lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / configure.ac
blobad246a64f37a3a81e6f875e71e1eabb6c71d78f6
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.5.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([--disable-optimized],
1198         [Whether to compile with optimization flags.
1199          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1200          otherwise.]))
1202 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1203     AS_HELP_STRING([--disable-runtime-optimizations],
1204         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1205          JVM JIT) that are known to interact badly with certain dynamic analysis
1206          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1207          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1208          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1210 AC_ARG_WITH(valgrind,
1211     AS_HELP_STRING([--with-valgrind],
1212         [Make availability of Valgrind headers a hard requirement.]))
1214 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1215     AS_HELP_STRING([--enable-compiler-plugins],
1216         [Enable compiler plugins that will perform additional checks during
1217          building. Enabled automatically by --enable-dbgutil.
1218          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1219 COMPILER_PLUGINS_DEBUG=
1220 if test "$enable_compiler_plugins" = debug; then
1221     enable_compiler_plugins=yes
1222     COMPILER_PLUGINS_DEBUG=TRUE
1225 libo_FUZZ_ARG_ENABLE(ooenv,
1226     AS_HELP_STRING([--disable-ooenv],
1227         [Disable ooenv for the instdir installation.]))
1229 libo_FUZZ_ARG_ENABLE(libnumbertext,
1230     AS_HELP_STRING([--disable-libnumbertext],
1231         [Disable use of numbertext external library.]))
1233 AC_ARG_ENABLE(lto,
1234     AS_HELP_STRING([--enable-lto],
1235         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1236          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1237          linker. For MSVC, this option is broken at the moment. This is experimental work
1238          in progress that shouldn't be used unless you are working on it.)]))
1240 AC_ARG_ENABLE(python,
1241     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1242         [Enables or disables Python support at run-time.
1243          Also specifies what Python to use. 'auto' is the default.
1244          'fully-internal' even forces the internal version for uses of Python
1245          during the build.]))
1247 libo_FUZZ_ARG_ENABLE(gtk3,
1248     AS_HELP_STRING([--disable-gtk3],
1249         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1250 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1252 AC_ARG_ENABLE(introspection,
1253     AS_HELP_STRING([--enable-introspection],
1254         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1255          Linux distributions.)]))
1257 AC_ARG_ENABLE(split-app-modules,
1258     AS_HELP_STRING([--enable-split-app-modules],
1259         [Split file lists for app modules, e.g. base, calc.
1260          Has effect only with make distro-pack-install]),
1263 AC_ARG_ENABLE(split-opt-features,
1264     AS_HELP_STRING([--enable-split-opt-features],
1265         [Split file lists for some optional features, e.g. pyuno, testtool.
1266          Has effect only with make distro-pack-install]),
1269 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1270     AS_HELP_STRING([--disable-cairo-canvas],
1271         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1274 libo_FUZZ_ARG_ENABLE(dbus,
1275     AS_HELP_STRING([--disable-dbus],
1276         [Determines whether to enable features that depend on dbus.
1277          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1278 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1280 libo_FUZZ_ARG_ENABLE(sdremote,
1281     AS_HELP_STRING([--disable-sdremote],
1282         [Determines whether to enable Impress remote control (i.e. the server component).]),
1283 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1285 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1286     AS_HELP_STRING([--disable-sdremote-bluetooth],
1287         [Determines whether to build sdremote with bluetooth support.
1288          Requires dbus on Linux.]))
1290 libo_FUZZ_ARG_ENABLE(gio,
1291     AS_HELP_STRING([--disable-gio],
1292         [Determines whether to use the GIO support.]),
1293 ,test "${enable_gio+set}" = set || enable_gio=yes)
1295 AC_ARG_ENABLE(qt5,
1296     AS_HELP_STRING([--enable-qt5],
1297         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1298          available.]),
1301 AC_ARG_ENABLE(kf5,
1302     AS_HELP_STRING([--enable-kf5],
1303         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1304          KF5 are available.]),
1307 AC_ARG_ENABLE(kde5,
1308     AS_HELP_STRING([--enable-kde5],
1309         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1312 AC_ARG_ENABLE(gtk3_kde5,
1313     AS_HELP_STRING([--enable-gtk3-kde5],
1314         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1315          platforms where Gtk3, Qt5 and Plasma is available.]),
1318 AC_ARG_ENABLE(gui,
1319     AS_HELP_STRING([--disable-gui],
1320         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1321 ,enable_gui=yes)
1323 libo_FUZZ_ARG_ENABLE(randr,
1324     AS_HELP_STRING([--disable-randr],
1325         [Disable RandR support in the vcl project.]),
1326 ,test "${enable_randr+set}" = set || enable_randr=yes)
1328 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1329     AS_HELP_STRING([--disable-gstreamer-1-0],
1330         [Disable building with the gstreamer 1.0 avmedia backend.]),
1331 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1333 libo_FUZZ_ARG_ENABLE(vlc,
1334     AS_HELP_STRING([--enable-vlc],
1335         [Enable building with the (experimental) VLC avmedia backend.]),
1336 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1338 libo_FUZZ_ARG_ENABLE(neon,
1339     AS_HELP_STRING([--disable-neon],
1340         [Disable neon and the compilation of webdav binding.]),
1343 libo_FUZZ_ARG_ENABLE([eot],
1344     [AS_HELP_STRING([--enable-eot],
1345         [Enable support for Embedded OpenType fonts.])],
1346 ,test "${enable_eot+set}" = set || enable_eot=no)
1348 libo_FUZZ_ARG_ENABLE(cve-tests,
1349     AS_HELP_STRING([--disable-cve-tests],
1350         [Prevent CVE tests to be executed]),
1353 libo_FUZZ_ARG_ENABLE(chart-tests,
1354     AS_HELP_STRING([--enable-chart-tests],
1355         [Executes chart XShape tests. In a perfect world these tests would be
1356          stable and everyone could run them, in reality it is best to run them
1357          only on a few machines that are known to work and maintained by people
1358          who can judge if a test failure is a regression or not.]),
1361 AC_ARG_ENABLE(build-unowinreg,
1362     AS_HELP_STRING([--enable-build-unowinreg],
1363         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1364          compiler is needed on Linux.]),
1367 AC_ARG_ENABLE(build-opensymbol,
1368     AS_HELP_STRING([--enable-build-opensymbol],
1369         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1370          fontforge installed.]),
1373 AC_ARG_ENABLE(dependency-tracking,
1374     AS_HELP_STRING([--enable-dependency-tracking],
1375         [Do not reject slow dependency extractors.])[
1376   --disable-dependency-tracking
1377                           Disables generation of dependency information.
1378                           Speed up one-time builds.],
1381 AC_ARG_ENABLE(icecream,
1382     AS_HELP_STRING([--enable-icecream],
1383         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1384          It defaults to /opt/icecream for the location of the icecream gcc/g++
1385          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1388 AC_ARG_ENABLE(ld,
1389     AS_HELP_STRING([--enable-ld=<linker>],
1390         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1391          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1394 libo_FUZZ_ARG_ENABLE(cups,
1395     AS_HELP_STRING([--disable-cups],
1396         [Do not build cups support.])
1399 AC_ARG_ENABLE(ccache,
1400     AS_HELP_STRING([--disable-ccache],
1401         [Do not try to use ccache automatically.
1402          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1403          CC/CXX are not yet set, and --enable-icecream is not given, we
1404          attempt to use ccache. --disable-ccache disables ccache completely.
1405          Additionally ccache's depend mode is enabled if possible,
1406          use --enable-ccache=nodepend to enable ccache without depend mode.
1410 AC_ARG_ENABLE(64-bit,
1411     AS_HELP_STRING([--enable-64-bit],
1412         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1413          At the moment meaningful only for Windows.]), ,)
1415 libo_FUZZ_ARG_ENABLE(online-update,
1416     AS_HELP_STRING([--enable-online-update],
1417         [Enable the online update service that will check for new versions of
1418          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1419          If the value is "mar", the experimental Mozilla-like update will be
1420          enabled instead of the traditional update mechanism.]),
1423 AC_ARG_WITH(update-config,
1424     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1425                    [Path to the update config ini file]))
1427 libo_FUZZ_ARG_ENABLE(extension-update,
1428     AS_HELP_STRING([--disable-extension-update],
1429         [Disable possibility to update installed extensions.]),
1432 libo_FUZZ_ARG_ENABLE(release-build,
1433     AS_HELP_STRING([--enable-release-build],
1434         [Enable release build. Note that the "release build" choice is orthogonal to
1435          whether symbols are present, debug info is generated, or optimization
1436          is done.
1437          See http://wiki.documentfoundation.org/Development/DevBuild]),
1440 AC_ARG_ENABLE(windows-build-signing,
1441     AS_HELP_STRING([--enable-windows-build-signing],
1442         [Enable signing of windows binaries (*.exe, *.dll)]),
1445 AC_ARG_ENABLE(silent-msi,
1446     AS_HELP_STRING([--enable-silent-msi],
1447         [Enable MSI with LIMITUI=1 (silent install).]),
1450 AC_ARG_ENABLE(macosx-code-signing,
1451     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1452         [Sign executables, dylibs, frameworks and the app bundle. If you
1453          don't provide an identity the first suitable certificate
1454          in your keychain is used.]),
1457 AC_ARG_ENABLE(macosx-package-signing,
1458     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1459         [Create a .pkg suitable for uploading to the Mac App Store and sign
1460          it. If you don't provide an identity the first suitable certificate
1461          in your keychain is used.]),
1464 AC_ARG_ENABLE(macosx-sandbox,
1465     AS_HELP_STRING([--enable-macosx-sandbox],
1466         [Make the app bundle run in a sandbox. Requires code signing.
1467          Is required by apps distributed in the Mac App Store, and implies
1468          adherence to App Store rules.]),
1471 AC_ARG_WITH(macosx-bundle-identifier,
1472     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1473         [Define the macOS bundle identifier. Default is the somewhat weird
1474          org.libreoffice.script ("script", huh?).]),
1475 ,with_macosx_bundle_identifier=org.libreoffice.script)
1477 AC_ARG_WITH(product-name,
1478     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1479         [Define the product name. Default is AC_PACKAGE_NAME.]),
1480 ,with_product_name=$PRODUCTNAME)
1482 AC_ARG_WITH(package-version,
1483     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1484         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1487 libo_FUZZ_ARG_ENABLE(readonly-installset,
1488     AS_HELP_STRING([--enable-readonly-installset],
1489         [Prevents any attempts by LibreOffice to write into its installation. That means
1490          at least that no "system-wide" extensions can be added. Partly experimental work in
1491          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1494 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1495     AS_HELP_STRING([--disable-postgresql-sdbc],
1496         [Disable the build of the PostgreSQL-SDBC driver.])
1499 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1500     AS_HELP_STRING([--disable-lotuswordpro],
1501         [Disable the build of the Lotus Word Pro filter.]),
1502 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1504 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1505     AS_HELP_STRING([--disable-firebird-sdbc],
1506         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1507 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1509 AC_ARG_ENABLE(bogus-pkg-config,
1510     AS_HELP_STRING([--enable-bogus-pkg-config],
1511         [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.]),
1514 AC_ARG_ENABLE(openssl,
1515     AS_HELP_STRING([--disable-openssl],
1516         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1517          components will either use GNUTLS or NSS. Work in progress,
1518          use only if you are hacking on it.]),
1519 ,enable_openssl=yes)
1521 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1522     AS_HELP_STRING([--enable-cipher-openssl-backend],
1523         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1524          Requires --enable-openssl.]))
1526 AC_ARG_ENABLE(library-bin-tar,
1527     AS_HELP_STRING([--enable-library-bin-tar],
1528         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1529         Some libraries can save their build result in a tarball
1530         stored in TARFILE_LOCATION. That binary tarball is
1531         uniquely identified by the source tarball,
1532         the content of the config_host.mk file and the content
1533         of the top-level directory in core for that library
1534         If this option is enabled, then if such a tarfile exist, it will be untarred
1535         instead of the source tarfile, and the build step will be skipped for that
1536         library.
1537         If a proper tarfile does not exist, then the normal source-based
1538         build is done for that library and a proper binary tarfile is created
1539         for the next time.]),
1542 AC_ARG_ENABLE(dconf,
1543     AS_HELP_STRING([--disable-dconf],
1544         [Disable the dconf configuration backend (enabled by default where
1545          available).]))
1547 libo_FUZZ_ARG_ENABLE(formula-logger,
1548     AS_HELP_STRING(
1549         [--enable-formula-logger],
1550         [Enable formula logger for logging formula calculation flow in Calc.]
1551     )
1554 AC_ARG_ENABLE(ldap,
1555     AS_HELP_STRING([--disable-ldap],
1556         [Disable LDAP support.]),
1557 ,enable_ldap=yes)
1559 dnl ===================================================================
1560 dnl Optional Packages (--with/without-)
1561 dnl ===================================================================
1563 AC_ARG_WITH(gcc-home,
1564     AS_HELP_STRING([--with-gcc-home],
1565         [Specify the location of gcc/g++ manually. This can be used in conjunction
1566          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1567          non-default path.]),
1570 AC_ARG_WITH(gnu-patch,
1571     AS_HELP_STRING([--with-gnu-patch],
1572         [Specify location of GNU patch on Solaris or FreeBSD.]),
1575 AC_ARG_WITH(build-platform-configure-options,
1576     AS_HELP_STRING([--with-build-platform-configure-options],
1577         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1580 AC_ARG_WITH(gnu-cp,
1581     AS_HELP_STRING([--with-gnu-cp],
1582         [Specify location of GNU cp on Solaris or FreeBSD.]),
1585 AC_ARG_WITH(external-tar,
1586     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1587         [Specify an absolute path of where to find (and store) tarfiles.]),
1588     TARFILE_LOCATION=$withval ,
1591 AC_ARG_WITH(referenced-git,
1592     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1593         [Specify another checkout directory to reference. This makes use of
1594                  git submodule update --reference, and saves a lot of diskspace
1595                  when having multiple trees side-by-side.]),
1596     GIT_REFERENCE_SRC=$withval ,
1599 AC_ARG_WITH(linked-git,
1600     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1601         [Specify a directory where the repositories of submodules are located.
1602          This uses a method similar to git-new-workdir to get submodules.]),
1603     GIT_LINK_SRC=$withval ,
1606 AC_ARG_WITH(galleries,
1607     AS_HELP_STRING([--with-galleries],
1608         [Specify how galleries should be built. It is possible either to
1609          build these internally from source ("build"),
1610          or to disable them ("no")]),
1613 AC_ARG_WITH(theme,
1614     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1615         [Choose which themes to include. By default those themes with an '*' are included.
1616          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1617          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *tango.]),
1620 libo_FUZZ_ARG_WITH(helppack-integration,
1621     AS_HELP_STRING([--without-helppack-integration],
1622         [It will not integrate the helppacks to the installer
1623          of the product. Please use this switch to use the online help
1624          or separate help packages.]),
1627 libo_FUZZ_ARG_WITH(fonts,
1628     AS_HELP_STRING([--without-fonts],
1629         [LibreOffice includes some third-party fonts to provide a reliable basis for
1630          help content, templates, samples, etc. When these fonts are already
1631          known to be available on the system then you should use this option.]),
1634 AC_ARG_WITH(epm,
1635     AS_HELP_STRING([--with-epm],
1636         [Decides which epm to use. Default is to use the one from the system if
1637          one is built. When either this is not there or you say =internal epm
1638          will be built.]),
1641 AC_ARG_WITH(package-format,
1642     AS_HELP_STRING([--with-package-format],
1643         [Specify package format(s) for LibreOffice installation sets. The
1644          implicit --without-package-format leads to no installation sets being
1645          generated. Possible values: aix, archive, bsd, deb, dmg,
1646          installed, msi, pkg, and rpm.
1647          Example: --with-package-format='deb rpm']),
1650 AC_ARG_WITH(tls,
1651     AS_HELP_STRING([--with-tls],
1652         [Decides which TLS/SSL and cryptographic implementations to use for
1653          LibreOffice's code. Notice that this doesn't apply for depending
1654          libraries like "neon", for example. Default is to use OpenSSL
1655          although NSS is also possible. Notice that selecting NSS restricts
1656          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1657          restrict by now the usage of NSS in LO's code. Possible values:
1658          openssl, nss. Example: --with-tls="nss"]),
1661 AC_ARG_WITH(system-libs,
1662     AS_HELP_STRING([--with-system-libs],
1663         [Use libraries already on system -- enables all --with-system-* flags.]),
1666 AC_ARG_WITH(system-bzip2,
1667     AS_HELP_STRING([--with-system-bzip2],
1668         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1669     [with_system_bzip2="$with_system_libs"])
1671 AC_ARG_WITH(system-headers,
1672     AS_HELP_STRING([--with-system-headers],
1673         [Use headers already on system -- enables all --with-system-* flags for
1674          external packages whose headers are the only entities used i.e.
1675          boost/odbc/sane-header(s).]),,
1676     [with_system_headers="$with_system_libs"])
1678 AC_ARG_WITH(system-jars,
1679     AS_HELP_STRING([--without-system-jars],
1680         [When building with --with-system-libs, also the needed jars are expected
1681          on the system. Use this to disable that]),,
1682     [with_system_jars="$with_system_libs"])
1684 AC_ARG_WITH(system-cairo,
1685     AS_HELP_STRING([--with-system-cairo],
1686         [Use cairo libraries already on system.  Happens automatically for
1687          (implicit) --enable-gtk3.]))
1689 AC_ARG_WITH(system-epoxy,
1690     AS_HELP_STRING([--with-system-epoxy],
1691         [Use epoxy libraries already on system.  Happens automatically for
1692          (implicit) --enable-gtk3.]),,
1693        [with_system_epoxy="$with_system_libs"])
1695 AC_ARG_WITH(myspell-dicts,
1696     AS_HELP_STRING([--with-myspell-dicts],
1697         [Adds myspell dictionaries to the LibreOffice installation set]),
1700 AC_ARG_WITH(system-dicts,
1701     AS_HELP_STRING([--without-system-dicts],
1702         [Do not use dictionaries from system paths.]),
1705 AC_ARG_WITH(external-dict-dir,
1706     AS_HELP_STRING([--with-external-dict-dir],
1707         [Specify external dictionary dir.]),
1710 AC_ARG_WITH(external-hyph-dir,
1711     AS_HELP_STRING([--with-external-hyph-dir],
1712         [Specify external hyphenation pattern dir.]),
1715 AC_ARG_WITH(external-thes-dir,
1716     AS_HELP_STRING([--with-external-thes-dir],
1717         [Specify external thesaurus dir.]),
1720 AC_ARG_WITH(system-zlib,
1721     AS_HELP_STRING([--with-system-zlib],
1722         [Use zlib already on system.]),,
1723     [with_system_zlib=auto])
1725 AC_ARG_WITH(system-jpeg,
1726     AS_HELP_STRING([--with-system-jpeg],
1727         [Use jpeg already on system.]),,
1728     [with_system_jpeg="$with_system_libs"])
1730 AC_ARG_WITH(system-clucene,
1731     AS_HELP_STRING([--with-system-clucene],
1732         [Use clucene already on system.]),,
1733     [with_system_clucene="$with_system_libs"])
1735 AC_ARG_WITH(system-expat,
1736     AS_HELP_STRING([--with-system-expat],
1737         [Use expat already on system.]),,
1738     [with_system_expat="$with_system_libs"])
1740 AC_ARG_WITH(system-libxml,
1741     AS_HELP_STRING([--with-system-libxml],
1742         [Use libxml/libxslt already on system.]),,
1743     [with_system_libxml=auto])
1745 AC_ARG_WITH(system-icu,
1746     AS_HELP_STRING([--with-system-icu],
1747         [Use icu already on system.]),,
1748     [with_system_icu="$with_system_libs"])
1750 AC_ARG_WITH(system-ucpp,
1751     AS_HELP_STRING([--with-system-ucpp],
1752         [Use ucpp already on system.]),,
1753     [])
1755 AC_ARG_WITH(system-openldap,
1756     AS_HELP_STRING([--with-system-openldap],
1757         [Use the OpenLDAP LDAP SDK already on system.]),,
1758     [with_system_openldap="$with_system_libs"])
1760 libo_FUZZ_ARG_ENABLE(poppler,
1761     AS_HELP_STRING([--disable-poppler],
1762         [Disable building Poppler.])
1765 AC_ARG_WITH(system-poppler,
1766     AS_HELP_STRING([--with-system-poppler],
1767         [Use system poppler (only needed for PDF import).]),,
1768     [with_system_poppler="$with_system_libs"])
1770 AC_ARG_WITH(system-gpgmepp,
1771     AS_HELP_STRING([--with-system-gpgmepp],
1772         [Use gpgmepp already on system]),,
1773     [with_system_gpgmepp="$with_system_libs"])
1775 AC_ARG_WITH(system-apache-commons,
1776     AS_HELP_STRING([--with-system-apache-commons],
1777         [Use Apache commons libraries already on system.]),,
1778     [with_system_apache_commons="$with_system_jars"])
1780 AC_ARG_WITH(system-mariadb,
1781     AS_HELP_STRING([--with-system-mariadb],
1782         [Use MariaDB/MySQL libraries already on system.]),,
1783     [with_system_mariadb="$with_system_libs"])
1785 AC_ARG_ENABLE(bundle-mariadb,
1786     AS_HELP_STRING([--enable-bundle-mariadb],
1787         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1790 AC_ARG_WITH(system-postgresql,
1791     AS_HELP_STRING([--with-system-postgresql],
1792         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1793          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1794     [with_system_postgresql="$with_system_libs"])
1796 AC_ARG_WITH(libpq-path,
1797     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1798         [Use this PostgreSQL C interface (libpq) installation for building
1799          the PostgreSQL-SDBC extension.]),
1802 AC_ARG_WITH(system-firebird,
1803     AS_HELP_STRING([--with-system-firebird],
1804         [Use Firebird libraries already on system, for building the Firebird-SDBC
1805          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1806     [with_system_firebird="$with_system_libs"])
1808 AC_ARG_WITH(system-libtommath,
1809             AS_HELP_STRING([--with-system-libtommath],
1810                            [Use libtommath already on system]),,
1811             [with_system_libtommath="$with_system_libs"])
1813 AC_ARG_WITH(system-hsqldb,
1814     AS_HELP_STRING([--with-system-hsqldb],
1815         [Use hsqldb already on system.]))
1817 AC_ARG_WITH(hsqldb-jar,
1818     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1819         [Specify path to jarfile manually.]),
1820     HSQLDB_JAR=$withval)
1822 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1823     AS_HELP_STRING([--disable-scripting-beanshell],
1824         [Disable support for scripts in BeanShell.]),
1828 AC_ARG_WITH(system-beanshell,
1829     AS_HELP_STRING([--with-system-beanshell],
1830         [Use beanshell already on system.]),,
1831     [with_system_beanshell="$with_system_jars"])
1833 AC_ARG_WITH(beanshell-jar,
1834     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     BSH_JAR=$withval)
1838 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1839     AS_HELP_STRING([--disable-scripting-javascript],
1840         [Disable support for scripts in JavaScript.]),
1844 AC_ARG_WITH(system-rhino,
1845     AS_HELP_STRING([--with-system-rhino],
1846         [Use rhino already on system.]),,)
1847 #    [with_system_rhino="$with_system_jars"])
1848 # Above is not used as we have different debug interface
1849 # patched into internal rhino. This code needs to be fixed
1850 # before we can enable it by default.
1852 AC_ARG_WITH(rhino-jar,
1853     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     RHINO_JAR=$withval)
1857 AC_ARG_WITH(commons-logging-jar,
1858     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     COMMONS_LOGGING_JAR=$withval)
1862 AC_ARG_WITH(system-jfreereport,
1863     AS_HELP_STRING([--with-system-jfreereport],
1864         [Use JFreeReport already on system.]),,
1865     [with_system_jfreereport="$with_system_jars"])
1867 AC_ARG_WITH(sac-jar,
1868     AS_HELP_STRING([--with-sac-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     SAC_JAR=$withval)
1872 AC_ARG_WITH(libxml-jar,
1873     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBXML_JAR=$withval)
1877 AC_ARG_WITH(flute-jar,
1878     AS_HELP_STRING([--with-flute-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     FLUTE_JAR=$withval)
1882 AC_ARG_WITH(jfreereport-jar,
1883     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     JFREEREPORT_JAR=$withval)
1887 AC_ARG_WITH(liblayout-jar,
1888     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBLAYOUT_JAR=$withval)
1892 AC_ARG_WITH(libloader-jar,
1893     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBLOADER_JAR=$withval)
1897 AC_ARG_WITH(libformula-jar,
1898     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBFORMULA_JAR=$withval)
1902 AC_ARG_WITH(librepository-jar,
1903     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBREPOSITORY_JAR=$withval)
1907 AC_ARG_WITH(libfonts-jar,
1908     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBFONTS_JAR=$withval)
1912 AC_ARG_WITH(libserializer-jar,
1913     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBSERIALIZER_JAR=$withval)
1917 AC_ARG_WITH(libbase-jar,
1918     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1919         [Specify path to jarfile manually.]),
1920     LIBBASE_JAR=$withval)
1922 AC_ARG_WITH(system-odbc,
1923     AS_HELP_STRING([--with-system-odbc],
1924         [Use the odbc headers already on system.]),,
1925     [with_system_odbc="auto"])
1927 AC_ARG_WITH(system-sane,
1928     AS_HELP_STRING([--with-system-sane],
1929         [Use sane.h already on system.]),,
1930     [with_system_sane="$with_system_headers"])
1932 AC_ARG_WITH(system-bluez,
1933     AS_HELP_STRING([--with-system-bluez],
1934         [Use bluetooth.h already on system.]),,
1935     [with_system_bluez="$with_system_headers"])
1937 AC_ARG_WITH(system-curl,
1938     AS_HELP_STRING([--with-system-curl],
1939         [Use curl already on system.]),,
1940     [with_system_curl=auto])
1942 AC_ARG_WITH(system-boost,
1943     AS_HELP_STRING([--with-system-boost],
1944         [Use boost already on system.]),,
1945     [with_system_boost="$with_system_headers"])
1947 AC_ARG_WITH(system-glm,
1948     AS_HELP_STRING([--with-system-glm],
1949         [Use glm already on system.]),,
1950     [with_system_glm="$with_system_headers"])
1952 AC_ARG_WITH(system-hunspell,
1953     AS_HELP_STRING([--with-system-hunspell],
1954         [Use libhunspell already on system.]),,
1955     [with_system_hunspell="$with_system_libs"])
1957 AC_ARG_WITH(system-qrcodegen,
1958     AS_HELP_STRING([--with-system-qrcodegen],
1959         [Use libqrcodegen already on system.]),,
1960     [with_system_qrcodegen="$with_system_libs"])
1962 AC_ARG_WITH(system-mythes,
1963     AS_HELP_STRING([--with-system-mythes],
1964         [Use mythes already on system.]),,
1965     [with_system_mythes="$with_system_libs"])
1967 AC_ARG_WITH(system-altlinuxhyph,
1968     AS_HELP_STRING([--with-system-altlinuxhyph],
1969         [Use ALTLinuxhyph already on system.]),,
1970     [with_system_altlinuxhyph="$with_system_libs"])
1972 AC_ARG_WITH(system-lpsolve,
1973     AS_HELP_STRING([--with-system-lpsolve],
1974         [Use lpsolve already on system.]),,
1975     [with_system_lpsolve="$with_system_libs"])
1977 AC_ARG_WITH(system-coinmp,
1978     AS_HELP_STRING([--with-system-coinmp],
1979         [Use CoinMP already on system.]),,
1980     [with_system_coinmp="$with_system_libs"])
1982 AC_ARG_WITH(system-liblangtag,
1983     AS_HELP_STRING([--with-system-liblangtag],
1984         [Use liblangtag library already on system.]),,
1985     [with_system_liblangtag="$with_system_libs"])
1987 AC_ARG_WITH(webdav,
1988     AS_HELP_STRING([--with-webdav],
1989         [Specify which library to use for webdav implementation.
1990          Possible values: "neon", "serf", "no". The default value is "neon".
1991          Example: --with-webdav="serf"]),
1992     WITH_WEBDAV=$withval,
1993     WITH_WEBDAV="neon")
1995 AC_ARG_WITH(linker-hash-style,
1996     AS_HELP_STRING([--with-linker-hash-style],
1997         [Use linker with --hash-style=<style> when linking shared objects.
1998          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1999          if supported on the build system, and "sysv" otherwise.]))
2001 AC_ARG_WITH(jdk-home,
2002     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2003         [If you have installed JDK 8 or later on your system please supply the
2004          path here. Note that this is not the location of the java command but the
2005          location of the entire distribution.]),
2008 AC_ARG_WITH(help,
2009     AS_HELP_STRING([--with-help],
2010         [Enable the build of help. There is a special parameter "common" that
2011          can be used to bundle only the common part, .e.g help-specific icons.
2012          This is useful when you build the helpcontent separately.])
2013     [
2014                           Usage:     --with-help    build the old local help
2015                                  --without-help     no local help (default)
2016                                  --with-help=html   build the new HTML local help
2017                                  --with-help=online build the new HTML online help
2018     ],
2021 AC_ARG_WITH(omindex,
2022    AS_HELP_STRING([--with-omindex],
2023         [Enable the support of xapian-omega index for online help.])
2024    [
2025                          Usage: --with-omindex=server prepare the pages for omindex
2026                                 but let xapian-omega be built in server.
2027                                 --with-omindex=noxap do not prepare online pages
2028                                 for xapian-omega
2029   ],
2032 libo_FUZZ_ARG_WITH(java,
2033     AS_HELP_STRING([--with-java=<java command>],
2034         [Specify the name of the Java interpreter command. Typically "java"
2035          which is the default.
2037          To build without support for Java components, applets, accessibility
2038          or the XML filters written in Java, use --without-java or --with-java=no.]),
2039     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2040     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2043 AC_ARG_WITH(jvm-path,
2044     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2045         [Use a specific JVM search path at runtime.
2046          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2049 AC_ARG_WITH(ant-home,
2050     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2051         [If you have installed Apache Ant on your system, please supply the path here.
2052          Note that this is not the location of the Ant binary but the location
2053          of the entire distribution.]),
2056 AC_ARG_WITH(symbol-config,
2057     AS_HELP_STRING([--with-symbol-config],
2058         [Configuration for the crashreport symbol upload]),
2059         [],
2060         [with_symbol_config=no])
2062 AC_ARG_WITH(export-validation,
2063     AS_HELP_STRING([--without-export-validation],
2064         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2065 ,with_export_validation=auto)
2067 AC_ARG_WITH(bffvalidator,
2068     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2069         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2070          Requires installed Microsoft Office Binary File Format Validator.
2071          Note: export-validation (--with-export-validation) is required to be turned on.
2072          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2073 ,with_bffvalidator=no)
2075 libo_FUZZ_ARG_WITH(junit,
2076     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2077         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2078          --without-junit disables those tests. Not relevant in the --without-java case.]),
2079 ,with_junit=yes)
2081 AC_ARG_WITH(hamcrest,
2082     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2083         [Specifies the hamcrest jar file to use for JUnit-based tests.
2084          --without-junit disables those tests. Not relevant in the --without-java case.]),
2085 ,with_hamcrest=yes)
2087 AC_ARG_WITH(perl-home,
2088     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2089         [If you have installed Perl 5 Distribution, on your system, please
2090          supply the path here. Note that this is not the location of the Perl
2091          binary but the location of the entire distribution.]),
2094 libo_FUZZ_ARG_WITH(doxygen,
2095     AS_HELP_STRING(
2096         [--with-doxygen=<absolute path to doxygen executable>],
2097         [Specifies the doxygen executable to use when generating ODK C/C++
2098          documentation. --without-doxygen disables generation of ODK C/C++
2099          documentation. Not relevant in the --disable-odk case.]),
2100 ,with_doxygen=yes)
2102 AC_ARG_WITH(visual-studio,
2103     AS_HELP_STRING([--with-visual-studio=<2017>],
2104         [Specify which Visual Studio version to use in case several are
2105          installed. Currently only 2017 is supported.]),
2108 AC_ARG_WITH(windows-sdk,
2109     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2110         [Specify which Windows SDK, or "Windows Kit", version to use
2111          in case the one that came with the selected Visual Studio
2112          is not what you want for some reason. Note that not all compiler/SDK
2113          combinations are supported. The intent is that this option should not
2114          be needed.]),
2117 AC_ARG_WITH(lang,
2118     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2119         [Use this option to build LibreOffice with additional UI language support.
2120          English (US) is always included by default.
2121          Separate multiple languages with space.
2122          For all languages, use --with-lang=ALL.]),
2125 AC_ARG_WITH(locales,
2126     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2127         [Use this option to limit the locale information built in.
2128          Separate multiple locales with space.
2129          Very experimental and might well break stuff.
2130          Just a desperate measure to shrink code and data size.
2131          By default all the locales available is included.
2132          This option is completely unrelated to --with-lang.])
2133     [
2134                           Affects also our character encoding conversion
2135                           tables for encodings mainly targeted for a
2136                           particular locale, like EUC-CN and EUC-TW for
2137                           zh, ISO-2022-JP for ja.
2139                           Affects also our add-on break iterator data for
2140                           some languages.
2142                           For the default, all locales, don't use this switch at all.
2143                           Specifying just the language part of a locale means all matching
2144                           locales will be included.
2145     ],
2148 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2149 libo_FUZZ_ARG_WITH(krb5,
2150     AS_HELP_STRING([--with-krb5],
2151         [Enable MIT Kerberos 5 support in modules that support it.
2152          By default automatically enabled on platforms
2153          where a good system Kerberos 5 is available.]),
2156 libo_FUZZ_ARG_WITH(gssapi,
2157     AS_HELP_STRING([--with-gssapi],
2158         [Enable GSSAPI support in modules that support it.
2159          By default automatically enabled on platforms
2160          where a good system GSSAPI is available.]),
2163 AC_ARG_WITH(iwyu,
2164     AS_HELP_STRING([--with-iwyu],
2165         [Use given IWYU binary path to check unneeded includes instead of building.
2166          Use only if you are hacking on it.]),
2169 libo_FUZZ_ARG_WITH(lxml,
2170     AS_HELP_STRING([--without-lxml],
2171         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2172          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2173          report widget classes and ids.]),
2176 dnl ===================================================================
2177 dnl Branding
2178 dnl ===================================================================
2180 AC_ARG_WITH(branding,
2181     AS_HELP_STRING([--with-branding=/path/to/images],
2182         [Use given path to retrieve branding images set.])
2183     [
2184                           Search for intro.png about.svg and flat_logo.svg.
2185                           If any is missing, default ones will be used instead.
2187                           Search also progress.conf for progress
2188                           settings on intro screen :
2190                           PROGRESSBARCOLOR="255,255,255" Set color of
2191                           progress bar. Comma separated RGB decimal values.
2192                           PROGRESSSIZE="407,6" Set size of progress bar.
2193                           Comma separated decimal values (width, height).
2194                           PROGRESSPOSITION="61,317" Set position of progress
2195                           bar from left,top. Comma separated decimal values.
2196                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2197                           bar frame. Comma separated RGB decimal values.
2198                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2199                           bar text. Comma separated RGB decimal values.
2200                           PROGRESSTEXTBASELINE="287" Set vertical position of
2201                           progress bar text from top. Decimal value.
2203                           Default values will be used if not found.
2204     ],
2208 AC_ARG_WITH(extra-buildid,
2209     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2210         [Show addition build identification in about dialog.]),
2214 AC_ARG_WITH(vendor,
2215     AS_HELP_STRING([--with-vendor="John the Builder"],
2216         [Set vendor of the build.]),
2219 AC_ARG_WITH(android-package-name,
2220     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2221         [Set Android package name of the build.]),
2224 AC_ARG_WITH(compat-oowrappers,
2225     AS_HELP_STRING([--with-compat-oowrappers],
2226         [Install oo* wrappers in parallel with
2227          lo* ones to keep backward compatibility.
2228          Has effect only with make distro-pack-install]),
2231 AC_ARG_WITH(os-version,
2232     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2233         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2236 AC_ARG_WITH(mingw-cross-compiler,
2237     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2238         [Specify the MinGW cross-compiler to use.
2239          When building on the ODK on Unix and building unowinreg.dll,
2240          specify the MinGW C++ cross-compiler.]),
2243 AC_ARG_WITH(idlc-cpp,
2244     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2245         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2248 AC_ARG_WITH(build-version,
2249     AS_HELP_STRING([--with-build-version="Built by Jim"],
2250         [Allows the builder to add a custom version tag that will appear in the
2251          Help/About box for QA purposes.]),
2252 with_build_version=$withval,
2255 AC_ARG_WITH(parallelism,
2256     AS_HELP_STRING([--with-parallelism],
2257         [Number of jobs to run simultaneously during build. Parallel builds can
2258         save a lot of time on multi-cpu machines. Defaults to the number of
2259         CPUs on the machine, unless you configure --enable-icecream - then to
2260         40.]),
2263 AC_ARG_WITH(all-tarballs,
2264     AS_HELP_STRING([--with-all-tarballs],
2265         [Download all external tarballs unconditionally]))
2267 AC_ARG_WITH(gdrive-client-id,
2268     AS_HELP_STRING([--with-gdrive-client-id],
2269         [Provides the client id of the application for OAuth2 authentication
2270         on Google Drive. If either this or --with-gdrive-client-secret is
2271         empty, the feature will be disabled]),
2274 AC_ARG_WITH(gdrive-client-secret,
2275     AS_HELP_STRING([--with-gdrive-client-secret],
2276         [Provides the client secret of the application for OAuth2
2277         authentication on Google Drive. If either this or
2278         --with-gdrive-client-id is empty, the feature will be disabled]),
2281 AC_ARG_WITH(alfresco-cloud-client-id,
2282     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2283         [Provides the client id of the application for OAuth2 authentication
2284         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2285         empty, the feature will be disabled]),
2288 AC_ARG_WITH(alfresco-cloud-client-secret,
2289     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2290         [Provides the client secret of the application for OAuth2
2291         authentication on Alfresco Cloud. If either this or
2292         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2295 AC_ARG_WITH(onedrive-client-id,
2296     AS_HELP_STRING([--with-onedrive-client-id],
2297         [Provides the client id of the application for OAuth2 authentication
2298         on OneDrive. If either this or --with-onedrive-client-secret is
2299         empty, the feature will be disabled]),
2302 AC_ARG_WITH(onedrive-client-secret,
2303     AS_HELP_STRING([--with-onedrive-client-secret],
2304         [Provides the client secret of the application for OAuth2
2305         authentication on OneDrive. If either this or
2306         --with-onedrive-client-id is empty, the feature will be disabled]),
2308 dnl ===================================================================
2309 dnl Do we want to use pre-build binary tarball for recompile
2310 dnl ===================================================================
2312 if test "$enable_library_bin_tar" = "yes" ; then
2313     USE_LIBRARY_BIN_TAR=TRUE
2314 else
2315     USE_LIBRARY_BIN_TAR=
2317 AC_SUBST(USE_LIBRARY_BIN_TAR)
2319 dnl ===================================================================
2320 dnl Test whether build target is Release Build
2321 dnl ===================================================================
2322 AC_MSG_CHECKING([whether build target is Release Build])
2323 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2324     AC_MSG_RESULT([no])
2325     ENABLE_RELEASE_BUILD=
2326 else
2327     AC_MSG_RESULT([yes])
2328     ENABLE_RELEASE_BUILD=TRUE
2330 AC_SUBST(ENABLE_RELEASE_BUILD)
2332 dnl ===================================================================
2333 dnl Test whether to sign Windows Build
2334 dnl ===================================================================
2335 AC_MSG_CHECKING([whether to sign windows build])
2336 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2337     AC_MSG_RESULT([yes])
2338     WINDOWS_BUILD_SIGNING="TRUE"
2339 else
2340     AC_MSG_RESULT([no])
2341     WINDOWS_BUILD_SIGNING="FALSE"
2343 AC_SUBST(WINDOWS_BUILD_SIGNING)
2345 dnl ===================================================================
2346 dnl MacOSX build and runtime environment options
2347 dnl ===================================================================
2349 AC_ARG_WITH(macosx-sdk,
2350     AS_HELP_STRING([--with-macosx-sdk=<version>],
2351         [Prefer a specific SDK for building.])
2352     [
2353                           If the requested SDK is not available, a search for the oldest one will be done.
2354                           With current Xcode versions, only the latest SDK is included, so this option is
2355                           not terribly useful. It works fine to build with a new SDK and run the result
2356                           on an older OS.
2358                           e. g.: --with-macosx-sdk=10.10
2360                           there are 3 options to control the MacOSX build:
2361                           --with-macosx-sdk (referred as 'sdk' below)
2362                           --with-macosx-version-min-required (referred as 'min' below)
2363                           --with-macosx-version-max-allowed (referred as 'max' below)
2365                           the connection between these value and the default they take is as follow:
2366                           ( ? means not specified on the command line, s means the SDK version found,
2367                           constraint: 8 <= x <= y <= z)
2369                           ==========================================
2370                            command line      || config result
2371                           ==========================================
2372                           min  | max  | sdk  || min   | max  | sdk  |
2373                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2374                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2375                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2376                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2377                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2378                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2379                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2380                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2383                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2384                           for a detailed technical explanation of these variables
2386                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2387     ],
2390 AC_ARG_WITH(macosx-version-min-required,
2391     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2392         [set the minimum OS version needed to run the built LibreOffice])
2393     [
2394                           e. g.: --with-macos-version-min-required=10.10
2395                           see --with-macosx-sdk for more info
2396     ],
2399 AC_ARG_WITH(macosx-version-max-allowed,
2400     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2401         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2402     [
2403                           e. g.: --with-macos-version-max-allowed=10.10
2404                           see --with-macosx-sdk for more info
2405     ],
2409 dnl ===================================================================
2410 dnl options for stuff used during cross-compilation build
2411 dnl Not quite superseded by --with-build-platform-configure-options.
2412 dnl TODO: check, if the "force" option is still needed anywhere.
2413 dnl ===================================================================
2415 AC_ARG_WITH(system-icu-for-build,
2416     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2417         [Use icu already on system for build tools (cross-compilation only).]))
2420 dnl ===================================================================
2421 dnl Check for incompatible options set by fuzzing, and reset those
2422 dnl automatically to working combinations
2423 dnl ===================================================================
2425 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2426         "$enable_dbus" != "$enable_avahi"; then
2427     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2428     enable_avahi=$enable_dbus
2431 add_lopath_after ()
2433     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2434         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2435     fi
2438 add_lopath_before ()
2440     local IFS=${P_SEP}
2441     local path_cleanup
2442     local dir
2443     for dir in $LO_PATH ; do
2444         if test "$dir" != "$1" ; then
2445             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2446         fi
2447     done
2448     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2451 dnl ===================================================================
2452 dnl check for required programs (grep, awk, sed, bash)
2453 dnl ===================================================================
2455 pathmunge ()
2457     if test -n "$1"; then
2458         if test "$build_os" = "cygwin"; then
2459             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2460                 PathFormat "$1"
2461                 new_path=`cygpath -sm "$formatted_path"`
2462             else
2463                 PathFormat "$1"
2464                 new_path=`cygpath -u "$formatted_path"`
2465             fi
2466         else
2467             new_path="$1"
2468         fi
2469         if test "$2" = "after"; then
2470             add_lopath_after "$new_path"
2471         else
2472             add_lopath_before "$new_path"
2473         fi
2474         unset new_path
2475     fi
2478 AC_PROG_AWK
2479 AC_PATH_PROG( AWK, $AWK)
2480 if test -z "$AWK"; then
2481     AC_MSG_ERROR([install awk to run this script])
2484 AC_PATH_PROG(BASH, bash)
2485 if test -z "$BASH"; then
2486     AC_MSG_ERROR([bash not found in \$PATH])
2488 AC_SUBST(BASH)
2490 AC_MSG_CHECKING([for GNU or BSD tar])
2491 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2492     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2493     if test $? -eq 0;  then
2494         GNUTAR=$a
2495         break
2496     fi
2497 done
2498 AC_MSG_RESULT($GNUTAR)
2499 if test -z "$GNUTAR"; then
2500     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2502 AC_SUBST(GNUTAR)
2504 AC_MSG_CHECKING([for tar's option to strip components])
2505 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2506 if test $? -eq 0; then
2507     STRIP_COMPONENTS="--strip-components"
2508 else
2509     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2510     if test $? -eq 0; then
2511         STRIP_COMPONENTS="--strip-path"
2512     else
2513         STRIP_COMPONENTS="unsupported"
2514     fi
2516 AC_MSG_RESULT($STRIP_COMPONENTS)
2517 if test x$STRIP_COMPONENTS = xunsupported; then
2518     AC_MSG_ERROR([you need a tar that is able to strip components.])
2520 AC_SUBST(STRIP_COMPONENTS)
2522 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2523 dnl desktop OSes from "mobile" ones.
2525 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2526 dnl In other words, that when building for an OS that is not a
2527 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2529 dnl Note the direction of the implication; there is no assumption that
2530 dnl cross-compiling would imply a non-desktop OS.
2532 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2533     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2534     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2535     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2538 # Whether to build "avmedia" functionality or not.
2540 if test -z "$enable_avmedia"; then
2541     enable_avmedia=yes
2544 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2545 if test "$enable_avmedia" = yes; then
2546     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2547 else
2548     USE_AVMEDIA_DUMMY='TRUE'
2550 AC_SUBST(USE_AVMEDIA_DUMMY)
2552 # Decide whether to build database connectivity stuff (including
2553 # Base) or not. We probably don't want to on non-desktop OSes.
2554 if test -z "$enable_database_connectivity"; then
2555     # --disable-database-connectivity is unfinished work in progress
2556     # and the iOS test app doesn't link if we actually try to use it.
2557     # if test $_os != iOS -a $_os != Android; then
2558     if test $_os != iOS; then
2559         enable_database_connectivity=yes
2560     fi
2563 if test "$enable_database_connectivity" = yes; then
2564     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2565     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2568 if test -z "$enable_extensions"; then
2569     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2570     if test $_os != iOS -a $_os != Android; then
2571         enable_extensions=yes
2572     fi
2575 if test "$enable_extensions" = yes; then
2576     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2577     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2580 if test -z "$enable_scripting"; then
2581     # Disable scripting for iOS unless specifically overridden
2582     # with --enable-scripting.
2583     if test $_os != iOS; then
2584         enable_scripting=yes
2585     fi
2588 DISABLE_SCRIPTING=''
2589 if test "$enable_scripting" = yes; then
2590     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2591     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2592 else
2593     DISABLE_SCRIPTING='TRUE'
2594     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2597 if test $_os = iOS -o $_os = Android; then
2598     # Disable dynamic_loading always for iOS and Android
2599     enable_dynamic_loading=no
2600 elif test -z "$enable_dynamic_loading"; then
2601     # Otherwise enable it unless specifically disabled
2602     enable_dynamic_loading=yes
2605 DISABLE_DYNLOADING=''
2606 if test "$enable_dynamic_loading" = yes; then
2607     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2608 else
2609     DISABLE_DYNLOADING='TRUE'
2611 AC_SUBST(DISABLE_DYNLOADING)
2613 # remember SYSBASE value
2614 AC_SUBST(SYSBASE)
2616 dnl ===================================================================
2617 dnl  Sort out various gallery compilation options
2618 dnl ===================================================================
2619 AC_MSG_CHECKING([how to build and package galleries])
2620 if test -n "${with_galleries}"; then
2621     if test "$with_galleries" = "build"; then
2622         WITH_GALLERY_BUILD=TRUE
2623         AC_MSG_RESULT([build from source images internally])
2624     elif test "$with_galleries" = "no"; then
2625         WITH_GALLERY_BUILD=
2626         AC_MSG_RESULT([disable non-internal gallery build])
2627     else
2628         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2629     fi
2630 else
2631     if test $_os != iOS -a $_os != Android; then
2632         WITH_GALLERY_BUILD=TRUE
2633         AC_MSG_RESULT([internal src images for desktop])
2634     else
2635         WITH_GALLERY_BUILD=
2636         AC_MSG_RESULT([disable src image build])
2637     fi
2639 AC_SUBST(WITH_GALLERY_BUILD)
2641 dnl ===================================================================
2642 dnl  Checks if ccache is available
2643 dnl ===================================================================
2644 CCACHE_DEPEND_MODE=
2645 if test "$_os" = "WINNT"; then
2646     # on windows/VC build do not use ccache
2647     CCACHE=""
2648 elif test "$enable_ccache" = "no"; then
2649     CCACHE=""
2650 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2651     case "%$CC%$CXX%" in
2652     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2653     # assume that's good then
2654     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2655         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2656         CCACHE_DEPEND_MODE=1
2657         ;;
2658     *)
2659         AC_PATH_PROG([CCACHE],[ccache],[not found])
2660         if test "$CCACHE" = "not found"; then
2661             CCACHE=""
2662         else
2663             CCACHE_DEPEND_MODE=1
2664             # Need to check for ccache version: otherwise prevents
2665             # caching of the results (like "-x objective-c++" for Mac)
2666             if test $_os = Darwin -o $_os = iOS; then
2667                 # Check ccache version
2668                 AC_MSG_CHECKING([whether version of ccache is suitable])
2669                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2670                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2671                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2672                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2673                 else
2674                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2675                     CCACHE=""
2676                     CCACHE_DEPEND_MODE=
2677                 fi
2678             fi
2679         fi
2680         ;;
2681     esac
2682 else
2683     CCACHE=""
2685 if test "$enable_ccache" = "nodepend"; then
2686     CCACHE_DEPEND_MODE=""
2688 AC_SUBST(CCACHE_DEPEND_MODE)
2690 if test "$CCACHE" != ""; then
2691     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2692     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2693     if test "$ccache_size" = ""; then
2694         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2695         if test "$ccache_size" = ""; then
2696             ccache_size=0
2697         fi
2698         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2699         if test $ccache_size -lt 1024; then
2700             CCACHE=""
2701             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2702             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2703         else
2704             # warn that ccache may be too small for debug build
2705             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2706             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2707         fi
2708     else
2709         if test $ccache_size -lt 5; then
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     fi
2717 dnl ===================================================================
2718 dnl  Checks for C compiler,
2719 dnl  The check for the C++ compiler is later on.
2720 dnl ===================================================================
2721 if test "$_os" != "WINNT"; then
2722     GCC_HOME_SET="true"
2723     AC_MSG_CHECKING([gcc home])
2724     if test -z "$with_gcc_home"; then
2725         if test "$enable_icecream" = "yes"; then
2726             if test -d "/usr/lib/icecc/bin"; then
2727                 GCC_HOME="/usr/lib/icecc/"
2728             elif test -d "/usr/libexec/icecc/bin"; then
2729                 GCC_HOME="/usr/libexec/icecc/"
2730             elif test -d "/opt/icecream/bin"; then
2731                 GCC_HOME="/opt/icecream/"
2732             else
2733                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2735             fi
2736         else
2737             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2738             GCC_HOME_SET="false"
2739         fi
2740     else
2741         GCC_HOME="$with_gcc_home"
2742     fi
2743     AC_MSG_RESULT($GCC_HOME)
2744     AC_SUBST(GCC_HOME)
2746     if test "$GCC_HOME_SET" = "true"; then
2747         if test -z "$CC"; then
2748             CC="$GCC_HOME/bin/gcc"
2749             CC_BASE="gcc"
2750         fi
2751         if test -z "$CXX"; then
2752             CXX="$GCC_HOME/bin/g++"
2753             CXX_BASE="g++"
2754         fi
2755     fi
2758 COMPATH=`dirname "$CC"`
2759 if test "$COMPATH" = "."; then
2760     AC_PATH_PROGS(COMPATH, $CC)
2761     dnl double square bracket to get single because of M4 quote...
2762     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2764 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2766 dnl ===================================================================
2767 dnl Java support
2768 dnl ===================================================================
2769 AC_MSG_CHECKING([whether to build with Java support])
2770 if test "$with_java" != "no"; then
2771     if test "$DISABLE_SCRIPTING" = TRUE; then
2772         AC_MSG_RESULT([no, overridden by --disable-scripting])
2773         ENABLE_JAVA=""
2774         with_java=no
2775     else
2776         AC_MSG_RESULT([yes])
2777         ENABLE_JAVA="TRUE"
2778         AC_DEFINE(HAVE_FEATURE_JAVA)
2779     fi
2780 else
2781     AC_MSG_RESULT([no])
2782     ENABLE_JAVA=""
2785 AC_SUBST(ENABLE_JAVA)
2787 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2789 dnl ENABLE_JAVA="" indicate no Java support at all
2791 dnl ===================================================================
2792 dnl Check macOS SDK and compiler
2793 dnl ===================================================================
2795 if test $_os = Darwin; then
2797     # If no --with-macosx-sdk option is given, look for one
2799     # The intent is that for "most" Mac-based developers, a suitable
2800     # SDK will be found automatically without any configure options.
2802     # For developers with a current Xcode, the lowest-numbered SDK
2803     # higher than or equal to the minimum required should be found.
2805     AC_MSG_CHECKING([what macOS SDK to use])
2806     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2807         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2808         if test -d "$MACOSX_SDK_PATH"; then
2809             with_macosx_sdk="${_macosx_sdk}"
2810             break
2811         else
2812             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2813             if test -d "$MACOSX_SDK_PATH"; then
2814                 with_macosx_sdk="${_macosx_sdk}"
2815                 break
2816             fi
2817         fi
2818     done
2819     if test ! -d "$MACOSX_SDK_PATH"; then
2820         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2821     fi
2823     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2825     case $with_macosx_sdk in
2826     10.12)
2827         MACOSX_SDK_VERSION=101200
2828         ;;
2829     10.13)
2830         MACOSX_SDK_VERSION=101300
2831         ;;
2832     10.14)
2833         MACOSX_SDK_VERSION=101400
2834         ;;
2835     10.15)
2836         MACOSX_SDK_VERSION=101500
2837         ;;
2838     *)
2839         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2840         ;;
2841     esac
2843     if test "$with_macosx_version_min_required" = "" ; then
2844         with_macosx_version_min_required="10.10";
2845     fi
2847     if test "$with_macosx_version_max_allowed" = "" ; then
2848         with_macosx_version_max_allowed="$with_macosx_sdk"
2849     fi
2851     # export this so that "xcrun" invocations later return matching values
2852     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2853     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2854     export DEVELOPER_DIR
2855     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2856     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2858     AC_MSG_CHECKING([whether Xcode is new enough])
2859     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2860     my_xcode_ver2=${my_xcode_ver1#Xcode }
2861     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2862     if test "$my_xcode_ver3" -ge 903; then
2863         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2864     else
2865         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2866     fi
2868     case "$with_macosx_version_min_required" in
2869     10.10)
2870         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2871         ;;
2872     10.11)
2873         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2874         ;;
2875     10.12)
2876         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2877         ;;
2878     10.13)
2879         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2880         ;;
2881     10.14)
2882         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2883         ;;
2884     10.15)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2886         ;;
2887     *)
2888         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2889         ;;
2890     esac
2891     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2893     LIBTOOL=/usr/bin/libtool
2894     INSTALL_NAME_TOOL=install_name_tool
2895     if test -z "$save_CC"; then
2896         stdlib=-stdlib=libc++
2897         if test "$ENABLE_LTO" = TRUE; then
2898             lto=-flto
2899         fi
2901         AC_MSG_CHECKING([what C compiler to use])
2902         CC="`xcrun -find clang`"
2903         CC_BASE=`first_arg_basename "$CC"`
2904         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2905         AC_MSG_RESULT([$CC])
2907         AC_MSG_CHECKING([what C++ compiler to use])
2908         CXX="`xcrun -find clang++`"
2909         CXX_BASE=`first_arg_basename "$CXX"`
2910         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2911         AC_MSG_RESULT([$CXX])
2913         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2914         AR=`xcrun -find ar`
2915         NM=`xcrun -find nm`
2916         STRIP=`xcrun -find strip`
2917         LIBTOOL=`xcrun -find libtool`
2918         RANLIB=`xcrun -find ranlib`
2919     fi
2921     case "$with_macosx_version_max_allowed" in
2922     10.10)
2923         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2924         ;;
2925     10.11)
2926         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2927         ;;
2928     10.12)
2929         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2930         ;;
2931     10.13)
2932         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2933         ;;
2934     10.14)
2935         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2936         ;;
2937     10.15)
2938         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2939         ;;
2940     *)
2941         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2942         ;;
2943     esac
2945     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2946     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2947         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])
2948     else
2949         AC_MSG_RESULT([ok])
2950     fi
2952     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2953     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2954         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2955     else
2956         AC_MSG_RESULT([ok])
2957     fi
2958     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2959     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2961     AC_MSG_CHECKING([whether to do code signing])
2963     if test "$enable_macosx_code_signing" = yes; then
2964         # By default use the first suitable certificate (?).
2966         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2967         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2968         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2969         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2970         # "Developer ID Application" one.
2972         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2973         if test -n "$identity"; then
2974             MACOSX_CODESIGNING_IDENTITY=$identity
2975             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2976             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2977         else
2978             AC_MSG_ERROR([cannot determine identity to use])
2979         fi
2980     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2981         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2982         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2983         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2984     else
2985         AC_MSG_RESULT([no])
2986     fi
2988     AC_MSG_CHECKING([whether to create a Mac App Store package])
2990     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2991         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2992     elif test "$enable_macosx_package_signing" = yes; then
2993         # By default use the first suitable certificate.
2994         # It should be a "3rd Party Mac Developer Installer" one
2996         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2997         if test -n "$identity"; then
2998             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2999             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3000             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3001         else
3002             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3003         fi
3004     elif test -n "$enable_macosx_package_signing"; then
3005         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3006         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3007         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3008     else
3009         AC_MSG_RESULT([no])
3010     fi
3012     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3013         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3014     fi
3016     AC_MSG_CHECKING([whether to sandbox the application])
3018     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3019         AC_MSG_ERROR([macOS sandboxing requires code signing])
3020     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3021         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3022     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3023         ENABLE_MACOSX_SANDBOX=TRUE
3024         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3025         AC_MSG_RESULT([yes])
3026     else
3027         AC_MSG_RESULT([no])
3028     fi
3030     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3031     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3032     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3034 AC_SUBST(MACOSX_SDK_PATH)
3035 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3036 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3037 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3038 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3039 AC_SUBST(INSTALL_NAME_TOOL)
3040 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3041 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3042 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3043 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3044 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3046 dnl ===================================================================
3047 dnl Check iOS SDK and compiler
3048 dnl ===================================================================
3050 if test $_os = iOS; then
3051     AC_MSG_CHECKING([what iOS SDK to use])
3052     current_sdk_ver=13.2
3053     older_sdk_vers="13.1 13.0 12.4 12.2"
3054     if test "$enable_ios_simulator" = "yes"; then
3055         platform=iPhoneSimulator
3056         versionmin=-mios-simulator-version-min=12.2
3057     else
3058         platform=iPhoneOS
3059         versionmin=-miphoneos-version-min=12.2
3060     fi
3061     xcode_developer=`xcode-select -print-path`
3063     for sdkver in $current_sdk_ver $older_sdk_vers; do
3064         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3065         if test -d $t; then
3066             sysroot=$t
3067             break
3068         fi
3069     done
3071     if test -z "$sysroot"; then
3072         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3073     fi
3075     AC_MSG_RESULT($sysroot)
3077     # LTO is not really recommended for iOS builds,
3078     # the link time will be astronomical
3079     if test "$ENABLE_LTO" = TRUE; then
3080         lto=-flto
3081     fi
3083     stdlib="-stdlib=libc++"
3085     AC_MSG_CHECKING([what C compiler to use])
3086     CC="`xcrun -find clang`"
3087     CC_BASE=`first_arg_basename "$CC"`
3088     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3089     AC_MSG_RESULT([$CC])
3091     AC_MSG_CHECKING([what C++ compiler to use])
3092     CXX="`xcrun -find clang++`"
3093     CXX_BASE=`first_arg_basename "$CXX"`
3094     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3095     AC_MSG_RESULT([$CXX])
3097     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3098     AR=`xcrun -find ar`
3099     NM=`xcrun -find nm`
3100     STRIP=`xcrun -find strip`
3101     LIBTOOL=`xcrun -find libtool`
3102     RANLIB=`xcrun -find ranlib`
3105 AC_MSG_CHECKING([whether to treat the installation as read-only])
3107 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3108         "$enable_extensions" != yes; then
3109     enable_readonly_installset=yes
3111 if test "$enable_readonly_installset" = yes; then
3112     AC_MSG_RESULT([yes])
3113     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3114 else
3115     AC_MSG_RESULT([no])
3118 dnl ===================================================================
3119 dnl Structure of install set
3120 dnl ===================================================================
3122 if test $_os = Darwin; then
3123     LIBO_BIN_FOLDER=MacOS
3124     LIBO_ETC_FOLDER=Resources
3125     LIBO_LIBEXEC_FOLDER=MacOS
3126     LIBO_LIB_FOLDER=Frameworks
3127     LIBO_LIB_PYUNO_FOLDER=Resources
3128     LIBO_SHARE_FOLDER=Resources
3129     LIBO_SHARE_HELP_FOLDER=Resources/help
3130     LIBO_SHARE_JAVA_FOLDER=Resources/java
3131     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3132     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3133     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3134     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3135     LIBO_URE_BIN_FOLDER=MacOS
3136     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3137     LIBO_URE_LIB_FOLDER=Frameworks
3138     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3139     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3140 elif test $_os = WINNT; then
3141     LIBO_BIN_FOLDER=program
3142     LIBO_ETC_FOLDER=program
3143     LIBO_LIBEXEC_FOLDER=program
3144     LIBO_LIB_FOLDER=program
3145     LIBO_LIB_PYUNO_FOLDER=program
3146     LIBO_SHARE_FOLDER=share
3147     LIBO_SHARE_HELP_FOLDER=help
3148     LIBO_SHARE_JAVA_FOLDER=program/classes
3149     LIBO_SHARE_PRESETS_FOLDER=presets
3150     LIBO_SHARE_READMES_FOLDER=readmes
3151     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3152     LIBO_SHARE_SHELL_FOLDER=program/shell
3153     LIBO_URE_BIN_FOLDER=program
3154     LIBO_URE_ETC_FOLDER=program
3155     LIBO_URE_LIB_FOLDER=program
3156     LIBO_URE_MISC_FOLDER=program
3157     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3158 else
3159     LIBO_BIN_FOLDER=program
3160     LIBO_ETC_FOLDER=program
3161     LIBO_LIBEXEC_FOLDER=program
3162     LIBO_LIB_FOLDER=program
3163     LIBO_LIB_PYUNO_FOLDER=program
3164     LIBO_SHARE_FOLDER=share
3165     LIBO_SHARE_HELP_FOLDER=help
3166     LIBO_SHARE_JAVA_FOLDER=program/classes
3167     LIBO_SHARE_PRESETS_FOLDER=presets
3168     LIBO_SHARE_READMES_FOLDER=readmes
3169     if test "$enable_fuzzers" != yes; then
3170         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3171     else
3172         LIBO_SHARE_RESOURCE_FOLDER=resource
3173     fi
3174     LIBO_SHARE_SHELL_FOLDER=program/shell
3175     LIBO_URE_BIN_FOLDER=program
3176     LIBO_URE_ETC_FOLDER=program
3177     LIBO_URE_LIB_FOLDER=program
3178     LIBO_URE_MISC_FOLDER=program
3179     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3181 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3182 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3183 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3184 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3185 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3186 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3187 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3188 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3189 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3190 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3191 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3192 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3193 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3194 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3198 # Not all of them needed in config_host.mk, add more if need arises
3199 AC_SUBST(LIBO_BIN_FOLDER)
3200 AC_SUBST(LIBO_ETC_FOLDER)
3201 AC_SUBST(LIBO_LIB_FOLDER)
3202 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3203 AC_SUBST(LIBO_SHARE_FOLDER)
3204 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3205 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3206 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3207 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3208 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3209 AC_SUBST(LIBO_URE_BIN_FOLDER)
3210 AC_SUBST(LIBO_URE_ETC_FOLDER)
3211 AC_SUBST(LIBO_URE_LIB_FOLDER)
3212 AC_SUBST(LIBO_URE_MISC_FOLDER)
3213 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3215 dnl ===================================================================
3216 dnl Windows specific tests and stuff
3217 dnl ===================================================================
3219 reg_get_value()
3221     # Return value: $regvalue
3222     unset regvalue
3224     local _regentry="/proc/registry${1}/${2}"
3225     if test -f "$_regentry"; then
3226         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3227         # Registry keys read via /proc/registry* are always \0 terminated!
3228         local _regvalue=$(tr -d '\0' < "$_regentry")
3229         if test $? -eq 0; then
3230             regvalue=$_regvalue
3231         fi
3232     fi
3235 # Get a value from the 32-bit side of the Registry
3236 reg_get_value_32()
3238     reg_get_value "32" "$1"
3241 # Get a value from the 64-bit side of the Registry
3242 reg_get_value_64()
3244     reg_get_value "64" "$1"
3247 if test "$_os" = "WINNT"; then
3248     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3249     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3250         AC_MSG_RESULT([no])
3251         WINDOWS_SDK_ARCH="x86"
3252     else
3253         AC_MSG_RESULT([yes])
3254         WINDOWS_SDK_ARCH="x64"
3255         BITNESS_OVERRIDE=64
3256     fi
3258 if test "$_os" = "iOS"; then
3259     cross_compiling="yes"
3262 if test "$cross_compiling" = "yes"; then
3263     export CROSS_COMPILING=TRUE
3264 else
3265     CROSS_COMPILING=
3266     BUILD_TYPE="$BUILD_TYPE NATIVE"
3268 AC_SUBST(CROSS_COMPILING)
3270 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3271 # NOTE: must _not_ be used for bundled external libraries!
3272 ISYSTEM=
3273 if test "$GCC" = "yes"; then
3274     AC_MSG_CHECKING( for -isystem )
3275     save_CFLAGS=$CFLAGS
3276     CFLAGS="$CFLAGS -Werror"
3277     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3278     CFLAGS=$save_CFLAGS
3279     if test -n "$ISYSTEM"; then
3280         AC_MSG_RESULT(yes)
3281     else
3282         AC_MSG_RESULT(no)
3283     fi
3285 if test -z "$ISYSTEM"; then
3286     # fall back to using -I
3287     ISYSTEM=-I
3289 AC_SUBST(ISYSTEM)
3291 dnl ===================================================================
3292 dnl  Check which Visual Studio compiler is used
3293 dnl ===================================================================
3295 map_vs_year_to_version()
3297     # Return value: $vsversion
3299     unset vsversion
3301     case $1 in
3302     2017)
3303         vsversion=15;;
3304     2019)
3305         vsversion=16;;
3306     *)
3307         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3308     esac
3311 vs_versions_to_check()
3313     # Args: $1 (optional) : versions to check, in the order of preference
3314     # Return value: $vsversions
3316     unset vsversions
3318     if test -n "$1"; then
3319         map_vs_year_to_version "$1"
3320         vsversions=$vsversion
3321     else
3322         # We accept only 2017
3323         vsversions="15"
3324     fi
3327 win_get_env_from_vsvars32bat()
3329     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3330     # Also seems to be located in another directory under the same name: vsvars32.bat
3331     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3332     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3333     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3334     chmod +x $WRAPPERBATCHFILEPATH
3335     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3336     rm -f $WRAPPERBATCHFILEPATH
3337     printf '%s' "$_win_get_env_from_vsvars32bat"
3340 find_ucrt()
3342     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3343     if test -n "$regvalue"; then
3344         PathFormat "$regvalue"
3345         UCRTSDKDIR=$formatted_path
3346         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3347         UCRTVERSION=$regvalue
3348         # Rest if not exist
3349         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3350           UCRTSDKDIR=
3351         fi
3352     fi
3353     if test -z "$UCRTSDKDIR"; then
3354         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3355         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3356         if test -f "$ide_env_file"; then
3357             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3358             UCRTSDKDIR=$formatted_path
3359             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3360             dnl Hack needed at least by tml:
3361             if test "$UCRTVERSION" = 10.0.15063.0 \
3362                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3363                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3364             then
3365                 UCRTVERSION=10.0.14393.0
3366             fi
3367         else
3368           AC_MSG_ERROR([No UCRT found])
3369         fi
3370     fi
3373 find_msvc()
3375     # Find Visual C++ 2017/2019
3376     # Args: $1 (optional) : The VS version year
3377     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3379     unset vctest vcnum vcnumwithdot vcbuildnumber
3381     vs_versions_to_check "$1"
3382     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3383     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3384     PathFormat "$vswhere"
3385     vswhere=$formatted_path
3386     for ver in $vsversions; do
3387         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3388         # Fall back to all MS products (this includes VC++ Build Tools)
3389         if ! test -n "$vswhereoutput"; then
3390             AC_MSG_CHECKING([VC++ Build Tools and similar])
3391             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3392         fi
3393         if test -n "$vswhereoutput"; then
3394             PathFormat "$vswhereoutput"
3395             vctest=$formatted_path
3396             break
3397         fi
3398     done
3400     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3401     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3402     # should be removed when upgrading baseline.
3403     if ! test -n "$vctest"; then
3404         for ver in $vsversions; do
3405             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3406             if test -n "$regvalue"; then
3407                 vctest=$regvalue
3408                 break
3409             fi
3410             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3411             if test -n "$regvalue"; then
3412                 AC_MSG_RESULT([found: $regvalue])
3413                 PathFormat "$regvalue"
3414                 vctest=$formatted_path
3415                 break
3416             fi
3417         done
3418     fi
3420     if test -n "$vctest"; then
3421         vcnumwithdot="$ver.0"
3422         case "$vcnumwithdot" in
3423         15.0)
3424             vcyear=2017
3425             vcnum=150
3426             ;;
3427         16.0)
3428             vcyear=2019
3429             vcnum=160
3430             ;;
3431         esac
3432         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3434     fi
3437 SOLARINC=
3438 MSBUILD_PATH=
3439 DEVENV=
3440 if test "$_os" = "WINNT"; then
3441     AC_MSG_CHECKING([Visual C++])
3442     find_msvc "$with_visual_studio"
3443     if test -z "$vctest"; then
3444         if test -n "$with_visual_studio"; then
3445             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3446         else
3447             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3448         fi
3449     fi
3451     if test "$BITNESS_OVERRIDE" = ""; then
3452         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3453             VC_PRODUCT_DIR=$vctest/VC
3454         else
3455             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3456         fi
3457     else
3458         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3459             VC_PRODUCT_DIR=$vctest/VC
3460         else
3461             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3462         fi
3463     fi
3464     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3466     AC_MSG_CHECKING([for short pathname of VC product directory])
3467     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3468     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3470     UCRTSDKDIR=
3471     UCRTVERSION=
3473     AC_MSG_CHECKING([for UCRT location])
3474     find_ucrt
3475     # find_ucrt errors out if it doesn't find it
3476     AC_MSG_RESULT([found])
3477     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3478     ucrtincpath_formatted=$formatted_path
3479     # SOLARINC is used for external modules and must be set too.
3480     # And no, it's not sufficient to set SOLARINC only, as configure
3481     # itself doesn't honour it.
3482     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3483     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3484     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3485     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3487     AC_SUBST(UCRTSDKDIR)
3488     AC_SUBST(UCRTVERSION)
3490     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3491     # Find the proper version of MSBuild.exe to use based on the VS version
3492     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3493     if test -n "$regvalue" ; then
3494         AC_MSG_RESULT([found: $regvalue])
3495         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3496     else
3497         if test "$vcnumwithdot" = "16.0"; then
3498             if test "$BITNESS_OVERRIDE" = ""; then
3499                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3500             else
3501                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3502             fi
3503         else
3504             if test "$BITNESS_OVERRIDE" = ""; then
3505                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3506             else
3507                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3508             fi
3509         fi
3510         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3511         AC_MSG_RESULT([$regvalue])
3512     fi
3514     # Find the version of devenv.exe
3515     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3516     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3517     if test ! -e "$DEVENV"; then
3518         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3519     fi
3521     dnl ===========================================================
3522     dnl  Check for the corresponding mspdb*.dll
3523     dnl ===========================================================
3525     VC_HOST_DIR=
3526     MSPDB_PATH=
3527     CL_PATH=
3529     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3530         VC_HOST_DIR="HostX64"
3531         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3532     else
3533         VC_HOST_DIR="HostX86"
3534         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3535     fi
3537     if test "$BITNESS_OVERRIDE" = ""; then
3538         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3539     else
3540         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3541     fi
3543     # MSVC 15.0 has libraries from 14.0?
3544     mspdbnum="140"
3546     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3547         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3548     fi
3550     dnl The path needs to be added before cl is called
3551     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3552     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3554     AC_MSG_CHECKING([cl.exe])
3556     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3557     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3558     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3559     # is not enough?
3561     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3562     dnl needed when building CLR code:
3563     if test -z "$MSVC_CXX"; then
3564         if test -f "$CL_PATH/cl.exe"; then
3565             MSVC_CXX="$CL_PATH/cl.exe"
3566         fi
3568         # This gives us a posix path with 8.3 filename restrictions
3569         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3570     fi
3572     if test -z "$CC"; then
3573         CC=$MSVC_CXX
3574         CC_BASE=`first_arg_basename "$CC"`
3575     fi
3576     if test "$BITNESS_OVERRIDE" = ""; then
3577         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3578         MSVC_CXX="$MSVC_CXX -arch:SSE"
3579     fi
3580     if test -z "$CXX"; then
3581         CXX=$MSVC_CXX
3582         CXX_BASE=`first_arg_basename "$CXX"`
3583     fi
3585     if test -n "$CC"; then
3586         # Remove /cl.exe from CC case insensitive
3587         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3588         if test "$BITNESS_OVERRIDE" = ""; then
3589            COMPATH="$VC_PRODUCT_DIR"
3590         else
3591             if test -n "$VC_PRODUCT_DIR"; then
3592                 COMPATH=$VC_PRODUCT_DIR
3593             fi
3594         fi
3595         if test "$BITNESS_OVERRIDE" = ""; then
3596             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3597             CC="$CC -arch:SSE"
3598         fi
3600         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3602         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3604         PathFormat "$COMPATH"
3605         COMPATH=`win_short_path_for_make "$formatted_path"`
3607         VCVER=$vcnum
3608         MSVSVER=$vcyear
3610         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3611         # are always "better", we list them in reverse chronological order.
3613         case "$vcnum" in
3614         150|160)
3615             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3616             ;;
3617         esac
3619         # The expectation is that --with-windows-sdk should not need to be used
3620         if test -n "$with_windows_sdk"; then
3621             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3622             *" "$with_windows_sdk" "*)
3623                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3624                 ;;
3625             *)
3626                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3627                 ;;
3628             esac
3629         fi
3631         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3632         ac_objext=obj
3633         ac_exeext=exe
3635     else
3636         AC_MSG_ERROR([Visual C++ not found after all, huh])
3637     fi
3639     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3640     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3641         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3642         // between Visual Studio versions and _MSC_VER:
3643         #if _MSC_VER < 1914
3644         #error
3645         #endif
3646     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3648     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3649     # version of the Explorer extension (and maybe other small
3650     # bits, too) needed when installing a 32-bit LibreOffice on a
3651     # 64-bit OS. The 64-bit Explorer extension is a feature that
3652     # has been present since long in OOo. Don't confuse it with
3653     # building LibreOffice itself as 64-bit code.
3655     BUILD_X64=
3656     CXX_X64_BINARY=
3658     if test "$BITNESS_OVERRIDE" = ""; then
3659         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3660         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3661              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3662             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3663                 BUILD_X64=TRUE
3664                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3665             fi
3666         fi
3667         if test "$BUILD_X64" = TRUE; then
3668             AC_MSG_RESULT([found])
3669         else
3670             AC_MSG_RESULT([not found])
3671             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3672         fi
3673     else
3674         CXX_X64_BINARY=$CXX
3675     fi
3676     AC_SUBST(BUILD_X64)
3678     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3679     AC_SUBST(CXX_X64_BINARY)
3681     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3682     # needed to support TWAIN scan on both 32- and 64-bit systems
3684     BUILD_X86=
3686     if test "$BITNESS_OVERRIDE" = "64"; then
3687         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3688         if test -n "$CXX_X86_BINARY"; then
3689             BUILD_X86=TRUE
3690             AC_MSG_RESULT([preset])
3691         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3692             BUILD_X86=TRUE
3693             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3694             CXX_X86_BINARY+=" /arch:SSE"
3695             AC_MSG_RESULT([found])
3696         else
3697             CXX_X86_BINARY=
3698             AC_MSG_RESULT([not found])
3699             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3700         fi
3701     else
3702         BUILD_X86=TRUE
3703         CXX_X86_BINARY=$MSVC_CXX
3704     fi
3705     AC_SUBST(BUILD_X86)
3706     AC_SUBST(CXX_X86_BINARY)
3708 AC_SUBST(VCVER)
3709 AC_SUBST(DEVENV)
3710 AC_SUBST(MSVC_CXX)
3713 # unowinreg.dll
3715 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3716 AC_SUBST(UNOWINREG_DLL)
3718 COM_IS_CLANG=
3719 AC_MSG_CHECKING([whether the compiler is actually Clang])
3720 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3721     #ifndef __clang__
3722     you lose
3723     #endif
3724     int foo=42;
3725     ]])],
3726     [AC_MSG_RESULT([yes])
3727      COM_IS_CLANG=TRUE],
3728     [AC_MSG_RESULT([no])])
3729 AC_SUBST(COM_IS_CLANG)
3731 CC_PLAIN=$CC
3732 CLANGVER=
3733 if test "$COM_IS_CLANG" = TRUE; then
3734     AC_MSG_CHECKING([whether Clang is new enough])
3735     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3736         #if !defined __apple_build_version__
3737         #error
3738         #endif
3739         ]])],
3740         [my_apple_clang=yes],[my_apple_clang=])
3741     if test "$my_apple_clang" = yes; then
3742         AC_MSG_RESULT([assumed yes (Apple Clang)])
3743     else
3744         if test "$_os" = WINNT; then
3745             dnl In which case, assume clang-cl:
3746             my_args="/EP /TC"
3747             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3748             dnl clang-cl:
3749             CC_PLAIN=
3750             for i in $CC; do
3751                 case $i in
3752                 -FIIntrin.h)
3753                     ;;
3754                 *)
3755                     CC_PLAIN="$CC_PLAIN $i"
3756                     ;;
3757                 esac
3758             done
3759         else
3760             my_args="-E -P"
3761         fi
3762         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3763         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3764         CLANGVER=`echo $clang_version \
3765             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3766         if test "$CLANGVER" -ge 50002; then
3767             AC_MSG_RESULT([yes ($clang_version)])
3768         else
3769             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3770         fi
3771         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3772         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3773     fi
3776 SHOWINCLUDES_PREFIX=
3777 if test "$_os" = WINNT; then
3778     dnl We need to guess the prefix of the -showIncludes output, it can be
3779     dnl localized
3780     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3781     echo "#include <stdlib.h>" > conftest.c
3782     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3783         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3784     rm -f conftest.c conftest.obj
3785     if test -z "$SHOWINCLUDES_PREFIX"; then
3786         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3787     else
3788         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3789     fi
3791 AC_SUBST(SHOWINCLUDES_PREFIX)
3794 # prefix C with ccache if needed
3796 if test "$CCACHE" != ""; then
3797     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3799     AC_LANG_PUSH([C])
3800     save_CFLAGS=$CFLAGS
3801     CFLAGS="$CFLAGS --ccache-skip -O2"
3802     dnl an empty program will do, we're checking the compiler flags
3803     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3804                       [use_ccache=yes], [use_ccache=no])
3805     if test $use_ccache = yes; then
3806         AC_MSG_RESULT([yes])
3807     else
3808         CC="$CCACHE $CC"
3809         CC_BASE="ccache $CC_BASE"
3810         AC_MSG_RESULT([no])
3811     fi
3812     CFLAGS=$save_CFLAGS
3813     AC_LANG_POP([C])
3816 # ===================================================================
3817 # check various GCC options that Clang does not support now but maybe
3818 # will somewhen in the future, check them even for GCC, so that the
3819 # flags are set
3820 # ===================================================================
3822 HAVE_GCC_GGDB2=
3823 if test "$GCC" = "yes"; then
3824     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3825     save_CFLAGS=$CFLAGS
3826     CFLAGS="$CFLAGS -Werror -ggdb2"
3827     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3828     CFLAGS=$save_CFLAGS
3829     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3830         AC_MSG_RESULT([yes])
3831     else
3832         AC_MSG_RESULT([no])
3833     fi
3835     if test "$host_cpu" = "m68k"; then
3836         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3837         save_CFLAGS=$CFLAGS
3838         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3839         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3840         CFLAGS=$save_CFLAGS
3841         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3842             AC_MSG_RESULT([yes])
3843         else
3844             AC_MSG_ERROR([no])
3845         fi
3846     fi
3848 AC_SUBST(HAVE_GCC_GGDB2)
3850 dnl ===================================================================
3851 dnl  Test the gcc version
3852 dnl ===================================================================
3853 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3854     AC_MSG_CHECKING([the GCC version])
3855     _gcc_version=`$CC -dumpversion`
3856     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3857         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3858     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3860     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3862     if test "$gcc_full_version" -lt 70000; then
3863         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3864     fi
3865 else
3866     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3867     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3868     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3869     # (which reports itself as GCC 4.2.1).
3870     GCC_VERSION=
3872 AC_SUBST(GCC_VERSION)
3874 dnl Set the ENABLE_DBGUTIL variable
3875 dnl ===================================================================
3876 AC_MSG_CHECKING([whether to build with additional debug utilities])
3877 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3878     ENABLE_DBGUTIL="TRUE"
3879     # this is an extra var so it can have different default on different MSVC
3880     # versions (in case there are version specific problems with it)
3881     MSVC_USE_DEBUG_RUNTIME="TRUE"
3883     AC_MSG_RESULT([yes])
3884     # cppunit and graphite expose STL in public headers
3885     if test "$with_system_cppunit" = "yes"; then
3886         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3887     else
3888         with_system_cppunit=no
3889     fi
3890     if test "$with_system_graphite" = "yes"; then
3891         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3892     else
3893         with_system_graphite=no
3894     fi
3895     if test "$with_system_orcus" = "yes"; then
3896         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3897     else
3898         with_system_orcus=no
3899     fi
3900     if test "$with_system_libcmis" = "yes"; then
3901         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3902     else
3903         with_system_libcmis=no
3904     fi
3905     if test "$with_system_hunspell" = "yes"; then
3906         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3907     else
3908         with_system_hunspell=no
3909     fi
3910     if test "$with_system_gpgmepp" = "yes"; then
3911         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3912     else
3913         with_system_gpgmepp=no
3914     fi
3915     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3916     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3917     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3918     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3919     # of those two is using the system variant:
3920     if test "$with_system_libnumbertext" = "yes"; then
3921         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3922     else
3923         with_system_libnumbertext=no
3924     fi
3925     if test "$with_system_libwps" = "yes"; then
3926         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3927     else
3928         with_system_libwps=no
3929     fi
3930 else
3931     ENABLE_DBGUTIL=""
3932     MSVC_USE_DEBUG_RUNTIME=""
3933     AC_MSG_RESULT([no])
3935 AC_SUBST(ENABLE_DBGUTIL)
3936 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3938 dnl Set the ENABLE_DEBUG variable.
3939 dnl ===================================================================
3940 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3941     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3943 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3944     if test -z "$libo_fuzzed_enable_debug"; then
3945         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3946     else
3947         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3948         enable_debug=yes
3949     fi
3952 AC_MSG_CHECKING([whether to do a debug build])
3953 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3954     ENABLE_DEBUG="TRUE"
3955     if test -n "$ENABLE_DBGUTIL" ; then
3956         AC_MSG_RESULT([yes (dbgutil)])
3957     else
3958         AC_MSG_RESULT([yes])
3959     fi
3960 else
3961     ENABLE_DEBUG=""
3962     AC_MSG_RESULT([no])
3964 AC_SUBST(ENABLE_DEBUG)
3966 dnl ===================================================================
3967 dnl Select the linker to use (gold/lld/ld.bfd).
3968 dnl This is done only after compiler checks (need to know if Clang is
3969 dnl used, for different defaults) and after checking if a debug build
3970 dnl is wanted (non-debug builds get the default linker if not explicitly
3971 dnl specified otherwise).
3972 dnl All checks for linker features/options should come after this.
3973 dnl ===================================================================
3974 check_use_ld()
3976     use_ld=$1
3977     use_ld_fail_if_error=$2
3978     use_ld_ok=
3979     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3980     use_ld_ldflags_save="$LDFLAGS"
3981     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3982     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3983 #include <stdio.h>
3984         ],[
3985 printf ("hello world\n");
3986         ])], USE_LD=$use_ld, [])
3987     if test -n "$USE_LD"; then
3988         AC_MSG_RESULT( yes )
3989         use_ld_ok=yes
3990     else
3991         if test -n "$use_ld_fail_if_error"; then
3992             AC_MSG_ERROR( no )
3993         else
3994             AC_MSG_RESULT( no )
3995         fi
3996     fi
3997     if test -n "$use_ld_ok"; then
3998         dnl keep the value of LDFLAGS
3999         return 0
4000     fi
4001     LDFLAGS="$use_ld_ldflags_save"
4002     return 1
4004 USE_LD=
4005 if test "$enable_ld" != "no"; then
4006     if test "$GCC" = "yes"; then
4007         if test -n "$enable_ld"; then
4008             check_use_ld "$enable_ld" fail_if_error
4009         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4010             dnl non-debug builds default to the default linker
4011             true
4012         elif test -n "$COM_IS_CLANG"; then
4013             check_use_ld lld
4014             if test $? -ne 0; then
4015                 check_use_ld gold
4016             fi
4017         else
4018             # For gcc first try gold, new versions also support lld.
4019             check_use_ld gold
4020             if test $? -ne 0; then
4021                 check_use_ld lld
4022             fi
4023         fi
4024         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4025         rm conftest.out
4026         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4027         if test -z "$ld_used"; then
4028             ld_used="unknown"
4029         fi
4030         AC_MSG_CHECKING([for linker that is used])
4031         AC_MSG_RESULT([$ld_used])
4032         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4033             if echo "$ld_used" | grep -q "^GNU ld"; then
4034                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4035                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4036             fi
4037         fi
4038     else
4039         if test "$enable_ld" = "yes"; then
4040             AC_MSG_ERROR([--enable-ld not supported])
4041         fi
4042     fi
4044 AC_SUBST(USE_LD)
4046 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4047 if test "$GCC" = "yes"; then
4048     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4049     bsymbolic_functions_ldflags_save=$LDFLAGS
4050     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4051     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4052 #include <stdio.h>
4053         ],[
4054 printf ("hello world\n");
4055         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4056     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4057         AC_MSG_RESULT( found )
4058     else
4059         AC_MSG_RESULT( not found )
4060     fi
4061     LDFLAGS=$bsymbolic_functions_ldflags_save
4063 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4066 HAVE_GSPLIT_DWARF=
4067 if test "$enable_split_debug" != no; then
4068     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4069     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4070         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4071         save_CFLAGS=$CFLAGS
4072         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4073         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4074         CFLAGS=$save_CFLAGS
4075         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4076             AC_MSG_RESULT([yes])
4077         else
4078             if test "$enable_split_debug" = yes; then
4079                 AC_MSG_ERROR([no])
4080             else
4081                 AC_MSG_RESULT([no])
4082             fi
4083         fi
4084     fi
4085     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4086         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4087         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4088     fi
4090 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4092 ENABLE_GDB_INDEX=
4093 if test "$enable_gdb_index" != "no"; then
4094     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4095     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4096         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4097         save_CFLAGS=$CFLAGS
4098         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4099         have_ggnu_pubnames=
4100         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4101         if test "$have_ggnu_pubnames" != "TRUE"; then
4102             if test "$enable_gdb_index" = "yes"; then
4103                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4104             else
4105                 AC_MSG_RESULT( no )
4106             fi
4107         else
4108             AC_MSG_RESULT( yes )
4109             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4110             ldflags_save=$LDFLAGS
4111             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4112             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4113 #include <stdio.h>
4114                 ],[
4115 printf ("hello world\n");
4116                 ])], ENABLE_GDB_INDEX=TRUE, [])
4117             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4118                 AC_MSG_RESULT( yes )
4119             else
4120                 if test "$enable_gdb_index" = "yes"; then
4121                     AC_MSG_ERROR( no )
4122                 else
4123                     AC_MSG_RESULT( no )
4124                 fi
4125             fi
4126             LDFLAGS=$ldflags_save
4127         fi
4128         CFLAGS=$save_CFLAGS
4129         fi
4130     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4131         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4132         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4133     fi
4135 AC_SUBST(ENABLE_GDB_INDEX)
4137 if test "$enable_sal_log" = yes; then
4138     ENABLE_SAL_LOG=TRUE
4140 AC_SUBST(ENABLE_SAL_LOG)
4142 dnl Check for enable symbols option
4143 dnl ===================================================================
4144 AC_MSG_CHECKING([whether to generate debug information])
4145 if test -z "$enable_symbols"; then
4146     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4147         enable_symbols=yes
4148     else
4149         enable_symbols=no
4150     fi
4152 if test "$enable_symbols" = yes; then
4153     ENABLE_SYMBOLS_FOR=all
4154     AC_MSG_RESULT([yes])
4155 elif test "$enable_symbols" = no; then
4156     ENABLE_SYMBOLS_FOR=
4157     AC_MSG_RESULT([no])
4158 else
4159     # Selective debuginfo.
4160     ENABLE_SYMBOLS_FOR="$enable_symbols"
4161     AC_MSG_RESULT([for "$enable_symbols"])
4163 AC_SUBST(ENABLE_SYMBOLS_FOR)
4165 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4166     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4167     AC_MSG_CHECKING([whether enough memory is available for linking])
4168     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4169     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4170     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4171         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4172     else
4173         AC_MSG_RESULT([yes])
4174     fi
4177 AC_MSG_CHECKING([whether to compile with optimization flags])
4178 if test -z "$enable_optimized"; then
4179     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4180         enable_optimized=no
4181     else
4182         enable_optimized=yes
4183     fi
4185 if test "$enable_optimized" != no; then
4186     ENABLE_OPTIMIZED=TRUE
4187     AC_MSG_RESULT([yes])
4188 else
4189     ENABLE_OPTIMIZED=
4190     AC_MSG_RESULT([no])
4192 AC_SUBST(ENABLE_OPTIMIZED)
4195 # determine CPUNAME, OS, ...
4196 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4198 case "$host_os" in
4200 aix*)
4201     COM=GCC
4202     CPUNAME=POWERPC
4203     USING_X11=TRUE
4204     OS=AIX
4205     RTL_OS=AIX
4206     RTL_ARCH=PowerPC
4207     PLATFORMID=aix_powerpc
4208     P_SEP=:
4209     ;;
4211 cygwin*)
4212     COM=MSC
4213     USING_X11=
4214     OS=WNT
4215     RTL_OS=Windows
4216     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4217         P_SEP=";"
4218     else
4219         P_SEP=:
4220     fi
4221     case "$host_cpu" in
4222     i*86|x86_64)
4223         if test "$BITNESS_OVERRIDE" = 64; then
4224             CPUNAME=X86_64
4225             RTL_ARCH=X86_64
4226             PLATFORMID=windows_x86_64
4227             WINDOWS_X64=1
4228             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4229         else
4230             CPUNAME=INTEL
4231             RTL_ARCH=x86
4232             PLATFORMID=windows_x86
4233         fi
4234         ;;
4235     *)
4236         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4237         ;;
4238     esac
4239     SCPDEFS="$SCPDEFS -D_MSC_VER"
4240     ;;
4242 darwin*)
4243     COM=GCC
4244     USING_X11=
4245     OS=MACOSX
4246     RTL_OS=MacOSX
4247     P_SEP=:
4249     case "$host_cpu" in
4250     arm)
4251         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4252         ;;
4253     arm64)
4254         OS=iOS
4255         RTL_OS=iOS
4256         if test "$enable_ios_simulator" = "yes"; then
4257             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4258         else
4259             CPUNAME=ARM64
4260             RTL_ARCH=ARM_EABI
4261             PLATFORMID=ios_arm64
4262         fi
4263         ;;
4264     i*86)
4265         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4266         ;;
4267     x86_64)
4268         if test "$enable_ios_simulator" = "yes"; then
4269             OS=iOS
4270         fi
4271         CPUNAME=X86_64
4272         RTL_ARCH=X86_64
4273         PLATFORMID=macosx_x86_64
4274         ;;
4275     *)
4276         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4277         ;;
4278     esac
4279     ;;
4281 dragonfly*)
4282     COM=GCC
4283     USING_X11=TRUE
4284     OS=DRAGONFLY
4285     RTL_OS=DragonFly
4286     P_SEP=:
4288     case "$host_cpu" in
4289     i*86)
4290         CPUNAME=INTEL
4291         RTL_ARCH=x86
4292         PLATFORMID=dragonfly_x86
4293         ;;
4294     x86_64)
4295         CPUNAME=X86_64
4296         RTL_ARCH=X86_64
4297         PLATFORMID=dragonfly_x86_64
4298         ;;
4299     *)
4300         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4301         ;;
4302     esac
4303     ;;
4305 freebsd*)
4306     COM=GCC
4307     USING_X11=TRUE
4308     RTL_OS=FreeBSD
4309     OS=FREEBSD
4310     P_SEP=:
4312     case "$host_cpu" in
4313     i*86)
4314         CPUNAME=INTEL
4315         RTL_ARCH=x86
4316         PLATFORMID=freebsd_x86
4317         ;;
4318     x86_64|amd64)
4319         CPUNAME=X86_64
4320         RTL_ARCH=X86_64
4321         PLATFORMID=freebsd_x86_64
4322         ;;
4323     *)
4324         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4325         ;;
4326     esac
4327     ;;
4329 haiku*)
4330     COM=GCC
4331     USING_X11=
4332     GUIBASE=haiku
4333     RTL_OS=Haiku
4334     OS=HAIKU
4335     P_SEP=:
4337     case "$host_cpu" in
4338     i*86)
4339         CPUNAME=INTEL
4340         RTL_ARCH=x86
4341         PLATFORMID=haiku_x86
4342         ;;
4343     x86_64|amd64)
4344         CPUNAME=X86_64
4345         RTL_ARCH=X86_64
4346         PLATFORMID=haiku_x86_64
4347         ;;
4348     *)
4349         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4350         ;;
4351     esac
4352     ;;
4354 kfreebsd*)
4355     COM=GCC
4356     USING_X11=TRUE
4357     OS=LINUX
4358     RTL_OS=kFreeBSD
4359     P_SEP=:
4361     case "$host_cpu" in
4363     i*86)
4364         CPUNAME=INTEL
4365         RTL_ARCH=x86
4366         PLATFORMID=kfreebsd_x86
4367         ;;
4368     x86_64)
4369         CPUNAME=X86_64
4370         RTL_ARCH=X86_64
4371         PLATFORMID=kfreebsd_x86_64
4372         ;;
4373     *)
4374         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4375         ;;
4376     esac
4377     ;;
4379 linux-gnu*)
4380     COM=GCC
4381     USING_X11=TRUE
4382     OS=LINUX
4383     RTL_OS=Linux
4384     P_SEP=:
4386     case "$host_cpu" in
4388     aarch64)
4389         CPUNAME=AARCH64
4390         PLATFORMID=linux_aarch64
4391         RTL_ARCH=AARCH64
4392         ;;
4393     alpha)
4394         CPUNAME=AXP
4395         RTL_ARCH=ALPHA
4396         PLATFORMID=linux_alpha
4397         ;;
4398     arm*)
4399         CPUNAME=ARM
4400         EPM_FLAGS="-a arm"
4401         RTL_ARCH=ARM_EABI
4402         PLATFORMID=linux_arm_eabi
4403         case "$host_cpu" in
4404         arm*-linux)
4405             RTL_ARCH=ARM_OABI
4406             PLATFORMID=linux_arm_oabi
4407             ;;
4408         esac
4409         ;;
4410     hppa)
4411         CPUNAME=HPPA
4412         RTL_ARCH=HPPA
4413         EPM_FLAGS="-a hppa"
4414         PLATFORMID=linux_hppa
4415         ;;
4416     i*86)
4417         CPUNAME=INTEL
4418         RTL_ARCH=x86
4419         PLATFORMID=linux_x86
4420         ;;
4421     ia64)
4422         CPUNAME=IA64
4423         RTL_ARCH=IA64
4424         PLATFORMID=linux_ia64
4425         ;;
4426     mips)
4427         CPUNAME=GODSON
4428         RTL_ARCH=MIPS_EB
4429         EPM_FLAGS="-a mips"
4430         PLATFORMID=linux_mips_eb
4431         ;;
4432     mips64)
4433         CPUNAME=GODSON64
4434         RTL_ARCH=MIPS64_EB
4435         EPM_FLAGS="-a mips64"
4436         PLATFORMID=linux_mips64_eb
4437         ;;
4438     mips64el)
4439         CPUNAME=GODSON64
4440         RTL_ARCH=MIPS64_EL
4441         EPM_FLAGS="-a mips64el"
4442         PLATFORMID=linux_mips64_el
4443         ;;
4444     mipsel)
4445         CPUNAME=GODSON
4446         RTL_ARCH=MIPS_EL
4447         EPM_FLAGS="-a mipsel"
4448         PLATFORMID=linux_mips_el
4449         ;;
4450     m68k)
4451         CPUNAME=M68K
4452         RTL_ARCH=M68K
4453         PLATFORMID=linux_m68k
4454         ;;
4455     powerpc)
4456         CPUNAME=POWERPC
4457         RTL_ARCH=PowerPC
4458         PLATFORMID=linux_powerpc
4459         ;;
4460     powerpc64)
4461         CPUNAME=POWERPC64
4462         RTL_ARCH=PowerPC_64
4463         PLATFORMID=linux_powerpc64
4464         ;;
4465     powerpc64le)
4466         CPUNAME=POWERPC64
4467         RTL_ARCH=PowerPC_64_LE
4468         PLATFORMID=linux_powerpc64_le
4469         ;;
4470     sparc)
4471         CPUNAME=SPARC
4472         RTL_ARCH=SPARC
4473         PLATFORMID=linux_sparc
4474         ;;
4475     sparc64)
4476         CPUNAME=SPARC64
4477         RTL_ARCH=SPARC64
4478         PLATFORMID=linux_sparc64
4479         ;;
4480     s390)
4481         CPUNAME=S390
4482         RTL_ARCH=S390
4483         PLATFORMID=linux_s390
4484         ;;
4485     s390x)
4486         CPUNAME=S390X
4487         RTL_ARCH=S390x
4488         PLATFORMID=linux_s390x
4489         ;;
4490     x86_64)
4491         CPUNAME=X86_64
4492         RTL_ARCH=X86_64
4493         PLATFORMID=linux_x86_64
4494         ;;
4495     *)
4496         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4497         ;;
4498     esac
4499     ;;
4501 linux-android*)
4502     COM=GCC
4503     USING_X11=
4504     OS=ANDROID
4505     RTL_OS=Android
4506     P_SEP=:
4508     case "$host_cpu" in
4510     arm|armel)
4511         CPUNAME=ARM
4512         RTL_ARCH=ARM_EABI
4513         PLATFORMID=android_arm_eabi
4514         ;;
4515     aarch64)
4516         CPUNAME=AARCH64
4517         RTL_ARCH=AARCH64
4518         PLATFORMID=android_aarch64
4519         ;;
4520     i*86)
4521         CPUNAME=INTEL
4522         RTL_ARCH=x86
4523         PLATFORMID=android_x86
4524         ;;
4525     x86_64)
4526         CPUNAME=X86_64
4527         RTL_ARCH=X86_64
4528         PLATFORMID=android_x86_64
4529         ;;
4530     *)
4531         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4532         ;;
4533     esac
4534     ;;
4536 *netbsd*)
4537     COM=GCC
4538     USING_X11=TRUE
4539     OS=NETBSD
4540     RTL_OS=NetBSD
4541     P_SEP=:
4543     case "$host_cpu" in
4544     i*86)
4545         CPUNAME=INTEL
4546         RTL_ARCH=x86
4547         PLATFORMID=netbsd_x86
4548         ;;
4549     powerpc)
4550         CPUNAME=POWERPC
4551         RTL_ARCH=PowerPC
4552         PLATFORMID=netbsd_powerpc
4553         ;;
4554     sparc)
4555         CPUNAME=SPARC
4556         RTL_ARCH=SPARC
4557         PLATFORMID=netbsd_sparc
4558         ;;
4559     x86_64)
4560         CPUNAME=X86_64
4561         RTL_ARCH=X86_64
4562         PLATFORMID=netbsd_x86_64
4563         ;;
4564     *)
4565         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4566         ;;
4567     esac
4568     ;;
4570 openbsd*)
4571     COM=GCC
4572     USING_X11=TRUE
4573     OS=OPENBSD
4574     RTL_OS=OpenBSD
4575     P_SEP=:
4577     case "$host_cpu" in
4578     i*86)
4579         CPUNAME=INTEL
4580         RTL_ARCH=x86
4581         PLATFORMID=openbsd_x86
4582         ;;
4583     x86_64)
4584         CPUNAME=X86_64
4585         RTL_ARCH=X86_64
4586         PLATFORMID=openbsd_x86_64
4587         ;;
4588     *)
4589         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4590         ;;
4591     esac
4592     SOLARINC="$SOLARINC -I/usr/local/include"
4593     ;;
4595 solaris*)
4596     COM=GCC
4597     USING_X11=TRUE
4598     OS=SOLARIS
4599     RTL_OS=Solaris
4600     P_SEP=:
4602     case "$host_cpu" in
4603     i*86)
4604         CPUNAME=INTEL
4605         RTL_ARCH=x86
4606         PLATFORMID=solaris_x86
4607         ;;
4608     sparc)
4609         CPUNAME=SPARC
4610         RTL_ARCH=SPARC
4611         PLATFORMID=solaris_sparc
4612         ;;
4613     sparc64)
4614         CPUNAME=SPARC64
4615         RTL_ARCH=SPARC64
4616         PLATFORMID=solaris_sparc64
4617         ;;
4618     *)
4619         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4620         ;;
4621     esac
4622     SOLARINC="$SOLARINC -I/usr/local/include"
4623     ;;
4626     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4627     ;;
4628 esac
4630 if test "$with_x" = "no"; then
4631     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4634 DISABLE_GUI=""
4635 if test "$enable_gui" = "no"; then
4636     if test "$USING_X11" != TRUE; then
4637         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4638     fi
4639     USING_X11=
4640     DISABLE_GUI=TRUE
4641     AC_DEFINE(HAVE_FEATURE_UI,0)
4642     test_cairo=yes
4644 AC_SUBST(DISABLE_GUI)
4646 WORKDIR="${BUILDDIR}/workdir"
4647 INSTDIR="${BUILDDIR}/instdir"
4648 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4649 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4650 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4651 AC_SUBST(COM)
4652 AC_SUBST(CPUNAME)
4653 AC_SUBST(RTL_OS)
4654 AC_SUBST(RTL_ARCH)
4655 AC_SUBST(EPM_FLAGS)
4656 AC_SUBST(USING_X11)
4657 AC_SUBST([INSTDIR])
4658 AC_SUBST([INSTROOT])
4659 AC_SUBST([INSTROOTBASE])
4660 AC_SUBST(OS)
4661 AC_SUBST(P_SEP)
4662 AC_SUBST(WORKDIR)
4663 AC_SUBST(PLATFORMID)
4664 AC_SUBST(WINDOWS_X64)
4665 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4667 dnl ===================================================================
4668 dnl Test which package format to use
4669 dnl ===================================================================
4670 AC_MSG_CHECKING([which package format to use])
4671 if test -n "$with_package_format" -a "$with_package_format" != no; then
4672     for i in $with_package_format; do
4673         case "$i" in
4674         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4675             ;;
4676         *)
4677             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4678 aix - AIX software distribution
4679 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4680 deb - Debian software distribution
4681 pkg - Solaris software distribution
4682 rpm - RedHat software distribution
4684 LibreOffice additionally supports:
4685 archive - .tar.gz or .zip
4686 dmg - macOS .dmg
4687 installed - installation tree
4688 msi - Windows .msi
4689         ])
4690             ;;
4691         esac
4692     done
4693     # fakeroot is needed to ensure correct file ownerships/permissions
4694     # inside deb packages and tar archives created on Linux and Solaris.
4695     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4696         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4697         if test "$FAKEROOT" = "no"; then
4698             AC_MSG_ERROR(
4699                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4700         fi
4701     fi
4702     PKGFORMAT="$with_package_format"
4703     AC_MSG_RESULT([$PKGFORMAT])
4704 else
4705     PKGFORMAT=
4706     AC_MSG_RESULT([none])
4708 AC_SUBST(PKGFORMAT)
4710 dnl ===================================================================
4711 dnl Set up a different compiler to produce tools to run on the build
4712 dnl machine when doing cross-compilation
4713 dnl ===================================================================
4715 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4716 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4717 if test "$cross_compiling" = "yes"; then
4718     AC_MSG_CHECKING([for BUILD platform configuration])
4719     echo
4720     rm -rf CONF-FOR-BUILD config_build.mk
4721     mkdir CONF-FOR-BUILD
4722     # Here must be listed all files needed when running the configure script. In particular, also
4723     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4724     # keep them in the same order as there.
4725     (cd $SRC_ROOT && tar cf - \
4726         config.guess \
4727         bin/get_config_variables \
4728         solenv/bin/getcompver.awk \
4729         solenv/inc/langlist.mk \
4730         download.lst \
4731         config_host.mk.in \
4732         config_host_lang.mk.in \
4733         Makefile.in \
4734         bin/bffvalidator.sh.in \
4735         bin/odfvalidator.sh.in \
4736         bin/officeotron.sh.in \
4737         instsetoo_native/util/openoffice.lst.in \
4738         config_host/*.in \
4739         sysui/desktop/macosx/Info.plist.in) \
4740     | (cd CONF-FOR-BUILD && tar xf -)
4741     cp configure CONF-FOR-BUILD
4742     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4743     (
4744     unset COM USING_X11 OS CPUNAME
4745     unset CC CXX SYSBASE CFLAGS
4746     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4747     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4748     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4749     if test -n "$CC_FOR_BUILD"; then
4750         export CC="$CC_FOR_BUILD"
4751         CC_BASE=`first_arg_basename "$CC"`
4752     fi
4753     if test -n "$CXX_FOR_BUILD"; then
4754         export CXX="$CXX_FOR_BUILD"
4755         CXX_BASE=`first_arg_basename "$CXX"`
4756     fi
4757     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4758     cd CONF-FOR-BUILD
4759     sub_conf_opts=""
4760     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4761     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4762     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4763     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4764     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4765     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4766     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4767     # Don't bother having configure look for stuff not needed for the build platform anyway
4768     ./configure \
4769         --disable-cups \
4770         --disable-gstreamer-1-0 \
4771         --disable-gtk3 \
4772         --disable-pdfimport \
4773         --disable-postgresql-sdbc \
4774         --with-parallelism="$with_parallelism" \
4775         --without-doxygen \
4776         --without-java \
4777         $sub_conf_opts \
4778         --srcdir=$srcdir \
4779         2>&1 | sed -e 's/^/    /'
4780     test -f ./config_host.mk 2>/dev/null || exit
4781     cp config_host.mk ../config_build.mk
4782     cp config_host_lang.mk ../config_build_lang.mk
4783     mv config.log ../config.Build.log
4784     mkdir -p ../config_build
4785     mv config_host/*.h ../config_build
4786     . ./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
4788     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
4789         VV='$'$V
4790         VV=`eval "echo $VV"`
4791         if test -n "$VV"; then
4792             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4793             echo "$line" >>build-config
4794         fi
4795     done
4797     for V in INSTDIR INSTROOT WORKDIR; do
4798         VV='$'$V
4799         VV=`eval "echo $VV"`
4800         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4801         if test -n "$VV"; then
4802             line="${V}_FOR_BUILD='$VV'"
4803             echo "$line" >>build-config
4804         fi
4805     done
4807     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4808     echo "$line" >>build-config
4810     )
4811     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4812     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])
4813     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4814              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4816     eval `cat CONF-FOR-BUILD/build-config`
4818     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4820     rm -rf CONF-FOR-BUILD
4821 else
4822     OS_FOR_BUILD="$OS"
4823     CC_FOR_BUILD="$CC"
4824     CXX_FOR_BUILD="$CXX"
4825     INSTDIR_FOR_BUILD="$INSTDIR"
4826     INSTROOT_FOR_BUILD="$INSTROOT"
4827     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4828     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4829     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4830     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4831     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4832     WORKDIR_FOR_BUILD="$WORKDIR"
4834 AC_SUBST(OS_FOR_BUILD)
4835 AC_SUBST(INSTDIR_FOR_BUILD)
4836 AC_SUBST(INSTROOT_FOR_BUILD)
4837 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4838 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4839 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4840 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4841 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4842 AC_SUBST(WORKDIR_FOR_BUILD)
4844 dnl ===================================================================
4845 dnl Check for syslog header
4846 dnl ===================================================================
4847 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4849 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4850 dnl ===================================================================
4851 AC_MSG_CHECKING([whether to turn warnings to errors])
4852 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4853     ENABLE_WERROR="TRUE"
4854     AC_MSG_RESULT([yes])
4855 else
4856     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4857         ENABLE_WERROR="TRUE"
4858         AC_MSG_RESULT([yes])
4859     else
4860         AC_MSG_RESULT([no])
4861     fi
4863 AC_SUBST(ENABLE_WERROR)
4865 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4866 dnl ===================================================================
4867 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4868 if test -z "$enable_assert_always_abort"; then
4869    if test "$ENABLE_DEBUG" = TRUE; then
4870        enable_assert_always_abort=yes
4871    else
4872        enable_assert_always_abort=no
4873    fi
4875 if test "$enable_assert_always_abort" = "yes"; then
4876     ASSERT_ALWAYS_ABORT="TRUE"
4877     AC_MSG_RESULT([yes])
4878 else
4879     ASSERT_ALWAYS_ABORT="FALSE"
4880     AC_MSG_RESULT([no])
4882 AC_SUBST(ASSERT_ALWAYS_ABORT)
4884 # Determine whether to use ooenv for the instdir installation
4885 # ===================================================================
4886 if test $_os != "WINNT" -a $_os != "Darwin"; then
4887     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4888     if test "$enable_ooenv" = "no"; then
4889         AC_MSG_RESULT([no])
4890     else
4891         ENABLE_OOENV="TRUE"
4892         AC_MSG_RESULT([yes])
4893     fi
4895 AC_SUBST(ENABLE_OOENV)
4897 if test "$USING_X11" != TRUE; then
4898     # be sure to do not mess with unneeded stuff
4899     test_randr=no
4900     test_xrender=no
4901     test_cups=no
4902     test_dbus=no
4903     build_gstreamer_1_0=no
4904     test_kf5=no
4905     test_qt5=no
4906     test_gtk3_kde5=no
4907     enable_cairo_canvas=no
4910 if test "$OS" = "HAIKU"; then
4911     enable_cairo_canvas=yes
4912     test_kf5=yes
4915 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4916     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!])
4917     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!"
4918     enable_kf5=yes
4921 if test "$test_kf5" = "yes"; then
4922     test_qt5=yes
4925 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4926     if test "$enable_qt5" = "no"; then
4927         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4928     else
4929         enable_qt5=yes
4930     fi
4933 dnl ===================================================================
4934 dnl check for cups support
4935 dnl ===================================================================
4936 ENABLE_CUPS=""
4938 if test "$enable_cups" = "no"; then
4939     test_cups=no
4942 AC_MSG_CHECKING([whether to enable CUPS support])
4943 if test "$test_cups" = "yes"; then
4944     ENABLE_CUPS="TRUE"
4945     AC_MSG_RESULT([yes])
4947     AC_MSG_CHECKING([whether cups support is present])
4948     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4949     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4950     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4951         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4952     fi
4954 else
4955     AC_MSG_RESULT([no])
4958 AC_SUBST(ENABLE_CUPS)
4960 # fontconfig checks
4961 if test "$test_fontconfig" = "yes"; then
4962     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4963     SYSTEM_FONTCONFIG=TRUE
4964     FilterLibs "${FONTCONFIG_LIBS}"
4965     FONTCONFIG_LIBS="${filteredlibs}"
4967 AC_SUBST(FONTCONFIG_CFLAGS)
4968 AC_SUBST(FONTCONFIG_LIBS)
4969 AC_SUBST([SYSTEM_FONTCONFIG])
4971 dnl whether to find & fetch external tarballs?
4972 dnl ===================================================================
4973 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4974    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4975        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4976    else
4977        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4978    fi
4980 if test -z "$TARFILE_LOCATION"; then
4981     if test -d "$SRC_ROOT/src" ; then
4982         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4983         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4984     fi
4985     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4986 else
4987     AbsolutePath "$TARFILE_LOCATION"
4988     PathFormat "${absolute_path}"
4989     TARFILE_LOCATION="${formatted_path}"
4991 AC_SUBST(TARFILE_LOCATION)
4993 AC_MSG_CHECKING([whether we want to fetch tarballs])
4994 if test "$enable_fetch_external" != "no"; then
4995     if test "$with_all_tarballs" = "yes"; then
4996         AC_MSG_RESULT([yes, all of them])
4997         DO_FETCH_TARBALLS="ALL"
4998     else
4999         AC_MSG_RESULT([yes, if we use them])
5000         DO_FETCH_TARBALLS="TRUE"
5001     fi
5002 else
5003     AC_MSG_RESULT([no])
5004     DO_FETCH_TARBALLS=
5006 AC_SUBST(DO_FETCH_TARBALLS)
5008 AC_MSG_CHECKING([whether to build help])
5009 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5010     BUILD_TYPE="$BUILD_TYPE HELP"
5011     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5012     case "$with_help" in
5013     "html")
5014         ENABLE_HTMLHELP=TRUE
5015         SCPDEFS="$SCPDEFS -DWITH_HELP"
5016         AC_MSG_RESULT([HTML])
5017         ;;
5018     "online")
5019         ENABLE_HTMLHELP=TRUE
5020         HELP_ONLINE=TRUE
5021         AC_MSG_RESULT([HTML])
5022         ;;
5023     yes)
5024         SCPDEFS="$SCPDEFS -DWITH_HELP"
5025         AC_MSG_RESULT([yes])
5026         ;;
5027     *)
5028         AC_MSG_ERROR([Unknown --with-help=$with_help])
5029         ;;
5030     esac
5031 else
5032     AC_MSG_RESULT([no])
5034 AC_SUBST([ENABLE_HTMLHELP])
5035 AC_SUBST([HELP_ONLINE])
5037 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5038 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5039     BUILD_TYPE="$BUILD_TYPE HELP"
5040     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5041     case "$with_omindex" in
5042     "server")
5043         ENABLE_HTMLHELP=TRUE
5044         HELP_ONLINE=TRUE
5045         HELP_OMINDEX_PAGE=TRUE
5046         AC_MSG_RESULT([SERVER])
5047         ;;
5048     "noxap")
5049         ENABLE_HTMLHELP=TRUE
5050         HELP_ONLINE=TRUE
5051         HELP_OMINDEX_PAGE=FALSE
5052         AC_MSG_RESULT([NOXAP])
5053         ;;
5054     *)
5055         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5056         ;;
5057     esac
5058 else
5059     HELP_OMINDEX_PAGE=FALSE
5060     AC_MSG_RESULT([no])
5062 AC_SUBST([ENABLE_HTMLHELP])
5063 AC_SUBST([HELP_OMINDEX_PAGE])
5064 AC_SUBST([HELP_ONLINE])
5067 dnl Test whether to include MySpell dictionaries
5068 dnl ===================================================================
5069 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5070 if test "$with_myspell_dicts" = "yes"; then
5071     AC_MSG_RESULT([yes])
5072     WITH_MYSPELL_DICTS=TRUE
5073     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5074     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5075 else
5076     AC_MSG_RESULT([no])
5077     WITH_MYSPELL_DICTS=
5079 AC_SUBST(WITH_MYSPELL_DICTS)
5081 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5082 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5083     if test "$with_system_dicts" = yes; then
5084         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5085     fi
5086     with_system_dicts=no
5089 AC_MSG_CHECKING([whether to use dicts from external paths])
5090 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5091     AC_MSG_RESULT([yes])
5092     SYSTEM_DICTS=TRUE
5093     AC_MSG_CHECKING([for spelling dictionary directory])
5094     if test -n "$with_external_dict_dir"; then
5095         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5096     else
5097         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5098         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5099             DICT_SYSTEM_DIR=file:///usr/share/myspell
5100         fi
5101     fi
5102     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5103     AC_MSG_CHECKING([for hyphenation patterns directory])
5104     if test -n "$with_external_hyph_dir"; then
5105         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5106     else
5107         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5108     fi
5109     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5110     AC_MSG_CHECKING([for thesaurus directory])
5111     if test -n "$with_external_thes_dir"; then
5112         THES_SYSTEM_DIR=file://$with_external_thes_dir
5113     else
5114         THES_SYSTEM_DIR=file:///usr/share/mythes
5115     fi
5116     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5117 else
5118     AC_MSG_RESULT([no])
5119     SYSTEM_DICTS=
5121 AC_SUBST(SYSTEM_DICTS)
5122 AC_SUBST(DICT_SYSTEM_DIR)
5123 AC_SUBST(HYPH_SYSTEM_DIR)
5124 AC_SUBST(THES_SYSTEM_DIR)
5126 dnl ===================================================================
5127 dnl Precompiled headers.
5128 ENABLE_PCH=""
5129 AC_MSG_CHECKING([whether to enable pch feature])
5130 if test -z "$enable_pch"; then
5131     if test "$_os" = "WINNT"; then
5132         # Enabled by default on Windows.
5133         enable_pch=yes
5134     else
5135         enable_pch=no
5136     fi
5138 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5139     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5141 if test "$enable_pch" = "system"; then
5142     ENABLE_PCH="1"
5143     AC_MSG_RESULT([yes (system headers)])
5144 elif test "$enable_pch" = "base"; then
5145     ENABLE_PCH="2"
5146     AC_MSG_RESULT([yes (system and base headers)])
5147 elif test "$enable_pch" = "normal"; then
5148     ENABLE_PCH="3"
5149     AC_MSG_RESULT([yes (normal)])
5150 elif test "$enable_pch" = "full"; then
5151     ENABLE_PCH="4"
5152     AC_MSG_RESULT([yes (full)])
5153 elif test "$enable_pch" = "yes"; then
5154     # Pick a suitable default.
5155     if test "$GCC" = "yes"; then
5156         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5157         # while making the PCHs larger and rebuilds more likely.
5158         ENABLE_PCH="2"
5159         AC_MSG_RESULT([yes (system and base headers)])
5160     else
5161         # With MSVC the highest level makes a significant difference,
5162         # and it was the default when there used to be no PCH levels.
5163         ENABLE_PCH="4"
5164         AC_MSG_RESULT([yes (full)])
5165     fi
5166 elif test "$enable_pch" = "no"; then
5167     AC_MSG_RESULT([no])
5168 else
5169     AC_MSG_ERROR([Unknown value for --enable-pch])
5171 AC_SUBST(ENABLE_PCH)
5172 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5173 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5174     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5175     if test "$CCACHE_BIN" != "not found"; then
5176         AC_MSG_CHECKING([ccache version])
5177         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5178         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5179         AC_MSG_RESULT([$CCACHE_VERSION])
5180         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5181         if test "$CCACHE_NUMVER" -gt "030701"; then
5182             AC_MSG_RESULT([yes])
5183         else
5184             AC_MSG_RESULT([no (not newer than 3.7.1)])
5185             CCACHE_DEPEND_MODE=
5186         fi
5187     fi
5190 TAB=`printf '\t'`
5192 AC_MSG_CHECKING([the GNU Make version])
5193 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5194 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5195 if test "$_make_longver" -ge "038200"; then
5196     AC_MSG_RESULT([$GNUMAKE $_make_version])
5198 elif test "$_make_longver" -ge "038100"; then
5199     if test "$build_os" = "cygwin"; then
5200         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5201     fi
5202     AC_MSG_RESULT([$GNUMAKE $_make_version])
5204     dnl ===================================================================
5205     dnl Search all the common names for sha1sum
5206     dnl ===================================================================
5207     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5208     if test -z "$SHA1SUM"; then
5209         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5210     elif test "$SHA1SUM" = "openssl"; then
5211         SHA1SUM="openssl sha1"
5212     fi
5213     AC_MSG_CHECKING([for GNU Make bug 20033])
5214     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5215     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5216 A := \$(wildcard *.a)
5218 .PHONY: all
5219 all: \$(A:.a=.b)
5220 <TAB>@echo survived bug20033.
5222 .PHONY: setup
5223 setup:
5224 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5226 define d1
5227 @echo lala \$(1)
5228 @sleep 1
5229 endef
5231 define d2
5232 @echo tyty \$(1)
5233 @sleep 1
5234 endef
5236 %.b : %.a
5237 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5238 <TAB>\$(call d1,\$(CHECKSUM)),\
5239 <TAB>\$(call d2,\$(CHECKSUM)))
5241     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5242         no_parallelism_make="YES"
5243         AC_MSG_RESULT([yes, disable parallelism])
5244     else
5245         AC_MSG_RESULT([no, keep parallelism enabled])
5246     fi
5247     rm -rf $TESTGMAKEBUG20033
5248 else
5249     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5252 # find if gnumake support file function
5253 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5254 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5255 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5256     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5258 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5259 \$(file >test.txt,Success )
5261 .PHONY: all
5262 all:
5263 <TAB>@cat test.txt
5266 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5267 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5268     HAVE_GNUMAKE_FILE_FUNC=TRUE
5269     AC_MSG_RESULT([yes])
5270 else
5271     AC_MSG_RESULT([no])
5273 rm -rf $TESTGMAKEFILEFUNC
5274 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5275 AC_SUBST(GNUMAKE_WIN_NATIVE)
5277 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5278 STALE_MAKE=
5279 if test "$_make_ver_check" = ""; then
5280    STALE_MAKE=TRUE
5283 HAVE_LD_HASH_STYLE=FALSE
5284 WITH_LINKER_HASH_STYLE=
5285 AC_MSG_CHECKING([for --hash-style gcc linker support])
5286 if test "$GCC" = "yes"; then
5287     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5288         hash_styles="gnu sysv"
5289     elif test "$with_linker_hash_style" = "no"; then
5290         hash_styles=
5291     else
5292         hash_styles="$with_linker_hash_style"
5293     fi
5295     for hash_style in $hash_styles; do
5296         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5297         hash_style_ldflags_save=$LDFLAGS
5298         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5300         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5301             [
5302 #include <stdio.h>
5303             ],[
5304 printf ("");
5305             ])],
5306             [
5307                   HAVE_LD_HASH_STYLE=TRUE
5308                   WITH_LINKER_HASH_STYLE=$hash_style
5309             ],
5310             [HAVE_LD_HASH_STYLE=FALSE],
5311             [HAVE_LD_HASH_STYLE=FALSE])
5312         LDFLAGS=$hash_style_ldflags_save
5313     done
5315     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5316         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5317     else
5318         AC_MSG_RESULT( no )
5319     fi
5320     LDFLAGS=$hash_style_ldflags_save
5321 else
5322     AC_MSG_RESULT( no )
5324 AC_SUBST(HAVE_LD_HASH_STYLE)
5325 AC_SUBST(WITH_LINKER_HASH_STYLE)
5327 dnl ===================================================================
5328 dnl Check whether there's a Perl version available.
5329 dnl ===================================================================
5330 if test -z "$with_perl_home"; then
5331     AC_PATH_PROG(PERL, perl)
5332 else
5333     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5334     _perl_path="$with_perl_home/bin/perl"
5335     if test -x "$_perl_path"; then
5336         PERL=$_perl_path
5337     else
5338         AC_MSG_ERROR([$_perl_path not found])
5339     fi
5342 dnl ===================================================================
5343 dnl Testing for Perl version 5 or greater.
5344 dnl $] is the Perl version variable, it is returned as an integer
5345 dnl ===================================================================
5346 if test "$PERL"; then
5347     AC_MSG_CHECKING([the Perl version])
5348     ${PERL} -e "exit($]);"
5349     _perl_version=$?
5350     if test "$_perl_version" -lt 5; then
5351         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5352     fi
5353     AC_MSG_RESULT([Perl $_perl_version])
5354 else
5355     AC_MSG_ERROR([Perl not found, install Perl 5])
5358 dnl ===================================================================
5359 dnl Testing for required Perl modules
5360 dnl ===================================================================
5362 AC_MSG_CHECKING([for required Perl modules])
5363 perl_use_string="use Cwd ; use Digest::MD5"
5364 if test "$_os" = "WINNT"; then
5365     if test -n "$PKGFORMAT"; then
5366         for i in $PKGFORMAT; do
5367             case "$i" in
5368             msi)
5369                 # for getting fonts versions to use in MSI
5370                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5371                 ;;
5372             esac
5373         done
5374     fi
5376 if test "$with_system_hsqldb" = "yes"; then
5377     perl_use_string="$perl_use_string ; use Archive::Zip"
5379 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5380     AC_MSG_RESULT([all modules found])
5381 else
5382     AC_MSG_RESULT([failed to find some modules])
5383     # Find out which modules are missing.
5384     for i in $perl_use_string; do
5385         if test "$i" != "use" -a "$i" != ";"; then
5386             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5387                 missing_perl_modules="$missing_perl_modules $i"
5388             fi
5389         fi
5390     done
5391     AC_MSG_ERROR([
5392     The missing Perl modules are: $missing_perl_modules
5393     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5396 dnl ===================================================================
5397 dnl Check for pkg-config
5398 dnl ===================================================================
5399 if test "$_os" != "WINNT"; then
5400     PKG_PROG_PKG_CONFIG
5403 if test "$_os" != "WINNT"; then
5405     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5406     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5407     # explicitly. Or put /path/to/compiler in PATH yourself.
5409     # Use wrappers for LTO
5410     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5411         AC_CHECK_TOOL(AR,gcc-ar)
5412         AC_CHECK_TOOL(NM,gcc-nm)
5413         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5414     else
5415         AC_CHECK_TOOL(AR,ar)
5416         AC_CHECK_TOOL(NM,nm)
5417         AC_CHECK_TOOL(RANLIB,ranlib)
5418     fi
5419     AC_CHECK_TOOL(OBJDUMP,objdump)
5420     AC_CHECK_TOOL(READELF,readelf)
5421     AC_CHECK_TOOL(STRIP,strip)
5422     if test "$_os" = "WINNT"; then
5423         AC_CHECK_TOOL(DLLTOOL,dlltool)
5424         AC_CHECK_TOOL(WINDRES,windres)
5425     fi
5427 AC_SUBST(AR)
5428 AC_SUBST(DLLTOOL)
5429 AC_SUBST(NM)
5430 AC_SUBST(OBJDUMP)
5431 AC_SUBST(PKG_CONFIG)
5432 AC_SUBST(RANLIB)
5433 AC_SUBST(READELF)
5434 AC_SUBST(STRIP)
5435 AC_SUBST(WINDRES)
5437 dnl ===================================================================
5438 dnl pkg-config checks on macOS
5439 dnl ===================================================================
5441 if test $_os = Darwin; then
5442     AC_MSG_CHECKING([for bogus pkg-config])
5443     if test -n "$PKG_CONFIG"; then
5444         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5445             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5446         else
5447             if test "$enable_bogus_pkg_config" = "yes"; then
5448                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5449             else
5450                 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.])
5451             fi
5452         fi
5453     else
5454         AC_MSG_RESULT([no, good])
5455     fi
5458 find_csc()
5460     # Return value: $csctest
5462     unset csctest
5464     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5465     if test -n "$regvalue"; then
5466         csctest=$regvalue
5467         return
5468     fi
5471 find_al()
5473     # Return value: $altest
5475     unset altest
5477     # We need this check to detect 4.6.1 or above.
5478     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5479         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5480         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5481             altest=$regvalue
5482             return
5483         fi
5484     done
5486     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5487         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5488         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5489             altest=$regvalue
5490             return
5491         fi
5492     done
5497 find_dotnetsdk46()
5499     unset frametest
5501     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5502         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5503         if test -n "$regvalue"; then
5504             frametest=$regvalue
5505             return
5506         fi
5507     done
5510 find_winsdk_version()
5512     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5513     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5515     unset winsdktest winsdkbinsubdir winsdklibsubdir
5517     case "$1" in
5518     8.0|8.0A)
5519         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5520         if test -n "$regvalue"; then
5521             winsdktest=$regvalue
5522             winsdklibsubdir=win8
5523             return
5524         fi
5525         ;;
5526     8.1|8.1A)
5527         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5528         if test -n "$regvalue"; then
5529             winsdktest=$regvalue
5530             winsdklibsubdir=winv6.3
5531             return
5532         fi
5533         ;;
5534     10.0)
5535         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5536         if test -n "$regvalue"; then
5537             winsdktest=$regvalue
5538             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5539             if test -n "$regvalue"; then
5540                 winsdkbinsubdir="$regvalue".0
5541                 winsdklibsubdir=$winsdkbinsubdir
5542                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5543                 # test exist the SDK path
5544                 if test -d "$tmppath"; then
5545                    # when path is convertible to a short path then path is okay
5546                    cygpath -d "$tmppath" >/dev/null 2>&1
5547                    if test $? -ne 0; then
5548                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5549                    fi
5550                 else
5551                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5552                 fi
5553             fi
5554             return
5555         fi
5556         ;;
5557     esac
5560 find_winsdk()
5562     # Return value: From find_winsdk_version
5564     unset winsdktest
5566     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5567         find_winsdk_version $ver
5568         if test -n "$winsdktest"; then
5569             return
5570         fi
5571     done
5574 find_msms()
5576     AC_MSG_CHECKING([for MSVC merge modules directory])
5577     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5578     case "$VCVER" in
5579         150|160)
5580         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5581         ;;
5582     esac
5583     for f in $my_msm_files; do
5584         echo "$as_me:$LINENO: searching for $f" >&5
5585     done
5587     msmdir=
5588     for ver in 14.0 15.0; do
5589         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5590         if test -n "$regvalue"; then
5591             for f in ${my_msm_files}; do
5592                 if test -e "$regvalue/${f}"; then
5593                     msmdir=$regvalue
5594                     break
5595                 fi
5596             done
5597         fi
5598     done
5599     dnl Is the following fallback really necessary, or was it added in response
5600     dnl to never having started Visual Studio on a given machine, so the
5601     dnl registry keys checked above had presumably not yet been created?
5602     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5603     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5604     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5605     dnl expanding to "C:\Program Files\Common Files"), which would need
5606     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5607     dnl obtain its value from cygwin:
5608     if test -z "$msmdir"; then
5609         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5610         for f in ${my_msm_files}; do
5611             if test -e "$my_msm_dir/${f}"; then
5612                 msmdir=$my_msm_dir
5613             fi
5614         done
5615     fi
5617     dnl Starting from MSVC 15.0, merge modules are located in different directory
5618     case "$VCVER" in
5619     150|160)
5620         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5621             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5622             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5623             for f in ${my_msm_files}; do
5624                 if test -e "$my_msm_dir/${f}"; then
5625                     msmdir=$my_msm_dir
5626                     break
5627                 fi
5628             done
5629         done
5630         ;;
5631     esac
5633     if test -n "$msmdir"; then
5634         msmdir=`cygpath -m "$msmdir"`
5635         AC_MSG_RESULT([$msmdir])
5636     else
5637         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5638             AC_MSG_FAILURE([not found])
5639         else
5640             AC_MSG_WARN([not found (check config.log)])
5641             add_warning "MSM none of ${my_msm_files} found"
5642         fi
5643     fi
5646 find_msvc_x64_dlls()
5648     AC_MSG_CHECKING([for MSVC x64 DLL path])
5649     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5650     case "$VCVER" in
5651     150|160)
5652         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5653             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5654             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5655                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5656                 break
5657             fi
5658             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5659             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5660                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5661                 break
5662             fi
5663             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5664             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5665                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5666                 break
5667             fi
5668         done
5669         ;;
5670     esac
5671     AC_MSG_RESULT([$msvcdllpath])
5672     AC_MSG_CHECKING([for MSVC x64 DLLs])
5673     msvcdlls="msvcp140.dll vcruntime140.dll"
5674     for dll in $msvcdlls; do
5675         if ! test -f "$msvcdllpath/$dll"; then
5676             AC_MSG_FAILURE([missing $dll])
5677         fi
5678     done
5679     AC_MSG_RESULT([found all ($msvcdlls)])
5682 dnl =========================================
5683 dnl Check for the Windows  SDK.
5684 dnl =========================================
5685 if test "$_os" = "WINNT"; then
5686     AC_MSG_CHECKING([for Windows SDK])
5687     if test "$build_os" = "cygwin"; then
5688         find_winsdk
5689         WINDOWS_SDK_HOME=$winsdktest
5691         # normalize if found
5692         if test -n "$WINDOWS_SDK_HOME"; then
5693             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5694             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5695         fi
5697         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5698     fi
5700     if test -n "$WINDOWS_SDK_HOME"; then
5701         # Remove a possible trailing backslash
5702         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5704         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5705              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5706              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5707             have_windows_sdk_headers=yes
5708         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5709              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5710              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5711             have_windows_sdk_headers=yes
5712         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5713              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5714              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5715             have_windows_sdk_headers=yes
5716         else
5717             have_windows_sdk_headers=no
5718         fi
5720         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5721             have_windows_sdk_libs=yes
5722         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5723             have_windows_sdk_libs=yes
5724         else
5725             have_windows_sdk_libs=no
5726         fi
5728         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5729             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5730 the  Windows SDK are installed.])
5731         fi
5732     fi
5734     if test -z "$WINDOWS_SDK_HOME"; then
5735         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5736     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5737         WINDOWS_SDK_VERSION=80
5738         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5739     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5740         WINDOWS_SDK_VERSION=81
5741         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5742     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5743         WINDOWS_SDK_VERSION=10
5744         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5745     else
5746         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5747     fi
5748     PathFormat "$WINDOWS_SDK_HOME"
5749     WINDOWS_SDK_HOME="$formatted_path"
5750     if test "$build_os" = "cygwin"; then
5751         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5752         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5753             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5754         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5755             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5756         fi
5757     fi
5759     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5760     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5761     dnl but not in v8.0), so allow this to be overridden with a
5762     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5763     dnl and configuration error if no WiLangId.vbs is found would arguably be
5764     dnl better, but I do not know under which conditions exactly it is needed by
5765     dnl msiglobal.pm:
5766     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5767         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5768         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5769             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5770         fi
5771         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5772             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5773         fi
5774         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5775             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5776         fi
5777     fi
5778     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5779         if test -n "$with_package_format" -a "$with_package_format" != no; then
5780             for i in "$with_package_format"; do
5781                 if test "$i" = "msi"; then
5782                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5783                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5784                     fi
5785                 fi
5786             done
5787         fi
5788     fi
5790 AC_SUBST(WINDOWS_SDK_HOME)
5791 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5792 AC_SUBST(WINDOWS_SDK_VERSION)
5793 AC_SUBST(WINDOWS_SDK_WILANGID)
5795 if test "$build_os" = "cygwin"; then
5796     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5797     dnl dir, it also determines that dir's path w/o an arch segment if any,
5798     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5799     AC_MSG_CHECKING([for midl.exe])
5801     find_winsdk
5802     if test -n "$winsdkbinsubdir" \
5803         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5804     then
5805         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5806         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5807     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5808         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5809         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5810     elif test -f "$winsdktest/Bin/midl.exe"; then
5811         MIDL_PATH=$winsdktest/Bin
5812         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5813     fi
5814     if test ! -f "$MIDL_PATH/midl.exe"; then
5815         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5816     else
5817         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5818     fi
5820     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5821     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5823     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5824          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5825          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5826          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5827     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5828          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5829          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5830          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5831     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5832          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5833          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5834          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5835     else
5836         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5837     fi
5839     dnl Check csc.exe
5840     AC_MSG_CHECKING([for csc.exe])
5841     find_csc
5842     if test -f "$csctest/csc.exe"; then
5843         CSC_PATH="$csctest"
5844     fi
5845     if test ! -f "$CSC_PATH/csc.exe"; then
5846         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5847     else
5848         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5849     fi
5851     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5853     dnl Check al.exe
5854     AC_MSG_CHECKING([for al.exe])
5855     find_winsdk
5856     if test -n "$winsdkbinsubdir" \
5857         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5858     then
5859         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5860     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5861         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5862     elif test -f "$winsdktest/Bin/al.exe"; then
5863         AL_PATH="$winsdktest/Bin"
5864     fi
5866     if test -z "$AL_PATH"; then
5867         find_al
5868         if test -f "$altest/bin/al.exe"; then
5869             AL_PATH="$altest/bin"
5870         elif test -f "$altest/al.exe"; then
5871             AL_PATH="$altest"
5872         fi
5873     fi
5874     if test ! -f "$AL_PATH/al.exe"; then
5875         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5876     else
5877         AC_MSG_RESULT([$AL_PATH/al.exe])
5878     fi
5880     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5882     dnl Check mscoree.lib / .NET Framework dir
5883     AC_MSG_CHECKING(.NET Framework)
5884     find_dotnetsdk46
5885     PathFormat "$frametest"
5886     frametest="$formatted_path"
5887     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5888         DOTNET_FRAMEWORK_HOME="$frametest"
5889     else
5890         find_winsdk
5891         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5892             DOTNET_FRAMEWORK_HOME="$winsdktest"
5893         fi
5894     fi
5895     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
5896         AC_MSG_ERROR([mscoree.lib not found])
5897     fi
5898     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5900     PathFormat "$MIDL_PATH"
5901     MIDL_PATH="$formatted_path"
5903     PathFormat "$AL_PATH"
5904     AL_PATH="$formatted_path"
5906     PathFormat "$DOTNET_FRAMEWORK_HOME"
5907     DOTNET_FRAMEWORK_HOME="$formatted_path"
5909     PathFormat "$CSC_PATH"
5910     CSC_PATH="$formatted_path"
5913 dnl ===================================================================
5914 dnl Check if stdc headers are available excluding MSVC.
5915 dnl ===================================================================
5916 if test "$_os" != "WINNT"; then
5917     AC_HEADER_STDC
5920 dnl ===================================================================
5921 dnl Testing for C++ compiler and version...
5922 dnl ===================================================================
5924 if test "$_os" != "WINNT"; then
5925     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5926     save_CXXFLAGS=$CXXFLAGS
5927     AC_PROG_CXX
5928     CXXFLAGS=$save_CXXFLAGS
5929     if test -z "$CXX_BASE"; then
5930         CXX_BASE=`first_arg_basename "$CXX"`
5931     fi
5934 dnl check for GNU C++ compiler version
5935 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5936     AC_MSG_CHECKING([the GNU C++ compiler version])
5938     _gpp_version=`$CXX -dumpversion`
5939     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5941     if test "$_gpp_majmin" -lt "700"; then
5942         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5943     else
5944         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5945     fi
5947     dnl see https://code.google.com/p/android/issues/detail?id=41770
5948         glibcxx_threads=no
5949         AC_LANG_PUSH([C++])
5950         AC_REQUIRE_CPP
5951         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5952         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5953             #include <bits/c++config.h>]],[[
5954             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5955             && !defined(_GLIBCXX__PTHREADS) \
5956             && !defined(_GLIBCXX_HAS_GTHREADS)
5957             choke me
5958             #endif
5959         ]])],[AC_MSG_RESULT([yes])
5960         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5961         AC_LANG_POP([C++])
5962         if test $glibcxx_threads = yes; then
5963             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5964         fi
5966 AC_SUBST(BOOST_CXXFLAGS)
5969 # prefx CXX with ccache if needed
5971 if test "$CCACHE" != ""; then
5972     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5973     AC_LANG_PUSH([C++])
5974     save_CXXFLAGS=$CXXFLAGS
5975     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5976     dnl an empty program will do, we're checking the compiler flags
5977     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5978                       [use_ccache=yes], [use_ccache=no])
5979     if test $use_ccache = yes; then
5980         AC_MSG_RESULT([yes])
5981     else
5982         CXX="$CCACHE $CXX"
5983         CXX_BASE="ccache $CXX_BASE"
5984         AC_MSG_RESULT([no])
5985     fi
5986     CXXFLAGS=$save_CXXFLAGS
5987     AC_LANG_POP([C++])
5990 dnl ===================================================================
5991 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5992 dnl ===================================================================
5994 if test "$_os" != "WINNT"; then
5995     AC_PROG_CXXCPP
5997     dnl Check whether there's a C pre-processor.
5998     AC_PROG_CPP
6002 dnl ===================================================================
6003 dnl Find integral type sizes and alignments
6004 dnl ===================================================================
6006 if test "$_os" != "WINNT"; then
6008 if test "$_os" = "iOS"; then
6009     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6010     ac_cv_sizeof_long=8
6011     ac_cv_sizeof_short=2
6012     ac_cv_sizeof_int=4
6013     ac_cv_sizeof_long_long=8
6014     ac_cv_sizeof_double=8
6015     ac_cv_sizeof_voidp=8
6016 else
6017     AC_CHECK_SIZEOF(long)
6018     AC_CHECK_SIZEOF(short)
6019     AC_CHECK_SIZEOF(int)
6020     AC_CHECK_SIZEOF(long long)
6021     AC_CHECK_SIZEOF(double)
6022     AC_CHECK_SIZEOF(void*)
6025     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6026     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6027     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6028     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6029     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6031     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6032     m4_pattern_allow([AC_CHECK_ALIGNOF])
6033     m4_ifdef([AC_CHECK_ALIGNOF],
6034         [
6035             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6036             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6037             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6038             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6039         ],
6040         [
6041             case "$_os-$host_cpu" in
6042             Linux-i686)
6043                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6044                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6045                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6046                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6047                 ;;
6048             Linux-x86_64)
6049                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6050                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6051                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6052                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6053                 ;;
6054             *)
6055                 if test -z "$ac_cv_alignof_short" -o \
6056                         -z "$ac_cv_alignof_int" -o \
6057                         -z "$ac_cv_alignof_long" -o \
6058                         -z "$ac_cv_alignof_double"; then
6059                    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.])
6060                 fi
6061                 ;;
6062             esac
6063         ])
6065     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6066     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6067     if test $ac_cv_sizeof_long -eq 8; then
6068         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6069     elif test $ac_cv_sizeof_double -eq 8; then
6070         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6071     else
6072         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6073     fi
6075     dnl Check for large file support
6076     AC_SYS_LARGEFILE
6077     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6078         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6079     fi
6080     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6081         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6082     fi
6083 else
6084     # Hardcode for MSVC
6085     SAL_TYPES_SIZEOFSHORT=2
6086     SAL_TYPES_SIZEOFINT=4
6087     SAL_TYPES_SIZEOFLONG=4
6088     SAL_TYPES_SIZEOFLONGLONG=8
6089     if test "$BITNESS_OVERRIDE" = ""; then
6090         SAL_TYPES_SIZEOFPOINTER=4
6091     else
6092         SAL_TYPES_SIZEOFPOINTER=8
6093     fi
6094     SAL_TYPES_ALIGNMENT2=2
6095     SAL_TYPES_ALIGNMENT4=4
6096     SAL_TYPES_ALIGNMENT8=8
6097     LFS_CFLAGS=''
6099 AC_SUBST(LFS_CFLAGS)
6101 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6102 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6103 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6104 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6105 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6106 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6107 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6108 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6110 dnl ===================================================================
6111 dnl Check whether to enable runtime optimizations
6112 dnl ===================================================================
6113 ENABLE_RUNTIME_OPTIMIZATIONS=
6114 AC_MSG_CHECKING([whether to enable runtime optimizations])
6115 if test -z "$enable_runtime_optimizations"; then
6116     for i in $CC; do
6117         case $i in
6118         -fsanitize=*)
6119             enable_runtime_optimizations=no
6120             break
6121             ;;
6122         esac
6123     done
6125 if test "$enable_runtime_optimizations" != no; then
6126     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6127     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6128     AC_MSG_RESULT([yes])
6129 else
6130     AC_MSG_RESULT([no])
6132 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6134 dnl ===================================================================
6135 dnl Check if valgrind headers are available
6136 dnl ===================================================================
6137 ENABLE_VALGRIND=
6138 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6139     prev_cppflags=$CPPFLAGS
6140     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6141     # or where does it come from?
6142     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6143     AC_CHECK_HEADER([valgrind/valgrind.h],
6144         [ENABLE_VALGRIND=TRUE])
6145     CPPFLAGS=$prev_cppflags
6147 AC_SUBST([ENABLE_VALGRIND])
6148 if test -z "$ENABLE_VALGRIND"; then
6149     if test "$with_valgrind" = yes; then
6150         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6151     fi
6152     VALGRIND_CFLAGS=
6154 AC_SUBST([VALGRIND_CFLAGS])
6157 dnl ===================================================================
6158 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6159 dnl ===================================================================
6161 # We need at least the sys/sdt.h include header.
6162 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6163 if test "$SDT_H_FOUND" = "TRUE"; then
6164     # Found sys/sdt.h header, now make sure the c++ compiler works.
6165     # Old g++ versions had problems with probes in constructors/destructors.
6166     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6167     AC_LANG_PUSH([C++])
6168     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6169     #include <sys/sdt.h>
6170     class ProbeClass
6171     {
6172     private:
6173       int& ref;
6174       const char *name;
6176     public:
6177       ProbeClass(int& v, const char *n) : ref(v), name(n)
6178       {
6179         DTRACE_PROBE2(_test_, cons, name, ref);
6180       }
6182       void method(int min)
6183       {
6184         DTRACE_PROBE3(_test_, meth, name, ref, min);
6185         ref -= min;
6186       }
6188       ~ProbeClass()
6189       {
6190         DTRACE_PROBE2(_test_, dest, name, ref);
6191       }
6192     };
6193     ]],[[
6194     int i = 64;
6195     DTRACE_PROBE1(_test_, call, i);
6196     ProbeClass inst = ProbeClass(i, "call");
6197     inst.method(24);
6198     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6199           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6200     AC_LANG_POP([C++])
6202 AC_CONFIG_HEADERS([config_host/config_probes.h])
6204 dnl ===================================================================
6205 dnl GCC features
6206 dnl ===================================================================
6207 HAVE_GCC_STACK_CLASH_PROTECTION=
6208 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6209     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6210     save_CFLAGS=$CFLAGS
6211     CFLAGS="$CFLAGS -fstack-clash-protection"
6212     AC_LINK_IFELSE(
6213         [AC_LANG_PROGRAM(, [[return 0;]])],
6214         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6215         [AC_MSG_RESULT([no])])
6216     CFLAGS=$save_CFLAGS
6218     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6219     save_CFLAGS=$CFLAGS
6220     CFLAGS="$CFLAGS -Werror -mno-avx"
6221     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6222     CFLAGS=$save_CFLAGS
6223     if test "$HAVE_GCC_AVX" = "TRUE"; then
6224         AC_MSG_RESULT([yes])
6225     else
6226         AC_MSG_RESULT([no])
6227     fi
6229     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6230     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6231     int v = 0;
6232     if (__sync_add_and_fetch(&v, 1) != 1 ||
6233         __sync_sub_and_fetch(&v, 1) != 0)
6234         return 1;
6235     __sync_synchronize();
6236     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6237         v != 1)
6238         return 1;
6239     return 0;
6240 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6241     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6242         AC_MSG_RESULT([yes])
6243         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6244     else
6245         AC_MSG_RESULT([no])
6246     fi
6248     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6249     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6250     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6251         AC_MSG_RESULT([yes])
6252         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6253     else
6254         AC_MSG_RESULT([no])
6255     fi
6257     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6258     save_CFLAGS=$CFLAGS
6259     CFLAGS="$CFLAGS -Werror"
6260     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6261             __attribute__((deprecated("test"))) void f();
6262         ])], [
6263             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6264             AC_MSG_RESULT([yes])
6265         ], [AC_MSG_RESULT([no])])
6266     CFLAGS=$save_CFLAGS
6268     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6269     AC_LANG_PUSH([C++])
6270     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6271             #include <cstddef>
6272             #include <cxxabi.h>
6273             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6274         ])], [
6275             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6276             AC_MSG_RESULT([yes])
6277         ], [AC_MSG_RESULT([no])])
6278     AC_LANG_POP([C++])
6280     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6281     AC_LANG_PUSH([C++])
6282     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6283             #include <cstddef>
6284             #include <cxxabi.h>
6285             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6286         ])], [
6287             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6288             AC_MSG_RESULT([yes])
6289         ], [AC_MSG_RESULT([no])])
6290     AC_LANG_POP([C++])
6292     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6293     AC_LANG_PUSH([C++])
6294     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6295             #include <cxxabi.h>
6296             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6297         ])], [
6298             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6299             AC_MSG_RESULT([yes])
6300         ], [AC_MSG_RESULT([no])])
6301     AC_LANG_POP([C++])
6303     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6304     AC_LANG_PUSH([C++])
6305     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6306             #include <cstddef>
6307             #include <cxxabi.h>
6308             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6309         ])], [
6310             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6311             AC_MSG_RESULT([yes])
6312         ], [AC_MSG_RESULT([no])])
6313     AC_LANG_POP([C++])
6315     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6316     AC_LANG_PUSH([C++])
6317     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6318             #include <cstddef>
6319             #include <cxxabi.h>
6320             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6321         ])], [
6322             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6323             AC_MSG_RESULT([yes])
6324         ], [AC_MSG_RESULT([no])])
6325     AC_LANG_POP([C++])
6327     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6328     AC_LANG_PUSH([C++])
6329     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6330             #include <cxxabi.h>
6331             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6332         ])], [
6333             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6334             AC_MSG_RESULT([yes])
6335         ], [AC_MSG_RESULT([no])])
6336     AC_LANG_POP([C++])
6338     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6339     AC_LANG_PUSH([C++])
6340     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6341             #include <cxxabi.h>
6342             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6343         ])], [
6344             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6345             AC_MSG_RESULT([yes])
6346         ], [AC_MSG_RESULT([no])])
6347     AC_LANG_POP([C++])
6349     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6350     AC_LANG_PUSH([C++])
6351     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6352             #include <cxxabi.h>
6353             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6354         ])], [
6355             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6356             AC_MSG_RESULT([yes])
6357         ], [AC_MSG_RESULT([no])])
6358     AC_LANG_POP([C++])
6360     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6361     AC_LANG_PUSH([C++])
6362     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6363             #include <cstddef>
6364             #include <cxxabi.h>
6365             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6366         ])], [
6367             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6368             AC_MSG_RESULT([yes])
6369         ], [AC_MSG_RESULT([no])])
6370     AC_LANG_POP([C++])
6372     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6373     AC_LANG_PUSH([C++])
6374     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6375             #include <cstddef>
6376             #include <cxxabi.h>
6377             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6378         ])], [
6379             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6380             AC_MSG_RESULT([yes])
6381         ], [AC_MSG_RESULT([no])])
6382     AC_LANG_POP([C++])
6384     dnl Available in GCC 4.9 and at least since Clang 3.4:
6385     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6386     AC_LANG_PUSH([C++])
6387     save_CXXFLAGS=$CXXFLAGS
6388     CXXFLAGS="$CXXFLAGS -Werror"
6389     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6390             struct __attribute__((warn_unused)) dummy {};
6391         ])], [
6392             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6393             AC_MSG_RESULT([yes])
6394         ], [AC_MSG_RESULT([no])])
6395     CXXFLAGS=$save_CXXFLAGS
6396 AC_LANG_POP([C++])
6399 AC_SUBST(HAVE_GCC_AVX)
6400 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6401 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6402 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6404 dnl ===================================================================
6405 dnl Identify the C++ library
6406 dnl ===================================================================
6408 AC_MSG_CHECKING([what the C++ library is])
6409 AC_LANG_PUSH([C++])
6410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6411 #include <utility>
6412 #ifndef __GLIBCXX__
6413 foo bar
6414 #endif
6415 ]])],
6416     [CPP_LIBRARY=GLIBCXX
6417      cpp_library_name="GNU libstdc++"
6418     ],
6419     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6420 #include <utility>
6421 #ifndef _LIBCPP_VERSION
6422 foo bar
6423 #endif
6424 ]])],
6425     [CPP_LIBRARY=LIBCPP
6426      cpp_library_name="LLVM libc++"
6427      AC_DEFINE([HAVE_LIBCXX])
6428     ],
6429     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6430 #include <utility>
6431 #ifndef _MSC_VER
6432 foo bar
6433 #endif
6434 ]])],
6435     [CPP_LIBRARY=MSVCRT
6436      cpp_library_name="Microsoft"
6437     ],
6438     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6439 AC_MSG_RESULT([$cpp_library_name])
6440 AC_LANG_POP([C++])
6442 dnl ===================================================================
6443 dnl Check for gperf
6444 dnl ===================================================================
6445 AC_PATH_PROG(GPERF, gperf)
6446 if test -z "$GPERF"; then
6447     AC_MSG_ERROR([gperf not found but needed. Install it.])
6449 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6450     GPERF=`cygpath -m $GPERF`
6452 AC_MSG_CHECKING([whether gperf is new enough])
6453 my_gperf_ver1=$($GPERF --version | head -n 1)
6454 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6455 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6456 if test "$my_gperf_ver3" -ge 301; then
6457     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6458 else
6459     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6461 AC_SUBST(GPERF)
6463 dnl ===================================================================
6464 dnl Check for system libcmis
6465 dnl ===================================================================
6466 # libcmis requires curl and we can't build curl for iOS
6467 if test $_os != iOS; then
6468     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6469     ENABLE_LIBCMIS=TRUE
6470 else
6471     ENABLE_LIBCMIS=
6473 AC_SUBST(ENABLE_LIBCMIS)
6475 dnl ===================================================================
6476 dnl C++11
6477 dnl ===================================================================
6479 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6480 CXXFLAGS_CXX11=
6481 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6482     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6483 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6484     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6485     for flag in $my_flags; do
6486         if test "$COM" = MSC; then
6487             flag="-Xclang $flag"
6488         fi
6489         save_CXXFLAGS=$CXXFLAGS
6490         CXXFLAGS="$CXXFLAGS $flag -Werror"
6491         if test "$SYSTEM_LIBCMIS" = TRUE; then
6492             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6493         fi
6494         AC_LANG_PUSH([C++])
6495         dnl Clang 3.9 supports __float128 since
6496         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6497         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6498         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6499         dnl $flag is supported below, so check this first):
6500         my_float128hack=
6501         my_float128hack_impl=-D__float128=void
6502         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6503             #include <vector>
6504             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6505             // (__float128)
6506             ]])
6507         ],,[
6508             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6509             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6510             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6511             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6512             dnl place where __float128 is used is in a template specialization, -D__float128=void
6513             dnl will avoid the problem there while still causing a problem if somebody actually uses
6514             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6515             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6516             dnl "fixed" with this hack):
6517             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6518             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6519                 #include <vector>
6520                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6521                 // (__float128)
6522                 ]])
6523             ],[my_float128hack=$my_float128hack_impl])
6524         ])
6525         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6526             #include <algorithm>
6527             #include <functional>
6528             #include <vector>
6530             #if defined SYSTEM_LIBCMIS
6531             // See ucb/source/ucp/cmis/auth_provider.hxx:
6532             #if !defined __clang__
6533             #pragma GCC diagnostic push
6534             #pragma GCC diagnostic ignored "-Wdeprecated"
6535             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6536             #endif
6537             #include <libcmis/libcmis.hxx>
6538             #if !defined __clang__
6539             #pragma GCC diagnostic pop
6540             #endif
6541             #endif
6543             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6544                 std::sort(v.begin(), v.end(), fn);
6545             }
6546             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6547         AC_LANG_POP([C++])
6548         CXXFLAGS=$save_CXXFLAGS
6549         if test -n "$CXXFLAGS_CXX11"; then
6550             break
6551         fi
6552     done
6554 if test -n "$CXXFLAGS_CXX11"; then
6555     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6556 else
6557     AC_MSG_ERROR(no)
6559 AC_SUBST(CXXFLAGS_CXX11)
6561 if test "$GCC" = "yes"; then
6562     save_CXXFLAGS=$CXXFLAGS
6563     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6564     CHECK_L_ATOMIC
6565     CXXFLAGS=$save_CXXFLAGS
6566     AC_SUBST(ATOMIC_LIB)
6569 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6570 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6571 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6572 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6573 dnl again towards 4.7.2:
6574 if test $CPP_LIBRARY = GLIBCXX; then
6575     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6576     AC_LANG_PUSH([C++])
6577     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6578 #include <list>
6579 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6580     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6581     //   GCC 4.7.0: 20120322
6582     //   GCC 4.7.1: 20120614
6583     // and using a range check is not possible as the mapping between
6584     // __GLIBCXX__ values and GCC versions is not monotonic
6585 /* ok */
6586 #else
6587 abi broken
6588 #endif
6589         ]])], [AC_MSG_RESULT(no, ok)],
6590         [AC_MSG_ERROR(yes)])
6591     AC_LANG_POP([C++])
6594 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6595 save_CXXFLAGS=$CXXFLAGS
6596 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6597 AC_LANG_PUSH([C++])
6599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6600 #include <stddef.h>
6602 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6604 namespace
6606         struct b
6607         {
6608                 int i;
6609                 int j;
6610         };
6612 ]], [[
6613 struct a
6615         int i;
6616         int j;
6618 a thinga[]={{0,0}, {1,1}};
6619 b thingb[]={{0,0}, {1,1}};
6620 size_t i = sizeof(sal_n_array_size(thinga));
6621 size_t j = sizeof(sal_n_array_size(thingb));
6622 return !(i != 0 && j != 0);
6624     ], [ AC_MSG_RESULT(yes) ],
6625     [ AC_MSG_ERROR(no)])
6626 AC_LANG_POP([C++])
6627 CXXFLAGS=$save_CXXFLAGS
6629 dnl _Pragma support (may require C++11)
6630 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6631     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6632     AC_LANG_PUSH([C++])
6633     save_CXXFLAGS=$CXXFLAGS
6634     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6635     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6636             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6637         ])], [
6638             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6639             AC_MSG_RESULT([yes])
6640         ], [AC_MSG_RESULT([no])])
6641     AC_LANG_POP([C++])
6642     CXXFLAGS=$save_CXXFLAGS
6645 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6646 if test "$GCC" = yes; then
6647     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6648     AC_LANG_PUSH([C++])
6649     save_CXXFLAGS=$CXXFLAGS
6650     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6651     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6652     CXXFLAGS=$save_CXXFLAGS
6653     AC_LANG_POP([C++])
6654     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6655         AC_MSG_RESULT([yes])
6656     else
6657         AC_MSG_RESULT([no])
6658     fi
6660 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6662 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6663 AC_LANG_PUSH([C++])
6664 save_CXXFLAGS=$CXXFLAGS
6665 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6666 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6667         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6668         // supporting it:
6669         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6670         struct S {
6671         private:
6672             S(S const &);
6673         public:
6674             S();
6675             ~S();
6676         };
6677         S copy();
6678         void f() { S c(copy()); }
6679         #endif
6680     ])], [
6681         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6682         AC_MSG_RESULT([yes])
6683     ], [AC_MSG_RESULT([no])])
6684 CXXFLAGS=$save_CXXFLAGS
6685 AC_LANG_POP([C++])
6687 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6688 AC_LANG_PUSH([C++])
6689 save_CXXFLAGS=$CXXFLAGS
6690 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6691 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6692         #include <algorithm>
6693         #include <initializer_list>
6694         #include <vector>
6695         template<typename T> class S {
6696         private:
6697             std::vector<T> v_;
6698         public:
6699             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6700         };
6701         constinit S<int> s{3, 2, 1};
6702     ])], [
6703         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6704         AC_MSG_RESULT([yes])
6705     ], [AC_MSG_RESULT([no])])
6706 CXXFLAGS=$save_CXXFLAGS
6707 AC_LANG_POP([C++])
6709 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6710 AC_LANG_PUSH([C++])
6711 save_CXXFLAGS=$CXXFLAGS
6712 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6713 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6714         #include <span>
6715         #include <type_traits>
6716         // Don't check size_type directly, as it was called index_type before P1872R0:
6717         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6718     ])], [
6719         AC_DEFINE([HAVE_CPP_SPAN],[1])
6720         AC_MSG_RESULT([yes])
6721     ], [AC_MSG_RESULT([no])])
6722 CXXFLAGS=$save_CXXFLAGS
6723 AC_LANG_POP([C++])
6725 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6726 AC_LANG_PUSH([C++])
6727 save_CXXFLAGS=$CXXFLAGS
6728 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6729 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6730         struct S1 { S1(S1 &&); };
6731         struct S2: S1 {};
6732         S1 f(S2 s) { return s; }
6733     ])], [
6734         AC_DEFINE([HAVE_P1155R3],[1])
6735         AC_MSG_RESULT([yes])
6736     ], [AC_MSG_RESULT([no])])
6737 CXXFLAGS=$save_CXXFLAGS
6738 AC_LANG_POP([C++])
6740 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6741 dnl which is included in -Wextra anyway):
6742 HAVE_WDEPRECATED_COPY_DTOR=
6743 if test "$GCC" = yes; then
6744     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6745     AC_LANG_PUSH([C++])
6746     save_CXXFLAGS=$CXXFLAGS
6747     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6748     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6749             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6750             AC_MSG_RESULT([yes])
6751         ], [AC_MSG_RESULT([no])])
6752     CXXFLAGS=$save_CXXFLAGS
6753     AC_LANG_POP([C++])
6755 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6757 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6758 dnl uninitialized warning for code like
6760 dnl   OString f();
6761 dnl   boost::optional<OString> * g(bool b) {
6762 dnl       boost::optional<OString> o;
6763 dnl       if (b) o = f();
6764 dnl       return new boost::optional<OString>(o);
6765 dnl   }
6767 dnl (as is e.g. present, in a slightly more elaborate form, in
6768 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6769 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6770 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6771 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6772     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6773     AC_LANG_PUSH([C++])
6774     save_CXXFLAGS=$CXXFLAGS
6775     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6776     if test "$ENABLE_OPTIMIZED" = TRUE; then
6777         CXXFLAGS="$CXXFLAGS -O2"
6778     else
6779         CXXFLAGS="$CXXFLAGS -O0"
6780     fi
6781     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6782             #include <new>
6783             void f1(int);
6784             struct S1 {
6785                 ~S1() { f1(n); }
6786                 int n = 0;
6787             };
6788             struct S2 {
6789                 S2() {}
6790                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6791                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6792                 void set(S1 s) {
6793                     new (stg) S1(s);
6794                     init = true;
6795                 }
6796                 bool init = false;
6797                 char stg[sizeof (S1)];
6798             } ;
6799             S1 f2();
6800             S2 * f3(bool b) {
6801                 S2 o;
6802                 if (b) o.set(f2());
6803                 return new S2(o);
6804             }
6805         ]])], [AC_MSG_RESULT([no])], [
6806             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6807             AC_MSG_RESULT([yes])
6808         ])
6809     CXXFLAGS=$save_CXXFLAGS
6810     AC_LANG_POP([C++])
6812 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6814 dnl ===================================================================
6815 dnl CPU Intrinsics support - SSE, AVX
6816 dnl ===================================================================
6818 CXXFLAGS_INTRINSICS_SSE2=
6819 CXXFLAGS_INTRINSICS_SSSE3=
6820 CXXFLAGS_INTRINSICS_SSE41=
6821 CXXFLAGS_INTRINSICS_SSE42=
6822 CXXFLAGS_INTRINSICS_AVX=
6823 CXXFLAGS_INTRINSICS_AVX2=
6824 CXXFLAGS_INTRINSICS_F16C=
6825 CXXFLAGS_INTRINSICS_FMA=
6827 if test "$GCC" = "yes"; then
6828     flag_sse2=-msse2
6829     flag_ssse3=-mssse3
6830     flag_sse41=-msse4.1
6831     flag_sse42=-msse4.2
6832     flag_avx=-mavx
6833     flag_avx2=-mavx2
6834     flag_f16c=-mf16c
6835     flag_fma=-mfma
6836 else
6837     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6838     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6839     # SSE2 seems to be SSE2+.
6840     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6841     # is not empty (and can be tested in gbuild), moreover we now default to SSE
6842     # for 32bit x86.
6843     flag_sse2=-arch:SSE2
6844     flag_ssse3=-arch:SSE2
6845     flag_sse41=-arch:SSE2
6846     flag_sse42=-arch:SSE2
6847     flag_avx=-arch:AVX
6848     flag_avx2=-arch:AVX2
6849     # These are part of -arch:AVX2
6850     flag_f16c=-arch:AVX2
6851     flag_fma=-arch:AVX2
6854 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6855 AC_LANG_PUSH([C++])
6856 save_CXXFLAGS=$CXXFLAGS
6857 CXXFLAGS="$CXXFLAGS $flag_sse2"
6858 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6859     #include <emmintrin.h>
6860     int main () {
6861         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6862         c = _mm_xor_si128 (a, b);
6863         return 0;
6864     }
6865     ])],
6866     [can_compile_sse2=yes],
6867     [can_compile_sse2=no])
6868 AC_LANG_POP([C++])
6869 CXXFLAGS=$save_CXXFLAGS
6870 AC_MSG_RESULT([${can_compile_sse2}])
6871 if test "${can_compile_sse2}" = "yes" ; then
6872     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6875 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6876 AC_LANG_PUSH([C++])
6877 save_CXXFLAGS=$CXXFLAGS
6878 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6879 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6880     #include <tmmintrin.h>
6881     int main () {
6882         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6883         c = _mm_maddubs_epi16 (a, b);
6884         return 0;
6885     }
6886     ])],
6887     [can_compile_ssse3=yes],
6888     [can_compile_ssse3=no])
6889 AC_LANG_POP([C++])
6890 CXXFLAGS=$save_CXXFLAGS
6891 AC_MSG_RESULT([${can_compile_ssse3}])
6892 if test "${can_compile_ssse3}" = "yes" ; then
6893     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6896 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6897 AC_LANG_PUSH([C++])
6898 save_CXXFLAGS=$CXXFLAGS
6899 CXXFLAGS="$CXXFLAGS $flag_sse41"
6900 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6901     #include <smmintrin.h>
6902     int main () {
6903         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6904         c = _mm_cmpeq_epi64 (a, b);
6905         return 0;
6906     }
6907     ])],
6908     [can_compile_sse41=yes],
6909     [can_compile_sse41=no])
6910 AC_LANG_POP([C++])
6911 CXXFLAGS=$save_CXXFLAGS
6912 AC_MSG_RESULT([${can_compile_sse41}])
6913 if test "${can_compile_sse41}" = "yes" ; then
6914     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6917 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6918 AC_LANG_PUSH([C++])
6919 save_CXXFLAGS=$CXXFLAGS
6920 CXXFLAGS="$CXXFLAGS $flag_sse42"
6921 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6922     #include <nmmintrin.h>
6923     int main () {
6924         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6925         c = _mm_cmpgt_epi64 (a, b);
6926         return 0;
6927     }
6928     ])],
6929     [can_compile_sse42=yes],
6930     [can_compile_sse42=no])
6931 AC_LANG_POP([C++])
6932 CXXFLAGS=$save_CXXFLAGS
6933 AC_MSG_RESULT([${can_compile_sse42}])
6934 if test "${can_compile_sse42}" = "yes" ; then
6935     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
6938 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6939 AC_LANG_PUSH([C++])
6940 save_CXXFLAGS=$CXXFLAGS
6941 CXXFLAGS="$CXXFLAGS $flag_avx"
6942 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6943     #include <immintrin.h>
6944     int main () {
6945         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6946         c = _mm256_xor_ps(a, b);
6947         return 0;
6948     }
6949     ])],
6950     [can_compile_avx=yes],
6951     [can_compile_avx=no])
6952 AC_LANG_POP([C++])
6953 CXXFLAGS=$save_CXXFLAGS
6954 AC_MSG_RESULT([${can_compile_avx}])
6955 if test "${can_compile_avx}" = "yes" ; then
6956     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
6959 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6960 AC_LANG_PUSH([C++])
6961 save_CXXFLAGS=$CXXFLAGS
6962 CXXFLAGS="$CXXFLAGS $flag_avx2"
6963 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6964     #include <immintrin.h>
6965     int main () {
6966         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6967         c = _mm256_maddubs_epi16(a, b);
6968         return 0;
6969     }
6970     ])],
6971     [can_compile_avx2=yes],
6972     [can_compile_avx2=no])
6973 AC_LANG_POP([C++])
6974 CXXFLAGS=$save_CXXFLAGS
6975 AC_MSG_RESULT([${can_compile_avx2}])
6976 if test "${can_compile_avx2}" = "yes" ; then
6977     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
6980 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
6981 AC_LANG_PUSH([C++])
6982 save_CXXFLAGS=$CXXFLAGS
6983 CXXFLAGS="$CXXFLAGS $flag_f16c"
6984 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6985     #include <immintrin.h>
6986     int main () {
6987         __m128i a = _mm_set1_epi32 (0);
6988         __m128 c;
6989         c = _mm_cvtph_ps(a);
6990         return 0;
6991     }
6992     ])],
6993     [can_compile_f16c=yes],
6994     [can_compile_f16c=no])
6995 AC_LANG_POP([C++])
6996 CXXFLAGS=$save_CXXFLAGS
6997 AC_MSG_RESULT([${can_compile_f16c}])
6998 if test "${can_compile_f16c}" = "yes" ; then
6999     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7002 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7003 AC_LANG_PUSH([C++])
7004 save_CXXFLAGS=$CXXFLAGS
7005 CXXFLAGS="$CXXFLAGS $flag_fma"
7006 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7007     #include <immintrin.h>
7008     int main () {
7009         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7010         d = _mm256_fmadd_ps(a, b, c);
7011         return 0;
7012     }
7013     ])],
7014     [can_compile_fma=yes],
7015     [can_compile_fma=no])
7016 AC_LANG_POP([C++])
7017 CXXFLAGS=$save_CXXFLAGS
7018 AC_MSG_RESULT([${can_compile_fma}])
7019 if test "${can_compile_fma}" = "yes" ; then
7020     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7023 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7024 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7025 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7026 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7027 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7028 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7029 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7030 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7032 dnl ===================================================================
7033 dnl system stl sanity tests
7034 dnl ===================================================================
7035 if test "$_os" != "WINNT"; then
7037     AC_LANG_PUSH([C++])
7039     save_CPPFLAGS="$CPPFLAGS"
7040     if test -n "$MACOSX_SDK_PATH"; then
7041         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7042     fi
7044     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7045     # only.
7046     if test "$CPP_LIBRARY" = GLIBCXX; then
7047         dnl gcc#19664, gcc#22482, rhbz#162935
7048         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7049         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7050         AC_MSG_RESULT([$stlvisok])
7051         if test "$stlvisok" = "no"; then
7052             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7053         fi
7054     fi
7056     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7057     # when we don't make any dynamic libraries?
7058     if test "$DISABLE_DYNLOADING" = ""; then
7059         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7060         cat > conftestlib1.cc <<_ACEOF
7061 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7062 struct S2: S1<int> { virtual ~S2(); };
7063 S2::~S2() {}
7064 _ACEOF
7065         cat > conftestlib2.cc <<_ACEOF
7066 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7067 struct S2: S1<int> { virtual ~S2(); };
7068 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7069 _ACEOF
7070         gccvisinlineshiddenok=yes
7071         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7072             gccvisinlineshiddenok=no
7073         else
7074             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7075             dnl known to not work with -z defs (unsetting which makes the test
7076             dnl moot, though):
7077             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7078             if test "$COM_IS_CLANG" = TRUE; then
7079                 for i in $CXX $CXXFLAGS; do
7080                     case $i in
7081                     -fsanitize=*)
7082                         my_linkflagsnoundefs=
7083                         break
7084                         ;;
7085                     esac
7086                 done
7087             fi
7088             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7089                 gccvisinlineshiddenok=no
7090             fi
7091         fi
7093         rm -fr libconftest*
7094         AC_MSG_RESULT([$gccvisinlineshiddenok])
7095         if test "$gccvisinlineshiddenok" = "no"; then
7096             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7097         fi
7098     fi
7100    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7101     cat >visibility.cxx <<_ACEOF
7102 #pragma GCC visibility push(hidden)
7103 struct __attribute__ ((visibility ("default"))) TestStruct {
7104   static void Init();
7106 __attribute__ ((visibility ("default"))) void TestFunc() {
7107   TestStruct::Init();
7109 _ACEOF
7110     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7111         gccvisbroken=yes
7112     else
7113         case "$host_cpu" in
7114         i?86|x86_64)
7115             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7116                 gccvisbroken=no
7117             else
7118                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7119                     gccvisbroken=no
7120                 else
7121                     gccvisbroken=yes
7122                 fi
7123             fi
7124             ;;
7125         *)
7126             gccvisbroken=no
7127             ;;
7128         esac
7129     fi
7130     rm -f visibility.s visibility.cxx
7132     AC_MSG_RESULT([$gccvisbroken])
7133     if test "$gccvisbroken" = "yes"; then
7134         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7135     fi
7137     CPPFLAGS="$save_CPPFLAGS"
7139     AC_LANG_POP([C++])
7142 dnl ===================================================================
7143 dnl  Clang++ tests
7144 dnl ===================================================================
7146 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7147 if test "$GCC" = "yes"; then
7148     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7149     AC_LANG_PUSH([C++])
7150     save_CXXFLAGS=$CXXFLAGS
7151     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7152     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7153     CXXFLAGS=$save_CXXFLAGS
7154     AC_LANG_POP([C++])
7155     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7156         AC_MSG_RESULT([yes])
7157     else
7158         AC_MSG_RESULT([no])
7159     fi
7161 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7163 dnl ===================================================================
7164 dnl Compiler plugins
7165 dnl ===================================================================
7167 COMPILER_PLUGINS=
7168 # currently only Clang
7170 if test "$COM_IS_CLANG" != "TRUE"; then
7171     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7172         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7173         enable_compiler_plugins=no
7174     fi
7177 if test "$COM_IS_CLANG" = "TRUE"; then
7178     if test -n "$enable_compiler_plugins"; then
7179         compiler_plugins="$enable_compiler_plugins"
7180     elif test -n "$ENABLE_DBGUTIL"; then
7181         compiler_plugins=test
7182     else
7183         compiler_plugins=no
7184     fi
7185     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7186         if test "$CLANGVER" -lt 50002; then
7187             if test "$compiler_plugins" = yes; then
7188                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7189             else
7190                 compiler_plugins=no
7191             fi
7192         fi
7193     fi
7194     if test "$compiler_plugins" != "no"; then
7195         dnl The prefix where Clang resides, override to where Clang resides if
7196         dnl using a source build:
7197         if test -z "$CLANGDIR"; then
7198             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7199         fi
7200         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7201         if test -z "$COMPILER_PLUGINS_CXX"; then
7202             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7203         fi
7204         clangbindir=$CLANGDIR/bin
7205         if test "$build_os" = "cygwin"; then
7206             clangbindir=$(cygpath -u "$clangbindir")
7207         fi
7208         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7209         if test -n "$LLVM_CONFIG"; then
7210             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7211             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7212             if test -z "$CLANGLIBDIR"; then
7213                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7214             fi
7215             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7216             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7217             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7218             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7219                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7220             fi
7221             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7222             clangobjdir=$($LLVM_CONFIG --obj-root)
7223             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7224                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7225             fi
7226         fi
7227         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7228         AC_LANG_PUSH([C++])
7229         save_CXX=$CXX
7230         save_CXXCPP=$CXXCPP
7231         save_CPPFLAGS=$CPPFLAGS
7232         save_CXXFLAGS=$CXXFLAGS
7233         save_LDFLAGS=$LDFLAGS
7234         save_LIBS=$LIBS
7235         CXX=$COMPILER_PLUGINS_CXX
7236         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7237         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7238         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7239         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7240             [COMPILER_PLUGINS=TRUE],
7241             [
7242             if test "$compiler_plugins" = "yes"; then
7243                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7244             else
7245                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7246                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7247             fi
7248             ])
7249         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7250         dnl comment in compilerplugins/Makefile-clang.mk:
7251         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7252             LDFLAGS=""
7253             AC_MSG_CHECKING([for clang libraries to use])
7254             if test -z "$CLANGTOOLLIBS"; then
7255                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7256  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7257                 AC_LINK_IFELSE([
7258                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7259                         [[ clang::FullSourceLoc().dump(); ]])
7260                 ],[CLANGTOOLLIBS="$LIBS"],[])
7261             fi
7262             if test -z "$CLANGTOOLLIBS"; then
7263                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7264                 AC_LINK_IFELSE([
7265                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7266                         [[ clang::FullSourceLoc().dump(); ]])
7267                 ],[CLANGTOOLLIBS="$LIBS"],[])
7268             fi
7269             AC_MSG_RESULT([$CLANGTOOLLIBS])
7270             if test -z "$CLANGTOOLLIBS"; then
7271                 if test "$compiler_plugins" = "yes"; then
7272                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7273                 else
7274                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7275                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7276                 fi
7277                 COMPILER_PLUGINS=
7278             fi
7279             if test -n "$COMPILER_PLUGINS"; then
7280                 if test -z "$CLANGSYSINCLUDE"; then
7281                     if test -n "$LLVM_CONFIG"; then
7282                         # Path to the clang system headers (no idea if there's a better way to get it).
7283                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7284                     fi
7285                 fi
7286             fi
7287         fi
7288         CXX=$save_CXX
7289         CXXCPP=$save_CXXCPP
7290         CPPFLAGS=$save_CPPFLAGS
7291         CXXFLAGS=$save_CXXFLAGS
7292         LDFLAGS=$save_LDFLAGS
7293         LIBS="$save_LIBS"
7294         AC_LANG_POP([C++])
7295     fi
7296 else
7297     if test "$enable_compiler_plugins" = "yes"; then
7298         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7299     fi
7301 AC_SUBST(COMPILER_PLUGINS)
7302 AC_SUBST(COMPILER_PLUGINS_CXX)
7303 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7304 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7305 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7306 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7307 AC_SUBST(CLANGDIR)
7308 AC_SUBST(CLANGLIBDIR)
7309 AC_SUBST(CLANGTOOLLIBS)
7310 AC_SUBST(CLANGSYSINCLUDE)
7312 # Plugin to help linker.
7313 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7314 # This makes --enable-lto build with clang work.
7315 AC_SUBST(LD_PLUGIN)
7317 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7318 AC_SUBST(HAVE_POSIX_FALLOCATE)
7320 dnl ===================================================================
7321 dnl Custom build version
7322 dnl ===================================================================
7324 AC_MSG_CHECKING([whether to add custom build version])
7325 if test "$with_build_version" != ""; then
7326     BUILD_VER_STRING=$with_build_version
7327     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7328 else
7329     BUILD_VER_STRING=
7330     AC_MSG_RESULT([no])
7332 AC_SUBST(BUILD_VER_STRING)
7334 JITC_PROCESSOR_TYPE=""
7335 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7336     # IBMs JDK needs this...
7337     JITC_PROCESSOR_TYPE=6
7338     export JITC_PROCESSOR_TYPE
7340 AC_SUBST([JITC_PROCESSOR_TYPE])
7342 # Misc Windows Stuff
7343 AC_ARG_WITH(ucrt-dir,
7344     AS_HELP_STRING([--with-ucrt-dir],
7345         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7346         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7347         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7348             Windows6.1-KB2999226-x64.msu
7349             Windows6.1-KB2999226-x86.msu
7350             Windows8.1-KB2999226-x64.msu
7351             Windows8.1-KB2999226-x86.msu
7352             Windows8-RT-KB2999226-x64.msu
7353             Windows8-RT-KB2999226-x86.msu
7354         A zip archive including those files is available from Microsoft site:
7355         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7357 UCRT_REDISTDIR="$with_ucrt_dir"
7358 if test $_os = "WINNT"; then
7359     find_msvc_x64_dlls
7360     find_msms
7361     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7362     MSVC_DLLS="$msvcdlls"
7363     MSM_PATH=`win_short_path_for_make "$msmdir"`
7364     # MSVC 15.3 changed it to VC141
7365     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7366         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7367     else
7368         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7369     fi
7371     if test "$UCRT_REDISTDIR" = "no"; then
7372         dnl explicitly disabled
7373         UCRT_REDISTDIR=""
7374     else
7375         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7376                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7377                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7378                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7379                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7380                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7381             UCRT_REDISTDIR=""
7382             if test -n "$PKGFORMAT"; then
7383                for i in $PKGFORMAT; do
7384                    case "$i" in
7385                    msi)
7386                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7387                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7388                        ;;
7389                    esac
7390                done
7391             fi
7392         fi
7393     fi
7396 AC_SUBST(UCRT_REDISTDIR)
7397 AC_SUBST(MSVC_DLL_PATH)
7398 AC_SUBST(MSVC_DLLS)
7399 AC_SUBST(MSM_PATH)
7401 dnl ===================================================================
7402 dnl Checks for Java
7403 dnl ===================================================================
7404 if test "$ENABLE_JAVA" != ""; then
7406     # Windows-specific tests
7407     if test "$build_os" = "cygwin"; then
7408         if test "$BITNESS_OVERRIDE" = 64; then
7409             bitness=64
7410         else
7411             bitness=32
7412         fi
7414         if test -z "$with_jdk_home"; then
7415             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7416             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7417             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7418             if test -n "$regvalue"; then
7419                 ver=$regvalue
7420                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7421                 _jdk_home=$regvalue
7422             fi
7423             if test -z "$with_jdk_home"; then
7424                 for ver in 1.8; do
7425                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7426                     if test -n "$regvalue"; then
7427                         _jdk_home=$regvalue
7428                         break
7429                     fi
7430                 done
7431             fi
7432             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7433                 with_jdk_home="$_jdk_home"
7434                 howfound="found automatically"
7435             else
7436                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7437             fi
7438         else
7439             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7440             howfound="you passed"
7441         fi
7442     fi
7444     # 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.
7445     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7446     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7447         with_jdk_home=`/usr/libexec/java_home`
7448     fi
7450     JAVA_HOME=; export JAVA_HOME
7451     if test -z "$with_jdk_home"; then
7452         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7453     else
7454         _java_path="$with_jdk_home/bin/$with_java"
7455         dnl Check if there is a Java interpreter at all.
7456         if test -x "$_java_path"; then
7457             JAVAINTERPRETER=$_java_path
7458         else
7459             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7460         fi
7461     fi
7463     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7464     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7465     dnl loaded by java to run JunitTests:
7466     if test "$build_os" = "cygwin"; then
7467         shortjdkhome=`cygpath -d "$with_jdk_home"`
7468         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
7469             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7470             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7471         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
7472             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7473             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7474         fi
7476         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7477             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7478         fi
7479         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7480     elif test "$cross_compiling" != "yes"; then
7481         case $CPUNAME in
7482             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7483                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7484                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7485                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7486                 fi
7487                 ;;
7488             *) # assumption: everything else 32-bit
7489                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7490                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7491                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7492                 fi
7493                 ;;
7494         esac
7495     fi
7498 dnl ===================================================================
7499 dnl Checks for JDK.
7500 dnl ===================================================================
7502 # Note that JAVA_HOME as for now always means the *build* platform's
7503 # JAVA_HOME. Whether all the complexity here actually is needed any
7504 # more or not, no idea.
7506 if test "$ENABLE_JAVA" != ""; then
7507     _gij_longver=0
7508     AC_MSG_CHECKING([the installed JDK])
7509     if test -n "$JAVAINTERPRETER"; then
7510         dnl java -version sends output to stderr!
7511         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7512             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7513         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7514             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7515         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7516             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7517         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7518             JDK=ibm
7520             dnl IBM JDK specific tests
7521             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7522             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7524             if test "$_jdk_ver" -lt 10800; then
7525                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7526             fi
7528             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7530             if test "$with_jdk_home" = ""; then
7531                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7532 you must use the "--with-jdk-home" configure option explicitly])
7533             fi
7535             JAVA_HOME=$with_jdk_home
7536         else
7537             JDK=sun
7539             dnl Sun JDK specific tests
7540             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7541             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7543             if test "$_jdk_ver" -lt 10800; then
7544                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7545             fi
7546             if test "$_jdk_ver" -gt 10800; then
7547                 JAVA_CLASSPATH_NOT_SET=TRUE
7548             fi
7550             AC_MSG_RESULT([found (JDK $_jdk)])
7551             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7552             if test "$_os" = "WINNT"; then
7553                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7554             fi
7556             # set to limit VM usage for JunitTests
7557             JAVAIFLAGS=-Xmx64M
7558             # set to limit VM usage for javac
7559             JAVAFLAGS=-J-Xmx128M
7560         fi
7561     else
7562         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7563     fi
7564 else
7565     dnl Java disabled
7566     JAVA_HOME=
7567     export JAVA_HOME
7570 dnl ===================================================================
7571 dnl Checks for javac
7572 dnl ===================================================================
7573 if test "$ENABLE_JAVA" != ""; then
7574     javacompiler="javac"
7575     : ${JAVA_SOURCE_VER=8}
7576     : ${JAVA_TARGET_VER=8}
7577     if test -z "$with_jdk_home"; then
7578         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7579     else
7580         _javac_path="$with_jdk_home/bin/$javacompiler"
7581         dnl Check if there is a Java compiler at all.
7582         if test -x "$_javac_path"; then
7583             JAVACOMPILER=$_javac_path
7584         fi
7585     fi
7586     if test -z "$JAVACOMPILER"; then
7587         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7588     fi
7589     if test "$build_os" = "cygwin"; then
7590         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7591             JAVACOMPILER="${JAVACOMPILER}.exe"
7592         fi
7593         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7594     fi
7597 dnl ===================================================================
7598 dnl Checks for javadoc
7599 dnl ===================================================================
7600 if test "$ENABLE_JAVA" != ""; then
7601     if test -z "$with_jdk_home"; then
7602         AC_PATH_PROG(JAVADOC, javadoc)
7603     else
7604         _javadoc_path="$with_jdk_home/bin/javadoc"
7605         dnl Check if there is a javadoc at all.
7606         if test -x "$_javadoc_path"; then
7607             JAVADOC=$_javadoc_path
7608         else
7609             AC_PATH_PROG(JAVADOC, javadoc)
7610         fi
7611     fi
7612     if test -z "$JAVADOC"; then
7613         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7614     fi
7615     if test "$build_os" = "cygwin"; then
7616         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7617             JAVADOC="${JAVADOC}.exe"
7618         fi
7619         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7620     fi
7622     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7623     JAVADOCISGJDOC="yes"
7624     fi
7626 AC_SUBST(JAVADOCISGJDOC)
7628 if test "$ENABLE_JAVA" != ""; then
7629     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7630     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7631         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7632            # try to recover first by looking whether we have an alternative
7633            # system as in Debian or newer SuSEs where following /usr/bin/javac
7634            # over /etc/alternatives/javac leads to the right bindir where we
7635            # just need to strip a bit away to get a valid JAVA_HOME
7636            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7637         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7638             # maybe only one level of symlink (e.g. on Mac)
7639             JAVA_HOME=$(readlink $JAVACOMPILER)
7640             if test "$(dirname $JAVA_HOME)" = "."; then
7641                 # we've got no path to trim back
7642                 JAVA_HOME=""
7643             fi
7644         else
7645             # else warn
7646             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7647             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7648             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7649             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7650         fi
7651         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7652         if test "$JAVA_HOME" != "/usr"; then
7653             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7654                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7655                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7656                 dnl Tiger already returns a JDK path...
7657                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7658             else
7659                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7660                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7661                 dnl that checks which version to run
7662                 if test -f "$JAVA_HOME"; then
7663                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7664                 fi
7665             fi
7666         fi
7667     fi
7668     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7670     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7671     if test -z "$JAVA_HOME"; then
7672         if test "x$with_jdk_home" = "x"; then
7673             cat > findhome.java <<_ACEOF
7674 [import java.io.File;
7676 class findhome
7678     public static void main(String args[])
7679     {
7680         String jrelocation = System.getProperty("java.home");
7681         File jre = new File(jrelocation);
7682         System.out.println(jre.getParent());
7683     }
7685 _ACEOF
7686             AC_MSG_CHECKING([if javac works])
7687             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7688             AC_TRY_EVAL(javac_cmd)
7689             if test $? = 0 -a -f ./findhome.class; then
7690                 AC_MSG_RESULT([javac works])
7691             else
7692                 echo "configure: javac test failed" >&5
7693                 cat findhome.java >&5
7694                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7695             fi
7696             AC_MSG_CHECKING([if gij knows its java.home])
7697             JAVA_HOME=`$JAVAINTERPRETER findhome`
7698             if test $? = 0 -a "$JAVA_HOME" != ""; then
7699                 AC_MSG_RESULT([$JAVA_HOME])
7700             else
7701                 echo "configure: java test failed" >&5
7702                 cat findhome.java >&5
7703                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7704             fi
7705             # clean-up after ourselves
7706             rm -f ./findhome.java ./findhome.class
7707         else
7708             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7709         fi
7710     fi
7712     # now check if $JAVA_HOME is really valid
7713     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7714         case "${JAVA_HOME}" in
7715             /Library/Java/JavaVirtualMachines/*)
7716                 ;;
7717             *)
7718                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7719                 ;;
7720         esac
7721         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7722             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7723             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7724             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7725             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7726             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7727             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7728         fi
7729     fi
7730     PathFormat "$JAVA_HOME"
7731     JAVA_HOME="$formatted_path"
7734 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7735     "$_os" != Darwin
7736 then
7737     AC_MSG_CHECKING([for JAWT lib])
7738     if test "$_os" = WINNT; then
7739         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7740         JAWTLIB=jawt.lib
7741     else
7742         case "$host_cpu" in
7743         arm*)
7744             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7745             JAVA_ARCH=$my_java_arch
7746             ;;
7747         i*86)
7748             my_java_arch=i386
7749             ;;
7750         m68k)
7751             my_java_arch=m68k
7752             ;;
7753         powerpc)
7754             my_java_arch=ppc
7755             ;;
7756         powerpc64)
7757             my_java_arch=ppc64
7758             ;;
7759         powerpc64le)
7760             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7761             JAVA_ARCH=$my_java_arch
7762             ;;
7763         sparc64)
7764             my_java_arch=sparcv9
7765             ;;
7766         x86_64)
7767             my_java_arch=amd64
7768             ;;
7769         *)
7770             my_java_arch=$host_cpu
7771             ;;
7772         esac
7773         # This is where JDK9 puts the library
7774         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7775             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7776         else
7777             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7778         fi
7779         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7780     fi
7781     AC_MSG_RESULT([$JAWTLIB])
7783 AC_SUBST(JAWTLIB)
7785 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7786     case "$host_os" in
7788     aix*)
7789         JAVAINC="-I$JAVA_HOME/include"
7790         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7791         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7792         ;;
7794     cygwin*)
7795         JAVAINC="-I$JAVA_HOME/include/win32"
7796         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7797         ;;
7799     darwin*)
7800         if test -d "$JAVA_HOME/include/darwin"; then
7801             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7802         else
7803             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7804         fi
7805         ;;
7807     dragonfly*)
7808         JAVAINC="-I$JAVA_HOME/include"
7809         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7810         ;;
7812     freebsd*)
7813         JAVAINC="-I$JAVA_HOME/include"
7814         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7815         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7816         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7817         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7818         ;;
7820     k*bsd*-gnu*)
7821         JAVAINC="-I$JAVA_HOME/include"
7822         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7823         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7824         ;;
7826     linux-gnu*)
7827         JAVAINC="-I$JAVA_HOME/include"
7828         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7829         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7830         ;;
7832     *netbsd*)
7833         JAVAINC="-I$JAVA_HOME/include"
7834         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7835         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7836        ;;
7838     openbsd*)
7839         JAVAINC="-I$JAVA_HOME/include"
7840         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7841         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7842         ;;
7844     solaris*)
7845         JAVAINC="-I$JAVA_HOME/include"
7846         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7847         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7848         ;;
7849     esac
7851 SOLARINC="$SOLARINC $JAVAINC"
7853 AC_SUBST(JAVACOMPILER)
7854 AC_SUBST(JAVADOC)
7855 AC_SUBST(JAVAINTERPRETER)
7856 AC_SUBST(JAVAIFLAGS)
7857 AC_SUBST(JAVAFLAGS)
7858 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7859 AC_SUBST(JAVA_HOME)
7860 AC_SUBST(JAVA_SOURCE_VER)
7861 AC_SUBST(JAVA_TARGET_VER)
7862 AC_SUBST(JDK)
7865 dnl ===================================================================
7866 dnl Export file validation
7867 dnl ===================================================================
7868 AC_MSG_CHECKING([whether to enable export file validation])
7869 if test "$with_export_validation" != "no"; then
7870     if test -z "$ENABLE_JAVA"; then
7871         if test "$with_export_validation" = "yes"; then
7872             AC_MSG_ERROR([requested, but Java is disabled])
7873         else
7874             AC_MSG_RESULT([no, as Java is disabled])
7875         fi
7876     elif ! test -d "${SRC_ROOT}/schema"; then
7877         if test "$with_export_validation" = "yes"; then
7878             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7879         else
7880             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7881         fi
7882     else
7883         AC_MSG_RESULT([yes])
7884         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7886         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7887         if test -z "$ODFVALIDATOR"; then
7888             # remember to download the ODF toolkit with validator later
7889             AC_MSG_NOTICE([no odfvalidator found, will download it])
7890             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7891             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7893             # and fetch name of odfvalidator jar name from download.lst
7894             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7895             AC_SUBST(ODFVALIDATOR_JAR)
7897             if test -z "$ODFVALIDATOR_JAR"; then
7898                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7899             fi
7900         fi
7901         if test "$build_os" = "cygwin"; then
7902             # In case of Cygwin it will be executed from Windows,
7903             # so we need to run bash and absolute path to validator
7904             # so instead of "odfvalidator" it will be
7905             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7906             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7907         else
7908             ODFVALIDATOR="sh $ODFVALIDATOR"
7909         fi
7910         AC_SUBST(ODFVALIDATOR)
7913         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7914         if test -z "$OFFICEOTRON"; then
7915             # remember to download the officeotron with validator later
7916             AC_MSG_NOTICE([no officeotron found, will download it])
7917             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7918             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7920             # and fetch name of officeotron jar name from download.lst
7921             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7922             AC_SUBST(OFFICEOTRON_JAR)
7924             if test -z "$OFFICEOTRON_JAR"; then
7925                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7926             fi
7927         else
7928             # check version of existing officeotron
7929             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7930             if test 0"$OFFICEOTRON_VER" -lt 704; then
7931                 AC_MSG_ERROR([officeotron too old])
7932             fi
7933         fi
7934         if test "$build_os" = "cygwin"; then
7935             # In case of Cygwin it will be executed from Windows,
7936             # so we need to run bash and absolute path to validator
7937             # so instead of "odfvalidator" it will be
7938             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7939             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7940         else
7941             OFFICEOTRON="sh $OFFICEOTRON"
7942         fi
7943     fi
7944     AC_SUBST(OFFICEOTRON)
7945 else
7946     AC_MSG_RESULT([no])
7949 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7950 if test "$with_bffvalidator" != "no"; then
7951     AC_DEFINE(HAVE_BFFVALIDATOR)
7953     if test "$with_export_validation" = "no"; then
7954         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7955     fi
7957     if test "$with_bffvalidator" = "yes"; then
7958         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7959     else
7960         BFFVALIDATOR="$with_bffvalidator"
7961     fi
7963     if test "$build_os" = "cygwin"; then
7964         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7965             AC_MSG_RESULT($BFFVALIDATOR)
7966         else
7967             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7968         fi
7969     elif test -n "$BFFVALIDATOR"; then
7970         # We are not in Cygwin but need to run Windows binary with wine
7971         AC_PATH_PROGS(WINE, wine)
7973         # so swap in a shell wrapper that converts paths transparently
7974         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7975         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7976         AC_SUBST(BFFVALIDATOR_EXE)
7977         AC_MSG_RESULT($BFFVALIDATOR)
7978     else
7979         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7980     fi
7981     AC_SUBST(BFFVALIDATOR)
7982 else
7983     AC_MSG_RESULT([no])
7986 dnl ===================================================================
7987 dnl Check for C preprocessor to use
7988 dnl ===================================================================
7989 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7990 if test -n "$with_idlc_cpp"; then
7991     AC_MSG_RESULT([$with_idlc_cpp])
7992     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7993 else
7994     AC_MSG_RESULT([ucpp])
7995     AC_MSG_CHECKING([which ucpp tp use])
7996     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7997         AC_MSG_RESULT([external])
7998         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7999     else
8000         AC_MSG_RESULT([internal])
8001         BUILD_TYPE="$BUILD_TYPE UCPP"
8002     fi
8004 AC_SUBST(SYSTEM_UCPP)
8006 dnl ===================================================================
8007 dnl Check for epm (not needed for Windows)
8008 dnl ===================================================================
8009 AC_MSG_CHECKING([whether to enable EPM for packing])
8010 if test "$enable_epm" = "yes"; then
8011     AC_MSG_RESULT([yes])
8012     if test "$_os" != "WINNT"; then
8013         if test $_os = Darwin; then
8014             EPM=internal
8015         elif test -n "$with_epm"; then
8016             EPM=$with_epm
8017         else
8018             AC_PATH_PROG(EPM, epm, no)
8019         fi
8020         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8021             AC_MSG_NOTICE([EPM will be built.])
8022             BUILD_TYPE="$BUILD_TYPE EPM"
8023             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8024         else
8025             # Gentoo has some epm which is something different...
8026             AC_MSG_CHECKING([whether the found epm is the right epm])
8027             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8028                 AC_MSG_RESULT([yes])
8029             else
8030                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8031             fi
8032             AC_MSG_CHECKING([epm version])
8033             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8034             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8035                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8036                 AC_MSG_RESULT([OK, >= 3.7])
8037             else
8038                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8039                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8040             fi
8041         fi
8042     fi
8044     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8045         AC_MSG_CHECKING([for rpm])
8046         for a in "$RPM" rpmbuild rpm; do
8047             $a --usage >/dev/null 2> /dev/null
8048             if test $? -eq 0; then
8049                 RPM=$a
8050                 break
8051             else
8052                 $a --version >/dev/null 2> /dev/null
8053                 if test $? -eq 0; then
8054                     RPM=$a
8055                     break
8056                 fi
8057             fi
8058         done
8059         if test -z "$RPM"; then
8060             AC_MSG_ERROR([not found])
8061         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8062             RPM_PATH=`which $RPM`
8063             AC_MSG_RESULT([$RPM_PATH])
8064             SCPDEFS="$SCPDEFS -DWITH_RPM"
8065         else
8066             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8067         fi
8068     fi
8069     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8070         AC_PATH_PROG(DPKG, dpkg, no)
8071         if test "$DPKG" = "no"; then
8072             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8073         fi
8074     fi
8075     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8076        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8077         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8078             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8079                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8080                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8081                     AC_MSG_RESULT([yes])
8082                 else
8083                     AC_MSG_RESULT([no])
8084                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8085                         _pt="rpm"
8086                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8087                         add_warning "the rpms will need to be installed with --nodeps"
8088                     else
8089                         _pt="pkg"
8090                     fi
8091                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8092                     add_warning "the ${_pt}s will not be relocatable"
8093                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8094                                  relocation will work, you need to patch your epm with the
8095                                  patch in epm/epm-3.7.patch or build with
8096                                  --with-epm=internal which will build a suitable epm])
8097                 fi
8098             fi
8099         fi
8100     fi
8101     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8102         AC_PATH_PROG(PKGMK, pkgmk, no)
8103         if test "$PKGMK" = "no"; then
8104             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8105         fi
8106     fi
8107     AC_SUBST(RPM)
8108     AC_SUBST(DPKG)
8109     AC_SUBST(PKGMK)
8110 else
8111     for i in $PKGFORMAT; do
8112         case "$i" in
8113         aix | bsd | deb | pkg | rpm | native | portable)
8114             AC_MSG_ERROR(
8115                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8116             ;;
8117         esac
8118     done
8119     AC_MSG_RESULT([no])
8120     EPM=NO
8122 AC_SUBST(EPM)
8124 ENABLE_LWP=
8125 if test "$enable_lotuswordpro" = "yes"; then
8126     ENABLE_LWP="TRUE"
8128 AC_SUBST(ENABLE_LWP)
8130 dnl ===================================================================
8131 dnl Check for building ODK
8132 dnl ===================================================================
8133 if test "$enable_odk" = no; then
8134     unset DOXYGEN
8135 else
8136     if test "$with_doxygen" = no; then
8137         AC_MSG_CHECKING([for doxygen])
8138         unset DOXYGEN
8139         AC_MSG_RESULT([no])
8140     else
8141         if test "$with_doxygen" = yes; then
8142             AC_PATH_PROG([DOXYGEN], [doxygen])
8143             if test -z "$DOXYGEN"; then
8144                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8145             fi
8146             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8147                 if ! dot -V 2>/dev/null; then
8148                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8149                 fi
8150             fi
8151         else
8152             AC_MSG_CHECKING([for doxygen])
8153             DOXYGEN=$with_doxygen
8154             AC_MSG_RESULT([$DOXYGEN])
8155         fi
8156         if test -n "$DOXYGEN"; then
8157             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8158             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8159             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8160                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8161             fi
8162         fi
8163     fi
8165 AC_SUBST([DOXYGEN])
8167 AC_MSG_CHECKING([whether to build the ODK])
8168 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8169     AC_MSG_RESULT([yes])
8171     if test "$with_java" != "no"; then
8172         AC_MSG_CHECKING([whether to build unowinreg.dll])
8173         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8174             # build on Win by default
8175             enable_build_unowinreg=yes
8176         fi
8177         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8178             AC_MSG_RESULT([no])
8179             BUILD_UNOWINREG=
8180         else
8181             AC_MSG_RESULT([yes])
8182             BUILD_UNOWINREG=TRUE
8183         fi
8184         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8185             if test -z "$with_mingw_cross_compiler"; then
8186                 dnl Guess...
8187                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8188             elif test -x "$with_mingw_cross_compiler"; then
8189                  MINGWCXX="$with_mingw_cross_compiler"
8190             else
8191                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8192             fi
8194             if test "$MINGWCXX" = "false"; then
8195                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8196             fi
8198             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8199             if test -x "$mingwstrip_test"; then
8200                 MINGWSTRIP="$mingwstrip_test"
8201             else
8202                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8203             fi
8205             if test "$MINGWSTRIP" = "false"; then
8206                 AC_MSG_ERROR(MinGW32 binutils not found.)
8207             fi
8208         fi
8209     fi
8210     BUILD_TYPE="$BUILD_TYPE ODK"
8211 else
8212     AC_MSG_RESULT([no])
8213     BUILD_UNOWINREG=
8215 AC_SUBST(BUILD_UNOWINREG)
8216 AC_SUBST(MINGWCXX)
8217 AC_SUBST(MINGWSTRIP)
8219 dnl ===================================================================
8220 dnl Check for system zlib
8221 dnl ===================================================================
8222 if test "$with_system_zlib" = "auto"; then
8223     case "$_os" in
8224     WINNT)
8225         with_system_zlib="$with_system_libs"
8226         ;;
8227     *)
8228         if test "$enable_fuzzers" != "yes"; then
8229             with_system_zlib=yes
8230         else
8231             with_system_zlib=no
8232         fi
8233         ;;
8234     esac
8237 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8238 dnl and has no pkg-config for it at least on some tinderboxes,
8239 dnl so leaving that out for now
8240 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8241 AC_MSG_CHECKING([which zlib to use])
8242 if test "$with_system_zlib" = "yes"; then
8243     AC_MSG_RESULT([external])
8244     SYSTEM_ZLIB=TRUE
8245     AC_CHECK_HEADER(zlib.h, [],
8246         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8247     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8248         [AC_MSG_ERROR(zlib not found or functional)], [])
8249 else
8250     AC_MSG_RESULT([internal])
8251     SYSTEM_ZLIB=
8252     BUILD_TYPE="$BUILD_TYPE ZLIB"
8253     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8254     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8256 AC_SUBST(ZLIB_CFLAGS)
8257 AC_SUBST(ZLIB_LIBS)
8258 AC_SUBST(SYSTEM_ZLIB)
8260 dnl ===================================================================
8261 dnl Check for system jpeg
8262 dnl ===================================================================
8263 AC_MSG_CHECKING([which libjpeg to use])
8264 if test "$with_system_jpeg" = "yes"; then
8265     AC_MSG_RESULT([external])
8266     SYSTEM_LIBJPEG=TRUE
8267     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8268         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8269     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8270         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8271 else
8272     SYSTEM_LIBJPEG=
8273     AC_MSG_RESULT([internal, libjpeg-turbo])
8274     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8275     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8276     if test "$COM" = "MSC"; then
8277         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8278     else
8279         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8280     fi
8282     case "$host_cpu" in
8283     x86_64 | amd64 | i*86 | x86 | ia32)
8284         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8285         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8286             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8287                 NASM="$LODE_HOME/opt/bin/nasm"
8288             elif test -x "/opt/lo/bin/nasm"; then
8289                 NASM="/opt/lo/bin/nasm"
8290             fi
8291         fi
8293         if test -n "$NASM"; then
8294             AC_MSG_CHECKING([for object file format of host system])
8295             case "$host_os" in
8296               cygwin* | mingw* | pw32* | interix*)
8297                 case "$host_cpu" in
8298                   x86_64)
8299                     objfmt='Win64-COFF'
8300                     ;;
8301                   *)
8302                     objfmt='Win32-COFF'
8303                     ;;
8304                 esac
8305               ;;
8306               msdosdjgpp* | go32*)
8307                 objfmt='COFF'
8308               ;;
8309               os2-emx*) # not tested
8310                 objfmt='MSOMF' # obj
8311               ;;
8312               linux*coff* | linux*oldld*)
8313                 objfmt='COFF' # ???
8314               ;;
8315               linux*aout*)
8316                 objfmt='a.out'
8317               ;;
8318               linux*)
8319                 case "$host_cpu" in
8320                   x86_64)
8321                     objfmt='ELF64'
8322                     ;;
8323                   *)
8324                     objfmt='ELF'
8325                     ;;
8326                 esac
8327               ;;
8328               kfreebsd* | freebsd* | netbsd* | openbsd*)
8329                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8330                   objfmt='BSD-a.out'
8331                 else
8332                   case "$host_cpu" in
8333                     x86_64 | amd64)
8334                       objfmt='ELF64'
8335                       ;;
8336                     *)
8337                       objfmt='ELF'
8338                       ;;
8339                   esac
8340                 fi
8341               ;;
8342               solaris* | sunos* | sysv* | sco*)
8343                 case "$host_cpu" in
8344                   x86_64)
8345                     objfmt='ELF64'
8346                     ;;
8347                   *)
8348                     objfmt='ELF'
8349                     ;;
8350                 esac
8351               ;;
8352               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8353                 case "$host_cpu" in
8354                   x86_64)
8355                     objfmt='Mach-O64'
8356                     ;;
8357                   *)
8358                     objfmt='Mach-O'
8359                     ;;
8360                 esac
8361               ;;
8362               *)
8363                 objfmt='ELF ?'
8364               ;;
8365             esac
8367             AC_MSG_RESULT([$objfmt])
8368             if test "$objfmt" = 'ELF ?'; then
8369               objfmt='ELF'
8370               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8371             fi
8373             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8374             case "$objfmt" in
8375               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8376               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8377               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8378               COFF)       NAFLAGS='-fcoff -DCOFF';;
8379               a.out)      NAFLAGS='-faout -DAOUT';;
8380               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8381               ELF)        NAFLAGS='-felf -DELF';;
8382               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8383               RDF)        NAFLAGS='-frdf -DRDF';;
8384               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8385               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8386             esac
8387             AC_MSG_RESULT([$NAFLAGS])
8389             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8390             cat > conftest.asm << EOF
8391             [%line __oline__ "configure"
8392                     section .text
8393                     global  _main,main
8394             _main:
8395             main:   xor     eax,eax
8396                     ret
8397             ]
8399             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8400             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8401               AC_MSG_RESULT(yes)
8402             else
8403               echo "configure: failed program was:" >&AC_FD_CC
8404               cat conftest.asm >&AC_FD_CC
8405               rm -rf conftest*
8406               AC_MSG_RESULT(no)
8407               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8408               NASM=""
8409             fi
8411         fi
8413         if test -z "$NASM"; then
8414 cat << _EOS
8415 ****************************************************************************
8416 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8417 To get one please:
8419 _EOS
8420             if test "$build_os" = "cygwin"; then
8421 cat << _EOS
8422 install a pre-compiled binary for Win32
8424 mkdir -p /opt/lo/bin
8425 cd /opt/lo/bin
8426 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8427 chmod +x nasm
8429 or get and install one from http://www.nasm.us/
8431 Then re-run autogen.sh
8433 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8434 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8436 _EOS
8437             else
8438 cat << _EOS
8439 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8441 _EOS
8442             fi
8443             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8444             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8445         fi
8446       ;;
8447     esac
8450 AC_SUBST(NASM)
8451 AC_SUBST(LIBJPEG_CFLAGS)
8452 AC_SUBST(LIBJPEG_LIBS)
8453 AC_SUBST(SYSTEM_LIBJPEG)
8455 dnl ===================================================================
8456 dnl Check for system clucene
8457 dnl ===================================================================
8458 dnl we should rather be using
8459 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8460 dnl but the contribs-lib check seems tricky
8461 AC_MSG_CHECKING([which clucene to use])
8462 if test "$with_system_clucene" = "yes"; then
8463     AC_MSG_RESULT([external])
8464     SYSTEM_CLUCENE=TRUE
8465     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8466     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8467     FilterLibs "${CLUCENE_LIBS}"
8468     CLUCENE_LIBS="${filteredlibs}"
8469     AC_LANG_PUSH([C++])
8470     save_CXXFLAGS=$CXXFLAGS
8471     save_CPPFLAGS=$CPPFLAGS
8472     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8473     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8474     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8475     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8476     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8477                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8478     CXXFLAGS=$save_CXXFLAGS
8479     CPPFLAGS=$save_CPPFLAGS
8480     AC_LANG_POP([C++])
8482     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8483 else
8484     AC_MSG_RESULT([internal])
8485     SYSTEM_CLUCENE=
8486     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8488 AC_SUBST(SYSTEM_CLUCENE)
8489 AC_SUBST(CLUCENE_CFLAGS)
8490 AC_SUBST(CLUCENE_LIBS)
8492 dnl ===================================================================
8493 dnl Check for system expat
8494 dnl ===================================================================
8495 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8497 dnl ===================================================================
8498 dnl Check for system xmlsec
8499 dnl ===================================================================
8500 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8502 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8503 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8504     ENABLE_EOT="TRUE"
8505     AC_DEFINE([ENABLE_EOT])
8506     AC_MSG_RESULT([yes])
8508     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8509 else
8510     ENABLE_EOT=
8511     AC_MSG_RESULT([no])
8513 AC_SUBST([ENABLE_EOT])
8515 dnl ===================================================================
8516 dnl Check for DLP libs
8517 dnl ===================================================================
8518 AS_IF([test "$COM" = "MSC"],
8519       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8520       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8522 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8524 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8526 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8528 AS_IF([test "$COM" = "MSC"],
8529       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8530       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8532 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8534 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8536 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8537 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8539 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8541 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8543 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8545 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8546 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8548 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8549 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8551 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8553 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8554 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8556 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8558 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8560 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8562 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8564 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8565 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8567 dnl ===================================================================
8568 dnl Check for system lcms2
8569 dnl ===================================================================
8570 if test "$with_system_lcms2" != "yes"; then
8571     SYSTEM_LCMS2=
8573 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8574 if test "$GCC" = "yes"; then
8575     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8577 if test "$COM" = "MSC"; then # override the above
8578     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8581 dnl ===================================================================
8582 dnl Check for system cppunit
8583 dnl ===================================================================
8584 if test "$_os" != "Android" ; then
8585     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8588 dnl ===================================================================
8589 dnl Check whether freetype is available
8590 dnl ===================================================================
8591 if test  "$test_freetype" = "yes"; then
8592     AC_MSG_CHECKING([whether freetype is available])
8593     # FreeType has 3 different kinds of versions
8594     # * release, like 2.4.10
8595     # * libtool, like 13.0.7 (this what pkg-config returns)
8596     # * soname
8597     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8598     #
8599     # 9.9.3 is 2.2.0
8600     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8601     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8602     FilterLibs "${FREETYPE_LIBS}"
8603     FREETYPE_LIBS="${filteredlibs}"
8604     SYSTEM_FREETYPE=TRUE
8605 else
8606     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8607     if test "x$ac_config_site_64bit_host" = xYES; then
8608         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8609     else
8610         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8611     fi
8613 AC_SUBST(FREETYPE_CFLAGS)
8614 AC_SUBST(FREETYPE_LIBS)
8615 AC_SUBST([SYSTEM_FREETYPE])
8617 # ===================================================================
8618 # Check for system libxslt
8619 # to prevent incompatibilities between internal libxml2 and external libxslt,
8620 # or vice versa, use with_system_libxml here
8621 # ===================================================================
8622 if test "$with_system_libxml" = "auto"; then
8623     case "$_os" in
8624     WINNT|iOS|Android)
8625         with_system_libxml="$with_system_libs"
8626         ;;
8627     *)
8628         if test "$enable_fuzzers" != "yes"; then
8629             with_system_libxml=yes
8630         else
8631             with_system_libxml=no
8632         fi
8633         ;;
8634     esac
8637 AC_MSG_CHECKING([which libxslt to use])
8638 if test "$with_system_libxml" = "yes"; then
8639     AC_MSG_RESULT([external])
8640     SYSTEM_LIBXSLT=TRUE
8641     if test "$_os" = "Darwin"; then
8642         dnl make sure to use SDK path
8643         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8644         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8645         dnl omit -L/usr/lib
8646         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8647         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8648     else
8649         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8650         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8651         FilterLibs "${LIBXSLT_LIBS}"
8652         LIBXSLT_LIBS="${filteredlibs}"
8653         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8654         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8655         FilterLibs "${LIBEXSLT_LIBS}"
8656         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8657     fi
8659     dnl Check for xsltproc
8660     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8661     if test "$XSLTPROC" = "no"; then
8662         AC_MSG_ERROR([xsltproc is required])
8663     fi
8664 else
8665     AC_MSG_RESULT([internal])
8666     SYSTEM_LIBXSLT=
8667     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8669     if test "$cross_compiling" = "yes"; then
8670         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8671         if test "$XSLTPROC" = "no"; then
8672             AC_MSG_ERROR([xsltproc is required])
8673         fi
8674     fi
8676 AC_SUBST(SYSTEM_LIBXSLT)
8677 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8678     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8680 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8682 AC_SUBST(LIBEXSLT_CFLAGS)
8683 AC_SUBST(LIBEXSLT_LIBS)
8684 AC_SUBST(LIBXSLT_CFLAGS)
8685 AC_SUBST(LIBXSLT_LIBS)
8686 AC_SUBST(XSLTPROC)
8688 # ===================================================================
8689 # Check for system libxml
8690 # ===================================================================
8691 AC_MSG_CHECKING([which libxml to use])
8692 if test "$with_system_libxml" = "yes"; then
8693     AC_MSG_RESULT([external])
8694     SYSTEM_LIBXML=TRUE
8695     if test "$_os" = "Darwin"; then
8696         dnl make sure to use SDK path
8697         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8698         dnl omit -L/usr/lib
8699         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8700     elif test $_os = iOS; then
8701         dnl make sure to use SDK path
8702         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8703         LIBXML_CFLAGS="-I$usr/include/libxml2"
8704         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8705     else
8706         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8707         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8708         FilterLibs "${LIBXML_LIBS}"
8709         LIBXML_LIBS="${filteredlibs}"
8710     fi
8712     dnl Check for xmllint
8713     AC_PATH_PROG(XMLLINT, xmllint, no)
8714     if test "$XMLLINT" = "no"; then
8715         AC_MSG_ERROR([xmllint is required])
8716     fi
8717 else
8718     AC_MSG_RESULT([internal])
8719     SYSTEM_LIBXML=
8720     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8721     if test "$COM" = "MSC"; then
8722         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8723     fi
8724     if test "$COM" = "MSC"; then
8725         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8726     else
8727         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8728     fi
8729     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8731 AC_SUBST(SYSTEM_LIBXML)
8732 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8733     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8735 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8736 AC_SUBST(LIBXML_CFLAGS)
8737 AC_SUBST(LIBXML_LIBS)
8738 AC_SUBST(XMLLINT)
8740 # =====================================================================
8741 # Checking for a Python interpreter with version >= 2.7.
8742 # Build and runtime requires Python 3 compatible version (>= 2.7).
8743 # Optionally user can pass an option to configure, i. e.
8744 # ./configure PYTHON=/usr/bin/python
8745 # =====================================================================
8746 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8747     if test -n "$PYTHON"; then
8748         PYTHON_FOR_BUILD=$PYTHON
8749     else
8750         # This allows a lack of system python with no error, we use internal one in that case.
8751         AM_PATH_PYTHON([2.7],, [:])
8752         # Clean PYTHON_VERSION checked below if cross-compiling
8753         PYTHON_VERSION=""
8754         if test "$PYTHON" != ":"; then
8755             PYTHON_FOR_BUILD=$PYTHON
8756         fi
8757     fi
8759 AC_SUBST(PYTHON_FOR_BUILD)
8761 # Checks for Python to use for Pyuno
8762 AC_MSG_CHECKING([which Python to use for Pyuno])
8763 case "$enable_python" in
8764 no|disable)
8765     if test -z $PYTHON_FOR_BUILD; then
8766         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8767         # requirement from the choice whether to include Python stuff in the installer, but why
8768         # bother?
8769         AC_MSG_ERROR([Python is required at build time.])
8770     fi
8771     enable_python=no
8772     AC_MSG_RESULT([none])
8773     ;;
8774 ""|yes|auto)
8775     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8776         AC_MSG_RESULT([no, overridden by --disable-scripting])
8777         enable_python=no
8778     elif test $build_os = cygwin; then
8779         dnl When building on Windows we don't attempt to use any installed
8780         dnl "system"  Python.
8781         AC_MSG_RESULT([fully internal])
8782         enable_python=internal
8783     elif test "$cross_compiling" = yes; then
8784         AC_MSG_RESULT([system])
8785         enable_python=system
8786     else
8787         # Unset variables set by the above AM_PATH_PYTHON so that
8788         # we actually do check anew.
8789         AC_MSG_RESULT([])
8790         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
8791         AM_PATH_PYTHON([3.3],, [:])
8792         AC_MSG_CHECKING([which Python to use for Pyuno])
8793         if test "$PYTHON" = ":"; then
8794             if test -z "$PYTHON_FOR_BUILD"; then
8795                 AC_MSG_RESULT([fully internal])
8796             else
8797                 AC_MSG_RESULT([internal])
8798             fi
8799             enable_python=internal
8800         else
8801             AC_MSG_RESULT([system])
8802             enable_python=system
8803         fi
8804     fi
8805     ;;
8806 internal)
8807     AC_MSG_RESULT([internal])
8808     ;;
8809 fully-internal)
8810     AC_MSG_RESULT([fully internal])
8811     enable_python=internal
8812     ;;
8813 system)
8814     AC_MSG_RESULT([system])
8815     if test "$_os" = Darwin; then
8816         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])
8817     fi
8818     ;;
8820     AC_MSG_ERROR([Incorrect --enable-python option])
8821     ;;
8822 esac
8824 if test $enable_python != no; then
8825     BUILD_TYPE="$BUILD_TYPE PYUNO"
8828 if test $enable_python = system; then
8829     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8830         # Fallback: Accept these in the environment, or as set above
8831         # for MacOSX.
8832         :
8833     elif test "$cross_compiling" != yes; then
8834         # Unset variables set by the above AM_PATH_PYTHON so that
8835         # we actually do check anew.
8836         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
8837         # This causes an error if no python command is found
8838         AM_PATH_PYTHON([3.3])
8839         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8840         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8841         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8842         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8843         if test -z "$PKG_CONFIG"; then
8844             PYTHON_CFLAGS="-I$python_include"
8845             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8846         elif $PKG_CONFIG --exists python-$python_version-embed; then
8847             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8848             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8849         elif $PKG_CONFIG --exists python-$python_version; then
8850             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8851             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8852         else
8853             PYTHON_CFLAGS="-I$python_include"
8854             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8855         fi
8856         FilterLibs "${PYTHON_LIBS}"
8857         PYTHON_LIBS="${filteredlibs}"
8858     else
8859         dnl How to find out the cross-compilation Python installation path?
8860         AC_MSG_CHECKING([for python version])
8861         AS_IF([test -n "$PYTHON_VERSION"],
8862               [AC_MSG_RESULT([$PYTHON_VERSION])],
8863               [AC_MSG_RESULT([not found])
8864                AC_MSG_ERROR([no usable python found])])
8865         test -n "$PYTHON_CFLAGS" && break
8866     fi
8868     dnl Check if the headers really work
8869     save_CPPFLAGS="$CPPFLAGS"
8870     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8871     AC_CHECK_HEADER(Python.h)
8872     CPPFLAGS="$save_CPPFLAGS"
8874     # let the PYTHON_FOR_BUILD match the same python installation that
8875     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8876     # better for PythonTests.
8877     PYTHON_FOR_BUILD=$PYTHON
8880 if test "$with_lxml" != no; then
8881     if test -z "$PYTHON_FOR_BUILD"; then
8882         case $build_os in
8883             cygwin)
8884                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8885                 ;;
8886             *)
8887                 if test "$cross_compiling" != yes ; then
8888                     BUILD_TYPE="$BUILD_TYPE LXML"
8889                 fi
8890                 ;;
8891         esac
8892     else
8893         AC_MSG_CHECKING([for python lxml])
8894         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8895             AC_MSG_RESULT([yes])
8896         else
8897             case $build_os in
8898                 cygwin)
8899                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8900                     ;;
8901                 *)
8902                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8903                         BUILD_TYPE="$BUILD_TYPE LXML"
8904                         AC_MSG_RESULT([no, using internal lxml])
8905                     else
8906                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8907                     fi
8908                     ;;
8909             esac
8910         fi
8911     fi
8914 dnl By now enable_python should be "system", "internal" or "no"
8915 case $enable_python in
8916 system)
8917     SYSTEM_PYTHON=TRUE
8919     if test "x$ac_cv_header_Python_h" != "xyes"; then
8920        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8921     fi
8923     AC_LANG_PUSH(C)
8924     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8925     AC_MSG_CHECKING([for correct python library version])
8926        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8927 #include <Python.h>
8929 int main(int argc, char **argv) {
8930    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8931        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8932    else return 1;
8934        ]])],[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])])
8935     CFLAGS=$save_CFLAGS
8936     AC_LANG_POP(C)
8938     dnl FIXME Check if the Python library can be linked with, too?
8939     ;;
8941 internal)
8942     SYSTEM_PYTHON=
8943     PYTHON_VERSION_MAJOR=3
8944     PYTHON_VERSION_MINOR=5
8945     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
8946     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8947         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8948     fi
8949     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8950     BUILD_TYPE="$BUILD_TYPE PYTHON"
8951     # Embedded Python dies without Home set
8952     if test "$HOME" = ""; then
8953         export HOME=""
8954     fi
8955     ;;
8957     DISABLE_PYTHON=TRUE
8958     SYSTEM_PYTHON=
8959     ;;
8961     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8962     ;;
8963 esac
8965 AC_SUBST(DISABLE_PYTHON)
8966 AC_SUBST(SYSTEM_PYTHON)
8967 AC_SUBST(PYTHON_CFLAGS)
8968 AC_SUBST(PYTHON_LIBS)
8969 AC_SUBST(PYTHON_VERSION)
8970 AC_SUBST(PYTHON_VERSION_MAJOR)
8971 AC_SUBST(PYTHON_VERSION_MINOR)
8973 ENABLE_MARIADBC=TRUE
8974 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8975     ENABLE_MARIADBC=
8977 MARIADBC_MAJOR=1
8978 MARIADBC_MINOR=0
8979 MARIADBC_MICRO=2
8980 if test "$ENABLE_MARIADBC" = "TRUE"; then
8981     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8984 AC_SUBST(ENABLE_MARIADBC)
8985 AC_SUBST(MARIADBC_MAJOR)
8986 AC_SUBST(MARIADBC_MINOR)
8987 AC_SUBST(MARIADBC_MICRO)
8989 if test "$ENABLE_MARIADBC" = "TRUE"; then
8990     dnl ===================================================================
8991     dnl Check for system MariaDB
8992     dnl ===================================================================
8993     AC_MSG_CHECKING([which MariaDB to use])
8994     if test "$with_system_mariadb" = "yes"; then
8995         AC_MSG_RESULT([external])
8996         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8997         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8998         if test -z "$MARIADBCONFIG"; then
8999             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9000             if test -z "$MARIADBCONFIG"; then
9001                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9002                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9003             fi
9004         fi
9005         AC_MSG_CHECKING([MariaDB version])
9006         MARIADB_VERSION=`$MARIADBCONFIG --version`
9007         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9008         if test "$MARIADB_MAJOR" -ge "5"; then
9009             AC_MSG_RESULT([OK])
9010         else
9011             AC_MSG_ERROR([too old, use 5.0.x or later])
9012         fi
9013         AC_MSG_CHECKING([for MariaDB Client library])
9014         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9015         if test "$COM_IS_CLANG" = TRUE; then
9016             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9017         fi
9018         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9019         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9020         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9021         dnl linux32:
9022         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9023             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9024             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9025                 | sed -e 's|/lib64/|/lib/|')
9026         fi
9027         FilterLibs "${MARIADB_LIBS}"
9028         MARIADB_LIBS="${filteredlibs}"
9029         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9030         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9031         if test "$enable_bundle_mariadb" = "yes"; then
9032             AC_MSG_RESULT([yes])
9033             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9034             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9036 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9038 /g' | grep -E '(mysqlclient|mariadb)')
9039             if test "$_os" = "Darwin"; then
9040                 LIBMARIADB=${LIBMARIADB}.dylib
9041             elif test "$_os" = "WINNT"; then
9042                 LIBMARIADB=${LIBMARIADB}.dll
9043             else
9044                 LIBMARIADB=${LIBMARIADB}.so
9045             fi
9046             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9047             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9048             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9049                 AC_MSG_RESULT([found.])
9050                 PathFormat "$LIBMARIADB_PATH"
9051                 LIBMARIADB_PATH="$formatted_path"
9052             else
9053                 AC_MSG_ERROR([not found.])
9054             fi
9055         else
9056             AC_MSG_RESULT([no])
9057             BUNDLE_MARIADB_CONNECTOR_C=
9058         fi
9059     else
9060         AC_MSG_RESULT([internal])
9061         SYSTEM_MARIADB_CONNECTOR_C=
9062         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9063         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9064         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9065     fi
9067     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9068     AC_SUBST(MARIADB_CFLAGS)
9069     AC_SUBST(MARIADB_LIBS)
9070     AC_SUBST(LIBMARIADB)
9071     AC_SUBST(LIBMARIADB_PATH)
9072     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9075 dnl ===================================================================
9076 dnl Check for system hsqldb
9077 dnl ===================================================================
9078 if test "$with_java" != "no"; then
9079     HSQLDB_USE_JDBC_4_1=
9080     AC_MSG_CHECKING([which hsqldb to use])
9081     if test "$with_system_hsqldb" = "yes"; then
9082         AC_MSG_RESULT([external])
9083         SYSTEM_HSQLDB=TRUE
9084         if test -z $HSQLDB_JAR; then
9085             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9086         fi
9087         if ! test -f $HSQLDB_JAR; then
9088                AC_MSG_ERROR(hsqldb.jar not found.)
9089         fi
9090         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9091         export HSQLDB_JAR
9092         if $PERL -e \
9093            'use Archive::Zip;
9094             my $file = "$ENV{'HSQLDB_JAR'}";
9095             my $zip = Archive::Zip->new( $file );
9096             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9097             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9098             {
9099                 push @l, split(/\n/, $mf);
9100                 foreach my $line (@l)
9101                 {
9102                     if ($line =~ m/Specification-Version:/)
9103                     {
9104                         ($t, $version) = split (/:/,$line);
9105                         $version =~ s/^\s//;
9106                         ($a, $b, $c, $d) = split (/\./,$version);
9107                         if ($c == "0" && $d > "8")
9108                         {
9109                             exit 0;
9110                         }
9111                         else
9112                         {
9113                             exit 1;
9114                         }
9115                     }
9116                 }
9117             }
9118             else
9119             {
9120                 exit 1;
9121             }'; then
9122             AC_MSG_RESULT([yes])
9123         else
9124             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9125         fi
9126     else
9127         AC_MSG_RESULT([internal])
9128         SYSTEM_HSQLDB=
9129         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9130         NEED_ANT=TRUE
9131         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9132         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9133         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9134             AC_MSG_RESULT([yes])
9135             HSQLDB_USE_JDBC_4_1=TRUE
9136         else
9137             AC_MSG_RESULT([no])
9138         fi
9139     fi
9140     AC_SUBST(SYSTEM_HSQLDB)
9141     AC_SUBST(HSQLDB_JAR)
9142     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9145 dnl ===================================================================
9146 dnl Check for PostgreSQL stuff
9147 dnl ===================================================================
9148 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9149 if test "x$enable_postgresql_sdbc" != "xno"; then
9150     AC_MSG_RESULT([yes])
9151     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9153     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9154         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9155     fi
9156     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9157         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9158     fi
9160     postgres_interface=""
9161     if test "$with_system_postgresql" = "yes"; then
9162         postgres_interface="external PostgreSQL"
9163         SYSTEM_POSTGRESQL=TRUE
9164         if test "$_os" = Darwin; then
9165             supp_path=''
9166             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9167                 pg_supp_path="$P_SEP$d$pg_supp_path"
9168             done
9169         fi
9170         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9171         if test -n "$PGCONFIG"; then
9172             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9173             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9174         else
9175             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9176               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9177               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9178             ],[
9179               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9180             ])
9181         fi
9182         FilterLibs "${POSTGRESQL_LIB}"
9183         POSTGRESQL_LIB="${filteredlibs}"
9184     else
9185         # if/when anything else than PostgreSQL uses Kerberos,
9186         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9187         WITH_KRB5=
9188         WITH_GSSAPI=
9189         case "$_os" in
9190         Darwin)
9191             # macOS has system MIT Kerberos 5 since 10.4
9192             if test "$with_krb5" != "no"; then
9193                 WITH_KRB5=TRUE
9194                 save_LIBS=$LIBS
9195                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9196                 # that the libraries where these functions are located on macOS will change, is it?
9197                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9198                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9199                 KRB5_LIBS=$LIBS
9200                 LIBS=$save_LIBS
9201                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9202                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9203                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9204                 LIBS=$save_LIBS
9205             fi
9206             if test "$with_gssapi" != "no"; then
9207                 WITH_GSSAPI=TRUE
9208                 save_LIBS=$LIBS
9209                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9210                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9211                 GSSAPI_LIBS=$LIBS
9212                 LIBS=$save_LIBS
9213             fi
9214             ;;
9215         WINNT)
9216             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9217                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9218             fi
9219             ;;
9220         Linux|GNU|*BSD|DragonFly)
9221             if test "$with_krb5" != "no"; then
9222                 WITH_KRB5=TRUE
9223                 save_LIBS=$LIBS
9224                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9225                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9226                 KRB5_LIBS=$LIBS
9227                 LIBS=$save_LIBS
9228                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9229                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9230                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9231                 LIBS=$save_LIBS
9232             fi
9233             if test "$with_gssapi" != "no"; then
9234                 WITH_GSSAPI=TRUE
9235                 save_LIBS=$LIBS
9236                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9237                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9238                 GSSAPI_LIBS=$LIBS
9239                 LIBS=$save_LIBS
9240             fi
9241             ;;
9242         *)
9243             if test "$with_krb5" = "yes"; then
9244                 WITH_KRB5=TRUE
9245                 save_LIBS=$LIBS
9246                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9247                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9248                 KRB5_LIBS=$LIBS
9249                 LIBS=$save_LIBS
9250                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9251                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9252                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9253                 LIBS=$save_LIBS
9254             fi
9255             if test "$with_gssapi" = "yes"; then
9256                 WITH_GSSAPI=TRUE
9257                 save_LIBS=$LIBS
9258                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9259                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9260                 LIBS=$save_LIBS
9261                 GSSAPI_LIBS=$LIBS
9262             fi
9263         esac
9265         if test -n "$with_libpq_path"; then
9266             SYSTEM_POSTGRESQL=TRUE
9267             postgres_interface="external libpq"
9268             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9269             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9270         else
9271             SYSTEM_POSTGRESQL=
9272             postgres_interface="internal"
9273             POSTGRESQL_LIB=""
9274             POSTGRESQL_INC="%OVERRIDE_ME%"
9275             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9276         fi
9277     fi
9279     AC_MSG_CHECKING([PostgreSQL C interface])
9280     AC_MSG_RESULT([$postgres_interface])
9282     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9283         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9284         save_CFLAGS=$CFLAGS
9285         save_CPPFLAGS=$CPPFLAGS
9286         save_LIBS=$LIBS
9287         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9288         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9289         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9290         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9291             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9292         CFLAGS=$save_CFLAGS
9293         CPPFLAGS=$save_CPPFLAGS
9294         LIBS=$save_LIBS
9295     fi
9296     BUILD_POSTGRESQL_SDBC=TRUE
9297 else
9298     AC_MSG_RESULT([no])
9300 AC_SUBST(WITH_KRB5)
9301 AC_SUBST(WITH_GSSAPI)
9302 AC_SUBST(GSSAPI_LIBS)
9303 AC_SUBST(KRB5_LIBS)
9304 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9305 AC_SUBST(SYSTEM_POSTGRESQL)
9306 AC_SUBST(POSTGRESQL_INC)
9307 AC_SUBST(POSTGRESQL_LIB)
9309 dnl ===================================================================
9310 dnl Check for Firebird stuff
9311 dnl ===================================================================
9312 ENABLE_FIREBIRD_SDBC=
9313 if test "$enable_firebird_sdbc" = "yes" ; then
9314     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9316     dnl ===================================================================
9317     dnl Check for system Firebird
9318     dnl ===================================================================
9319     AC_MSG_CHECKING([which Firebird to use])
9320     if test "$with_system_firebird" = "yes"; then
9321         AC_MSG_RESULT([external])
9322         SYSTEM_FIREBIRD=TRUE
9323         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9324         if test -z "$FIREBIRDCONFIG"; then
9325             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9326             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9327                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9328             ])
9329             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9330         else
9331             AC_MSG_NOTICE([fb_config found])
9332             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9333             AC_MSG_CHECKING([for Firebird Client library])
9334             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9335             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9336             FilterLibs "${FIREBIRD_LIBS}"
9337             FIREBIRD_LIBS="${filteredlibs}"
9338         fi
9339         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9340         AC_MSG_CHECKING([Firebird version])
9341         if test -n "${FIREBIRD_VERSION}"; then
9342             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9343             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9344             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9345                 AC_MSG_RESULT([OK])
9346             else
9347                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9348             fi
9349         else
9350             __save_CFLAGS="${CFLAGS}"
9351             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9352             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9353 #if defined(FB_API_VER) && FB_API_VER == 30
9354 int fb_api_is_30(void) { return 0; }
9355 #else
9356 #error "Wrong Firebird API version"
9357 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9358             CFLAGS="${__save_CFLAGS}"
9359         fi
9360         ENABLE_FIREBIRD_SDBC=TRUE
9361         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9362     elif test "$enable_database_connectivity" != yes; then
9363         AC_MSG_RESULT([none])
9364     elif test "$cross_compiling" = "yes"; then
9365         AC_MSG_RESULT([none])
9366     else
9367         dnl Embedded Firebird has version 3.0
9368         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9369         dnl We need libatomic_ops for any non X86/X64 system
9370         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9371             dnl ===================================================================
9372             dnl Check for system libatomic_ops
9373             dnl ===================================================================
9374             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9375             if test "$with_system_libatomic_ops" = "yes"; then
9376                 SYSTEM_LIBATOMIC_OPS=TRUE
9377                 AC_CHECK_HEADERS(atomic_ops.h, [],
9378                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9379             else
9380                 SYSTEM_LIBATOMIC_OPS=
9381                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9382                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9383                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9384             fi
9385         fi
9387         AC_MSG_RESULT([internal])
9388         SYSTEM_FIREBIRD=
9389         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9390         FIREBIRD_LIBS="-lfbclient"
9392         if test "$with_system_libtommath" = "yes"; then
9393             SYSTEM_LIBTOMMATH=TRUE
9394             dnl check for tommath presence
9395             save_LIBS=$LIBS
9396             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9397             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9398             LIBS=$save_LIBS
9399         else
9400             SYSTEM_LIBTOMMATH=
9401             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9402             LIBTOMMATH_LIBS="-ltommath"
9403             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9404         fi
9406         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9407         ENABLE_FIREBIRD_SDBC=TRUE
9408         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9409     fi
9411 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9412 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9413 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9414 AC_SUBST(LIBATOMIC_OPS_LIBS)
9415 AC_SUBST(SYSTEM_FIREBIRD)
9416 AC_SUBST(FIREBIRD_CFLAGS)
9417 AC_SUBST(FIREBIRD_LIBS)
9418 AC_SUBST([TOMMATH_CFLAGS])
9419 AC_SUBST([TOMMATH_LIBS])
9421 dnl ===================================================================
9422 dnl Check for system curl
9423 dnl ===================================================================
9424 AC_MSG_CHECKING([which libcurl to use])
9425 if test "$with_system_curl" = "auto"; then
9426     with_system_curl="$with_system_libs"
9429 if test "$with_system_curl" = "yes"; then
9430     AC_MSG_RESULT([external])
9431     SYSTEM_CURL=TRUE
9433     # First try PKGCONFIG and then fall back
9434     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9436     if test -n "$CURL_PKG_ERRORS"; then
9437         AC_PATH_PROG(CURLCONFIG, curl-config)
9438         if test -z "$CURLCONFIG"; then
9439             AC_MSG_ERROR([curl development files not found])
9440         fi
9441         CURL_LIBS=`$CURLCONFIG --libs`
9442         FilterLibs "${CURL_LIBS}"
9443         CURL_LIBS="${filteredlibs}"
9444         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9445         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9447         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9448         case $curl_version in
9449         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9450         dnl so they need to be doubled to end up in the configure script
9451         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9452             AC_MSG_RESULT([yes])
9453             ;;
9454         *)
9455             AC_MSG_ERROR([no, you have $curl_version])
9456             ;;
9457         esac
9458     fi
9460     ENABLE_CURL=TRUE
9461 elif test $_os = iOS; then
9462     # Let's see if we need curl, I think not?
9463     AC_MSG_RESULT([none])
9464     ENABLE_CURL=
9465 else
9466     AC_MSG_RESULT([internal])
9467     SYSTEM_CURL=
9468     BUILD_TYPE="$BUILD_TYPE CURL"
9469     ENABLE_CURL=TRUE
9471 AC_SUBST(SYSTEM_CURL)
9472 AC_SUBST(CURL_CFLAGS)
9473 AC_SUBST(CURL_LIBS)
9474 AC_SUBST(ENABLE_CURL)
9476 dnl ===================================================================
9477 dnl Check for system boost
9478 dnl ===================================================================
9479 AC_MSG_CHECKING([which boost to use])
9480 if test "$with_system_boost" = "yes"; then
9481     AC_MSG_RESULT([external])
9482     SYSTEM_BOOST=TRUE
9483     AX_BOOST_BASE(1.47)
9484     AX_BOOST_DATE_TIME
9485     AX_BOOST_FILESYSTEM
9486     AX_BOOST_IOSTREAMS
9487     AX_BOOST_LOCALE
9488     AC_LANG_PUSH([C++])
9489     save_CXXFLAGS=$CXXFLAGS
9490     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9491     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9492        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9493     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9494        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9495     CXXFLAGS=$save_CXXFLAGS
9496     AC_LANG_POP([C++])
9497     # this is in m4/ax_boost_base.m4
9498     FilterLibs "${BOOST_LDFLAGS}"
9499     BOOST_LDFLAGS="${filteredlibs}"
9500 else
9501     AC_MSG_RESULT([internal])
9502     BUILD_TYPE="$BUILD_TYPE BOOST"
9503     SYSTEM_BOOST=
9504     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9505         # use warning-suppressing wrapper headers
9506         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9507     else
9508         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9509     fi
9511 AC_SUBST(SYSTEM_BOOST)
9513 dnl ===================================================================
9514 dnl Check for system mdds
9515 dnl ===================================================================
9516 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9518 dnl ===================================================================
9519 dnl Check for system glm
9520 dnl ===================================================================
9521 AC_MSG_CHECKING([which glm to use])
9522 if test "$with_system_glm" = "yes"; then
9523     AC_MSG_RESULT([external])
9524     SYSTEM_GLM=TRUE
9525     AC_LANG_PUSH([C++])
9526     AC_CHECK_HEADER([glm/glm.hpp], [],
9527        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9528     AC_LANG_POP([C++])
9529 else
9530     AC_MSG_RESULT([internal])
9531     BUILD_TYPE="$BUILD_TYPE GLM"
9532     SYSTEM_GLM=
9533     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9535 AC_SUBST([GLM_CFLAGS])
9536 AC_SUBST([SYSTEM_GLM])
9538 dnl ===================================================================
9539 dnl Check for system odbc
9540 dnl ===================================================================
9541 AC_MSG_CHECKING([which odbc headers to use])
9542 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
9543     AC_MSG_RESULT([external])
9544     SYSTEM_ODBC_HEADERS=TRUE
9546     if test "$build_os" = "cygwin"; then
9547         save_CPPFLAGS=$CPPFLAGS
9548         find_winsdk
9549         PathFormat "$winsdktest"
9550         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"
9551         AC_CHECK_HEADER(sqlext.h, [],
9552             [AC_MSG_ERROR(odbc not found. install odbc)],
9553             [#include <windows.h>])
9554         CPPFLAGS=$save_CPPFLAGS
9555     else
9556         AC_CHECK_HEADER(sqlext.h, [],
9557             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9558     fi
9559 elif test "$enable_database_connectivity" != yes; then
9560     AC_MSG_RESULT([none])
9561 else
9562     AC_MSG_RESULT([internal])
9563     SYSTEM_ODBC_HEADERS=
9565 AC_SUBST(SYSTEM_ODBC_HEADERS)
9567 dnl ===================================================================
9568 dnl Enable LDAP support
9569 dnl ===================================================================
9571 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9572 AC_MSG_CHECKING([whether to enable LDAP support])
9573     if test "$enable_ldap" != "yes"; then
9574         AC_MSG_RESULT([no])
9575         ENABLE_LDAP=""
9576         enable_ldap=no
9577     else
9578         AC_MSG_RESULT([yes])
9579         ENABLE_LDAP="TRUE"
9580         AC_DEFINE(HAVE_FEATURE_LDAP)
9581     fi
9583 AC_SUBST(ENABLE_LDAP)
9585 dnl ===================================================================
9586 dnl Check for system openldap
9587 dnl ===================================================================
9589 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9590 AC_MSG_CHECKING([which openldap library to use])
9591 if test "$with_system_openldap" = "yes"; then
9592     AC_MSG_RESULT([external])
9593     SYSTEM_OPENLDAP=TRUE
9594     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9595     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9596     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9597 else
9598     AC_MSG_RESULT([internal])
9599     SYSTEM_OPENLDAP=
9600     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9603 AC_SUBST(SYSTEM_OPENLDAP)
9605 dnl ===================================================================
9606 dnl Check for system NSS
9607 dnl ===================================================================
9608 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9609     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9610     AC_DEFINE(HAVE_FEATURE_NSS)
9611     ENABLE_NSS="TRUE"
9612     AC_DEFINE(ENABLE_NSS)
9613 elif test $_os != iOS ; then
9614     with_tls=openssl
9616 AC_SUBST(ENABLE_NSS)
9618 dnl ===================================================================
9619 dnl Check for TLS/SSL and cryptographic implementation to use
9620 dnl ===================================================================
9621 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9622 if test -n "$with_tls"; then
9623     case $with_tls in
9624     openssl)
9625         AC_DEFINE(USE_TLS_OPENSSL)
9626         TLS=OPENSSL
9628         if test "$enable_openssl" != "yes"; then
9629             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9630         fi
9632         # warn that OpenSSL has been selected but not all TLS code has this option
9633         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9634         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9635         ;;
9636     nss)
9637         AC_DEFINE(USE_TLS_NSS)
9638         TLS=NSS
9639         ;;
9640     no)
9641         AC_MSG_WARN([Skipping TLS/SSL])
9642         ;;
9643     *)
9644         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9645 openssl - OpenSSL
9646 nss - Mozilla's Network Security Services (NSS)
9647     ])
9648         ;;
9649     esac
9650 else
9651     # default to using NSS, it results in smaller oox lib
9652     AC_DEFINE(USE_TLS_NSS)
9653     TLS=NSS
9655 AC_MSG_RESULT([$TLS])
9656 AC_SUBST(TLS)
9658 dnl ===================================================================
9659 dnl Check for system sane
9660 dnl ===================================================================
9661 AC_MSG_CHECKING([which sane header to use])
9662 if test "$with_system_sane" = "yes"; then
9663     AC_MSG_RESULT([external])
9664     AC_CHECK_HEADER(sane/sane.h, [],
9665       [AC_MSG_ERROR(sane not found. install sane)], [])
9666 else
9667     AC_MSG_RESULT([internal])
9668     BUILD_TYPE="$BUILD_TYPE SANE"
9671 dnl ===================================================================
9672 dnl Check for system icu
9673 dnl ===================================================================
9674 SYSTEM_GENBRK=
9675 SYSTEM_GENCCODE=
9676 SYSTEM_GENCMN=
9678 ICU_MAJOR=65
9679 ICU_MINOR=1
9680 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9681 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9682 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9683 AC_MSG_CHECKING([which icu to use])
9684 if test "$with_system_icu" = "yes"; then
9685     AC_MSG_RESULT([external])
9686     SYSTEM_ICU=TRUE
9687     AC_LANG_PUSH([C++])
9688     AC_MSG_CHECKING([for unicode/rbbi.h])
9689     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9690     AC_LANG_POP([C++])
9692     if test "$cross_compiling" != "yes"; then
9693         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9694         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9695         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9696         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9697     fi
9699     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9700         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9701         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9702         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9703         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9704         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9705             AC_MSG_RESULT([yes])
9706         else
9707             AC_MSG_RESULT([no])
9708             if test "$with_system_icu_for_build" != "force"; then
9709                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9710 You can use --with-system-icu-for-build=force to use it anyway.])
9711             fi
9712         fi
9713     fi
9715     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9716         # using the system icu tools can lead to version confusion, use the
9717         # ones from the build environment when cross-compiling
9718         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9719         if test -z "$SYSTEM_GENBRK"; then
9720             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9721         fi
9722         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9723         if test -z "$SYSTEM_GENCCODE"; then
9724             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9725         fi
9726         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9727         if test -z "$SYSTEM_GENCMN"; then
9728             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9729         fi
9730         if test "$ICU_MAJOR" -ge "49"; then
9731             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9732             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9733             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9734         else
9735             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9736             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9737             ICU_RECLASSIFIED_HEBREW_LETTER=
9738         fi
9739     fi
9741     if test "$cross_compiling" = "yes"; then
9742         if test "$ICU_MAJOR" -ge "50"; then
9743             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9744             ICU_MINOR=""
9745         fi
9746     fi
9747 else
9748     AC_MSG_RESULT([internal])
9749     SYSTEM_ICU=
9750     BUILD_TYPE="$BUILD_TYPE ICU"
9751     # surprisingly set these only for "internal" (to be used by various other
9752     # external libs): the system icu-config is quite unhelpful and spits out
9753     # dozens of weird flags and also default path -I/usr/include
9754     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9755     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9757 if test "$ICU_MAJOR" -ge "59"; then
9758     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9759     # with -std=c++11 but not all external libraries can be built with that,
9760     # for those use a bit-compatible typedef uint16_t UChar; see
9761     # icu/source/common/unicode/umachine.h
9762     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9763 else
9764     ICU_UCHAR_TYPE=""
9766 AC_SUBST(SYSTEM_ICU)
9767 AC_SUBST(SYSTEM_GENBRK)
9768 AC_SUBST(SYSTEM_GENCCODE)
9769 AC_SUBST(SYSTEM_GENCMN)
9770 AC_SUBST(ICU_MAJOR)
9771 AC_SUBST(ICU_MINOR)
9772 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9773 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9774 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9775 AC_SUBST(ICU_CFLAGS)
9776 AC_SUBST(ICU_LIBS)
9777 AC_SUBST(ICU_UCHAR_TYPE)
9779 dnl ==================================================================
9780 dnl Breakpad
9781 dnl ==================================================================
9782 DEFAULT_CRASHDUMP_VALUE="true"
9783 AC_MSG_CHECKING([whether to enable breakpad])
9784 if test "$enable_breakpad" != yes; then
9785     AC_MSG_RESULT([no])
9786 else
9787     AC_MSG_RESULT([yes])
9788     ENABLE_BREAKPAD="TRUE"
9789     AC_DEFINE(ENABLE_BREAKPAD)
9790     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9791     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9793     AC_MSG_CHECKING([for disable crash dump])
9794     if test "$enable_crashdump" = no; then
9795         DEFAULT_CRASHDUMP_VALUE="false"
9796         AC_MSG_RESULT([yes])
9797     else
9798        AC_MSG_RESULT([no])
9799     fi
9801     AC_MSG_CHECKING([for crashreport config])
9802     if test "$with_symbol_config" = "no"; then
9803         BREAKPAD_SYMBOL_CONFIG="invalid"
9804         AC_MSG_RESULT([no])
9805     else
9806         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9807         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9808         AC_MSG_RESULT([yes])
9809     fi
9810     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9812 AC_SUBST(ENABLE_BREAKPAD)
9813 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9815 dnl ==================================================================
9816 dnl libfuzzer
9817 dnl ==================================================================
9818 AC_MSG_CHECKING([whether to enable fuzzers])
9819 if test "$enable_fuzzers" != yes; then
9820     AC_MSG_RESULT([no])
9821 else
9822     AC_MSG_RESULT([yes])
9823     ENABLE_FUZZERS="TRUE"
9824     AC_DEFINE([ENABLE_FUZZERS],1)
9825     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9827 AC_SUBST(ENABLE_FUZZERS)
9829 dnl ===================================================================
9830 dnl Orcus
9831 dnl ===================================================================
9832 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9833 if test "$with_system_orcus" != "yes"; then
9834     if test "$SYSTEM_BOOST" = "TRUE"; then
9835         # ===========================================================
9836         # Determine if we are going to need to link with Boost.System
9837         # ===========================================================
9838         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9839         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9840         dnl in documentation has no effect.
9841         AC_MSG_CHECKING([if we need to link with Boost.System])
9842         AC_LANG_PUSH([C++])
9843         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9844                 @%:@include <boost/version.hpp>
9845             ]],[[
9846                 #if BOOST_VERSION >= 105000
9847                 #   error yes, we need to link with Boost.System
9848                 #endif
9849             ]])],[
9850                 AC_MSG_RESULT([no])
9851             ],[
9852                 AC_MSG_RESULT([yes])
9853                 AX_BOOST_SYSTEM
9854         ])
9855         AC_LANG_POP([C++])
9856     fi
9858 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9859 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9860 AC_SUBST([BOOST_SYSTEM_LIB])
9861 AC_SUBST(SYSTEM_LIBORCUS)
9863 dnl ===================================================================
9864 dnl HarfBuzz
9865 dnl ===================================================================
9866 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9867                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9868                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9870 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9871                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9872                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9874 if test "$COM" = "MSC"; then # override the above
9875     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9876     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9879 if test "$with_system_harfbuzz" = "yes"; then
9880     if test "$with_system_graphite" = "no"; then
9881         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9882     fi
9883     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9884     _save_libs="$LIBS"
9885     _save_cflags="$CFLAGS"
9886     LIBS="$LIBS $HARFBUZZ_LIBS"
9887     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9888     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9889     LIBS="$_save_libs"
9890     CFLAGS="$_save_cflags"
9891 else
9892     if test "$with_system_graphite" = "yes"; then
9893         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9894     fi
9897 AC_MSG_CHECKING([whether to use X11])
9898 dnl ***************************************
9899 dnl testing for X libraries and includes...
9900 dnl ***************************************
9901 if test "$USING_X11" = TRUE; then
9902     AC_DEFINE(HAVE_FEATURE_X11)
9904 AC_MSG_RESULT([$USING_X11])
9906 if test "$USING_X11" = TRUE; then
9907     AC_PATH_X
9908     AC_PATH_XTRA
9909     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9911     if test -z "$x_includes"; then
9912         x_includes="default_x_includes"
9913     fi
9914     if test -z "$x_libraries"; then
9915         x_libraries="default_x_libraries"
9916     fi
9917     CFLAGS="$CFLAGS $X_CFLAGS"
9918     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9919     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9920 else
9921     x_includes="no_x_includes"
9922     x_libraries="no_x_libraries"
9925 if test "$USING_X11" = TRUE; then
9926     dnl ===================================================================
9927     dnl Check for extension headers
9928     dnl ===================================================================
9929     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9930      [#include <X11/extensions/shape.h>])
9932     # vcl needs ICE and SM
9933     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9934     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9935         [AC_MSG_ERROR(ICE library not found)])
9936     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9937     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9938         [AC_MSG_ERROR(SM library not found)])
9941 dnl ===================================================================
9942 dnl Check for system Xrender
9943 dnl ===================================================================
9944 AC_MSG_CHECKING([whether to use Xrender])
9945 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9946     AC_MSG_RESULT([yes])
9947     PKG_CHECK_MODULES(XRENDER, xrender)
9948     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9949     FilterLibs "${XRENDER_LIBS}"
9950     XRENDER_LIBS="${filteredlibs}"
9951     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9952       [AC_MSG_ERROR(libXrender not found or functional)], [])
9953     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9954       [AC_MSG_ERROR(Xrender not found. install X)], [])
9955 else
9956     AC_MSG_RESULT([no])
9958 AC_SUBST(XRENDER_CFLAGS)
9959 AC_SUBST(XRENDER_LIBS)
9961 dnl ===================================================================
9962 dnl Check for XRandr
9963 dnl ===================================================================
9964 AC_MSG_CHECKING([whether to enable RandR support])
9965 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9966     AC_MSG_RESULT([yes])
9967     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9968     if test "$ENABLE_RANDR" != "TRUE"; then
9969         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9970                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9971         XRANDR_CFLAGS=" "
9972         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9973           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9974         XRANDR_LIBS="-lXrandr "
9975         ENABLE_RANDR="TRUE"
9976     fi
9977     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9978     FilterLibs "${XRANDR_LIBS}"
9979     XRANDR_LIBS="${filteredlibs}"
9980 else
9981     ENABLE_RANDR=""
9982     AC_MSG_RESULT([no])
9984 AC_SUBST(XRANDR_CFLAGS)
9985 AC_SUBST(XRANDR_LIBS)
9986 AC_SUBST(ENABLE_RANDR)
9988 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9989     WITH_WEBDAV="serf"
9991 if test $_os = iOS -o $_os = Android; then
9992     WITH_WEBDAV="no"
9994 AC_MSG_CHECKING([for webdav library])
9995 case "$WITH_WEBDAV" in
9996 serf)
9997     AC_MSG_RESULT([serf])
9998     # Check for system apr-util
9999     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10000                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10001                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10002     if test "$COM" = "MSC"; then
10003         APR_LIB_DIR="LibR"
10004         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10005         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10006     fi
10008     # Check for system serf
10009     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10010                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10011     if test "$COM" = "MSC"; then
10012         SERF_LIB_DIR="Release"
10013         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10014         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10015     fi
10016     ;;
10017 neon)
10018     AC_MSG_RESULT([neon])
10019     # Check for system neon
10020     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10021     if test "$with_system_neon" = "yes"; then
10022         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10023     else
10024         NEON_VERSION=0295
10025     fi
10026     AC_SUBST(NEON_VERSION)
10027     ;;
10029     AC_MSG_RESULT([none, disabled])
10030     WITH_WEBDAV=""
10031     ;;
10032 esac
10033 AC_SUBST(WITH_WEBDAV)
10035 dnl ===================================================================
10036 dnl Check for disabling cve_tests
10037 dnl ===================================================================
10038 AC_MSG_CHECKING([whether to execute CVE tests])
10039 # If not explicitly enabled or disabled, default
10040 if test -z "$enable_cve_tests"; then
10041     case "$OS" in
10042     WNT)
10043         # Default cves off for Windows with its wild and wonderful
10044         # variety of AV software kicking in and panicking
10045         enable_cve_tests=no
10046         ;;
10047     *)
10048         # otherwise yes
10049         enable_cve_tests=yes
10050         ;;
10051     esac
10053 if test "$enable_cve_tests" = "no"; then
10054     AC_MSG_RESULT([no])
10055     DISABLE_CVE_TESTS=TRUE
10056     AC_SUBST(DISABLE_CVE_TESTS)
10057 else
10058     AC_MSG_RESULT([yes])
10061 dnl ===================================================================
10062 dnl Check for enabling chart XShape tests
10063 dnl ===================================================================
10064 AC_MSG_CHECKING([whether to execute chart XShape tests])
10065 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10066     AC_MSG_RESULT([yes])
10067     ENABLE_CHART_TESTS=TRUE
10068     AC_SUBST(ENABLE_CHART_TESTS)
10069 else
10070     AC_MSG_RESULT([no])
10073 dnl ===================================================================
10074 dnl Check for system openssl
10075 dnl ===================================================================
10076 DISABLE_OPENSSL=
10077 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10078 if test "$enable_openssl" = "yes"; then
10079     AC_MSG_RESULT([no])
10080     if test "$_os" = Darwin ; then
10081         # OpenSSL is deprecated when building for 10.7 or later.
10082         #
10083         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10084         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10086         with_system_openssl=no
10087         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10088     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10089             && test "$with_system_openssl" != "no"; then
10090         with_system_openssl=yes
10091         SYSTEM_OPENSSL=TRUE
10092         OPENSSL_CFLAGS=
10093         OPENSSL_LIBS="-lssl -lcrypto"
10094     else
10095         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10096     fi
10097     if test "$with_system_openssl" = "yes"; then
10098         AC_MSG_CHECKING([whether openssl supports SHA512])
10099         AC_LANG_PUSH([C])
10100         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10101             SHA512_CTX context;
10102 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10103         AC_LANG_POP(C)
10104     fi
10105 else
10106     AC_MSG_RESULT([yes])
10107     DISABLE_OPENSSL=TRUE
10109     # warn that although OpenSSL is disabled, system libraries may depend on it
10110     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10111     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10114 AC_SUBST([DISABLE_OPENSSL])
10116 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10117     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10118         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10119         enable_cipher_openssl_backend=no
10120     else
10121         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10122     fi
10124 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10125 ENABLE_CIPHER_OPENSSL_BACKEND=
10126 if test "$enable_cipher_openssl_backend" = yes; then
10127     AC_MSG_RESULT([yes])
10128     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10129 else
10130     AC_MSG_RESULT([no])
10132 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10134 dnl ===================================================================
10135 dnl Check for building gnutls
10136 dnl ===================================================================
10137 AC_MSG_CHECKING([whether to use gnutls])
10138 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10139     AC_MSG_RESULT([yes])
10140     AM_PATH_LIBGCRYPT()
10141     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10142         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10143                       available in the system to use as replacement.]]))
10144     FilterLibs "${LIBGCRYPT_LIBS}"
10145     LIBGCRYPT_LIBS="${filteredlibs}"
10146 else
10147     AC_MSG_RESULT([no])
10150 AC_SUBST([LIBGCRYPT_CFLAGS])
10151 AC_SUBST([LIBGCRYPT_LIBS])
10153 dnl ===================================================================
10154 dnl Check for system redland
10155 dnl ===================================================================
10156 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10157 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10158 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10159 if test "$with_system_redland" = "yes"; then
10160     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10161             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10162 else
10163     RAPTOR_MAJOR="0"
10164     RASQAL_MAJOR="3"
10165     REDLAND_MAJOR="0"
10167 AC_SUBST(RAPTOR_MAJOR)
10168 AC_SUBST(RASQAL_MAJOR)
10169 AC_SUBST(REDLAND_MAJOR)
10171 dnl ===================================================================
10172 dnl Check for system hunspell
10173 dnl ===================================================================
10174 AC_MSG_CHECKING([which libhunspell to use])
10175 if test "$with_system_hunspell" = "yes"; then
10176     AC_MSG_RESULT([external])
10177     SYSTEM_HUNSPELL=TRUE
10178     AC_LANG_PUSH([C++])
10179     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10180     if test "$HUNSPELL_PC" != "TRUE"; then
10181         AC_CHECK_HEADER(hunspell.hxx, [],
10182             [
10183             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10184             [AC_MSG_ERROR(hunspell headers not found.)], [])
10185             ], [])
10186         AC_CHECK_LIB([hunspell], [main], [:],
10187            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10188         HUNSPELL_LIBS=-lhunspell
10189     fi
10190     AC_LANG_POP([C++])
10191     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10192     FilterLibs "${HUNSPELL_LIBS}"
10193     HUNSPELL_LIBS="${filteredlibs}"
10194 else
10195     AC_MSG_RESULT([internal])
10196     SYSTEM_HUNSPELL=
10197     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10198     if test "$COM" = "MSC"; then
10199         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10200     else
10201         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10202     fi
10203     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10205 AC_SUBST(SYSTEM_HUNSPELL)
10206 AC_SUBST(HUNSPELL_CFLAGS)
10207 AC_SUBST(HUNSPELL_LIBS)
10209 dnl ===================================================================
10210 dnl Check for system qrcodegen
10211 dnl ===================================================================
10212 AC_MSG_CHECKING([which libqrcodegen to use])
10213 if test "$with_system_qrcodegen" = "yes"; then
10214     AC_MSG_RESULT([external])
10215     SYSTEM_QRCODEGEN=TRUE
10216     AC_LANG_PUSH([C++])
10217     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10218         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10219     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10220         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10221     QRCODEGEN_LIBS=-lqrcodegencpp
10222     AC_LANG_POP([C++])
10223     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10224     FilterLibs "${QRCODEGEN_LIBS}"
10225     QRCODEGEN_LIBS="${filteredlibs}"
10226 else
10227     AC_MSG_RESULT([internal])
10228     SYSTEM_QRCODEGEN=
10229     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10231 AC_SUBST(SYSTEM_QRCODEGEN)
10232 AC_SUBST(QRCODEGEN_CFLAGS)
10233 AC_SUBST(QRCODEGEN_LIBS)
10235 dnl ===================================================================
10236 dnl Checking for altlinuxhyph
10237 dnl ===================================================================
10238 AC_MSG_CHECKING([which altlinuxhyph to use])
10239 if test "$with_system_altlinuxhyph" = "yes"; then
10240     AC_MSG_RESULT([external])
10241     SYSTEM_HYPH=TRUE
10242     AC_CHECK_HEADER(hyphen.h, [],
10243        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10244     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10245        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10246        [#include <hyphen.h>])
10247     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10248         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10249     if test -z "$HYPHEN_LIB"; then
10250         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10251            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10252     fi
10253     if test -z "$HYPHEN_LIB"; then
10254         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10255            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10256     fi
10257 else
10258     AC_MSG_RESULT([internal])
10259     SYSTEM_HYPH=
10260     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10261     if test "$COM" = "MSC"; then
10262         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10263     else
10264         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10265     fi
10267 AC_SUBST(SYSTEM_HYPH)
10268 AC_SUBST(HYPHEN_LIB)
10270 dnl ===================================================================
10271 dnl Checking for mythes
10272 dnl ===================================================================
10273 AC_MSG_CHECKING([which mythes to use])
10274 if test "$with_system_mythes" = "yes"; then
10275     AC_MSG_RESULT([external])
10276     SYSTEM_MYTHES=TRUE
10277     AC_LANG_PUSH([C++])
10278     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10279     if test "$MYTHES_PKGCONFIG" = "no"; then
10280         AC_CHECK_HEADER(mythes.hxx, [],
10281             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10282         AC_CHECK_LIB([mythes-1.2], [main], [:],
10283             [ MYTHES_FOUND=no], [])
10284     if test "$MYTHES_FOUND" = "no"; then
10285         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10286                 [ MYTHES_FOUND=no], [])
10287     fi
10288     if test "$MYTHES_FOUND" = "no"; then
10289         AC_MSG_ERROR([mythes library not found!.])
10290     fi
10291     fi
10292     AC_LANG_POP([C++])
10293     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10294     FilterLibs "${MYTHES_LIBS}"
10295     MYTHES_LIBS="${filteredlibs}"
10296 else
10297     AC_MSG_RESULT([internal])
10298     SYSTEM_MYTHES=
10299     BUILD_TYPE="$BUILD_TYPE MYTHES"
10300     if test "$COM" = "MSC"; then
10301         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10302     else
10303         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10304     fi
10306 AC_SUBST(SYSTEM_MYTHES)
10307 AC_SUBST(MYTHES_CFLAGS)
10308 AC_SUBST(MYTHES_LIBS)
10310 dnl ===================================================================
10311 dnl How should we build the linear programming solver ?
10312 dnl ===================================================================
10314 ENABLE_COINMP=
10315 AC_MSG_CHECKING([whether to build with CoinMP])
10316 if test "$enable_coinmp" != "no"; then
10317     ENABLE_COINMP=TRUE
10318     AC_MSG_RESULT([yes])
10319     if test "$with_system_coinmp" = "yes"; then
10320         SYSTEM_COINMP=TRUE
10321         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10322         FilterLibs "${COINMP_LIBS}"
10323         COINMP_LIBS="${filteredlibs}"
10324     else
10325         BUILD_TYPE="$BUILD_TYPE COINMP"
10326     fi
10327 else
10328     AC_MSG_RESULT([no])
10330 AC_SUBST(ENABLE_COINMP)
10331 AC_SUBST(SYSTEM_COINMP)
10332 AC_SUBST(COINMP_CFLAGS)
10333 AC_SUBST(COINMP_LIBS)
10335 ENABLE_LPSOLVE=
10336 AC_MSG_CHECKING([whether to build with lpsolve])
10337 if test "$enable_lpsolve" != "no"; then
10338     ENABLE_LPSOLVE=TRUE
10339     AC_MSG_RESULT([yes])
10340 else
10341     AC_MSG_RESULT([no])
10343 AC_SUBST(ENABLE_LPSOLVE)
10345 if test "$ENABLE_LPSOLVE" = TRUE; then
10346     AC_MSG_CHECKING([which lpsolve to use])
10347     if test "$with_system_lpsolve" = "yes"; then
10348         AC_MSG_RESULT([external])
10349         SYSTEM_LPSOLVE=TRUE
10350         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10351            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10352         save_LIBS=$LIBS
10353         # some systems need this. Like Ubuntu...
10354         AC_CHECK_LIB(m, floor)
10355         AC_CHECK_LIB(dl, dlopen)
10356         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10357             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10358         LIBS=$save_LIBS
10359     else
10360         AC_MSG_RESULT([internal])
10361         SYSTEM_LPSOLVE=
10362         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10363     fi
10365 AC_SUBST(SYSTEM_LPSOLVE)
10367 dnl ===================================================================
10368 dnl Checking for libexttextcat
10369 dnl ===================================================================
10370 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10371 if test "$with_system_libexttextcat" = "yes"; then
10372     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10374 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10376 dnl ===================================================================
10377 dnl Checking for libnumbertext
10378 dnl ===================================================================
10379 AC_MSG_CHECKING([whether to use libnumbertext])
10380 if test "$enable_libnumbertext" = "no"; then
10381     AC_MSG_RESULT([no])
10382     ENABLE_LIBNUMBERTEXT=
10383     SYSTEM_LIBNUMBERTEXT=
10384 else
10385     AC_MSG_RESULT([yes])
10386     ENABLE_LIBNUMBERTEXT=TRUE
10387     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10388     if test "$with_system_libnumbertext" = "yes"; then
10389         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10390         SYSTEM_LIBNUMBERTEXT=YES
10391     else
10392         SYSTEM_LIBNUMBERTEXT=
10393         AC_LANG_PUSH([C++])
10394         save_CPPFLAGS=$CPPFLAGS
10395         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10396         AC_CHECK_HEADERS([codecvt regex])
10397         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10398                 [ ENABLE_LIBNUMBERTEXT=''
10399                   LIBNUMBERTEXT_CFLAGS=''
10400                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10401                                Enable libnumbertext fallback (missing number to number name conversion).])
10402                 ])
10403         CPPFLAGS=$save_CPPFLAGS
10404         AC_LANG_POP([C++])
10405     fi
10406     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10407         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10408     fi
10410 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10411 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10412 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10413 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10415 dnl ***************************************
10416 dnl testing libc version for Linux...
10417 dnl ***************************************
10418 if test "$_os" = "Linux"; then
10419     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10420     exec 6>/dev/null # no output
10421     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10422     exec 6>&1 # output on again
10423     if test "$HAVE_LIBC"; then
10424         AC_MSG_RESULT([yes])
10425     else
10426         AC_MSG_ERROR([no, upgrade libc])
10427     fi
10430 dnl =========================================
10431 dnl Check for uuidgen
10432 dnl =========================================
10433 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10434     # presence is already tested above in the WINDOWS_SDK_HOME check
10435     UUIDGEN=uuidgen.exe
10436     AC_SUBST(UUIDGEN)
10437 else
10438     AC_PATH_PROG([UUIDGEN], [uuidgen])
10439     if test -z "$UUIDGEN"; then
10440         AC_MSG_WARN([uuid is needed for building installation sets])
10441     fi
10444 dnl ***************************************
10445 dnl Checking for bison and flex
10446 dnl ***************************************
10447 AC_PATH_PROG(BISON, bison)
10448 if test -z "$BISON"; then
10449     AC_MSG_ERROR([no bison found in \$PATH, install it])
10450 else
10451     AC_MSG_CHECKING([the bison version])
10452     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10453     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10454     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10455     dnl cause
10456     dnl
10457     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]
10458     dnl   typedef union YYSTYPE
10459     dnl           ~~~~~~^~~~~~~
10460     dnl
10461     dnl while at least 3.4.1 is know to be good:
10462     if test "$COMPILER_PLUGINS" = TRUE; then
10463         if test "$_bison_longver" -lt 2004; then
10464             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10465         fi
10466     else
10467         if test "$_bison_longver" -lt 2000; then
10468             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10469         fi
10470     fi
10472 AC_SUBST([BISON])
10474 AC_PATH_PROG(FLEX, flex)
10475 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10476     FLEX=`cygpath -m $FLEX`
10478 if test -z "$FLEX"; then
10479     AC_MSG_ERROR([no flex found in \$PATH, install it])
10480 else
10481     AC_MSG_CHECKING([the flex version])
10482     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10483     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10484         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10485     fi
10487 AC_SUBST([FLEX])
10488 dnl ***************************************
10489 dnl Checking for patch
10490 dnl ***************************************
10491 AC_PATH_PROG(PATCH, patch)
10492 if test -z "$PATCH"; then
10493     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10496 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10497 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10498     if test -z "$with_gnu_patch"; then
10499         GNUPATCH=$PATCH
10500     else
10501         if test -x "$with_gnu_patch"; then
10502             GNUPATCH=$with_gnu_patch
10503         else
10504             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10505         fi
10506     fi
10508     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10509     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10510         AC_MSG_RESULT([yes])
10511     else
10512         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10513     fi
10514 else
10515     GNUPATCH=$PATCH
10518 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10519     GNUPATCH=`cygpath -m $GNUPATCH`
10522 dnl We also need to check for --with-gnu-cp
10524 if test -z "$with_gnu_cp"; then
10525     # check the place where the good stuff is hidden on Solaris...
10526     if test -x /usr/gnu/bin/cp; then
10527         GNUCP=/usr/gnu/bin/cp
10528     else
10529         AC_PATH_PROGS(GNUCP, gnucp cp)
10530     fi
10531     if test -z $GNUCP; then
10532         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10533     fi
10534 else
10535     if test -x "$with_gnu_cp"; then
10536         GNUCP=$with_gnu_cp
10537     else
10538         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10539     fi
10542 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10543     GNUCP=`cygpath -m $GNUCP`
10546 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10547 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10548     AC_MSG_RESULT([yes])
10549 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10550     AC_MSG_RESULT([yes])
10551 else
10552     case "$build_os" in
10553     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10554         x_GNUCP=[\#]
10555         GNUCP=''
10556         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10557         ;;
10558     *)
10559         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10560         ;;
10561     esac
10564 AC_SUBST(GNUPATCH)
10565 AC_SUBST(GNUCP)
10566 AC_SUBST(x_GNUCP)
10568 dnl ***************************************
10569 dnl testing assembler path
10570 dnl ***************************************
10571 ML_EXE=""
10572 if test "$_os" = "WINNT"; then
10573     if test "$BITNESS_OVERRIDE" = ""; then
10574         assembler=ml.exe
10575     else
10576         assembler=ml64.exe
10577     fi
10579     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10580     if test -f "$CL_PATH/$assembler"; then
10581         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10582         AC_MSG_RESULT([$ML_EXE])
10583     else
10584         AC_MSG_ERROR([not found])
10585     fi
10588 AC_SUBST(ML_EXE)
10590 dnl ===================================================================
10591 dnl We need zip and unzip
10592 dnl ===================================================================
10593 AC_PATH_PROG(ZIP, zip)
10594 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10595 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10596     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],,)
10599 AC_PATH_PROG(UNZIP, unzip)
10600 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10602 dnl ===================================================================
10603 dnl Zip must be a specific type for different build types.
10604 dnl ===================================================================
10605 if test $build_os = cygwin; then
10606     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10607         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10608     fi
10611 dnl ===================================================================
10612 dnl We need touch with -h option support.
10613 dnl ===================================================================
10614 AC_PATH_PROG(TOUCH, touch)
10615 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10616 touch warn
10617 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10618     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],,)
10621 dnl ===================================================================
10622 dnl Check for system epoxy
10623 dnl ===================================================================
10624 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10626 dnl ===================================================================
10627 dnl Set vcl option: coordinate device in double or sal_Int32
10628 dnl ===================================================================
10630 dnl disabled for now, we don't want subtle differences between OSs
10631 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10632 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10633 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10634 dnl     AC_MSG_RESULT([double])
10635 dnl else
10636 dnl     AC_MSG_RESULT([sal_Int32])
10637 dnl fi
10639 dnl ===================================================================
10640 dnl Test which vclplugs have to be built.
10641 dnl ===================================================================
10642 R=""
10643 if test "$USING_X11" != TRUE; then
10644     enable_gtk3=no
10646 GTK3_CFLAGS=""
10647 GTK3_LIBS=""
10648 ENABLE_GTK3=""
10649 if test "x$enable_gtk3" = "xyes"; then
10650     if test "$with_system_cairo" = no; then
10651         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10652     fi
10653     : ${with_system_cairo:=yes}
10654     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="")
10655     if test "x$ENABLE_GTK3" = "xTRUE"; then
10656         AC_DEFINE(ENABLE_GTK3)
10657         R="gtk3"
10658     else
10659         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10660     fi
10661     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10662     FilterLibs "${GTK3_LIBS}"
10663     GTK3_LIBS="${filteredlibs}"
10665     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10666     if test "$with_system_epoxy" != "yes"; then
10667         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10668         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10669                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10670     fi
10672 AC_SUBST(GTK3_LIBS)
10673 AC_SUBST(GTK3_CFLAGS)
10674 AC_SUBST(ENABLE_GTK3)
10676 if test "$enable_introspection" = yes; then
10677     if test "$ENABLE_GTK3" = TRUE; then
10678         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10679     else
10680         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10681     fi
10684 ENABLE_QT5=""
10685 if test "x$enable_qt5" = "xyes"; then
10686     ENABLE_QT5="TRUE"
10687     AC_DEFINE(ENABLE_QT5)
10688     R="$R qt5"
10690 AC_SUBST(ENABLE_QT5)
10692 ENABLE_KF5=""
10693 if test "x$enable_kf5" = "xyes"; then
10694     ENABLE_KF5="TRUE"
10695     AC_DEFINE(ENABLE_KF5)
10696     R="$R kf5"
10698 AC_SUBST(ENABLE_KF5)
10700 ENABLE_GTK3_KDE5=""
10701 if test "x$enable_gtk3_kde5" = "xyes"; then
10702     ENABLE_GTK3_KDE5="TRUE"
10703     AC_DEFINE(ENABLE_GTK3_KDE5)
10704     R="$R gtk3_kde5"
10706 AC_SUBST(ENABLE_GTK3_KDE5)
10708 if test "$_os" = "WINNT"; then
10709     R="$R win"
10710 elif test "$_os" = "Darwin"; then
10711     R="$R osx"
10712 elif test "$_os" = "iOS"; then
10713     R="ios (builtin)"
10716 build_vcl_plugins="$R"
10717 if test -z "$build_vcl_plugins"; then
10718     build_vcl_plugins="none"
10720 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10722 dnl ===================================================================
10723 dnl check for dbus support
10724 dnl ===================================================================
10725 ENABLE_DBUS=""
10726 DBUS_CFLAGS=""
10727 DBUS_LIBS=""
10728 DBUS_GLIB_CFLAGS=""
10729 DBUS_GLIB_LIBS=""
10730 DBUS_HAVE_GLIB=""
10732 if test "$enable_dbus" = "no"; then
10733     test_dbus=no
10736 AC_MSG_CHECKING([whether to enable DBUS support])
10737 if test "$test_dbus" = "yes"; then
10738     ENABLE_DBUS="TRUE"
10739     AC_MSG_RESULT([yes])
10740     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10741     AC_DEFINE(ENABLE_DBUS)
10742     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10743     FilterLibs "${DBUS_LIBS}"
10744     DBUS_LIBS="${filteredlibs}"
10746     # Glib is needed for BluetoothServer
10747     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10748     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10749         [
10750             DBUS_HAVE_GLIB="TRUE"
10751             AC_DEFINE(DBUS_HAVE_GLIB,1)
10752         ],
10753         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10754     )
10755 else
10756     AC_MSG_RESULT([no])
10759 AC_SUBST(ENABLE_DBUS)
10760 AC_SUBST(DBUS_CFLAGS)
10761 AC_SUBST(DBUS_LIBS)
10762 AC_SUBST(DBUS_GLIB_CFLAGS)
10763 AC_SUBST(DBUS_GLIB_LIBS)
10764 AC_SUBST(DBUS_HAVE_GLIB)
10766 AC_MSG_CHECKING([whether to enable Impress remote control])
10767 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10768     AC_MSG_RESULT([yes])
10769     ENABLE_SDREMOTE=TRUE
10770     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10772     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10773         # The Bluetooth code doesn't compile with macOS SDK 10.15
10774         enable_sdremote_bluetooth=no
10775     fi
10776     # If not explicitly enabled or disabled, default
10777     if test -z "$enable_sdremote_bluetooth"; then
10778         case "$OS" in
10779         LINUX|MACOSX|WNT)
10780             # Default to yes for these
10781             enable_sdremote_bluetooth=yes
10782             ;;
10783         *)
10784             # otherwise no
10785             enable_sdremote_bluetooth=no
10786             ;;
10787         esac
10788     fi
10789     # $enable_sdremote_bluetooth is guaranteed non-empty now
10791     if test "$enable_sdremote_bluetooth" != "no"; then
10792         if test "$OS" = "LINUX"; then
10793             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10794                 AC_MSG_RESULT([yes])
10795                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10796                 dnl ===================================================================
10797                 dnl Check for system bluez
10798                 dnl ===================================================================
10799                 AC_MSG_CHECKING([which Bluetooth header to use])
10800                 if test "$with_system_bluez" = "yes"; then
10801                     AC_MSG_RESULT([external])
10802                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10803                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10804                     SYSTEM_BLUEZ=TRUE
10805                 else
10806                     AC_MSG_RESULT([internal])
10807                     SYSTEM_BLUEZ=
10808                 fi
10809             else
10810                 AC_MSG_RESULT([no, dbus disabled])
10811                 ENABLE_SDREMOTE_BLUETOOTH=
10812                 SYSTEM_BLUEZ=
10813             fi
10814         else
10815             AC_MSG_RESULT([yes])
10816             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10817             SYSTEM_BLUEZ=
10818         fi
10819     else
10820         AC_MSG_RESULT([no])
10821         ENABLE_SDREMOTE_BLUETOOTH=
10822         SYSTEM_BLUEZ=
10823     fi
10824 else
10825     ENABLE_SDREMOTE=
10826     SYSTEM_BLUEZ=
10827     AC_MSG_RESULT([no])
10829 AC_SUBST(ENABLE_SDREMOTE)
10830 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10831 AC_SUBST(SYSTEM_BLUEZ)
10833 dnl ===================================================================
10834 dnl Check whether to enable GIO support
10835 dnl ===================================================================
10836 if test "$ENABLE_GTK3" = "TRUE"; then
10837     AC_MSG_CHECKING([whether to enable GIO support])
10838     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10839         dnl Need at least 2.26 for the dbus support.
10840         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10841                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10842         if test "$ENABLE_GIO" = "TRUE"; then
10843             AC_DEFINE(ENABLE_GIO)
10844             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10845             FilterLibs "${GIO_LIBS}"
10846             GIO_LIBS="${filteredlibs}"
10847         fi
10848     else
10849         AC_MSG_RESULT([no])
10850     fi
10852 AC_SUBST(ENABLE_GIO)
10853 AC_SUBST(GIO_CFLAGS)
10854 AC_SUBST(GIO_LIBS)
10857 dnl ===================================================================
10859 SPLIT_APP_MODULES=""
10860 if test "$enable_split_app_modules" = "yes"; then
10861     SPLIT_APP_MODULES="TRUE"
10863 AC_SUBST(SPLIT_APP_MODULES)
10865 SPLIT_OPT_FEATURES=""
10866 if test "$enable_split_opt_features" = "yes"; then
10867     SPLIT_OPT_FEATURES="TRUE"
10869 AC_SUBST(SPLIT_OPT_FEATURES)
10871 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10872     if test "$enable_cairo_canvas" = yes; then
10873         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10874     fi
10875     enable_cairo_canvas=no
10876 elif test -z "$enable_cairo_canvas"; then
10877     enable_cairo_canvas=yes
10880 ENABLE_CAIRO_CANVAS=""
10881 if test "$enable_cairo_canvas" = "yes"; then
10882     test_cairo=yes
10883     ENABLE_CAIRO_CANVAS="TRUE"
10884     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10886 AC_SUBST(ENABLE_CAIRO_CANVAS)
10888 dnl ===================================================================
10889 dnl Check whether the GStreamer libraries are available.
10890 dnl ===================================================================
10892 ENABLE_GSTREAMER_1_0=""
10894 if test "$build_gstreamer_1_0" = "yes"; then
10896     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10897     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10898         ENABLE_GSTREAMER_1_0="TRUE"
10899         AC_MSG_RESULT([yes])
10900         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10901         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10902         FilterLibs "${GSTREAMER_1_0_LIBS}"
10903         GSTREAMER_1_0_LIBS="${filteredlibs}"
10904         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10905     else
10906         AC_MSG_RESULT([no])
10907     fi
10909 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10910 AC_SUBST(GSTREAMER_1_0_LIBS)
10911 AC_SUBST(ENABLE_GSTREAMER_1_0)
10913 dnl ===================================================================
10914 dnl Check whether to build the VLC avmedia backend
10915 dnl ===================================================================
10917 ENABLE_VLC=""
10919 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10920 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10921     ENABLE_VLC="TRUE"
10922     AC_MSG_RESULT([yes])
10923 else
10924     AC_MSG_RESULT([no])
10926 AC_SUBST(ENABLE_VLC)
10928 ENABLE_OPENGL_TRANSITIONS=
10929 ENABLE_OPENGL_CANVAS=
10930 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10931    : # disable
10932 elif test "$_os" = "Darwin"; then
10933     # We use frameworks on macOS, no need for detail checks
10934     ENABLE_OPENGL_TRANSITIONS=TRUE
10935     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10936     ENABLE_OPENGL_CANVAS=TRUE
10937 elif test $_os = WINNT; then
10938     ENABLE_OPENGL_TRANSITIONS=TRUE
10939     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10940     ENABLE_OPENGL_CANVAS=TRUE
10941 else
10942     if test "$USING_X11" = TRUE; then
10943         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10944         ENABLE_OPENGL_TRANSITIONS=TRUE
10945         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10946         ENABLE_OPENGL_CANVAS=TRUE
10947     fi
10950 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10951 AC_SUBST(ENABLE_OPENGL_CANVAS)
10953 dnl =================================================
10954 dnl Check whether to build with OpenCL support.
10955 dnl =================================================
10957 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10958     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10959     # platform (optional at run-time, used through clew).
10960     BUILD_TYPE="$BUILD_TYPE OPENCL"
10961     AC_DEFINE(HAVE_FEATURE_OPENCL)
10964 dnl =================================================
10965 dnl Check whether to build with dconf support.
10966 dnl =================================================
10968 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10969     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10970         if test "$enable_dconf" = yes; then
10971             AC_MSG_ERROR([dconf not found])
10972         else
10973             enable_dconf=no
10974         fi])
10976 AC_MSG_CHECKING([whether to enable dconf])
10977 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10978     DCONF_CFLAGS=
10979     DCONF_LIBS=
10980     ENABLE_DCONF=
10981     AC_MSG_RESULT([no])
10982 else
10983     ENABLE_DCONF=TRUE
10984     AC_DEFINE(ENABLE_DCONF)
10985     AC_MSG_RESULT([yes])
10987 AC_SUBST([DCONF_CFLAGS])
10988 AC_SUBST([DCONF_LIBS])
10989 AC_SUBST([ENABLE_DCONF])
10991 # pdf import?
10992 AC_MSG_CHECKING([whether to build the PDF import feature])
10993 ENABLE_PDFIMPORT=
10994 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10995     AC_MSG_RESULT([yes])
10996     ENABLE_PDFIMPORT=TRUE
10997     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10998 else
10999     AC_MSG_RESULT([no])
11002 # Pdfium?
11003 AC_MSG_CHECKING([whether to build PDFium])
11004 ENABLE_PDFIUM=
11005 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11006     AC_MSG_RESULT([yes])
11007     ENABLE_PDFIUM=TRUE
11008     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11009     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11010 else
11011     AC_MSG_RESULT([no])
11013 AC_SUBST(ENABLE_PDFIUM)
11015 dnl ===================================================================
11016 dnl Check for poppler
11017 dnl ===================================================================
11018 ENABLE_POPPLER=
11019 AC_MSG_CHECKING([whether to build Poppler])
11020 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11021     AC_MSG_RESULT([yes])
11022     ENABLE_POPPLER=TRUE
11023     AC_DEFINE(HAVE_FEATURE_POPPLER)
11024 else
11025     AC_MSG_RESULT([no])
11027 AC_SUBST(ENABLE_POPPLER)
11029 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11030     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11033 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11034     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11037 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11038     dnl ===================================================================
11039     dnl Check for system poppler
11040     dnl ===================================================================
11041     AC_MSG_CHECKING([which PDF import poppler to use])
11042     if test "$with_system_poppler" = "yes"; then
11043         AC_MSG_RESULT([external])
11044         SYSTEM_POPPLER=TRUE
11045         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11046         AC_LANG_PUSH([C++])
11047         save_CXXFLAGS=$CXXFLAGS
11048         save_CPPFLAGS=$CPPFLAGS
11049         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11050         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11051         AC_CHECK_HEADER([cpp/poppler-version.h],
11052             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11053             [])
11054         CXXFLAGS=$save_CXXFLAGS
11055         CPPFLAGS=$save_CPPFLAGS
11056         AC_LANG_POP([C++])
11057         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11059         FilterLibs "${POPPLER_LIBS}"
11060         POPPLER_LIBS="${filteredlibs}"
11061     else
11062         AC_MSG_RESULT([internal])
11063         SYSTEM_POPPLER=
11064         BUILD_TYPE="$BUILD_TYPE POPPLER"
11065         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11066     fi
11067     AC_DEFINE([ENABLE_PDFIMPORT],1)
11069 AC_SUBST(ENABLE_PDFIMPORT)
11070 AC_SUBST(SYSTEM_POPPLER)
11071 AC_SUBST(POPPLER_CFLAGS)
11072 AC_SUBST(POPPLER_LIBS)
11074 # Skia?
11075 AC_MSG_CHECKING([whether to build Skia])
11076 ENABLE_SKIA=
11077 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11078     AC_MSG_RESULT([yes])
11079     ENABLE_SKIA=TRUE
11080     AC_DEFINE(HAVE_FEATURE_SKIA)
11081     BUILD_TYPE="$BUILD_TYPE SKIA"
11082 else
11083     AC_MSG_RESULT([no])
11085 AC_SUBST(ENABLE_SKIA)
11087 SYSTEM_GPGMEPP=
11089 if test "$build_for_ios" = "YES"; then
11090     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11091     AC_MSG_RESULT([yes])
11092 elif test "$enable_mpl_subset" = "yes"; then
11093     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11094     AC_MSG_RESULT([yes])
11095 elif test "$enable_fuzzers" = "yes"; then
11096     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11097     AC_MSG_RESULT([yes])
11098 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11099     dnl ===================================================================
11100     dnl Check for system gpgme
11101     dnl ===================================================================
11102     AC_MSG_CHECKING([which gpgmepp to use])
11103     if test "$with_system_gpgmepp" = "yes"; then
11104         AC_MSG_RESULT([external])
11105         SYSTEM_GPGMEPP=TRUE
11107         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11108         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11109             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11110         # progress_callback is the only func with plain C linkage
11111         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11112         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11113             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11114         AC_CHECK_HEADER(gpgme.h, [],
11115             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11116     else
11117         AC_MSG_RESULT([internal])
11118         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11119         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11121         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11122         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11123         if test "$_os" != "WINNT"; then
11124             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11125             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11126         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11127             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11128         fi
11129     fi
11130     ENABLE_GPGMEPP=TRUE
11131     AC_DEFINE([HAVE_FEATURE_GPGME])
11132     AC_PATH_PROG(GPG, gpg)
11133     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11134     # so let's exclude that manually for the moment
11135     if test -n "$GPG" -a "$_os" != "WINNT"; then
11136         # make sure we not only have a working gpgme, but a full working
11137         # gpg installation to run OpenPGP signature verification
11138         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11139     fi
11140     if test "$_os" = "Linux"; then
11141       uid=`id -u`
11142       AC_MSG_CHECKING([for /run/user/$uid])
11143       if test -d /run/user/$uid; then
11144         AC_MSG_RESULT([yes])
11145         AC_PATH_PROG(GPGCONF, gpgconf)
11147         # Older versions of gpgconf are not working as expected, since
11148         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11149         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11150         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11151         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11152         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11153         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11154         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11155           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11156           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11157           if $GPGCONF --dump-options > /dev/null ; then
11158             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11159               AC_MSG_RESULT([yes])
11160               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11161               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11162             else
11163               AC_MSG_RESULT([no])
11164             fi
11165           else
11166             AC_MSG_RESULT([no. missing or broken gpgconf?])
11167           fi
11168         else
11169           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11170         fi
11171       else
11172         AC_MSG_RESULT([no])
11173      fi
11174    fi
11176 AC_SUBST(ENABLE_GPGMEPP)
11177 AC_SUBST(SYSTEM_GPGMEPP)
11178 AC_SUBST(GPG_ERROR_CFLAGS)
11179 AC_SUBST(GPG_ERROR_LIBS)
11180 AC_SUBST(LIBASSUAN_CFLAGS)
11181 AC_SUBST(LIBASSUAN_LIBS)
11182 AC_SUBST(GPGMEPP_CFLAGS)
11183 AC_SUBST(GPGMEPP_LIBS)
11185 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11186 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11187     AC_MSG_RESULT([yes])
11188     ENABLE_MEDIAWIKI=TRUE
11189     BUILD_TYPE="$BUILD_TYPE XSLTML"
11190     if test  "x$with_java" = "xno"; then
11191         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11192     fi
11193 else
11194     AC_MSG_RESULT([no])
11195     ENABLE_MEDIAWIKI=
11196     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11198 AC_SUBST(ENABLE_MEDIAWIKI)
11200 AC_MSG_CHECKING([whether to build the Report Builder])
11201 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11202     AC_MSG_RESULT([yes])
11203     ENABLE_REPORTBUILDER=TRUE
11204     AC_MSG_CHECKING([which jfreereport libs to use])
11205     if test "$with_system_jfreereport" = "yes"; then
11206         SYSTEM_JFREEREPORT=TRUE
11207         AC_MSG_RESULT([external])
11208         if test -z $SAC_JAR; then
11209             SAC_JAR=/usr/share/java/sac.jar
11210         fi
11211         if ! test -f $SAC_JAR; then
11212              AC_MSG_ERROR(sac.jar not found.)
11213         fi
11215         if test -z $LIBXML_JAR; then
11216             if test -f /usr/share/java/libxml-1.0.0.jar; then
11217                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11218             elif test -f /usr/share/java/libxml.jar; then
11219                 LIBXML_JAR=/usr/share/java/libxml.jar
11220             else
11221                 AC_MSG_ERROR(libxml.jar replacement not found.)
11222             fi
11223         elif ! test -f $LIBXML_JAR; then
11224             AC_MSG_ERROR(libxml.jar not found.)
11225         fi
11227         if test -z $FLUTE_JAR; then
11228             if test -f/usr/share/java/flute-1.3.0.jar; then
11229                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11230             elif test -f /usr/share/java/flute.jar; then
11231                 FLUTE_JAR=/usr/share/java/flute.jar
11232             else
11233                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11234             fi
11235         elif ! test -f $FLUTE_JAR; then
11236             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11237         fi
11239         if test -z $JFREEREPORT_JAR; then
11240             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11241                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11242             elif test -f /usr/share/java/flow-engine.jar; then
11243                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11244             else
11245                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11246             fi
11247         elif ! test -f  $JFREEREPORT_JAR; then
11248                 AC_MSG_ERROR(jfreereport.jar not found.)
11249         fi
11251         if test -z $LIBLAYOUT_JAR; then
11252             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11253                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11254             elif test -f /usr/share/java/liblayout.jar; then
11255                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11256             else
11257                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11258             fi
11259         elif ! test -f $LIBLAYOUT_JAR; then
11260                 AC_MSG_ERROR(liblayout.jar not found.)
11261         fi
11263         if test -z $LIBLOADER_JAR; then
11264             if test -f /usr/share/java/libloader-1.0.0.jar; then
11265                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11266             elif test -f /usr/share/java/libloader.jar; then
11267                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11268             else
11269                 AC_MSG_ERROR(libloader.jar replacement not found.)
11270             fi
11271         elif ! test -f  $LIBLOADER_JAR; then
11272             AC_MSG_ERROR(libloader.jar not found.)
11273         fi
11275         if test -z $LIBFORMULA_JAR; then
11276             if test -f /usr/share/java/libformula-0.2.0.jar; then
11277                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11278             elif test -f /usr/share/java/libformula.jar; then
11279                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11280             else
11281                 AC_MSG_ERROR(libformula.jar replacement not found.)
11282             fi
11283         elif ! test -f $LIBFORMULA_JAR; then
11284                 AC_MSG_ERROR(libformula.jar not found.)
11285         fi
11287         if test -z $LIBREPOSITORY_JAR; then
11288             if test -f /usr/share/java/librepository-1.0.0.jar; then
11289                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11290             elif test -f /usr/share/java/librepository.jar; then
11291                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11292             else
11293                 AC_MSG_ERROR(librepository.jar replacement not found.)
11294             fi
11295         elif ! test -f $LIBREPOSITORY_JAR; then
11296             AC_MSG_ERROR(librepository.jar not found.)
11297         fi
11299         if test -z $LIBFONTS_JAR; then
11300             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11301                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11302             elif test -f /usr/share/java/libfonts.jar; then
11303                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11304             else
11305                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11306             fi
11307         elif ! test -f $LIBFONTS_JAR; then
11308                 AC_MSG_ERROR(libfonts.jar not found.)
11309         fi
11311         if test -z $LIBSERIALIZER_JAR; then
11312             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11313                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11314             elif test -f /usr/share/java/libserializer.jar; then
11315                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11316             else
11317                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11318             fi
11319         elif ! test -f $LIBSERIALIZER_JAR; then
11320                 AC_MSG_ERROR(libserializer.jar not found.)
11321         fi
11323         if test -z $LIBBASE_JAR; then
11324             if test -f /usr/share/java/libbase-1.0.0.jar; then
11325                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11326             elif test -f /usr/share/java/libbase.jar; then
11327                 LIBBASE_JAR=/usr/share/java/libbase.jar
11328             else
11329                 AC_MSG_ERROR(libbase.jar replacement not found.)
11330             fi
11331         elif ! test -f $LIBBASE_JAR; then
11332             AC_MSG_ERROR(libbase.jar not found.)
11333         fi
11335     else
11336         AC_MSG_RESULT([internal])
11337         SYSTEM_JFREEREPORT=
11338         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11339         NEED_ANT=TRUE
11340     fi
11341 else
11342     AC_MSG_RESULT([no])
11343     ENABLE_REPORTBUILDER=
11344     SYSTEM_JFREEREPORT=
11346 AC_SUBST(ENABLE_REPORTBUILDER)
11347 AC_SUBST(SYSTEM_JFREEREPORT)
11348 AC_SUBST(SAC_JAR)
11349 AC_SUBST(LIBXML_JAR)
11350 AC_SUBST(FLUTE_JAR)
11351 AC_SUBST(JFREEREPORT_JAR)
11352 AC_SUBST(LIBBASE_JAR)
11353 AC_SUBST(LIBLAYOUT_JAR)
11354 AC_SUBST(LIBLOADER_JAR)
11355 AC_SUBST(LIBFORMULA_JAR)
11356 AC_SUBST(LIBREPOSITORY_JAR)
11357 AC_SUBST(LIBFONTS_JAR)
11358 AC_SUBST(LIBSERIALIZER_JAR)
11360 # this has to be here because both the Wiki Publisher and the SRB use
11361 # commons-logging
11362 COMMONS_LOGGING_VERSION=1.2
11363 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11364     AC_MSG_CHECKING([which Apache commons-* libs to use])
11365     if test "$with_system_apache_commons" = "yes"; then
11366         SYSTEM_APACHE_COMMONS=TRUE
11367         AC_MSG_RESULT([external])
11368         if test -z $COMMONS_LOGGING_JAR; then
11369             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11370                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11371            elif test -f /usr/share/java/commons-logging.jar; then
11372                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11373             else
11374                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11375             fi
11376         elif ! test -f $COMMONS_LOGGING_JAR; then
11377             AC_MSG_ERROR(commons-logging.jar not found.)
11378         fi
11379     else
11380         AC_MSG_RESULT([internal])
11381         SYSTEM_APACHE_COMMONS=
11382         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11383         NEED_ANT=TRUE
11384     fi
11386 AC_SUBST(SYSTEM_APACHE_COMMONS)
11387 AC_SUBST(COMMONS_LOGGING_JAR)
11388 AC_SUBST(COMMONS_LOGGING_VERSION)
11390 # scripting provider for BeanShell?
11391 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11392 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11393     AC_MSG_RESULT([yes])
11394     ENABLE_SCRIPTING_BEANSHELL=TRUE
11396     dnl ===================================================================
11397     dnl Check for system beanshell
11398     dnl ===================================================================
11399     AC_MSG_CHECKING([which beanshell to use])
11400     if test "$with_system_beanshell" = "yes"; then
11401         AC_MSG_RESULT([external])
11402         SYSTEM_BSH=TRUE
11403         if test -z $BSH_JAR; then
11404             BSH_JAR=/usr/share/java/bsh.jar
11405         fi
11406         if ! test -f $BSH_JAR; then
11407             AC_MSG_ERROR(bsh.jar not found.)
11408         fi
11409     else
11410         AC_MSG_RESULT([internal])
11411         SYSTEM_BSH=
11412         BUILD_TYPE="$BUILD_TYPE BSH"
11413     fi
11414 else
11415     AC_MSG_RESULT([no])
11416     ENABLE_SCRIPTING_BEANSHELL=
11417     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11419 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11420 AC_SUBST(SYSTEM_BSH)
11421 AC_SUBST(BSH_JAR)
11423 # scripting provider for JavaScript?
11424 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11425 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11426     AC_MSG_RESULT([yes])
11427     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11429     dnl ===================================================================
11430     dnl Check for system rhino
11431     dnl ===================================================================
11432     AC_MSG_CHECKING([which rhino to use])
11433     if test "$with_system_rhino" = "yes"; then
11434         AC_MSG_RESULT([external])
11435         SYSTEM_RHINO=TRUE
11436         if test -z $RHINO_JAR; then
11437             RHINO_JAR=/usr/share/java/js.jar
11438         fi
11439         if ! test -f $RHINO_JAR; then
11440             AC_MSG_ERROR(js.jar not found.)
11441         fi
11442     else
11443         AC_MSG_RESULT([internal])
11444         SYSTEM_RHINO=
11445         BUILD_TYPE="$BUILD_TYPE RHINO"
11446         NEED_ANT=TRUE
11447     fi
11448 else
11449     AC_MSG_RESULT([no])
11450     ENABLE_SCRIPTING_JAVASCRIPT=
11451     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11453 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11454 AC_SUBST(SYSTEM_RHINO)
11455 AC_SUBST(RHINO_JAR)
11457 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11458 # paths should be added to library search path. So lets put all 64-bit
11459 # platforms there.
11460 supports_multilib=
11461 case "$host_cpu" in
11462 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11463     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11464         supports_multilib="yes"
11465     fi
11466     ;;
11468     ;;
11469 esac
11471 dnl ===================================================================
11472 dnl QT5 Integration
11473 dnl ===================================================================
11475 QT5_CFLAGS=""
11476 QT5_LIBS=""
11477 QMAKE5="qmake"
11478 MOC5="moc"
11479 QT5_GOBJECT_CFLAGS=""
11480 QT5_GOBJECT_LIBS=""
11481 QT5_HAVE_GOBJECT=""
11482 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11483         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11484         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11485 then
11486     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11487     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11489     if test -n "$supports_multilib"; then
11490         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11491     fi
11493     qt5_test_include="QtWidgets/qapplication.h"
11494     qt5_test_library="libQt5Widgets.so"
11496     dnl Check for qmake5
11497     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11498     if test "$QMAKE5" = "no"; then
11499         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11500     else
11501         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11502         if test -z "$qmake5_test_ver"; then
11503             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11504         fi
11505         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11506         qt5_minimal_minor="6"
11507         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11508             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11509         else
11510             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11511         fi
11512     fi
11514     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11515     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11517     AC_MSG_CHECKING([for Qt5 headers])
11518     qt5_incdir="no"
11519     for inc_dir in $qt5_incdirs; do
11520         if test -r "$inc_dir/$qt5_test_include"; then
11521             qt5_incdir="$inc_dir"
11522             break
11523         fi
11524     done
11525     AC_MSG_RESULT([$qt5_incdir])
11526     if test "x$qt5_incdir" = "xno"; then
11527         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11528     fi
11530     AC_MSG_CHECKING([for Qt5 libraries])
11531     qt5_libdir="no"
11532     for lib_dir in $qt5_libdirs; do
11533         if test -r "$lib_dir/$qt5_test_library"; then
11534             qt5_libdir="$lib_dir"
11535             break
11536         fi
11537     done
11538     AC_MSG_RESULT([$qt5_libdir])
11539     if test "x$qt5_libdir" = "xno"; then
11540         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11541     fi
11543     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11544     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11545     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11547     if test "$USING_X11" = TRUE; then
11548         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11549         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11550             QT5_HAVE_XCB_ICCCM=1
11551             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11552         ],[
11553             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)])
11554             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11555         ])
11556         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11557         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11558         QT5_USING_X11=1
11559         AC_DEFINE(QT5_USING_X11)
11560     fi
11562     dnl Check for Meta Object Compiler
11564     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11565     if test "$MOC5" = "no"; then
11566         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11567 the root of your Qt installation by exporting QT5DIR before running "configure".])
11568     fi
11570     if test "$build_gstreamer_1_0" = "yes"; then
11571         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11572                 QT5_HAVE_GOBJECT=1
11573                 AC_DEFINE(QT5_HAVE_GOBJECT)
11574             ],
11575             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11576         )
11577     fi
11579 AC_SUBST(QT5_CFLAGS)
11580 AC_SUBST(QT5_LIBS)
11581 AC_SUBST(MOC5)
11582 AC_SUBST(QT5_GOBJECT_CFLAGS)
11583 AC_SUBST(QT5_GOBJECT_LIBS)
11584 AC_SUBST(QT5_HAVE_GOBJECT)
11586 dnl ===================================================================
11587 dnl KF5 Integration
11588 dnl ===================================================================
11590 KF5_CFLAGS=""
11591 KF5_LIBS=""
11592 KF5_CONFIG="kf5-config"
11593 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11594         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11595 then
11596     if test "$OS" = "HAIKU"; then
11597         haiku_arch="`echo $RTL_ARCH | tr X x`"
11598         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11599         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11600     fi
11602     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11603     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11604     if test -n "$supports_multilib"; then
11605         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11606     fi
11608     kf5_test_include="KF5/kcoreaddons_version.h"
11609     kf5_test_library="libKF5CoreAddons.so"
11610     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11612     dnl kf5 KDE4 support compatibility installed
11613     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11614     if test "$KF5_CONFIG" != "no"; then
11615         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11616         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11617     fi
11619     dnl Check for KF5 headers
11620     AC_MSG_CHECKING([for KF5 headers])
11621     kf5_incdir="no"
11622     for kf5_check in $kf5_incdirs; do
11623         if test -r "$kf5_check/$kf5_test_include"; then
11624             kf5_incdir="$kf5_check/KF5"
11625             break
11626         fi
11627     done
11628     AC_MSG_RESULT([$kf5_incdir])
11629     if test "x$kf5_incdir" = "xno"; then
11630         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11631     fi
11633     dnl Check for KF5 libraries
11634     AC_MSG_CHECKING([for KF5 libraries])
11635     kf5_libdir="no"
11636     for kf5_check in $kf5_libdirs; do
11637         if test -r "$kf5_check/$kf5_test_library"; then
11638             kf5_libdir="$kf5_check"
11639             break
11640         fi
11641     done
11643     AC_MSG_RESULT([$kf5_libdir])
11644     if test "x$kf5_libdir" = "xno"; then
11645         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11646     fi
11648     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"
11649     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11650     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11652     if test "$USING_X11" = TRUE; then
11653         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11654     fi
11656     AC_LANG_PUSH([C++])
11657     save_CXXFLAGS=$CXXFLAGS
11658     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11659     AC_MSG_CHECKING([whether KDE is >= 5.0])
11660        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11661 #include <kcoreaddons_version.h>
11663 int main(int argc, char **argv) {
11664        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11665        else return 1;
11667        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11668     CXXFLAGS=$save_CXXFLAGS
11669     AC_LANG_POP([C++])
11671 AC_SUBST(KF5_CFLAGS)
11672 AC_SUBST(KF5_LIBS)
11674 dnl ===================================================================
11675 dnl Test whether to include Evolution 2 support
11676 dnl ===================================================================
11677 AC_MSG_CHECKING([whether to enable evolution 2 support])
11678 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11679     AC_MSG_RESULT([yes])
11680     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11681     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11682     FilterLibs "${GOBJECT_LIBS}"
11683     GOBJECT_LIBS="${filteredlibs}"
11684     ENABLE_EVOAB2="TRUE"
11685 else
11686     ENABLE_EVOAB2=""
11687     AC_MSG_RESULT([no])
11689 AC_SUBST(ENABLE_EVOAB2)
11690 AC_SUBST(GOBJECT_CFLAGS)
11691 AC_SUBST(GOBJECT_LIBS)
11693 dnl ===================================================================
11694 dnl Test which themes to include
11695 dnl ===================================================================
11696 AC_MSG_CHECKING([which themes to include])
11697 # if none given use default subset of available themes
11698 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11699     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11702 WITH_THEMES=""
11703 if test "x$with_theme" != "xno"; then
11704     for theme in $with_theme; do
11705         case $theme in
11706         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11707         default) real_theme=colibre ;;
11708         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11709         esac
11710         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11711     done
11713 AC_MSG_RESULT([$WITH_THEMES])
11714 AC_SUBST([WITH_THEMES])
11715 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11716 for theme in $with_theme; do
11717     case $theme in
11718     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11719     *) ;;
11720     esac
11721 done
11723 dnl ===================================================================
11724 dnl Test whether to integrate helppacks into the product's installer
11725 dnl ===================================================================
11726 AC_MSG_CHECKING([for helppack integration])
11727 if test "$with_helppack_integration" = "no"; then
11728     AC_MSG_RESULT([no integration])
11729 else
11730     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11731     AC_MSG_RESULT([integration])
11734 ###############################################################################
11735 # Extensions checking
11736 ###############################################################################
11737 AC_MSG_CHECKING([for extensions integration])
11738 if test "x$enable_extension_integration" != "xno"; then
11739     WITH_EXTENSION_INTEGRATION=TRUE
11740     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11741     AC_MSG_RESULT([yes, use integration])
11742 else
11743     WITH_EXTENSION_INTEGRATION=
11744     AC_MSG_RESULT([no, do not integrate])
11746 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11748 dnl Should any extra extensions be included?
11749 dnl There are standalone tests for each of these below.
11750 WITH_EXTRA_EXTENSIONS=
11751 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11753 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11754 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11755 if test "x$with_java" != "xno"; then
11756     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11757     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11760 AC_MSG_CHECKING([whether to build opens___.ttf])
11761 if test "$enable_build_opensymbol" = "yes"; then
11762     AC_MSG_RESULT([yes])
11763     AC_PATH_PROG(FONTFORGE, fontforge)
11764     if test -z "$FONTFORGE"; then
11765         AC_MSG_ERROR([fontforge not installed])
11766     fi
11767 else
11768     AC_MSG_RESULT([no])
11769     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11770     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11772 AC_SUBST(OPENSYMBOL_TTF)
11773 AC_SUBST(FONTFORGE)
11775 dnl ===================================================================
11776 dnl Test whether to include fonts
11777 dnl ===================================================================
11778 AC_MSG_CHECKING([whether to include third-party fonts])
11779 if test "$with_fonts" != "no"; then
11780     AC_MSG_RESULT([yes])
11781     WITH_FONTS=TRUE
11782     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11783     AC_DEFINE(HAVE_MORE_FONTS)
11784 else
11785     AC_MSG_RESULT([no])
11786     WITH_FONTS=
11787     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11789 AC_SUBST(WITH_FONTS)
11792 dnl ===================================================================
11793 dnl Test whether to enable online update service
11794 dnl ===================================================================
11795 AC_MSG_CHECKING([whether to enable online update])
11796 ENABLE_ONLINE_UPDATE=
11797 ENABLE_ONLINE_UPDATE_MAR=
11798 UPDATE_CONFIG=
11799 if test "$enable_online_update" = ""; then
11800     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11801         AC_MSG_RESULT([yes])
11802         ENABLE_ONLINE_UPDATE="TRUE"
11803     else
11804         AC_MSG_RESULT([no])
11805     fi
11806 else
11807     if test "$enable_online_update" = "mar"; then
11808         AC_MSG_RESULT([yes - MAR-based online update])
11809         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11810         if test "$with_update_config" = ""; then
11811             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11812         fi
11813         UPDATE_CONFIG="$with_update_config"
11814         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11815     elif test "$enable_online_update" = "yes"; then
11816         AC_MSG_RESULT([yes])
11817         ENABLE_ONLINE_UPDATE="TRUE"
11818     else
11819         AC_MSG_RESULT([no])
11820     fi
11822 AC_SUBST(ENABLE_ONLINE_UPDATE)
11823 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11824 AC_SUBST(UPDATE_CONFIG)
11826 dnl ===================================================================
11827 dnl Test whether we need bzip2
11828 dnl ===================================================================
11829 SYSTEM_BZIP2=
11830 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11831     AC_MSG_CHECKING([whether to use system bzip2])
11832     if test "$with_system_bzip2" = yes; then
11833         SYSTEM_BZIP2=TRUE
11834         AC_MSG_RESULT([yes])
11835         PKG_CHECK_MODULES(BZIP2, bzip2)
11836         FilterLibs "${BZIP2_LIBS}"
11837         BZIP2_LIBS="${filteredlibs}"
11838     else
11839         AC_MSG_RESULT([no])
11840         BUILD_TYPE="$BUILD_TYPE BZIP2"
11841     fi
11843 AC_SUBST(SYSTEM_BZIP2)
11844 AC_SUBST(BZIP2_CFLAGS)
11845 AC_SUBST(BZIP2_LIBS)
11847 dnl ===================================================================
11848 dnl Test whether to enable extension update
11849 dnl ===================================================================
11850 AC_MSG_CHECKING([whether to enable extension update])
11851 ENABLE_EXTENSION_UPDATE=
11852 if test "x$enable_extension_update" = "xno"; then
11853     AC_MSG_RESULT([no])
11854 else
11855     AC_MSG_RESULT([yes])
11856     ENABLE_EXTENSION_UPDATE="TRUE"
11857     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11858     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11860 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11863 dnl ===================================================================
11864 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11865 dnl ===================================================================
11866 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11867 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11868     AC_MSG_RESULT([no])
11869     ENABLE_SILENT_MSI=
11870 else
11871     AC_MSG_RESULT([yes])
11872     ENABLE_SILENT_MSI=TRUE
11873     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11875 AC_SUBST(ENABLE_SILENT_MSI)
11877 AC_MSG_CHECKING([whether and how to use Xinerama])
11878 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11879     if test "$x_libraries" = "default_x_libraries"; then
11880         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11881         if test "x$XINERAMALIB" = x; then
11882            XINERAMALIB="/usr/lib"
11883         fi
11884     else
11885         XINERAMALIB="$x_libraries"
11886     fi
11887     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11888         # we have both versions, let the user decide but use the dynamic one
11889         # per default
11890         USE_XINERAMA=TRUE
11891         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11892             XINERAMA_LINK=dynamic
11893         else
11894             XINERAMA_LINK=static
11895         fi
11896     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11897         # we have only the dynamic version
11898         USE_XINERAMA=TRUE
11899         XINERAMA_LINK=dynamic
11900     elif test -e "$XINERAMALIB/libXinerama.a"; then
11901         # static version
11902         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11903             USE_XINERAMA=TRUE
11904             XINERAMA_LINK=static
11905         else
11906             USE_XINERAMA=
11907             XINERAMA_LINK=none
11908         fi
11909     else
11910         # no Xinerama
11911         USE_XINERAMA=
11912         XINERAMA_LINK=none
11913     fi
11914     if test "$USE_XINERAMA" = "TRUE"; then
11915         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11916         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11917             [AC_MSG_ERROR(Xinerama header not found.)], [])
11918         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11919         if test "x$XEXTLIB" = x; then
11920            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11921         fi
11922         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11923         if test "$_os" = "FreeBSD"; then
11924             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11925         fi
11926         if test "$_os" = "Linux"; then
11927             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11928         fi
11929         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11930             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11931     else
11932         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11933     fi
11934 else
11935     USE_XINERAMA=
11936     XINERAMA_LINK=none
11937     AC_MSG_RESULT([no])
11939 AC_SUBST(USE_XINERAMA)
11940 AC_SUBST(XINERAMA_LINK)
11942 dnl ===================================================================
11943 dnl Test whether to build cairo or rely on the system version
11944 dnl ===================================================================
11946 if test "$USING_X11" = TRUE; then
11947     # Used in vcl/Library_vclplug_gen.mk
11948     test_cairo=yes
11951 if test "$test_cairo" = "yes"; then
11952     AC_MSG_CHECKING([whether to use the system cairo])
11954     : ${with_system_cairo:=$with_system_libs}
11955     if test "$with_system_cairo" = "yes"; then
11956         SYSTEM_CAIRO=TRUE
11957         AC_MSG_RESULT([yes])
11959         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11960         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11961         FilterLibs "${CAIRO_LIBS}"
11962         CAIRO_LIBS="${filteredlibs}"
11964         if test "$test_xrender" = "yes"; then
11965             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11966             AC_LANG_PUSH([C])
11967             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11968 #ifdef PictStandardA8
11969 #else
11970       return fail;
11971 #endif
11972 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11974             AC_LANG_POP([C])
11975         fi
11976     else
11977         SYSTEM_CAIRO=
11978         AC_MSG_RESULT([no])
11980         BUILD_TYPE="$BUILD_TYPE CAIRO"
11981     fi
11984 AC_SUBST(SYSTEM_CAIRO)
11985 AC_SUBST(CAIRO_CFLAGS)
11986 AC_SUBST(CAIRO_LIBS)
11988 dnl ===================================================================
11989 dnl Test whether to use avahi
11990 dnl ===================================================================
11991 if test "$_os" = "WINNT"; then
11992     # Windows uses bundled mDNSResponder
11993     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11994 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11995     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11996                       [ENABLE_AVAHI="TRUE"])
11997     AC_DEFINE(HAVE_FEATURE_AVAHI)
11998     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11999     FilterLibs "${AVAHI_LIBS}"
12000     AVAHI_LIBS="${filteredlibs}"
12003 AC_SUBST(ENABLE_AVAHI)
12004 AC_SUBST(AVAHI_CFLAGS)
12005 AC_SUBST(AVAHI_LIBS)
12007 dnl ===================================================================
12008 dnl Test whether to use liblangtag
12009 dnl ===================================================================
12010 SYSTEM_LIBLANGTAG=
12011 AC_MSG_CHECKING([whether to use system liblangtag])
12012 if test "$with_system_liblangtag" = yes; then
12013     SYSTEM_LIBLANGTAG=TRUE
12014     AC_MSG_RESULT([yes])
12015     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12016     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12017     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12018     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12019     FilterLibs "${LIBLANGTAG_LIBS}"
12020     LIBLANGTAG_LIBS="${filteredlibs}"
12021 else
12022     SYSTEM_LIBLANGTAG=
12023     AC_MSG_RESULT([no])
12024     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12025     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12026     if test "$COM" = "MSC"; then
12027         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12028     else
12029         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12030     fi
12032 AC_SUBST(SYSTEM_LIBLANGTAG)
12033 AC_SUBST(LIBLANGTAG_CFLAGS)
12034 AC_SUBST(LIBLANGTAG_LIBS)
12036 dnl ===================================================================
12037 dnl Test whether to build libpng or rely on the system version
12038 dnl ===================================================================
12040 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12042 dnl ===================================================================
12043 dnl Check for runtime JVM search path
12044 dnl ===================================================================
12045 if test "$ENABLE_JAVA" != ""; then
12046     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12047     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12048         AC_MSG_RESULT([yes])
12049         if ! test -d "$with_jvm_path"; then
12050             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12051         fi
12052         if ! test -d "$with_jvm_path"jvm; then
12053             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12054         fi
12055         JVM_ONE_PATH_CHECK="$with_jvm_path"
12056         AC_SUBST(JVM_ONE_PATH_CHECK)
12057     else
12058         AC_MSG_RESULT([no])
12059     fi
12062 dnl ===================================================================
12063 dnl Test for the presence of Ant and that it works
12064 dnl ===================================================================
12066 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12067     ANT_HOME=; export ANT_HOME
12068     WITH_ANT_HOME=; export WITH_ANT_HOME
12069     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12070         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12071             if test "$_os" = "WINNT"; then
12072                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12073             else
12074                 with_ant_home="$LODE_HOME/opt/ant"
12075             fi
12076         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12077             with_ant_home="$LODE_HOME/opt/ant"
12078         fi
12079     fi
12080     if test -z "$with_ant_home"; then
12081         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12082     else
12083         if test "$_os" = "WINNT"; then
12084             # AC_PATH_PROGS needs unix path
12085             with_ant_home=`cygpath -u "$with_ant_home"`
12086         fi
12087         AbsolutePath "$with_ant_home"
12088         with_ant_home=$absolute_path
12089         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12090         WITH_ANT_HOME=$with_ant_home
12091         ANT_HOME=$with_ant_home
12092     fi
12094     if test -z "$ANT"; then
12095         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12096     else
12097         # resolve relative or absolute symlink
12098         while test -h "$ANT"; do
12099             a_cwd=`pwd`
12100             a_basename=`basename "$ANT"`
12101             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12102             cd "`dirname "$ANT"`"
12103             cd "`dirname "$a_script"`"
12104             ANT="`pwd`"/"`basename "$a_script"`"
12105             cd "$a_cwd"
12106         done
12108         AC_MSG_CHECKING([if $ANT works])
12109         mkdir -p conftest.dir
12110         a_cwd=$(pwd)
12111         cd conftest.dir
12112         cat > conftest.java << EOF
12113         public class conftest {
12114             int testmethod(int a, int b) {
12115                     return a + b;
12116             }
12117         }
12120         cat > conftest.xml << EOF
12121         <project name="conftest" default="conftest">
12122         <target name="conftest">
12123             <javac srcdir="." includes="conftest.java">
12124             </javac>
12125         </target>
12126         </project>
12129         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12130         if test $? = 0 -a -f ./conftest.class; then
12131             AC_MSG_RESULT([Ant works])
12132             if test -z "$WITH_ANT_HOME"; then
12133                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12134                 if test -z "$ANT_HOME"; then
12135                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12136                 fi
12137             else
12138                 ANT_HOME="$WITH_ANT_HOME"
12139             fi
12140         else
12141             echo "configure: Ant test failed" >&5
12142             cat conftest.java >&5
12143             cat conftest.xml >&5
12144             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12145         fi
12146         cd "$a_cwd"
12147         rm -fr conftest.dir
12148     fi
12149     if test -z "$ANT_HOME"; then
12150         ANT_HOME="NO_ANT_HOME"
12151     else
12152         PathFormat "$ANT_HOME"
12153         ANT_HOME="$formatted_path"
12154         PathFormat "$ANT"
12155         ANT="$formatted_path"
12156     fi
12157     AC_SUBST(ANT_HOME)
12158     AC_SUBST(ANT)
12160     dnl Checking for ant.jar
12161     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12162         AC_MSG_CHECKING([Ant lib directory])
12163         if test -f $ANT_HOME/lib/ant.jar; then
12164             ANT_LIB="$ANT_HOME/lib"
12165         else
12166             if test -f $ANT_HOME/ant.jar; then
12167                 ANT_LIB="$ANT_HOME"
12168             else
12169                 if test -f /usr/share/java/ant.jar; then
12170                     ANT_LIB=/usr/share/java
12171                 else
12172                     if test -f /usr/share/ant-core/lib/ant.jar; then
12173                         ANT_LIB=/usr/share/ant-core/lib
12174                     else
12175                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12176                             ANT_LIB="$ANT_HOME/lib/ant"
12177                         else
12178                             if test -f /usr/share/lib/ant/ant.jar; then
12179                                 ANT_LIB=/usr/share/lib/ant
12180                             else
12181                                 AC_MSG_ERROR([Ant libraries not found!])
12182                             fi
12183                         fi
12184                     fi
12185                 fi
12186             fi
12187         fi
12188         PathFormat "$ANT_LIB"
12189         ANT_LIB="$formatted_path"
12190         AC_MSG_RESULT([Ant lib directory found.])
12191     fi
12192     AC_SUBST(ANT_LIB)
12194     ant_minver=1.6.0
12195     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12197     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12198     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12199     ant_version_major=`echo $ant_version | cut -d. -f1`
12200     ant_version_minor=`echo $ant_version | cut -d. -f2`
12201     echo "configure: ant_version $ant_version " >&5
12202     echo "configure: ant_version_major $ant_version_major " >&5
12203     echo "configure: ant_version_minor $ant_version_minor " >&5
12204     if test "$ant_version_major" -ge "2"; then
12205         AC_MSG_RESULT([yes, $ant_version])
12206     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12207         AC_MSG_RESULT([yes, $ant_version])
12208     else
12209         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12210     fi
12212     rm -f conftest* core core.* *.core
12215 OOO_JUNIT_JAR=
12216 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12217     AC_MSG_CHECKING([for JUnit 4])
12218     if test "$with_junit" = "yes"; then
12219         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12220             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12221         elif test -e /usr/share/java/junit4.jar; then
12222             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12223         else
12224            if test -e /usr/share/lib/java/junit.jar; then
12225               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12226            else
12227               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12228            fi
12229         fi
12230     else
12231         OOO_JUNIT_JAR=$with_junit
12232     fi
12233     if test "$_os" = "WINNT"; then
12234         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12235     fi
12236     printf 'import org.junit.Before;' > conftest.java
12237     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12238         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12239     else
12240         AC_MSG_ERROR(
12241 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12242  specify its pathname via --with-junit=..., or disable it via --without-junit])
12243     fi
12244     rm -f conftest.class conftest.java
12245     if test $OOO_JUNIT_JAR != ""; then
12246     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12247     fi
12249 AC_SUBST(OOO_JUNIT_JAR)
12251 HAMCREST_JAR=
12252 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12253     AC_MSG_CHECKING([for included Hamcrest])
12254     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12255     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12256         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12257     else
12258         AC_MSG_RESULT([Not included])
12259         AC_MSG_CHECKING([for standalone hamcrest jar.])
12260         if test "$with_hamcrest" = "yes"; then
12261             if test -e /usr/share/lib/java/hamcrest.jar; then
12262                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12263             elif test -e /usr/share/java/hamcrest/core.jar; then
12264                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12265             else
12266                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12267             fi
12268         else
12269             HAMCREST_JAR=$with_hamcrest
12270         fi
12271         if test "$_os" = "WINNT"; then
12272             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12273         fi
12274         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12275             AC_MSG_RESULT([$HAMCREST_JAR])
12276         else
12277             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),
12278                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12279         fi
12280     fi
12281     rm -f conftest.class conftest.java
12283 AC_SUBST(HAMCREST_JAR)
12286 AC_SUBST(SCPDEFS)
12289 # check for wget and curl
12291 WGET=
12292 CURL=
12294 if test "$enable_fetch_external" != "no"; then
12296 CURL=`which curl 2>/dev/null`
12298 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12299     # wget new enough?
12300     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12301     if test $? -eq 0; then
12302         WGET=$i
12303         break
12304     fi
12305 done
12307 if test -z "$WGET" -a -z "$CURL"; then
12308     AC_MSG_ERROR([neither wget nor curl found!])
12313 AC_SUBST(WGET)
12314 AC_SUBST(CURL)
12317 # check for sha256sum
12319 SHA256SUM=
12321 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12322     eval "$i -a 256 --version" > /dev/null 2>&1
12323     ret=$?
12324     if test $ret -eq 0; then
12325         SHA256SUM="$i -a 256"
12326         break
12327     fi
12328 done
12330 if test -z "$SHA256SUM"; then
12331     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12332         eval "$i --version" > /dev/null 2>&1
12333         ret=$?
12334         if test $ret -eq 0; then
12335             SHA256SUM=$i
12336             break
12337         fi
12338     done
12341 if test -z "$SHA256SUM"; then
12342     AC_MSG_ERROR([no sha256sum found!])
12345 AC_SUBST(SHA256SUM)
12347 dnl ===================================================================
12348 dnl Dealing with l10n options
12349 dnl ===================================================================
12350 AC_MSG_CHECKING([which languages to be built])
12351 # get list of all languages
12352 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12353 # the sed command does the following:
12354 #   + if a line ends with a backslash, append the next line to it
12355 #   + adds " on the beginning of the value (after =)
12356 #   + adds " at the end of the value
12357 #   + removes en-US; we want to put it on the beginning
12358 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12359 [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)]
12360 ALL_LANGS="en-US $completelangiso"
12361 # check the configured localizations
12362 WITH_LANG="$with_lang"
12364 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12365 # (Norwegian is "nb" and "nn".)
12366 if test "$WITH_LANG" = "no"; then
12367     WITH_LANG=
12370 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12371     AC_MSG_RESULT([en-US])
12372 else
12373     AC_MSG_RESULT([$WITH_LANG])
12374     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12375     if test -z "$MSGFMT"; then
12376         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12377             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12378         elif test -x "/opt/lo/bin/msgfmt"; then
12379             MSGFMT="/opt/lo/bin/msgfmt"
12380         else
12381             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12382             if test -z "$MSGFMT"; then
12383                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12384             fi
12385         fi
12386     fi
12387     if test -z "$MSGUNIQ"; then
12388         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12389             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12390         elif test -x "/opt/lo/bin/msguniq"; then
12391             MSGUNIQ="/opt/lo/bin/msguniq"
12392         else
12393             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12394             if test -z "$MSGUNIQ"; then
12395                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12396             fi
12397         fi
12398     fi
12400 AC_SUBST(MSGFMT)
12401 AC_SUBST(MSGUNIQ)
12402 # check that the list is valid
12403 for lang in $WITH_LANG; do
12404     test "$lang" = "ALL" && continue
12405     # need to check for the exact string, so add space before and after the list of all languages
12406     for vl in $ALL_LANGS; do
12407         if test "$vl" = "$lang"; then
12408            break
12409         fi
12410     done
12411     if test "$vl" != "$lang"; then
12412         # if you're reading this - you prolly quoted your languages remove the quotes ...
12413         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12414     fi
12415 done
12416 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12417     echo $WITH_LANG | grep -q en-US
12418     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12420 # list with substituted ALL
12421 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12422 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12423 test "$WITH_LANG" = "en-US" && WITH_LANG=
12424 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12425     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12426     ALL_LANGS=`echo $ALL_LANGS qtz`
12428 AC_SUBST(ALL_LANGS)
12429 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12430 AC_SUBST(WITH_LANG)
12431 AC_SUBST(WITH_LANG_LIST)
12432 AC_SUBST(GIT_NEEDED_SUBMODULES)
12434 WITH_POOR_HELP_LOCALIZATIONS=
12435 if test -d "$SRC_ROOT/translations/source"; then
12436     for l in `ls -1 $SRC_ROOT/translations/source`; do
12437         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12438             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12439         fi
12440     done
12442 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12444 if test -n "$with_locales"; then
12445     WITH_LOCALES="$with_locales"
12447     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12448     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12449     # config_host/config_locales.h.in
12450     for locale in $WITH_LOCALES; do
12451         lang=${locale%_*}
12453         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12455         case $lang in
12456         hi|mr*ne)
12457             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12458             ;;
12459         bg|ru)
12460             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12461             ;;
12462         esac
12463     done
12464 else
12465     AC_DEFINE(WITH_LOCALE_ALL)
12467 AC_SUBST(WITH_LOCALES)
12469 dnl git submodule update --reference
12470 dnl ===================================================================
12471 if test -n "${GIT_REFERENCE_SRC}"; then
12472     for repo in ${GIT_NEEDED_SUBMODULES}; do
12473         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12474             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12475         fi
12476     done
12478 AC_SUBST(GIT_REFERENCE_SRC)
12480 dnl git submodules linked dirs
12481 dnl ===================================================================
12482 if test -n "${GIT_LINK_SRC}"; then
12483     for repo in ${GIT_NEEDED_SUBMODULES}; do
12484         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12485             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12486         fi
12487     done
12489 AC_SUBST(GIT_LINK_SRC)
12491 dnl branding
12492 dnl ===================================================================
12493 AC_MSG_CHECKING([for alternative branding images directory])
12494 # initialize mapped arrays
12495 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12496 brand_files="$BRAND_INTRO_IMAGES about.svg"
12498 if test -z "$with_branding" -o "$with_branding" = "no"; then
12499     AC_MSG_RESULT([none])
12500     DEFAULT_BRAND_IMAGES="$brand_files"
12501 else
12502     if ! test -d $with_branding ; then
12503         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12504     else
12505         AC_MSG_RESULT([$with_branding])
12506         CUSTOM_BRAND_DIR="$with_branding"
12507         for lfile in $brand_files
12508         do
12509             if ! test -f $with_branding/$lfile ; then
12510                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12511                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12512             else
12513                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12514             fi
12515         done
12516         check_for_progress="yes"
12517     fi
12519 AC_SUBST([BRAND_INTRO_IMAGES])
12520 AC_SUBST([CUSTOM_BRAND_DIR])
12521 AC_SUBST([CUSTOM_BRAND_IMAGES])
12522 AC_SUBST([DEFAULT_BRAND_IMAGES])
12525 AC_MSG_CHECKING([for 'intro' progress settings])
12526 PROGRESSBARCOLOR=
12527 PROGRESSSIZE=
12528 PROGRESSPOSITION=
12529 PROGRESSFRAMECOLOR=
12530 PROGRESSTEXTCOLOR=
12531 PROGRESSTEXTBASELINE=
12533 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12534     source "$with_branding/progress.conf"
12535     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12536 else
12537     AC_MSG_RESULT([none])
12540 AC_SUBST(PROGRESSBARCOLOR)
12541 AC_SUBST(PROGRESSSIZE)
12542 AC_SUBST(PROGRESSPOSITION)
12543 AC_SUBST(PROGRESSFRAMECOLOR)
12544 AC_SUBST(PROGRESSTEXTCOLOR)
12545 AC_SUBST(PROGRESSTEXTBASELINE)
12548 AC_MSG_CHECKING([for extra build ID])
12549 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12550     EXTRA_BUILDID="$with_extra_buildid"
12552 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12553 if test -n "$EXTRA_BUILDID" ; then
12554     AC_MSG_RESULT([$EXTRA_BUILDID])
12555 else
12556     AC_MSG_RESULT([not set])
12558 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12560 OOO_VENDOR=
12561 AC_MSG_CHECKING([for vendor])
12562 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12563     OOO_VENDOR="$USERNAME"
12565     if test -z "$OOO_VENDOR"; then
12566         OOO_VENDOR="$USER"
12567     fi
12569     if test -z "$OOO_VENDOR"; then
12570         OOO_VENDOR="`id -u -n`"
12571     fi
12573     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12574 else
12575     OOO_VENDOR="$with_vendor"
12576     AC_MSG_RESULT([$OOO_VENDOR])
12578 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12579 AC_SUBST(OOO_VENDOR)
12581 if test "$_os" = "Android" ; then
12582     ANDROID_PACKAGE_NAME=
12583     AC_MSG_CHECKING([for Android package name])
12584     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12585         if test -n "$ENABLE_DEBUG"; then
12586             # Default to the package name that makes ndk-gdb happy.
12587             ANDROID_PACKAGE_NAME="org.libreoffice"
12588         else
12589             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12590         fi
12592         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12593     else
12594         ANDROID_PACKAGE_NAME="$with_android_package_name"
12595         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12596     fi
12597     AC_SUBST(ANDROID_PACKAGE_NAME)
12600 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12601 if test "$with_compat_oowrappers" = "yes"; then
12602     WITH_COMPAT_OOWRAPPERS=TRUE
12603     AC_MSG_RESULT(yes)
12604 else
12605     WITH_COMPAT_OOWRAPPERS=
12606     AC_MSG_RESULT(no)
12608 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12610 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12611 AC_MSG_CHECKING([for install dirname])
12612 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12613     INSTALLDIRNAME="$with_install_dirname"
12615 AC_MSG_RESULT([$INSTALLDIRNAME])
12616 AC_SUBST(INSTALLDIRNAME)
12618 AC_MSG_CHECKING([for prefix])
12619 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12620 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12621 PREFIXDIR="$prefix"
12622 AC_MSG_RESULT([$PREFIXDIR])
12623 AC_SUBST(PREFIXDIR)
12625 LIBDIR=[$(eval echo $(eval echo $libdir))]
12626 AC_SUBST(LIBDIR)
12628 DATADIR=[$(eval echo $(eval echo $datadir))]
12629 AC_SUBST(DATADIR)
12631 MANDIR=[$(eval echo $(eval echo $mandir))]
12632 AC_SUBST(MANDIR)
12634 DOCDIR=[$(eval echo $(eval echo $docdir))]
12635 AC_SUBST(DOCDIR)
12637 BINDIR=[$(eval echo $(eval echo $bindir))]
12638 AC_SUBST(BINDIR)
12640 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12641 AC_SUBST(INSTALLDIR)
12643 TESTINSTALLDIR="${BUILDDIR}/test-install"
12644 AC_SUBST(TESTINSTALLDIR)
12647 # ===================================================================
12648 # OAuth2 id and secrets
12649 # ===================================================================
12651 AC_MSG_CHECKING([for Google Drive client id and secret])
12652 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12653     AC_MSG_RESULT([not set])
12654     GDRIVE_CLIENT_ID="\"\""
12655     GDRIVE_CLIENT_SECRET="\"\""
12656 else
12657     AC_MSG_RESULT([set])
12658     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12659     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12661 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12662 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12664 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12665 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12666     AC_MSG_RESULT([not set])
12667     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12668     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12669 else
12670     AC_MSG_RESULT([set])
12671     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12672     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12674 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12675 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12677 AC_MSG_CHECKING([for OneDrive client id and secret])
12678 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12679     AC_MSG_RESULT([not set])
12680     ONEDRIVE_CLIENT_ID="\"\""
12681     ONEDRIVE_CLIENT_SECRET="\"\""
12682 else
12683     AC_MSG_RESULT([set])
12684     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12685     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12687 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12688 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12691 dnl ===================================================================
12692 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12693 dnl --enable-dependency-tracking configure option
12694 dnl ===================================================================
12695 AC_MSG_CHECKING([whether to enable dependency tracking])
12696 if test "$enable_dependency_tracking" = "no"; then
12697     nodep=TRUE
12698     AC_MSG_RESULT([no])
12699 else
12700     AC_MSG_RESULT([yes])
12702 AC_SUBST(nodep)
12704 dnl ===================================================================
12705 dnl Number of CPUs to use during the build
12706 dnl ===================================================================
12707 AC_MSG_CHECKING([for number of processors to use])
12708 # plain --with-parallelism is just the default
12709 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12710     if test "$with_parallelism" = "no"; then
12711         PARALLELISM=0
12712     else
12713         PARALLELISM=$with_parallelism
12714     fi
12715 else
12716     if test "$enable_icecream" = "yes"; then
12717         PARALLELISM="40"
12718     else
12719         case `uname -s` in
12721         Darwin|FreeBSD|NetBSD|OpenBSD)
12722             PARALLELISM=`sysctl -n hw.ncpu`
12723             ;;
12725         Linux)
12726             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12727         ;;
12728         # what else than above does profit here *and* has /proc?
12729         *)
12730             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12731             ;;
12732         esac
12734         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12735         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12736     fi
12739 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12740     if test -z "$with_parallelism"; then
12741             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12742             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12743             PARALLELISM="1"
12744     else
12745         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."
12746     fi
12749 if test $PARALLELISM -eq 0; then
12750     AC_MSG_RESULT([explicit make -j option needed])
12751 else
12752     AC_MSG_RESULT([$PARALLELISM])
12754 AC_SUBST(PARALLELISM)
12756 IWYU_PATH="$with_iwyu"
12757 AC_SUBST(IWYU_PATH)
12758 if test ! -z "$IWYU_PATH"; then
12759     if test ! -f "$IWYU_PATH"; then
12760         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12761     fi
12765 # Set up ILIB for MSVC build
12767 ILIB1=
12768 if test "$build_os" = "cygwin"; then
12769     ILIB="."
12770     if test -n "$JAVA_HOME"; then
12771         ILIB="$ILIB;$JAVA_HOME/lib"
12772     fi
12773     ILIB1=-link
12774     if test "$BITNESS_OVERRIDE" = 64; then
12775         ILIB="$ILIB;$COMPATH/lib/x64"
12776         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12777         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12778         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12779         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12780             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12781             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12782         fi
12783         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12784         ucrtlibpath_formatted=$formatted_path
12785         ILIB="$ILIB;$ucrtlibpath_formatted"
12786         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12787     else
12788         ILIB="$ILIB;$COMPATH/lib/x86"
12789         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12790         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12791         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12792         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12793             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12794             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12795         fi
12796         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12797         ucrtlibpath_formatted=$formatted_path
12798         ILIB="$ILIB;$ucrtlibpath_formatted"
12799         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12800     fi
12801     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12802         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12803     else
12804         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12805     fi
12807     AC_SUBST(ILIB)
12810 # ===================================================================
12811 # Creating bigger shared library to link against
12812 # ===================================================================
12813 AC_MSG_CHECKING([whether to create huge library])
12814 MERGELIBS=
12816 if test $_os = iOS -o $_os = Android; then
12817     # Never any point in mergelibs for these as we build just static
12818     # libraries anyway...
12819     enable_mergelibs=no
12822 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12823     if test $_os != Linux -a $_os != WINNT; then
12824         add_warning "--enable-mergelibs is not tested for this platform"
12825     fi
12826     MERGELIBS="TRUE"
12827     AC_MSG_RESULT([yes])
12828 else
12829     AC_MSG_RESULT([no])
12831 AC_SUBST([MERGELIBS])
12833 dnl ===================================================================
12834 dnl icerun is a wrapper that stops us spawning tens of processes
12835 dnl locally - for tools that can't be executed on the compile cluster
12836 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12837 dnl ===================================================================
12838 AC_MSG_CHECKING([whether to use icerun wrapper])
12839 ICECREAM_RUN=
12840 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12841     ICECREAM_RUN=icerun
12842     AC_MSG_RESULT([yes])
12843 else
12844     AC_MSG_RESULT([no])
12846 AC_SUBST(ICECREAM_RUN)
12848 dnl ===================================================================
12849 dnl Setup the ICECC_VERSION for the build the same way it was set for
12850 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12851 dnl ===================================================================
12852 x_ICECC_VERSION=[\#]
12853 if test -n "$ICECC_VERSION" ; then
12854     x_ICECC_VERSION=
12856 AC_SUBST(x_ICECC_VERSION)
12857 AC_SUBST(ICECC_VERSION)
12859 dnl ===================================================================
12861 AC_MSG_CHECKING([MPL subset])
12862 MPL_SUBSET=
12864 if test "$enable_mpl_subset" = "yes"; then
12865     warn_report=false
12866     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12867         warn_report=true
12868     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12869         warn_report=true
12870     fi
12871     if test "$warn_report" = "true"; then
12872         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12873     fi
12874     if test "x$enable_postgresql_sdbc" != "xno"; then
12875         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12876     fi
12877     if test "$enable_lotuswordpro" = "yes"; then
12878         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12879     fi
12880     if test "$WITH_WEBDAV" = "neon"; then
12881         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12882     fi
12883     if test -n "$ENABLE_POPPLER"; then
12884         if test "x$SYSTEM_POPPLER" = "x"; then
12885             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12886         fi
12887     fi
12888     # cf. m4/libo_check_extension.m4
12889     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12890         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12891     fi
12892     for theme in $WITH_THEMES; do
12893         case $theme in
12894         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12895             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12896         *) : ;;
12897         esac
12898     done
12900     ENABLE_OPENGL_TRANSITIONS=
12902     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12903         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12904     fi
12906     MPL_SUBSET="TRUE"
12907     AC_DEFINE(MPL_HAVE_SUBSET)
12908     AC_MSG_RESULT([only])
12909 else
12910     AC_MSG_RESULT([no restrictions])
12912 AC_SUBST(MPL_SUBSET)
12914 dnl ===================================================================
12916 AC_MSG_CHECKING([formula logger])
12917 ENABLE_FORMULA_LOGGER=
12919 if test "x$enable_formula_logger" = "xyes"; then
12920     AC_MSG_RESULT([yes])
12921     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12922     ENABLE_FORMULA_LOGGER=TRUE
12923 elif test -n "$ENABLE_DBGUTIL" ; then
12924     AC_MSG_RESULT([yes])
12925     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12926     ENABLE_FORMULA_LOGGER=TRUE
12927 else
12928     AC_MSG_RESULT([no])
12931 AC_SUBST(ENABLE_FORMULA_LOGGER)
12933 dnl ===================================================================
12934 dnl Setting up the environment.
12935 dnl ===================================================================
12936 AC_MSG_NOTICE([setting up the build environment variables...])
12938 AC_SUBST(COMPATH)
12940 if test "$build_os" = "cygwin"; then
12941     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12942         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12943         ATL_INCLUDE="$COMPATH/atlmfc/include"
12944     elif test -d "$COMPATH/atlmfc/lib"; then
12945         ATL_LIB="$COMPATH/atlmfc/lib"
12946         ATL_INCLUDE="$COMPATH/atlmfc/include"
12947     else
12948         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12949         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12950     fi
12951     if test "$BITNESS_OVERRIDE" = 64; then
12952         ATL_LIB="$ATL_LIB/x64"
12953     else
12954         ATL_LIB="$ATL_LIB/x86"
12955     fi
12956     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12957     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12959     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12960     PathFormat "/usr/bin/find.exe"
12961     FIND="$formatted_path"
12962     PathFormat "/usr/bin/sort.exe"
12963     SORT="$formatted_path"
12964     PathFormat "/usr/bin/grep.exe"
12965     WIN_GREP="$formatted_path"
12966     PathFormat "/usr/bin/ls.exe"
12967     WIN_LS="$formatted_path"
12968     PathFormat "/usr/bin/touch.exe"
12969     WIN_TOUCH="$formatted_path"
12970 else
12971     FIND=find
12972     SORT=sort
12975 AC_SUBST(ATL_INCLUDE)
12976 AC_SUBST(ATL_LIB)
12977 AC_SUBST(FIND)
12978 AC_SUBST(SORT)
12979 AC_SUBST(WIN_GREP)
12980 AC_SUBST(WIN_LS)
12981 AC_SUBST(WIN_TOUCH)
12983 AC_SUBST(BUILD_TYPE)
12985 AC_SUBST(SOLARINC)
12987 PathFormat "$PERL"
12988 PERL="$formatted_path"
12989 AC_SUBST(PERL)
12991 if test -n "$TMPDIR"; then
12992     TEMP_DIRECTORY="$TMPDIR"
12993 else
12994     TEMP_DIRECTORY="/tmp"
12996 if test "$build_os" = "cygwin"; then
12997     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12999 AC_SUBST(TEMP_DIRECTORY)
13001 # setup the PATH for the environment
13002 if test -n "$LO_PATH_FOR_BUILD"; then
13003     LO_PATH="$LO_PATH_FOR_BUILD"
13004 else
13005     LO_PATH="$PATH"
13007     case "$host_os" in
13009     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13010         if test "$ENABLE_JAVA" != ""; then
13011             pathmunge "$JAVA_HOME/bin" "after"
13012         fi
13013         ;;
13015     cygwin*)
13016         # Win32 make needs native paths
13017         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13018             LO_PATH=`cygpath -p -m "$PATH"`
13019         fi
13020         if test "$BITNESS_OVERRIDE" = 64; then
13021             # needed for msi packaging
13022             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13023         fi
13024         # .NET 4.6 and higher don't have bin directory
13025         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13026             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13027         fi
13028         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13029         pathmunge "$CSC_PATH" "before"
13030         pathmunge "$MIDL_PATH" "before"
13031         pathmunge "$AL_PATH" "before"
13032         pathmunge "$MSPDB_PATH" "before"
13033         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13034             pathmunge "$CL_PATH" "before"
13035         fi
13036         if test -n "$MSBUILD_PATH" ; then
13037             pathmunge "$MSBUILD_PATH" "before"
13038         fi
13039         if test "$BITNESS_OVERRIDE" = 64; then
13040             pathmunge "$COMPATH/bin/amd64" "before"
13041             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13042         else
13043             pathmunge "$COMPATH/bin" "before"
13044             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13045         fi
13046         if test "$ENABLE_JAVA" != ""; then
13047             if test -d "$JAVA_HOME/jre/bin/client"; then
13048                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13049             fi
13050             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13051                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13052             fi
13053             pathmunge "$JAVA_HOME/bin" "before"
13054         fi
13055         ;;
13057     solaris*)
13058         pathmunge "/usr/css/bin" "before"
13059         if test "$ENABLE_JAVA" != ""; then
13060             pathmunge "$JAVA_HOME/bin" "after"
13061         fi
13062         ;;
13063     esac
13066 AC_SUBST(LO_PATH)
13068 libo_FUZZ_SUMMARY
13070 # Generate a configuration sha256 we can use for deps
13071 if test -f config_host.mk; then
13072     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13074 if test -f config_host_lang.mk; then
13075     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13078 CFLAGS=$my_original_CFLAGS
13079 CXXFLAGS=$my_original_CXXFLAGS
13080 CPPFLAGS=$my_original_CPPFLAGS
13082 AC_CONFIG_FILES([config_host.mk
13083                  config_host_lang.mk
13084                  Makefile
13085                  bin/bffvalidator.sh
13086                  bin/odfvalidator.sh
13087                  bin/officeotron.sh
13088                  instsetoo_native/util/openoffice.lst
13089                  sysui/desktop/macosx/Info.plist])
13090 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13091 AC_CONFIG_HEADERS([config_host/config_clang.h])
13092 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13093 AC_CONFIG_HEADERS([config_host/config_eot.h])
13094 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13095 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13096 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13097 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13098 AC_CONFIG_HEADERS([config_host/config_features.h])
13099 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13100 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13101 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13102 AC_CONFIG_HEADERS([config_host/config_folders.h])
13103 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13104 AC_CONFIG_HEADERS([config_host/config_gio.h])
13105 AC_CONFIG_HEADERS([config_host/config_global.h])
13106 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13107 AC_CONFIG_HEADERS([config_host/config_java.h])
13108 AC_CONFIG_HEADERS([config_host/config_langs.h])
13109 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13110 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13111 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13112 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13113 AC_CONFIG_HEADERS([config_host/config_locales.h])
13114 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13115 AC_CONFIG_HEADERS([config_host/config_oox.h])
13116 AC_CONFIG_HEADERS([config_host/config_options.h])
13117 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13118 AC_CONFIG_HEADERS([config_host/config_skia.h])
13119 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13120 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13121 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13122 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13123 AC_CONFIG_HEADERS([config_host/config_version.h])
13124 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13125 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13126 AC_CONFIG_HEADERS([config_host/config_python.h])
13127 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13128 AC_OUTPUT
13130 if test "$CROSS_COMPILING" = TRUE; then
13131     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13134 # touch the config timestamp file
13135 if test ! -f config_host.mk.stamp; then
13136     echo > config_host.mk.stamp
13137 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13138     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13139 else
13140     echo > config_host.mk.stamp
13143 # touch the config lang timestamp file
13144 if test ! -f config_host_lang.mk.stamp; then
13145     echo > config_host_lang.mk.stamp
13146 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13147     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13148 else
13149     echo > config_host_lang.mk.stamp
13153 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13154         -a "$build_os" = "cygwin"; then
13156 cat << _EOS
13157 ****************************************************************************
13158 WARNING:
13159 Your make version is known to be horribly slow, and hard to debug
13160 problems with. To get a reasonably functional make please do:
13162 to install a pre-compiled binary make for Win32
13164  mkdir -p /opt/lo/bin
13165  cd /opt/lo/bin
13166  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13167  cp make-4.2.1-msvc.exe make
13168  chmod +x make
13170 to install from source:
13171 place yourself in a working directory of you choice.
13173  git clone git://git.savannah.gnu.org/make.git
13175  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13176  set PATH=%PATH%;C:\Cygwin\bin
13177  [or Cygwin64, if that is what you have]
13178  cd path-to-make-repo-you-cloned-above
13179  build_w32.bat --without-guile
13181 should result in a WinRel/gnumake.exe.
13182 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13184 Then re-run autogen.sh
13186 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13187 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13189 _EOS
13190 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13191     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13196 cat << _EOF
13197 ****************************************************************************
13199 To build, run:
13200 $GNUMAKE
13202 To view some help, run:
13203 $GNUMAKE help
13205 _EOF
13207 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13208     cat << _EOF
13209 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13210 _EOF
13212     if test $_os = Darwin; then
13213         echo open instdir/$PRODUCTNAME.app
13214     else
13215         echo instdir/program/soffice
13216     fi
13217     cat << _EOF
13219 If you want to run the smoketest, run:
13220 $GNUMAKE check
13222 _EOF
13225 if test -f warn; then
13226     cat warn
13227     rm warn
13230 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: