add notify for script use
[LibreOffice.git] / configure.ac
blob4fbd1ad6be13ad444952182a4816fbb9fe19b2b2
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([CIB Office],[6.4.0.24b],[],[],[https://www.cib.de/office/])
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 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
569 test_gdb_index=no
570 test_split_debug=no
572 # Default values, as such probably valid just for Linux, set
573 # differently below just for Mac OSX, but at least better than
574 # hardcoding these as we used to do. Much of this is duplicated also
575 # in solenv for old build system and for gbuild, ideally we should
576 # perhaps define stuff like this only here in configure.ac?
578 LINKFLAGSSHL="-shared"
579 PICSWITCH="-fpic"
580 DLLPOST=".so"
582 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
584 INSTROOTBASESUFFIX=
585 INSTROOTCONTENTSUFFIX=
586 SDKDIRNAME=sdk
588 case "$host_os" in
590 solaris*)
591     build_gstreamer_1_0=yes
592     test_freetype=yes
593     _os=SunOS
595     dnl ===========================================================
596     dnl Check whether we're using Solaris 10 - SPARC or Intel.
597     dnl ===========================================================
598     AC_MSG_CHECKING([the Solaris operating system release])
599     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
600     if test "$_os_release" -lt "10"; then
601         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
602     else
603         AC_MSG_RESULT([ok ($_os_release)])
604     fi
606     dnl Check whether we're using a SPARC or i386 processor
607     AC_MSG_CHECKING([the processor type])
608     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
609         AC_MSG_RESULT([ok ($host_cpu)])
610     else
611         AC_MSG_ERROR([only SPARC and i386 processors are supported])
612     fi
613     ;;
615 linux-gnu*|k*bsd*-gnu*)
616     build_gstreamer_1_0=yes
617     test_kf5=yes
618     test_gtk3_kde5=yes
619     test_gdb_index=yes
620     test_split_debug=yes
621     if test "$enable_fuzzers" != yes; then
622         test_freetype=yes
623         test_fontconfig=yes
624     else
625         test_freetype=no
626         test_fontconfig=no
627         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
628     fi
629     _os=Linux
630     ;;
632 gnu)
633     test_randr=no
634     test_xrender=no
635     _os=GNU
636      ;;
638 cygwin*|interix*)
640     # When building on Windows normally with MSVC under Cygwin,
641     # configure thinks that the host platform (the platform the
642     # built code will run on) is Cygwin, even if it obviously is
643     # Windows, which in Autoconf terminology is called
644     # "mingw32". (Which is misleading as MinGW is the name of the
645     # tool-chain, not an operating system.)
647     # Somewhat confusing, yes. But this configure script doesn't
648     # look at $host etc that much, it mostly uses its own $_os
649     # variable, set here in this case statement.
651     test_cups=no
652     test_dbus=no
653     test_randr=no
654     test_xrender=no
655     test_freetype=no
656     test_fontconfig=no
657     _os=WINNT
659     DLLPOST=".dll"
660     LINKFLAGSNOUNDEFS=
661     ;;
663 darwin*) # macOS or iOS
664     test_randr=no
665     test_xrender=no
666     test_freetype=no
667     test_fontconfig=no
668     test_dbus=no
669     if test -n "$LODE_HOME" ; then
670         mac_sanitize_path
671         AC_MSG_NOTICE([sanitized the PATH to $PATH])
672     fi
673     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
674         build_for_ios=YES
675         _os=iOS
676         test_cups=no
677         enable_mpl_subset=yes
678         enable_lotuswordpro=no
679         enable_coinmp=no
680         enable_lpsolve=no
681         enable_postgresql_sdbc=no
682         enable_extension_integration=no
683         enable_report_builder=no
684         with_ppds=no
685         if test "$enable_ios_simulator" = "yes"; then
686             host=x86_64-apple-darwin
687         fi
688     else
689         _os=Darwin
690         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
691         INSTROOTCONTENTSUFFIX=/Contents
692         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
693     fi
694     # See comment above the case "$host_os"
695     LINKFLAGSSHL="-dynamiclib -single_module"
697     # -fPIC is default
698     PICSWITCH=""
700     DLLPOST=".dylib"
702     # -undefined error is the default
703     LINKFLAGSNOUNDEFS=""
706 freebsd*)
707     build_gstreamer_1_0=yes
708     test_kf5=yes
709     test_gtk3_kde5=yes
710     test_freetype=yes
711     AC_MSG_CHECKING([the FreeBSD operating system release])
712     if test -n "$with_os_version"; then
713         OSVERSION="$with_os_version"
714     else
715         OSVERSION=`/sbin/sysctl -n kern.osreldate`
716     fi
717     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
718     AC_MSG_CHECKING([which thread library to use])
719     if test "$OSVERSION" -lt "500016"; then
720         PTHREAD_CFLAGS="-D_THREAD_SAFE"
721         PTHREAD_LIBS="-pthread"
722     elif test "$OSVERSION" -lt "502102"; then
723         PTHREAD_CFLAGS="-D_THREAD_SAFE"
724         PTHREAD_LIBS="-lc_r"
725     else
726         PTHREAD_CFLAGS=""
727         PTHREAD_LIBS="-pthread"
728     fi
729     AC_MSG_RESULT([$PTHREAD_LIBS])
730     _os=FreeBSD
731     ;;
733 *netbsd*)
734     build_gstreamer_1_0=yes
735     test_kf5=yes
736     test_gtk3_kde5=yes
737     test_freetype=yes
738     PTHREAD_LIBS="-pthread -lpthread"
739     _os=NetBSD
740     ;;
742 aix*)
743     test_randr=no
744     test_freetype=yes
745     PTHREAD_LIBS=-pthread
746     _os=AIX
747     ;;
749 openbsd*)
750     test_freetype=yes
751     PTHREAD_CFLAGS="-D_THREAD_SAFE"
752     PTHREAD_LIBS="-pthread"
753     _os=OpenBSD
754     ;;
756 dragonfly*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     enable_lotuswordpro=no
768     enable_mpl_subset=yes
769     enable_coinmp=yes
770     enable_lpsolve=no
771     enable_report_builder=no
772     enable_odk=no
773     enable_postgresql_sdbc=no
774     enable_python=no
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_kf5=no
780     test_qt5=no
781     test_gtk3_kde5=no
782     test_randr=no
783     test_xrender=no
784     _os=Android
786     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
787     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
788     ;;
790 haiku*)
791     test_cups=no
792     test_dbus=no
793     test_randr=no
794     test_xrender=no
795     test_freetype=yes
796     enable_odk=no
797     enable_gstreamer_1_0=no
798     enable_vlc=no
799     enable_coinmp=no
800     enable_pdfium=no
801     enable_sdremote=no
802     enable_postgresql_sdbc=no
803     enable_firebird_sdbc=no
804     _os=Haiku
805     ;;
808     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
809     ;;
810 esac
812 if test "$_os" = "Android" ; then
813     # Verify that the NDK and SDK options are proper
814     if test -z "$with_android_ndk"; then
815         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
816     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
817         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
818     fi
820     if test -z "$ANDROID_SDK_HOME"; then
821         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
822     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
823         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
824     fi
826     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
827     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
828         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
829                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
830                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
831         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
832         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
833         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
834     fi
835     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
836         AC_MSG_WARN([android support repository not found - install with
837                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
838                      to allow the build to download the specified version of the android support libraries])
839         add_warning "android support repository not found - install with"
840         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
841         add_warning "to allow the build to download the specified version of the android support libraries"
842     fi
845 if test "$_os" = "AIX"; then
846     AC_PATH_PROG(GAWK, gawk)
847     if test -z "$GAWK"; then
848         AC_MSG_ERROR([gawk not found in \$PATH])
849     fi
852 AC_SUBST(SDKDIRNAME)
854 AC_SUBST(PTHREAD_CFLAGS)
855 AC_SUBST(PTHREAD_LIBS)
857 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
858 # By default use the ones specified by our build system,
859 # but explicit override is possible.
860 AC_MSG_CHECKING(for explicit AFLAGS)
861 if test -n "$AFLAGS"; then
862     AC_MSG_RESULT([$AFLAGS])
863     x_AFLAGS=
864 else
865     AC_MSG_RESULT(no)
866     x_AFLAGS=[\#]
868 AC_MSG_CHECKING(for explicit CFLAGS)
869 if test -n "$CFLAGS"; then
870     AC_MSG_RESULT([$CFLAGS])
871     x_CFLAGS=
872 else
873     AC_MSG_RESULT(no)
874     x_CFLAGS=[\#]
876 AC_MSG_CHECKING(for explicit CXXFLAGS)
877 if test -n "$CXXFLAGS"; then
878     AC_MSG_RESULT([$CXXFLAGS])
879     x_CXXFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_CXXFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit OBJCFLAGS)
885 if test -n "$OBJCFLAGS"; then
886     AC_MSG_RESULT([$OBJCFLAGS])
887     x_OBJCFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_OBJCFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
893 if test -n "$OBJCXXFLAGS"; then
894     AC_MSG_RESULT([$OBJCXXFLAGS])
895     x_OBJCXXFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_OBJCXXFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit LDFLAGS)
901 if test -n "$LDFLAGS"; then
902     AC_MSG_RESULT([$LDFLAGS])
903     x_LDFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_LDFLAGS=[\#]
908 AC_SUBST(AFLAGS)
909 AC_SUBST(CFLAGS)
910 AC_SUBST(CXXFLAGS)
911 AC_SUBST(OBJCFLAGS)
912 AC_SUBST(OBJCXXFLAGS)
913 AC_SUBST(LDFLAGS)
914 AC_SUBST(x_AFLAGS)
915 AC_SUBST(x_CFLAGS)
916 AC_SUBST(x_CXXFLAGS)
917 AC_SUBST(x_OBJCFLAGS)
918 AC_SUBST(x_OBJCXXFLAGS)
919 AC_SUBST(x_LDFLAGS)
921 dnl These are potentially set for MSVC, in the code checking for UCRT below:
922 my_original_CFLAGS=$CFLAGS
923 my_original_CXXFLAGS=$CXXFLAGS
924 my_original_CPPFLAGS=$CPPFLAGS
926 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
927 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
928 dnl AC_PROG_CC internally.
929 if test "$_os" != "WINNT"; then
930     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
931     save_CFLAGS=$CFLAGS
932     AC_PROG_CC
933     CFLAGS=$save_CFLAGS
934     if test -z "$CC_BASE"; then
935         CC_BASE=`first_arg_basename "$CC"`
936     fi
939 if test "$_os" != "WINNT"; then
940     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942     ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 libo_FUZZ_ARG_ENABLE(crashdump,
1068     AS_HELP_STRING([--disable-crashdump],
1069         [Disable dump.ini and dump-file, when --enable-breakpad])
1072 AC_ARG_ENABLE(fetch-external,
1073     AS_HELP_STRING([--disable-fetch-external],
1074         [Disables fetching external tarballs from web sources.])
1077 AC_ARG_ENABLE(fuzzers,
1078     AS_HELP_STRING([--enable-fuzzers],
1079         [Enables building libfuzzer targets for fuzz testing.])
1082 libo_FUZZ_ARG_ENABLE(pch,
1083     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1084         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1085          Using 'system' will include only external headers, 'base' will add also headers
1086          from base modules, 'normal' will also add all headers except from the module built,
1087          'full' will use all suitable headers even from a module itself.])
1090 libo_FUZZ_ARG_ENABLE(epm,
1091     AS_HELP_STRING([--enable-epm],
1092         [LibreOffice includes self-packaging code, that requires epm, however epm is
1093          useless for large scale package building.])
1096 libo_FUZZ_ARG_ENABLE(odk,
1097     AS_HELP_STRING([--disable-odk],
1098         [LibreOffice includes an ODK, office development kit which some packagers may
1099          wish to build without.])
1102 AC_ARG_ENABLE(mpl-subset,
1103     AS_HELP_STRING([--enable-mpl-subset],
1104         [Don't compile any pieces which are not MPL or more liberally licensed])
1107 libo_FUZZ_ARG_ENABLE(evolution2,
1108     AS_HELP_STRING([--enable-evolution2],
1109         [Allows the built-in evolution 2 addressbook connectivity build to be
1110          enabled.])
1113 AC_ARG_ENABLE(avahi,
1114     AS_HELP_STRING([--enable-avahi],
1115         [Determines whether to use Avahi to advertise Impress to remote controls.])
1118 libo_FUZZ_ARG_ENABLE(werror,
1119     AS_HELP_STRING([--enable-werror],
1120         [Turn warnings to errors. (Has no effect in modules where the treating
1121          of warnings as errors is disabled explicitly.)]),
1124 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1125     AS_HELP_STRING([--enable-assert-always-abort],
1126         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1129 libo_FUZZ_ARG_ENABLE(dbgutil,
1130     AS_HELP_STRING([--enable-dbgutil],
1131         [Provide debugging support from --enable-debug and include additional debugging
1132          utilities such as object counting or more expensive checks.
1133          This is the recommended option for developers.
1134          Note that this makes the build ABI incompatible, it is not possible to mix object
1135          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1137 libo_FUZZ_ARG_ENABLE(debug,
1138     AS_HELP_STRING([--enable-debug],
1139         [Include debugging information, disable compiler optimization and inlining plus
1140          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1142 libo_FUZZ_ARG_ENABLE(split-debug,
1143     AS_HELP_STRING([--disable-split-debug],
1144         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1145          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1147 libo_FUZZ_ARG_ENABLE(gdb-index,
1148     AS_HELP_STRING([--disable-gdb-index],
1149         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1150          The feature requires the gold or lld linker.]))
1152 libo_FUZZ_ARG_ENABLE(sal-log,
1153     AS_HELP_STRING([--enable-sal-log],
1154         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1156 libo_FUZZ_ARG_ENABLE(symbols,
1157     AS_HELP_STRING([--enable-symbols],
1158         [Generate debug information.
1159          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1160          otherwise. It is possible to explicitly specify gbuild build targets
1161          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1162          everything in the directory; there is no ordering, more specific overrides
1163          more general, and disabling takes precedence).
1164          Example: --enable-symbols="all -sw/ -Library_sc".]))
1166 libo_FUZZ_ARG_ENABLE(optimized,
1167     AS_HELP_STRING([--disable-optimized],
1168         [Whether to compile with optimization flags.
1169          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1170          otherwise.]))
1172 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1173     AS_HELP_STRING([--disable-runtime-optimizations],
1174         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1175          JVM JIT) that are known to interact badly with certain dynamic analysis
1176          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1177          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1178          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1180 AC_ARG_WITH(valgrind,
1181     AS_HELP_STRING([--with-valgrind],
1182         [Make availability of Valgrind headers a hard requirement.]))
1184 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1185     AS_HELP_STRING([--enable-compiler-plugins],
1186         [Enable compiler plugins that will perform additional checks during
1187          building. Enabled automatically by --enable-dbgutil.
1188          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1189 COMPILER_PLUGINS_DEBUG=
1190 if test "$enable_compiler_plugins" = debug; then
1191     enable_compiler_plugins=yes
1192     COMPILER_PLUGINS_DEBUG=TRUE
1195 libo_FUZZ_ARG_ENABLE(ooenv,
1196     AS_HELP_STRING([--disable-ooenv],
1197         [Disable ooenv for the instdir installation.]))
1199 libo_FUZZ_ARG_ENABLE(libnumbertext,
1200     AS_HELP_STRING([--disable-libnumbertext],
1201         [Disable use of numbertext external library.]))
1203 AC_ARG_ENABLE(lto,
1204     AS_HELP_STRING([--enable-lto],
1205         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1206          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1207          linker. For MSVC, this option is broken at the moment. This is experimental work
1208          in progress that shouldn't be used unless you are working on it.)]))
1210 AC_ARG_ENABLE(python,
1211     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1212         [Enables or disables Python support at run-time.
1213          Also specifies what Python to use. 'auto' is the default.
1214          'fully-internal' even forces the internal version for uses of Python
1215          during the build.]))
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(introspection,
1223     AS_HELP_STRING([--enable-introspection],
1224         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1225          Linux distributions.)]))
1227 AC_ARG_ENABLE(split-app-modules,
1228     AS_HELP_STRING([--enable-split-app-modules],
1229         [Split file lists for app modules, e.g. base, calc.
1230          Has effect only with make distro-pack-install]),
1233 AC_ARG_ENABLE(split-opt-features,
1234     AS_HELP_STRING([--enable-split-opt-features],
1235         [Split file lists for some optional features, e.g. pyuno, testtool.
1236          Has effect only with make distro-pack-install]),
1239 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1240     AS_HELP_STRING([--disable-cairo-canvas],
1241         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1244 libo_FUZZ_ARG_ENABLE(dbus,
1245     AS_HELP_STRING([--disable-dbus],
1246         [Determines whether to enable features that depend on dbus.
1247          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1248 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote,
1251     AS_HELP_STRING([--disable-sdremote],
1252         [Determines whether to enable Impress remote control (i.e. the server component).]),
1253 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1255 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1256     AS_HELP_STRING([--disable-sdremote-bluetooth],
1257         [Determines whether to build sdremote with bluetooth support.
1258          Requires dbus on Linux.]))
1260 libo_FUZZ_ARG_ENABLE(gio,
1261     AS_HELP_STRING([--disable-gio],
1262         [Determines whether to use the GIO support.]),
1263 ,test "${enable_gio+set}" = set || enable_gio=yes)
1265 AC_ARG_ENABLE(qt5,
1266     AS_HELP_STRING([--enable-qt5],
1267         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1268          available.]),
1271 AC_ARG_ENABLE(kf5,
1272     AS_HELP_STRING([--enable-kf5],
1273         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1274          KF5 are available.]),
1277 AC_ARG_ENABLE(kde5,
1278     AS_HELP_STRING([--enable-kde5],
1279         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1282 AC_ARG_ENABLE(gtk3_kde5,
1283     AS_HELP_STRING([--enable-gtk3-kde5],
1284         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1285          platforms where Gtk3, Qt5 and Plasma is available.]),
1288 AC_ARG_ENABLE(gui,
1289     AS_HELP_STRING([--disable-gui],
1290         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1291 ,enable_gui=yes)
1293 libo_FUZZ_ARG_ENABLE(randr,
1294     AS_HELP_STRING([--disable-randr],
1295         [Disable RandR support in the vcl project.]),
1296 ,test "${enable_randr+set}" = set || enable_randr=yes)
1298 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1299     AS_HELP_STRING([--disable-gstreamer-1-0],
1300         [Disable building with the gstreamer 1.0 avmedia backend.]),
1301 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1375          Additionally ccache's depend mode is enabled if possible,
1376          use --enable-ccache=nodepend to enable ccache without depend mode.
1380 AC_ARG_ENABLE(64-bit,
1381     AS_HELP_STRING([--enable-64-bit],
1382         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1383          At the moment meaningful only for Windows.]), ,)
1385 libo_FUZZ_ARG_ENABLE(online-update,
1386     AS_HELP_STRING([--enable-online-update],
1387         [Enable the online update service that will check for new versions of
1388          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1389          If the value is "mar", the experimental Mozilla-like update will be
1390          enabled instead of the traditional update mechanism.]),
1393 AC_ARG_WITH(update-config,
1394     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1395                    [Path to the update config ini file]))
1397 libo_FUZZ_ARG_ENABLE(extension-update,
1398     AS_HELP_STRING([--disable-extension-update],
1399         [Disable possibility to update installed extensions.]),
1402 libo_FUZZ_ARG_ENABLE(release-build,
1403     AS_HELP_STRING([--enable-release-build],
1404         [Enable release build. Note that the "release build" choice is orthogonal to
1405          whether symbols are present, debug info is generated, or optimization
1406          is done.
1407          See http://wiki.documentfoundation.org/Development/DevBuild]),
1410 AC_ARG_ENABLE(windows-build-signing,
1411     AS_HELP_STRING([--enable-windows-build-signing],
1412         [Enable signing of windows binaries (*.exe, *.dll)]),
1415 AC_ARG_ENABLE(silent-msi,
1416     AS_HELP_STRING([--enable-silent-msi],
1417         [Enable MSI with LIMITUI=1 (silent install).]),
1420 AC_ARG_ENABLE(macosx-code-signing,
1421     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1422         [Sign executables, dylibs, frameworks and the app bundle. If you
1423          don't provide an identity the first suitable certificate
1424          in your keychain is used.]),
1427 AC_ARG_ENABLE(macosx-package-signing,
1428     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1429         [Create a .pkg suitable for uploading to the Mac App Store and sign
1430          it. If you don't provide an identity the first suitable certificate
1431          in your keychain is used.]),
1434 AC_ARG_ENABLE(macosx-sandbox,
1435     AS_HELP_STRING([--enable-macosx-sandbox],
1436         [Make the app bundle run in a sandbox. Requires code signing.
1437          Is required by apps distributed in the Mac App Store, and implies
1438          adherence to App Store rules.]),
1441 AC_ARG_WITH(macosx-bundle-identifier,
1442     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1443         [Define the macOS bundle identifier. Default is the somewhat weird
1444          org.libreoffice.script ("script", huh?).]),
1445 ,with_macosx_bundle_identifier=org.libreoffice.script)
1447 AC_ARG_WITH(product-name,
1448     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1449         [Define the product name. Default is AC_PACKAGE_NAME.]),
1450 ,with_product_name=$PRODUCTNAME)
1452 AC_ARG_WITH(package-version,
1453     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1454         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1457 libo_FUZZ_ARG_ENABLE(readonly-installset,
1458     AS_HELP_STRING([--enable-readonly-installset],
1459         [Prevents any attempts by LibreOffice to write into its installation. That means
1460          at least that no "system-wide" extensions can be added. Partly experimental work in
1461          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1464 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1465     AS_HELP_STRING([--disable-postgresql-sdbc],
1466         [Disable the build of the PostgreSQL-SDBC driver.])
1469 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1470     AS_HELP_STRING([--disable-lotuswordpro],
1471         [Disable the build of the Lotus Word Pro filter.]),
1472 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1474 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1475     AS_HELP_STRING([--disable-firebird-sdbc],
1476         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1477 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1479 AC_ARG_ENABLE(bogus-pkg-config,
1480     AS_HELP_STRING([--enable-bogus-pkg-config],
1481         [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.]),
1484 AC_ARG_ENABLE(openssl,
1485     AS_HELP_STRING([--disable-openssl],
1486         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1487          components will either use GNUTLS or NSS. Work in progress,
1488          use only if you are hacking on it.]),
1489 ,enable_openssl=yes)
1491 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1492     AS_HELP_STRING([--enable-cipher-openssl-backend],
1493         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1494          Requires --enable-openssl.]))
1496 AC_ARG_ENABLE(library-bin-tar,
1497     AS_HELP_STRING([--enable-library-bin-tar],
1498         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1499         Some libraries can save their build result in a tarball
1500         stored in TARFILE_LOCATION. That binary tarball is
1501         uniquely identified by the source tarball,
1502         the content of the config_host.mk file and the content
1503         of the top-level directory in core for that library
1504         If this option is enabled, then if such a tarfile exist, it will be untarred
1505         instead of the source tarfile, and the build step will be skipped for that
1506         library.
1507         If a proper tarfile does not exist, then the normal source-based
1508         build is done for that library and a proper binary tarfile is created
1509         for the next time.]),
1512 AC_ARG_ENABLE(dconf,
1513     AS_HELP_STRING([--disable-dconf],
1514         [Disable the dconf configuration backend (enabled by default where
1515          available).]))
1517 libo_FUZZ_ARG_ENABLE(formula-logger,
1518     AS_HELP_STRING(
1519         [--enable-formula-logger],
1520         [Enable formula logger for logging formula calculation flow in Calc.]
1521     )
1524 AC_ARG_ENABLE(ldap,
1525     AS_HELP_STRING([--disable-ldap],
1526         [Disable LDAP support.]),
1527 ,enable_ldap=yes)
1529 dnl ===================================================================
1530 dnl Optional Packages (--with/without-)
1531 dnl ===================================================================
1533 AC_ARG_WITH(gcc-home,
1534     AS_HELP_STRING([--with-gcc-home],
1535         [Specify the location of gcc/g++ manually. This can be used in conjunction
1536          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1537          non-default path.]),
1540 AC_ARG_WITH(gnu-patch,
1541     AS_HELP_STRING([--with-gnu-patch],
1542         [Specify location of GNU patch on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(build-platform-configure-options,
1546     AS_HELP_STRING([--with-build-platform-configure-options],
1547         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1550 AC_ARG_WITH(gnu-cp,
1551     AS_HELP_STRING([--with-gnu-cp],
1552         [Specify location of GNU cp on Solaris or FreeBSD.]),
1555 AC_ARG_WITH(external-tar,
1556     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1557         [Specify an absolute path of where to find (and store) tarfiles.]),
1558     TARFILE_LOCATION=$withval ,
1561 AC_ARG_WITH(referenced-git,
1562     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1563         [Specify another checkout directory to reference. This makes use of
1564                  git submodule update --reference, and saves a lot of diskspace
1565                  when having multiple trees side-by-side.]),
1566     GIT_REFERENCE_SRC=$withval ,
1569 AC_ARG_WITH(linked-git,
1570     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1571         [Specify a directory where the repositories of submodules are located.
1572          This uses a method similar to git-new-workdir to get submodules.]),
1573     GIT_LINK_SRC=$withval ,
1576 AC_ARG_WITH(galleries,
1577     AS_HELP_STRING([--with-galleries],
1578         [Specify how galleries should be built. It is possible either to
1579          build these internally from source ("build"),
1580          or to disable them ("no")]),
1583 AC_ARG_WITH(theme,
1584     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1585         [Choose which themes to include. By default those themes with an '*' are included.
1586          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *cib, *colibre, *colibre_svg, *elementary,
1587          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1590 libo_FUZZ_ARG_WITH(helppack-integration,
1591     AS_HELP_STRING([--without-helppack-integration],
1592         [It will not integrate the helppacks to the installer
1593          of the product. Please use this switch to use the online help
1594          or separate help packages.]),
1597 libo_FUZZ_ARG_WITH(fonts,
1598     AS_HELP_STRING([--without-fonts],
1599         [LibreOffice includes some third-party fonts to provide a reliable basis for
1600          help content, templates, samples, etc. When these fonts are already
1601          known to be available on the system then you should use this option.]),
1604 AC_ARG_WITH(epm,
1605     AS_HELP_STRING([--with-epm],
1606         [Decides which epm to use. Default is to use the one from the system if
1607          one is built. When either this is not there or you say =internal epm
1608          will be built.]),
1611 AC_ARG_WITH(package-format,
1612     AS_HELP_STRING([--with-package-format],
1613         [Specify package format(s) for LibreOffice installation sets. The
1614          implicit --without-package-format leads to no installation sets being
1615          generated. Possible values: aix, archive, bsd, deb, dmg,
1616          installed, msi, pkg, and rpm.
1617          Example: --with-package-format='deb rpm']),
1620 AC_ARG_WITH(tls,
1621     AS_HELP_STRING([--with-tls],
1622         [Decides which TLS/SSL and cryptographic implementations to use for
1623          LibreOffice's code. Notice that this doesn't apply for depending
1624          libraries like "neon", for example. Default is to use OpenSSL
1625          although NSS is also possible. Notice that selecting NSS restricts
1626          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1627          restrict by now the usage of NSS in LO's code. Possible values:
1628          openssl, nss. Example: --with-tls="nss"]),
1631 AC_ARG_WITH(system-libs,
1632     AS_HELP_STRING([--with-system-libs],
1633         [Use libraries already on system -- enables all --with-system-* flags.]),
1636 AC_ARG_WITH(system-bzip2,
1637     AS_HELP_STRING([--with-system-bzip2],
1638         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1639     [with_system_bzip2="$with_system_libs"])
1641 AC_ARG_WITH(system-headers,
1642     AS_HELP_STRING([--with-system-headers],
1643         [Use headers already on system -- enables all --with-system-* flags for
1644          external packages whose headers are the only entities used i.e.
1645          boost/odbc/sane-header(s).]),,
1646     [with_system_headers="$with_system_libs"])
1648 AC_ARG_WITH(system-jars,
1649     AS_HELP_STRING([--without-system-jars],
1650         [When building with --with-system-libs, also the needed jars are expected
1651          on the system. Use this to disable that]),,
1652     [with_system_jars="$with_system_libs"])
1654 AC_ARG_WITH(system-cairo,
1655     AS_HELP_STRING([--with-system-cairo],
1656         [Use cairo libraries already on system.  Happens automatically for
1657          (implicit) --enable-gtk3.]))
1659 AC_ARG_WITH(system-epoxy,
1660     AS_HELP_STRING([--with-system-epoxy],
1661         [Use epoxy libraries already on system.  Happens automatically for
1662          (implicit) --enable-gtk3.]),,
1663        [with_system_epoxy="$with_system_libs"])
1665 AC_ARG_WITH(myspell-dicts,
1666     AS_HELP_STRING([--with-myspell-dicts],
1667         [Adds myspell dictionaries to the LibreOffice installation set]),
1670 AC_ARG_WITH(system-dicts,
1671     AS_HELP_STRING([--without-system-dicts],
1672         [Do not use dictionaries from system paths.]),
1675 AC_ARG_WITH(external-dict-dir,
1676     AS_HELP_STRING([--with-external-dict-dir],
1677         [Specify external dictionary dir.]),
1680 AC_ARG_WITH(external-hyph-dir,
1681     AS_HELP_STRING([--with-external-hyph-dir],
1682         [Specify external hyphenation pattern dir.]),
1685 AC_ARG_WITH(external-thes-dir,
1686     AS_HELP_STRING([--with-external-thes-dir],
1687         [Specify external thesaurus dir.]),
1690 AC_ARG_WITH(system-zlib,
1691     AS_HELP_STRING([--with-system-zlib],
1692         [Use zlib already on system.]),,
1693     [with_system_zlib=auto])
1695 AC_ARG_WITH(system-jpeg,
1696     AS_HELP_STRING([--with-system-jpeg],
1697         [Use jpeg already on system.]),,
1698     [with_system_jpeg="$with_system_libs"])
1700 AC_ARG_WITH(system-clucene,
1701     AS_HELP_STRING([--with-system-clucene],
1702         [Use clucene already on system.]),,
1703     [with_system_clucene="$with_system_libs"])
1705 AC_ARG_WITH(system-expat,
1706     AS_HELP_STRING([--with-system-expat],
1707         [Use expat already on system.]),,
1708     [with_system_expat="$with_system_libs"])
1710 AC_ARG_WITH(system-libxml,
1711     AS_HELP_STRING([--with-system-libxml],
1712         [Use libxml/libxslt already on system.]),,
1713     [with_system_libxml=auto])
1715 AC_ARG_WITH(system-icu,
1716     AS_HELP_STRING([--with-system-icu],
1717         [Use icu already on system.]),,
1718     [with_system_icu="$with_system_libs"])
1720 AC_ARG_WITH(system-ucpp,
1721     AS_HELP_STRING([--with-system-ucpp],
1722         [Use ucpp already on system.]),,
1723     [])
1725 AC_ARG_WITH(system-openldap,
1726     AS_HELP_STRING([--with-system-openldap],
1727         [Use the OpenLDAP LDAP SDK already on system.]),,
1728     [with_system_openldap="$with_system_libs"])
1730 libo_FUZZ_ARG_ENABLE(poppler,
1731     AS_HELP_STRING([--disable-poppler],
1732         [Disable building Poppler.])
1735 AC_ARG_WITH(system-poppler,
1736     AS_HELP_STRING([--with-system-poppler],
1737         [Use system poppler (only needed for PDF import).]),,
1738     [with_system_poppler="$with_system_libs"])
1740 AC_ARG_WITH(system-gpgmepp,
1741     AS_HELP_STRING([--with-system-gpgmepp],
1742         [Use gpgmepp already on system]),,
1743     [with_system_gpgmepp="$with_system_libs"])
1745 AC_ARG_WITH(system-mariadb,
1746     AS_HELP_STRING([--with-system-mariadb],
1747         [Use MariaDB/MySQL libraries already on system.]),,
1748     [with_system_mariadb="$with_system_libs"])
1750 AC_ARG_ENABLE(bundle-mariadb,
1751     AS_HELP_STRING([--enable-bundle-mariadb],
1752         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1755 AC_ARG_WITH(system-postgresql,
1756     AS_HELP_STRING([--with-system-postgresql],
1757         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1758          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1759     [with_system_postgresql="$with_system_libs"])
1761 AC_ARG_WITH(libpq-path,
1762     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1763         [Use this PostgreSQL C interface (libpq) installation for building
1764          the PostgreSQL-SDBC extension.]),
1767 AC_ARG_WITH(system-firebird,
1768     AS_HELP_STRING([--with-system-firebird],
1769         [Use Firebird libraries already on system, for building the Firebird-SDBC
1770          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1771     [with_system_firebird="$with_system_libs"])
1773 AC_ARG_WITH(system-libtommath,
1774             AS_HELP_STRING([--with-system-libtommath],
1775                            [Use libtommath already on system]),,
1776             [with_system_libtommath="$with_system_libs"])
1778 AC_ARG_WITH(system-hsqldb,
1779     AS_HELP_STRING([--with-system-hsqldb],
1780         [Use hsqldb already on system.]))
1782 AC_ARG_WITH(hsqldb-jar,
1783     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1784         [Specify path to jarfile manually.]),
1785     HSQLDB_JAR=$withval)
1787 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1788     AS_HELP_STRING([--disable-scripting-beanshell],
1789         [Disable support for scripts in BeanShell.]),
1793 AC_ARG_WITH(system-beanshell,
1794     AS_HELP_STRING([--with-system-beanshell],
1795         [Use beanshell already on system.]),,
1796     [with_system_beanshell="$with_system_jars"])
1798 AC_ARG_WITH(beanshell-jar,
1799     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1800         [Specify path to jarfile manually.]),
1801     BSH_JAR=$withval)
1803 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1804     AS_HELP_STRING([--disable-scripting-javascript],
1805         [Disable support for scripts in JavaScript.]),
1809 AC_ARG_WITH(system-rhino,
1810     AS_HELP_STRING([--with-system-rhino],
1811         [Use rhino already on system.]),,)
1812 #    [with_system_rhino="$with_system_jars"])
1813 # Above is not used as we have different debug interface
1814 # patched into internal rhino. This code needs to be fixed
1815 # before we can enable it by default.
1817 AC_ARG_WITH(rhino-jar,
1818     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1819         [Specify path to jarfile manually.]),
1820     RHINO_JAR=$withval)
1822 AC_ARG_WITH(system-jfreereport,
1823     AS_HELP_STRING([--with-system-jfreereport],
1824         [Use JFreeReport already on system.]),,
1825     [with_system_jfreereport="$with_system_jars"])
1827 AC_ARG_WITH(sac-jar,
1828     AS_HELP_STRING([--with-sac-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     SAC_JAR=$withval)
1832 AC_ARG_WITH(libxml-jar,
1833     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1834         [Specify path to jarfile manually.]),
1835     LIBXML_JAR=$withval)
1837 AC_ARG_WITH(flute-jar,
1838     AS_HELP_STRING([--with-flute-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     FLUTE_JAR=$withval)
1842 AC_ARG_WITH(jfreereport-jar,
1843     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     JFREEREPORT_JAR=$withval)
1847 AC_ARG_WITH(liblayout-jar,
1848     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     LIBLAYOUT_JAR=$withval)
1852 AC_ARG_WITH(libloader-jar,
1853     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     LIBLOADER_JAR=$withval)
1857 AC_ARG_WITH(libformula-jar,
1858     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBFORMULA_JAR=$withval)
1862 AC_ARG_WITH(librepository-jar,
1863     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBREPOSITORY_JAR=$withval)
1867 AC_ARG_WITH(libfonts-jar,
1868     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFONTS_JAR=$withval)
1872 AC_ARG_WITH(libserializer-jar,
1873     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBSERIALIZER_JAR=$withval)
1877 AC_ARG_WITH(libbase-jar,
1878     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBBASE_JAR=$withval)
1882 AC_ARG_WITH(system-odbc,
1883     AS_HELP_STRING([--with-system-odbc],
1884         [Use the odbc headers already on system.]),,
1885     [with_system_odbc="auto"])
1887 AC_ARG_WITH(system-sane,
1888     AS_HELP_STRING([--with-system-sane],
1889         [Use sane.h already on system.]),,
1890     [with_system_sane="$with_system_headers"])
1892 AC_ARG_WITH(system-bluez,
1893     AS_HELP_STRING([--with-system-bluez],
1894         [Use bluetooth.h already on system.]),,
1895     [with_system_bluez="$with_system_headers"])
1897 AC_ARG_WITH(system-curl,
1898     AS_HELP_STRING([--with-system-curl],
1899         [Use curl already on system.]),,
1900     [with_system_curl=auto])
1902 AC_ARG_WITH(system-boost,
1903     AS_HELP_STRING([--with-system-boost],
1904         [Use boost already on system.]),,
1905     [with_system_boost="$with_system_headers"])
1907 AC_ARG_WITH(system-glm,
1908     AS_HELP_STRING([--with-system-glm],
1909         [Use glm already on system.]),,
1910     [with_system_glm="$with_system_headers"])
1912 AC_ARG_WITH(system-hunspell,
1913     AS_HELP_STRING([--with-system-hunspell],
1914         [Use libhunspell already on system.]),,
1915     [with_system_hunspell="$with_system_libs"])
1917 libo_FUZZ_ARG_ENABLE(qrcodegen,
1918     AS_HELP_STRING([--disable-qrcodegen],
1919         [Disable use of qrcodegen external library.]))
1921 AC_ARG_WITH(system-qrcodegen,
1922     AS_HELP_STRING([--with-system-qrcodegen],
1923         [Use libqrcodegen already on system.]),,
1924     [with_system_qrcodegen="$with_system_libs"])
1926 AC_ARG_WITH(system-mythes,
1927     AS_HELP_STRING([--with-system-mythes],
1928         [Use mythes already on system.]),,
1929     [with_system_mythes="$with_system_libs"])
1931 AC_ARG_WITH(system-altlinuxhyph,
1932     AS_HELP_STRING([--with-system-altlinuxhyph],
1933         [Use ALTLinuxhyph already on system.]),,
1934     [with_system_altlinuxhyph="$with_system_libs"])
1936 AC_ARG_WITH(system-lpsolve,
1937     AS_HELP_STRING([--with-system-lpsolve],
1938         [Use lpsolve already on system.]),,
1939     [with_system_lpsolve="$with_system_libs"])
1941 AC_ARG_WITH(system-coinmp,
1942     AS_HELP_STRING([--with-system-coinmp],
1943         [Use CoinMP already on system.]),,
1944     [with_system_coinmp="$with_system_libs"])
1946 AC_ARG_WITH(system-liblangtag,
1947     AS_HELP_STRING([--with-system-liblangtag],
1948         [Use liblangtag library already on system.]),,
1949     [with_system_liblangtag="$with_system_libs"])
1951 AC_ARG_WITH(webdav,
1952     AS_HELP_STRING([--with-webdav],
1953         [Specify which library to use for webdav implementation.
1954          Possible values: "neon", "serf", "curl", "no". The default value is "neon".
1955          Example: --with-webdav="serf"]),
1956     WITH_WEBDAV=$withval,
1957     WITH_WEBDAV="neon")
1959 AC_ARG_WITH(linker-hash-style,
1960     AS_HELP_STRING([--with-linker-hash-style],
1961         [Use linker with --hash-style=<style> when linking shared objects.
1962          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1963          if supported on the build system, and "sysv" otherwise.]))
1965 AC_ARG_WITH(jdk-home,
1966     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1967         [If you have installed JDK 8 or later on your system please supply the
1968          path here. Note that this is not the location of the java command but the
1969          location of the entire distribution.]),
1972 AC_ARG_WITH(help,
1973     AS_HELP_STRING([--with-help],
1974         [Enable the build of help. There is a special parameter "common" that
1975          can be used to bundle only the common part, .e.g help-specific icons.
1976          This is useful when you build the helpcontent separately.])
1977     [
1978                           Usage:     --with-help    build the old local help
1979                                  --without-help     no local help (default)
1980                                  --with-help=html   build the new HTML local help
1981                                  --with-help=online build the new HTML online help
1982     ],
1985 AC_ARG_WITH(omindex,
1986    AS_HELP_STRING([--with-omindex],
1987         [Enable the support of xapian-omega index for online help.])
1988    [
1989                          Usage: --with-omindex=server prepare the pages for omindex
1990                                 but let xapian-omega be built in server.
1991                                 --with-omindex=noxap do not prepare online pages
1992                                 for xapian-omega
1993   ],
1996 libo_FUZZ_ARG_WITH(java,
1997     AS_HELP_STRING([--with-java=<java command>],
1998         [Specify the name of the Java interpreter command. Typically "java"
1999          which is the default.
2001          To build without support for Java components, applets, accessibility
2002          or the XML filters written in Java, use --without-java or --with-java=no.]),
2003     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2004     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2007 AC_ARG_WITH(jvm-path,
2008     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2009         [Use a specific JVM search path at runtime.
2010          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2013 AC_ARG_WITH(ant-home,
2014     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2015         [If you have installed Apache Ant on your system, please supply the path here.
2016          Note that this is not the location of the Ant binary but the location
2017          of the entire distribution.]),
2020 AC_ARG_WITH(symbol-config,
2021     AS_HELP_STRING([--with-symbol-config],
2022         [Configuration for the crashreport symbol upload]),
2023         [],
2024         [with_symbol_config=no])
2026 AC_ARG_WITH(export-validation,
2027     AS_HELP_STRING([--without-export-validation],
2028         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2029 ,with_export_validation=auto)
2031 AC_ARG_WITH(bffvalidator,
2032     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2033         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2034          Requires installed Microsoft Office Binary File Format Validator.
2035          Note: export-validation (--with-export-validation) is required to be turned on.
2036          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2037 ,with_bffvalidator=no)
2039 libo_FUZZ_ARG_WITH(junit,
2040     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2041         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2042          --without-junit disables those tests. Not relevant in the --without-java case.]),
2043 ,with_junit=yes)
2045 AC_ARG_WITH(hamcrest,
2046     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2047         [Specifies the hamcrest jar file to use for JUnit-based tests.
2048          --without-junit disables those tests. Not relevant in the --without-java case.]),
2049 ,with_hamcrest=yes)
2051 AC_ARG_WITH(perl-home,
2052     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2053         [If you have installed Perl 5 Distribution, on your system, please
2054          supply the path here. Note that this is not the location of the Perl
2055          binary but the location of the entire distribution.]),
2058 libo_FUZZ_ARG_WITH(doxygen,
2059     AS_HELP_STRING(
2060         [--with-doxygen=<absolute path to doxygen executable>],
2061         [Specifies the doxygen executable to use when generating ODK C/C++
2062          documentation. --without-doxygen disables generation of ODK C/C++
2063          documentation. Not relevant in the --disable-odk case.]),
2064 ,with_doxygen=yes)
2066 AC_ARG_WITH(visual-studio,
2067     AS_HELP_STRING([--with-visual-studio=<2017>],
2068         [Specify which Visual Studio version to use in case several are
2069          installed. Currently only 2017 is supported.]),
2072 AC_ARG_WITH(windows-sdk,
2073     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2074         [Specify which Windows SDK, or "Windows Kit", version to use
2075          in case the one that came with the selected Visual Studio
2076          is not what you want for some reason. Note that not all compiler/SDK
2077          combinations are supported. The intent is that this option should not
2078          be needed.]),
2081 AC_ARG_WITH(lang,
2082     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2083         [Use this option to build LibreOffice with additional UI language support.
2084          English (US) is always included by default.
2085          Separate multiple languages with space.
2086          For all languages, use --with-lang=ALL.]),
2089 AC_ARG_WITH(locales,
2090     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2091         [Use this option to limit the locale information built in.
2092          Separate multiple locales with space.
2093          Very experimental and might well break stuff.
2094          Just a desperate measure to shrink code and data size.
2095          By default all the locales available is included.
2096          This option is completely unrelated to --with-lang.])
2097     [
2098                           Affects also our character encoding conversion
2099                           tables for encodings mainly targeted for a
2100                           particular locale, like EUC-CN and EUC-TW for
2101                           zh, ISO-2022-JP for ja.
2103                           Affects also our add-on break iterator data for
2104                           some languages.
2106                           For the default, all locales, don't use this switch at all.
2107                           Specifying just the language part of a locale means all matching
2108                           locales will be included.
2109     ],
2112 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2113 libo_FUZZ_ARG_WITH(krb5,
2114     AS_HELP_STRING([--with-krb5],
2115         [Enable MIT Kerberos 5 support in modules that support it.
2116          By default automatically enabled on platforms
2117          where a good system Kerberos 5 is available.]),
2120 libo_FUZZ_ARG_WITH(gssapi,
2121     AS_HELP_STRING([--with-gssapi],
2122         [Enable GSSAPI support in modules that support it.
2123          By default automatically enabled on platforms
2124          where a good system GSSAPI is available.]),
2127 AC_ARG_WITH(iwyu,
2128     AS_HELP_STRING([--with-iwyu],
2129         [Use given IWYU binary path to check unneeded includes instead of building.
2130          Use only if you are hacking on it.]),
2133 libo_FUZZ_ARG_WITH(lxml,
2134     AS_HELP_STRING([--without-lxml],
2135         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2136          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2137          report widget classes and ids.]),
2140 libo_FUZZ_ARG_WITH(latest-c++,
2141     AS_HELP_STRING([--with-latest-c++],
2142         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2143          published standard.]),,
2144         [with_latest_c__=no])
2146 dnl ===================================================================
2147 dnl Branding
2148 dnl ===================================================================
2150 AC_ARG_WITH(branding,
2151     AS_HELP_STRING([--with-branding=/path/to/images],
2152         [Use given path to retrieve branding images set.])
2153     [
2154                           Search for intro.png about.svg and flat_logo.svg.
2155                           If any is missing, default ones will be used instead.
2157                           Search also progress.conf for progress
2158                           settings on intro screen :
2160                           PROGRESSBARCOLOR="255,255,255" Set color of
2161                           progress bar. Comma separated RGB decimal values.
2162                           PROGRESSSIZE="407,6" Set size of progress bar.
2163                           Comma separated decimal values (width, height).
2164                           PROGRESSPOSITION="61,317" Set position of progress
2165                           bar from left,top. Comma separated decimal values.
2166                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2167                           bar frame. Comma separated RGB decimal values.
2168                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2169                           bar text. Comma separated RGB decimal values.
2170                           PROGRESSTEXTBASELINE="287" Set vertical position of
2171                           progress bar text from top. Decimal value.
2173                           Default values will be used if not found.
2174     ],
2178 AC_ARG_WITH(extra-buildid,
2179     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2180         [Show addition build identification in about dialog.]),
2184 AC_ARG_WITH(vendor,
2185     AS_HELP_STRING([--with-vendor="John the Builder"],
2186         [Set vendor of the build.]),
2189 AC_ARG_WITH(android-package-name,
2190     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2191         [Set Android package name of the build.]),
2194 AC_ARG_WITH(compat-oowrappers,
2195     AS_HELP_STRING([--with-compat-oowrappers],
2196         [Install oo* wrappers in parallel with
2197          lo* ones to keep backward compatibility.
2198          Has effect only with make distro-pack-install]),
2201 AC_ARG_WITH(os-version,
2202     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2203         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2206 AC_ARG_WITH(mingw-cross-compiler,
2207     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2208         [Specify the MinGW cross-compiler to use.
2209          When building on the ODK on Unix and building unowinreg.dll,
2210          specify the MinGW C++ cross-compiler.]),
2213 AC_ARG_WITH(idlc-cpp,
2214     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2215         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2218 AC_ARG_WITH(build-version,
2219     AS_HELP_STRING([--with-build-version="Built by Jim"],
2220         [Allows the builder to add a custom version tag that will appear in the
2221          Help/About box for QA purposes.]),
2222 with_build_version=$withval,
2225 AC_ARG_WITH(parallelism,
2226     AS_HELP_STRING([--with-parallelism],
2227         [Number of jobs to run simultaneously during build. Parallel builds can
2228         save a lot of time on multi-cpu machines. Defaults to the number of
2229         CPUs on the machine, unless you configure --enable-icecream - then to
2230         40.]),
2233 AC_ARG_WITH(all-tarballs,
2234     AS_HELP_STRING([--with-all-tarballs],
2235         [Download all external tarballs unconditionally]))
2237 AC_ARG_WITH(gdrive-client-id,
2238     AS_HELP_STRING([--with-gdrive-client-id],
2239         [Provides the client id of the application for OAuth2 authentication
2240         on Google Drive. If either this or --with-gdrive-client-secret is
2241         empty, the feature will be disabled]),
2244 AC_ARG_WITH(gdrive-client-secret,
2245     AS_HELP_STRING([--with-gdrive-client-secret],
2246         [Provides the client secret of the application for OAuth2
2247         authentication on Google Drive. If either this or
2248         --with-gdrive-client-id is empty, the feature will be disabled]),
2251 AC_ARG_WITH(alfresco-cloud-client-id,
2252     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2253         [Provides the client id of the application for OAuth2 authentication
2254         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2255         empty, the feature will be disabled]),
2258 AC_ARG_WITH(alfresco-cloud-client-secret,
2259     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2260         [Provides the client secret of the application for OAuth2
2261         authentication on Alfresco Cloud. If either this or
2262         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2265 AC_ARG_WITH(onedrive-client-id,
2266     AS_HELP_STRING([--with-onedrive-client-id],
2267         [Provides the client id of the application for OAuth2 authentication
2268         on OneDrive. If either this or --with-onedrive-client-secret is
2269         empty, the feature will be disabled]),
2272 AC_ARG_WITH(onedrive-client-secret,
2273     AS_HELP_STRING([--with-onedrive-client-secret],
2274         [Provides the client secret of the application for OAuth2
2275         authentication on OneDrive. If either this or
2276         --with-onedrive-client-id is empty, the feature will be disabled]),
2278 dnl ===================================================================
2279 dnl Do we want to use pre-build binary tarball for recompile
2280 dnl ===================================================================
2282 if test "$enable_library_bin_tar" = "yes" ; then
2283     USE_LIBRARY_BIN_TAR=TRUE
2284 else
2285     USE_LIBRARY_BIN_TAR=
2287 AC_SUBST(USE_LIBRARY_BIN_TAR)
2289 dnl ===================================================================
2290 dnl Test whether build target is Release Build
2291 dnl ===================================================================
2292 AC_MSG_CHECKING([whether build target is Release Build])
2293 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2294     AC_MSG_RESULT([no])
2295     ENABLE_RELEASE_BUILD=
2296 else
2297     AC_MSG_RESULT([yes])
2298     ENABLE_RELEASE_BUILD=TRUE
2300 AC_SUBST(ENABLE_RELEASE_BUILD)
2302 dnl ===================================================================
2303 dnl Test whether to sign Windows Build
2304 dnl ===================================================================
2305 AC_MSG_CHECKING([whether to sign windows build])
2306 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2307     AC_MSG_RESULT([yes])
2308     WINDOWS_BUILD_SIGNING="TRUE"
2309 else
2310     AC_MSG_RESULT([no])
2311     WINDOWS_BUILD_SIGNING="FALSE"
2313 AC_SUBST(WINDOWS_BUILD_SIGNING)
2315 dnl ===================================================================
2316 dnl MacOSX build and runtime environment options
2317 dnl ===================================================================
2319 AC_ARG_WITH(macosx-sdk,
2320     AS_HELP_STRING([--with-macosx-sdk=<version>],
2321         [Prefer a specific SDK for building.])
2322     [
2323                           If the requested SDK is not available, a search for the oldest one will be done.
2324                           With current Xcode versions, only the latest SDK is included, so this option is
2325                           not terribly useful. It works fine to build with a new SDK and run the result
2326                           on an older OS.
2328                           e. g.: --with-macosx-sdk=10.10
2330                           there are 3 options to control the MacOSX build:
2331                           --with-macosx-sdk (referred as 'sdk' below)
2332                           --with-macosx-version-min-required (referred as 'min' below)
2333                           --with-macosx-version-max-allowed (referred as 'max' below)
2335                           the connection between these value and the default they take is as follow:
2336                           ( ? means not specified on the command line, s means the SDK version found,
2337                           constraint: 8 <= x <= y <= z)
2339                           ==========================================
2340                            command line      || config result
2341                           ==========================================
2342                           min  | max  | sdk  || min   | max  | sdk  |
2343                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2344                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2345                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2346                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2347                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2348                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2349                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2350                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2353                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2354                           for a detailed technical explanation of these variables
2356                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2357     ],
2360 AC_ARG_WITH(macosx-version-min-required,
2361     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2362         [set the minimum OS version needed to run the built LibreOffice])
2363     [
2364                           e. g.: --with-macos-version-min-required=10.10
2365                           see --with-macosx-sdk for more info
2366     ],
2369 AC_ARG_WITH(macosx-version-max-allowed,
2370     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2371         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2372     [
2373                           e. g.: --with-macos-version-max-allowed=10.10
2374                           see --with-macosx-sdk for more info
2375     ],
2379 dnl ===================================================================
2380 dnl options for stuff used during cross-compilation build
2381 dnl Not quite superseded by --with-build-platform-configure-options.
2382 dnl TODO: check, if the "force" option is still needed anywhere.
2383 dnl ===================================================================
2385 AC_ARG_WITH(system-icu-for-build,
2386     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2387         [Use icu already on system for build tools (cross-compilation only).]))
2390 dnl ===================================================================
2391 dnl Check for incompatible options set by fuzzing, and reset those
2392 dnl automatically to working combinations
2393 dnl ===================================================================
2395 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2396         "$enable_dbus" != "$enable_avahi"; then
2397     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2398     enable_avahi=$enable_dbus
2401 add_lopath_after ()
2403     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2404         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2405     fi
2408 add_lopath_before ()
2410     local IFS=${P_SEP}
2411     local path_cleanup
2412     local dir
2413     for dir in $LO_PATH ; do
2414         if test "$dir" != "$1" ; then
2415             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2416         fi
2417     done
2418     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2421 dnl ===================================================================
2422 dnl check for required programs (grep, awk, sed, bash)
2423 dnl ===================================================================
2425 pathmunge ()
2427     if test -n "$1"; then
2428         if test "$build_os" = "cygwin"; then
2429             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2430                 PathFormat "$1"
2431                 new_path=`cygpath -sm "$formatted_path"`
2432             else
2433                 PathFormat "$1"
2434                 new_path=`cygpath -u "$formatted_path"`
2435             fi
2436         else
2437             new_path="$1"
2438         fi
2439         if test "$2" = "after"; then
2440             add_lopath_after "$new_path"
2441         else
2442             add_lopath_before "$new_path"
2443         fi
2444         unset new_path
2445     fi
2448 AC_PROG_AWK
2449 AC_PATH_PROG( AWK, $AWK)
2450 if test -z "$AWK"; then
2451     AC_MSG_ERROR([install awk to run this script])
2454 AC_PATH_PROG(BASH, bash)
2455 if test -z "$BASH"; then
2456     AC_MSG_ERROR([bash not found in \$PATH])
2458 AC_SUBST(BASH)
2460 AC_MSG_CHECKING([for GNU or BSD tar])
2461 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2462     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2463     if test $? -eq 0;  then
2464         GNUTAR=$a
2465         break
2466     fi
2467 done
2468 AC_MSG_RESULT($GNUTAR)
2469 if test -z "$GNUTAR"; then
2470     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2472 AC_SUBST(GNUTAR)
2474 AC_MSG_CHECKING([for tar's option to strip components])
2475 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2476 if test $? -eq 0; then
2477     STRIP_COMPONENTS="--strip-components"
2478 else
2479     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2480     if test $? -eq 0; then
2481         STRIP_COMPONENTS="--strip-path"
2482     else
2483         STRIP_COMPONENTS="unsupported"
2484     fi
2486 AC_MSG_RESULT($STRIP_COMPONENTS)
2487 if test x$STRIP_COMPONENTS = xunsupported; then
2488     AC_MSG_ERROR([you need a tar that is able to strip components.])
2490 AC_SUBST(STRIP_COMPONENTS)
2492 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2493 dnl desktop OSes from "mobile" ones.
2495 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2496 dnl In other words, that when building for an OS that is not a
2497 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2499 dnl Note the direction of the implication; there is no assumption that
2500 dnl cross-compiling would imply a non-desktop OS.
2502 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2503     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2504     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2505     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2508 # Whether to build "avmedia" functionality or not.
2510 if test -z "$enable_avmedia"; then
2511     enable_avmedia=yes
2514 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2515 if test "$enable_avmedia" = yes; then
2516     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2517 else
2518     USE_AVMEDIA_DUMMY='TRUE'
2520 AC_SUBST(USE_AVMEDIA_DUMMY)
2522 # Decide whether to build database connectivity stuff (including
2523 # Base) or not. We probably don't want to on non-desktop OSes.
2524 if test -z "$enable_database_connectivity"; then
2525     # --disable-database-connectivity is unfinished work in progress
2526     # and the iOS test app doesn't link if we actually try to use it.
2527     # if test $_os != iOS -a $_os != Android; then
2528     if test $_os != iOS; then
2529         enable_database_connectivity=yes
2530     fi
2533 if test "$enable_database_connectivity" = yes; then
2534     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2535     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2538 if test -z "$enable_extensions"; then
2539     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2540     if test $_os != iOS -a $_os != Android; then
2541         enable_extensions=yes
2542     fi
2545 if test "$enable_extensions" = yes; then
2546     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2547     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2550 if test -z "$enable_scripting"; then
2551     # Disable scripting for iOS unless specifically overridden
2552     # with --enable-scripting.
2553     if test $_os != iOS; then
2554         enable_scripting=yes
2555     fi
2558 DISABLE_SCRIPTING=''
2559 if test "$enable_scripting" = yes; then
2560     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2561     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2562 else
2563     DISABLE_SCRIPTING='TRUE'
2564     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2567 if test $_os = iOS -o $_os = Android; then
2568     # Disable dynamic_loading always for iOS and Android
2569     enable_dynamic_loading=no
2570 elif test -z "$enable_dynamic_loading"; then
2571     # Otherwise enable it unless specifically disabled
2572     enable_dynamic_loading=yes
2575 DISABLE_DYNLOADING=''
2576 if test "$enable_dynamic_loading" = yes; then
2577     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2578 else
2579     DISABLE_DYNLOADING='TRUE'
2581 AC_SUBST(DISABLE_DYNLOADING)
2583 # remember SYSBASE value
2584 AC_SUBST(SYSBASE)
2586 dnl ===================================================================
2587 dnl  Sort out various gallery compilation options
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([how to build and package galleries])
2590 if test -n "${with_galleries}"; then
2591     if test "$with_galleries" = "build"; then
2592         WITH_GALLERY_BUILD=TRUE
2593         AC_MSG_RESULT([build from source images internally])
2594     elif test "$with_galleries" = "no"; then
2595         WITH_GALLERY_BUILD=
2596         AC_MSG_RESULT([disable non-internal gallery build])
2597     else
2598         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2599     fi
2600 else
2601     if test $_os != iOS -a $_os != Android; then
2602         WITH_GALLERY_BUILD=TRUE
2603         AC_MSG_RESULT([internal src images for desktop])
2604     else
2605         WITH_GALLERY_BUILD=
2606         AC_MSG_RESULT([disable src image build])
2607     fi
2609 AC_SUBST(WITH_GALLERY_BUILD)
2611 dnl ===================================================================
2612 dnl  Checks if ccache is available
2613 dnl ===================================================================
2614 CCACHE_DEPEND_MODE=
2615 if test "$_os" = "WINNT"; then
2616     # on windows/VC build do not use ccache
2617     CCACHE=""
2618 elif test "$enable_ccache" = "no"; then
2619     CCACHE=""
2620 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2621     case "%$CC%$CXX%" in
2622     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2623     # assume that's good then
2624     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2625         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2626         CCACHE_DEPEND_MODE=1
2627         ;;
2628     *)
2629         AC_PATH_PROG([CCACHE],[ccache],[not found])
2630         if test "$CCACHE" = "not found"; then
2631             CCACHE=""
2632         else
2633             CCACHE_DEPEND_MODE=1
2634             # Need to check for ccache version: otherwise prevents
2635             # caching of the results (like "-x objective-c++" for Mac)
2636             if test $_os = Darwin -o $_os = iOS; then
2637                 # Check ccache version
2638                 AC_MSG_CHECKING([whether version of ccache is suitable])
2639                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2640                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2641                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2642                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2643                 else
2644                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2645                     CCACHE=""
2646                     CCACHE_DEPEND_MODE=
2647                 fi
2648             fi
2649         fi
2650         ;;
2651     esac
2652 else
2653     CCACHE=""
2655 if test "$enable_ccache" = "nodepend"; then
2656     CCACHE_DEPEND_MODE=""
2658 AC_SUBST(CCACHE_DEPEND_MODE)
2660 if test "$CCACHE" != ""; then
2661     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2662     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2663     if test "$ccache_size" = ""; then
2664         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2665         if test "$ccache_size" = ""; then
2666             ccache_size=0
2667         fi
2668         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2669         if test $ccache_size -lt 1024; then
2670             CCACHE=""
2671             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2672             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2673         else
2674             # warn that ccache may be too small for debug build
2675             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2676             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2677         fi
2678     else
2679         if test $ccache_size -lt 5; then
2680             #warn that ccache may be too small for debug build
2681             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2682             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2683         fi
2684     fi
2687 dnl ===================================================================
2688 dnl  Checks for C compiler,
2689 dnl  The check for the C++ compiler is later on.
2690 dnl ===================================================================
2691 if test "$_os" != "WINNT"; then
2692     GCC_HOME_SET="true"
2693     AC_MSG_CHECKING([gcc home])
2694     if test -z "$with_gcc_home"; then
2695         if test "$enable_icecream" = "yes"; then
2696             if test -d "/usr/lib/icecc/bin"; then
2697                 GCC_HOME="/usr/lib/icecc/"
2698             elif test -d "/usr/libexec/icecc/bin"; then
2699                 GCC_HOME="/usr/libexec/icecc/"
2700             elif test -d "/opt/icecream/bin"; then
2701                 GCC_HOME="/opt/icecream/"
2702             else
2703                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2705             fi
2706         else
2707             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2708             GCC_HOME_SET="false"
2709         fi
2710     else
2711         GCC_HOME="$with_gcc_home"
2712     fi
2713     AC_MSG_RESULT($GCC_HOME)
2714     AC_SUBST(GCC_HOME)
2716     if test "$GCC_HOME_SET" = "true"; then
2717         if test -z "$CC"; then
2718             CC="$GCC_HOME/bin/gcc"
2719             CC_BASE="gcc"
2720         fi
2721         if test -z "$CXX"; then
2722             CXX="$GCC_HOME/bin/g++"
2723             CXX_BASE="g++"
2724         fi
2725     fi
2728 COMPATH=`dirname "$CC"`
2729 if test "$COMPATH" = "."; then
2730     AC_PATH_PROGS(COMPATH, $CC)
2731     dnl double square bracket to get single because of M4 quote...
2732     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2734 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2736 dnl ===================================================================
2737 dnl Java support
2738 dnl ===================================================================
2739 AC_MSG_CHECKING([whether to build with Java support])
2740 if test "$with_java" != "no"; then
2741     if test "$DISABLE_SCRIPTING" = TRUE; then
2742         AC_MSG_RESULT([no, overridden by --disable-scripting])
2743         ENABLE_JAVA=""
2744         with_java=no
2745     else
2746         AC_MSG_RESULT([yes])
2747         ENABLE_JAVA="TRUE"
2748         AC_DEFINE(HAVE_FEATURE_JAVA)
2749     fi
2750 else
2751     AC_MSG_RESULT([no])
2752     ENABLE_JAVA=""
2755 AC_SUBST(ENABLE_JAVA)
2757 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2759 dnl ENABLE_JAVA="" indicate no Java support at all
2761 dnl ===================================================================
2762 dnl Check macOS SDK and compiler
2763 dnl ===================================================================
2765 HAVE_MACOS_LD_PLATFORMVERSION=
2766 if test $_os = Darwin; then
2768     # If no --with-macosx-sdk option is given, look for one
2770     # The intent is that for "most" Mac-based developers, a suitable
2771     # SDK will be found automatically without any configure options.
2773     # For developers with a current Xcode, the lowest-numbered SDK
2774     # higher than or equal to the minimum required should be found.
2776     AC_MSG_CHECKING([what macOS SDK to use])
2777     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2778         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2779         if test -d "$MACOSX_SDK_PATH"; then
2780             with_macosx_sdk="${_macosx_sdk}"
2781             break
2782         else
2783             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2784             if test -d "$MACOSX_SDK_PATH"; then
2785                 with_macosx_sdk="${_macosx_sdk}"
2786                 break
2787             fi
2788         fi
2789     done
2790     if test ! -d "$MACOSX_SDK_PATH"; then
2791         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2792     fi
2794     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2796     case $with_macosx_sdk in
2797     10.12)
2798         MACOSX_SDK_VERSION=101200
2799         ;;
2800     10.13)
2801         MACOSX_SDK_VERSION=101300
2802         ;;
2803     10.14)
2804         MACOSX_SDK_VERSION=101400
2805         ;;
2806     10.15)
2807         MACOSX_SDK_VERSION=101500
2808         ;;
2809     *)
2810         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2811         ;;
2812     esac
2814     if test "$with_macosx_version_min_required" = "" ; then
2815         with_macosx_version_min_required="10.10";
2816     fi
2818     if test "$with_macosx_version_max_allowed" = "" ; then
2819         with_macosx_version_max_allowed="$with_macosx_sdk"
2820     fi
2822     # export this so that "xcrun" invocations later return matching values
2823     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2824     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2825     export DEVELOPER_DIR
2826     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2827     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2829     AC_MSG_CHECKING([whether Xcode is new enough])
2830     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2831     my_xcode_ver2=${my_xcode_ver1#Xcode }
2832     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2833     if test "$my_xcode_ver3" -ge 903; then
2834         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2835     else
2836         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2837     fi
2839     case "$with_macosx_version_min_required" in
2840     10.10)
2841         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2842         ;;
2843     10.11)
2844         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2845         ;;
2846     10.12)
2847         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2848         ;;
2849     10.13)
2850         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2851         ;;
2852     10.14)
2853         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2854         ;;
2855     10.15)
2856         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2857         ;;
2858     *)
2859         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2860         ;;
2861     esac
2862     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2864     LIBTOOL=/usr/bin/libtool
2865     INSTALL_NAME_TOOL=install_name_tool
2866     if test -z "$save_CC"; then
2867         stdlib=-stdlib=libc++
2868         if test "$ENABLE_LTO" = TRUE; then
2869             lto=-flto
2870         fi
2872         AC_MSG_CHECKING([what C compiler to use])
2873         CC="`xcrun -find clang`"
2874         CC_BASE=`first_arg_basename "$CC"`
2875         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2876         AC_MSG_RESULT([$CC])
2878         AC_MSG_CHECKING([what C++ compiler to use])
2879         CXX="`xcrun -find clang++`"
2880         CXX_BASE=`first_arg_basename "$CXX"`
2881         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2882         AC_MSG_RESULT([$CXX])
2884         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2885         AR=`xcrun -find ar`
2886         NM=`xcrun -find nm`
2887         STRIP=`xcrun -find strip`
2888         LIBTOOL=`xcrun -find libtool`
2889         RANLIB=`xcrun -find ranlib`
2890     fi
2892     case "$with_macosx_version_max_allowed" in
2893     10.10)
2894         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2895         ;;
2896     10.11)
2897         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2898         ;;
2899     10.12)
2900         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2901         ;;
2902     10.13)
2903         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2904         ;;
2905     10.14)
2906         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2907         ;;
2908     10.15)
2909         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2910         ;;
2911     *)
2912         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2913         ;;
2914     esac
2916     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2917     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2918         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])
2919     else
2920         AC_MSG_RESULT([ok])
2921     fi
2923     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2924     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2925         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2926     else
2927         AC_MSG_RESULT([ok])
2928     fi
2929     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2930     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2932     AC_MSG_CHECKING([whether to do code signing])
2934     if test "$enable_macosx_code_signing" = yes; then
2935         # By default use the first suitable certificate (?).
2937         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2938         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2939         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2940         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2941         # "Developer ID Application" one.
2943         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2944         if test -n "$identity"; then
2945             MACOSX_CODESIGNING_IDENTITY=$identity
2946             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2947             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2948         else
2949             AC_MSG_ERROR([cannot determine identity to use])
2950         fi
2951     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2952         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2953         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2954         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2955     else
2956         AC_MSG_RESULT([no])
2957     fi
2959     AC_MSG_CHECKING([whether to create a Mac App Store package])
2961     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2962         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2963     elif test "$enable_macosx_package_signing" = yes; then
2964         # By default use the first suitable certificate.
2965         # It should be a "3rd Party Mac Developer Installer" one
2967         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2968         if test -n "$identity"; then
2969             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2970             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2971             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2972         else
2973             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2974         fi
2975     elif test -n "$enable_macosx_package_signing"; then
2976         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2977         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2978         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2979     else
2980         AC_MSG_RESULT([no])
2981     fi
2983     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2984         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2985     fi
2987     AC_MSG_CHECKING([whether to sandbox the application])
2989     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2990         AC_MSG_ERROR([macOS sandboxing requires code signing])
2991     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2992         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2993     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2994         ENABLE_MACOSX_SANDBOX=TRUE
2995         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2996         AC_MSG_RESULT([yes])
2997     else
2998         AC_MSG_RESULT([no])
2999     fi
3001     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3002     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3003     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3005     AC_MSG_CHECKING([whether the linker supports -platform_version])
3006     save_LDFLAGS=$LDFLAGS
3007     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3008         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3009     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3010         [AC_MSG_RESULT([yes])
3011          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3012         [AC_MSG_RESULT([no])])
3013     LDFLAGS=$save_LDFLAGS
3015 AC_SUBST(MACOSX_SDK_PATH)
3016 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3017 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3018 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3019 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3020 AC_SUBST(INSTALL_NAME_TOOL)
3021 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3022 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3023 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3024 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3025 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3026 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3028 dnl ===================================================================
3029 dnl Check iOS SDK and compiler
3030 dnl ===================================================================
3032 if test $_os = iOS; then
3033     AC_MSG_CHECKING([what iOS SDK to use])
3034     current_sdk_ver=13.2
3035     older_sdk_vers="13.1 13.0 12.4 12.2"
3036     if test "$enable_ios_simulator" = "yes"; then
3037         platform=iPhoneSimulator
3038         versionmin=-mios-simulator-version-min=12.2
3039     else
3040         platform=iPhoneOS
3041         versionmin=-miphoneos-version-min=12.2
3042     fi
3043     xcode_developer=`xcode-select -print-path`
3045     for sdkver in $current_sdk_ver $older_sdk_vers; do
3046         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3047         if test -d $t; then
3048             sysroot=$t
3049             break
3050         fi
3051     done
3053     if test -z "$sysroot"; then
3054         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3055     fi
3057     AC_MSG_RESULT($sysroot)
3059     # LTO is not really recommended for iOS builds,
3060     # the link time will be astronomical
3061     if test "$ENABLE_LTO" = TRUE; then
3062         lto=-flto
3063     fi
3065     stdlib="-stdlib=libc++"
3067     AC_MSG_CHECKING([what C compiler to use])
3068     CC="`xcrun -find clang`"
3069     CC_BASE=`first_arg_basename "$CC"`
3070     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3071     AC_MSG_RESULT([$CC])
3073     AC_MSG_CHECKING([what C++ compiler to use])
3074     CXX="`xcrun -find clang++`"
3075     CXX_BASE=`first_arg_basename "$CXX"`
3076     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3077     AC_MSG_RESULT([$CXX])
3079     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3080     AR=`xcrun -find ar`
3081     NM=`xcrun -find nm`
3082     STRIP=`xcrun -find strip`
3083     LIBTOOL=`xcrun -find libtool`
3084     RANLIB=`xcrun -find ranlib`
3087 AC_MSG_CHECKING([whether to treat the installation as read-only])
3089 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3090         "$enable_extensions" != yes; then
3091     enable_readonly_installset=yes
3093 if test "$enable_readonly_installset" = yes; then
3094     AC_MSG_RESULT([yes])
3095     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3096 else
3097     AC_MSG_RESULT([no])
3100 dnl ===================================================================
3101 dnl Structure of install set
3102 dnl ===================================================================
3104 if test $_os = Darwin; then
3105     LIBO_BIN_FOLDER=MacOS
3106     LIBO_ETC_FOLDER=Resources
3107     LIBO_LIBEXEC_FOLDER=MacOS
3108     LIBO_LIB_FOLDER=Frameworks
3109     LIBO_LIB_PYUNO_FOLDER=Resources
3110     LIBO_SHARE_FOLDER=Resources
3111     LIBO_SHARE_HELP_FOLDER=Resources/help
3112     LIBO_SHARE_JAVA_FOLDER=Resources/java
3113     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3114     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3115     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3116     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3117     LIBO_URE_BIN_FOLDER=MacOS
3118     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3119     LIBO_URE_LIB_FOLDER=Frameworks
3120     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3121     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3122 elif test $_os = WINNT; then
3123     LIBO_BIN_FOLDER=program
3124     LIBO_ETC_FOLDER=program
3125     LIBO_LIBEXEC_FOLDER=program
3126     LIBO_LIB_FOLDER=program
3127     LIBO_LIB_PYUNO_FOLDER=program
3128     LIBO_SHARE_FOLDER=share
3129     LIBO_SHARE_HELP_FOLDER=help
3130     LIBO_SHARE_JAVA_FOLDER=program/classes
3131     LIBO_SHARE_PRESETS_FOLDER=presets
3132     LIBO_SHARE_READMES_FOLDER=readmes
3133     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3134     LIBO_SHARE_SHELL_FOLDER=program/shell
3135     LIBO_URE_BIN_FOLDER=program
3136     LIBO_URE_ETC_FOLDER=program
3137     LIBO_URE_LIB_FOLDER=program
3138     LIBO_URE_MISC_FOLDER=program
3139     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3140 else
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     if test "$enable_fuzzers" != yes; then
3152         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3153     else
3154         LIBO_SHARE_RESOURCE_FOLDER=resource
3155     fi
3156     LIBO_SHARE_SHELL_FOLDER=program/shell
3157     LIBO_URE_BIN_FOLDER=program
3158     LIBO_URE_ETC_FOLDER=program
3159     LIBO_URE_LIB_FOLDER=program
3160     LIBO_URE_MISC_FOLDER=program
3161     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3163 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3172 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3173 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3177 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3178 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3180 # Not all of them needed in config_host.mk, add more if need arises
3181 AC_SUBST(LIBO_BIN_FOLDER)
3182 AC_SUBST(LIBO_ETC_FOLDER)
3183 AC_SUBST(LIBO_LIB_FOLDER)
3184 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3185 AC_SUBST(LIBO_SHARE_FOLDER)
3186 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3187 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3188 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3189 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3190 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3191 AC_SUBST(LIBO_URE_BIN_FOLDER)
3192 AC_SUBST(LIBO_URE_ETC_FOLDER)
3193 AC_SUBST(LIBO_URE_LIB_FOLDER)
3194 AC_SUBST(LIBO_URE_MISC_FOLDER)
3195 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3197 dnl ===================================================================
3198 dnl Windows specific tests and stuff
3199 dnl ===================================================================
3201 reg_get_value()
3203     # Return value: $regvalue
3204     unset regvalue
3206     local _regentry="/proc/registry${1}/${2}"
3207     if test -f "$_regentry"; then
3208         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3209         # Registry keys read via /proc/registry* are always \0 terminated!
3210         local _regvalue=$(tr -d '\0' < "$_regentry")
3211         if test $? -eq 0; then
3212             regvalue=$_regvalue
3213         fi
3214     fi
3217 # Get a value from the 32-bit side of the Registry
3218 reg_get_value_32()
3220     reg_get_value "32" "$1"
3223 # Get a value from the 64-bit side of the Registry
3224 reg_get_value_64()
3226     reg_get_value "64" "$1"
3229 if test "$_os" = "WINNT"; then
3230     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3231     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3232         AC_MSG_RESULT([no])
3233         WINDOWS_SDK_ARCH="x86"
3234     else
3235         AC_MSG_RESULT([yes])
3236         WINDOWS_SDK_ARCH="x64"
3237         BITNESS_OVERRIDE=64
3238     fi
3240 if test "$_os" = "iOS"; then
3241     cross_compiling="yes"
3244 if test "$cross_compiling" = "yes"; then
3245     export CROSS_COMPILING=TRUE
3246 else
3247     CROSS_COMPILING=
3248     BUILD_TYPE="$BUILD_TYPE NATIVE"
3250 AC_SUBST(CROSS_COMPILING)
3252 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3253 # NOTE: must _not_ be used for bundled external libraries!
3254 ISYSTEM=
3255 if test "$GCC" = "yes"; then
3256     AC_MSG_CHECKING( for -isystem )
3257     save_CFLAGS=$CFLAGS
3258     CFLAGS="$CFLAGS -Werror"
3259     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3260     CFLAGS=$save_CFLAGS
3261     if test -n "$ISYSTEM"; then
3262         AC_MSG_RESULT(yes)
3263     else
3264         AC_MSG_RESULT(no)
3265     fi
3267 if test -z "$ISYSTEM"; then
3268     # fall back to using -I
3269     ISYSTEM=-I
3271 AC_SUBST(ISYSTEM)
3273 dnl ===================================================================
3274 dnl  Check which Visual Studio compiler is used
3275 dnl ===================================================================
3277 map_vs_year_to_version()
3279     # Return value: $vsversion
3281     unset vsversion
3283     case $1 in
3284     2017)
3285         vsversion=15;;
3286     2019)
3287         vsversion=16;;
3288     *)
3289         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3290     esac
3293 vs_versions_to_check()
3295     # Args: $1 (optional) : versions to check, in the order of preference
3296     # Return value: $vsversions
3298     unset vsversions
3300     if test -n "$1"; then
3301         map_vs_year_to_version "$1"
3302         vsversions=$vsversion
3303     else
3304         # We accept only 2017
3305         vsversions="15"
3306     fi
3309 win_get_env_from_vsvars32bat()
3311     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3312     # Also seems to be located in another directory under the same name: vsvars32.bat
3313     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3314     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3315     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3316     chmod +x $WRAPPERBATCHFILEPATH
3317     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3318     rm -f $WRAPPERBATCHFILEPATH
3319     printf '%s' "$_win_get_env_from_vsvars32bat"
3322 find_ucrt()
3324     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3325     if test -n "$regvalue"; then
3326         PathFormat "$regvalue"
3327         UCRTSDKDIR=$formatted_path
3328         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3329         UCRTVERSION=$regvalue
3330         # Rest if not exist
3331         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3332           UCRTSDKDIR=
3333         fi
3334     fi
3335     if test -z "$UCRTSDKDIR"; then
3336         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3337         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3338         if test -f "$ide_env_file"; then
3339             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3340             UCRTSDKDIR=$formatted_path
3341             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3342             dnl Hack needed at least by tml:
3343             if test "$UCRTVERSION" = 10.0.15063.0 \
3344                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3345                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3346             then
3347                 UCRTVERSION=10.0.14393.0
3348             fi
3349         else
3350           AC_MSG_ERROR([No UCRT found])
3351         fi
3352     fi
3355 find_msvc()
3357     # Find Visual C++ 2017/2019
3358     # Args: $1 (optional) : The VS version year
3359     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3361     unset vctest vcnum vcnumwithdot vcbuildnumber
3363     vs_versions_to_check "$1"
3364     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3365     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3366     PathFormat "$vswhere"
3367     vswhere=$formatted_path
3368     for ver in $vsversions; do
3369         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3370         if test -n "$vswhereoutput"; then
3371             PathFormat "$vswhereoutput"
3372             vctest=$formatted_path
3373             break
3374         fi
3375     done
3377     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3378     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3379     # should be removed when upgrading baseline.
3380     if ! test -n "$vctest"; then
3381         for ver in $vsversions; do
3382             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3383             if test -n "$regvalue"; then
3384                 vctest=$regvalue
3385                 break
3386             fi
3387             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3388             if test -n "$regvalue"; then
3389                 AC_MSG_RESULT([found: $regvalue])
3390                 PathFormat "$regvalue"
3391                 vctest=$formatted_path
3392                 break
3393             fi
3394         done
3395     fi
3397     if test -n "$vctest"; then
3398         vcnumwithdot="$ver.0"
3399         case "$vcnumwithdot" in
3400         15.0)
3401             vcyear=2017
3402             vcnum=150
3403             ;;
3404         16.0)
3405             vcyear=2019
3406             vcnum=160
3407             ;;
3408         esac
3409         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3411     fi
3414 SOLARINC=
3415 MSBUILD_PATH=
3416 DEVENV=
3417 if test "$_os" = "WINNT"; then
3418     AC_MSG_CHECKING([Visual C++])
3419     find_msvc "$with_visual_studio"
3420     if test -z "$vctest"; then
3421         if test -n "$with_visual_studio"; then
3422             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3423         else
3424             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3425         fi
3426     fi
3428     if test "$BITNESS_OVERRIDE" = ""; then
3429         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3430             VC_PRODUCT_DIR=$vctest/VC
3431         else
3432             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3433         fi
3434     else
3435         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3436             VC_PRODUCT_DIR=$vctest/VC
3437         else
3438             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3439         fi
3440     fi
3441     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3443     AC_MSG_CHECKING([for short pathname of VC product directory])
3444     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3445     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3447     UCRTSDKDIR=
3448     UCRTVERSION=
3450     AC_MSG_CHECKING([for UCRT location])
3451     find_ucrt
3452     # find_ucrt errors out if it doesn't find it
3453     AC_MSG_RESULT([found])
3454     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3455     ucrtincpath_formatted=$formatted_path
3456     # SOLARINC is used for external modules and must be set too.
3457     # And no, it's not sufficient to set SOLARINC only, as configure
3458     # itself doesn't honour it.
3459     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3460     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3461     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3462     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3464     AC_SUBST(UCRTSDKDIR)
3465     AC_SUBST(UCRTVERSION)
3467     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3468     # Find the proper version of MSBuild.exe to use based on the VS version
3469     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3470     if test -n "$regvalue" ; then
3471         AC_MSG_RESULT([found: $regvalue])
3472         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3473     else
3474         if test "$vcnumwithdot" = "16.0"; then
3475             if test "$BITNESS_OVERRIDE" = ""; then
3476                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3477             else
3478                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3479             fi
3480         else
3481             if test "$BITNESS_OVERRIDE" = ""; then
3482                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3483             else
3484                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3485             fi
3486         fi
3487         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3488         AC_MSG_RESULT([$regvalue])
3489     fi
3491     # Find the version of devenv.exe
3492     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3493     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3494     if test ! -e "$DEVENV"; then
3495         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3496     fi
3498     dnl ===========================================================
3499     dnl  Check for the corresponding mspdb*.dll
3500     dnl ===========================================================
3502     VC_HOST_DIR=
3503     MSPDB_PATH=
3504     CL_PATH=
3506     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3507         VC_HOST_DIR="HostX64"
3508         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3509     else
3510         VC_HOST_DIR="HostX86"
3511         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3512     fi
3514     if test "$BITNESS_OVERRIDE" = ""; then
3515         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3516     else
3517         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3518     fi
3520     # MSVC 15.0 has libraries from 14.0?
3521     mspdbnum="140"
3523     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3524         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3525     fi
3527     dnl The path needs to be added before cl is called
3528     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3529     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3531     AC_MSG_CHECKING([cl.exe])
3533     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3534     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3535     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3536     # is not enough?
3538     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3539     dnl needed when building CLR code:
3540     if test -z "$MSVC_CXX"; then
3541         if test -f "$CL_PATH/cl.exe"; then
3542             MSVC_CXX="$CL_PATH/cl.exe"
3543         fi
3545         # This gives us a posix path with 8.3 filename restrictions
3546         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3547     fi
3549     if test -z "$CC"; then
3550         CC=$MSVC_CXX
3551         CC_BASE=`first_arg_basename "$CC"`
3552     fi
3553     if test "$BITNESS_OVERRIDE" = ""; then
3554         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3555         MSVC_CXX="$MSVC_CXX -arch:SSE"
3556     fi
3557     if test -z "$CXX"; then
3558         CXX=$MSVC_CXX
3559         CXX_BASE=`first_arg_basename "$CXX"`
3560     fi
3562     if test -n "$CC"; then
3563         # Remove /cl.exe from CC case insensitive
3564         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3565         if test "$BITNESS_OVERRIDE" = ""; then
3566            COMPATH="$VC_PRODUCT_DIR"
3567         else
3568             if test -n "$VC_PRODUCT_DIR"; then
3569                 COMPATH=$VC_PRODUCT_DIR
3570             fi
3571         fi
3572         if test "$BITNESS_OVERRIDE" = ""; then
3573             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3574             CC="$CC -arch:SSE"
3575         fi
3577         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3579         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3581         PathFormat "$COMPATH"
3582         COMPATH=`win_short_path_for_make "$formatted_path"`
3584         VCVER=$vcnum
3585         MSVSVER=$vcyear
3587         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3588         # are always "better", we list them in reverse chronological order.
3590         case "$vcnum" in
3591         150|160)
3592             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3593             ;;
3594         esac
3596         # The expectation is that --with-windows-sdk should not need to be used
3597         if test -n "$with_windows_sdk"; then
3598             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3599             *" "$with_windows_sdk" "*)
3600                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3601                 ;;
3602             *)
3603                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3604                 ;;
3605             esac
3606         fi
3608         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3609         ac_objext=obj
3610         ac_exeext=exe
3612     else
3613         AC_MSG_ERROR([Visual C++ not found after all, huh])
3614     fi
3616     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3617     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3618         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3619         // between Visual Studio versions and _MSC_VER:
3620         #if _MSC_VER < 1914
3621         #error
3622         #endif
3623     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3625     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3626     # version of the Explorer extension (and maybe other small
3627     # bits, too) needed when installing a 32-bit LibreOffice on a
3628     # 64-bit OS. The 64-bit Explorer extension is a feature that
3629     # has been present since long in OOo. Don't confuse it with
3630     # building LibreOffice itself as 64-bit code.
3632     BUILD_X64=
3633     CXX_X64_BINARY=
3635     if test "$BITNESS_OVERRIDE" = ""; then
3636         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3637         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3638              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3639             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3640                 BUILD_X64=TRUE
3641                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3642             fi
3643         fi
3644         if test "$BUILD_X64" = TRUE; then
3645             AC_MSG_RESULT([found])
3646         else
3647             AC_MSG_RESULT([not found])
3648             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3649         fi
3650     else
3651         CXX_X64_BINARY=$CXX
3652     fi
3653     AC_SUBST(BUILD_X64)
3655     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3656     AC_SUBST(CXX_X64_BINARY)
3658     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3659     # needed to support TWAIN scan on both 32- and 64-bit systems
3661     BUILD_X86=
3663     if test "$BITNESS_OVERRIDE" = "64"; then
3664         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3665         if test -n "$CXX_X86_BINARY"; then
3666             BUILD_X86=TRUE
3667             AC_MSG_RESULT([preset])
3668         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3669             BUILD_X86=TRUE
3670             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3671             CXX_X86_BINARY+=" /arch:SSE"
3672             AC_MSG_RESULT([found])
3673         else
3674             CXX_X86_BINARY=
3675             AC_MSG_RESULT([not found])
3676             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3677         fi
3678     else
3679         BUILD_X86=TRUE
3680         CXX_X86_BINARY=$MSVC_CXX
3681     fi
3682     AC_SUBST(BUILD_X86)
3683     AC_SUBST(CXX_X86_BINARY)
3685 AC_SUBST(VCVER)
3686 AC_SUBST(DEVENV)
3687 AC_SUBST(MSVC_CXX)
3690 # unowinreg.dll
3692 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3693 AC_SUBST(UNOWINREG_DLL)
3695 COM_IS_CLANG=
3696 AC_MSG_CHECKING([whether the compiler is actually Clang])
3697 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3698     #ifndef __clang__
3699     you lose
3700     #endif
3701     int foo=42;
3702     ]])],
3703     [AC_MSG_RESULT([yes])
3704      COM_IS_CLANG=TRUE],
3705     [AC_MSG_RESULT([no])])
3706 AC_SUBST(COM_IS_CLANG)
3708 CC_PLAIN=$CC
3709 CLANGVER=
3710 if test "$COM_IS_CLANG" = TRUE; then
3711     AC_MSG_CHECKING([whether Clang is new enough])
3712     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3713         #if !defined __apple_build_version__
3714         #error
3715         #endif
3716         ]])],
3717         [my_apple_clang=yes],[my_apple_clang=])
3718     if test "$my_apple_clang" = yes; then
3719         AC_MSG_RESULT([assumed yes (Apple Clang)])
3720     else
3721         if test "$_os" = WINNT; then
3722             dnl In which case, assume clang-cl:
3723             my_args="/EP /TC"
3724             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3725             dnl clang-cl:
3726             CC_PLAIN=
3727             for i in $CC; do
3728                 case $i in
3729                 -FIIntrin.h)
3730                     ;;
3731                 *)
3732                     CC_PLAIN="$CC_PLAIN $i"
3733                     ;;
3734                 esac
3735             done
3736         else
3737             my_args="-E -P"
3738         fi
3739         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3740         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3741         CLANGVER=`echo $clang_version \
3742             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3743         if test "$CLANGVER" -ge 50002; then
3744             AC_MSG_RESULT([yes ($clang_version)])
3745         else
3746             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3747         fi
3748         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3749         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3750     fi
3753 SHOWINCLUDES_PREFIX=
3754 if test "$_os" = WINNT; then
3755     dnl We need to guess the prefix of the -showIncludes output, it can be
3756     dnl localized
3757     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3758     echo "#include <stdlib.h>" > conftest.c
3759     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3760         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3761     rm -f conftest.c conftest.obj
3762     if test -z "$SHOWINCLUDES_PREFIX"; then
3763         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3764     else
3765         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3766     fi
3768 AC_SUBST(SHOWINCLUDES_PREFIX)
3771 # prefix C with ccache if needed
3773 if test "$CCACHE" != ""; then
3774     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3776     AC_LANG_PUSH([C])
3777     save_CFLAGS=$CFLAGS
3778     CFLAGS="$CFLAGS --ccache-skip -O2"
3779     dnl an empty program will do, we're checking the compiler flags
3780     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3781                       [use_ccache=yes], [use_ccache=no])
3782     if test $use_ccache = yes; then
3783         AC_MSG_RESULT([yes])
3784     else
3785         CC="$CCACHE $CC"
3786         CC_BASE="ccache $CC_BASE"
3787         AC_MSG_RESULT([no])
3788     fi
3789     CFLAGS=$save_CFLAGS
3790     AC_LANG_POP([C])
3793 # ===================================================================
3794 # check various GCC options that Clang does not support now but maybe
3795 # will somewhen in the future, check them even for GCC, so that the
3796 # flags are set
3797 # ===================================================================
3799 HAVE_GCC_GGDB2=
3800 if test "$GCC" = "yes"; then
3801     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3802     save_CFLAGS=$CFLAGS
3803     CFLAGS="$CFLAGS -Werror -ggdb2"
3804     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3805     CFLAGS=$save_CFLAGS
3806     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3807         AC_MSG_RESULT([yes])
3808     else
3809         AC_MSG_RESULT([no])
3810     fi
3812     if test "$host_cpu" = "m68k"; then
3813         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3814         save_CFLAGS=$CFLAGS
3815         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3816         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3817         CFLAGS=$save_CFLAGS
3818         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3819             AC_MSG_RESULT([yes])
3820         else
3821             AC_MSG_ERROR([no])
3822         fi
3823     fi
3825 AC_SUBST(HAVE_GCC_GGDB2)
3827 dnl ===================================================================
3828 dnl  Test the gcc version
3829 dnl ===================================================================
3830 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3831     AC_MSG_CHECKING([the GCC version])
3832     _gcc_version=`$CC -dumpversion`
3833     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3834         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3835     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3837     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3839     if test "$gcc_full_version" -lt 70000; then
3840         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3841     fi
3842 else
3843     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3844     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3845     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3846     # (which reports itself as GCC 4.2.1).
3847     GCC_VERSION=
3849 AC_SUBST(GCC_VERSION)
3851 dnl Set the ENABLE_DBGUTIL variable
3852 dnl ===================================================================
3853 AC_MSG_CHECKING([whether to build with additional debug utilities])
3854 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3855     ENABLE_DBGUTIL="TRUE"
3856     # this is an extra var so it can have different default on different MSVC
3857     # versions (in case there are version specific problems with it)
3858     MSVC_USE_DEBUG_RUNTIME="TRUE"
3860     AC_MSG_RESULT([yes])
3861     # cppunit and graphite expose STL in public headers
3862     if test "$with_system_cppunit" = "yes"; then
3863         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3864     else
3865         with_system_cppunit=no
3866     fi
3867     if test "$with_system_graphite" = "yes"; then
3868         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3869     else
3870         with_system_graphite=no
3871     fi
3872     if test "$with_system_orcus" = "yes"; then
3873         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3874     else
3875         with_system_orcus=no
3876     fi
3877     if test "$with_system_libcmis" = "yes"; then
3878         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3879     else
3880         with_system_libcmis=no
3881     fi
3882     if test "$with_system_hunspell" = "yes"; then
3883         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3884     else
3885         with_system_hunspell=no
3886     fi
3887     if test "$with_system_gpgmepp" = "yes"; then
3888         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3889     else
3890         with_system_gpgmepp=no
3891     fi
3892     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3893     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3894     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3895     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3896     # of those two is using the system variant:
3897     if test "$with_system_libnumbertext" = "yes"; then
3898         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3899     else
3900         with_system_libnumbertext=no
3901     fi
3902     if test "$with_system_libwps" = "yes"; then
3903         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3904     else
3905         with_system_libwps=no
3906     fi
3907 else
3908     ENABLE_DBGUTIL=""
3909     MSVC_USE_DEBUG_RUNTIME=""
3910     AC_MSG_RESULT([no])
3912 AC_SUBST(ENABLE_DBGUTIL)
3913 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3915 dnl Set the ENABLE_DEBUG variable.
3916 dnl ===================================================================
3917 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3918     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3920 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3921     if test -z "$libo_fuzzed_enable_debug"; then
3922         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3923     else
3924         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3925         enable_debug=yes
3926     fi
3929 AC_MSG_CHECKING([whether to do a debug build])
3930 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3931     ENABLE_DEBUG="TRUE"
3932     if test -n "$ENABLE_DBGUTIL" ; then
3933         AC_MSG_RESULT([yes (dbgutil)])
3934     else
3935         AC_MSG_RESULT([yes])
3936     fi
3937 else
3938     ENABLE_DEBUG=""
3939     AC_MSG_RESULT([no])
3941 AC_SUBST(ENABLE_DEBUG)
3943 dnl ===================================================================
3944 dnl Select the linker to use (gold/lld/ld.bfd).
3945 dnl This is done only after compiler checks (need to know if Clang is
3946 dnl used, for different defaults) and after checking if a debug build
3947 dnl is wanted (non-debug builds get the default linker if not explicitly
3948 dnl specified otherwise).
3949 dnl All checks for linker features/options should come after this.
3950 dnl ===================================================================
3951 check_use_ld()
3953     use_ld=$1
3954     use_ld_fail_if_error=$2
3955     use_ld_ok=
3956     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3957     use_ld_ldflags_save="$LDFLAGS"
3958     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3959     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3960 #include <stdio.h>
3961         ],[
3962 printf ("hello world\n");
3963         ])], USE_LD=$use_ld, [])
3964     if test -n "$USE_LD"; then
3965         AC_MSG_RESULT( yes )
3966         use_ld_ok=yes
3967     else
3968         if test -n "$use_ld_fail_if_error"; then
3969             AC_MSG_ERROR( no )
3970         else
3971             AC_MSG_RESULT( no )
3972         fi
3973     fi
3974     if test -n "$use_ld_ok"; then
3975         dnl keep the value of LDFLAGS
3976         return 0
3977     fi
3978     LDFLAGS="$use_ld_ldflags_save"
3979     return 1
3981 USE_LD=
3982 if test "$enable_ld" != "no"; then
3983     if test "$GCC" = "yes"; then
3984         if test -n "$enable_ld"; then
3985             check_use_ld "$enable_ld" fail_if_error
3986         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3987             dnl non-debug builds default to the default linker
3988             true
3989         elif test -n "$COM_IS_CLANG"; then
3990             check_use_ld lld
3991             if test $? -ne 0; then
3992                 check_use_ld gold
3993             fi
3994         else
3995             # For gcc first try gold, new versions also support lld.
3996             check_use_ld gold
3997             if test $? -ne 0; then
3998                 check_use_ld lld
3999             fi
4000         fi
4001         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4002         rm conftest.out
4003         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4004         if test -z "$ld_used"; then
4005             ld_used="unknown"
4006         fi
4007         AC_MSG_CHECKING([for linker that is used])
4008         AC_MSG_RESULT([$ld_used])
4009         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4010             if echo "$ld_used" | grep -q "^GNU ld"; then
4011                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4012                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4013             fi
4014         fi
4015     else
4016         if test "$enable_ld" = "yes"; then
4017             AC_MSG_ERROR([--enable-ld not supported])
4018         fi
4019     fi
4021 AC_SUBST(USE_LD)
4023 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4024 if test "$GCC" = "yes"; then
4025     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4026     bsymbolic_functions_ldflags_save=$LDFLAGS
4027     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4028     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4029 #include <stdio.h>
4030         ],[
4031 printf ("hello world\n");
4032         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4033     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4034         AC_MSG_RESULT( found )
4035     else
4036         AC_MSG_RESULT( not found )
4037     fi
4038     LDFLAGS=$bsymbolic_functions_ldflags_save
4040 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4043 HAVE_GSPLIT_DWARF=
4044 if test "$enable_split_debug" != no; then
4045     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4046     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4047         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4048         save_CFLAGS=$CFLAGS
4049         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4050         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4051         CFLAGS=$save_CFLAGS
4052         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4053             AC_MSG_RESULT([yes])
4054         else
4055             if test "$enable_split_debug" = yes; then
4056                 AC_MSG_ERROR([no])
4057             else
4058                 AC_MSG_RESULT([no])
4059             fi
4060         fi
4061     fi
4062     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4063         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4064         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4065     fi
4067 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4069 ENABLE_GDB_INDEX=
4070 if test "$enable_gdb_index" != "no"; then
4071     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4072     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4073         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4074         save_CFLAGS=$CFLAGS
4075         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4076         have_ggnu_pubnames=
4077         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4078         if test "$have_ggnu_pubnames" != "TRUE"; then
4079             if test "$enable_gdb_index" = "yes"; then
4080                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4081             else
4082                 AC_MSG_RESULT( no )
4083             fi
4084         else
4085             AC_MSG_RESULT( yes )
4086             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4087             ldflags_save=$LDFLAGS
4088             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4089             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4090 #include <stdio.h>
4091                 ],[
4092 printf ("hello world\n");
4093                 ])], ENABLE_GDB_INDEX=TRUE, [])
4094             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4095                 AC_MSG_RESULT( yes )
4096             else
4097                 if test "$enable_gdb_index" = "yes"; then
4098                     AC_MSG_ERROR( no )
4099                 else
4100                     AC_MSG_RESULT( no )
4101                 fi
4102             fi
4103             LDFLAGS=$ldflags_save
4104         fi
4105         CFLAGS=$save_CFLAGS
4106         fi
4107     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4108         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4109         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4110     fi
4112 AC_SUBST(ENABLE_GDB_INDEX)
4114 if test "$enable_sal_log" = yes; then
4115     ENABLE_SAL_LOG=TRUE
4117 AC_SUBST(ENABLE_SAL_LOG)
4119 dnl Check for enable symbols option
4120 dnl ===================================================================
4121 AC_MSG_CHECKING([whether to generate debug information])
4122 if test -z "$enable_symbols"; then
4123     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4124         enable_symbols=yes
4125     else
4126         enable_symbols=no
4127     fi
4129 if test "$enable_symbols" = yes; then
4130     ENABLE_SYMBOLS_FOR=all
4131     AC_MSG_RESULT([yes])
4132 elif test "$enable_symbols" = no; then
4133     ENABLE_SYMBOLS_FOR=
4134     AC_MSG_RESULT([no])
4135 else
4136     # Selective debuginfo.
4137     ENABLE_SYMBOLS_FOR="$enable_symbols"
4138     AC_MSG_RESULT([for "$enable_symbols"])
4140 AC_SUBST(ENABLE_SYMBOLS_FOR)
4142 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4143     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4144     AC_MSG_CHECKING([whether enough memory is available for linking])
4145     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4146     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4147     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4148         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4149     else
4150         AC_MSG_RESULT([yes])
4151     fi
4154 AC_MSG_CHECKING([whether to compile with optimization flags])
4155 if test -z "$enable_optimized"; then
4156     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4157         enable_optimized=no
4158     else
4159         enable_optimized=yes
4160     fi
4162 if test "$enable_optimized" != no; then
4163     ENABLE_OPTIMIZED=TRUE
4164     AC_MSG_RESULT([yes])
4165 else
4166     ENABLE_OPTIMIZED=
4167     AC_MSG_RESULT([no])
4169 AC_SUBST(ENABLE_OPTIMIZED)
4172 # determine CPUNAME, OS, ...
4173 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4175 case "$host_os" in
4177 aix*)
4178     COM=GCC
4179     CPUNAME=POWERPC
4180     USING_X11=TRUE
4181     OS=AIX
4182     RTL_OS=AIX
4183     RTL_ARCH=PowerPC
4184     PLATFORMID=aix_powerpc
4185     P_SEP=:
4186     ;;
4188 cygwin*)
4189     COM=MSC
4190     USING_X11=
4191     OS=WNT
4192     RTL_OS=Windows
4193     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4194         P_SEP=";"
4195     else
4196         P_SEP=:
4197     fi
4198     case "$host_cpu" in
4199     i*86|x86_64)
4200         if test "$BITNESS_OVERRIDE" = 64; then
4201             CPUNAME=X86_64
4202             RTL_ARCH=X86_64
4203             PLATFORMID=windows_x86_64
4204             WINDOWS_X64=1
4205             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4206         else
4207             CPUNAME=INTEL
4208             RTL_ARCH=x86
4209             PLATFORMID=windows_x86
4210         fi
4211         ;;
4212     *)
4213         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4214         ;;
4215     esac
4216     SCPDEFS="$SCPDEFS -D_MSC_VER"
4217     ;;
4219 darwin*)
4220     COM=GCC
4221     USING_X11=
4222     OS=MACOSX
4223     RTL_OS=MacOSX
4224     P_SEP=:
4226     case "$host_cpu" in
4227     arm)
4228         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4229         ;;
4230     arm64)
4231         OS=iOS
4232         RTL_OS=iOS
4233         if test "$enable_ios_simulator" = "yes"; then
4234             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4235         else
4236             CPUNAME=ARM64
4237             RTL_ARCH=ARM_EABI
4238             PLATFORMID=ios_arm64
4239         fi
4240         ;;
4241     i*86)
4242         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4243         ;;
4244     x86_64)
4245         if test "$enable_ios_simulator" = "yes"; then
4246             OS=iOS
4247         fi
4248         CPUNAME=X86_64
4249         RTL_ARCH=X86_64
4250         PLATFORMID=macosx_x86_64
4251         ;;
4252     *)
4253         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4254         ;;
4255     esac
4256     ;;
4258 dragonfly*)
4259     COM=GCC
4260     USING_X11=TRUE
4261     OS=DRAGONFLY
4262     RTL_OS=DragonFly
4263     P_SEP=:
4265     case "$host_cpu" in
4266     i*86)
4267         CPUNAME=INTEL
4268         RTL_ARCH=x86
4269         PLATFORMID=dragonfly_x86
4270         ;;
4271     x86_64)
4272         CPUNAME=X86_64
4273         RTL_ARCH=X86_64
4274         PLATFORMID=dragonfly_x86_64
4275         ;;
4276     *)
4277         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4278         ;;
4279     esac
4280     ;;
4282 freebsd*)
4283     COM=GCC
4284     USING_X11=TRUE
4285     RTL_OS=FreeBSD
4286     OS=FREEBSD
4287     P_SEP=:
4289     case "$host_cpu" in
4290     i*86)
4291         CPUNAME=INTEL
4292         RTL_ARCH=x86
4293         PLATFORMID=freebsd_x86
4294         ;;
4295     x86_64|amd64)
4296         CPUNAME=X86_64
4297         RTL_ARCH=X86_64
4298         PLATFORMID=freebsd_x86_64
4299         ;;
4300     *)
4301         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4302         ;;
4303     esac
4304     ;;
4306 haiku*)
4307     COM=GCC
4308     USING_X11=
4309     GUIBASE=haiku
4310     RTL_OS=Haiku
4311     OS=HAIKU
4312     P_SEP=:
4314     case "$host_cpu" in
4315     i*86)
4316         CPUNAME=INTEL
4317         RTL_ARCH=x86
4318         PLATFORMID=haiku_x86
4319         ;;
4320     x86_64|amd64)
4321         CPUNAME=X86_64
4322         RTL_ARCH=X86_64
4323         PLATFORMID=haiku_x86_64
4324         ;;
4325     *)
4326         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4327         ;;
4328     esac
4329     ;;
4331 kfreebsd*)
4332     COM=GCC
4333     USING_X11=TRUE
4334     OS=LINUX
4335     RTL_OS=kFreeBSD
4336     P_SEP=:
4338     case "$host_cpu" in
4340     i*86)
4341         CPUNAME=INTEL
4342         RTL_ARCH=x86
4343         PLATFORMID=kfreebsd_x86
4344         ;;
4345     x86_64)
4346         CPUNAME=X86_64
4347         RTL_ARCH=X86_64
4348         PLATFORMID=kfreebsd_x86_64
4349         ;;
4350     *)
4351         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4352         ;;
4353     esac
4354     ;;
4356 linux-gnu*)
4357     COM=GCC
4358     USING_X11=TRUE
4359     OS=LINUX
4360     RTL_OS=Linux
4361     P_SEP=:
4363     case "$host_cpu" in
4365     aarch64)
4366         CPUNAME=AARCH64
4367         PLATFORMID=linux_aarch64
4368         RTL_ARCH=AARCH64
4369         ;;
4370     alpha)
4371         CPUNAME=AXP
4372         RTL_ARCH=ALPHA
4373         PLATFORMID=linux_alpha
4374         ;;
4375     arm*)
4376         CPUNAME=ARM
4377         EPM_FLAGS="-a arm"
4378         RTL_ARCH=ARM_EABI
4379         PLATFORMID=linux_arm_eabi
4380         case "$host_cpu" in
4381         arm*-linux)
4382             RTL_ARCH=ARM_OABI
4383             PLATFORMID=linux_arm_oabi
4384             ;;
4385         esac
4386         ;;
4387     hppa)
4388         CPUNAME=HPPA
4389         RTL_ARCH=HPPA
4390         EPM_FLAGS="-a hppa"
4391         PLATFORMID=linux_hppa
4392         ;;
4393     i*86)
4394         CPUNAME=INTEL
4395         RTL_ARCH=x86
4396         PLATFORMID=linux_x86
4397         ;;
4398     ia64)
4399         CPUNAME=IA64
4400         RTL_ARCH=IA64
4401         PLATFORMID=linux_ia64
4402         ;;
4403     mips)
4404         CPUNAME=GODSON
4405         RTL_ARCH=MIPS_EB
4406         EPM_FLAGS="-a mips"
4407         PLATFORMID=linux_mips_eb
4408         ;;
4409     mips64)
4410         CPUNAME=GODSON64
4411         RTL_ARCH=MIPS64_EB
4412         EPM_FLAGS="-a mips64"
4413         PLATFORMID=linux_mips64_eb
4414         ;;
4415     mips64el)
4416         CPUNAME=GODSON64
4417         RTL_ARCH=MIPS64_EL
4418         EPM_FLAGS="-a mips64el"
4419         PLATFORMID=linux_mips64_el
4420         ;;
4421     mipsel)
4422         CPUNAME=GODSON
4423         RTL_ARCH=MIPS_EL
4424         EPM_FLAGS="-a mipsel"
4425         PLATFORMID=linux_mips_el
4426         ;;
4427     m68k)
4428         CPUNAME=M68K
4429         RTL_ARCH=M68K
4430         PLATFORMID=linux_m68k
4431         ;;
4432     powerpc)
4433         CPUNAME=POWERPC
4434         RTL_ARCH=PowerPC
4435         PLATFORMID=linux_powerpc
4436         ;;
4437     powerpc64)
4438         CPUNAME=POWERPC64
4439         RTL_ARCH=PowerPC_64
4440         PLATFORMID=linux_powerpc64
4441         ;;
4442     powerpc64le)
4443         CPUNAME=POWERPC64
4444         RTL_ARCH=PowerPC_64_LE
4445         PLATFORMID=linux_powerpc64_le
4446         ;;
4447     sparc)
4448         CPUNAME=SPARC
4449         RTL_ARCH=SPARC
4450         PLATFORMID=linux_sparc
4451         ;;
4452     sparc64)
4453         CPUNAME=SPARC64
4454         RTL_ARCH=SPARC64
4455         PLATFORMID=linux_sparc64
4456         ;;
4457     s390)
4458         CPUNAME=S390
4459         RTL_ARCH=S390
4460         PLATFORMID=linux_s390
4461         ;;
4462     s390x)
4463         CPUNAME=S390X
4464         RTL_ARCH=S390x
4465         PLATFORMID=linux_s390x
4466         ;;
4467     x86_64)
4468         CPUNAME=X86_64
4469         RTL_ARCH=X86_64
4470         PLATFORMID=linux_x86_64
4471         ;;
4472     *)
4473         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4474         ;;
4475     esac
4476     ;;
4478 linux-android*)
4479     COM=GCC
4480     USING_X11=
4481     OS=ANDROID
4482     RTL_OS=Android
4483     P_SEP=:
4485     case "$host_cpu" in
4487     arm|armel)
4488         CPUNAME=ARM
4489         RTL_ARCH=ARM_EABI
4490         PLATFORMID=android_arm_eabi
4491         ;;
4492     aarch64)
4493         CPUNAME=AARCH64
4494         RTL_ARCH=AARCH64
4495         PLATFORMID=android_aarch64
4496         ;;
4497     i*86)
4498         CPUNAME=INTEL
4499         RTL_ARCH=x86
4500         PLATFORMID=android_x86
4501         ;;
4502     x86_64)
4503         CPUNAME=X86_64
4504         RTL_ARCH=X86_64
4505         PLATFORMID=android_x86_64
4506         ;;
4507     *)
4508         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4509         ;;
4510     esac
4511     ;;
4513 *netbsd*)
4514     COM=GCC
4515     USING_X11=TRUE
4516     OS=NETBSD
4517     RTL_OS=NetBSD
4518     P_SEP=:
4520     case "$host_cpu" in
4521     i*86)
4522         CPUNAME=INTEL
4523         RTL_ARCH=x86
4524         PLATFORMID=netbsd_x86
4525         ;;
4526     powerpc)
4527         CPUNAME=POWERPC
4528         RTL_ARCH=PowerPC
4529         PLATFORMID=netbsd_powerpc
4530         ;;
4531     sparc)
4532         CPUNAME=SPARC
4533         RTL_ARCH=SPARC
4534         PLATFORMID=netbsd_sparc
4535         ;;
4536     x86_64)
4537         CPUNAME=X86_64
4538         RTL_ARCH=X86_64
4539         PLATFORMID=netbsd_x86_64
4540         ;;
4541     *)
4542         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4543         ;;
4544     esac
4545     ;;
4547 openbsd*)
4548     COM=GCC
4549     USING_X11=TRUE
4550     OS=OPENBSD
4551     RTL_OS=OpenBSD
4552     P_SEP=:
4554     case "$host_cpu" in
4555     i*86)
4556         CPUNAME=INTEL
4557         RTL_ARCH=x86
4558         PLATFORMID=openbsd_x86
4559         ;;
4560     x86_64)
4561         CPUNAME=X86_64
4562         RTL_ARCH=X86_64
4563         PLATFORMID=openbsd_x86_64
4564         ;;
4565     *)
4566         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4567         ;;
4568     esac
4569     SOLARINC="$SOLARINC -I/usr/local/include"
4570     ;;
4572 solaris*)
4573     COM=GCC
4574     USING_X11=TRUE
4575     OS=SOLARIS
4576     RTL_OS=Solaris
4577     P_SEP=:
4579     case "$host_cpu" in
4580     i*86)
4581         CPUNAME=INTEL
4582         RTL_ARCH=x86
4583         PLATFORMID=solaris_x86
4584         ;;
4585     sparc)
4586         CPUNAME=SPARC
4587         RTL_ARCH=SPARC
4588         PLATFORMID=solaris_sparc
4589         ;;
4590     sparc64)
4591         CPUNAME=SPARC64
4592         RTL_ARCH=SPARC64
4593         PLATFORMID=solaris_sparc64
4594         ;;
4595     *)
4596         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4597         ;;
4598     esac
4599     SOLARINC="$SOLARINC -I/usr/local/include"
4600     ;;
4603     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4604     ;;
4605 esac
4607 if test "$with_x" = "no"; then
4608     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4611 DISABLE_GUI=""
4612 if test "$enable_gui" = "no"; then
4613     if test "$USING_X11" != TRUE; then
4614         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4615     fi
4616     USING_X11=
4617     DISABLE_GUI=TRUE
4618     AC_DEFINE(HAVE_FEATURE_UI,0)
4619     test_cairo=yes
4621 AC_SUBST(DISABLE_GUI)
4623 WORKDIR="${BUILDDIR}/workdir"
4624 INSTDIR="${BUILDDIR}/instdir"
4625 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4626 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4627 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4628 AC_SUBST(COM)
4629 AC_SUBST(CPUNAME)
4630 AC_SUBST(RTL_OS)
4631 AC_SUBST(RTL_ARCH)
4632 AC_SUBST(EPM_FLAGS)
4633 AC_SUBST(USING_X11)
4634 AC_SUBST([INSTDIR])
4635 AC_SUBST([INSTROOT])
4636 AC_SUBST([INSTROOTBASE])
4637 AC_SUBST(OS)
4638 AC_SUBST(P_SEP)
4639 AC_SUBST(WORKDIR)
4640 AC_SUBST(PLATFORMID)
4641 AC_SUBST(WINDOWS_X64)
4642 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4644 dnl ===================================================================
4645 dnl Test which package format to use
4646 dnl ===================================================================
4647 AC_MSG_CHECKING([which package format to use])
4648 if test -n "$with_package_format" -a "$with_package_format" != no; then
4649     for i in $with_package_format; do
4650         case "$i" in
4651         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4652             ;;
4653         *)
4654             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4655 aix - AIX software distribution
4656 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4657 deb - Debian software distribution
4658 pkg - Solaris software distribution
4659 rpm - RedHat software distribution
4661 LibreOffice additionally supports:
4662 archive - .tar.gz or .zip
4663 dmg - macOS .dmg
4664 installed - installation tree
4665 msi - Windows .msi
4666         ])
4667             ;;
4668         esac
4669     done
4670     # fakeroot is needed to ensure correct file ownerships/permissions
4671     # inside deb packages and tar archives created on Linux and Solaris.
4672     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4673         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4674         if test "$FAKEROOT" = "no"; then
4675             AC_MSG_ERROR(
4676                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4677         fi
4678     fi
4679     PKGFORMAT="$with_package_format"
4680     AC_MSG_RESULT([$PKGFORMAT])
4681 else
4682     PKGFORMAT=
4683     AC_MSG_RESULT([none])
4685 AC_SUBST(PKGFORMAT)
4687 dnl ===================================================================
4688 dnl Set up a different compiler to produce tools to run on the build
4689 dnl machine when doing cross-compilation
4690 dnl ===================================================================
4692 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4693 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4694 if test "$cross_compiling" = "yes"; then
4695     AC_MSG_CHECKING([for BUILD platform configuration])
4696     echo
4697     rm -rf CONF-FOR-BUILD config_build.mk
4698     mkdir CONF-FOR-BUILD
4699     # Here must be listed all files needed when running the configure script. In particular, also
4700     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4701     # keep them in the same order as there.
4702     (cd $SRC_ROOT && tar cf - \
4703         config.guess \
4704         bin/get_config_variables \
4705         solenv/bin/getcompver.awk \
4706         solenv/inc/langlist.mk \
4707         download.lst \
4708         config_host.mk.in \
4709         config_host_lang.mk.in \
4710         Makefile.in \
4711         bin/bffvalidator.sh.in \
4712         bin/odfvalidator.sh.in \
4713         bin/officeotron.sh.in \
4714         instsetoo_native/util/openoffice.lst.in \
4715         config_host/*.in \
4716         sysui/desktop/macosx/Info.plist.in) \
4717     | (cd CONF-FOR-BUILD && tar xf -)
4718     cp configure CONF-FOR-BUILD
4719     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4720     (
4721     unset COM USING_X11 OS CPUNAME
4722     unset CC CXX SYSBASE CFLAGS
4723     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4724     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4725     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4726     if test -n "$CC_FOR_BUILD"; then
4727         export CC="$CC_FOR_BUILD"
4728         CC_BASE=`first_arg_basename "$CC"`
4729     fi
4730     if test -n "$CXX_FOR_BUILD"; then
4731         export CXX="$CXX_FOR_BUILD"
4732         CXX_BASE=`first_arg_basename "$CXX"`
4733     fi
4734     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4735     cd CONF-FOR-BUILD
4736     sub_conf_opts=""
4737     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4738     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4739     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4740     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4741     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4742     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4743     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4744     # Don't bother having configure look for stuff not needed for the build platform anyway
4745     ./configure \
4746         --disable-cups \
4747         --disable-gstreamer-1-0 \
4748         --disable-gtk3 \
4749         --disable-pdfimport \
4750         --disable-postgresql-sdbc \
4751         --with-parallelism="$with_parallelism" \
4752         --without-doxygen \
4753         --without-java \
4754         $sub_conf_opts \
4755         --srcdir=$srcdir \
4756         2>&1 | sed -e 's/^/    /'
4757     test -f ./config_host.mk 2>/dev/null || exit
4758     cp config_host.mk ../config_build.mk
4759     cp config_host_lang.mk ../config_build_lang.mk
4760     mv config.log ../config.Build.log
4761     mkdir -p ../config_build
4762     mv config_host/*.h ../config_build
4763     . ./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
4765     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
4766         VV='$'$V
4767         VV=`eval "echo $VV"`
4768         if test -n "$VV"; then
4769             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4770             echo "$line" >>build-config
4771         fi
4772     done
4774     for V in INSTDIR INSTROOT WORKDIR; do
4775         VV='$'$V
4776         VV=`eval "echo $VV"`
4777         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4778         if test -n "$VV"; then
4779             line="${V}_FOR_BUILD='$VV'"
4780             echo "$line" >>build-config
4781         fi
4782     done
4784     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4785     echo "$line" >>build-config
4787     )
4788     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4789     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])
4790     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4791              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4793     eval `cat CONF-FOR-BUILD/build-config`
4795     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4797     rm -rf CONF-FOR-BUILD
4798 else
4799     OS_FOR_BUILD="$OS"
4800     CC_FOR_BUILD="$CC"
4801     CXX_FOR_BUILD="$CXX"
4802     INSTDIR_FOR_BUILD="$INSTDIR"
4803     INSTROOT_FOR_BUILD="$INSTROOT"
4804     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4805     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4806     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4807     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4808     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4809     WORKDIR_FOR_BUILD="$WORKDIR"
4811 AC_SUBST(OS_FOR_BUILD)
4812 AC_SUBST(INSTDIR_FOR_BUILD)
4813 AC_SUBST(INSTROOT_FOR_BUILD)
4814 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4815 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4816 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4817 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4818 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4819 AC_SUBST(WORKDIR_FOR_BUILD)
4821 dnl ===================================================================
4822 dnl Check for syslog header
4823 dnl ===================================================================
4824 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4826 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4827 dnl ===================================================================
4828 AC_MSG_CHECKING([whether to turn warnings to errors])
4829 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4830     ENABLE_WERROR="TRUE"
4831     AC_MSG_RESULT([yes])
4832 else
4833     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4834         ENABLE_WERROR="TRUE"
4835         AC_MSG_RESULT([yes])
4836     else
4837         AC_MSG_RESULT([no])
4838     fi
4840 AC_SUBST(ENABLE_WERROR)
4842 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4843 dnl ===================================================================
4844 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4845 if test -z "$enable_assert_always_abort"; then
4846    if test "$ENABLE_DEBUG" = TRUE; then
4847        enable_assert_always_abort=yes
4848    else
4849        enable_assert_always_abort=no
4850    fi
4852 if test "$enable_assert_always_abort" = "yes"; then
4853     ASSERT_ALWAYS_ABORT="TRUE"
4854     AC_MSG_RESULT([yes])
4855 else
4856     ASSERT_ALWAYS_ABORT="FALSE"
4857     AC_MSG_RESULT([no])
4859 AC_SUBST(ASSERT_ALWAYS_ABORT)
4861 # Determine whether to use ooenv for the instdir installation
4862 # ===================================================================
4863 if test $_os != "WINNT" -a $_os != "Darwin"; then
4864     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4865     if test "$enable_ooenv" = "no"; then
4866         AC_MSG_RESULT([no])
4867     else
4868         ENABLE_OOENV="TRUE"
4869         AC_MSG_RESULT([yes])
4870     fi
4872 AC_SUBST(ENABLE_OOENV)
4874 if test "$USING_X11" != TRUE; then
4875     # be sure to do not mess with unneeded stuff
4876     test_randr=no
4877     test_xrender=no
4878     test_cups=no
4879     test_dbus=no
4880     build_gstreamer_1_0=no
4881     test_kf5=no
4882     test_qt5=no
4883     test_gtk3_kde5=no
4884     enable_cairo_canvas=no
4887 if test "$OS" = "HAIKU"; then
4888     enable_cairo_canvas=yes
4889     test_kf5=yes
4892 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4893     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!])
4894     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!"
4895     enable_kf5=yes
4898 if test "$test_kf5" = "yes"; then
4899     test_qt5=yes
4902 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4903     if test "$enable_qt5" = "no"; then
4904         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4905     else
4906         enable_qt5=yes
4907     fi
4910 dnl ===================================================================
4911 dnl check for cups support
4912 dnl ===================================================================
4913 ENABLE_CUPS=""
4915 if test "$enable_cups" = "no"; then
4916     test_cups=no
4919 AC_MSG_CHECKING([whether to enable CUPS support])
4920 if test "$test_cups" = "yes"; then
4921     ENABLE_CUPS="TRUE"
4922     AC_MSG_RESULT([yes])
4924     AC_MSG_CHECKING([whether cups support is present])
4925     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4926     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4927     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4928         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4929     fi
4931 else
4932     AC_MSG_RESULT([no])
4935 AC_SUBST(ENABLE_CUPS)
4937 # fontconfig checks
4938 if test "$test_fontconfig" = "yes"; then
4939     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4940     SYSTEM_FONTCONFIG=TRUE
4941     FilterLibs "${FONTCONFIG_LIBS}"
4942     FONTCONFIG_LIBS="${filteredlibs}"
4944 AC_SUBST(FONTCONFIG_CFLAGS)
4945 AC_SUBST(FONTCONFIG_LIBS)
4946 AC_SUBST([SYSTEM_FONTCONFIG])
4948 dnl whether to find & fetch external tarballs?
4949 dnl ===================================================================
4950 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4951    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4952        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4953    else
4954        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4955    fi
4957 if test -z "$TARFILE_LOCATION"; then
4958     if test -d "$SRC_ROOT/src" ; then
4959         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4960         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4961     fi
4962     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4963 else
4964     AbsolutePath "$TARFILE_LOCATION"
4965     PathFormat "${absolute_path}"
4966     TARFILE_LOCATION="${formatted_path}"
4968 AC_SUBST(TARFILE_LOCATION)
4970 AC_MSG_CHECKING([whether we want to fetch tarballs])
4971 if test "$enable_fetch_external" != "no"; then
4972     if test "$with_all_tarballs" = "yes"; then
4973         AC_MSG_RESULT([yes, all of them])
4974         DO_FETCH_TARBALLS="ALL"
4975     else
4976         AC_MSG_RESULT([yes, if we use them])
4977         DO_FETCH_TARBALLS="TRUE"
4978     fi
4979 else
4980     AC_MSG_RESULT([no])
4981     DO_FETCH_TARBALLS=
4983 AC_SUBST(DO_FETCH_TARBALLS)
4985 AC_MSG_CHECKING([whether to build help])
4986 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4987     BUILD_TYPE="$BUILD_TYPE HELP"
4988     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4989     case "$with_help" in
4990     "html")
4991         ENABLE_HTMLHELP=TRUE
4992         SCPDEFS="$SCPDEFS -DWITH_HELP"
4993         AC_MSG_RESULT([HTML])
4994         ;;
4995     "online")
4996         ENABLE_HTMLHELP=TRUE
4997         HELP_ONLINE=TRUE
4998         AC_MSG_RESULT([HTML])
4999         ;;
5000     yes)
5001         SCPDEFS="$SCPDEFS -DWITH_HELP"
5002         AC_MSG_RESULT([yes])
5003         ;;
5004     *)
5005         AC_MSG_ERROR([Unknown --with-help=$with_help])
5006         ;;
5007     esac
5008 else
5009     AC_MSG_RESULT([no])
5011 AC_SUBST([ENABLE_HTMLHELP])
5012 AC_SUBST([HELP_ONLINE])
5014 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5015 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5016     BUILD_TYPE="$BUILD_TYPE HELP"
5017     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5018     case "$with_omindex" in
5019     "server")
5020         ENABLE_HTMLHELP=TRUE
5021         HELP_ONLINE=TRUE
5022         HELP_OMINDEX_PAGE=TRUE
5023         AC_MSG_RESULT([SERVER])
5024         ;;
5025     "noxap")
5026         ENABLE_HTMLHELP=TRUE
5027         HELP_ONLINE=TRUE
5028         HELP_OMINDEX_PAGE=FALSE
5029         AC_MSG_RESULT([NOXAP])
5030         ;;
5031     *)
5032         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5033         ;;
5034     esac
5035 else
5036     HELP_OMINDEX_PAGE=FALSE
5037     AC_MSG_RESULT([no])
5039 AC_SUBST([ENABLE_HTMLHELP])
5040 AC_SUBST([HELP_OMINDEX_PAGE])
5041 AC_SUBST([HELP_ONLINE])
5044 dnl Test whether to include MySpell dictionaries
5045 dnl ===================================================================
5046 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5047 if test "$with_myspell_dicts" = "yes"; then
5048     AC_MSG_RESULT([yes])
5049     WITH_MYSPELL_DICTS=TRUE
5050     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5051     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5052 else
5053     AC_MSG_RESULT([no])
5054     WITH_MYSPELL_DICTS=
5056 AC_SUBST(WITH_MYSPELL_DICTS)
5058 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5059 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5060     if test "$with_system_dicts" = yes; then
5061         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5062     fi
5063     with_system_dicts=no
5066 AC_MSG_CHECKING([whether to use dicts from external paths])
5067 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5068     AC_MSG_RESULT([yes])
5069     SYSTEM_DICTS=TRUE
5070     AC_MSG_CHECKING([for spelling dictionary directory])
5071     if test -n "$with_external_dict_dir"; then
5072         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5073     else
5074         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5075         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5076             DICT_SYSTEM_DIR=file:///usr/share/myspell
5077         fi
5078     fi
5079     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5080     AC_MSG_CHECKING([for hyphenation patterns directory])
5081     if test -n "$with_external_hyph_dir"; then
5082         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5083     else
5084         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5085     fi
5086     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5087     AC_MSG_CHECKING([for thesaurus directory])
5088     if test -n "$with_external_thes_dir"; then
5089         THES_SYSTEM_DIR=file://$with_external_thes_dir
5090     else
5091         THES_SYSTEM_DIR=file:///usr/share/mythes
5092     fi
5093     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5094 else
5095     AC_MSG_RESULT([no])
5096     SYSTEM_DICTS=
5098 AC_SUBST(SYSTEM_DICTS)
5099 AC_SUBST(DICT_SYSTEM_DIR)
5100 AC_SUBST(HYPH_SYSTEM_DIR)
5101 AC_SUBST(THES_SYSTEM_DIR)
5103 dnl ===================================================================
5104 dnl Precompiled headers.
5105 ENABLE_PCH=""
5106 AC_MSG_CHECKING([whether to enable pch feature])
5107 if test -z "$enable_pch"; then
5108     if test "$_os" = "WINNT"; then
5109         # Enabled by default on Windows.
5110         enable_pch=yes
5111     else
5112         enable_pch=no
5113     fi
5115 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5116     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5118 if test "$enable_pch" = "system"; then
5119     ENABLE_PCH="1"
5120     AC_MSG_RESULT([yes (system headers)])
5121 elif test "$enable_pch" = "base"; then
5122     ENABLE_PCH="2"
5123     AC_MSG_RESULT([yes (system and base headers)])
5124 elif test "$enable_pch" = "normal"; then
5125     ENABLE_PCH="3"
5126     AC_MSG_RESULT([yes (normal)])
5127 elif test "$enable_pch" = "full"; then
5128     ENABLE_PCH="4"
5129     AC_MSG_RESULT([yes (full)])
5130 elif test "$enable_pch" = "yes"; then
5131     # Pick a suitable default.
5132     if test "$GCC" = "yes"; then
5133         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5134         # while making the PCHs larger and rebuilds more likely.
5135         ENABLE_PCH="2"
5136         AC_MSG_RESULT([yes (system and base headers)])
5137     else
5138         # With MSVC the highest level makes a significant difference,
5139         # and it was the default when there used to be no PCH levels.
5140         ENABLE_PCH="4"
5141         AC_MSG_RESULT([yes (full)])
5142     fi
5143 elif test "$enable_pch" = "no"; then
5144     AC_MSG_RESULT([no])
5145 else
5146     AC_MSG_ERROR([Unknown value for --enable-pch])
5148 AC_SUBST(ENABLE_PCH)
5149 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5150 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5151     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5152     if test "$CCACHE_BIN" != "not found"; then
5153         AC_MSG_CHECKING([ccache version])
5154         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5155         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5156         AC_MSG_RESULT([$CCACHE_VERSION])
5157         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5158         if test "$CCACHE_NUMVER" -gt "030701"; then
5159             AC_MSG_RESULT([yes])
5160         else
5161             AC_MSG_RESULT([no (not newer than 3.7.1)])
5162             CCACHE_DEPEND_MODE=
5163         fi
5164     fi
5167 TAB=`printf '\t'`
5169 AC_MSG_CHECKING([the GNU Make version])
5170 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5171 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5172 if test "$_make_longver" -ge "038200"; then
5173     AC_MSG_RESULT([$GNUMAKE $_make_version])
5175 elif test "$_make_longver" -ge "038100"; then
5176     if test "$build_os" = "cygwin"; then
5177         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5178     fi
5179     AC_MSG_RESULT([$GNUMAKE $_make_version])
5181     dnl ===================================================================
5182     dnl Search all the common names for sha1sum
5183     dnl ===================================================================
5184     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5185     if test -z "$SHA1SUM"; then
5186         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5187     elif test "$SHA1SUM" = "openssl"; then
5188         SHA1SUM="openssl sha1"
5189     fi
5190     AC_MSG_CHECKING([for GNU Make bug 20033])
5191     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5192     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5193 A := \$(wildcard *.a)
5195 .PHONY: all
5196 all: \$(A:.a=.b)
5197 <TAB>@echo survived bug20033.
5199 .PHONY: setup
5200 setup:
5201 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5203 define d1
5204 @echo lala \$(1)
5205 @sleep 1
5206 endef
5208 define d2
5209 @echo tyty \$(1)
5210 @sleep 1
5211 endef
5213 %.b : %.a
5214 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5215 <TAB>\$(call d1,\$(CHECKSUM)),\
5216 <TAB>\$(call d2,\$(CHECKSUM)))
5218     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5219         no_parallelism_make="YES"
5220         AC_MSG_RESULT([yes, disable parallelism])
5221     else
5222         AC_MSG_RESULT([no, keep parallelism enabled])
5223     fi
5224     rm -rf $TESTGMAKEBUG20033
5225 else
5226     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5229 # find if gnumake support file function
5230 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5231 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5232 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5233     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5235 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5236 \$(file >test.txt,Success )
5238 .PHONY: all
5239 all:
5240 <TAB>@cat test.txt
5243 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5244 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5245     HAVE_GNUMAKE_FILE_FUNC=TRUE
5246     AC_MSG_RESULT([yes])
5247 else
5248     AC_MSG_RESULT([no])
5250 rm -rf $TESTGMAKEFILEFUNC
5251 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5252 AC_SUBST(GNUMAKE_WIN_NATIVE)
5254 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5255 STALE_MAKE=
5256 if test "$_make_ver_check" = ""; then
5257    STALE_MAKE=TRUE
5260 HAVE_LD_HASH_STYLE=FALSE
5261 WITH_LINKER_HASH_STYLE=
5262 AC_MSG_CHECKING([for --hash-style gcc linker support])
5263 if test "$GCC" = "yes"; then
5264     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5265         hash_styles="gnu sysv"
5266     elif test "$with_linker_hash_style" = "no"; then
5267         hash_styles=
5268     else
5269         hash_styles="$with_linker_hash_style"
5270     fi
5272     for hash_style in $hash_styles; do
5273         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5274         hash_style_ldflags_save=$LDFLAGS
5275         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5277         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5278             [
5279 #include <stdio.h>
5280             ],[
5281 printf ("");
5282             ])],
5283             [
5284                   HAVE_LD_HASH_STYLE=TRUE
5285                   WITH_LINKER_HASH_STYLE=$hash_style
5286             ],
5287             [HAVE_LD_HASH_STYLE=FALSE],
5288             [HAVE_LD_HASH_STYLE=FALSE])
5289         LDFLAGS=$hash_style_ldflags_save
5290     done
5292     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5293         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5294     else
5295         AC_MSG_RESULT( no )
5296     fi
5297     LDFLAGS=$hash_style_ldflags_save
5298 else
5299     AC_MSG_RESULT( no )
5301 AC_SUBST(HAVE_LD_HASH_STYLE)
5302 AC_SUBST(WITH_LINKER_HASH_STYLE)
5304 dnl ===================================================================
5305 dnl Check whether there's a Perl version available.
5306 dnl ===================================================================
5307 if test -z "$with_perl_home"; then
5308     AC_PATH_PROG(PERL, perl)
5309 else
5310     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5311     _perl_path="$with_perl_home/bin/perl"
5312     if test -x "$_perl_path"; then
5313         PERL=$_perl_path
5314     else
5315         AC_MSG_ERROR([$_perl_path not found])
5316     fi
5319 dnl ===================================================================
5320 dnl Testing for Perl version 5 or greater.
5321 dnl $] is the Perl version variable, it is returned as an integer
5322 dnl ===================================================================
5323 if test "$PERL"; then
5324     AC_MSG_CHECKING([the Perl version])
5325     ${PERL} -e "exit($]);"
5326     _perl_version=$?
5327     if test "$_perl_version" -lt 5; then
5328         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5329     fi
5330     AC_MSG_RESULT([Perl $_perl_version])
5331 else
5332     AC_MSG_ERROR([Perl not found, install Perl 5])
5335 dnl ===================================================================
5336 dnl Testing for required Perl modules
5337 dnl ===================================================================
5339 AC_MSG_CHECKING([for required Perl modules])
5340 perl_use_string="use Cwd ; use Digest::MD5"
5341 if test "$_os" = "WINNT"; then
5342     if test -n "$PKGFORMAT"; then
5343         for i in $PKGFORMAT; do
5344             case "$i" in
5345             msi)
5346                 # for getting fonts versions to use in MSI
5347                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5348                 ;;
5349             esac
5350         done
5351     fi
5353 if test "$with_system_hsqldb" = "yes"; then
5354     perl_use_string="$perl_use_string ; use Archive::Zip"
5356 if test "$with_system_openssl" != "yes"; then
5357     # OpenSSL needs that to build
5358     perl_use_string="$perl_use_string ; use FindBin"
5360 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5361     AC_MSG_RESULT([all modules found])
5362 else
5363     AC_MSG_RESULT([failed to find some modules])
5364     # Find out which modules are missing.
5365     for i in $perl_use_string; do
5366         if test "$i" != "use" -a "$i" != ";"; then
5367             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5368                 missing_perl_modules="$missing_perl_modules $i"
5369             fi
5370         fi
5371     done
5372     AC_MSG_ERROR([
5373     The missing Perl modules are: $missing_perl_modules
5374     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5377 dnl ===================================================================
5378 dnl Check for pkg-config
5379 dnl ===================================================================
5380 if test "$_os" != "WINNT"; then
5381     PKG_PROG_PKG_CONFIG
5384 if test "$_os" != "WINNT"; then
5386     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5387     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5388     # explicitly. Or put /path/to/compiler in PATH yourself.
5390     # Use wrappers for LTO
5391     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5392         AC_CHECK_TOOL(AR,gcc-ar)
5393         AC_CHECK_TOOL(NM,gcc-nm)
5394         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5395     else
5396         AC_CHECK_TOOL(AR,ar)
5397         AC_CHECK_TOOL(NM,nm)
5398         AC_CHECK_TOOL(RANLIB,ranlib)
5399     fi
5400     AC_CHECK_TOOL(OBJDUMP,objdump)
5401     AC_CHECK_TOOL(READELF,readelf)
5402     AC_CHECK_TOOL(STRIP,strip)
5403     if test "$_os" = "WINNT"; then
5404         AC_CHECK_TOOL(DLLTOOL,dlltool)
5405         AC_CHECK_TOOL(WINDRES,windres)
5406     fi
5408 AC_SUBST(AR)
5409 AC_SUBST(DLLTOOL)
5410 AC_SUBST(NM)
5411 AC_SUBST(OBJDUMP)
5412 AC_SUBST(PKG_CONFIG)
5413 AC_SUBST(RANLIB)
5414 AC_SUBST(READELF)
5415 AC_SUBST(STRIP)
5416 AC_SUBST(WINDRES)
5418 dnl ===================================================================
5419 dnl pkg-config checks on macOS
5420 dnl ===================================================================
5422 if test $_os = Darwin; then
5423     AC_MSG_CHECKING([for bogus pkg-config])
5424     if test -n "$PKG_CONFIG"; then
5425         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5426             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5427         else
5428             if test "$enable_bogus_pkg_config" = "yes"; then
5429                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5430             else
5431                 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.])
5432             fi
5433         fi
5434     else
5435         AC_MSG_RESULT([no, good])
5436     fi
5439 find_csc()
5441     # Return value: $csctest
5443     unset csctest
5445     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5446     if test -n "$regvalue"; then
5447         csctest=$regvalue
5448         return
5449     fi
5452 find_al()
5454     # Return value: $altest
5456     unset altest
5458     # We need this check to detect 4.6.1 or above.
5459     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5460         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5461         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5462             altest=$regvalue
5463             return
5464         fi
5465     done
5467     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5468         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5469         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5470             altest=$regvalue
5471             return
5472         fi
5473     done
5478 find_dotnetsdk46()
5480     unset frametest
5482     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5483         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5484         if test -n "$regvalue"; then
5485             frametest=$regvalue
5486             return
5487         fi
5488     done
5491 find_winsdk_version()
5493     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5494     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5496     unset winsdktest winsdkbinsubdir winsdklibsubdir
5498     case "$1" in
5499     8.0|8.0A)
5500         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5501         if test -n "$regvalue"; then
5502             winsdktest=$regvalue
5503             winsdklibsubdir=win8
5504             return
5505         fi
5506         ;;
5507     8.1|8.1A)
5508         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5509         if test -n "$regvalue"; then
5510             winsdktest=$regvalue
5511             winsdklibsubdir=winv6.3
5512             return
5513         fi
5514         ;;
5515     10.0)
5516         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5517         if test -n "$regvalue"; then
5518             winsdktest=$regvalue
5519             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5520             if test -n "$regvalue"; then
5521                 winsdkbinsubdir="$regvalue".0
5522                 winsdklibsubdir=$winsdkbinsubdir
5523                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5524                 # test exist the SDK path
5525                 if test -d "$tmppath"; then
5526                    # when path is convertible to a short path then path is okay
5527                    cygpath -d "$tmppath" >/dev/null 2>&1
5528                    if test $? -ne 0; then
5529                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5530                    fi
5531                 else
5532                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5533                 fi
5534             fi
5535             return
5536         fi
5537         ;;
5538     esac
5541 find_winsdk()
5543     # Return value: From find_winsdk_version
5545     unset winsdktest
5547     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5548         find_winsdk_version $ver
5549         if test -n "$winsdktest"; then
5550             return
5551         fi
5552     done
5555 find_msms()
5557     AC_MSG_CHECKING([for MSVC merge modules directory])
5558     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5559     case "$VCVER" in
5560         150|160)
5561         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5562         ;;
5563     esac
5564     for f in $my_msm_files; do
5565         echo "$as_me:$LINENO: searching for $f" >&5
5566     done
5568     msmdir=
5569     for ver in 14.0 15.0; do
5570         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5571         if test -n "$regvalue"; then
5572             for f in ${my_msm_files}; do
5573                 if test -e "$regvalue/${f}"; then
5574                     msmdir=$regvalue
5575                     break
5576                 fi
5577             done
5578         fi
5579     done
5580     dnl Is the following fallback really necessary, or was it added in response
5581     dnl to never having started Visual Studio on a given machine, so the
5582     dnl registry keys checked above had presumably not yet been created?
5583     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5584     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5585     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5586     dnl expanding to "C:\Program Files\Common Files"), which would need
5587     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5588     dnl obtain its value from cygwin:
5589     if test -z "$msmdir"; then
5590         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5591         for f in ${my_msm_files}; do
5592             if test -e "$my_msm_dir/${f}"; then
5593                 msmdir=$my_msm_dir
5594             fi
5595         done
5596     fi
5598     dnl Starting from MSVC 15.0, merge modules are located in different directory
5599     case "$VCVER" in
5600     150|160)
5601         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5602             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5603             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5604             for f in ${my_msm_files}; do
5605                 if test -e "$my_msm_dir/${f}"; then
5606                     msmdir=$my_msm_dir
5607                     break
5608                 fi
5609             done
5610         done
5611         ;;
5612     esac
5614     if test -n "$msmdir"; then
5615         msmdir=`cygpath -m "$msmdir"`
5616         AC_MSG_RESULT([$msmdir])
5617     else
5618         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5619             AC_MSG_FAILURE([not found])
5620         else
5621             AC_MSG_WARN([not found (check config.log)])
5622             add_warning "MSM none of ${my_msm_files} found"
5623         fi
5624     fi
5627 find_msvc_x64_dlls()
5629     AC_MSG_CHECKING([for MSVC x64 DLL path])
5630     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5631     case "$VCVER" in
5632     150|160)
5633         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5634             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5635             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5636                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5637                 break
5638             fi
5639             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5640             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5641                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5642                 break
5643             fi
5644             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5645             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5646                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5647                 break
5648             fi
5649         done
5650         ;;
5651     esac
5652     AC_MSG_RESULT([$msvcdllpath])
5653     AC_MSG_CHECKING([for MSVC x64 DLLs])
5654     msvcdlls="msvcp140.dll vcruntime140.dll"
5655     for dll in $msvcdlls; do
5656         if ! test -f "$msvcdllpath/$dll"; then
5657             AC_MSG_FAILURE([missing $dll])
5658         fi
5659     done
5660     AC_MSG_RESULT([found all ($msvcdlls)])
5663 dnl =========================================
5664 dnl Check for the Windows  SDK.
5665 dnl =========================================
5666 if test "$_os" = "WINNT"; then
5667     AC_MSG_CHECKING([for Windows SDK])
5668     if test "$build_os" = "cygwin"; then
5669         find_winsdk
5670         WINDOWS_SDK_HOME=$winsdktest
5672         # normalize if found
5673         if test -n "$WINDOWS_SDK_HOME"; then
5674             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5675             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5676         fi
5678         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5679     fi
5681     if test -n "$WINDOWS_SDK_HOME"; then
5682         # Remove a possible trailing backslash
5683         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5685         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5686              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5687              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5688             have_windows_sdk_headers=yes
5689         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5690              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5691              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5692             have_windows_sdk_headers=yes
5693         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5694              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5695              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5696             have_windows_sdk_headers=yes
5697         else
5698             have_windows_sdk_headers=no
5699         fi
5701         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5702             have_windows_sdk_libs=yes
5703         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5704             have_windows_sdk_libs=yes
5705         else
5706             have_windows_sdk_libs=no
5707         fi
5709         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5710             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5711 the  Windows SDK are installed.])
5712         fi
5713     fi
5715     if test -z "$WINDOWS_SDK_HOME"; then
5716         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5717     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5718         WINDOWS_SDK_VERSION=80
5719         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5720     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5721         WINDOWS_SDK_VERSION=81
5722         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5723     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5724         WINDOWS_SDK_VERSION=10
5725         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5726     else
5727         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5728     fi
5729     PathFormat "$WINDOWS_SDK_HOME"
5730     WINDOWS_SDK_HOME="$formatted_path"
5731     if test "$build_os" = "cygwin"; then
5732         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5733         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5734             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5735         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5736             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5737         fi
5738     fi
5740     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5741     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5742     dnl but not in v8.0), so allow this to be overridden with a
5743     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5744     dnl and configuration error if no WiLangId.vbs is found would arguably be
5745     dnl better, but I do not know under which conditions exactly it is needed by
5746     dnl msiglobal.pm:
5747     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5748         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5749         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5750             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5751         fi
5752         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5753             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5754         fi
5755         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5756             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5757         fi
5758     fi
5759     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5760         if test -n "$with_package_format" -a "$with_package_format" != no; then
5761             for i in "$with_package_format"; do
5762                 if test "$i" = "msi"; then
5763                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5764                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5765                     fi
5766                 fi
5767             done
5768         fi
5769     fi
5771 AC_SUBST(WINDOWS_SDK_HOME)
5772 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5773 AC_SUBST(WINDOWS_SDK_VERSION)
5774 AC_SUBST(WINDOWS_SDK_WILANGID)
5776 if test "$build_os" = "cygwin"; then
5777     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5778     dnl dir, it also determines that dir's path w/o an arch segment if any,
5779     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5780     AC_MSG_CHECKING([for midl.exe])
5782     find_winsdk
5783     if test -n "$winsdkbinsubdir" \
5784         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5785     then
5786         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5787         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5788     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5789         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5790         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5791     elif test -f "$winsdktest/Bin/midl.exe"; then
5792         MIDL_PATH=$winsdktest/Bin
5793         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5794     fi
5795     if test ! -f "$MIDL_PATH/midl.exe"; then
5796         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5797     else
5798         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5799     fi
5801     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5802     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5804     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5805          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5806          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5807          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5808     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5809          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5810          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5811          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5812     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5813          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5814          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5815          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5816     else
5817         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5818     fi
5820     dnl Check csc.exe
5821     AC_MSG_CHECKING([for csc.exe])
5822     find_csc
5823     if test -f "$csctest/csc.exe"; then
5824         CSC_PATH="$csctest"
5825     fi
5826     if test ! -f "$CSC_PATH/csc.exe"; then
5827         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5828     else
5829         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5830     fi
5832     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5834     dnl Check al.exe
5835     AC_MSG_CHECKING([for al.exe])
5836     find_winsdk
5837     if test -n "$winsdkbinsubdir" \
5838         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5839     then
5840         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5841     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5842         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5843     elif test -f "$winsdktest/Bin/al.exe"; then
5844         AL_PATH="$winsdktest/Bin"
5845     fi
5847     if test -z "$AL_PATH"; then
5848         find_al
5849         if test -f "$altest/bin/al.exe"; then
5850             AL_PATH="$altest/bin"
5851         elif test -f "$altest/al.exe"; then
5852             AL_PATH="$altest"
5853         fi
5854     fi
5855     if test ! -f "$AL_PATH/al.exe"; then
5856         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5857     else
5858         AC_MSG_RESULT([$AL_PATH/al.exe])
5859     fi
5861     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5863     dnl Check mscoree.lib / .NET Framework dir
5864     AC_MSG_CHECKING(.NET Framework)
5865     find_dotnetsdk46
5866     PathFormat "$frametest"
5867     frametest="$formatted_path"
5868     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5869         DOTNET_FRAMEWORK_HOME="$frametest"
5870     else
5871         find_winsdk
5872         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5873             DOTNET_FRAMEWORK_HOME="$winsdktest"
5874         fi
5875     fi
5876     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
5877         AC_MSG_ERROR([mscoree.lib not found])
5878     fi
5879     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5881     PathFormat "$MIDL_PATH"
5882     MIDL_PATH="$formatted_path"
5884     PathFormat "$AL_PATH"
5885     AL_PATH="$formatted_path"
5887     PathFormat "$DOTNET_FRAMEWORK_HOME"
5888     DOTNET_FRAMEWORK_HOME="$formatted_path"
5890     PathFormat "$CSC_PATH"
5891     CSC_PATH="$formatted_path"
5894 dnl ===================================================================
5895 dnl Check if stdc headers are available excluding MSVC.
5896 dnl ===================================================================
5897 if test "$_os" != "WINNT"; then
5898     AC_HEADER_STDC
5901 dnl ===================================================================
5902 dnl Testing for C++ compiler and version...
5903 dnl ===================================================================
5905 if test "$_os" != "WINNT"; then
5906     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5907     save_CXXFLAGS=$CXXFLAGS
5908     AC_PROG_CXX
5909     CXXFLAGS=$save_CXXFLAGS
5910     if test -z "$CXX_BASE"; then
5911         CXX_BASE=`first_arg_basename "$CXX"`
5912     fi
5915 dnl check for GNU C++ compiler version
5916 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5917     AC_MSG_CHECKING([the GNU C++ compiler version])
5919     _gpp_version=`$CXX -dumpversion`
5920     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5922     if test "$_gpp_majmin" -lt "700"; then
5923         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5924     else
5925         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5926     fi
5928     dnl see https://code.google.com/p/android/issues/detail?id=41770
5929         glibcxx_threads=no
5930         AC_LANG_PUSH([C++])
5931         AC_REQUIRE_CPP
5932         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5933         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5934             #include <bits/c++config.h>]],[[
5935             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5936             && !defined(_GLIBCXX__PTHREADS) \
5937             && !defined(_GLIBCXX_HAS_GTHREADS)
5938             choke me
5939             #endif
5940         ]])],[AC_MSG_RESULT([yes])
5941         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5942         AC_LANG_POP([C++])
5943         if test $glibcxx_threads = yes; then
5944             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5945         fi
5947 AC_SUBST(BOOST_CXXFLAGS)
5950 # prefx CXX with ccache if needed
5952 if test "$CCACHE" != ""; then
5953     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5954     AC_LANG_PUSH([C++])
5955     save_CXXFLAGS=$CXXFLAGS
5956     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5957     dnl an empty program will do, we're checking the compiler flags
5958     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5959                       [use_ccache=yes], [use_ccache=no])
5960     if test $use_ccache = yes; then
5961         AC_MSG_RESULT([yes])
5962     else
5963         CXX="$CCACHE $CXX"
5964         CXX_BASE="ccache $CXX_BASE"
5965         AC_MSG_RESULT([no])
5966     fi
5967     CXXFLAGS=$save_CXXFLAGS
5968     AC_LANG_POP([C++])
5971 dnl ===================================================================
5972 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5973 dnl ===================================================================
5975 if test "$_os" != "WINNT"; then
5976     AC_PROG_CXXCPP
5978     dnl Check whether there's a C pre-processor.
5979     AC_PROG_CPP
5983 dnl ===================================================================
5984 dnl Find integral type sizes and alignments
5985 dnl ===================================================================
5987 if test "$_os" != "WINNT"; then
5989 if test "$_os" = "iOS"; then
5990     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5991     ac_cv_sizeof_long=8
5992     ac_cv_sizeof_short=2
5993     ac_cv_sizeof_int=4
5994     ac_cv_sizeof_long_long=8
5995     ac_cv_sizeof_double=8
5996     ac_cv_sizeof_voidp=8
5997 else
5998     AC_CHECK_SIZEOF(long)
5999     AC_CHECK_SIZEOF(short)
6000     AC_CHECK_SIZEOF(int)
6001     AC_CHECK_SIZEOF(long long)
6002     AC_CHECK_SIZEOF(double)
6003     AC_CHECK_SIZEOF(void*)
6006     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6007     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6008     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6009     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6010     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6012     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6013     m4_pattern_allow([AC_CHECK_ALIGNOF])
6014     m4_ifdef([AC_CHECK_ALIGNOF],
6015         [
6016             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6017             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6018             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6019             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6020         ],
6021         [
6022             case "$_os-$host_cpu" in
6023             Linux-i686)
6024                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6025                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6026                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6027                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6028                 ;;
6029             Linux-x86_64)
6030                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6031                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6032                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6033                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6034                 ;;
6035             *)
6036                 if test -z "$ac_cv_alignof_short" -o \
6037                         -z "$ac_cv_alignof_int" -o \
6038                         -z "$ac_cv_alignof_long" -o \
6039                         -z "$ac_cv_alignof_double"; then
6040                    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.])
6041                 fi
6042                 ;;
6043             esac
6044         ])
6046     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6047     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6048     if test $ac_cv_sizeof_long -eq 8; then
6049         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6050     elif test $ac_cv_sizeof_double -eq 8; then
6051         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6052     else
6053         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6054     fi
6056     dnl Check for large file support
6057     AC_SYS_LARGEFILE
6058     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6059         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6060     fi
6061     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6062         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6063     fi
6064 else
6065     # Hardcode for MSVC
6066     SAL_TYPES_SIZEOFSHORT=2
6067     SAL_TYPES_SIZEOFINT=4
6068     SAL_TYPES_SIZEOFLONG=4
6069     SAL_TYPES_SIZEOFLONGLONG=8
6070     if test "$BITNESS_OVERRIDE" = ""; then
6071         SAL_TYPES_SIZEOFPOINTER=4
6072     else
6073         SAL_TYPES_SIZEOFPOINTER=8
6074     fi
6075     SAL_TYPES_ALIGNMENT2=2
6076     SAL_TYPES_ALIGNMENT4=4
6077     SAL_TYPES_ALIGNMENT8=8
6078     LFS_CFLAGS=''
6080 AC_SUBST(LFS_CFLAGS)
6082 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6083 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6084 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6085 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6086 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6087 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6088 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6089 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6091 dnl ===================================================================
6092 dnl Check whether to enable runtime optimizations
6093 dnl ===================================================================
6094 ENABLE_RUNTIME_OPTIMIZATIONS=
6095 AC_MSG_CHECKING([whether to enable runtime optimizations])
6096 if test -z "$enable_runtime_optimizations"; then
6097     for i in $CC; do
6098         case $i in
6099         -fsanitize=*)
6100             enable_runtime_optimizations=no
6101             break
6102             ;;
6103         esac
6104     done
6106 if test "$enable_runtime_optimizations" != no; then
6107     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6108     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6109     AC_MSG_RESULT([yes])
6110 else
6111     AC_MSG_RESULT([no])
6113 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6115 dnl ===================================================================
6116 dnl Check if valgrind headers are available
6117 dnl ===================================================================
6118 ENABLE_VALGRIND=
6119 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6120     prev_cppflags=$CPPFLAGS
6121     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6122     # or where does it come from?
6123     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6124     AC_CHECK_HEADER([valgrind/valgrind.h],
6125         [ENABLE_VALGRIND=TRUE])
6126     CPPFLAGS=$prev_cppflags
6128 AC_SUBST([ENABLE_VALGRIND])
6129 if test -z "$ENABLE_VALGRIND"; then
6130     if test "$with_valgrind" = yes; then
6131         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6132     fi
6133     VALGRIND_CFLAGS=
6135 AC_SUBST([VALGRIND_CFLAGS])
6138 dnl ===================================================================
6139 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6140 dnl ===================================================================
6142 # We need at least the sys/sdt.h include header.
6143 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6144 if test "$SDT_H_FOUND" = "TRUE"; then
6145     # Found sys/sdt.h header, now make sure the c++ compiler works.
6146     # Old g++ versions had problems with probes in constructors/destructors.
6147     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6148     AC_LANG_PUSH([C++])
6149     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6150     #include <sys/sdt.h>
6151     class ProbeClass
6152     {
6153     private:
6154       int& ref;
6155       const char *name;
6157     public:
6158       ProbeClass(int& v, const char *n) : ref(v), name(n)
6159       {
6160         DTRACE_PROBE2(_test_, cons, name, ref);
6161       }
6163       void method(int min)
6164       {
6165         DTRACE_PROBE3(_test_, meth, name, ref, min);
6166         ref -= min;
6167       }
6169       ~ProbeClass()
6170       {
6171         DTRACE_PROBE2(_test_, dest, name, ref);
6172       }
6173     };
6174     ]],[[
6175     int i = 64;
6176     DTRACE_PROBE1(_test_, call, i);
6177     ProbeClass inst = ProbeClass(i, "call");
6178     inst.method(24);
6179     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6180           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6181     AC_LANG_POP([C++])
6183 AC_CONFIG_HEADERS([config_host/config_probes.h])
6185 dnl ===================================================================
6186 dnl GCC features
6187 dnl ===================================================================
6188 HAVE_GCC_STACK_CLASH_PROTECTION=
6189 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6190     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6191     save_CFLAGS=$CFLAGS
6192     CFLAGS="$CFLAGS -fstack-clash-protection"
6193     AC_LINK_IFELSE(
6194         [AC_LANG_PROGRAM(, [[return 0;]])],
6195         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6196         [AC_MSG_RESULT([no])])
6197     CFLAGS=$save_CFLAGS
6199     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6200     save_CFLAGS=$CFLAGS
6201     CFLAGS="$CFLAGS -Werror -mno-avx"
6202     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6203     CFLAGS=$save_CFLAGS
6204     if test "$HAVE_GCC_AVX" = "TRUE"; then
6205         AC_MSG_RESULT([yes])
6206     else
6207         AC_MSG_RESULT([no])
6208     fi
6210     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6211     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6212     int v = 0;
6213     if (__sync_add_and_fetch(&v, 1) != 1 ||
6214         __sync_sub_and_fetch(&v, 1) != 0)
6215         return 1;
6216     __sync_synchronize();
6217     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6218         v != 1)
6219         return 1;
6220     return 0;
6221 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6222     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6223         AC_MSG_RESULT([yes])
6224         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6225     else
6226         AC_MSG_RESULT([no])
6227     fi
6229     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6230     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6231     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6232         AC_MSG_RESULT([yes])
6233         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6234     else
6235         AC_MSG_RESULT([no])
6236     fi
6238     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6239     save_CFLAGS=$CFLAGS
6240     CFLAGS="$CFLAGS -Werror"
6241     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6242             __attribute__((deprecated("test"))) void f();
6243         ])], [
6244             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6245             AC_MSG_RESULT([yes])
6246         ], [AC_MSG_RESULT([no])])
6247     CFLAGS=$save_CFLAGS
6249     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6250     AC_LANG_PUSH([C++])
6251     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6252             #include <cstddef>
6253             #include <cxxabi.h>
6254             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6255         ])], [
6256             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6257             AC_MSG_RESULT([yes])
6258         ], [AC_MSG_RESULT([no])])
6259     AC_LANG_POP([C++])
6261     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6262     AC_LANG_PUSH([C++])
6263     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6264             #include <cstddef>
6265             #include <cxxabi.h>
6266             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6267         ])], [
6268             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6269             AC_MSG_RESULT([yes])
6270         ], [AC_MSG_RESULT([no])])
6271     AC_LANG_POP([C++])
6273     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6274     AC_LANG_PUSH([C++])
6275     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6276             #include <cxxabi.h>
6277             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6278         ])], [
6279             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6280             AC_MSG_RESULT([yes])
6281         ], [AC_MSG_RESULT([no])])
6282     AC_LANG_POP([C++])
6284     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6285     AC_LANG_PUSH([C++])
6286     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6287             #include <cstddef>
6288             #include <cxxabi.h>
6289             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6290         ])], [
6291             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6292             AC_MSG_RESULT([yes])
6293         ], [AC_MSG_RESULT([no])])
6294     AC_LANG_POP([C++])
6296     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6297     AC_LANG_PUSH([C++])
6298     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6299             #include <cstddef>
6300             #include <cxxabi.h>
6301             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6302         ])], [
6303             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6304             AC_MSG_RESULT([yes])
6305         ], [AC_MSG_RESULT([no])])
6306     AC_LANG_POP([C++])
6308     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6309     AC_LANG_PUSH([C++])
6310     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6311             #include <cxxabi.h>
6312             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6313         ])], [
6314             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6315             AC_MSG_RESULT([yes])
6316         ], [AC_MSG_RESULT([no])])
6317     AC_LANG_POP([C++])
6319     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6320     AC_LANG_PUSH([C++])
6321     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6322             #include <cxxabi.h>
6323             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6324         ])], [
6325             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6326             AC_MSG_RESULT([yes])
6327         ], [AC_MSG_RESULT([no])])
6328     AC_LANG_POP([C++])
6330     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6331     AC_LANG_PUSH([C++])
6332     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6333             #include <cxxabi.h>
6334             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6335         ])], [
6336             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6337             AC_MSG_RESULT([yes])
6338         ], [AC_MSG_RESULT([no])])
6339     AC_LANG_POP([C++])
6341     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6342     AC_LANG_PUSH([C++])
6343     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6344             #include <cstddef>
6345             #include <cxxabi.h>
6346             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6347         ])], [
6348             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6349             AC_MSG_RESULT([yes])
6350         ], [AC_MSG_RESULT([no])])
6351     AC_LANG_POP([C++])
6353     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6354     AC_LANG_PUSH([C++])
6355     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6356             #include <cstddef>
6357             #include <cxxabi.h>
6358             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6359         ])], [
6360             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6361             AC_MSG_RESULT([yes])
6362         ], [AC_MSG_RESULT([no])])
6363     AC_LANG_POP([C++])
6365     dnl Available in GCC 4.9 and at least since Clang 3.4:
6366     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6367     AC_LANG_PUSH([C++])
6368     save_CXXFLAGS=$CXXFLAGS
6369     CXXFLAGS="$CXXFLAGS -Werror"
6370     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6371             struct __attribute__((warn_unused)) dummy {};
6372         ])], [
6373             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6374             AC_MSG_RESULT([yes])
6375         ], [AC_MSG_RESULT([no])])
6376     CXXFLAGS=$save_CXXFLAGS
6377 AC_LANG_POP([C++])
6380 AC_SUBST(HAVE_GCC_AVX)
6381 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6382 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6383 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6385 dnl ===================================================================
6386 dnl Identify the C++ library
6387 dnl ===================================================================
6389 AC_MSG_CHECKING([what the C++ library is])
6390 AC_LANG_PUSH([C++])
6391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6392 #include <utility>
6393 #ifndef __GLIBCXX__
6394 foo bar
6395 #endif
6396 ]])],
6397     [CPP_LIBRARY=GLIBCXX
6398      cpp_library_name="GNU libstdc++"
6399     ],
6400     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6401 #include <utility>
6402 #ifndef _LIBCPP_VERSION
6403 foo bar
6404 #endif
6405 ]])],
6406     [CPP_LIBRARY=LIBCPP
6407      cpp_library_name="LLVM libc++"
6408      AC_DEFINE([HAVE_LIBCXX])
6409     ],
6410     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6411 #include <utility>
6412 #ifndef _MSC_VER
6413 foo bar
6414 #endif
6415 ]])],
6416     [CPP_LIBRARY=MSVCRT
6417      cpp_library_name="Microsoft"
6418     ],
6419     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6420 AC_MSG_RESULT([$cpp_library_name])
6421 AC_LANG_POP([C++])
6423 dnl ===================================================================
6424 dnl Check for gperf
6425 dnl ===================================================================
6426 AC_PATH_PROG(GPERF, gperf)
6427 if test -z "$GPERF"; then
6428     AC_MSG_ERROR([gperf not found but needed. Install it.])
6430 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6431     GPERF=`cygpath -m $GPERF`
6433 AC_MSG_CHECKING([whether gperf is new enough])
6434 my_gperf_ver1=$($GPERF --version | head -n 1)
6435 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6436 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6437 if test "$my_gperf_ver3" -ge 301; then
6438     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6439 else
6440     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6442 AC_SUBST(GPERF)
6444 dnl ===================================================================
6445 dnl Check for system libcmis
6446 dnl ===================================================================
6447 # libcmis requires curl and we can't build curl for iOS
6448 if test $_os != iOS; then
6449     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6450     ENABLE_LIBCMIS=TRUE
6451 else
6452     ENABLE_LIBCMIS=
6454 AC_SUBST(ENABLE_LIBCMIS)
6456 dnl ===================================================================
6457 dnl C++11
6458 dnl ===================================================================
6460 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6461 CXXFLAGS_CXX11=
6462 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6463     if test "$with_latest_c__" = yes; then
6464         CXXFLAGS_CXX11=-std:c++latest
6465     else
6466         CXXFLAGS_CXX11=-std:c++17
6467     fi
6468     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6469 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6470     my_flags='-std=c++17 -std=c++1z'
6471     if test "$with_latest_c__" = yes; then
6472         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6473     fi
6474     for flag in $my_flags; do
6475         if test "$COM" = MSC; then
6476             flag="-Xclang $flag"
6477         fi
6478         save_CXXFLAGS=$CXXFLAGS
6479         CXXFLAGS="$CXXFLAGS $flag -Werror"
6480         if test "$SYSTEM_LIBCMIS" = TRUE; then
6481             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6482         fi
6483         AC_LANG_PUSH([C++])
6484         dnl Clang 3.9 supports __float128 since
6485         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6486         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6487         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6488         dnl $flag is supported below, so check this first):
6489         my_float128hack=
6490         my_float128hack_impl=-D__float128=void
6491         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6492             #include <vector>
6493             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6494             // (__float128)
6495             ]])
6496         ],,[
6497             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6498             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6499             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6500             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6501             dnl place where __float128 is used is in a template specialization, -D__float128=void
6502             dnl will avoid the problem there while still causing a problem if somebody actually uses
6503             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6504             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6505             dnl "fixed" with this hack):
6506             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6507             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6508                 #include <vector>
6509                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6510                 // (__float128)
6511                 ]])
6512             ],[my_float128hack=$my_float128hack_impl])
6513         ])
6514         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6515             #include <algorithm>
6516             #include <functional>
6517             #include <vector>
6519             #if defined SYSTEM_LIBCMIS
6520             // See ucb/source/ucp/cmis/auth_provider.hxx:
6521             #if !defined __clang__
6522             #pragma GCC diagnostic push
6523             #pragma GCC diagnostic ignored "-Wdeprecated"
6524             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6525             #endif
6526             #include <libcmis/libcmis.hxx>
6527             #if !defined __clang__
6528             #pragma GCC diagnostic pop
6529             #endif
6530             #endif
6532             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6533                 std::sort(v.begin(), v.end(), fn);
6534             }
6535             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6536         AC_LANG_POP([C++])
6537         CXXFLAGS=$save_CXXFLAGS
6538         if test -n "$CXXFLAGS_CXX11"; then
6539             break
6540         fi
6541     done
6543 if test -n "$CXXFLAGS_CXX11"; then
6544     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6545 else
6546     AC_MSG_ERROR(no)
6548 AC_SUBST(CXXFLAGS_CXX11)
6550 if test "$GCC" = "yes"; then
6551     save_CXXFLAGS=$CXXFLAGS
6552     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6553     CHECK_L_ATOMIC
6554     CXXFLAGS=$save_CXXFLAGS
6555     AC_SUBST(ATOMIC_LIB)
6558 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6559 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6560 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6561 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6562 dnl again towards 4.7.2:
6563 if test $CPP_LIBRARY = GLIBCXX; then
6564     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6565     AC_LANG_PUSH([C++])
6566     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6567 #include <list>
6568 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6569     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6570     //   GCC 4.7.0: 20120322
6571     //   GCC 4.7.1: 20120614
6572     // and using a range check is not possible as the mapping between
6573     // __GLIBCXX__ values and GCC versions is not monotonic
6574 /* ok */
6575 #else
6576 abi broken
6577 #endif
6578         ]])], [AC_MSG_RESULT(no, ok)],
6579         [AC_MSG_ERROR(yes)])
6580     AC_LANG_POP([C++])
6583 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6584 save_CXXFLAGS=$CXXFLAGS
6585 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6586 AC_LANG_PUSH([C++])
6588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6589 #include <stddef.h>
6591 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6593 namespace
6595         struct b
6596         {
6597                 int i;
6598                 int j;
6599         };
6601 ]], [[
6602 struct a
6604         int i;
6605         int j;
6607 a thinga[]={{0,0}, {1,1}};
6608 b thingb[]={{0,0}, {1,1}};
6609 size_t i = sizeof(sal_n_array_size(thinga));
6610 size_t j = sizeof(sal_n_array_size(thingb));
6611 return !(i != 0 && j != 0);
6613     ], [ AC_MSG_RESULT(yes) ],
6614     [ AC_MSG_ERROR(no)])
6615 AC_LANG_POP([C++])
6616 CXXFLAGS=$save_CXXFLAGS
6618 dnl _Pragma support (may require C++11)
6619 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6620     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6621     AC_LANG_PUSH([C++])
6622     save_CXXFLAGS=$CXXFLAGS
6623     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6624     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6625             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6626         ])], [
6627             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6628             AC_MSG_RESULT([yes])
6629         ], [AC_MSG_RESULT([no])])
6630     AC_LANG_POP([C++])
6631     CXXFLAGS=$save_CXXFLAGS
6634 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6635 if test "$GCC" = yes; then
6636     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6637     AC_LANG_PUSH([C++])
6638     save_CXXFLAGS=$CXXFLAGS
6639     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6640     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6641     CXXFLAGS=$save_CXXFLAGS
6642     AC_LANG_POP([C++])
6643     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6644         AC_MSG_RESULT([yes])
6645     else
6646         AC_MSG_RESULT([no])
6647     fi
6649 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6651 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6652 AC_LANG_PUSH([C++])
6653 save_CXXFLAGS=$CXXFLAGS
6654 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6655 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6656         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6657         // supporting it:
6658         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6659         struct S {
6660         private:
6661             S(S const &);
6662         public:
6663             S();
6664             ~S();
6665         };
6666         S copy();
6667         void f() { S c(copy()); }
6668         #endif
6669     ])], [
6670         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6671         AC_MSG_RESULT([yes])
6672     ], [AC_MSG_RESULT([no])])
6673 CXXFLAGS=$save_CXXFLAGS
6674 AC_LANG_POP([C++])
6676 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6677 AC_LANG_PUSH([C++])
6678 save_CXXFLAGS=$CXXFLAGS
6679 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6680 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6681         #include <algorithm>
6682         #include <initializer_list>
6683         #include <vector>
6684         template<typename T> class S {
6685         private:
6686             std::vector<T> v_;
6687         public:
6688             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6689         };
6690         constinit S<int> s{3, 2, 1};
6691     ])], [
6692         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6693         AC_MSG_RESULT([yes])
6694     ], [AC_MSG_RESULT([no])])
6695 CXXFLAGS=$save_CXXFLAGS
6696 AC_LANG_POP([C++])
6698 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6699 AC_LANG_PUSH([C++])
6700 save_CXXFLAGS=$CXXFLAGS
6701 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6702 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6703         #include <span>
6704         #include <type_traits>
6705         // Don't check size_type directly, as it was called index_type before P1872R0:
6706         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6707     ])], [
6708         AC_DEFINE([HAVE_CPP_SPAN],[1])
6709         AC_MSG_RESULT([yes])
6710     ], [AC_MSG_RESULT([no])])
6711 CXXFLAGS=$save_CXXFLAGS
6712 AC_LANG_POP([C++])
6714 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6715 AC_LANG_PUSH([C++])
6716 save_CXXFLAGS=$CXXFLAGS
6717 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6718 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6719         struct S1 { S1(S1 &&); };
6720         struct S2: S1 {};
6721         S1 f(S2 s) { return s; }
6722     ])], [
6723         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6724         AC_MSG_RESULT([yes])
6725     ], [AC_MSG_RESULT([no])])
6726 CXXFLAGS=$save_CXXFLAGS
6727 AC_LANG_POP([C++])
6729 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6730 dnl uninitialized warning for code like
6732 dnl   OString f();
6733 dnl   boost::optional<OString> * g(bool b) {
6734 dnl       boost::optional<OString> o;
6735 dnl       if (b) o = f();
6736 dnl       return new boost::optional<OString>(o);
6737 dnl   }
6739 dnl (as is e.g. present, in a slightly more elaborate form, in
6740 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6741 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6742 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6743 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6744     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6745     AC_LANG_PUSH([C++])
6746     save_CXXFLAGS=$CXXFLAGS
6747     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6748     if test "$ENABLE_OPTIMIZED" = TRUE; then
6749         CXXFLAGS="$CXXFLAGS -O2"
6750     else
6751         CXXFLAGS="$CXXFLAGS -O0"
6752     fi
6753     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6754             #include <new>
6755             void f1(int);
6756             struct S1 {
6757                 ~S1() { f1(n); }
6758                 int n = 0;
6759             };
6760             struct S2 {
6761                 S2() {}
6762                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6763                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6764                 void set(S1 s) {
6765                     new (stg) S1(s);
6766                     init = true;
6767                 }
6768                 bool init = false;
6769                 char stg[sizeof (S1)];
6770             } ;
6771             S1 f2();
6772             S2 * f3(bool b) {
6773                 S2 o;
6774                 if (b) o.set(f2());
6775                 return new S2(o);
6776             }
6777         ]])], [AC_MSG_RESULT([no])], [
6778             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6779             AC_MSG_RESULT([yes])
6780         ])
6781     CXXFLAGS=$save_CXXFLAGS
6782     AC_LANG_POP([C++])
6784 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6786 dnl ===================================================================
6787 dnl CPU Intrinsics support - SSE, AVX
6788 dnl ===================================================================
6790 INTRINSICS_CXXFLAGS=""
6792 if test "$GCC" = "yes"; then
6793     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6794     AC_LANG_PUSH([C++])
6795     save_CXXFLAGS=$CXXFLAGS
6796     CXXFLAGS="$CXXFLAGS -msse2"
6797     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6798         #include <emmintrin.h>
6799         int main () {
6800             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6801             c = _mm_xor_si128 (a, b);
6802             return 0;
6803         }
6804         ])],
6805         [can_compile_sse2=yes],
6806         [can_compile_sse2=no])
6807     AC_LANG_POP([C++])
6808     CXXFLAGS=$save_CXXFLAGS
6809     AC_MSG_RESULT([${can_compile_sse2}])
6810     if test "${can_compile_sse2}" = "yes" ; then
6811         INTRINSICS_CXXFLAGS="-msse2"
6812     else
6813         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6814     fi
6816     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6817     AC_LANG_PUSH([C++])
6818     save_CXXFLAGS=$CXXFLAGS
6819     CXXFLAGS="$CXXFLAGS -mssse3"
6820     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6821         #include <tmmintrin.h>
6822         int main () {
6823             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6824             c = _mm_maddubs_epi16 (a, b);
6825             return 0;
6826         }
6827         ])],
6828         [can_compile_ssse3=yes],
6829         [can_compile_ssse3=no])
6830     AC_LANG_POP([C++])
6831     CXXFLAGS=$save_CXXFLAGS
6832     AC_MSG_RESULT([${can_compile_ssse3}])
6833     if test "${can_compile_ssse3}" = "yes" ; then
6834         INTRINSICS_CXXFLAGS="-mssse3"
6835     else
6836         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6837     fi
6839     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6840     AC_LANG_PUSH([C++])
6841     save_CXXFLAGS=$CXXFLAGS
6842     CXXFLAGS="$CXXFLAGS -mavx"
6843     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6844         #include <immintrin.h>
6845         int main () {
6846             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6847             c = _mm256_xor_ps(a, b);
6848             return 0;
6849         }
6850         ])],
6851         [can_compile_avx=yes],
6852         [can_compile_avx=no])
6853     AC_LANG_POP([C++])
6854     CXXFLAGS=$save_CXXFLAGS
6855     AC_MSG_RESULT([${can_compile_avx}])
6856     if test "${can_compile_avx}" = "yes" ; then
6857         INTRINSICS_CXXFLAGS="-mavx"
6858     else
6859         AC_MSG_WARN([cannot compile AVX intrinsics])
6860     fi
6862     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6863     AC_LANG_PUSH([C++])
6864     save_CXXFLAGS=$CXXFLAGS
6865     CXXFLAGS="$CXXFLAGS -mavx2"
6866     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6867         #include <immintrin.h>
6868         int main () {
6869             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6870             c = _mm256_maddubs_epi16(a, b);
6871             return 0;
6872         }
6873         ])],
6874         [can_compile_avx2=yes],
6875         [can_compile_avx2=no])
6876     AC_LANG_POP([C++])
6877     CXXFLAGS=$save_CXXFLAGS
6878     AC_MSG_RESULT([${can_compile_avx2}])
6879     if test "${can_compile_avx2}" = "yes" ; then
6880         INTRINSICS_CXXFLAGS="-mavx2"
6881     else
6882         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6883     fi
6886 AC_SUBST([INTRINSICS_CXXFLAGS])
6888 dnl ===================================================================
6889 dnl system stl sanity tests
6890 dnl ===================================================================
6891 if test "$_os" != "WINNT"; then
6893     AC_LANG_PUSH([C++])
6895     save_CPPFLAGS="$CPPFLAGS"
6896     if test -n "$MACOSX_SDK_PATH"; then
6897         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6898     fi
6900     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6901     # only.
6902     if test "$CPP_LIBRARY" = GLIBCXX; then
6903         dnl gcc#19664, gcc#22482, rhbz#162935
6904         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6905         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6906         AC_MSG_RESULT([$stlvisok])
6907         if test "$stlvisok" = "no"; then
6908             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6909         fi
6910     fi
6912     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6913     # when we don't make any dynamic libraries?
6914     if test "$DISABLE_DYNLOADING" = ""; then
6915         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6916         cat > conftestlib1.cc <<_ACEOF
6917 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6918 struct S2: S1<int> { virtual ~S2(); };
6919 S2::~S2() {}
6920 _ACEOF
6921         cat > conftestlib2.cc <<_ACEOF
6922 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6923 struct S2: S1<int> { virtual ~S2(); };
6924 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6925 _ACEOF
6926         gccvisinlineshiddenok=yes
6927         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6928             gccvisinlineshiddenok=no
6929         else
6930             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6931             dnl known to not work with -z defs (unsetting which makes the test
6932             dnl moot, though):
6933             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6934             if test "$COM_IS_CLANG" = TRUE; then
6935                 for i in $CXX $CXXFLAGS; do
6936                     case $i in
6937                     -fsanitize=*)
6938                         my_linkflagsnoundefs=
6939                         break
6940                         ;;
6941                     esac
6942                 done
6943             fi
6944             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6945                 gccvisinlineshiddenok=no
6946             fi
6947         fi
6949         rm -fr libconftest*
6950         AC_MSG_RESULT([$gccvisinlineshiddenok])
6951         if test "$gccvisinlineshiddenok" = "no"; then
6952             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6953         fi
6954     fi
6956    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6957     cat >visibility.cxx <<_ACEOF
6958 #pragma GCC visibility push(hidden)
6959 struct __attribute__ ((visibility ("default"))) TestStruct {
6960   static void Init();
6962 __attribute__ ((visibility ("default"))) void TestFunc() {
6963   TestStruct::Init();
6965 _ACEOF
6966     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6967         gccvisbroken=yes
6968     else
6969         case "$host_cpu" in
6970         i?86|x86_64)
6971             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6972                 gccvisbroken=no
6973             else
6974                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6975                     gccvisbroken=no
6976                 else
6977                     gccvisbroken=yes
6978                 fi
6979             fi
6980             ;;
6981         *)
6982             gccvisbroken=no
6983             ;;
6984         esac
6985     fi
6986     rm -f visibility.s visibility.cxx
6988     AC_MSG_RESULT([$gccvisbroken])
6989     if test "$gccvisbroken" = "yes"; then
6990         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6991     fi
6993     CPPFLAGS="$save_CPPFLAGS"
6995     AC_LANG_POP([C++])
6998 dnl ===================================================================
6999 dnl  Clang++ tests
7000 dnl ===================================================================
7002 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7003 if test "$GCC" = "yes"; then
7004     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7005     AC_LANG_PUSH([C++])
7006     save_CXXFLAGS=$CXXFLAGS
7007     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7008     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7009     CXXFLAGS=$save_CXXFLAGS
7010     AC_LANG_POP([C++])
7011     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7012         AC_MSG_RESULT([yes])
7013     else
7014         AC_MSG_RESULT([no])
7015     fi
7017 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7019 dnl ===================================================================
7020 dnl Compiler plugins
7021 dnl ===================================================================
7023 COMPILER_PLUGINS=
7024 # currently only Clang
7026 if test "$COM_IS_CLANG" != "TRUE"; then
7027     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7028         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7029         enable_compiler_plugins=no
7030     fi
7033 if test "$COM_IS_CLANG" = "TRUE"; then
7034     if test -n "$enable_compiler_plugins"; then
7035         compiler_plugins="$enable_compiler_plugins"
7036     elif test -n "$ENABLE_DBGUTIL"; then
7037         compiler_plugins=test
7038     else
7039         compiler_plugins=no
7040     fi
7041     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7042         if test "$CLANGVER" -lt 50002; then
7043             if test "$compiler_plugins" = yes; then
7044                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7045             else
7046                 compiler_plugins=no
7047             fi
7048         fi
7049     fi
7050     if test "$compiler_plugins" != "no"; then
7051         dnl The prefix where Clang resides, override to where Clang resides if
7052         dnl using a source build:
7053         if test -z "$CLANGDIR"; then
7054             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7055         fi
7056         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7057         if test -z "$COMPILER_PLUGINS_CXX"; then
7058             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7059         fi
7060         clangbindir=$CLANGDIR/bin
7061         if test "$build_os" = "cygwin"; then
7062             clangbindir=$(cygpath -u "$clangbindir")
7063         fi
7064         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7065         if test -n "$LLVM_CONFIG"; then
7066             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7067             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7068             if test -z "$CLANGLIBDIR"; then
7069                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7070             fi
7071             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7072             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7073             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7074             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7075                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7076             fi
7077             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7078             clangobjdir=$($LLVM_CONFIG --obj-root)
7079             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7080                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7081             fi
7082         fi
7083         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7084         AC_LANG_PUSH([C++])
7085         save_CXX=$CXX
7086         save_CXXCPP=$CXXCPP
7087         save_CPPFLAGS=$CPPFLAGS
7088         save_CXXFLAGS=$CXXFLAGS
7089         save_LDFLAGS=$LDFLAGS
7090         save_LIBS=$LIBS
7091         CXX=$COMPILER_PLUGINS_CXX
7092         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7093         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7094         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7095         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7096             [COMPILER_PLUGINS=TRUE],
7097             [
7098             if test "$compiler_plugins" = "yes"; then
7099                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7100             else
7101                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7102                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7103             fi
7104             ])
7105         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7106         dnl comment in compilerplugins/Makefile-clang.mk:
7107         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7108             LDFLAGS=""
7109             AC_MSG_CHECKING([for clang libraries to use])
7110             if test -z "$CLANGTOOLLIBS"; then
7111                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7112  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7113                 AC_LINK_IFELSE([
7114                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7115                         [[ clang::FullSourceLoc().dump(); ]])
7116                 ],[CLANGTOOLLIBS="$LIBS"],[])
7117             fi
7118             if test -z "$CLANGTOOLLIBS"; then
7119                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7120                 AC_LINK_IFELSE([
7121                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7122                         [[ clang::FullSourceLoc().dump(); ]])
7123                 ],[CLANGTOOLLIBS="$LIBS"],[])
7124             fi
7125             AC_MSG_RESULT([$CLANGTOOLLIBS])
7126             if test -z "$CLANGTOOLLIBS"; then
7127                 if test "$compiler_plugins" = "yes"; then
7128                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7129                 else
7130                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7131                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7132                 fi
7133                 COMPILER_PLUGINS=
7134             fi
7135             if test -n "$COMPILER_PLUGINS"; then
7136                 if test -z "$CLANGSYSINCLUDE"; then
7137                     if test -n "$LLVM_CONFIG"; then
7138                         # Path to the clang system headers (no idea if there's a better way to get it).
7139                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7140                     fi
7141                 fi
7142             fi
7143         fi
7144         CXX=$save_CXX
7145         CXXCPP=$save_CXXCPP
7146         CPPFLAGS=$save_CPPFLAGS
7147         CXXFLAGS=$save_CXXFLAGS
7148         LDFLAGS=$save_LDFLAGS
7149         LIBS="$save_LIBS"
7150         AC_LANG_POP([C++])
7151     fi
7152 else
7153     if test "$enable_compiler_plugins" = "yes"; then
7154         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7155     fi
7157 AC_SUBST(COMPILER_PLUGINS)
7158 AC_SUBST(COMPILER_PLUGINS_CXX)
7159 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7160 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7161 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7162 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7163 AC_SUBST(CLANGDIR)
7164 AC_SUBST(CLANGLIBDIR)
7165 AC_SUBST(CLANGTOOLLIBS)
7166 AC_SUBST(CLANGSYSINCLUDE)
7168 # Plugin to help linker.
7169 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7170 # This makes --enable-lto build with clang work.
7171 AC_SUBST(LD_PLUGIN)
7173 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7174 AC_SUBST(HAVE_POSIX_FALLOCATE)
7176 dnl ===================================================================
7177 dnl Custom build version
7178 dnl ===================================================================
7180 AC_MSG_CHECKING([whether to add custom build version])
7181 if test "$with_build_version" != ""; then
7182     BUILD_VER_STRING=$with_build_version
7183     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7184 else
7185     BUILD_VER_STRING=
7186     AC_MSG_RESULT([no])
7188 AC_SUBST(BUILD_VER_STRING)
7190 JITC_PROCESSOR_TYPE=""
7191 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7192     # IBMs JDK needs this...
7193     JITC_PROCESSOR_TYPE=6
7194     export JITC_PROCESSOR_TYPE
7196 AC_SUBST([JITC_PROCESSOR_TYPE])
7198 # Misc Windows Stuff
7199 AC_ARG_WITH(ucrt-dir,
7200     AS_HELP_STRING([--with-ucrt-dir],
7201         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7202         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7203         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7204             Windows6.1-KB2999226-x64.msu
7205             Windows6.1-KB2999226-x86.msu
7206             Windows8.1-KB2999226-x64.msu
7207             Windows8.1-KB2999226-x86.msu
7208             Windows8-RT-KB2999226-x64.msu
7209             Windows8-RT-KB2999226-x86.msu
7210         A zip archive including those files is available from Microsoft site:
7211         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7213 UCRT_REDISTDIR="$with_ucrt_dir"
7214 if test $_os = "WINNT"; then
7215     find_msvc_x64_dlls
7216     find_msms
7217     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7218     MSVC_DLLS="$msvcdlls"
7219     MSM_PATH=`win_short_path_for_make "$msmdir"`
7220     # MSVC 15.3 changed it to VC141
7221     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7222         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7223     else
7224         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7225     fi
7227     if test "$UCRT_REDISTDIR" = "no"; then
7228         dnl explicitly disabled
7229         UCRT_REDISTDIR=""
7230     else
7231         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7232                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7233                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7234                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7235                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7236                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7237             UCRT_REDISTDIR=""
7238             if test -n "$PKGFORMAT"; then
7239                for i in $PKGFORMAT; do
7240                    case "$i" in
7241                    msi)
7242                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7243                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7244                        ;;
7245                    esac
7246                done
7247             fi
7248         fi
7249     fi
7252 AC_SUBST(UCRT_REDISTDIR)
7253 AC_SUBST(MSVC_DLL_PATH)
7254 AC_SUBST(MSVC_DLLS)
7255 AC_SUBST(MSM_PATH)
7257 dnl ===================================================================
7258 dnl Checks for Java
7259 dnl ===================================================================
7260 if test "$ENABLE_JAVA" != ""; then
7262     # Windows-specific tests
7263     if test "$build_os" = "cygwin"; then
7264         if test "$BITNESS_OVERRIDE" = 64; then
7265             bitness=64
7266         else
7267             bitness=32
7268         fi
7270         if test -z "$with_jdk_home"; then
7271             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7272             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7273             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7274             if test -n "$regvalue"; then
7275                 ver=$regvalue
7276                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7277                 _jdk_home=$regvalue
7278             fi
7279             if test -z "$with_jdk_home"; then
7280                 for ver in 1.8; do
7281                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7282                     if test -n "$regvalue"; then
7283                         _jdk_home=$regvalue
7284                         break
7285                     fi
7286                 done
7287             fi
7288             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7289                 with_jdk_home="$_jdk_home"
7290                 howfound="found automatically"
7291             else
7292                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7293             fi
7294         else
7295             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7296             howfound="you passed"
7297         fi
7298     fi
7300     # 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.
7301     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7302     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7303         with_jdk_home=`/usr/libexec/java_home`
7304     fi
7306     JAVA_HOME=; export JAVA_HOME
7307     if test -z "$with_jdk_home"; then
7308         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7309     else
7310         _java_path="$with_jdk_home/bin/$with_java"
7311         dnl Check if there is a Java interpreter at all.
7312         if test -x "$_java_path"; then
7313             JAVAINTERPRETER=$_java_path
7314         else
7315             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7316         fi
7317     fi
7319     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7320     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7321     dnl loaded by java to run JunitTests:
7322     if test "$build_os" = "cygwin"; then
7323         shortjdkhome=`cygpath -d "$with_jdk_home"`
7324         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
7325             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7326             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7327         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
7328             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7329             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7330         fi
7332         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7333             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7334         fi
7335         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7336     elif test "$cross_compiling" != "yes"; then
7337         case $CPUNAME in
7338             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7339                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7340                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7341                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7342                 fi
7343                 ;;
7344             *) # assumption: everything else 32-bit
7345                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7346                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7347                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7348                 fi
7349                 ;;
7350         esac
7351     fi
7354 dnl ===================================================================
7355 dnl Checks for JDK.
7356 dnl ===================================================================
7358 # Note that JAVA_HOME as for now always means the *build* platform's
7359 # JAVA_HOME. Whether all the complexity here actually is needed any
7360 # more or not, no idea.
7362 if test "$ENABLE_JAVA" != ""; then
7363     _gij_longver=0
7364     AC_MSG_CHECKING([the installed JDK])
7365     if test -n "$JAVAINTERPRETER"; then
7366         dnl java -version sends output to stderr!
7367         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7368             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7369         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7370             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7371         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7372             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7373         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7374             JDK=ibm
7376             dnl IBM JDK specific tests
7377             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7378             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7380             if test "$_jdk_ver" -lt 10800; then
7381                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7382             fi
7384             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7386             if test "$with_jdk_home" = ""; then
7387                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7388 you must use the "--with-jdk-home" configure option explicitly])
7389             fi
7391             JAVA_HOME=$with_jdk_home
7392         else
7393             JDK=sun
7395             dnl Sun JDK specific tests
7396             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7397             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7399             if test "$_jdk_ver" -lt 10800; then
7400                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7401             fi
7402             if test "$_jdk_ver" -gt 10800; then
7403                 JAVA_CLASSPATH_NOT_SET=TRUE
7404             fi
7406             AC_MSG_RESULT([found (JDK $_jdk)])
7407             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7408             if test "$_os" = "WINNT"; then
7409                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7410             fi
7412             # set to limit VM usage for JunitTests
7413             JAVAIFLAGS=-Xmx64M
7414             # set to limit VM usage for javac
7415             JAVAFLAGS=-J-Xmx128M
7416         fi
7417     else
7418         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7419     fi
7420 else
7421     dnl Java disabled
7422     JAVA_HOME=
7423     export JAVA_HOME
7426 dnl ===================================================================
7427 dnl Checks for javac
7428 dnl ===================================================================
7429 if test "$ENABLE_JAVA" != ""; then
7430     javacompiler="javac"
7431     : ${JAVA_SOURCE_VER=8}
7432     : ${JAVA_TARGET_VER=8}
7433     if test -z "$with_jdk_home"; then
7434         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7435     else
7436         _javac_path="$with_jdk_home/bin/$javacompiler"
7437         dnl Check if there is a Java compiler at all.
7438         if test -x "$_javac_path"; then
7439             JAVACOMPILER=$_javac_path
7440         fi
7441     fi
7442     if test -z "$JAVACOMPILER"; then
7443         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7444     fi
7445     if test "$build_os" = "cygwin"; then
7446         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7447             JAVACOMPILER="${JAVACOMPILER}.exe"
7448         fi
7449         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7450     fi
7453 dnl ===================================================================
7454 dnl Checks for javadoc
7455 dnl ===================================================================
7456 if test "$ENABLE_JAVA" != ""; then
7457     if test -z "$with_jdk_home"; then
7458         AC_PATH_PROG(JAVADOC, javadoc)
7459     else
7460         _javadoc_path="$with_jdk_home/bin/javadoc"
7461         dnl Check if there is a javadoc at all.
7462         if test -x "$_javadoc_path"; then
7463             JAVADOC=$_javadoc_path
7464         else
7465             AC_PATH_PROG(JAVADOC, javadoc)
7466         fi
7467     fi
7468     if test -z "$JAVADOC"; then
7469         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7470     fi
7471     if test "$build_os" = "cygwin"; then
7472         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7473             JAVADOC="${JAVADOC}.exe"
7474         fi
7475         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7476     fi
7478     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7479     JAVADOCISGJDOC="yes"
7480     fi
7482 AC_SUBST(JAVADOCISGJDOC)
7484 if test "$ENABLE_JAVA" != ""; then
7485     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7486     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7487         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7488            # try to recover first by looking whether we have an alternative
7489            # system as in Debian or newer SuSEs where following /usr/bin/javac
7490            # over /etc/alternatives/javac leads to the right bindir where we
7491            # just need to strip a bit away to get a valid JAVA_HOME
7492            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7493         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7494             # maybe only one level of symlink (e.g. on Mac)
7495             JAVA_HOME=$(readlink $JAVACOMPILER)
7496             if test "$(dirname $JAVA_HOME)" = "."; then
7497                 # we've got no path to trim back
7498                 JAVA_HOME=""
7499             fi
7500         else
7501             # else warn
7502             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7503             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7504             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7505             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7506         fi
7507         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7508         if test "$JAVA_HOME" != "/usr"; then
7509             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7510                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7511                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7512                 dnl Tiger already returns a JDK path...
7513                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7514             else
7515                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7516                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7517                 dnl that checks which version to run
7518                 if test -f "$JAVA_HOME"; then
7519                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7520                 fi
7521             fi
7522         fi
7523     fi
7524     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7526     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7527     if test -z "$JAVA_HOME"; then
7528         if test "x$with_jdk_home" = "x"; then
7529             cat > findhome.java <<_ACEOF
7530 [import java.io.File;
7532 class findhome
7534     public static void main(String args[])
7535     {
7536         String jrelocation = System.getProperty("java.home");
7537         File jre = new File(jrelocation);
7538         System.out.println(jre.getParent());
7539     }
7541 _ACEOF
7542             AC_MSG_CHECKING([if javac works])
7543             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7544             AC_TRY_EVAL(javac_cmd)
7545             if test $? = 0 -a -f ./findhome.class; then
7546                 AC_MSG_RESULT([javac works])
7547             else
7548                 echo "configure: javac test failed" >&5
7549                 cat findhome.java >&5
7550                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7551             fi
7552             AC_MSG_CHECKING([if gij knows its java.home])
7553             JAVA_HOME=`$JAVAINTERPRETER findhome`
7554             if test $? = 0 -a "$JAVA_HOME" != ""; then
7555                 AC_MSG_RESULT([$JAVA_HOME])
7556             else
7557                 echo "configure: java test failed" >&5
7558                 cat findhome.java >&5
7559                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7560             fi
7561             # clean-up after ourselves
7562             rm -f ./findhome.java ./findhome.class
7563         else
7564             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7565         fi
7566     fi
7568     # now check if $JAVA_HOME is really valid
7569     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7570         case "${JAVA_HOME}" in
7571             /Library/Java/JavaVirtualMachines/*)
7572                 ;;
7573             *)
7574                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7575                 ;;
7576         esac
7577         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7578             JAVA_HOME_OK="NO"
7579         fi
7580     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7581         JAVA_HOME_OK="NO"
7582     fi
7583     if test "$JAVA_HOME_OK" = "NO"; then
7584         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7585         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7586         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7587         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7588         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7589         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7590     fi
7591     PathFormat "$JAVA_HOME"
7592     JAVA_HOME="$formatted_path"
7595 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7596     "$_os" != Darwin
7597 then
7598     AC_MSG_CHECKING([for JAWT lib])
7599     if test "$_os" = WINNT; then
7600         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7601         JAWTLIB=jawt.lib
7602     else
7603         case "$host_cpu" in
7604         arm*)
7605             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7606             JAVA_ARCH=$my_java_arch
7607             ;;
7608         i*86)
7609             my_java_arch=i386
7610             ;;
7611         m68k)
7612             my_java_arch=m68k
7613             ;;
7614         powerpc)
7615             my_java_arch=ppc
7616             ;;
7617         powerpc64)
7618             my_java_arch=ppc64
7619             ;;
7620         powerpc64le)
7621             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7622             JAVA_ARCH=$my_java_arch
7623             ;;
7624         sparc64)
7625             my_java_arch=sparcv9
7626             ;;
7627         x86_64)
7628             my_java_arch=amd64
7629             ;;
7630         *)
7631             my_java_arch=$host_cpu
7632             ;;
7633         esac
7634         # This is where JDK9 puts the library
7635         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7636             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7637         else
7638             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7639         fi
7640         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7641     fi
7642     AC_MSG_RESULT([$JAWTLIB])
7644 AC_SUBST(JAWTLIB)
7646 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7647     case "$host_os" in
7649     aix*)
7650         JAVAINC="-I$JAVA_HOME/include"
7651         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7652         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7653         ;;
7655     cygwin*)
7656         JAVAINC="-I$JAVA_HOME/include/win32"
7657         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7658         ;;
7660     darwin*)
7661         if test -d "$JAVA_HOME/include/darwin"; then
7662             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7663         else
7664             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7665         fi
7666         ;;
7668     dragonfly*)
7669         JAVAINC="-I$JAVA_HOME/include"
7670         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7671         ;;
7673     freebsd*)
7674         JAVAINC="-I$JAVA_HOME/include"
7675         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7676         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7677         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7678         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7679         ;;
7681     k*bsd*-gnu*)
7682         JAVAINC="-I$JAVA_HOME/include"
7683         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7684         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7685         ;;
7687     linux-gnu*)
7688         JAVAINC="-I$JAVA_HOME/include"
7689         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7690         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7691         ;;
7693     *netbsd*)
7694         JAVAINC="-I$JAVA_HOME/include"
7695         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7696         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7697        ;;
7699     openbsd*)
7700         JAVAINC="-I$JAVA_HOME/include"
7701         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7702         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7703         ;;
7705     solaris*)
7706         JAVAINC="-I$JAVA_HOME/include"
7707         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7708         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7709         ;;
7710     esac
7712 SOLARINC="$SOLARINC $JAVAINC"
7714 AC_SUBST(JAVACOMPILER)
7715 AC_SUBST(JAVADOC)
7716 AC_SUBST(JAVAINTERPRETER)
7717 AC_SUBST(JAVAIFLAGS)
7718 AC_SUBST(JAVAFLAGS)
7719 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7720 AC_SUBST(JAVA_HOME)
7721 AC_SUBST(JAVA_SOURCE_VER)
7722 AC_SUBST(JAVA_TARGET_VER)
7723 AC_SUBST(JDK)
7726 dnl ===================================================================
7727 dnl Export file validation
7728 dnl ===================================================================
7729 AC_MSG_CHECKING([whether to enable export file validation])
7730 if test "$with_export_validation" != "no"; then
7731     if test -z "$ENABLE_JAVA"; then
7732         if test "$with_export_validation" = "yes"; then
7733             AC_MSG_ERROR([requested, but Java is disabled])
7734         else
7735             AC_MSG_RESULT([no, as Java is disabled])
7736         fi
7737     elif ! test -d "${SRC_ROOT}/schema"; then
7738         if test "$with_export_validation" = "yes"; then
7739             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7740         else
7741             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7742         fi
7743     else
7744         AC_MSG_RESULT([yes])
7745         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7747         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7748         if test -z "$ODFVALIDATOR"; then
7749             # remember to download the ODF toolkit with validator later
7750             AC_MSG_NOTICE([no odfvalidator found, will download it])
7751             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7752             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7754             # and fetch name of odfvalidator jar name from download.lst
7755             ODFVALIDATOR_JAR=`$SED -n -e "s/^ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7756             AC_SUBST(ODFVALIDATOR_JAR)
7758             if test -z "$ODFVALIDATOR_JAR"; then
7759                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7760             fi
7761         fi
7762         if test "$build_os" = "cygwin"; then
7763             # In case of Cygwin it will be executed from Windows,
7764             # so we need to run bash and absolute path to validator
7765             # so instead of "odfvalidator" it will be
7766             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7767             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7768         else
7769             ODFVALIDATOR="sh $ODFVALIDATOR"
7770         fi
7771         AC_SUBST(ODFVALIDATOR)
7774         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7775         if test -z "$OFFICEOTRON"; then
7776             # remember to download the officeotron with validator later
7777             AC_MSG_NOTICE([no officeotron found, will download it])
7778             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7779             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7781             # and fetch name of officeotron jar name from download.lst
7782             OFFICEOTRON_JAR=`$SED -n -e "s/^OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7783             AC_SUBST(OFFICEOTRON_JAR)
7785             if test -z "$OFFICEOTRON_JAR"; then
7786                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7787             fi
7788         else
7789             # check version of existing officeotron
7790             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7791             if test 0"$OFFICEOTRON_VER" -lt 704; then
7792                 AC_MSG_ERROR([officeotron too old])
7793             fi
7794         fi
7795         if test "$build_os" = "cygwin"; then
7796             # In case of Cygwin it will be executed from Windows,
7797             # so we need to run bash and absolute path to validator
7798             # so instead of "odfvalidator" it will be
7799             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7800             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7801         else
7802             OFFICEOTRON="sh $OFFICEOTRON"
7803         fi
7804     fi
7805     AC_SUBST(OFFICEOTRON)
7806 else
7807     AC_MSG_RESULT([no])
7810 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7811 if test "$with_bffvalidator" != "no"; then
7812     AC_DEFINE(HAVE_BFFVALIDATOR)
7814     if test "$with_export_validation" = "no"; then
7815         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7816     fi
7818     if test "$with_bffvalidator" = "yes"; then
7819         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7820     else
7821         BFFVALIDATOR="$with_bffvalidator"
7822     fi
7824     if test "$build_os" = "cygwin"; then
7825         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7826             AC_MSG_RESULT($BFFVALIDATOR)
7827         else
7828             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7829         fi
7830     elif test -n "$BFFVALIDATOR"; then
7831         # We are not in Cygwin but need to run Windows binary with wine
7832         AC_PATH_PROGS(WINE, wine)
7834         # so swap in a shell wrapper that converts paths transparently
7835         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7836         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7837         AC_SUBST(BFFVALIDATOR_EXE)
7838         AC_MSG_RESULT($BFFVALIDATOR)
7839     else
7840         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7841     fi
7842     AC_SUBST(BFFVALIDATOR)
7843 else
7844     AC_MSG_RESULT([no])
7847 dnl ===================================================================
7848 dnl Check for C preprocessor to use
7849 dnl ===================================================================
7850 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7851 if test -n "$with_idlc_cpp"; then
7852     AC_MSG_RESULT([$with_idlc_cpp])
7853     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7854 else
7855     AC_MSG_RESULT([ucpp])
7856     AC_MSG_CHECKING([which ucpp tp use])
7857     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7858         AC_MSG_RESULT([external])
7859         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7860     else
7861         AC_MSG_RESULT([internal])
7862         BUILD_TYPE="$BUILD_TYPE UCPP"
7863     fi
7865 AC_SUBST(SYSTEM_UCPP)
7867 dnl ===================================================================
7868 dnl Check for epm (not needed for Windows)
7869 dnl ===================================================================
7870 AC_MSG_CHECKING([whether to enable EPM for packing])
7871 if test "$enable_epm" = "yes"; then
7872     AC_MSG_RESULT([yes])
7873     if test "$_os" != "WINNT"; then
7874         if test $_os = Darwin; then
7875             EPM=internal
7876         elif test -n "$with_epm"; then
7877             EPM=$with_epm
7878         else
7879             AC_PATH_PROG(EPM, epm, no)
7880         fi
7881         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7882             AC_MSG_NOTICE([EPM will be built.])
7883             BUILD_TYPE="$BUILD_TYPE EPM"
7884             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7885         else
7886             # Gentoo has some epm which is something different...
7887             AC_MSG_CHECKING([whether the found epm is the right epm])
7888             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7889                 AC_MSG_RESULT([yes])
7890             else
7891                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7892             fi
7893             AC_MSG_CHECKING([epm version])
7894             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7895             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7896                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7897                 AC_MSG_RESULT([OK, >= 3.7])
7898             else
7899                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7900                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7901             fi
7902         fi
7903     fi
7905     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7906         AC_MSG_CHECKING([for rpm])
7907         for a in "$RPM" rpmbuild rpm; do
7908             $a --usage >/dev/null 2> /dev/null
7909             if test $? -eq 0; then
7910                 RPM=$a
7911                 break
7912             else
7913                 $a --version >/dev/null 2> /dev/null
7914                 if test $? -eq 0; then
7915                     RPM=$a
7916                     break
7917                 fi
7918             fi
7919         done
7920         if test -z "$RPM"; then
7921             AC_MSG_ERROR([not found])
7922         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7923             RPM_PATH=`which $RPM`
7924             AC_MSG_RESULT([$RPM_PATH])
7925             SCPDEFS="$SCPDEFS -DWITH_RPM"
7926         else
7927             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7928         fi
7929     fi
7930     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7931         AC_PATH_PROG(DPKG, dpkg, no)
7932         if test "$DPKG" = "no"; then
7933             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7934         fi
7935     fi
7936     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7937        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7938         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7939             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7940                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7941                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7942                     AC_MSG_RESULT([yes])
7943                 else
7944                     AC_MSG_RESULT([no])
7945                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7946                         _pt="rpm"
7947                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7948                         add_warning "the rpms will need to be installed with --nodeps"
7949                     else
7950                         _pt="pkg"
7951                     fi
7952                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7953                     add_warning "the ${_pt}s will not be relocatable"
7954                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7955                                  relocation will work, you need to patch your epm with the
7956                                  patch in epm/epm-3.7.patch or build with
7957                                  --with-epm=internal which will build a suitable epm])
7958                 fi
7959             fi
7960         fi
7961     fi
7962     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7963         AC_PATH_PROG(PKGMK, pkgmk, no)
7964         if test "$PKGMK" = "no"; then
7965             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7966         fi
7967     fi
7968     AC_SUBST(RPM)
7969     AC_SUBST(DPKG)
7970     AC_SUBST(PKGMK)
7971 else
7972     for i in $PKGFORMAT; do
7973         case "$i" in
7974         aix | bsd | deb | pkg | rpm | native | portable)
7975             AC_MSG_ERROR(
7976                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7977             ;;
7978         esac
7979     done
7980     AC_MSG_RESULT([no])
7981     EPM=NO
7983 AC_SUBST(EPM)
7985 ENABLE_LWP=
7986 if test "$enable_lotuswordpro" = "yes"; then
7987     ENABLE_LWP="TRUE"
7989 AC_SUBST(ENABLE_LWP)
7991 dnl ===================================================================
7992 dnl Check for building ODK
7993 dnl ===================================================================
7994 if test "$enable_odk" = no; then
7995     unset DOXYGEN
7996 else
7997     if test "$with_doxygen" = no; then
7998         AC_MSG_CHECKING([for doxygen])
7999         unset DOXYGEN
8000         AC_MSG_RESULT([no])
8001     else
8002         if test "$with_doxygen" = yes; then
8003             AC_PATH_PROG([DOXYGEN], [doxygen])
8004             if test -z "$DOXYGEN"; then
8005                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8006             fi
8007             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8008                 if ! dot -V 2>/dev/null; then
8009                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8010                 fi
8011             fi
8012         else
8013             AC_MSG_CHECKING([for doxygen])
8014             DOXYGEN=$with_doxygen
8015             AC_MSG_RESULT([$DOXYGEN])
8016         fi
8017         if test -n "$DOXYGEN"; then
8018             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8019             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8020             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8021                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8022             fi
8023         fi
8024     fi
8026 AC_SUBST([DOXYGEN])
8028 AC_MSG_CHECKING([whether to build the ODK])
8029 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8030     AC_MSG_RESULT([yes])
8032     if test "$with_java" != "no"; then
8033         AC_MSG_CHECKING([whether to build unowinreg.dll])
8034         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8035             # build on Win by default
8036             enable_build_unowinreg=yes
8037         fi
8038         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8039             AC_MSG_RESULT([no])
8040             BUILD_UNOWINREG=
8041         else
8042             AC_MSG_RESULT([yes])
8043             BUILD_UNOWINREG=TRUE
8044         fi
8045         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8046             if test -z "$with_mingw_cross_compiler"; then
8047                 dnl Guess...
8048                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8049             elif test -x "$with_mingw_cross_compiler"; then
8050                  MINGWCXX="$with_mingw_cross_compiler"
8051             else
8052                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8053             fi
8055             if test "$MINGWCXX" = "false"; then
8056                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8057             fi
8059             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8060             if test -x "$mingwstrip_test"; then
8061                 MINGWSTRIP="$mingwstrip_test"
8062             else
8063                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8064             fi
8066             if test "$MINGWSTRIP" = "false"; then
8067                 AC_MSG_ERROR(MinGW32 binutils not found.)
8068             fi
8069         fi
8070     fi
8071     BUILD_TYPE="$BUILD_TYPE ODK"
8072 else
8073     AC_MSG_RESULT([no])
8074     BUILD_UNOWINREG=
8076 AC_SUBST(BUILD_UNOWINREG)
8077 AC_SUBST(MINGWCXX)
8078 AC_SUBST(MINGWSTRIP)
8080 dnl ===================================================================
8081 dnl Check for system zlib
8082 dnl ===================================================================
8083 if test "$with_system_zlib" = "auto"; then
8084     case "$_os" in
8085     WINNT)
8086         with_system_zlib="$with_system_libs"
8087         ;;
8088     *)
8089         if test "$enable_fuzzers" != "yes"; then
8090             with_system_zlib=yes
8091         else
8092             with_system_zlib=no
8093         fi
8094         ;;
8095     esac
8098 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8099 dnl and has no pkg-config for it at least on some tinderboxes,
8100 dnl so leaving that out for now
8101 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8102 AC_MSG_CHECKING([which zlib to use])
8103 if test "$with_system_zlib" = "yes"; then
8104     AC_MSG_RESULT([external])
8105     SYSTEM_ZLIB=TRUE
8106     AC_CHECK_HEADER(zlib.h, [],
8107         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8108     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8109         [AC_MSG_ERROR(zlib not found or functional)], [])
8110 else
8111     AC_MSG_RESULT([internal])
8112     SYSTEM_ZLIB=
8113     BUILD_TYPE="$BUILD_TYPE ZLIB"
8114     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8115     if test "$COM" = "MSC"; then
8116         ZLIB_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/zlib.lib"
8117     else
8118         ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8119     fi
8121 AC_SUBST(ZLIB_CFLAGS)
8122 AC_SUBST(ZLIB_LIBS)
8123 AC_SUBST(SYSTEM_ZLIB)
8125 dnl ===================================================================
8126 dnl Check for system jpeg
8127 dnl ===================================================================
8128 AC_MSG_CHECKING([which libjpeg to use])
8129 if test "$with_system_jpeg" = "yes"; then
8130     AC_MSG_RESULT([external])
8131     SYSTEM_LIBJPEG=TRUE
8132     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8133         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8134     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8135         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8136 else
8137     SYSTEM_LIBJPEG=
8138     AC_MSG_RESULT([internal, libjpeg-turbo])
8139     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8140     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8141     if test "$COM" = "MSC"; then
8142         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8143     else
8144         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8145     fi
8147     case "$host_cpu" in
8148     x86_64 | amd64 | i*86 | x86 | ia32)
8149         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8150         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8151             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8152                 NASM="$LODE_HOME/opt/bin/nasm"
8153             elif test -x "/opt/lo/bin/nasm"; then
8154                 NASM="/opt/lo/bin/nasm"
8155             fi
8156         fi
8158         if test -n "$NASM"; then
8159             AC_MSG_CHECKING([for object file format of host system])
8160             case "$host_os" in
8161               cygwin* | mingw* | pw32* | interix*)
8162                 case "$host_cpu" in
8163                   x86_64)
8164                     objfmt='Win64-COFF'
8165                     ;;
8166                   *)
8167                     objfmt='Win32-COFF'
8168                     ;;
8169                 esac
8170               ;;
8171               msdosdjgpp* | go32*)
8172                 objfmt='COFF'
8173               ;;
8174               os2-emx*) # not tested
8175                 objfmt='MSOMF' # obj
8176               ;;
8177               linux*coff* | linux*oldld*)
8178                 objfmt='COFF' # ???
8179               ;;
8180               linux*aout*)
8181                 objfmt='a.out'
8182               ;;
8183               linux*)
8184                 case "$host_cpu" in
8185                   x86_64)
8186                     objfmt='ELF64'
8187                     ;;
8188                   *)
8189                     objfmt='ELF'
8190                     ;;
8191                 esac
8192               ;;
8193               kfreebsd* | freebsd* | netbsd* | openbsd*)
8194                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8195                   objfmt='BSD-a.out'
8196                 else
8197                   case "$host_cpu" in
8198                     x86_64 | amd64)
8199                       objfmt='ELF64'
8200                       ;;
8201                     *)
8202                       objfmt='ELF'
8203                       ;;
8204                   esac
8205                 fi
8206               ;;
8207               solaris* | sunos* | sysv* | sco*)
8208                 case "$host_cpu" in
8209                   x86_64)
8210                     objfmt='ELF64'
8211                     ;;
8212                   *)
8213                     objfmt='ELF'
8214                     ;;
8215                 esac
8216               ;;
8217               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8218                 case "$host_cpu" in
8219                   x86_64)
8220                     objfmt='Mach-O64'
8221                     ;;
8222                   *)
8223                     objfmt='Mach-O'
8224                     ;;
8225                 esac
8226               ;;
8227               *)
8228                 objfmt='ELF ?'
8229               ;;
8230             esac
8232             AC_MSG_RESULT([$objfmt])
8233             if test "$objfmt" = 'ELF ?'; then
8234               objfmt='ELF'
8235               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8236             fi
8238             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8239             case "$objfmt" in
8240               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8241               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8242               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8243               COFF)       NAFLAGS='-fcoff -DCOFF';;
8244               a.out)      NAFLAGS='-faout -DAOUT';;
8245               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8246               ELF)        NAFLAGS='-felf -DELF';;
8247               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8248               RDF)        NAFLAGS='-frdf -DRDF';;
8249               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8250               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8251             esac
8252             AC_MSG_RESULT([$NAFLAGS])
8254             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8255             cat > conftest.asm << EOF
8256             [%line __oline__ "configure"
8257                     section .text
8258                     global  _main,main
8259             _main:
8260             main:   xor     eax,eax
8261                     ret
8262             ]
8264             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8265             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8266               AC_MSG_RESULT(yes)
8267             else
8268               echo "configure: failed program was:" >&AC_FD_CC
8269               cat conftest.asm >&AC_FD_CC
8270               rm -rf conftest*
8271               AC_MSG_RESULT(no)
8272               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8273               NASM=""
8274             fi
8276         fi
8278         if test -z "$NASM"; then
8279 cat << _EOS
8280 ****************************************************************************
8281 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8282 To get one please:
8284 _EOS
8285             if test "$build_os" = "cygwin"; then
8286 cat << _EOS
8287 install a pre-compiled binary for Win32
8289 mkdir -p /opt/lo/bin
8290 cd /opt/lo/bin
8291 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8292 chmod +x nasm
8294 or get and install one from http://www.nasm.us/
8296 Then re-run autogen.sh
8298 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8299 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8301 _EOS
8302             else
8303 cat << _EOS
8304 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8306 _EOS
8307             fi
8308             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8309             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8310         fi
8311       ;;
8312     esac
8315 AC_SUBST(NASM)
8316 AC_SUBST(LIBJPEG_CFLAGS)
8317 AC_SUBST(LIBJPEG_LIBS)
8318 AC_SUBST(SYSTEM_LIBJPEG)
8320 dnl ===================================================================
8321 dnl Check for system clucene
8322 dnl ===================================================================
8323 dnl we should rather be using
8324 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8325 dnl but the contribs-lib check seems tricky
8326 AC_MSG_CHECKING([which clucene to use])
8327 if test "$with_system_clucene" = "yes"; then
8328     AC_MSG_RESULT([external])
8329     SYSTEM_CLUCENE=TRUE
8330     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8331     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8332     FilterLibs "${CLUCENE_LIBS}"
8333     CLUCENE_LIBS="${filteredlibs}"
8334     AC_LANG_PUSH([C++])
8335     save_CXXFLAGS=$CXXFLAGS
8336     save_CPPFLAGS=$CPPFLAGS
8337     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8338     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8339     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8340     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8341     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8342                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8343     CXXFLAGS=$save_CXXFLAGS
8344     CPPFLAGS=$save_CPPFLAGS
8345     AC_LANG_POP([C++])
8347     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8348 else
8349     AC_MSG_RESULT([internal])
8350     SYSTEM_CLUCENE=
8351     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8353 AC_SUBST(SYSTEM_CLUCENE)
8354 AC_SUBST(CLUCENE_CFLAGS)
8355 AC_SUBST(CLUCENE_LIBS)
8357 dnl ===================================================================
8358 dnl Check for system expat
8359 dnl ===================================================================
8360 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8362 dnl ===================================================================
8363 dnl Check for system xmlsec
8364 dnl ===================================================================
8365 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8367 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8368 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8369     ENABLE_EOT="TRUE"
8370     AC_DEFINE([ENABLE_EOT])
8371     AC_MSG_RESULT([yes])
8373     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8374 else
8375     ENABLE_EOT=
8376     AC_MSG_RESULT([no])
8378 AC_SUBST([ENABLE_EOT])
8380 dnl ===================================================================
8381 dnl Check for DLP libs
8382 dnl ===================================================================
8383 AS_IF([test "$COM" = "MSC"],
8384       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8385       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8387 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8389 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8391 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8393 AS_IF([test "$COM" = "MSC"],
8394       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8395       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8397 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8399 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8401 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8402 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8404 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8406 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8408 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8410 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8411 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8413 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8414 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8416 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8418 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8419 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8421 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8423 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8425 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8427 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8429 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8430 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8432 dnl ===================================================================
8433 dnl Check for system lcms2
8434 dnl ===================================================================
8435 if test "$with_system_lcms2" != "yes"; then
8436     SYSTEM_LCMS2=
8438 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8439 if test "$GCC" = "yes"; then
8440     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8442 if test "$COM" = "MSC"; then # override the above
8443     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8446 dnl ===================================================================
8447 dnl Check for system cppunit
8448 dnl ===================================================================
8449 if test "$_os" != "Android" ; then
8450     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8453 dnl ===================================================================
8454 dnl Check whether freetype is available
8455 dnl ===================================================================
8456 if test  "$test_freetype" = "yes"; then
8457     AC_MSG_CHECKING([whether freetype is available])
8458     # FreeType has 3 different kinds of versions
8459     # * release, like 2.4.10
8460     # * libtool, like 13.0.7 (this what pkg-config returns)
8461     # * soname
8462     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8463     #
8464     # 9.9.3 is 2.2.0
8465     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8466     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8467     FilterLibs "${FREETYPE_LIBS}"
8468     FREETYPE_LIBS="${filteredlibs}"
8469     SYSTEM_FREETYPE=TRUE
8470 else
8471     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8472     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8474 AC_SUBST(FREETYPE_CFLAGS)
8475 AC_SUBST(FREETYPE_LIBS)
8476 AC_SUBST([SYSTEM_FREETYPE])
8478 # ===================================================================
8479 # Check for system libxslt
8480 # to prevent incompatibilities between internal libxml2 and external libxslt,
8481 # or vice versa, use with_system_libxml here
8482 # ===================================================================
8483 if test "$with_system_libxml" = "auto"; then
8484     case "$_os" in
8485     WINNT|iOS|Android)
8486         with_system_libxml="$with_system_libs"
8487         ;;
8488     *)
8489         if test "$enable_fuzzers" != "yes"; then
8490             with_system_libxml=yes
8491         else
8492             with_system_libxml=no
8493         fi
8494         ;;
8495     esac
8498 AC_MSG_CHECKING([which libxslt to use])
8499 if test "$with_system_libxml" = "yes"; then
8500     AC_MSG_RESULT([external])
8501     SYSTEM_LIBXSLT=TRUE
8502     if test "$_os" = "Darwin"; then
8503         dnl make sure to use SDK path
8504         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8505         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8506         dnl omit -L/usr/lib
8507         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8508         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8509     else
8510         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8511         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8512         FilterLibs "${LIBXSLT_LIBS}"
8513         LIBXSLT_LIBS="${filteredlibs}"
8514         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8515         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8516         FilterLibs "${LIBEXSLT_LIBS}"
8517         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8518     fi
8520     dnl Check for xsltproc
8521     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8522     if test "$XSLTPROC" = "no"; then
8523         AC_MSG_ERROR([xsltproc is required])
8524     fi
8525 else
8526     AC_MSG_RESULT([internal])
8527     SYSTEM_LIBXSLT=
8528     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8530     if test "$cross_compiling" = "yes"; then
8531         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8532         if test "$XSLTPROC" = "no"; then
8533             AC_MSG_ERROR([xsltproc is required])
8534         fi
8535     fi
8537 AC_SUBST(SYSTEM_LIBXSLT)
8538 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8539     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8541 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8543 AC_SUBST(LIBEXSLT_CFLAGS)
8544 AC_SUBST(LIBEXSLT_LIBS)
8545 AC_SUBST(LIBXSLT_CFLAGS)
8546 AC_SUBST(LIBXSLT_LIBS)
8547 AC_SUBST(XSLTPROC)
8549 # ===================================================================
8550 # Check for system libxml
8551 # ===================================================================
8552 AC_MSG_CHECKING([which libxml to use])
8553 if test "$with_system_libxml" = "yes"; then
8554     AC_MSG_RESULT([external])
8555     SYSTEM_LIBXML=TRUE
8556     if test "$_os" = "Darwin"; then
8557         dnl make sure to use SDK path
8558         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8559         dnl omit -L/usr/lib
8560         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8561     elif test $_os = iOS; then
8562         dnl make sure to use SDK path
8563         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8564         LIBXML_CFLAGS="-I$usr/include/libxml2"
8565         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8566     else
8567         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8568         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8569         FilterLibs "${LIBXML_LIBS}"
8570         LIBXML_LIBS="${filteredlibs}"
8571     fi
8573     dnl Check for xmllint
8574     AC_PATH_PROG(XMLLINT, xmllint, no)
8575     if test "$XMLLINT" = "no"; then
8576         AC_MSG_ERROR([xmllint is required])
8577     fi
8578 else
8579     AC_MSG_RESULT([internal])
8580     SYSTEM_LIBXML=
8581     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8582     if test "$COM" = "MSC"; then
8583         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8584     fi
8585     if test "$COM" = "MSC"; then
8586         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8587     else
8588         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8589     fi
8590     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8592 AC_SUBST(SYSTEM_LIBXML)
8593 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8594     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8596 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8597 AC_SUBST(LIBXML_CFLAGS)
8598 AC_SUBST(LIBXML_LIBS)
8599 AC_SUBST(XMLLINT)
8601 # =====================================================================
8602 # Checking for a Python interpreter with version >= 2.7.
8603 # Build and runtime requires Python 3 compatible version (>= 2.7).
8604 # Optionally user can pass an option to configure, i. e.
8605 # ./configure PYTHON=/usr/bin/python
8606 # =====================================================================
8607 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8608     if test -n "$PYTHON"; then
8609         PYTHON_FOR_BUILD=$PYTHON
8610     else
8611         # This allows a lack of system python with no error, we use internal one in that case.
8612         AM_PATH_PYTHON([2.7],, [:])
8613         # Clean PYTHON_VERSION checked below if cross-compiling
8614         PYTHON_VERSION=""
8615         if test "$PYTHON" != ":"; then
8616             PYTHON_FOR_BUILD=$PYTHON
8617         fi
8618     fi
8620 AC_SUBST(PYTHON_FOR_BUILD)
8622 # Checks for Python to use for Pyuno
8623 AC_MSG_CHECKING([which Python to use for Pyuno])
8624 case "$enable_python" in
8625 no|disable)
8626     if test -z $PYTHON_FOR_BUILD; then
8627         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8628         # requirement from the choice whether to include Python stuff in the installer, but why
8629         # bother?
8630         AC_MSG_ERROR([Python is required at build time.])
8631     fi
8632     enable_python=no
8633     AC_MSG_RESULT([none])
8634     ;;
8635 ""|yes|auto)
8636     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8637         AC_MSG_RESULT([no, overridden by --disable-scripting])
8638         enable_python=no
8639     elif test $build_os = cygwin; then
8640         dnl When building on Windows we don't attempt to use any installed
8641         dnl "system"  Python.
8642         AC_MSG_RESULT([fully internal])
8643         enable_python=internal
8644     elif test "$cross_compiling" = yes; then
8645         AC_MSG_RESULT([system])
8646         enable_python=system
8647     else
8648         if test -z "$PYTHON_FOR_BUILD"; then
8649             AC_MSG_RESULT([fully internal])
8650         else
8651             AC_MSG_RESULT([internal])
8652         fi
8653         enable_python=internal
8654     fi
8655     ;;
8656 internal)
8657     AC_MSG_RESULT([internal])
8658     ;;
8659 fully-internal)
8660     AC_MSG_RESULT([fully internal])
8661     enable_python=internal
8662     ;;
8663 system)
8664     AC_MSG_RESULT([system])
8665     if test "$_os" = Darwin; then
8666         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])
8667     fi
8668     ;;
8670     AC_MSG_ERROR([Incorrect --enable-python option])
8671     ;;
8672 esac
8674 if test $enable_python != no; then
8675     BUILD_TYPE="$BUILD_TYPE PYUNO"
8678 if test $enable_python = system; then
8679     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8680         # Fallback: Accept these in the environment, or as set above
8681         # for MacOSX.
8682         :
8683     elif test "$cross_compiling" != yes; then
8684         # Unset variables set by the above AM_PATH_PYTHON so that
8685         # we actually do check anew.
8686         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
8687         # This causes an error if no python command is found
8688         AM_PATH_PYTHON([3.3])
8689         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8690         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8691         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8692         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8693         if test -z "$PKG_CONFIG"; then
8694             PYTHON_CFLAGS="-I$python_include"
8695             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8696         elif $PKG_CONFIG --exists python-$python_version-embed; then
8697             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8698             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8699         elif $PKG_CONFIG --exists python-$python_version; then
8700             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8701             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8702         else
8703             PYTHON_CFLAGS="-I$python_include"
8704             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8705         fi
8706         FilterLibs "${PYTHON_LIBS}"
8707         PYTHON_LIBS="${filteredlibs}"
8708     else
8709         dnl How to find out the cross-compilation Python installation path?
8710         AC_MSG_CHECKING([for python version])
8711         AS_IF([test -n "$PYTHON_VERSION"],
8712               [AC_MSG_RESULT([$PYTHON_VERSION])],
8713               [AC_MSG_RESULT([not found])
8714                AC_MSG_ERROR([no usable python found])])
8715         test -n "$PYTHON_CFLAGS" && break
8716     fi
8718     dnl Check if the headers really work
8719     save_CPPFLAGS="$CPPFLAGS"
8720     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8721     AC_CHECK_HEADER(Python.h)
8722     CPPFLAGS="$save_CPPFLAGS"
8724     # let the PYTHON_FOR_BUILD match the same python installation that
8725     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8726     # better for PythonTests.
8727     PYTHON_FOR_BUILD=$PYTHON
8730 if test "$with_lxml" != no; then
8731     if test -z "$PYTHON_FOR_BUILD"; then
8732         case $build_os in
8733             cygwin)
8734                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8735                 ;;
8736             *)
8737                 if test "$cross_compiling" != yes ; then
8738                     BUILD_TYPE="$BUILD_TYPE LXML"
8739                 fi
8740                 ;;
8741         esac
8742     else
8743         AC_MSG_CHECKING([for python lxml])
8744         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8745             AC_MSG_RESULT([yes])
8746         else
8747             case $build_os in
8748                 cygwin)
8749                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8750                     ;;
8751                 *)
8752                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8753                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8754                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8755                         else
8756                             BUILD_TYPE="$BUILD_TYPE LXML"
8757                             AC_MSG_RESULT([no, using internal lxml])
8758                         fi
8759                     else
8760                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8761                     fi
8762                     ;;
8763             esac
8764         fi
8765     fi
8768 dnl By now enable_python should be "system", "internal" or "no"
8769 case $enable_python in
8770 system)
8771     SYSTEM_PYTHON=TRUE
8773     if test "x$ac_cv_header_Python_h" != "xyes"; then
8774        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8775     fi
8777     AC_LANG_PUSH(C)
8778     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8779     AC_MSG_CHECKING([for correct python library version])
8780        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8781 #include <Python.h>
8783 int main(int argc, char **argv) {
8784    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8785        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8786    else return 1;
8788        ]])],[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])])
8789     CFLAGS=$save_CFLAGS
8790     AC_LANG_POP(C)
8792     dnl FIXME Check if the Python library can be linked with, too?
8793     ;;
8795 internal)
8796     SYSTEM_PYTHON=
8797     PYTHON_VERSION_MAJOR=3
8798     PYTHON_VERSION_MINOR=8
8799     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.18
8800     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8801         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8802     fi
8803     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8804     BUILD_TYPE="$BUILD_TYPE PYTHON"
8805     if test "$OS" = LINUX -o "$OS" = WNT ; then
8806         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8807     fi
8808     # Embedded Python dies without Home set
8809     if test "$HOME" = ""; then
8810         export HOME=""
8811     fi
8812     ;;
8814     DISABLE_PYTHON=TRUE
8815     SYSTEM_PYTHON=
8816     ;;
8818     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8819     ;;
8820 esac
8822 AC_SUBST(DISABLE_PYTHON)
8823 AC_SUBST(SYSTEM_PYTHON)
8824 AC_SUBST(PYTHON_CFLAGS)
8825 AC_SUBST(PYTHON_LIBS)
8826 AC_SUBST(PYTHON_VERSION)
8827 AC_SUBST(PYTHON_VERSION_MAJOR)
8828 AC_SUBST(PYTHON_VERSION_MINOR)
8830 ENABLE_MARIADBC=TRUE
8831 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8832     ENABLE_MARIADBC=
8834 MARIADBC_MAJOR=1
8835 MARIADBC_MINOR=0
8836 MARIADBC_MICRO=2
8837 if test "$ENABLE_MARIADBC" = "TRUE"; then
8838     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8841 AC_SUBST(ENABLE_MARIADBC)
8842 AC_SUBST(MARIADBC_MAJOR)
8843 AC_SUBST(MARIADBC_MINOR)
8844 AC_SUBST(MARIADBC_MICRO)
8846 if test "$ENABLE_MARIADBC" = "TRUE"; then
8847     dnl ===================================================================
8848     dnl Check for system MariaDB
8849     dnl ===================================================================
8850     AC_MSG_CHECKING([which MariaDB to use])
8851     if test "$with_system_mariadb" = "yes"; then
8852         AC_MSG_RESULT([external])
8853         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8854         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8855         if test -z "$MARIADBCONFIG"; then
8856             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8857             if test -z "$MARIADBCONFIG"; then
8858                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8859                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8860             fi
8861         fi
8862         AC_MSG_CHECKING([MariaDB version])
8863         MARIADB_VERSION=`$MARIADBCONFIG --version`
8864         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8865         if test "$MARIADB_MAJOR" -ge "5"; then
8866             AC_MSG_RESULT([OK])
8867         else
8868             AC_MSG_ERROR([too old, use 5.0.x or later])
8869         fi
8870         AC_MSG_CHECKING([for MariaDB Client library])
8871         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8872         if test "$COM_IS_CLANG" = TRUE; then
8873             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8874         fi
8875         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8876         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8877         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8878         dnl linux32:
8879         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8880             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8881             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8882                 | sed -e 's|/lib64/|/lib/|')
8883         fi
8884         FilterLibs "${MARIADB_LIBS}"
8885         MARIADB_LIBS="${filteredlibs}"
8886         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8887         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8888         if test "$enable_bundle_mariadb" = "yes"; then
8889             AC_MSG_RESULT([yes])
8890             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8891             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8893 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8895 /g' | grep -E '(mysqlclient|mariadb)')
8896             if test "$_os" = "Darwin"; then
8897                 LIBMARIADB=${LIBMARIADB}.dylib
8898             elif test "$_os" = "WINNT"; then
8899                 LIBMARIADB=${LIBMARIADB}.dll
8900             else
8901                 LIBMARIADB=${LIBMARIADB}.so
8902             fi
8903             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8904             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8905             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8906                 AC_MSG_RESULT([found.])
8907                 PathFormat "$LIBMARIADB_PATH"
8908                 LIBMARIADB_PATH="$formatted_path"
8909             else
8910                 AC_MSG_ERROR([not found.])
8911             fi
8912         else
8913             AC_MSG_RESULT([no])
8914             BUNDLE_MARIADB_CONNECTOR_C=
8915         fi
8916     else
8917         AC_MSG_RESULT([internal])
8918         SYSTEM_MARIADB_CONNECTOR_C=
8919         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8920         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8921         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8922     fi
8924     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8925     AC_SUBST(MARIADB_CFLAGS)
8926     AC_SUBST(MARIADB_LIBS)
8927     AC_SUBST(LIBMARIADB)
8928     AC_SUBST(LIBMARIADB_PATH)
8929     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8932 dnl ===================================================================
8933 dnl Check for system hsqldb
8934 dnl ===================================================================
8935 if test "$with_java" != "no"; then
8936     HSQLDB_USE_JDBC_4_1=
8937     AC_MSG_CHECKING([which hsqldb to use])
8938     if test "$with_system_hsqldb" = "yes"; then
8939         AC_MSG_RESULT([external])
8940         SYSTEM_HSQLDB=TRUE
8941         if test -z $HSQLDB_JAR; then
8942             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8943         fi
8944         if ! test -f $HSQLDB_JAR; then
8945                AC_MSG_ERROR(hsqldb.jar not found.)
8946         fi
8947         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8948         export HSQLDB_JAR
8949         if $PERL -e \
8950            'use Archive::Zip;
8951             my $file = "$ENV{'HSQLDB_JAR'}";
8952             my $zip = Archive::Zip->new( $file );
8953             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8954             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8955             {
8956                 push @l, split(/\n/, $mf);
8957                 foreach my $line (@l)
8958                 {
8959                     if ($line =~ m/Specification-Version:/)
8960                     {
8961                         ($t, $version) = split (/:/,$line);
8962                         $version =~ s/^\s//;
8963                         ($a, $b, $c, $d) = split (/\./,$version);
8964                         if ($c == "0" && $d > "8")
8965                         {
8966                             exit 0;
8967                         }
8968                         else
8969                         {
8970                             exit 1;
8971                         }
8972                     }
8973                 }
8974             }
8975             else
8976             {
8977                 exit 1;
8978             }'; then
8979             AC_MSG_RESULT([yes])
8980         else
8981             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8982         fi
8983     else
8984         AC_MSG_RESULT([internal])
8985         SYSTEM_HSQLDB=
8986         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8987         NEED_ANT=TRUE
8988         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8989         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8990         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8991             AC_MSG_RESULT([yes])
8992             HSQLDB_USE_JDBC_4_1=TRUE
8993         else
8994             AC_MSG_RESULT([no])
8995         fi
8996     fi
8997     AC_SUBST(SYSTEM_HSQLDB)
8998     AC_SUBST(HSQLDB_JAR)
8999     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9002 dnl ===================================================================
9003 dnl Check for PostgreSQL stuff
9004 dnl ===================================================================
9005 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9006 if test "x$enable_postgresql_sdbc" != "xno"; then
9007     AC_MSG_RESULT([yes])
9008     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9010     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9011         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9012     fi
9013     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9014         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9015     fi
9017     postgres_interface=""
9018     if test "$with_system_postgresql" = "yes"; then
9019         postgres_interface="external PostgreSQL"
9020         SYSTEM_POSTGRESQL=TRUE
9021         if test "$_os" = Darwin; then
9022             supp_path=''
9023             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9024                 pg_supp_path="$P_SEP$d$pg_supp_path"
9025             done
9026         fi
9027         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9028         if test -n "$PGCONFIG"; then
9029             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9030             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9031         else
9032             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9033               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9034               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9035             ],[
9036               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9037             ])
9038         fi
9039         FilterLibs "${POSTGRESQL_LIB}"
9040         POSTGRESQL_LIB="${filteredlibs}"
9041     else
9042         # if/when anything else than PostgreSQL uses Kerberos,
9043         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9044         WITH_KRB5=
9045         WITH_GSSAPI=
9046         case "$_os" in
9047         Darwin)
9048             # macOS has system MIT Kerberos 5 since 10.4
9049             if test "$with_krb5" != "no"; then
9050                 WITH_KRB5=TRUE
9051                 save_LIBS=$LIBS
9052                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9053                 # that the libraries where these functions are located on macOS will change, is it?
9054                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9055                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9056                 KRB5_LIBS=$LIBS
9057                 LIBS=$save_LIBS
9058                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9059                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9060                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9061                 LIBS=$save_LIBS
9062             fi
9063             if test "$with_gssapi" != "no"; then
9064                 WITH_GSSAPI=TRUE
9065                 save_LIBS=$LIBS
9066                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9067                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9068                 GSSAPI_LIBS=$LIBS
9069                 LIBS=$save_LIBS
9070             fi
9071             ;;
9072         WINNT)
9073             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9074                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9075             fi
9076             ;;
9077         Linux|GNU|*BSD|DragonFly)
9078             if test "$with_krb5" != "no"; then
9079                 WITH_KRB5=TRUE
9080                 save_LIBS=$LIBS
9081                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9082                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9083                 KRB5_LIBS=$LIBS
9084                 LIBS=$save_LIBS
9085                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9086                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9087                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9088                 LIBS=$save_LIBS
9089             fi
9090             if test "$with_gssapi" != "no"; then
9091                 WITH_GSSAPI=TRUE
9092                 save_LIBS=$LIBS
9093                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9094                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9095                 GSSAPI_LIBS=$LIBS
9096                 LIBS=$save_LIBS
9097             fi
9098             ;;
9099         *)
9100             if test "$with_krb5" = "yes"; then
9101                 WITH_KRB5=TRUE
9102                 save_LIBS=$LIBS
9103                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9104                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9105                 KRB5_LIBS=$LIBS
9106                 LIBS=$save_LIBS
9107                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9108                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9109                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9110                 LIBS=$save_LIBS
9111             fi
9112             if test "$with_gssapi" = "yes"; then
9113                 WITH_GSSAPI=TRUE
9114                 save_LIBS=$LIBS
9115                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9116                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9117                 LIBS=$save_LIBS
9118                 GSSAPI_LIBS=$LIBS
9119             fi
9120         esac
9122         if test -n "$with_libpq_path"; then
9123             SYSTEM_POSTGRESQL=TRUE
9124             postgres_interface="external libpq"
9125             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9126             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9127         else
9128             SYSTEM_POSTGRESQL=
9129             postgres_interface="internal"
9130             POSTGRESQL_LIB=""
9131             POSTGRESQL_INC="%OVERRIDE_ME%"
9132             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9133         fi
9134     fi
9136     AC_MSG_CHECKING([PostgreSQL C interface])
9137     AC_MSG_RESULT([$postgres_interface])
9139     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9140         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9141         save_CFLAGS=$CFLAGS
9142         save_CPPFLAGS=$CPPFLAGS
9143         save_LIBS=$LIBS
9144         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9145         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9146         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9147         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9148             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9149         CFLAGS=$save_CFLAGS
9150         CPPFLAGS=$save_CPPFLAGS
9151         LIBS=$save_LIBS
9152     fi
9153     BUILD_POSTGRESQL_SDBC=TRUE
9154 else
9155     AC_MSG_RESULT([no])
9157 AC_SUBST(WITH_KRB5)
9158 AC_SUBST(WITH_GSSAPI)
9159 AC_SUBST(GSSAPI_LIBS)
9160 AC_SUBST(KRB5_LIBS)
9161 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9162 AC_SUBST(SYSTEM_POSTGRESQL)
9163 AC_SUBST(POSTGRESQL_INC)
9164 AC_SUBST(POSTGRESQL_LIB)
9166 dnl ===================================================================
9167 dnl Check for Firebird stuff
9168 dnl ===================================================================
9169 ENABLE_FIREBIRD_SDBC=
9170 if test "$enable_firebird_sdbc" = "yes" ; then
9171     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9173     dnl ===================================================================
9174     dnl Check for system Firebird
9175     dnl ===================================================================
9176     AC_MSG_CHECKING([which Firebird to use])
9177     if test "$with_system_firebird" = "yes"; then
9178         AC_MSG_RESULT([external])
9179         SYSTEM_FIREBIRD=TRUE
9180         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9181         if test -z "$FIREBIRDCONFIG"; then
9182             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9183             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9184                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9185             ])
9186             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9187         else
9188             AC_MSG_NOTICE([fb_config found])
9189             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9190             AC_MSG_CHECKING([for Firebird Client library])
9191             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9192             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9193             FilterLibs "${FIREBIRD_LIBS}"
9194             FIREBIRD_LIBS="${filteredlibs}"
9195         fi
9196         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9197         AC_MSG_CHECKING([Firebird version])
9198         if test -n "${FIREBIRD_VERSION}"; then
9199             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9200             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9201             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9202                 AC_MSG_RESULT([OK])
9203             else
9204                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9205             fi
9206         else
9207             __save_CFLAGS="${CFLAGS}"
9208             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9209             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9210 #if defined(FB_API_VER) && FB_API_VER == 30
9211 int fb_api_is_30(void) { return 0; }
9212 #else
9213 #error "Wrong Firebird API version"
9214 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9215             CFLAGS="${__save_CFLAGS}"
9216         fi
9217         ENABLE_FIREBIRD_SDBC=TRUE
9218         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9219     elif test "$enable_database_connectivity" != yes; then
9220         AC_MSG_RESULT([none])
9221     elif test "$cross_compiling" = "yes"; then
9222         AC_MSG_RESULT([none])
9223     else
9224         dnl Embedded Firebird has version 3.0
9225         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9226         dnl We need libatomic_ops for any non X86/X64 system
9227         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9228             dnl ===================================================================
9229             dnl Check for system libatomic_ops
9230             dnl ===================================================================
9231             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9232             if test "$with_system_libatomic_ops" = "yes"; then
9233                 SYSTEM_LIBATOMIC_OPS=TRUE
9234                 AC_CHECK_HEADERS(atomic_ops.h, [],
9235                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9236             else
9237                 SYSTEM_LIBATOMIC_OPS=
9238                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9239                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9240                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9241             fi
9242         fi
9244         AC_MSG_RESULT([internal])
9245         SYSTEM_FIREBIRD=
9246         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9247         FIREBIRD_LIBS="-lfbclient"
9249         if test "$with_system_libtommath" = "yes"; then
9250             SYSTEM_LIBTOMMATH=TRUE
9251             dnl check for tommath presence
9252             save_LIBS=$LIBS
9253             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9254             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9255             LIBS=$save_LIBS
9256         else
9257             SYSTEM_LIBTOMMATH=
9258             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9259             LIBTOMMATH_LIBS="-ltommath"
9260             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9261         fi
9263         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9264         ENABLE_FIREBIRD_SDBC=TRUE
9265         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9266     fi
9268 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9269 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9270 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9271 AC_SUBST(LIBATOMIC_OPS_LIBS)
9272 AC_SUBST(SYSTEM_FIREBIRD)
9273 AC_SUBST(FIREBIRD_CFLAGS)
9274 AC_SUBST(FIREBIRD_LIBS)
9275 AC_SUBST([TOMMATH_CFLAGS])
9276 AC_SUBST([TOMMATH_LIBS])
9278 dnl ===================================================================
9279 dnl Check for system curl
9280 dnl ===================================================================
9281 AC_MSG_CHECKING([which libcurl to use])
9282 if test "$with_system_curl" = "auto"; then
9283     with_system_curl="$with_system_libs"
9286 if test "$with_system_curl" = "yes"; then
9287     AC_MSG_RESULT([external])
9288     SYSTEM_CURL=TRUE
9290     PKG_CHECK_MODULES(CURL, libcurl >= 7.68.0)
9292     ENABLE_CURL=TRUE
9293 elif test $_os = iOS; then
9294     # Let's see if we need curl, I think not?
9295     AC_MSG_RESULT([none])
9296     ENABLE_CURL=
9297 else
9298     AC_MSG_RESULT([internal])
9299     SYSTEM_CURL=
9300     BUILD_TYPE="$BUILD_TYPE CURL"
9301     ENABLE_CURL=TRUE
9303 AC_SUBST(SYSTEM_CURL)
9304 AC_SUBST(CURL_CFLAGS)
9305 AC_SUBST(CURL_LIBS)
9306 AC_SUBST(ENABLE_CURL)
9308 dnl ===================================================================
9309 dnl Check for system boost
9310 dnl ===================================================================
9311 AC_MSG_CHECKING([which boost to use])
9312 if test "$with_system_boost" = "yes"; then
9313     AC_MSG_RESULT([external])
9314     SYSTEM_BOOST=TRUE
9315     AX_BOOST_BASE(1.47)
9316     AX_BOOST_DATE_TIME
9317     AX_BOOST_FILESYSTEM
9318     AX_BOOST_IOSTREAMS
9319     AX_BOOST_LOCALE
9320     AC_LANG_PUSH([C++])
9321     save_CXXFLAGS=$CXXFLAGS
9322     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9323     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9324        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9325     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9326        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9327     CXXFLAGS=$save_CXXFLAGS
9328     AC_LANG_POP([C++])
9329     # this is in m4/ax_boost_base.m4
9330     FilterLibs "${BOOST_LDFLAGS}"
9331     BOOST_LDFLAGS="${filteredlibs}"
9332 else
9333     AC_MSG_RESULT([internal])
9334     BUILD_TYPE="$BUILD_TYPE BOOST"
9335     SYSTEM_BOOST=
9336     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9337         # use warning-suppressing wrapper headers
9338         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9339     else
9340         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9341     fi
9343 AC_SUBST(SYSTEM_BOOST)
9345 dnl ===================================================================
9346 dnl Check for system mdds
9347 dnl ===================================================================
9348 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9350 dnl ===================================================================
9351 dnl Check for system glm
9352 dnl ===================================================================
9353 AC_MSG_CHECKING([which glm to use])
9354 if test "$with_system_glm" = "yes"; then
9355     AC_MSG_RESULT([external])
9356     SYSTEM_GLM=TRUE
9357     AC_LANG_PUSH([C++])
9358     AC_CHECK_HEADER([glm/glm.hpp], [],
9359        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9360     AC_LANG_POP([C++])
9361 else
9362     AC_MSG_RESULT([internal])
9363     BUILD_TYPE="$BUILD_TYPE GLM"
9364     SYSTEM_GLM=
9365     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9367 AC_SUBST([GLM_CFLAGS])
9368 AC_SUBST([SYSTEM_GLM])
9370 dnl ===================================================================
9371 dnl Check for system odbc
9372 dnl ===================================================================
9373 AC_MSG_CHECKING([which odbc headers to use])
9374 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
9375     AC_MSG_RESULT([external])
9376     SYSTEM_ODBC_HEADERS=TRUE
9378     if test "$build_os" = "cygwin"; then
9379         save_CPPFLAGS=$CPPFLAGS
9380         find_winsdk
9381         PathFormat "$winsdktest"
9382         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"
9383         AC_CHECK_HEADER(sqlext.h, [],
9384             [AC_MSG_ERROR(odbc not found. install odbc)],
9385             [#include <windows.h>])
9386         CPPFLAGS=$save_CPPFLAGS
9387     else
9388         AC_CHECK_HEADER(sqlext.h, [],
9389             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9390     fi
9391 elif test "$enable_database_connectivity" != yes; then
9392     AC_MSG_RESULT([none])
9393 else
9394     AC_MSG_RESULT([internal])
9395     SYSTEM_ODBC_HEADERS=
9397 AC_SUBST(SYSTEM_ODBC_HEADERS)
9399 dnl ===================================================================
9400 dnl Enable LDAP support
9401 dnl ===================================================================
9403 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9404 AC_MSG_CHECKING([whether to enable LDAP support])
9405     if test "$enable_ldap" != "yes"; then
9406         AC_MSG_RESULT([no])
9407         ENABLE_LDAP=""
9408         enable_ldap=no
9409     else
9410         AC_MSG_RESULT([yes])
9411         ENABLE_LDAP="TRUE"
9412         AC_DEFINE(HAVE_FEATURE_LDAP)
9413     fi
9415 AC_SUBST(ENABLE_LDAP)
9417 dnl ===================================================================
9418 dnl Check for system openldap
9419 dnl ===================================================================
9421 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9422 AC_MSG_CHECKING([which openldap library to use])
9423 if test "$with_system_openldap" = "yes"; then
9424     AC_MSG_RESULT([external])
9425     SYSTEM_OPENLDAP=TRUE
9426     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9427     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9428     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9429 else
9430     AC_MSG_RESULT([internal])
9431     SYSTEM_OPENLDAP=
9432     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9435 AC_SUBST(SYSTEM_OPENLDAP)
9437 dnl ===================================================================
9438 dnl Check for system NSS
9439 dnl ===================================================================
9440 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9441     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9442     AC_DEFINE(HAVE_FEATURE_NSS)
9443     ENABLE_NSS="TRUE"
9444     AC_DEFINE(ENABLE_NSS)
9445 elif test $_os != iOS ; then
9446     with_tls=openssl
9448 AC_SUBST(ENABLE_NSS)
9450 dnl ===================================================================
9451 dnl Check for TLS/SSL and cryptographic implementation to use
9452 dnl ===================================================================
9453 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9454 if test -n "$with_tls"; then
9455     case $with_tls in
9456     openssl)
9457         AC_DEFINE(USE_TLS_OPENSSL)
9458         TLS=OPENSSL
9460         if test "$enable_openssl" != "yes"; then
9461             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9462         fi
9464         # warn that OpenSSL has been selected but not all TLS code has this option
9465         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9466         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9467         ;;
9468     nss)
9469         AC_DEFINE(USE_TLS_NSS)
9470         TLS=NSS
9471         ;;
9472     no)
9473         AC_MSG_WARN([Skipping TLS/SSL])
9474         ;;
9475     *)
9476         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9477 openssl - OpenSSL
9478 nss - Mozilla's Network Security Services (NSS)
9479     ])
9480         ;;
9481     esac
9482 else
9483     # default to using NSS, it results in smaller oox lib
9484     AC_DEFINE(USE_TLS_NSS)
9485     TLS=NSS
9487 AC_MSG_RESULT([$TLS])
9488 AC_SUBST(TLS)
9490 dnl ===================================================================
9491 dnl Check for system sane
9492 dnl ===================================================================
9493 AC_MSG_CHECKING([which sane header to use])
9494 if test "$with_system_sane" = "yes"; then
9495     AC_MSG_RESULT([external])
9496     AC_CHECK_HEADER(sane/sane.h, [],
9497       [AC_MSG_ERROR(sane not found. install sane)], [])
9498 else
9499     AC_MSG_RESULT([internal])
9500     BUILD_TYPE="$BUILD_TYPE SANE"
9503 dnl ===================================================================
9504 dnl Check for system icu
9505 dnl ===================================================================
9506 SYSTEM_GENBRK=
9507 SYSTEM_GENCCODE=
9508 SYSTEM_GENCMN=
9510 ICU_MAJOR=65
9511 ICU_MINOR=1
9512 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9513 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9514 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9515 AC_MSG_CHECKING([which icu to use])
9516 if test "$with_system_icu" = "yes"; then
9517     AC_MSG_RESULT([external])
9518     SYSTEM_ICU=TRUE
9519     AC_LANG_PUSH([C++])
9520     AC_MSG_CHECKING([for unicode/rbbi.h])
9521     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9522     AC_LANG_POP([C++])
9524     if test "$cross_compiling" != "yes"; then
9525         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9526         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9527         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9528         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9529     fi
9531     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9532         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9533         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9534         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9535         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9536         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9537             AC_MSG_RESULT([yes])
9538         else
9539             AC_MSG_RESULT([no])
9540             if test "$with_system_icu_for_build" != "force"; then
9541                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9542 You can use --with-system-icu-for-build=force to use it anyway.])
9543             fi
9544         fi
9545     fi
9547     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9548         # using the system icu tools can lead to version confusion, use the
9549         # ones from the build environment when cross-compiling
9550         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9551         if test -z "$SYSTEM_GENBRK"; then
9552             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9553         fi
9554         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9555         if test -z "$SYSTEM_GENCCODE"; then
9556             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9557         fi
9558         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9559         if test -z "$SYSTEM_GENCMN"; then
9560             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9561         fi
9562         if test "$ICU_MAJOR" -ge "49"; then
9563             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9564             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9565             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9566         else
9567             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9568             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9569             ICU_RECLASSIFIED_HEBREW_LETTER=
9570         fi
9571     fi
9573     if test "$cross_compiling" = "yes"; then
9574         if test "$ICU_MAJOR" -ge "50"; then
9575             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9576             ICU_MINOR=""
9577         fi
9578     fi
9579 else
9580     AC_MSG_RESULT([internal])
9581     SYSTEM_ICU=
9582     BUILD_TYPE="$BUILD_TYPE ICU"
9583     # surprisingly set these only for "internal" (to be used by various other
9584     # external libs): the system icu-config is quite unhelpful and spits out
9585     # dozens of weird flags and also default path -I/usr/include
9586     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9587     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9589 if test "$ICU_MAJOR" -ge "59"; then
9590     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9591     # with -std=c++11 but not all external libraries can be built with that,
9592     # for those use a bit-compatible typedef uint16_t UChar; see
9593     # icu/source/common/unicode/umachine.h
9594     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9595 else
9596     ICU_UCHAR_TYPE=""
9598 AC_SUBST(SYSTEM_ICU)
9599 AC_SUBST(SYSTEM_GENBRK)
9600 AC_SUBST(SYSTEM_GENCCODE)
9601 AC_SUBST(SYSTEM_GENCMN)
9602 AC_SUBST(ICU_MAJOR)
9603 AC_SUBST(ICU_MINOR)
9604 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9605 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9606 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9607 AC_SUBST(ICU_CFLAGS)
9608 AC_SUBST(ICU_LIBS)
9609 AC_SUBST(ICU_UCHAR_TYPE)
9611 dnl ==================================================================
9612 dnl Breakpad
9613 dnl ==================================================================
9614 DEFAULT_CRASHDUMP_VALUE="true"
9615 AC_MSG_CHECKING([whether to enable breakpad])
9616 if test "$enable_breakpad" != yes; then
9617     AC_MSG_RESULT([no])
9618 else
9619     AC_MSG_RESULT([yes])
9620     ENABLE_BREAKPAD="TRUE"
9621     AC_DEFINE(ENABLE_BREAKPAD)
9622     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9623     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9625     AC_MSG_CHECKING([for disable crash dump])
9626     if test "$enable_crashdump" = no; then
9627         DEFAULT_CRASHDUMP_VALUE="false"
9628         AC_MSG_RESULT([yes])
9629     else
9630        AC_MSG_RESULT([no])
9631     fi
9633     AC_MSG_CHECKING([for crashreport config])
9634     if test "$with_symbol_config" = "no"; then
9635         BREAKPAD_SYMBOL_CONFIG="invalid"
9636         AC_MSG_RESULT([no])
9637     else
9638         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9639         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9640         AC_MSG_RESULT([yes])
9641     fi
9642     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9644 AC_SUBST(ENABLE_BREAKPAD)
9645 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9647 dnl ==================================================================
9648 dnl libfuzzer
9649 dnl ==================================================================
9650 AC_MSG_CHECKING([whether to enable fuzzers])
9651 if test "$enable_fuzzers" != yes; then
9652     AC_MSG_RESULT([no])
9653 else
9654     AC_MSG_RESULT([yes])
9655     ENABLE_FUZZERS="TRUE"
9656     AC_DEFINE([ENABLE_FUZZERS],1)
9657     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9659 AC_SUBST(ENABLE_FUZZERS)
9661 dnl ===================================================================
9662 dnl Orcus
9663 dnl ===================================================================
9664 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9665 if test "$with_system_orcus" != "yes"; then
9666     if test "$SYSTEM_BOOST" = "TRUE"; then
9667         # ===========================================================
9668         # Determine if we are going to need to link with Boost.System
9669         # ===========================================================
9670         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9671         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9672         dnl in documentation has no effect.
9673         AC_MSG_CHECKING([if we need to link with Boost.System])
9674         AC_LANG_PUSH([C++])
9675         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9676                 @%:@include <boost/version.hpp>
9677             ]],[[
9678                 #if BOOST_VERSION >= 105000
9679                 #   error yes, we need to link with Boost.System
9680                 #endif
9681             ]])],[
9682                 AC_MSG_RESULT([no])
9683             ],[
9684                 AC_MSG_RESULT([yes])
9685                 AX_BOOST_SYSTEM
9686         ])
9687         AC_LANG_POP([C++])
9688     fi
9690 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9691 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9692 AC_SUBST([BOOST_SYSTEM_LIB])
9693 AC_SUBST(SYSTEM_LIBORCUS)
9695 dnl ===================================================================
9696 dnl HarfBuzz
9697 dnl ===================================================================
9698 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9699                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9700                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9702 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9703                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9704                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9706 if test "$COM" = "MSC"; then # override the above
9707     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9708     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9711 if test "$with_system_harfbuzz" = "yes"; then
9712     if test "$with_system_graphite" = "no"; then
9713         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9714     fi
9715     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9716     _save_libs="$LIBS"
9717     _save_cflags="$CFLAGS"
9718     LIBS="$LIBS $HARFBUZZ_LIBS"
9719     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9720     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9721     LIBS="$_save_libs"
9722     CFLAGS="$_save_cflags"
9723 else
9724     if test "$with_system_graphite" = "yes"; then
9725         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9726     fi
9729 AC_MSG_CHECKING([whether to use X11])
9730 dnl ***************************************
9731 dnl testing for X libraries and includes...
9732 dnl ***************************************
9733 if test "$USING_X11" = TRUE; then
9734     AC_DEFINE(HAVE_FEATURE_X11)
9736 AC_MSG_RESULT([$USING_X11])
9738 if test "$USING_X11" = TRUE; then
9739     AC_PATH_X
9740     AC_PATH_XTRA
9741     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9743     if test -z "$x_includes"; then
9744         x_includes="default_x_includes"
9745     fi
9746     if test -z "$x_libraries"; then
9747         x_libraries="default_x_libraries"
9748     fi
9749     CFLAGS="$CFLAGS $X_CFLAGS"
9750     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9751     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9752 else
9753     x_includes="no_x_includes"
9754     x_libraries="no_x_libraries"
9757 if test "$USING_X11" = TRUE; then
9758     dnl ===================================================================
9759     dnl Check for extension headers
9760     dnl ===================================================================
9761     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9762      [#include <X11/extensions/shape.h>])
9764     # vcl needs ICE and SM
9765     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9766     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9767         [AC_MSG_ERROR(ICE library not found)])
9768     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9769     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9770         [AC_MSG_ERROR(SM library not found)])
9773 dnl ===================================================================
9774 dnl Check for system Xrender
9775 dnl ===================================================================
9776 AC_MSG_CHECKING([whether to use Xrender])
9777 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9778     AC_MSG_RESULT([yes])
9779     PKG_CHECK_MODULES(XRENDER, xrender)
9780     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9781     FilterLibs "${XRENDER_LIBS}"
9782     XRENDER_LIBS="${filteredlibs}"
9783     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9784       [AC_MSG_ERROR(libXrender not found or functional)], [])
9785     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9786       [AC_MSG_ERROR(Xrender not found. install X)], [])
9787 else
9788     AC_MSG_RESULT([no])
9790 AC_SUBST(XRENDER_CFLAGS)
9791 AC_SUBST(XRENDER_LIBS)
9793 dnl ===================================================================
9794 dnl Check for XRandr
9795 dnl ===================================================================
9796 AC_MSG_CHECKING([whether to enable RandR support])
9797 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9798     AC_MSG_RESULT([yes])
9799     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9800     if test "$ENABLE_RANDR" != "TRUE"; then
9801         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9802                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9803         XRANDR_CFLAGS=" "
9804         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9805           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9806         XRANDR_LIBS="-lXrandr "
9807         ENABLE_RANDR="TRUE"
9808     fi
9809     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9810     FilterLibs "${XRANDR_LIBS}"
9811     XRANDR_LIBS="${filteredlibs}"
9812 else
9813     ENABLE_RANDR=""
9814     AC_MSG_RESULT([no])
9816 AC_SUBST(XRANDR_CFLAGS)
9817 AC_SUBST(XRANDR_LIBS)
9818 AC_SUBST(ENABLE_RANDR)
9820 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9821     WITH_WEBDAV="serf"
9823 if test $_os = iOS -o $_os = Android; then
9824     WITH_WEBDAV="no"
9826 AC_MSG_CHECKING([for webdav library])
9827 case "$WITH_WEBDAV" in
9828 curl)
9829     AC_MSG_RESULT([curl])
9830     # curl is already mandatory (almost) and checked elsewhere
9831     if test "$enable_curl" = "no"; then
9832         AC_MSG_ERROR(["--with-webdav=curl conflicts with --disable-curl"])
9833     fi
9834     ;;
9835 serf)
9836     AC_MSG_RESULT([serf])
9837     # Check for system apr-util
9838     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9839                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9840                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9841     if test "$COM" = "MSC"; then
9842         APR_LIB_DIR="LibR"
9843         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9844         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9845     fi
9847     # Check for system serf
9848     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9849                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9850     if test "$COM" = "MSC"; then
9851         SERF_LIB_DIR="Release"
9852         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9853         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9854     fi
9855     ;;
9856 neon)
9857     AC_MSG_RESULT([neon])
9858     # Check for system neon
9859     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9860     if test "$with_system_neon" = "yes"; then
9861         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9862     else
9863         NEON_VERSION=0295
9864     fi
9865     AC_SUBST(NEON_VERSION)
9866     ;;
9868     AC_MSG_RESULT([none, disabled])
9869     WITH_WEBDAV=""
9870     ;;
9871 esac
9872 AC_SUBST(WITH_WEBDAV)
9874 dnl ===================================================================
9875 dnl Check for disabling cve_tests
9876 dnl ===================================================================
9877 AC_MSG_CHECKING([whether to execute CVE tests])
9878 # If not explicitly enabled or disabled, default
9879 if test -z "$enable_cve_tests"; then
9880     case "$OS" in
9881     WNT)
9882         # Default cves off for Windows with its wild and wonderful
9883         # variety of AV software kicking in and panicking
9884         enable_cve_tests=no
9885         ;;
9886     *)
9887         # otherwise yes
9888         enable_cve_tests=yes
9889         ;;
9890     esac
9892 if test "$enable_cve_tests" = "no"; then
9893     AC_MSG_RESULT([no])
9894     DISABLE_CVE_TESTS=TRUE
9895     AC_SUBST(DISABLE_CVE_TESTS)
9896 else
9897     AC_MSG_RESULT([yes])
9900 dnl ===================================================================
9901 dnl Check for enabling chart XShape tests
9902 dnl ===================================================================
9903 AC_MSG_CHECKING([whether to execute chart XShape tests])
9904 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9905     AC_MSG_RESULT([yes])
9906     ENABLE_CHART_TESTS=TRUE
9907     AC_SUBST(ENABLE_CHART_TESTS)
9908 else
9909     AC_MSG_RESULT([no])
9912 dnl ===================================================================
9913 dnl Check for system openssl
9914 dnl ===================================================================
9915 DISABLE_OPENSSL=
9916 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9917 if test "$enable_openssl" = "yes"; then
9918     AC_MSG_RESULT([no])
9919     if test "$_os" = Darwin ; then
9920         # OpenSSL is deprecated when building for 10.7 or later.
9921         #
9922         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9923         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9925         with_system_openssl=no
9926         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9927     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9928             && test "$with_system_openssl" != "no"; then
9929         with_system_openssl=yes
9930         SYSTEM_OPENSSL=TRUE
9931         OPENSSL_CFLAGS=
9932         OPENSSL_LIBS="-lssl -lcrypto"
9933     else
9934         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9935     fi
9936     if test "$with_system_openssl" = "yes"; then
9937         AC_MSG_CHECKING([whether openssl supports SHA512])
9938         AC_LANG_PUSH([C])
9939         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9940             SHA512_CTX context;
9941 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9942         AC_LANG_POP(C)
9943     fi
9944 else
9945     AC_MSG_RESULT([yes])
9946     DISABLE_OPENSSL=TRUE
9948     # warn that although OpenSSL is disabled, system libraries may depend on it
9949     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9950     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9953 AC_SUBST([DISABLE_OPENSSL])
9955 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9956     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9957         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9958         enable_cipher_openssl_backend=no
9959     else
9960         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9961     fi
9963 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9964 ENABLE_CIPHER_OPENSSL_BACKEND=
9965 if test "$enable_cipher_openssl_backend" = yes; then
9966     AC_MSG_RESULT([yes])
9967     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9968 else
9969     AC_MSG_RESULT([no])
9971 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9973 dnl ===================================================================
9974 dnl Check for building gnutls
9975 dnl ===================================================================
9976 AC_MSG_CHECKING([whether to use gnutls])
9977 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9978     AC_MSG_RESULT([yes])
9979     AM_PATH_LIBGCRYPT()
9980     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9981         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9982                       available in the system to use as replacement.]]))
9983     FilterLibs "${LIBGCRYPT_LIBS}"
9984     LIBGCRYPT_LIBS="${filteredlibs}"
9985 else
9986     AC_MSG_RESULT([no])
9989 AC_SUBST([LIBGCRYPT_CFLAGS])
9990 AC_SUBST([LIBGCRYPT_LIBS])
9992 dnl ===================================================================
9993 dnl Check for system redland
9994 dnl ===================================================================
9995 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9996 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9997 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9998 if test "$with_system_redland" = "yes"; then
9999     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10000             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10001 else
10002     RAPTOR_MAJOR="0"
10003     RASQAL_MAJOR="3"
10004     REDLAND_MAJOR="0"
10006 AC_SUBST(RAPTOR_MAJOR)
10007 AC_SUBST(RASQAL_MAJOR)
10008 AC_SUBST(REDLAND_MAJOR)
10010 dnl ===================================================================
10011 dnl Check for system hunspell
10012 dnl ===================================================================
10013 AC_MSG_CHECKING([which libhunspell to use])
10014 if test "$with_system_hunspell" = "yes"; then
10015     AC_MSG_RESULT([external])
10016     SYSTEM_HUNSPELL=TRUE
10017     AC_LANG_PUSH([C++])
10018     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10019     if test "$HUNSPELL_PC" != "TRUE"; then
10020         AC_CHECK_HEADER(hunspell.hxx, [],
10021             [
10022             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10023             [AC_MSG_ERROR(hunspell headers not found.)], [])
10024             ], [])
10025         AC_CHECK_LIB([hunspell], [main], [:],
10026            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10027         HUNSPELL_LIBS=-lhunspell
10028     fi
10029     AC_LANG_POP([C++])
10030     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10031     FilterLibs "${HUNSPELL_LIBS}"
10032     HUNSPELL_LIBS="${filteredlibs}"
10033 else
10034     AC_MSG_RESULT([internal])
10035     SYSTEM_HUNSPELL=
10036     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10037     if test "$COM" = "MSC"; then
10038         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10039     else
10040         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10041     fi
10042     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10044 AC_SUBST(SYSTEM_HUNSPELL)
10045 AC_SUBST(HUNSPELL_CFLAGS)
10046 AC_SUBST(HUNSPELL_LIBS)
10048 dnl ===================================================================
10049 dnl Check for system qrcodegen
10050 dnl ===================================================================
10051 AC_MSG_CHECKING([whether to use libqrcodegen])
10052 if test "$enable_qrcodegen" = "no"; then
10053     AC_MSG_RESULT([no])
10054     ENABLE_QRCODEGEN=
10055     SYSTEM_QRCODEGEN=
10056 else
10057     AC_MSG_RESULT([yes])
10058     ENABLE_QRCODEGEN=TRUE
10059     AC_MSG_CHECKING([which libqrcodegen to use])
10060     if test "$with_system_qrcodegen" = "yes"; then
10061         AC_MSG_RESULT([external])
10062         SYSTEM_QRCODEGEN=TRUE
10063         AC_LANG_PUSH([C++])
10064         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10065             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10066         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10067             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10068         QRCODEGEN_LIBS=-lqrcodegencpp
10069         AC_LANG_POP([C++])
10070         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10071         FilterLibs "${QRCODEGEN_LIBS}"
10072         QRCODEGEN_LIBS="${filteredlibs}"
10073     else
10074         AC_MSG_RESULT([internal])
10075         SYSTEM_QRCODEGEN=
10076         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10077     fi
10078     if test "$ENABLE_QRCODEGEN" = TRUE; then
10079         AC_DEFINE(ENABLE_QRCODEGEN)
10080     fi
10082 AC_SUBST(SYSTEM_QRCODEGEN)
10083 AC_SUBST(ENABLE_QRCODEGEN)
10084 AC_SUBST(QRCODEGEN_CFLAGS)
10085 AC_SUBST(QRCODEGEN_LIBS)
10087 dnl ===================================================================
10088 dnl Checking for altlinuxhyph
10089 dnl ===================================================================
10090 AC_MSG_CHECKING([which altlinuxhyph to use])
10091 if test "$with_system_altlinuxhyph" = "yes"; then
10092     AC_MSG_RESULT([external])
10093     SYSTEM_HYPH=TRUE
10094     AC_CHECK_HEADER(hyphen.h, [],
10095        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10096     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10097        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10098        [#include <hyphen.h>])
10099     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10100         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10101     if test -z "$HYPHEN_LIB"; then
10102         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10103            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10104     fi
10105     if test -z "$HYPHEN_LIB"; then
10106         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10107            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10108     fi
10109 else
10110     AC_MSG_RESULT([internal])
10111     SYSTEM_HYPH=
10112     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10113     if test "$COM" = "MSC"; then
10114         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10115     else
10116         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10117     fi
10119 AC_SUBST(SYSTEM_HYPH)
10120 AC_SUBST(HYPHEN_LIB)
10122 dnl ===================================================================
10123 dnl Checking for mythes
10124 dnl ===================================================================
10125 AC_MSG_CHECKING([which mythes to use])
10126 if test "$with_system_mythes" = "yes"; then
10127     AC_MSG_RESULT([external])
10128     SYSTEM_MYTHES=TRUE
10129     AC_LANG_PUSH([C++])
10130     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10131     if test "$MYTHES_PKGCONFIG" = "no"; then
10132         AC_CHECK_HEADER(mythes.hxx, [],
10133             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10134         AC_CHECK_LIB([mythes-1.2], [main], [:],
10135             [ MYTHES_FOUND=no], [])
10136     if test "$MYTHES_FOUND" = "no"; then
10137         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10138                 [ MYTHES_FOUND=no], [])
10139     fi
10140     if test "$MYTHES_FOUND" = "no"; then
10141         AC_MSG_ERROR([mythes library not found!.])
10142     fi
10143     fi
10144     AC_LANG_POP([C++])
10145     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10146     FilterLibs "${MYTHES_LIBS}"
10147     MYTHES_LIBS="${filteredlibs}"
10148 else
10149     AC_MSG_RESULT([internal])
10150     SYSTEM_MYTHES=
10151     BUILD_TYPE="$BUILD_TYPE MYTHES"
10152     if test "$COM" = "MSC"; then
10153         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10154     else
10155         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10156     fi
10158 AC_SUBST(SYSTEM_MYTHES)
10159 AC_SUBST(MYTHES_CFLAGS)
10160 AC_SUBST(MYTHES_LIBS)
10162 dnl ===================================================================
10163 dnl How should we build the linear programming solver ?
10164 dnl ===================================================================
10166 ENABLE_COINMP=
10167 AC_MSG_CHECKING([whether to build with CoinMP])
10168 if test "$enable_coinmp" != "no"; then
10169     ENABLE_COINMP=TRUE
10170     AC_MSG_RESULT([yes])
10171     if test "$with_system_coinmp" = "yes"; then
10172         SYSTEM_COINMP=TRUE
10173         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10174         FilterLibs "${COINMP_LIBS}"
10175         COINMP_LIBS="${filteredlibs}"
10176     else
10177         BUILD_TYPE="$BUILD_TYPE COINMP"
10178     fi
10179 else
10180     AC_MSG_RESULT([no])
10182 AC_SUBST(ENABLE_COINMP)
10183 AC_SUBST(SYSTEM_COINMP)
10184 AC_SUBST(COINMP_CFLAGS)
10185 AC_SUBST(COINMP_LIBS)
10187 ENABLE_LPSOLVE=
10188 AC_MSG_CHECKING([whether to build with lpsolve])
10189 if test "$enable_lpsolve" != "no"; then
10190     ENABLE_LPSOLVE=TRUE
10191     AC_MSG_RESULT([yes])
10192 else
10193     AC_MSG_RESULT([no])
10195 AC_SUBST(ENABLE_LPSOLVE)
10197 if test "$ENABLE_LPSOLVE" = TRUE; then
10198     AC_MSG_CHECKING([which lpsolve to use])
10199     if test "$with_system_lpsolve" = "yes"; then
10200         AC_MSG_RESULT([external])
10201         SYSTEM_LPSOLVE=TRUE
10202         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10203            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10204         save_LIBS=$LIBS
10205         # some systems need this. Like Ubuntu...
10206         AC_CHECK_LIB(m, floor)
10207         AC_CHECK_LIB(dl, dlopen)
10208         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10209             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10210         LIBS=$save_LIBS
10211     else
10212         AC_MSG_RESULT([internal])
10213         SYSTEM_LPSOLVE=
10214         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10215     fi
10217 AC_SUBST(SYSTEM_LPSOLVE)
10219 dnl ===================================================================
10220 dnl Checking for libexttextcat
10221 dnl ===================================================================
10222 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10223 if test "$with_system_libexttextcat" = "yes"; then
10224     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10226 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10228 dnl ===================================================================
10229 dnl Checking for libnumbertext
10230 dnl ===================================================================
10231 AC_MSG_CHECKING([whether to use libnumbertext])
10232 if test "$enable_libnumbertext" = "no"; then
10233     AC_MSG_RESULT([no])
10234     ENABLE_LIBNUMBERTEXT=
10235     SYSTEM_LIBNUMBERTEXT=
10236 else
10237     AC_MSG_RESULT([yes])
10238     ENABLE_LIBNUMBERTEXT=TRUE
10239     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10240     if test "$with_system_libnumbertext" = "yes"; then
10241         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10242         SYSTEM_LIBNUMBERTEXT=YES
10243     else
10244         SYSTEM_LIBNUMBERTEXT=
10245         AC_LANG_PUSH([C++])
10246         save_CPPFLAGS=$CPPFLAGS
10247         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10248         AC_CHECK_HEADERS([codecvt regex])
10249         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10250                 [ ENABLE_LIBNUMBERTEXT=''
10251                   LIBNUMBERTEXT_CFLAGS=''
10252                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10253                                Enable libnumbertext fallback (missing number to number name conversion).])
10254                 ])
10255         CPPFLAGS=$save_CPPFLAGS
10256         AC_LANG_POP([C++])
10257     fi
10258     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10259         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10260     fi
10262 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10263 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10264 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10265 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10267 dnl ***************************************
10268 dnl testing libc version for Linux...
10269 dnl ***************************************
10270 if test "$_os" = "Linux"; then
10271     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10272     exec 6>/dev/null # no output
10273     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10274     exec 6>&1 # output on again
10275     if test "$HAVE_LIBC"; then
10276         AC_MSG_RESULT([yes])
10277     else
10278         AC_MSG_ERROR([no, upgrade libc])
10279     fi
10282 dnl =========================================
10283 dnl Check for uuidgen
10284 dnl =========================================
10285 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10286     # presence is already tested above in the WINDOWS_SDK_HOME check
10287     UUIDGEN=uuidgen.exe
10288     AC_SUBST(UUIDGEN)
10289 else
10290     AC_PATH_PROG([UUIDGEN], [uuidgen])
10291     if test -z "$UUIDGEN"; then
10292         AC_MSG_WARN([uuid is needed for building installation sets])
10293     fi
10296 dnl ***************************************
10297 dnl Checking for bison and flex
10298 dnl ***************************************
10299 AC_PATH_PROG(BISON, bison)
10300 if test -z "$BISON"; then
10301     AC_MSG_ERROR([no bison found in \$PATH, install it])
10302 else
10303     AC_MSG_CHECKING([the bison version])
10304     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10305     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10306     # Accept newer than 2.0
10307     if test "$_bison_longver" -lt 2000; then
10308         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10309     fi
10312 AC_PATH_PROG(FLEX, flex)
10313 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10314     FLEX=`cygpath -m $FLEX`
10316 if test -z "$FLEX"; then
10317     AC_MSG_ERROR([no flex found in \$PATH, install it])
10318 else
10319     AC_MSG_CHECKING([the flex version])
10320     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10321     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10322         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10323     fi
10325 AC_SUBST([FLEX])
10326 dnl ***************************************
10327 dnl Checking for patch
10328 dnl ***************************************
10329 AC_PATH_PROG(PATCH, patch)
10330 if test -z "$PATCH"; then
10331     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10334 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10335 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10336     if test -z "$with_gnu_patch"; then
10337         GNUPATCH=$PATCH
10338     else
10339         if test -x "$with_gnu_patch"; then
10340             GNUPATCH=$with_gnu_patch
10341         else
10342             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10343         fi
10344     fi
10346     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10347     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10348         AC_MSG_RESULT([yes])
10349     else
10350         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10351     fi
10352 else
10353     GNUPATCH=$PATCH
10356 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10357     GNUPATCH=`cygpath -m $GNUPATCH`
10360 dnl We also need to check for --with-gnu-cp
10362 if test -z "$with_gnu_cp"; then
10363     # check the place where the good stuff is hidden on Solaris...
10364     if test -x /usr/gnu/bin/cp; then
10365         GNUCP=/usr/gnu/bin/cp
10366     else
10367         AC_PATH_PROGS(GNUCP, gnucp cp)
10368     fi
10369     if test -z $GNUCP; then
10370         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10371     fi
10372 else
10373     if test -x "$with_gnu_cp"; then
10374         GNUCP=$with_gnu_cp
10375     else
10376         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10377     fi
10380 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10381     GNUCP=`cygpath -m $GNUCP`
10384 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10385 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10386     AC_MSG_RESULT([yes])
10387 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10388     AC_MSG_RESULT([yes])
10389 else
10390     case "$build_os" in
10391     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10392         x_GNUCP=[\#]
10393         GNUCP=''
10394         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10395         ;;
10396     *)
10397         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10398         ;;
10399     esac
10402 AC_SUBST(GNUPATCH)
10403 AC_SUBST(GNUCP)
10404 AC_SUBST(x_GNUCP)
10406 dnl ***************************************
10407 dnl testing assembler path
10408 dnl ***************************************
10409 ML_EXE=""
10410 if test "$_os" = "WINNT"; then
10411     if test "$BITNESS_OVERRIDE" = ""; then
10412         assembler=ml.exe
10413     else
10414         assembler=ml64.exe
10415     fi
10417     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10418     if test -f "$CL_PATH/$assembler"; then
10419         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10420         AC_MSG_RESULT([$ML_EXE])
10421     else
10422         AC_MSG_ERROR([not found])
10423     fi
10426 AC_SUBST(ML_EXE)
10428 dnl ===================================================================
10429 dnl We need zip and unzip
10430 dnl ===================================================================
10431 AC_PATH_PROG(ZIP, zip)
10432 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10433 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10434     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],,)
10437 AC_PATH_PROG(UNZIP, unzip)
10438 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10440 dnl ===================================================================
10441 dnl Zip must be a specific type for different build types.
10442 dnl ===================================================================
10443 if test $build_os = cygwin; then
10444     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10445         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10446     fi
10449 dnl ===================================================================
10450 dnl We need touch with -h option support.
10451 dnl ===================================================================
10452 AC_PATH_PROG(TOUCH, touch)
10453 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10454 touch warn
10455 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10456     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],,)
10459 dnl ===================================================================
10460 dnl Check for system epoxy
10461 dnl ===================================================================
10462 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10464 dnl ===================================================================
10465 dnl Set vcl option: coordinate device in double or sal_Int32
10466 dnl ===================================================================
10468 dnl disabled for now, we don't want subtle differences between OSs
10469 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10470 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10471 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10472 dnl     AC_MSG_RESULT([double])
10473 dnl else
10474 dnl     AC_MSG_RESULT([sal_Int32])
10475 dnl fi
10477 dnl ===================================================================
10478 dnl Test which vclplugs have to be built.
10479 dnl ===================================================================
10480 R=""
10481 if test "$USING_X11" != TRUE; then
10482     enable_gtk3=no
10484 GTK3_CFLAGS=""
10485 GTK3_LIBS=""
10486 ENABLE_GTK3=""
10487 if test "x$enable_gtk3" = "xyes"; then
10488     if test "$with_system_cairo" = no; then
10489         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10490     fi
10491     : ${with_system_cairo:=yes}
10492     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="")
10493     if test "x$ENABLE_GTK3" = "xTRUE"; then
10494         AC_DEFINE(ENABLE_GTK3)
10495         R="gtk3"
10496     else
10497         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10498     fi
10499     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10500     FilterLibs "${GTK3_LIBS}"
10501     GTK3_LIBS="${filteredlibs}"
10503     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10504     if test "$with_system_epoxy" != "yes"; then
10505         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10506         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10507                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10508     fi
10510 AC_SUBST(GTK3_LIBS)
10511 AC_SUBST(GTK3_CFLAGS)
10512 AC_SUBST(ENABLE_GTK3)
10514 if test "$enable_introspection" = yes; then
10515     if test "$ENABLE_GTK3" = TRUE; then
10516         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10517     else
10518         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10519     fi
10522 ENABLE_QT5=""
10523 if test "x$enable_qt5" = "xyes"; then
10524     ENABLE_QT5="TRUE"
10525     AC_DEFINE(ENABLE_QT5)
10526     R="$R qt5"
10528 AC_SUBST(ENABLE_QT5)
10530 ENABLE_KF5=""
10531 if test "x$enable_kf5" = "xyes"; then
10532     ENABLE_KF5="TRUE"
10533     AC_DEFINE(ENABLE_KF5)
10534     R="$R kf5"
10536 AC_SUBST(ENABLE_KF5)
10538 ENABLE_GTK3_KDE5=""
10539 if test "x$enable_gtk3_kde5" = "xyes"; then
10540     ENABLE_GTK3_KDE5="TRUE"
10541     AC_DEFINE(ENABLE_GTK3_KDE5)
10542     R="$R gtk3_kde5"
10544 AC_SUBST(ENABLE_GTK3_KDE5)
10546 if test "$_os" = "WINNT"; then
10547     R="$R win"
10548 elif test "$_os" = "Darwin"; then
10549     R="$R osx"
10550 elif test "$_os" = "iOS"; then
10551     R="ios (builtin)"
10554 build_vcl_plugins="$R"
10555 if test -z "$build_vcl_plugins"; then
10556     build_vcl_plugins="none"
10558 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10560 dnl ===================================================================
10561 dnl check for dbus support
10562 dnl ===================================================================
10563 ENABLE_DBUS=""
10564 DBUS_CFLAGS=""
10565 DBUS_LIBS=""
10566 DBUS_GLIB_CFLAGS=""
10567 DBUS_GLIB_LIBS=""
10568 DBUS_HAVE_GLIB=""
10570 if test "$enable_dbus" = "no"; then
10571     test_dbus=no
10574 AC_MSG_CHECKING([whether to enable DBUS support])
10575 if test "$test_dbus" = "yes"; then
10576     ENABLE_DBUS="TRUE"
10577     AC_MSG_RESULT([yes])
10578     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10579     AC_DEFINE(ENABLE_DBUS)
10580     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10581     FilterLibs "${DBUS_LIBS}"
10582     DBUS_LIBS="${filteredlibs}"
10584     # Glib is needed for BluetoothServer
10585     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10586     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10587         [
10588             DBUS_HAVE_GLIB="TRUE"
10589             AC_DEFINE(DBUS_HAVE_GLIB,1)
10590         ],
10591         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10592     )
10593 else
10594     AC_MSG_RESULT([no])
10597 AC_SUBST(ENABLE_DBUS)
10598 AC_SUBST(DBUS_CFLAGS)
10599 AC_SUBST(DBUS_LIBS)
10600 AC_SUBST(DBUS_GLIB_CFLAGS)
10601 AC_SUBST(DBUS_GLIB_LIBS)
10602 AC_SUBST(DBUS_HAVE_GLIB)
10604 AC_MSG_CHECKING([whether to enable Impress remote control])
10605 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10606     AC_MSG_RESULT([yes])
10607     ENABLE_SDREMOTE=TRUE
10608     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10610     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10611         # The Bluetooth code doesn't compile with macOS SDK 10.15
10612         enable_sdremote_bluetooth=no
10613     fi
10614     # If not explicitly enabled or disabled, default
10615     if test -z "$enable_sdremote_bluetooth"; then
10616         case "$OS" in
10617         LINUX|MACOSX|WNT)
10618             # Default to yes for these
10619             enable_sdremote_bluetooth=yes
10620             ;;
10621         *)
10622             # otherwise no
10623             enable_sdremote_bluetooth=no
10624             ;;
10625         esac
10626     fi
10627     # $enable_sdremote_bluetooth is guaranteed non-empty now
10629     if test "$enable_sdremote_bluetooth" != "no"; then
10630         if test "$OS" = "LINUX"; then
10631             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10632                 AC_MSG_RESULT([yes])
10633                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10634                 dnl ===================================================================
10635                 dnl Check for system bluez
10636                 dnl ===================================================================
10637                 AC_MSG_CHECKING([which Bluetooth header to use])
10638                 if test "$with_system_bluez" = "yes"; then
10639                     AC_MSG_RESULT([external])
10640                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10641                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10642                     SYSTEM_BLUEZ=TRUE
10643                 else
10644                     AC_MSG_RESULT([internal])
10645                     SYSTEM_BLUEZ=
10646                 fi
10647             else
10648                 AC_MSG_RESULT([no, dbus disabled])
10649                 ENABLE_SDREMOTE_BLUETOOTH=
10650                 SYSTEM_BLUEZ=
10651             fi
10652         else
10653             AC_MSG_RESULT([yes])
10654             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10655             SYSTEM_BLUEZ=
10656         fi
10657     else
10658         AC_MSG_RESULT([no])
10659         ENABLE_SDREMOTE_BLUETOOTH=
10660         SYSTEM_BLUEZ=
10661     fi
10662 else
10663     ENABLE_SDREMOTE=
10664     SYSTEM_BLUEZ=
10665     AC_MSG_RESULT([no])
10667 AC_SUBST(ENABLE_SDREMOTE)
10668 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10669 AC_SUBST(SYSTEM_BLUEZ)
10671 dnl ===================================================================
10672 dnl Check whether to enable GIO support
10673 dnl ===================================================================
10674 if test "$ENABLE_GTK3" = "TRUE"; then
10675     AC_MSG_CHECKING([whether to enable GIO support])
10676     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10677         dnl Need at least 2.26 for the dbus support.
10678         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10679                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10680         if test "$ENABLE_GIO" = "TRUE"; then
10681             AC_DEFINE(ENABLE_GIO)
10682             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10683             FilterLibs "${GIO_LIBS}"
10684             GIO_LIBS="${filteredlibs}"
10685         fi
10686     else
10687         AC_MSG_RESULT([no])
10688     fi
10690 AC_SUBST(ENABLE_GIO)
10691 AC_SUBST(GIO_CFLAGS)
10692 AC_SUBST(GIO_LIBS)
10695 dnl ===================================================================
10697 SPLIT_APP_MODULES=""
10698 if test "$enable_split_app_modules" = "yes"; then
10699     SPLIT_APP_MODULES="TRUE"
10701 AC_SUBST(SPLIT_APP_MODULES)
10703 SPLIT_OPT_FEATURES=""
10704 if test "$enable_split_opt_features" = "yes"; then
10705     SPLIT_OPT_FEATURES="TRUE"
10707 AC_SUBST(SPLIT_OPT_FEATURES)
10709 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10710     if test "$enable_cairo_canvas" = yes; then
10711         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10712     fi
10713     enable_cairo_canvas=no
10714 elif test -z "$enable_cairo_canvas"; then
10715     enable_cairo_canvas=yes
10718 ENABLE_CAIRO_CANVAS=""
10719 if test "$enable_cairo_canvas" = "yes"; then
10720     test_cairo=yes
10721     ENABLE_CAIRO_CANVAS="TRUE"
10722     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10724 AC_SUBST(ENABLE_CAIRO_CANVAS)
10726 dnl ===================================================================
10727 dnl Check whether the GStreamer libraries are available.
10728 dnl ===================================================================
10730 ENABLE_GSTREAMER_1_0=""
10732 if test "$build_gstreamer_1_0" = "yes"; then
10734     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10735     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10736         ENABLE_GSTREAMER_1_0="TRUE"
10737         AC_MSG_RESULT([yes])
10738         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10739         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10740         FilterLibs "${GSTREAMER_1_0_LIBS}"
10741         GSTREAMER_1_0_LIBS="${filteredlibs}"
10742         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10743     else
10744         AC_MSG_RESULT([no])
10745     fi
10747 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10748 AC_SUBST(GSTREAMER_1_0_LIBS)
10749 AC_SUBST(ENABLE_GSTREAMER_1_0)
10751 dnl ===================================================================
10752 dnl Check whether to build the VLC avmedia backend
10753 dnl ===================================================================
10755 ENABLE_VLC=""
10757 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10758 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10759     ENABLE_VLC="TRUE"
10760     AC_MSG_RESULT([yes])
10761 else
10762     AC_MSG_RESULT([no])
10764 AC_SUBST(ENABLE_VLC)
10766 ENABLE_OPENGL_TRANSITIONS=
10767 ENABLE_OPENGL_CANVAS=
10768 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10769    : # disable
10770 elif test "$_os" = "Darwin"; then
10771     # We use frameworks on macOS, no need for detail checks
10772     ENABLE_OPENGL_TRANSITIONS=TRUE
10773     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10774     ENABLE_OPENGL_CANVAS=TRUE
10775 elif test $_os = WINNT; then
10776     ENABLE_OPENGL_TRANSITIONS=TRUE
10777     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10778     ENABLE_OPENGL_CANVAS=TRUE
10779 else
10780     if test "$USING_X11" = TRUE; then
10781         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10782         ENABLE_OPENGL_TRANSITIONS=TRUE
10783         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10784         ENABLE_OPENGL_CANVAS=TRUE
10785     fi
10788 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10789 AC_SUBST(ENABLE_OPENGL_CANVAS)
10791 dnl =================================================
10792 dnl Check whether to build with OpenCL support.
10793 dnl =================================================
10795 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10796     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10797     # platform (optional at run-time, used through clew).
10798     BUILD_TYPE="$BUILD_TYPE OPENCL"
10799     AC_DEFINE(HAVE_FEATURE_OPENCL)
10802 dnl =================================================
10803 dnl Check whether to build with dconf support.
10804 dnl =================================================
10806 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10807     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10808         if test "$enable_dconf" = yes; then
10809             AC_MSG_ERROR([dconf not found])
10810         else
10811             enable_dconf=no
10812         fi])
10814 AC_MSG_CHECKING([whether to enable dconf])
10815 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10816     DCONF_CFLAGS=
10817     DCONF_LIBS=
10818     ENABLE_DCONF=
10819     AC_MSG_RESULT([no])
10820 else
10821     ENABLE_DCONF=TRUE
10822     AC_DEFINE(ENABLE_DCONF)
10823     AC_MSG_RESULT([yes])
10825 AC_SUBST([DCONF_CFLAGS])
10826 AC_SUBST([DCONF_LIBS])
10827 AC_SUBST([ENABLE_DCONF])
10829 # pdf import?
10830 AC_MSG_CHECKING([whether to build the PDF import feature])
10831 ENABLE_PDFIMPORT=
10832 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10833     AC_MSG_RESULT([yes])
10834     ENABLE_PDFIMPORT=TRUE
10835     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10836 else
10837     AC_MSG_RESULT([no])
10840 # Pdfium?
10841 AC_MSG_CHECKING([whether to build PDFium])
10842 ENABLE_PDFIUM=
10843 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10844     AC_MSG_RESULT([yes])
10845     ENABLE_PDFIUM=TRUE
10846     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10847     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10848 else
10849     AC_MSG_RESULT([no])
10851 AC_SUBST(ENABLE_PDFIUM)
10853 dnl ===================================================================
10854 dnl Check for poppler
10855 dnl ===================================================================
10856 ENABLE_POPPLER=
10857 AC_MSG_CHECKING([whether to build Poppler])
10858 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10859     AC_MSG_RESULT([yes])
10860     ENABLE_POPPLER=TRUE
10861     AC_DEFINE(HAVE_FEATURE_POPPLER)
10862 else
10863     AC_MSG_RESULT([no])
10865 AC_SUBST(ENABLE_POPPLER)
10867 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10868     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10871 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10872     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10875 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10876     dnl ===================================================================
10877     dnl Check for system poppler
10878     dnl ===================================================================
10879     AC_MSG_CHECKING([which PDF import poppler to use])
10880     if test "$with_system_poppler" = "yes"; then
10881         AC_MSG_RESULT([external])
10882         SYSTEM_POPPLER=TRUE
10883         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10884         AC_LANG_PUSH([C++])
10885         save_CXXFLAGS=$CXXFLAGS
10886         save_CPPFLAGS=$CPPFLAGS
10887         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10888         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10889         AC_CHECK_HEADER([cpp/poppler-version.h],
10890             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10891             [])
10892         CXXFLAGS=$save_CXXFLAGS
10893         CPPFLAGS=$save_CPPFLAGS
10894         AC_LANG_POP([C++])
10895         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10897         FilterLibs "${POPPLER_LIBS}"
10898         POPPLER_LIBS="${filteredlibs}"
10899     else
10900         AC_MSG_RESULT([internal])
10901         SYSTEM_POPPLER=
10902         BUILD_TYPE="$BUILD_TYPE POPPLER"
10903         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10904     fi
10905     AC_DEFINE([ENABLE_PDFIMPORT],1)
10907 AC_SUBST(ENABLE_PDFIMPORT)
10908 AC_SUBST(SYSTEM_POPPLER)
10909 AC_SUBST(POPPLER_CFLAGS)
10910 AC_SUBST(POPPLER_LIBS)
10912 SYSTEM_GPGMEPP=
10914 if test "$build_for_ios" = "YES"; then
10915     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10916     AC_MSG_RESULT([yes])
10917 elif test "$enable_mpl_subset" = "yes"; then
10918     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10919     AC_MSG_RESULT([yes])
10920 elif test "$enable_fuzzers" = "yes"; then
10921     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10922     AC_MSG_RESULT([yes])
10923 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10924     dnl ===================================================================
10925     dnl Check for system gpgme
10926     dnl ===================================================================
10927     AC_MSG_CHECKING([which gpgmepp to use])
10928     if test "$with_system_gpgmepp" = "yes"; then
10929         AC_MSG_RESULT([external])
10930         SYSTEM_GPGMEPP=TRUE
10932         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10933         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10934             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10935         # progress_callback is the only func with plain C linkage
10936         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10937         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10938             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10939         AC_CHECK_HEADER(gpgme.h, [],
10940             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10941     else
10942         AC_MSG_RESULT([internal])
10943         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10944         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10946         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10947         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10948         if test "$_os" != "WINNT"; then
10949             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10950             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10951         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10952             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10953         fi
10954     fi
10955     ENABLE_GPGMEPP=TRUE
10956     AC_DEFINE([HAVE_FEATURE_GPGME])
10957     AC_PATH_PROG(GPG, gpg)
10958     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10959     # so let's exclude that manually for the moment
10960     if test -n "$GPG" -a "$_os" != "WINNT"; then
10961         # make sure we not only have a working gpgme, but a full working
10962         # gpg installation to run OpenPGP signature verification
10963         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10964     fi
10965     if test "$_os" = "Linux"; then
10966       uid=`id -u`
10967       AC_MSG_CHECKING([for /run/user/$uid])
10968       if test -d /run/user/$uid; then
10969         AC_MSG_RESULT([yes])
10970         AC_PATH_PROG(GPGCONF, gpgconf)
10972         # Older versions of gpgconf are not working as expected, since
10973         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10974         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10975         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10976         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10977         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10978         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10979         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10980           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10981           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10982           if $GPGCONF --dump-options > /dev/null ; then
10983             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10984               AC_MSG_RESULT([yes])
10985               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10986               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10987             else
10988               AC_MSG_RESULT([no])
10989             fi
10990           else
10991             AC_MSG_RESULT([no. missing or broken gpgconf?])
10992           fi
10993         else
10994           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10995         fi
10996       else
10997         AC_MSG_RESULT([no])
10998      fi
10999    fi
11001 AC_SUBST(ENABLE_GPGMEPP)
11002 AC_SUBST(SYSTEM_GPGMEPP)
11003 AC_SUBST(GPG_ERROR_CFLAGS)
11004 AC_SUBST(GPG_ERROR_LIBS)
11005 AC_SUBST(LIBASSUAN_CFLAGS)
11006 AC_SUBST(LIBASSUAN_LIBS)
11007 AC_SUBST(GPGMEPP_CFLAGS)
11008 AC_SUBST(GPGMEPP_LIBS)
11010 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11011 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11012     AC_MSG_RESULT([yes])
11013     ENABLE_MEDIAWIKI=TRUE
11014     BUILD_TYPE="$BUILD_TYPE XSLTML"
11015     if test  "x$with_java" = "xno"; then
11016         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11017     fi
11018 else
11019     AC_MSG_RESULT([no])
11020     ENABLE_MEDIAWIKI=
11021     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11023 AC_SUBST(ENABLE_MEDIAWIKI)
11025 AC_MSG_CHECKING([whether to build the Report Builder])
11026 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11027     AC_MSG_RESULT([yes])
11028     ENABLE_REPORTBUILDER=TRUE
11029     AC_MSG_CHECKING([which jfreereport libs to use])
11030     if test "$with_system_jfreereport" = "yes"; then
11031         SYSTEM_JFREEREPORT=TRUE
11032         AC_MSG_RESULT([external])
11033         if test -z $SAC_JAR; then
11034             SAC_JAR=/usr/share/java/sac.jar
11035         fi
11036         if ! test -f $SAC_JAR; then
11037              AC_MSG_ERROR(sac.jar not found.)
11038         fi
11040         if test -z $LIBXML_JAR; then
11041             if test -f /usr/share/java/libxml-1.0.0.jar; then
11042                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11043             elif test -f /usr/share/java/libxml.jar; then
11044                 LIBXML_JAR=/usr/share/java/libxml.jar
11045             else
11046                 AC_MSG_ERROR(libxml.jar replacement not found.)
11047             fi
11048         elif ! test -f $LIBXML_JAR; then
11049             AC_MSG_ERROR(libxml.jar not found.)
11050         fi
11052         if test -z $FLUTE_JAR; then
11053             if test -f/usr/share/java/flute-1.3.0.jar; then
11054                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11055             elif test -f /usr/share/java/flute.jar; then
11056                 FLUTE_JAR=/usr/share/java/flute.jar
11057             else
11058                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11059             fi
11060         elif ! test -f $FLUTE_JAR; then
11061             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11062         fi
11064         if test -z $JFREEREPORT_JAR; then
11065             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11066                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11067             elif test -f /usr/share/java/flow-engine.jar; then
11068                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11069             else
11070                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11071             fi
11072         elif ! test -f  $JFREEREPORT_JAR; then
11073                 AC_MSG_ERROR(jfreereport.jar not found.)
11074         fi
11076         if test -z $LIBLAYOUT_JAR; then
11077             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11078                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11079             elif test -f /usr/share/java/liblayout.jar; then
11080                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11081             else
11082                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11083             fi
11084         elif ! test -f $LIBLAYOUT_JAR; then
11085                 AC_MSG_ERROR(liblayout.jar not found.)
11086         fi
11088         if test -z $LIBLOADER_JAR; then
11089             if test -f /usr/share/java/libloader-1.0.0.jar; then
11090                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11091             elif test -f /usr/share/java/libloader.jar; then
11092                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11093             else
11094                 AC_MSG_ERROR(libloader.jar replacement not found.)
11095             fi
11096         elif ! test -f  $LIBLOADER_JAR; then
11097             AC_MSG_ERROR(libloader.jar not found.)
11098         fi
11100         if test -z $LIBFORMULA_JAR; then
11101             if test -f /usr/share/java/libformula-0.2.0.jar; then
11102                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11103             elif test -f /usr/share/java/libformula.jar; then
11104                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11105             else
11106                 AC_MSG_ERROR(libformula.jar replacement not found.)
11107             fi
11108         elif ! test -f $LIBFORMULA_JAR; then
11109                 AC_MSG_ERROR(libformula.jar not found.)
11110         fi
11112         if test -z $LIBREPOSITORY_JAR; then
11113             if test -f /usr/share/java/librepository-1.0.0.jar; then
11114                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11115             elif test -f /usr/share/java/librepository.jar; then
11116                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11117             else
11118                 AC_MSG_ERROR(librepository.jar replacement not found.)
11119             fi
11120         elif ! test -f $LIBREPOSITORY_JAR; then
11121             AC_MSG_ERROR(librepository.jar not found.)
11122         fi
11124         if test -z $LIBFONTS_JAR; then
11125             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11126                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11127             elif test -f /usr/share/java/libfonts.jar; then
11128                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11129             else
11130                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11131             fi
11132         elif ! test -f $LIBFONTS_JAR; then
11133                 AC_MSG_ERROR(libfonts.jar not found.)
11134         fi
11136         if test -z $LIBSERIALIZER_JAR; then
11137             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11138                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11139             elif test -f /usr/share/java/libserializer.jar; then
11140                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11141             else
11142                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11143             fi
11144         elif ! test -f $LIBSERIALIZER_JAR; then
11145                 AC_MSG_ERROR(libserializer.jar not found.)
11146         fi
11148         if test -z $LIBBASE_JAR; then
11149             if test -f /usr/share/java/libbase-1.0.0.jar; then
11150                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11151             elif test -f /usr/share/java/libbase.jar; then
11152                 LIBBASE_JAR=/usr/share/java/libbase.jar
11153             else
11154                 AC_MSG_ERROR(libbase.jar replacement not found.)
11155             fi
11156         elif ! test -f $LIBBASE_JAR; then
11157             AC_MSG_ERROR(libbase.jar not found.)
11158         fi
11160     else
11161         AC_MSG_RESULT([internal])
11162         SYSTEM_JFREEREPORT=
11163         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11164         NEED_ANT=TRUE
11165     fi
11166 else
11167     AC_MSG_RESULT([no])
11168     ENABLE_REPORTBUILDER=
11169     SYSTEM_JFREEREPORT=
11171 AC_SUBST(ENABLE_REPORTBUILDER)
11172 AC_SUBST(SYSTEM_JFREEREPORT)
11173 AC_SUBST(SAC_JAR)
11174 AC_SUBST(LIBXML_JAR)
11175 AC_SUBST(FLUTE_JAR)
11176 AC_SUBST(JFREEREPORT_JAR)
11177 AC_SUBST(LIBBASE_JAR)
11178 AC_SUBST(LIBLAYOUT_JAR)
11179 AC_SUBST(LIBLOADER_JAR)
11180 AC_SUBST(LIBFORMULA_JAR)
11181 AC_SUBST(LIBREPOSITORY_JAR)
11182 AC_SUBST(LIBFONTS_JAR)
11183 AC_SUBST(LIBSERIALIZER_JAR)
11185 # scripting provider for BeanShell?
11186 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11187 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11188     AC_MSG_RESULT([yes])
11189     ENABLE_SCRIPTING_BEANSHELL=TRUE
11191     dnl ===================================================================
11192     dnl Check for system beanshell
11193     dnl ===================================================================
11194     AC_MSG_CHECKING([which beanshell to use])
11195     if test "$with_system_beanshell" = "yes"; then
11196         AC_MSG_RESULT([external])
11197         SYSTEM_BSH=TRUE
11198         if test -z $BSH_JAR; then
11199             BSH_JAR=/usr/share/java/bsh.jar
11200         fi
11201         if ! test -f $BSH_JAR; then
11202             AC_MSG_ERROR(bsh.jar not found.)
11203         fi
11204     else
11205         AC_MSG_RESULT([internal])
11206         SYSTEM_BSH=
11207         BUILD_TYPE="$BUILD_TYPE BSH"
11208     fi
11209 else
11210     AC_MSG_RESULT([no])
11211     ENABLE_SCRIPTING_BEANSHELL=
11212     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11214 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11215 AC_SUBST(SYSTEM_BSH)
11216 AC_SUBST(BSH_JAR)
11218 # scripting provider for JavaScript?
11219 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11220 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11221     AC_MSG_RESULT([yes])
11222     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11224     dnl ===================================================================
11225     dnl Check for system rhino
11226     dnl ===================================================================
11227     AC_MSG_CHECKING([which rhino to use])
11228     if test "$with_system_rhino" = "yes"; then
11229         AC_MSG_RESULT([external])
11230         SYSTEM_RHINO=TRUE
11231         if test -z $RHINO_JAR; then
11232             RHINO_JAR=/usr/share/java/js.jar
11233         fi
11234         if ! test -f $RHINO_JAR; then
11235             AC_MSG_ERROR(js.jar not found.)
11236         fi
11237     else
11238         AC_MSG_RESULT([internal])
11239         SYSTEM_RHINO=
11240         BUILD_TYPE="$BUILD_TYPE RHINO"
11241         NEED_ANT=TRUE
11242     fi
11243 else
11244     AC_MSG_RESULT([no])
11245     ENABLE_SCRIPTING_JAVASCRIPT=
11246     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11248 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11249 AC_SUBST(SYSTEM_RHINO)
11250 AC_SUBST(RHINO_JAR)
11252 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11253 # paths should be added to library search path. So lets put all 64-bit
11254 # platforms there.
11255 supports_multilib=
11256 case "$host_cpu" in
11257 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11258     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11259         supports_multilib="yes"
11260     fi
11261     ;;
11263     ;;
11264 esac
11266 dnl ===================================================================
11267 dnl QT5 Integration
11268 dnl ===================================================================
11270 QT5_CFLAGS=""
11271 QT5_LIBS=""
11272 QMAKE5="qmake"
11273 MOC5="moc"
11274 QT5_GOBJECT_CFLAGS=""
11275 QT5_GOBJECT_LIBS=""
11276 QT5_HAVE_GOBJECT=""
11277 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11278         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11279         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11280 then
11281     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11282     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11284     if test -n "$supports_multilib"; then
11285         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11286     fi
11288     qt5_test_include="QtWidgets/qapplication.h"
11289     qt5_test_library="libQt5Widgets.so"
11291     dnl Check for qmake5
11292     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11293     if test "$QMAKE5" = "no"; then
11294         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11295     else
11296         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11297         if test -z "$qmake5_test_ver"; then
11298             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11299         fi
11300         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11301         qt5_minimal_minor="6"
11302         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11303             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11304         else
11305             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11306         fi
11307     fi
11309     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11310     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11312     AC_MSG_CHECKING([for Qt5 headers])
11313     qt5_incdir="no"
11314     for inc_dir in $qt5_incdirs; do
11315         if test -r "$inc_dir/$qt5_test_include"; then
11316             qt5_incdir="$inc_dir"
11317             break
11318         fi
11319     done
11320     AC_MSG_RESULT([$qt5_incdir])
11321     if test "x$qt5_incdir" = "xno"; then
11322         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11323     fi
11325     AC_MSG_CHECKING([for Qt5 libraries])
11326     qt5_libdir="no"
11327     for lib_dir in $qt5_libdirs; do
11328         if test -r "$lib_dir/$qt5_test_library"; then
11329             qt5_libdir="$lib_dir"
11330             break
11331         fi
11332     done
11333     AC_MSG_RESULT([$qt5_libdir])
11334     if test "x$qt5_libdir" = "xno"; then
11335         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11336     fi
11338     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11339     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11340     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11342     if test "$USING_X11" = TRUE; then
11343         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11344         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11345             QT5_HAVE_XCB_ICCCM=1
11346             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11347         ],[
11348             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)])
11349             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11350         ])
11351         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11352         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11353         QT5_USING_X11=1
11354         AC_DEFINE(QT5_USING_X11)
11355     fi
11357     dnl Check for Meta Object Compiler
11359     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11360     if test "$MOC5" = "no"; then
11361         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11362 the root of your Qt installation by exporting QT5DIR before running "configure".])
11363     fi
11365     if test "$build_gstreamer_1_0" = "yes"; then
11366         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11367                 QT5_HAVE_GOBJECT=1
11368                 AC_DEFINE(QT5_HAVE_GOBJECT)
11369             ],
11370             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11371         )
11372     fi
11374 AC_SUBST(QT5_CFLAGS)
11375 AC_SUBST(QT5_LIBS)
11376 AC_SUBST(MOC5)
11377 AC_SUBST(QT5_GOBJECT_CFLAGS)
11378 AC_SUBST(QT5_GOBJECT_LIBS)
11379 AC_SUBST(QT5_HAVE_GOBJECT)
11381 dnl ===================================================================
11382 dnl KF5 Integration
11383 dnl ===================================================================
11385 KF5_CFLAGS=""
11386 KF5_LIBS=""
11387 KF5_CONFIG="kf5-config"
11388 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11389         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11390 then
11391     if test "$OS" = "HAIKU"; then
11392         haiku_arch="`echo $RTL_ARCH | tr X x`"
11393         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11394         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11395     fi
11397     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11398     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11399     if test -n "$supports_multilib"; then
11400         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11401     fi
11403     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
11404     kf5_test_library="libKF5KIOFileWidgets.so"
11405     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11407     dnl kf5 KDE4 support compatibility installed
11408     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11409     if test "$KF5_CONFIG" != "no"; then
11410         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11411         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11412     fi
11414     dnl Check for KF5 headers
11415     AC_MSG_CHECKING([for KF5 headers])
11416     kf5_incdir="no"
11417     for kf5_check in $kf5_incdirs; do
11418         if test -r "$kf5_check/$kf5_test_include"; then
11419             kf5_incdir="$kf5_check/KF5"
11420             break
11421         fi
11422     done
11423     AC_MSG_RESULT([$kf5_incdir])
11424     if test "x$kf5_incdir" = "xno"; then
11425         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11426     fi
11428     dnl Check for KF5 libraries
11429     AC_MSG_CHECKING([for KF5 libraries])
11430     kf5_libdir="no"
11431     for kf5_check in $kf5_libdirs; do
11432         if test -r "$kf5_check/$kf5_test_library"; then
11433             kf5_libdir="$kf5_check"
11434             break
11435         fi
11436     done
11438     AC_MSG_RESULT([$kf5_libdir])
11439     if test "x$kf5_libdir" = "xno"; then
11440         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11441     fi
11443     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"
11444     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11445     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11447     if test "$USING_X11" = TRUE; then
11448         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11449     fi
11451     AC_LANG_PUSH([C++])
11452     save_CXXFLAGS=$CXXFLAGS
11453     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11454     AC_MSG_CHECKING([whether KDE is >= 5.0])
11455        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11456 #include <kcoreaddons_version.h>
11458 int main(int argc, char **argv) {
11459        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11460        else return 1;
11462        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11463     CXXFLAGS=$save_CXXFLAGS
11464     AC_LANG_POP([C++])
11466 AC_SUBST(KF5_CFLAGS)
11467 AC_SUBST(KF5_LIBS)
11469 dnl ===================================================================
11470 dnl Test whether to include Evolution 2 support
11471 dnl ===================================================================
11472 AC_MSG_CHECKING([whether to enable evolution 2 support])
11473 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11474     AC_MSG_RESULT([yes])
11475     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11476     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11477     FilterLibs "${GOBJECT_LIBS}"
11478     GOBJECT_LIBS="${filteredlibs}"
11479     ENABLE_EVOAB2="TRUE"
11480 else
11481     ENABLE_EVOAB2=""
11482     AC_MSG_RESULT([no])
11484 AC_SUBST(ENABLE_EVOAB2)
11485 AC_SUBST(GOBJECT_CFLAGS)
11486 AC_SUBST(GOBJECT_LIBS)
11488 dnl ===================================================================
11489 dnl Test which themes to include
11490 dnl ===================================================================
11491 AC_MSG_CHECKING([which themes to include])
11492 # if none given use default subset of available themes
11493 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11494     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg cib colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg tango"
11497 WITH_THEMES=""
11498 if test "x$with_theme" != "xno"; then
11499     for theme in $with_theme; do
11500         case $theme in
11501         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|tango|cib) real_theme="$theme" ;;
11502         default) real_theme=colibre ;;
11503         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11504         esac
11505         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11506     done
11508 AC_MSG_RESULT([$WITH_THEMES])
11509 AC_SUBST([WITH_THEMES])
11510 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11511 for theme in $with_theme; do
11512     case $theme in
11513     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11514     *) ;;
11515     esac
11516 done
11518 dnl ===================================================================
11519 dnl Test whether to integrate helppacks into the product's installer
11520 dnl ===================================================================
11521 AC_MSG_CHECKING([for helppack integration])
11522 if test "$with_helppack_integration" = "no"; then
11523     AC_MSG_RESULT([no integration])
11524 else
11525     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11526     AC_MSG_RESULT([integration])
11529 ###############################################################################
11530 # Extensions checking
11531 ###############################################################################
11532 AC_MSG_CHECKING([for extensions integration])
11533 if test "x$enable_extension_integration" != "xno"; then
11534     WITH_EXTENSION_INTEGRATION=TRUE
11535     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11536     AC_MSG_RESULT([yes, use integration])
11537 else
11538     WITH_EXTENSION_INTEGRATION=
11539     AC_MSG_RESULT([no, do not integrate])
11541 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11543 dnl Should any extra extensions be included?
11544 dnl There are standalone tests for each of these below.
11545 WITH_EXTRA_EXTENSIONS=
11546 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11548 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11549 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11550 if test "x$with_java" != "xno"; then
11551     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11552     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11555 AC_MSG_CHECKING([whether to build opens___.ttf])
11556 if test "$enable_build_opensymbol" = "yes"; then
11557     AC_MSG_RESULT([yes])
11558     AC_PATH_PROG(FONTFORGE, fontforge)
11559     if test -z "$FONTFORGE"; then
11560         AC_MSG_ERROR([fontforge not installed])
11561     fi
11562 else
11563     AC_MSG_RESULT([no])
11564     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11565     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11567 AC_SUBST(OPENSYMBOL_TTF)
11568 AC_SUBST(FONTFORGE)
11570 dnl ===================================================================
11571 dnl Test whether to include fonts
11572 dnl ===================================================================
11573 AC_MSG_CHECKING([whether to include third-party fonts])
11574 if test "$with_fonts" != "no"; then
11575     AC_MSG_RESULT([yes])
11576     WITH_FONTS=TRUE
11577     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11578     AC_DEFINE(HAVE_MORE_FONTS)
11579 else
11580     AC_MSG_RESULT([no])
11581     WITH_FONTS=
11582     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11584 AC_SUBST(WITH_FONTS)
11587 dnl ===================================================================
11588 dnl Test whether to enable online update service
11589 dnl ===================================================================
11590 AC_MSG_CHECKING([whether to enable online update])
11591 ENABLE_ONLINE_UPDATE=
11592 ENABLE_ONLINE_UPDATE_MAR=
11593 UPDATE_CONFIG=
11594 if test "$enable_online_update" = ""; then
11595     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11596         AC_MSG_RESULT([yes])
11597         ENABLE_ONLINE_UPDATE="TRUE"
11598     else
11599         AC_MSG_RESULT([no])
11600     fi
11601 else
11602     if test "$enable_online_update" = "mar"; then
11603         AC_MSG_RESULT([yes - MAR-based online update])
11604         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11605         if test "$with_update_config" = ""; then
11606             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11607         fi
11608         UPDATE_CONFIG="$with_update_config"
11609         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11610     elif test "$enable_online_update" = "yes"; then
11611         AC_MSG_RESULT([yes])
11612         ENABLE_ONLINE_UPDATE="TRUE"
11613     else
11614         AC_MSG_RESULT([no])
11615     fi
11617 AC_SUBST(ENABLE_ONLINE_UPDATE)
11618 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11619 AC_SUBST(UPDATE_CONFIG)
11621 dnl ===================================================================
11622 dnl Test whether we need bzip2
11623 dnl ===================================================================
11624 SYSTEM_BZIP2=
11625 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11626     AC_MSG_CHECKING([whether to use system bzip2])
11627     if test "$with_system_bzip2" = yes; then
11628         SYSTEM_BZIP2=TRUE
11629         AC_MSG_RESULT([yes])
11630         PKG_CHECK_MODULES(BZIP2, bzip2)
11631         FilterLibs "${BZIP2_LIBS}"
11632         BZIP2_LIBS="${filteredlibs}"
11633     else
11634         AC_MSG_RESULT([no])
11635         BUILD_TYPE="$BUILD_TYPE BZIP2"
11636     fi
11638 AC_SUBST(SYSTEM_BZIP2)
11639 AC_SUBST(BZIP2_CFLAGS)
11640 AC_SUBST(BZIP2_LIBS)
11642 dnl ===================================================================
11643 dnl Test whether to enable extension update
11644 dnl ===================================================================
11645 AC_MSG_CHECKING([whether to enable extension update])
11646 ENABLE_EXTENSION_UPDATE=
11647 if test "x$enable_extension_update" = "xno"; then
11648     AC_MSG_RESULT([no])
11649 else
11650     AC_MSG_RESULT([yes])
11651     ENABLE_EXTENSION_UPDATE="TRUE"
11652     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11653     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11655 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11658 dnl ===================================================================
11659 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11660 dnl ===================================================================
11661 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11662 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11663     AC_MSG_RESULT([no])
11664     ENABLE_SILENT_MSI=
11665 else
11666     AC_MSG_RESULT([yes])
11667     ENABLE_SILENT_MSI=TRUE
11668     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11670 AC_SUBST(ENABLE_SILENT_MSI)
11672 AC_MSG_CHECKING([whether and how to use Xinerama])
11673 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11674     if test "$x_libraries" = "default_x_libraries"; then
11675         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11676         if test "x$XINERAMALIB" = x; then
11677            XINERAMALIB="/usr/lib"
11678         fi
11679     else
11680         XINERAMALIB="$x_libraries"
11681     fi
11682     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11683         # we have both versions, let the user decide but use the dynamic one
11684         # per default
11685         USE_XINERAMA=TRUE
11686         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11687             XINERAMA_LINK=dynamic
11688         else
11689             XINERAMA_LINK=static
11690         fi
11691     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11692         # we have only the dynamic version
11693         USE_XINERAMA=TRUE
11694         XINERAMA_LINK=dynamic
11695     elif test -e "$XINERAMALIB/libXinerama.a"; then
11696         # static version
11697         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11698             USE_XINERAMA=TRUE
11699             XINERAMA_LINK=static
11700         else
11701             USE_XINERAMA=
11702             XINERAMA_LINK=none
11703         fi
11704     else
11705         # no Xinerama
11706         USE_XINERAMA=
11707         XINERAMA_LINK=none
11708     fi
11709     if test "$USE_XINERAMA" = "TRUE"; then
11710         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11711         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11712             [AC_MSG_ERROR(Xinerama header not found.)], [])
11713         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11714         if test "x$XEXTLIB" = x; then
11715            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11716         fi
11717         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11718         if test "$_os" = "FreeBSD"; then
11719             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11720         fi
11721         if test "$_os" = "Linux"; then
11722             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11723         fi
11724         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11725             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11726     else
11727         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11728     fi
11729 else
11730     USE_XINERAMA=
11731     XINERAMA_LINK=none
11732     AC_MSG_RESULT([no])
11734 AC_SUBST(USE_XINERAMA)
11735 AC_SUBST(XINERAMA_LINK)
11737 dnl ===================================================================
11738 dnl Test whether to build cairo or rely on the system version
11739 dnl ===================================================================
11741 if test "$USING_X11" = TRUE; then
11742     # Used in vcl/Library_vclplug_gen.mk
11743     test_cairo=yes
11746 if test "$test_cairo" = "yes"; then
11747     AC_MSG_CHECKING([whether to use the system cairo])
11749     : ${with_system_cairo:=$with_system_libs}
11750     if test "$with_system_cairo" = "yes"; then
11751         SYSTEM_CAIRO=TRUE
11752         AC_MSG_RESULT([yes])
11754         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11755         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11756         FilterLibs "${CAIRO_LIBS}"
11757         CAIRO_LIBS="${filteredlibs}"
11759         if test "$test_xrender" = "yes"; then
11760             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11761             AC_LANG_PUSH([C])
11762             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11763 #ifdef PictStandardA8
11764 #else
11765       return fail;
11766 #endif
11767 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11769             AC_LANG_POP([C])
11770         fi
11771     else
11772         SYSTEM_CAIRO=
11773         AC_MSG_RESULT([no])
11775         BUILD_TYPE="$BUILD_TYPE CAIRO"
11776     fi
11779 AC_SUBST(SYSTEM_CAIRO)
11780 AC_SUBST(CAIRO_CFLAGS)
11781 AC_SUBST(CAIRO_LIBS)
11783 dnl ===================================================================
11784 dnl Test whether to use avahi
11785 dnl ===================================================================
11786 if test "$_os" = "WINNT"; then
11787     # Windows uses bundled mDNSResponder
11788     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11789 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11790     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11791                       [ENABLE_AVAHI="TRUE"])
11792     AC_DEFINE(HAVE_FEATURE_AVAHI)
11793     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11794     FilterLibs "${AVAHI_LIBS}"
11795     AVAHI_LIBS="${filteredlibs}"
11798 AC_SUBST(ENABLE_AVAHI)
11799 AC_SUBST(AVAHI_CFLAGS)
11800 AC_SUBST(AVAHI_LIBS)
11802 dnl ===================================================================
11803 dnl Test whether to use liblangtag
11804 dnl ===================================================================
11805 SYSTEM_LIBLANGTAG=
11806 AC_MSG_CHECKING([whether to use system liblangtag])
11807 if test "$with_system_liblangtag" = yes; then
11808     SYSTEM_LIBLANGTAG=TRUE
11809     AC_MSG_RESULT([yes])
11810     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11811     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11812     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11813     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11814     FilterLibs "${LIBLANGTAG_LIBS}"
11815     LIBLANGTAG_LIBS="${filteredlibs}"
11816 else
11817     SYSTEM_LIBLANGTAG=
11818     AC_MSG_RESULT([no])
11819     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11820     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11821     if test "$COM" = "MSC"; then
11822         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11823     else
11824         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11825     fi
11827 AC_SUBST(SYSTEM_LIBLANGTAG)
11828 AC_SUBST(LIBLANGTAG_CFLAGS)
11829 AC_SUBST(LIBLANGTAG_LIBS)
11831 dnl ===================================================================
11832 dnl Test whether to build libpng or rely on the system version
11833 dnl ===================================================================
11835 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11837 dnl ===================================================================
11838 dnl Check for runtime JVM search path
11839 dnl ===================================================================
11840 if test "$ENABLE_JAVA" != ""; then
11841     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11842     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11843         AC_MSG_RESULT([yes])
11844         if ! test -d "$with_jvm_path"; then
11845             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11846         fi
11847         if ! test -d "$with_jvm_path"jvm; then
11848             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11849         fi
11850         JVM_ONE_PATH_CHECK="$with_jvm_path"
11851         AC_SUBST(JVM_ONE_PATH_CHECK)
11852     else
11853         AC_MSG_RESULT([no])
11854     fi
11857 dnl ===================================================================
11858 dnl Test for the presence of Ant and that it works
11859 dnl ===================================================================
11861 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11862     ANT_HOME=; export ANT_HOME
11863     WITH_ANT_HOME=; export WITH_ANT_HOME
11864     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11865         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11866             if test "$_os" = "WINNT"; then
11867                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11868             else
11869                 with_ant_home="$LODE_HOME/opt/ant"
11870             fi
11871         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11872             with_ant_home="$LODE_HOME/opt/ant"
11873         fi
11874     fi
11875     if test -z "$with_ant_home"; then
11876         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11877     else
11878         if test "$_os" = "WINNT"; then
11879             # AC_PATH_PROGS needs unix path
11880             with_ant_home=`cygpath -u "$with_ant_home"`
11881         fi
11882         AbsolutePath "$with_ant_home"
11883         with_ant_home=$absolute_path
11884         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11885         WITH_ANT_HOME=$with_ant_home
11886         ANT_HOME=$with_ant_home
11887     fi
11889     if test -z "$ANT"; then
11890         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11891     else
11892         # resolve relative or absolute symlink
11893         while test -h "$ANT"; do
11894             a_cwd=`pwd`
11895             a_basename=`basename "$ANT"`
11896             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11897             cd "`dirname "$ANT"`"
11898             cd "`dirname "$a_script"`"
11899             ANT="`pwd`"/"`basename "$a_script"`"
11900             cd "$a_cwd"
11901         done
11903         AC_MSG_CHECKING([if $ANT works])
11904         mkdir -p conftest.dir
11905         a_cwd=$(pwd)
11906         cd conftest.dir
11907         cat > conftest.java << EOF
11908         public class conftest {
11909             int testmethod(int a, int b) {
11910                     return a + b;
11911             }
11912         }
11915         cat > conftest.xml << EOF
11916         <project name="conftest" default="conftest">
11917         <target name="conftest">
11918             <javac srcdir="." includes="conftest.java">
11919             </javac>
11920         </target>
11921         </project>
11924         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11925         if test $? = 0 -a -f ./conftest.class; then
11926             AC_MSG_RESULT([Ant works])
11927             if test -z "$WITH_ANT_HOME"; then
11928                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11929                 if test -z "$ANT_HOME"; then
11930                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11931                 fi
11932             else
11933                 ANT_HOME="$WITH_ANT_HOME"
11934             fi
11935         else
11936             echo "configure: Ant test failed" >&5
11937             cat conftest.java >&5
11938             cat conftest.xml >&5
11939             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11940         fi
11941         cd "$a_cwd"
11942         rm -fr conftest.dir
11943     fi
11944     if test -z "$ANT_HOME"; then
11945         ANT_HOME="NO_ANT_HOME"
11946     else
11947         PathFormat "$ANT_HOME"
11948         ANT_HOME="$formatted_path"
11949         PathFormat "$ANT"
11950         ANT="$formatted_path"
11951     fi
11952     AC_SUBST(ANT_HOME)
11953     AC_SUBST(ANT)
11955     dnl Checking for ant.jar
11956     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11957         AC_MSG_CHECKING([Ant lib directory])
11958         if test -f $ANT_HOME/lib/ant.jar; then
11959             ANT_LIB="$ANT_HOME/lib"
11960         else
11961             if test -f $ANT_HOME/ant.jar; then
11962                 ANT_LIB="$ANT_HOME"
11963             else
11964                 if test -f /usr/share/java/ant.jar; then
11965                     ANT_LIB=/usr/share/java
11966                 else
11967                     if test -f /usr/share/ant-core/lib/ant.jar; then
11968                         ANT_LIB=/usr/share/ant-core/lib
11969                     else
11970                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11971                             ANT_LIB="$ANT_HOME/lib/ant"
11972                         else
11973                             if test -f /usr/share/lib/ant/ant.jar; then
11974                                 ANT_LIB=/usr/share/lib/ant
11975                             else
11976                                 AC_MSG_ERROR([Ant libraries not found!])
11977                             fi
11978                         fi
11979                     fi
11980                 fi
11981             fi
11982         fi
11983         PathFormat "$ANT_LIB"
11984         ANT_LIB="$formatted_path"
11985         AC_MSG_RESULT([Ant lib directory found.])
11986     fi
11987     AC_SUBST(ANT_LIB)
11989     ant_minver=1.6.0
11990     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11992     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11993     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
11994     ant_version_major=`echo $ant_version | cut -d. -f1`
11995     ant_version_minor=`echo $ant_version | cut -d. -f2`
11996     echo "configure: ant_version $ant_version " >&5
11997     echo "configure: ant_version_major $ant_version_major " >&5
11998     echo "configure: ant_version_minor $ant_version_minor " >&5
11999     if test "$ant_version_major" -ge "2"; then
12000         AC_MSG_RESULT([yes, $ant_version])
12001     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12002         AC_MSG_RESULT([yes, $ant_version])
12003     else
12004         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12005     fi
12007     rm -f conftest* core core.* *.core
12010 OOO_JUNIT_JAR=
12011 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12012     AC_MSG_CHECKING([for JUnit 4])
12013     if test "$with_junit" = "yes"; then
12014         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12015             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12016         elif test -e /usr/share/java/junit4.jar; then
12017             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12018         else
12019            if test -e /usr/share/lib/java/junit.jar; then
12020               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12021            else
12022               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12023            fi
12024         fi
12025     else
12026         OOO_JUNIT_JAR=$with_junit
12027     fi
12028     if test "$_os" = "WINNT"; then
12029         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12030     fi
12031     printf 'import org.junit.Before;' > conftest.java
12032     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12033         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12034     else
12035         AC_MSG_ERROR(
12036 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12037  specify its pathname via --with-junit=..., or disable it via --without-junit])
12038     fi
12039     rm -f conftest.class conftest.java
12040     if test $OOO_JUNIT_JAR != ""; then
12041     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12042     fi
12044 AC_SUBST(OOO_JUNIT_JAR)
12046 HAMCREST_JAR=
12047 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12048     AC_MSG_CHECKING([for included Hamcrest])
12049     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12050     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12051         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12052     else
12053         AC_MSG_RESULT([Not included])
12054         AC_MSG_CHECKING([for standalone hamcrest jar.])
12055         if test "$with_hamcrest" = "yes"; then
12056             if test -e /usr/share/lib/java/hamcrest.jar; then
12057                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12058             elif test -e /usr/share/java/hamcrest/core.jar; then
12059                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12060             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
12061                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
12062             else
12063                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12064             fi
12065         else
12066             HAMCREST_JAR=$with_hamcrest
12067         fi
12068         if test "$_os" = "WINNT"; then
12069             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12070         fi
12071         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12072             AC_MSG_RESULT([$HAMCREST_JAR])
12073         else
12074             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),
12075                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12076         fi
12077     fi
12078     rm -f conftest.class conftest.java
12080 AC_SUBST(HAMCREST_JAR)
12083 AC_SUBST(SCPDEFS)
12086 # check for wget and curl
12088 WGET=
12089 CURL=
12091 if test "$enable_fetch_external" != "no"; then
12093 CURL=`which curl 2>/dev/null`
12095 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12096     # wget new enough?
12097     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12098     if test $? -eq 0; then
12099         WGET=$i
12100         break
12101     fi
12102 done
12104 if test -z "$WGET" -a -z "$CURL"; then
12105     AC_MSG_ERROR([neither wget nor curl found!])
12110 AC_SUBST(WGET)
12111 AC_SUBST(CURL)
12114 # check for sha256sum
12116 SHA256SUM=
12118 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12119     eval "$i -a 256 --version" > /dev/null 2>&1
12120     ret=$?
12121     if test $ret -eq 0; then
12122         SHA256SUM="$i -a 256"
12123         break
12124     fi
12125 done
12127 if test -z "$SHA256SUM"; then
12128     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12129         eval "$i --version" > /dev/null 2>&1
12130         ret=$?
12131         if test $ret -eq 0; then
12132             SHA256SUM=$i
12133             break
12134         fi
12135     done
12138 if test -z "$SHA256SUM"; then
12139     AC_MSG_ERROR([no sha256sum found!])
12142 AC_SUBST(SHA256SUM)
12144 dnl ===================================================================
12145 dnl Dealing with l10n options
12146 dnl ===================================================================
12147 AC_MSG_CHECKING([which languages to be built])
12148 # get list of all languages
12149 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12150 # the sed command does the following:
12151 #   + if a line ends with a backslash, append the next line to it
12152 #   + adds " on the beginning of the value (after =)
12153 #   + adds " at the end of the value
12154 #   + removes en-US; we want to put it on the beginning
12155 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12156 [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)]
12157 ALL_LANGS="en-US $completelangiso"
12158 # check the configured localizations
12159 WITH_LANG="$with_lang"
12161 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12162 # (Norwegian is "nb" and "nn".)
12163 if test "$WITH_LANG" = "no"; then
12164     WITH_LANG=
12167 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12168     AC_MSG_RESULT([en-US])
12169 else
12170     AC_MSG_RESULT([$WITH_LANG])
12171     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12172     if test -z "$MSGFMT"; then
12173         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12174             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12175         elif test -x "/opt/lo/bin/msgfmt"; then
12176             MSGFMT="/opt/lo/bin/msgfmt"
12177         else
12178             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12179             if test -z "$MSGFMT"; then
12180                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12181             fi
12182         fi
12183     fi
12184     if test -z "$MSGUNIQ"; then
12185         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12186             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12187         elif test -x "/opt/lo/bin/msguniq"; then
12188             MSGUNIQ="/opt/lo/bin/msguniq"
12189         else
12190             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12191             if test -z "$MSGUNIQ"; then
12192                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12193             fi
12194         fi
12195     fi
12197 AC_SUBST(MSGFMT)
12198 AC_SUBST(MSGUNIQ)
12199 # check that the list is valid
12200 for lang in $WITH_LANG; do
12201     test "$lang" = "ALL" && continue
12202     # need to check for the exact string, so add space before and after the list of all languages
12203     for vl in $ALL_LANGS; do
12204         if test "$vl" = "$lang"; then
12205            break
12206         fi
12207     done
12208     if test "$vl" != "$lang"; then
12209         # if you're reading this - you prolly quoted your languages remove the quotes ...
12210         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12211     fi
12212 done
12213 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12214     echo $WITH_LANG | grep -q en-US
12215     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12217 # list with substituted ALL
12218 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12219 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12220 test "$WITH_LANG" = "en-US" && WITH_LANG=
12221 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12222     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12223     ALL_LANGS=`echo $ALL_LANGS qtz`
12225 AC_SUBST(ALL_LANGS)
12226 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12227 AC_SUBST(WITH_LANG)
12228 AC_SUBST(WITH_LANG_LIST)
12229 AC_SUBST(GIT_NEEDED_SUBMODULES)
12231 WITH_POOR_HELP_LOCALIZATIONS=
12232 if test -d "$SRC_ROOT/translations/source"; then
12233     for l in `ls -1 $SRC_ROOT/translations/source`; do
12234         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12235             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12236         fi
12237     done
12239 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12241 if test -n "$with_locales"; then
12242     WITH_LOCALES="$with_locales"
12244     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12245     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12246     # config_host/config_locales.h.in
12247     for locale in $WITH_LOCALES; do
12248         lang=${locale%_*}
12250         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12252         case $lang in
12253         hi|mr*ne)
12254             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12255             ;;
12256         bg|ru)
12257             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12258             ;;
12259         esac
12260     done
12261 else
12262     AC_DEFINE(WITH_LOCALE_ALL)
12264 AC_SUBST(WITH_LOCALES)
12266 dnl git submodule update --reference
12267 dnl ===================================================================
12268 if test -n "${GIT_REFERENCE_SRC}"; then
12269     for repo in ${GIT_NEEDED_SUBMODULES}; do
12270         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12271             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12272         fi
12273     done
12275 AC_SUBST(GIT_REFERENCE_SRC)
12277 dnl git submodules linked dirs
12278 dnl ===================================================================
12279 if test -n "${GIT_LINK_SRC}"; then
12280     for repo in ${GIT_NEEDED_SUBMODULES}; do
12281         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12282             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12283         fi
12284     done
12286 AC_SUBST(GIT_LINK_SRC)
12288 dnl branding
12289 dnl ===================================================================
12290 AC_MSG_CHECKING([for alternative branding images directory])
12291 # initialize mapped arrays
12292 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12293 brand_files="$BRAND_INTRO_IMAGES about.svg"
12295 if test -z "$with_branding" -o "$with_branding" = "no"; then
12296     AC_MSG_RESULT([none])
12297     DEFAULT_BRAND_IMAGES="$brand_files"
12298 else
12299     if ! test -d $with_branding ; then
12300         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12301     else
12302         AC_MSG_RESULT([$with_branding])
12303         CUSTOM_BRAND_DIR="$with_branding"
12304         for lfile in $brand_files
12305         do
12306             if ! test -f $with_branding/$lfile ; then
12307                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12308                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12309             else
12310                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12311             fi
12312         done
12313         check_for_progress="yes"
12314     fi
12316 AC_SUBST([BRAND_INTRO_IMAGES])
12317 AC_SUBST([CUSTOM_BRAND_DIR])
12318 AC_SUBST([CUSTOM_BRAND_IMAGES])
12319 AC_SUBST([DEFAULT_BRAND_IMAGES])
12322 AC_MSG_CHECKING([for 'intro' progress settings])
12323 PROGRESSBARCOLOR=
12324 PROGRESSSIZE=
12325 PROGRESSPOSITION=
12326 PROGRESSFRAMECOLOR=
12327 PROGRESSTEXTCOLOR=
12328 PROGRESSTEXTBASELINE=
12330 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12331     source "$with_branding/progress.conf"
12332     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12333 else
12334     AC_MSG_RESULT([none])
12337 AC_SUBST(PROGRESSBARCOLOR)
12338 AC_SUBST(PROGRESSSIZE)
12339 AC_SUBST(PROGRESSPOSITION)
12340 AC_SUBST(PROGRESSFRAMECOLOR)
12341 AC_SUBST(PROGRESSTEXTCOLOR)
12342 AC_SUBST(PROGRESSTEXTBASELINE)
12345 AC_MSG_CHECKING([for extra build ID])
12346 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12347     EXTRA_BUILDID="$with_extra_buildid"
12349 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12350 if test -n "$EXTRA_BUILDID" ; then
12351     AC_MSG_RESULT([$EXTRA_BUILDID])
12352 else
12353     AC_MSG_RESULT([not set])
12355 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12357 OOO_VENDOR=
12358 AC_MSG_CHECKING([for vendor])
12359 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12360     OOO_VENDOR="$USERNAME"
12362     if test -z "$OOO_VENDOR"; then
12363         OOO_VENDOR="$USER"
12364     fi
12366     if test -z "$OOO_VENDOR"; then
12367         OOO_VENDOR="`id -u -n`"
12368     fi
12370     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12371 else
12372     OOO_VENDOR="$with_vendor"
12373     AC_MSG_RESULT([$OOO_VENDOR])
12375 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12376 AC_SUBST(OOO_VENDOR)
12378 if test "$_os" = "Android" ; then
12379     ANDROID_PACKAGE_NAME=
12380     AC_MSG_CHECKING([for Android package name])
12381     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12382         if test -n "$ENABLE_DEBUG"; then
12383             # Default to the package name that makes ndk-gdb happy.
12384             ANDROID_PACKAGE_NAME="org.libreoffice"
12385         else
12386             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12387         fi
12389         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12390     else
12391         ANDROID_PACKAGE_NAME="$with_android_package_name"
12392         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12393     fi
12394     AC_SUBST(ANDROID_PACKAGE_NAME)
12397 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12398 if test "$with_compat_oowrappers" = "yes"; then
12399     WITH_COMPAT_OOWRAPPERS=TRUE
12400     AC_MSG_RESULT(yes)
12401 else
12402     WITH_COMPAT_OOWRAPPERS=
12403     AC_MSG_RESULT(no)
12405 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12407 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12408 AC_MSG_CHECKING([for install dirname])
12409 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12410     INSTALLDIRNAME="$with_install_dirname"
12412 AC_MSG_RESULT([$INSTALLDIRNAME])
12413 AC_SUBST(INSTALLDIRNAME)
12415 AC_MSG_CHECKING([for prefix])
12416 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12417 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12418 PREFIXDIR="$prefix"
12419 AC_MSG_RESULT([$PREFIXDIR])
12420 AC_SUBST(PREFIXDIR)
12422 LIBDIR=[$(eval echo $(eval echo $libdir))]
12423 AC_SUBST(LIBDIR)
12425 DATADIR=[$(eval echo $(eval echo $datadir))]
12426 AC_SUBST(DATADIR)
12428 MANDIR=[$(eval echo $(eval echo $mandir))]
12429 AC_SUBST(MANDIR)
12431 DOCDIR=[$(eval echo $(eval echo $docdir))]
12432 AC_SUBST(DOCDIR)
12434 BINDIR=[$(eval echo $(eval echo $bindir))]
12435 AC_SUBST(BINDIR)
12437 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12438 AC_SUBST(INSTALLDIR)
12440 TESTINSTALLDIR="${BUILDDIR}/test-install"
12441 AC_SUBST(TESTINSTALLDIR)
12444 # ===================================================================
12445 # OAuth2 id and secrets
12446 # ===================================================================
12448 AC_MSG_CHECKING([for Google Drive client id and secret])
12449 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12450     AC_MSG_RESULT([not set])
12451     GDRIVE_CLIENT_ID="\"\""
12452     GDRIVE_CLIENT_SECRET="\"\""
12453 else
12454     AC_MSG_RESULT([set])
12455     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12456     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12458 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12459 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12461 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12462 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12463     AC_MSG_RESULT([not set])
12464     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12465     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12466 else
12467     AC_MSG_RESULT([set])
12468     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12469     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12471 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12472 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12474 AC_MSG_CHECKING([for OneDrive client id and secret])
12475 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12476     AC_MSG_RESULT([not set])
12477     ONEDRIVE_CLIENT_ID="\"\""
12478     ONEDRIVE_CLIENT_SECRET="\"\""
12479 else
12480     AC_MSG_RESULT([set])
12481     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12482     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12484 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12485 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12488 dnl ===================================================================
12489 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12490 dnl --enable-dependency-tracking configure option
12491 dnl ===================================================================
12492 AC_MSG_CHECKING([whether to enable dependency tracking])
12493 if test "$enable_dependency_tracking" = "no"; then
12494     nodep=TRUE
12495     AC_MSG_RESULT([no])
12496 else
12497     AC_MSG_RESULT([yes])
12499 AC_SUBST(nodep)
12501 dnl ===================================================================
12502 dnl Number of CPUs to use during the build
12503 dnl ===================================================================
12504 AC_MSG_CHECKING([for number of processors to use])
12505 # plain --with-parallelism is just the default
12506 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12507     if test "$with_parallelism" = "no"; then
12508         PARALLELISM=0
12509     else
12510         PARALLELISM=$with_parallelism
12511     fi
12512 else
12513     if test "$enable_icecream" = "yes"; then
12514         PARALLELISM="40"
12515     else
12516         case `uname -s` in
12518         Darwin|FreeBSD|NetBSD|OpenBSD)
12519             PARALLELISM=`sysctl -n hw.ncpu`
12520             ;;
12522         Linux)
12523             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12524         ;;
12525         # what else than above does profit here *and* has /proc?
12526         *)
12527             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12528             ;;
12529         esac
12531         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12532         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12533     fi
12536 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12537     if test -z "$with_parallelism"; then
12538             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12539             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12540             PARALLELISM="1"
12541     else
12542         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."
12543     fi
12546 if test $PARALLELISM -eq 0; then
12547     AC_MSG_RESULT([explicit make -j option needed])
12548 else
12549     AC_MSG_RESULT([$PARALLELISM])
12551 AC_SUBST(PARALLELISM)
12553 IWYU_PATH="$with_iwyu"
12554 AC_SUBST(IWYU_PATH)
12555 if test ! -z "$IWYU_PATH"; then
12556     if test ! -f "$IWYU_PATH"; then
12557         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12558     fi
12562 # Set up ILIB for MSVC build
12564 ILIB1=
12565 if test "$build_os" = "cygwin"; then
12566     ILIB="."
12567     if test -n "$JAVA_HOME"; then
12568         ILIB="$ILIB;$JAVA_HOME/lib"
12569     fi
12570     ILIB1=-link
12571     if test "$BITNESS_OVERRIDE" = 64; then
12572         ILIB="$ILIB;$COMPATH/lib/x64"
12573         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12574         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12575         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12576         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12577             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12578             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12579         fi
12580         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12581         ucrtlibpath_formatted=$formatted_path
12582         ILIB="$ILIB;$ucrtlibpath_formatted"
12583         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12584     else
12585         ILIB="$ILIB;$COMPATH/lib/x86"
12586         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12587         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12588         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12589         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12590             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12591             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12592         fi
12593         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12594         ucrtlibpath_formatted=$formatted_path
12595         ILIB="$ILIB;$ucrtlibpath_formatted"
12596         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12597     fi
12598     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12599         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12600     else
12601         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12602     fi
12604     AC_SUBST(ILIB)
12607 # ===================================================================
12608 # Creating bigger shared library to link against
12609 # ===================================================================
12610 AC_MSG_CHECKING([whether to create huge library])
12611 MERGELIBS=
12613 if test $_os = iOS -o $_os = Android; then
12614     # Never any point in mergelibs for these as we build just static
12615     # libraries anyway...
12616     enable_mergelibs=no
12619 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12620     if test $_os != Linux -a $_os != WINNT; then
12621         add_warning "--enable-mergelibs is not tested for this platform"
12622     fi
12623     MERGELIBS="TRUE"
12624     AC_MSG_RESULT([yes])
12625 else
12626     AC_MSG_RESULT([no])
12628 AC_SUBST([MERGELIBS])
12630 dnl ===================================================================
12631 dnl icerun is a wrapper that stops us spawning tens of processes
12632 dnl locally - for tools that can't be executed on the compile cluster
12633 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12634 dnl ===================================================================
12635 AC_MSG_CHECKING([whether to use icerun wrapper])
12636 ICECREAM_RUN=
12637 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12638     ICECREAM_RUN=icerun
12639     AC_MSG_RESULT([yes])
12640 else
12641     AC_MSG_RESULT([no])
12643 AC_SUBST(ICECREAM_RUN)
12645 dnl ===================================================================
12646 dnl Setup the ICECC_VERSION for the build the same way it was set for
12647 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12648 dnl ===================================================================
12649 x_ICECC_VERSION=[\#]
12650 if test -n "$ICECC_VERSION" ; then
12651     x_ICECC_VERSION=
12653 AC_SUBST(x_ICECC_VERSION)
12654 AC_SUBST(ICECC_VERSION)
12656 dnl ===================================================================
12658 AC_MSG_CHECKING([MPL subset])
12659 MPL_SUBSET=
12661 if test "$enable_mpl_subset" = "yes"; then
12662     warn_report=false
12663     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12664         warn_report=true
12665     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12666         warn_report=true
12667     fi
12668     if test "$warn_report" = "true"; then
12669         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12670     fi
12671     if test "x$enable_postgresql_sdbc" != "xno"; then
12672         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12673     fi
12674     if test "$enable_lotuswordpro" = "yes"; then
12675         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12676     fi
12677     if test "$WITH_WEBDAV" = "neon"; then
12678         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12679     fi
12680     if test -n "$ENABLE_POPPLER"; then
12681         if test "x$SYSTEM_POPPLER" = "x"; then
12682             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12683         fi
12684     fi
12685     # cf. m4/libo_check_extension.m4
12686     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12687         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12688     fi
12689     for theme in $WITH_THEMES; do
12690         case $theme in
12691         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12692             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12693         *) : ;;
12694         esac
12695     done
12697     ENABLE_OPENGL_TRANSITIONS=
12699     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12700         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12701     fi
12703     MPL_SUBSET="TRUE"
12704     AC_DEFINE(MPL_HAVE_SUBSET)
12705     AC_MSG_RESULT([only])
12706 else
12707     AC_MSG_RESULT([no restrictions])
12709 AC_SUBST(MPL_SUBSET)
12711 dnl ===================================================================
12713 AC_MSG_CHECKING([formula logger])
12714 ENABLE_FORMULA_LOGGER=
12716 if test "x$enable_formula_logger" = "xyes"; then
12717     AC_MSG_RESULT([yes])
12718     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12719     ENABLE_FORMULA_LOGGER=TRUE
12720 elif test -n "$ENABLE_DBGUTIL" ; then
12721     AC_MSG_RESULT([yes])
12722     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12723     ENABLE_FORMULA_LOGGER=TRUE
12724 else
12725     AC_MSG_RESULT([no])
12728 AC_SUBST(ENABLE_FORMULA_LOGGER)
12730 dnl ===================================================================
12731 dnl Setting up the environment.
12732 dnl ===================================================================
12733 AC_MSG_NOTICE([setting up the build environment variables...])
12735 AC_SUBST(COMPATH)
12737 if test "$build_os" = "cygwin"; then
12738     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12739         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12740         ATL_INCLUDE="$COMPATH/atlmfc/include"
12741     elif test -d "$COMPATH/atlmfc/lib"; then
12742         ATL_LIB="$COMPATH/atlmfc/lib"
12743         ATL_INCLUDE="$COMPATH/atlmfc/include"
12744     else
12745         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12746         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12747     fi
12748     if test "$BITNESS_OVERRIDE" = 64; then
12749         ATL_LIB="$ATL_LIB/x64"
12750     else
12751         ATL_LIB="$ATL_LIB/x86"
12752     fi
12753     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12754     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12756     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12757     PathFormat "/usr/bin/find.exe"
12758     FIND="$formatted_path"
12759     PathFormat "/usr/bin/sort.exe"
12760     SORT="$formatted_path"
12761     PathFormat "/usr/bin/grep.exe"
12762     WIN_GREP="$formatted_path"
12763     PathFormat "/usr/bin/ls.exe"
12764     WIN_LS="$formatted_path"
12765     PathFormat "/usr/bin/touch.exe"
12766     WIN_TOUCH="$formatted_path"
12767 else
12768     FIND=find
12769     SORT=sort
12772 AC_SUBST(ATL_INCLUDE)
12773 AC_SUBST(ATL_LIB)
12774 AC_SUBST(FIND)
12775 AC_SUBST(SORT)
12776 AC_SUBST(WIN_GREP)
12777 AC_SUBST(WIN_LS)
12778 AC_SUBST(WIN_TOUCH)
12780 AC_SUBST(BUILD_TYPE)
12782 AC_SUBST(SOLARINC)
12784 PathFormat "$PERL"
12785 PERL="$formatted_path"
12786 AC_SUBST(PERL)
12788 if test -n "$TMPDIR"; then
12789     TEMP_DIRECTORY="$TMPDIR"
12790 else
12791     TEMP_DIRECTORY="/tmp"
12793 if test "$build_os" = "cygwin"; then
12794     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12796 AC_SUBST(TEMP_DIRECTORY)
12798 # setup the PATH for the environment
12799 if test -n "$LO_PATH_FOR_BUILD"; then
12800     LO_PATH="$LO_PATH_FOR_BUILD"
12801 else
12802     LO_PATH="$PATH"
12804     case "$host_os" in
12806     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12807         if test "$ENABLE_JAVA" != ""; then
12808             pathmunge "$JAVA_HOME/bin" "after"
12809         fi
12810         ;;
12812     cygwin*)
12813         # Win32 make needs native paths
12814         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12815             LO_PATH=`cygpath -p -m "$PATH"`
12816         fi
12817         if test "$BITNESS_OVERRIDE" = 64; then
12818             # needed for msi packaging
12819             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12820         fi
12821         # .NET 4.6 and higher don't have bin directory
12822         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12823             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12824         fi
12825         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12826         pathmunge "$CSC_PATH" "before"
12827         pathmunge "$MIDL_PATH" "before"
12828         pathmunge "$AL_PATH" "before"
12829         pathmunge "$MSPDB_PATH" "before"
12830         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12831             pathmunge "$CL_PATH" "before"
12832         fi
12833         if test -n "$MSBUILD_PATH" ; then
12834             pathmunge "$MSBUILD_PATH" "before"
12835         fi
12836         if test "$BITNESS_OVERRIDE" = 64; then
12837             pathmunge "$COMPATH/bin/amd64" "before"
12838             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12839         else
12840             pathmunge "$COMPATH/bin" "before"
12841             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12842         fi
12843         if test "$ENABLE_JAVA" != ""; then
12844             if test -d "$JAVA_HOME/jre/bin/client"; then
12845                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12846             fi
12847             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12848                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12849             fi
12850             pathmunge "$JAVA_HOME/bin" "before"
12851         fi
12852         ;;
12854     solaris*)
12855         pathmunge "/usr/css/bin" "before"
12856         if test "$ENABLE_JAVA" != ""; then
12857             pathmunge "$JAVA_HOME/bin" "after"
12858         fi
12859         ;;
12860     esac
12863 AC_SUBST(LO_PATH)
12865 libo_FUZZ_SUMMARY
12867 # Generate a configuration sha256 we can use for deps
12868 if test -f config_host.mk; then
12869     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12871 if test -f config_host_lang.mk; then
12872     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12875 CFLAGS=$my_original_CFLAGS
12876 CXXFLAGS=$my_original_CXXFLAGS
12877 CPPFLAGS=$my_original_CPPFLAGS
12879 AC_CONFIG_FILES([config_host.mk
12880                  config_host_lang.mk
12881                  Makefile
12882                  bin/bffvalidator.sh
12883                  bin/odfvalidator.sh
12884                  bin/officeotron.sh
12885                  instsetoo_native/util/openoffice.lst
12886                  sysui/desktop/macosx/Info.plist])
12887 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12888 AC_CONFIG_HEADERS([config_host/config_clang.h])
12889 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12890 AC_CONFIG_HEADERS([config_host/config_eot.h])
12891 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12892 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12893 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12894 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12895 AC_CONFIG_HEADERS([config_host/config_features.h])
12896 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12897 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12898 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12899 AC_CONFIG_HEADERS([config_host/config_folders.h])
12900 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12901 AC_CONFIG_HEADERS([config_host/config_gio.h])
12902 AC_CONFIG_HEADERS([config_host/config_global.h])
12903 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12904 AC_CONFIG_HEADERS([config_host/config_java.h])
12905 AC_CONFIG_HEADERS([config_host/config_langs.h])
12906 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12907 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12908 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12909 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12910 AC_CONFIG_HEADERS([config_host/config_locales.h])
12911 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12912 AC_CONFIG_HEADERS([config_host/config_oox.h])
12913 AC_CONFIG_HEADERS([config_host/config_options.h])
12914 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12915 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
12916 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12917 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12918 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12919 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12920 AC_CONFIG_HEADERS([config_host/config_version.h])
12921 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12922 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12923 AC_CONFIG_HEADERS([config_host/config_python.h])
12924 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12925 AC_OUTPUT
12927 if test "$CROSS_COMPILING" = TRUE; then
12928     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12931 # touch the config timestamp file
12932 if test ! -f config_host.mk.stamp; then
12933     echo > config_host.mk.stamp
12934 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12935     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12936 else
12937     echo > config_host.mk.stamp
12940 # touch the config lang timestamp file
12941 if test ! -f config_host_lang.mk.stamp; then
12942     echo > config_host_lang.mk.stamp
12943 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12944     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12945 else
12946     echo > config_host_lang.mk.stamp
12950 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12951         -a "$build_os" = "cygwin"; then
12953 cat << _EOS
12954 ****************************************************************************
12955 WARNING:
12956 Your make version is known to be horribly slow, and hard to debug
12957 problems with. To get a reasonably functional make please do:
12959 to install a pre-compiled binary make for Win32
12961  mkdir -p /opt/lo/bin
12962  cd /opt/lo/bin
12963  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12964  cp make-4.2.1-msvc.exe make
12965  chmod +x make
12967 to install from source:
12968 place yourself in a working directory of you choice.
12970  git clone git://git.savannah.gnu.org/make.git
12972  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12973  set PATH=%PATH%;C:\Cygwin\bin
12974  [or Cygwin64, if that is what you have]
12975  cd path-to-make-repo-you-cloned-above
12976  build_w32.bat --without-guile
12978 should result in a WinRel/gnumake.exe.
12979 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12981 Then re-run autogen.sh
12983 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12984 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12986 _EOS
12987 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12988     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12993 cat << _EOF
12994 ****************************************************************************
12996 To build, run:
12997 $GNUMAKE
12999 To view some help, run:
13000 $GNUMAKE help
13002 _EOF
13004 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13005     cat << _EOF
13006 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13007 _EOF
13009     if test $_os = Darwin; then
13010         echo open instdir/$PRODUCTNAME.app
13011     else
13012         echo instdir/program/soffice
13013     fi
13014     cat << _EOF
13016 If you want to run the smoketest, run:
13017 $GNUMAKE check
13019 _EOF
13022 if test -f warn; then
13023     cat warn
13024     rm warn
13027 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: