Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / configure.ac
blob0e94953038db5e57736bda4f9d07985c9201933a
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.0.0.beta1],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 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_svg, *colibre, *colibre_svg, *elementary,
1587          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *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-apache-commons,
1746     AS_HELP_STRING([--with-system-apache-commons],
1747         [Use Apache commons libraries already on system.]),,
1748     [with_system_apache_commons="$with_system_jars"])
1750 AC_ARG_WITH(system-mariadb,
1751     AS_HELP_STRING([--with-system-mariadb],
1752         [Use MariaDB/MySQL libraries already on system.]),,
1753     [with_system_mariadb="$with_system_libs"])
1755 AC_ARG_ENABLE(bundle-mariadb,
1756     AS_HELP_STRING([--enable-bundle-mariadb],
1757         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1760 AC_ARG_WITH(system-postgresql,
1761     AS_HELP_STRING([--with-system-postgresql],
1762         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1763          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1764     [with_system_postgresql="$with_system_libs"])
1766 AC_ARG_WITH(libpq-path,
1767     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1768         [Use this PostgreSQL C interface (libpq) installation for building
1769          the PostgreSQL-SDBC extension.]),
1772 AC_ARG_WITH(system-firebird,
1773     AS_HELP_STRING([--with-system-firebird],
1774         [Use Firebird libraries already on system, for building the Firebird-SDBC
1775          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1776     [with_system_firebird="$with_system_libs"])
1778 AC_ARG_WITH(system-libtommath,
1779             AS_HELP_STRING([--with-system-libtommath],
1780                            [Use libtommath already on system]),,
1781             [with_system_libtommath="$with_system_libs"])
1783 AC_ARG_WITH(system-hsqldb,
1784     AS_HELP_STRING([--with-system-hsqldb],
1785         [Use hsqldb already on system.]))
1787 AC_ARG_WITH(hsqldb-jar,
1788     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     HSQLDB_JAR=$withval)
1792 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1793     AS_HELP_STRING([--disable-scripting-beanshell],
1794         [Disable support for scripts in BeanShell.]),
1798 AC_ARG_WITH(system-beanshell,
1799     AS_HELP_STRING([--with-system-beanshell],
1800         [Use beanshell already on system.]),,
1801     [with_system_beanshell="$with_system_jars"])
1803 AC_ARG_WITH(beanshell-jar,
1804     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     BSH_JAR=$withval)
1808 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1809     AS_HELP_STRING([--disable-scripting-javascript],
1810         [Disable support for scripts in JavaScript.]),
1814 AC_ARG_WITH(system-rhino,
1815     AS_HELP_STRING([--with-system-rhino],
1816         [Use rhino already on system.]),,)
1817 #    [with_system_rhino="$with_system_jars"])
1818 # Above is not used as we have different debug interface
1819 # patched into internal rhino. This code needs to be fixed
1820 # before we can enable it by default.
1822 AC_ARG_WITH(rhino-jar,
1823     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     RHINO_JAR=$withval)
1827 AC_ARG_WITH(commons-logging-jar,
1828     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     COMMONS_LOGGING_JAR=$withval)
1832 AC_ARG_WITH(system-jfreereport,
1833     AS_HELP_STRING([--with-system-jfreereport],
1834         [Use JFreeReport already on system.]),,
1835     [with_system_jfreereport="$with_system_jars"])
1837 AC_ARG_WITH(sac-jar,
1838     AS_HELP_STRING([--with-sac-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     SAC_JAR=$withval)
1842 AC_ARG_WITH(libxml-jar,
1843     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     LIBXML_JAR=$withval)
1847 AC_ARG_WITH(flute-jar,
1848     AS_HELP_STRING([--with-flute-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     FLUTE_JAR=$withval)
1852 AC_ARG_WITH(jfreereport-jar,
1853     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     JFREEREPORT_JAR=$withval)
1857 AC_ARG_WITH(liblayout-jar,
1858     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBLAYOUT_JAR=$withval)
1862 AC_ARG_WITH(libloader-jar,
1863     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBLOADER_JAR=$withval)
1867 AC_ARG_WITH(libformula-jar,
1868     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFORMULA_JAR=$withval)
1872 AC_ARG_WITH(librepository-jar,
1873     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBREPOSITORY_JAR=$withval)
1877 AC_ARG_WITH(libfonts-jar,
1878     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBFONTS_JAR=$withval)
1882 AC_ARG_WITH(libserializer-jar,
1883     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBSERIALIZER_JAR=$withval)
1887 AC_ARG_WITH(libbase-jar,
1888     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBBASE_JAR=$withval)
1892 AC_ARG_WITH(system-odbc,
1893     AS_HELP_STRING([--with-system-odbc],
1894         [Use the odbc headers already on system.]),,
1895     [with_system_odbc="auto"])
1897 AC_ARG_WITH(system-sane,
1898     AS_HELP_STRING([--with-system-sane],
1899         [Use sane.h already on system.]),,
1900     [with_system_sane="$with_system_headers"])
1902 AC_ARG_WITH(system-bluez,
1903     AS_HELP_STRING([--with-system-bluez],
1904         [Use bluetooth.h already on system.]),,
1905     [with_system_bluez="$with_system_headers"])
1907 AC_ARG_WITH(system-curl,
1908     AS_HELP_STRING([--with-system-curl],
1909         [Use curl already on system.]),,
1910     [with_system_curl=auto])
1912 AC_ARG_WITH(system-boost,
1913     AS_HELP_STRING([--with-system-boost],
1914         [Use boost already on system.]),,
1915     [with_system_boost="$with_system_headers"])
1917 AC_ARG_WITH(system-glm,
1918     AS_HELP_STRING([--with-system-glm],
1919         [Use glm already on system.]),,
1920     [with_system_glm="$with_system_headers"])
1922 AC_ARG_WITH(system-hunspell,
1923     AS_HELP_STRING([--with-system-hunspell],
1924         [Use libhunspell already on system.]),,
1925     [with_system_hunspell="$with_system_libs"])
1927 AC_ARG_WITH(system-qrcodegen,
1928     AS_HELP_STRING([--with-system-qrcodegen],
1929         [Use libqrcodegen already on system.]),,
1930     [with_system_qrcodegen="$with_system_libs"])
1932 AC_ARG_WITH(system-mythes,
1933     AS_HELP_STRING([--with-system-mythes],
1934         [Use mythes already on system.]),,
1935     [with_system_mythes="$with_system_libs"])
1937 AC_ARG_WITH(system-altlinuxhyph,
1938     AS_HELP_STRING([--with-system-altlinuxhyph],
1939         [Use ALTLinuxhyph already on system.]),,
1940     [with_system_altlinuxhyph="$with_system_libs"])
1942 AC_ARG_WITH(system-lpsolve,
1943     AS_HELP_STRING([--with-system-lpsolve],
1944         [Use lpsolve already on system.]),,
1945     [with_system_lpsolve="$with_system_libs"])
1947 AC_ARG_WITH(system-coinmp,
1948     AS_HELP_STRING([--with-system-coinmp],
1949         [Use CoinMP already on system.]),,
1950     [with_system_coinmp="$with_system_libs"])
1952 AC_ARG_WITH(system-liblangtag,
1953     AS_HELP_STRING([--with-system-liblangtag],
1954         [Use liblangtag library already on system.]),,
1955     [with_system_liblangtag="$with_system_libs"])
1957 AC_ARG_WITH(webdav,
1958     AS_HELP_STRING([--with-webdav],
1959         [Specify which library to use for webdav implementation.
1960          Possible values: "neon", "serf", "no". The default value is "neon".
1961          Example: --with-webdav="serf"]),
1962     WITH_WEBDAV=$withval,
1963     WITH_WEBDAV="neon")
1965 AC_ARG_WITH(linker-hash-style,
1966     AS_HELP_STRING([--with-linker-hash-style],
1967         [Use linker with --hash-style=<style> when linking shared objects.
1968          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1969          if supported on the build system, and "sysv" otherwise.]))
1971 AC_ARG_WITH(jdk-home,
1972     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1973         [If you have installed JDK 8 or later on your system please supply the
1974          path here. Note that this is not the location of the java command but the
1975          location of the entire distribution.]),
1978 AC_ARG_WITH(help,
1979     AS_HELP_STRING([--with-help],
1980         [Enable the build of help. There is a special parameter "common" that
1981          can be used to bundle only the common part, .e.g help-specific icons.
1982          This is useful when you build the helpcontent separately.])
1983     [
1984                           Usage:     --with-help    build the old local help
1985                                  --without-help     no local help (default)
1986                                  --with-help=html   build the new HTML local help
1987                                  --with-help=online build the new HTML online help
1988     ],
1991 AC_ARG_WITH(omindex,
1992    AS_HELP_STRING([--with-omindex],
1993         [Enable the support of xapian-omega index for online help.])
1994    [
1995                          Usage: --with-omindex=server prepare the pages for omindex
1996                                 but let xapian-omega be built in server.
1997                                 --with-omindex=noxap do not prepare online pages
1998                                 for xapian-omega
1999   ],
2002 libo_FUZZ_ARG_WITH(java,
2003     AS_HELP_STRING([--with-java=<java command>],
2004         [Specify the name of the Java interpreter command. Typically "java"
2005          which is the default.
2007          To build without support for Java components, applets, accessibility
2008          or the XML filters written in Java, use --without-java or --with-java=no.]),
2009     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2010     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2013 AC_ARG_WITH(jvm-path,
2014     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2015         [Use a specific JVM search path at runtime.
2016          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2019 AC_ARG_WITH(ant-home,
2020     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2021         [If you have installed Apache Ant on your system, please supply the path here.
2022          Note that this is not the location of the Ant binary but the location
2023          of the entire distribution.]),
2026 AC_ARG_WITH(symbol-config,
2027     AS_HELP_STRING([--with-symbol-config],
2028         [Configuration for the crashreport symbol upload]),
2029         [],
2030         [with_symbol_config=no])
2032 AC_ARG_WITH(export-validation,
2033     AS_HELP_STRING([--without-export-validation],
2034         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2035 ,with_export_validation=auto)
2037 AC_ARG_WITH(bffvalidator,
2038     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2039         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2040          Requires installed Microsoft Office Binary File Format Validator.
2041          Note: export-validation (--with-export-validation) is required to be turned on.
2042          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2043 ,with_bffvalidator=no)
2045 libo_FUZZ_ARG_WITH(junit,
2046     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2047         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2048          --without-junit disables those tests. Not relevant in the --without-java case.]),
2049 ,with_junit=yes)
2051 AC_ARG_WITH(hamcrest,
2052     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2053         [Specifies the hamcrest jar file to use for JUnit-based tests.
2054          --without-junit disables those tests. Not relevant in the --without-java case.]),
2055 ,with_hamcrest=yes)
2057 AC_ARG_WITH(perl-home,
2058     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2059         [If you have installed Perl 5 Distribution, on your system, please
2060          supply the path here. Note that this is not the location of the Perl
2061          binary but the location of the entire distribution.]),
2064 libo_FUZZ_ARG_WITH(doxygen,
2065     AS_HELP_STRING(
2066         [--with-doxygen=<absolute path to doxygen executable>],
2067         [Specifies the doxygen executable to use when generating ODK C/C++
2068          documentation. --without-doxygen disables generation of ODK C/C++
2069          documentation. Not relevant in the --disable-odk case.]),
2070 ,with_doxygen=yes)
2072 AC_ARG_WITH(visual-studio,
2073     AS_HELP_STRING([--with-visual-studio=<2017>],
2074         [Specify which Visual Studio version to use in case several are
2075          installed. Currently only 2017 is supported.]),
2078 AC_ARG_WITH(windows-sdk,
2079     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2080         [Specify which Windows SDK, or "Windows Kit", version to use
2081          in case the one that came with the selected Visual Studio
2082          is not what you want for some reason. Note that not all compiler/SDK
2083          combinations are supported. The intent is that this option should not
2084          be needed.]),
2087 AC_ARG_WITH(lang,
2088     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2089         [Use this option to build LibreOffice with additional UI language support.
2090          English (US) is always included by default.
2091          Separate multiple languages with space.
2092          For all languages, use --with-lang=ALL.]),
2095 AC_ARG_WITH(locales,
2096     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2097         [Use this option to limit the locale information built in.
2098          Separate multiple locales with space.
2099          Very experimental and might well break stuff.
2100          Just a desperate measure to shrink code and data size.
2101          By default all the locales available is included.
2102          This option is completely unrelated to --with-lang.])
2103     [
2104                           Affects also our character encoding conversion
2105                           tables for encodings mainly targeted for a
2106                           particular locale, like EUC-CN and EUC-TW for
2107                           zh, ISO-2022-JP for ja.
2109                           Affects also our add-on break iterator data for
2110                           some languages.
2112                           For the default, all locales, don't use this switch at all.
2113                           Specifying just the language part of a locale means all matching
2114                           locales will be included.
2115     ],
2118 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2119 libo_FUZZ_ARG_WITH(krb5,
2120     AS_HELP_STRING([--with-krb5],
2121         [Enable MIT Kerberos 5 support in modules that support it.
2122          By default automatically enabled on platforms
2123          where a good system Kerberos 5 is available.]),
2126 libo_FUZZ_ARG_WITH(gssapi,
2127     AS_HELP_STRING([--with-gssapi],
2128         [Enable GSSAPI support in modules that support it.
2129          By default automatically enabled on platforms
2130          where a good system GSSAPI is available.]),
2133 AC_ARG_WITH(iwyu,
2134     AS_HELP_STRING([--with-iwyu],
2135         [Use given IWYU binary path to check unneeded includes instead of building.
2136          Use only if you are hacking on it.]),
2139 libo_FUZZ_ARG_WITH(lxml,
2140     AS_HELP_STRING([--without-lxml],
2141         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2142          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2143          report widget classes and ids.]),
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 if test $_os = Darwin; then
2767     # If no --with-macosx-sdk option is given, look for one
2769     # The intent is that for "most" Mac-based developers, a suitable
2770     # SDK will be found automatically without any configure options.
2772     # For developers with a current Xcode, the lowest-numbered SDK
2773     # higher than or equal to the minimum required should be found.
2775     AC_MSG_CHECKING([what macOS SDK to use])
2776     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2777         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2778         if test -d "$MACOSX_SDK_PATH"; then
2779             with_macosx_sdk="${_macosx_sdk}"
2780             break
2781         else
2782             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2783             if test -d "$MACOSX_SDK_PATH"; then
2784                 with_macosx_sdk="${_macosx_sdk}"
2785                 break
2786             fi
2787         fi
2788     done
2789     if test ! -d "$MACOSX_SDK_PATH"; then
2790         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2791     fi
2793     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2795     case $with_macosx_sdk in
2796     10.12)
2797         MACOSX_SDK_VERSION=101200
2798         ;;
2799     10.13)
2800         MACOSX_SDK_VERSION=101300
2801         ;;
2802     10.14)
2803         MACOSX_SDK_VERSION=101400
2804         ;;
2805     10.15)
2806         MACOSX_SDK_VERSION=101500
2807         ;;
2808     *)
2809         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2810         ;;
2811     esac
2813     if test "$with_macosx_version_min_required" = "" ; then
2814         with_macosx_version_min_required="10.10";
2815     fi
2817     if test "$with_macosx_version_max_allowed" = "" ; then
2818         with_macosx_version_max_allowed="$with_macosx_sdk"
2819     fi
2821     # export this so that "xcrun" invocations later return matching values
2822     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2823     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2824     export DEVELOPER_DIR
2825     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2826     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2828     AC_MSG_CHECKING([whether Xcode is new enough])
2829     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2830     my_xcode_ver2=${my_xcode_ver1#Xcode }
2831     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2832     if test "$my_xcode_ver3" -ge 903; then
2833         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2834     else
2835         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2836     fi
2838     case "$with_macosx_version_min_required" in
2839     10.10)
2840         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2841         ;;
2842     10.11)
2843         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2844         ;;
2845     10.12)
2846         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2847         ;;
2848     10.13)
2849         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2850         ;;
2851     10.14)
2852         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2853         ;;
2854     10.15)
2855         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2856         ;;
2857     *)
2858         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2859         ;;
2860     esac
2861     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2863     LIBTOOL=/usr/bin/libtool
2864     INSTALL_NAME_TOOL=install_name_tool
2865     if test -z "$save_CC"; then
2866         stdlib=-stdlib=libc++
2867         if test "$ENABLE_LTO" = TRUE; then
2868             lto=-flto
2869         fi
2871         AC_MSG_CHECKING([what C compiler to use])
2872         CC="`xcrun -find clang`"
2873         CC_BASE=`first_arg_basename "$CC"`
2874         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2875         AC_MSG_RESULT([$CC])
2877         AC_MSG_CHECKING([what C++ compiler to use])
2878         CXX="`xcrun -find clang++`"
2879         CXX_BASE=`first_arg_basename "$CXX"`
2880         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2881         AC_MSG_RESULT([$CXX])
2883         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2884         AR=`xcrun -find ar`
2885         NM=`xcrun -find nm`
2886         STRIP=`xcrun -find strip`
2887         LIBTOOL=`xcrun -find libtool`
2888         RANLIB=`xcrun -find ranlib`
2889     fi
2891     case "$with_macosx_version_max_allowed" in
2892     10.10)
2893         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2894         ;;
2895     10.11)
2896         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2897         ;;
2898     10.12)
2899         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2900         ;;
2901     10.13)
2902         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2903         ;;
2904     10.14)
2905         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2906         ;;
2907     10.15)
2908         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2909         ;;
2910     *)
2911         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2912         ;;
2913     esac
2915     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2916     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2917         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])
2918     else
2919         AC_MSG_RESULT([ok])
2920     fi
2922     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2923     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2924         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2925     else
2926         AC_MSG_RESULT([ok])
2927     fi
2928     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2929     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2931     AC_MSG_CHECKING([whether to do code signing])
2933     if test "$enable_macosx_code_signing" = yes; then
2934         # By default use the first suitable certificate (?).
2936         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2937         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2938         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2939         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2940         # "Developer ID Application" one.
2942         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2943         if test -n "$identity"; then
2944             MACOSX_CODESIGNING_IDENTITY=$identity
2945             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2946             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2947         else
2948             AC_MSG_ERROR([cannot determine identity to use])
2949         fi
2950     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2951         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2952         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2953         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2954     else
2955         AC_MSG_RESULT([no])
2956     fi
2958     AC_MSG_CHECKING([whether to create a Mac App Store package])
2960     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2961         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2962     elif test "$enable_macosx_package_signing" = yes; then
2963         # By default use the first suitable certificate.
2964         # It should be a "3rd Party Mac Developer Installer" one
2966         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2967         if test -n "$identity"; then
2968             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2969             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2970             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2971         else
2972             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2973         fi
2974     elif test -n "$enable_macosx_package_signing"; then
2975         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2976         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2977         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2978     else
2979         AC_MSG_RESULT([no])
2980     fi
2982     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2983         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2984     fi
2986     AC_MSG_CHECKING([whether to sandbox the application])
2988     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2989         AC_MSG_ERROR([macOS sandboxing requires code signing])
2990     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2991         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2992     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2993         ENABLE_MACOSX_SANDBOX=TRUE
2994         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2995         AC_MSG_RESULT([yes])
2996     else
2997         AC_MSG_RESULT([no])
2998     fi
3000     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3001     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3002     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3004 AC_SUBST(MACOSX_SDK_PATH)
3005 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3006 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3007 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3008 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3009 AC_SUBST(INSTALL_NAME_TOOL)
3010 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3011 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3012 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3013 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3014 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3016 dnl ===================================================================
3017 dnl Check iOS SDK and compiler
3018 dnl ===================================================================
3020 if test $_os = iOS; then
3021     AC_MSG_CHECKING([what iOS SDK to use])
3022     current_sdk_ver=13.2
3023     older_sdk_vers="13.1 13.0 12.4 12.2"
3024     if test "$enable_ios_simulator" = "yes"; then
3025         platform=iPhoneSimulator
3026         versionmin=-mios-simulator-version-min=12.2
3027     else
3028         platform=iPhoneOS
3029         versionmin=-miphoneos-version-min=12.2
3030     fi
3031     xcode_developer=`xcode-select -print-path`
3033     for sdkver in $current_sdk_ver $older_sdk_vers; do
3034         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3035         if test -d $t; then
3036             sysroot=$t
3037             break
3038         fi
3039     done
3041     if test -z "$sysroot"; then
3042         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3043     fi
3045     AC_MSG_RESULT($sysroot)
3047     # LTO is not really recommended for iOS builds,
3048     # the link time will be astronomical
3049     if test "$ENABLE_LTO" = TRUE; then
3050         lto=-flto
3051     fi
3053     stdlib="-stdlib=libc++"
3055     AC_MSG_CHECKING([what C compiler to use])
3056     CC="`xcrun -find clang`"
3057     CC_BASE=`first_arg_basename "$CC"`
3058     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3059     AC_MSG_RESULT([$CC])
3061     AC_MSG_CHECKING([what C++ compiler to use])
3062     CXX="`xcrun -find clang++`"
3063     CXX_BASE=`first_arg_basename "$CXX"`
3064     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3065     AC_MSG_RESULT([$CXX])
3067     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3068     AR=`xcrun -find ar`
3069     NM=`xcrun -find nm`
3070     STRIP=`xcrun -find strip`
3071     LIBTOOL=`xcrun -find libtool`
3072     RANLIB=`xcrun -find ranlib`
3075 AC_MSG_CHECKING([whether to treat the installation as read-only])
3077 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3078         "$enable_extensions" != yes; then
3079     enable_readonly_installset=yes
3081 if test "$enable_readonly_installset" = yes; then
3082     AC_MSG_RESULT([yes])
3083     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3084 else
3085     AC_MSG_RESULT([no])
3088 dnl ===================================================================
3089 dnl Structure of install set
3090 dnl ===================================================================
3092 if test $_os = Darwin; then
3093     LIBO_BIN_FOLDER=MacOS
3094     LIBO_ETC_FOLDER=Resources
3095     LIBO_LIBEXEC_FOLDER=MacOS
3096     LIBO_LIB_FOLDER=Frameworks
3097     LIBO_LIB_PYUNO_FOLDER=Resources
3098     LIBO_SHARE_FOLDER=Resources
3099     LIBO_SHARE_HELP_FOLDER=Resources/help
3100     LIBO_SHARE_JAVA_FOLDER=Resources/java
3101     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3102     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3103     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3104     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3105     LIBO_URE_BIN_FOLDER=MacOS
3106     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3107     LIBO_URE_LIB_FOLDER=Frameworks
3108     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3109     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3110 elif test $_os = WINNT; then
3111     LIBO_BIN_FOLDER=program
3112     LIBO_ETC_FOLDER=program
3113     LIBO_LIBEXEC_FOLDER=program
3114     LIBO_LIB_FOLDER=program
3115     LIBO_LIB_PYUNO_FOLDER=program
3116     LIBO_SHARE_FOLDER=share
3117     LIBO_SHARE_HELP_FOLDER=help
3118     LIBO_SHARE_JAVA_FOLDER=program/classes
3119     LIBO_SHARE_PRESETS_FOLDER=presets
3120     LIBO_SHARE_READMES_FOLDER=readmes
3121     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3122     LIBO_SHARE_SHELL_FOLDER=program/shell
3123     LIBO_URE_BIN_FOLDER=program
3124     LIBO_URE_ETC_FOLDER=program
3125     LIBO_URE_LIB_FOLDER=program
3126     LIBO_URE_MISC_FOLDER=program
3127     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3128 else
3129     LIBO_BIN_FOLDER=program
3130     LIBO_ETC_FOLDER=program
3131     LIBO_LIBEXEC_FOLDER=program
3132     LIBO_LIB_FOLDER=program
3133     LIBO_LIB_PYUNO_FOLDER=program
3134     LIBO_SHARE_FOLDER=share
3135     LIBO_SHARE_HELP_FOLDER=help
3136     LIBO_SHARE_JAVA_FOLDER=program/classes
3137     LIBO_SHARE_PRESETS_FOLDER=presets
3138     LIBO_SHARE_READMES_FOLDER=readmes
3139     if test "$enable_fuzzers" != yes; then
3140         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3141     else
3142         LIBO_SHARE_RESOURCE_FOLDER=resource
3143     fi
3144     LIBO_SHARE_SHELL_FOLDER=program/shell
3145     LIBO_URE_BIN_FOLDER=program
3146     LIBO_URE_ETC_FOLDER=program
3147     LIBO_URE_LIB_FOLDER=program
3148     LIBO_URE_MISC_FOLDER=program
3149     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3151 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3154 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3155 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3156 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3157 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3158 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3159 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3160 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3161 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3168 # Not all of them needed in config_host.mk, add more if need arises
3169 AC_SUBST(LIBO_BIN_FOLDER)
3170 AC_SUBST(LIBO_ETC_FOLDER)
3171 AC_SUBST(LIBO_LIB_FOLDER)
3172 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3173 AC_SUBST(LIBO_SHARE_FOLDER)
3174 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3175 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3176 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3177 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3178 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3179 AC_SUBST(LIBO_URE_BIN_FOLDER)
3180 AC_SUBST(LIBO_URE_ETC_FOLDER)
3181 AC_SUBST(LIBO_URE_LIB_FOLDER)
3182 AC_SUBST(LIBO_URE_MISC_FOLDER)
3183 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3185 dnl ===================================================================
3186 dnl Windows specific tests and stuff
3187 dnl ===================================================================
3189 reg_get_value()
3191     # Return value: $regvalue
3192     unset regvalue
3194     local _regentry="/proc/registry${1}/${2}"
3195     if test -f "$_regentry"; then
3196         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3197         # Registry keys read via /proc/registry* are always \0 terminated!
3198         local _regvalue=$(tr -d '\0' < "$_regentry")
3199         if test $? -eq 0; then
3200             regvalue=$_regvalue
3201         fi
3202     fi
3205 # Get a value from the 32-bit side of the Registry
3206 reg_get_value_32()
3208     reg_get_value "32" "$1"
3211 # Get a value from the 64-bit side of the Registry
3212 reg_get_value_64()
3214     reg_get_value "64" "$1"
3217 if test "$_os" = "WINNT"; then
3218     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3219     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3220         AC_MSG_RESULT([no])
3221         WINDOWS_SDK_ARCH="x86"
3222     else
3223         AC_MSG_RESULT([yes])
3224         WINDOWS_SDK_ARCH="x64"
3225         BITNESS_OVERRIDE=64
3226     fi
3228 if test "$_os" = "iOS"; then
3229     cross_compiling="yes"
3232 if test "$cross_compiling" = "yes"; then
3233     export CROSS_COMPILING=TRUE
3234 else
3235     CROSS_COMPILING=
3236     BUILD_TYPE="$BUILD_TYPE NATIVE"
3238 AC_SUBST(CROSS_COMPILING)
3240 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3241 # NOTE: must _not_ be used for bundled external libraries!
3242 ISYSTEM=
3243 if test "$GCC" = "yes"; then
3244     AC_MSG_CHECKING( for -isystem )
3245     save_CFLAGS=$CFLAGS
3246     CFLAGS="$CFLAGS -Werror"
3247     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3248     CFLAGS=$save_CFLAGS
3249     if test -n "$ISYSTEM"; then
3250         AC_MSG_RESULT(yes)
3251     else
3252         AC_MSG_RESULT(no)
3253     fi
3255 if test -z "$ISYSTEM"; then
3256     # fall back to using -I
3257     ISYSTEM=-I
3259 AC_SUBST(ISYSTEM)
3261 dnl ===================================================================
3262 dnl  Check which Visual Studio compiler is used
3263 dnl ===================================================================
3265 map_vs_year_to_version()
3267     # Return value: $vsversion
3269     unset vsversion
3271     case $1 in
3272     2017)
3273         vsversion=15;;
3274     2019)
3275         vsversion=16;;
3276     *)
3277         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3278     esac
3281 vs_versions_to_check()
3283     # Args: $1 (optional) : versions to check, in the order of preference
3284     # Return value: $vsversions
3286     unset vsversions
3288     if test -n "$1"; then
3289         map_vs_year_to_version "$1"
3290         vsversions=$vsversion
3291     else
3292         # We accept only 2017
3293         vsversions="15"
3294     fi
3297 win_get_env_from_vsvars32bat()
3299     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3300     # Also seems to be located in another directory under the same name: vsvars32.bat
3301     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3302     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3303     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3304     chmod +x $WRAPPERBATCHFILEPATH
3305     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3306     rm -f $WRAPPERBATCHFILEPATH
3307     printf '%s' "$_win_get_env_from_vsvars32bat"
3310 find_ucrt()
3312     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3313     if test -n "$regvalue"; then
3314         PathFormat "$regvalue"
3315         UCRTSDKDIR=$formatted_path
3316         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3317         UCRTVERSION=$regvalue
3318         # Rest if not exist
3319         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3320           UCRTSDKDIR=
3321         fi
3322     fi
3323     if test -z "$UCRTSDKDIR"; then
3324         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3325         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3326         if test -f "$ide_env_file"; then
3327             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3328             UCRTSDKDIR=$formatted_path
3329             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3330             dnl Hack needed at least by tml:
3331             if test "$UCRTVERSION" = 10.0.15063.0 \
3332                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3333                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3334             then
3335                 UCRTVERSION=10.0.14393.0
3336             fi
3337         else
3338           AC_MSG_ERROR([No UCRT found])
3339         fi
3340     fi
3343 find_msvc()
3345     # Find Visual C++ 2017/2019
3346     # Args: $1 (optional) : The VS version year
3347     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3349     unset vctest vcnum vcnumwithdot vcbuildnumber
3351     vs_versions_to_check "$1"
3352     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3353     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3354     PathFormat "$vswhere"
3355     vswhere=$formatted_path
3356     for ver in $vsversions; do
3357         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3358         if test -n "$vswhereoutput"; then
3359             PathFormat "$vswhereoutput"
3360             vctest=$formatted_path
3361             break
3362         fi
3363     done
3365     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3366     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3367     # should be removed when upgrading baseline.
3368     if ! test -n "$vctest"; then
3369         for ver in $vsversions; do
3370             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3371             if test -n "$regvalue"; then
3372                 vctest=$regvalue
3373                 break
3374             fi
3375             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3376             if test -n "$regvalue"; then
3377                 AC_MSG_RESULT([found: $regvalue])
3378                 PathFormat "$regvalue"
3379                 vctest=$formatted_path
3380                 break
3381             fi
3382         done
3383     fi
3385     if test -n "$vctest"; then
3386         vcnumwithdot="$ver.0"
3387         case "$vcnumwithdot" in
3388         15.0)
3389             vcyear=2017
3390             vcnum=150
3391             ;;
3392         16.0)
3393             vcyear=2019
3394             vcnum=160
3395             ;;
3396         esac
3397         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3399     fi
3402 SOLARINC=
3403 MSBUILD_PATH=
3404 DEVENV=
3405 if test "$_os" = "WINNT"; then
3406     AC_MSG_CHECKING([Visual C++])
3407     find_msvc "$with_visual_studio"
3408     if test -z "$vctest"; then
3409         if test -n "$with_visual_studio"; then
3410             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3411         else
3412             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3413         fi
3414     fi
3416     if test "$BITNESS_OVERRIDE" = ""; then
3417         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3418             VC_PRODUCT_DIR=$vctest/VC
3419         else
3420             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3421         fi
3422     else
3423         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3424             VC_PRODUCT_DIR=$vctest/VC
3425         else
3426             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3427         fi
3428     fi
3429     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3431     AC_MSG_CHECKING([for short pathname of VC product directory])
3432     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3433     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3435     UCRTSDKDIR=
3436     UCRTVERSION=
3438     AC_MSG_CHECKING([for UCRT location])
3439     find_ucrt
3440     # find_ucrt errors out if it doesn't find it
3441     AC_MSG_RESULT([found])
3442     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3443     ucrtincpath_formatted=$formatted_path
3444     # SOLARINC is used for external modules and must be set too.
3445     # And no, it's not sufficient to set SOLARINC only, as configure
3446     # itself doesn't honour it.
3447     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3448     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3449     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3450     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3452     AC_SUBST(UCRTSDKDIR)
3453     AC_SUBST(UCRTVERSION)
3455     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3456     # Find the proper version of MSBuild.exe to use based on the VS version
3457     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3458     if test -n "$regvalue" ; then
3459         AC_MSG_RESULT([found: $regvalue])
3460         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3461     else
3462         if test "$vcnumwithdot" = "16.0"; then
3463             if test "$BITNESS_OVERRIDE" = ""; then
3464                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3465             else
3466                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3467             fi
3468         else
3469             if test "$BITNESS_OVERRIDE" = ""; then
3470                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3471             else
3472                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3473             fi
3474         fi
3475         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3476         AC_MSG_RESULT([$regvalue])
3477     fi
3479     # Find the version of devenv.exe
3480     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3481     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3482     if test ! -e "$DEVENV"; then
3483         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3484     fi
3486     dnl ===========================================================
3487     dnl  Check for the corresponding mspdb*.dll
3488     dnl ===========================================================
3490     VC_HOST_DIR=
3491     MSPDB_PATH=
3492     CL_PATH=
3494     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3495         VC_HOST_DIR="HostX64"
3496         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3497     else
3498         VC_HOST_DIR="HostX86"
3499         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3500     fi
3502     if test "$BITNESS_OVERRIDE" = ""; then
3503         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3504     else
3505         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3506     fi
3508     # MSVC 15.0 has libraries from 14.0?
3509     mspdbnum="140"
3511     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3512         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3513     fi
3515     dnl The path needs to be added before cl is called
3516     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3517     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3519     AC_MSG_CHECKING([cl.exe])
3521     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3522     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3523     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3524     # is not enough?
3526     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3527     dnl needed when building CLR code:
3528     if test -z "$MSVC_CXX"; then
3529         if test -f "$CL_PATH/cl.exe"; then
3530             MSVC_CXX="$CL_PATH/cl.exe"
3531         fi
3533         # This gives us a posix path with 8.3 filename restrictions
3534         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3535     fi
3537     if test -z "$CC"; then
3538         CC=$MSVC_CXX
3539         CC_BASE=`first_arg_basename "$CC"`
3540     fi
3541     if test "$BITNESS_OVERRIDE" = ""; then
3542         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3543         MSVC_CXX="$MSVC_CXX -arch:SSE"
3544     fi
3545     if test -z "$CXX"; then
3546         CXX=$MSVC_CXX
3547         CXX_BASE=`first_arg_basename "$CXX"`
3548     fi
3550     if test -n "$CC"; then
3551         # Remove /cl.exe from CC case insensitive
3552         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3553         if test "$BITNESS_OVERRIDE" = ""; then
3554            COMPATH="$VC_PRODUCT_DIR"
3555         else
3556             if test -n "$VC_PRODUCT_DIR"; then
3557                 COMPATH=$VC_PRODUCT_DIR
3558             fi
3559         fi
3560         if test "$BITNESS_OVERRIDE" = ""; then
3561             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3562             CC="$CC -arch:SSE"
3563         fi
3565         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3567         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3569         PathFormat "$COMPATH"
3570         COMPATH=`win_short_path_for_make "$formatted_path"`
3572         VCVER=$vcnum
3573         MSVSVER=$vcyear
3575         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3576         # are always "better", we list them in reverse chronological order.
3578         case "$vcnum" in
3579         150|160)
3580             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3581             ;;
3582         esac
3584         # The expectation is that --with-windows-sdk should not need to be used
3585         if test -n "$with_windows_sdk"; then
3586             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3587             *" "$with_windows_sdk" "*)
3588                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3589                 ;;
3590             *)
3591                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3592                 ;;
3593             esac
3594         fi
3596         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3597         ac_objext=obj
3598         ac_exeext=exe
3600     else
3601         AC_MSG_ERROR([Visual C++ not found after all, huh])
3602     fi
3604     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3605     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3606         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3607         // between Visual Studio versions and _MSC_VER:
3608         #if _MSC_VER < 1914
3609         #error
3610         #endif
3611     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3613     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3614     # version of the Explorer extension (and maybe other small
3615     # bits, too) needed when installing a 32-bit LibreOffice on a
3616     # 64-bit OS. The 64-bit Explorer extension is a feature that
3617     # has been present since long in OOo. Don't confuse it with
3618     # building LibreOffice itself as 64-bit code.
3620     BUILD_X64=
3621     CXX_X64_BINARY=
3623     if test "$BITNESS_OVERRIDE" = ""; then
3624         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3625         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3626              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3627             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3628                 BUILD_X64=TRUE
3629                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3630             fi
3631         fi
3632         if test "$BUILD_X64" = TRUE; then
3633             AC_MSG_RESULT([found])
3634         else
3635             AC_MSG_RESULT([not found])
3636             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3637         fi
3638     else
3639         CXX_X64_BINARY=$CXX
3640     fi
3641     AC_SUBST(BUILD_X64)
3643     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3644     AC_SUBST(CXX_X64_BINARY)
3646     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3647     # needed to support TWAIN scan on both 32- and 64-bit systems
3649     BUILD_X86=
3651     if test "$BITNESS_OVERRIDE" = "64"; then
3652         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3653         if test -n "$CXX_X86_BINARY"; then
3654             BUILD_X86=TRUE
3655             AC_MSG_RESULT([preset])
3656         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3657             BUILD_X86=TRUE
3658             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3659             CXX_X86_BINARY+=" /arch:SSE"
3660             AC_MSG_RESULT([found])
3661         else
3662             CXX_X86_BINARY=
3663             AC_MSG_RESULT([not found])
3664             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3665         fi
3666     else
3667         BUILD_X86=TRUE
3668         CXX_X86_BINARY=$MSVC_CXX
3669     fi
3670     AC_SUBST(BUILD_X86)
3671     AC_SUBST(CXX_X86_BINARY)
3673 AC_SUBST(VCVER)
3674 AC_SUBST(DEVENV)
3675 AC_SUBST(MSVC_CXX)
3678 # unowinreg.dll
3680 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3681 AC_SUBST(UNOWINREG_DLL)
3683 COM_IS_CLANG=
3684 AC_MSG_CHECKING([whether the compiler is actually Clang])
3685 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3686     #ifndef __clang__
3687     you lose
3688     #endif
3689     int foo=42;
3690     ]])],
3691     [AC_MSG_RESULT([yes])
3692      COM_IS_CLANG=TRUE],
3693     [AC_MSG_RESULT([no])])
3694 AC_SUBST(COM_IS_CLANG)
3696 CC_PLAIN=$CC
3697 CLANGVER=
3698 if test "$COM_IS_CLANG" = TRUE; then
3699     AC_MSG_CHECKING([whether Clang is new enough])
3700     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3701         #if !defined __apple_build_version__
3702         #error
3703         #endif
3704         ]])],
3705         [my_apple_clang=yes],[my_apple_clang=])
3706     if test "$my_apple_clang" = yes; then
3707         AC_MSG_RESULT([assumed yes (Apple Clang)])
3708     else
3709         if test "$_os" = WINNT; then
3710             dnl In which case, assume clang-cl:
3711             my_args="/EP /TC"
3712             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3713             dnl clang-cl:
3714             CC_PLAIN=
3715             for i in $CC; do
3716                 case $i in
3717                 -FIIntrin.h)
3718                     ;;
3719                 *)
3720                     CC_PLAIN="$CC_PLAIN $i"
3721                     ;;
3722                 esac
3723             done
3724         else
3725             my_args="-E -P"
3726         fi
3727         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3728         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3729         CLANGVER=`echo $clang_version \
3730             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3731         if test "$CLANGVER" -ge 50002; then
3732             AC_MSG_RESULT([yes ($clang_version)])
3733         else
3734             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3735         fi
3736         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3737         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3738     fi
3741 SHOWINCLUDES_PREFIX=
3742 if test "$_os" = WINNT; then
3743     dnl We need to guess the prefix of the -showIncludes output, it can be
3744     dnl localized
3745     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3746     echo "#include <stdlib.h>" > conftest.c
3747     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3748         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3749     rm -f conftest.c conftest.obj
3750     if test -z "$SHOWINCLUDES_PREFIX"; then
3751         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3752     else
3753         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3754     fi
3756 AC_SUBST(SHOWINCLUDES_PREFIX)
3759 # prefix C with ccache if needed
3761 if test "$CCACHE" != ""; then
3762     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3764     AC_LANG_PUSH([C])
3765     save_CFLAGS=$CFLAGS
3766     CFLAGS="$CFLAGS --ccache-skip -O2"
3767     dnl an empty program will do, we're checking the compiler flags
3768     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3769                       [use_ccache=yes], [use_ccache=no])
3770     if test $use_ccache = yes; then
3771         AC_MSG_RESULT([yes])
3772     else
3773         CC="$CCACHE $CC"
3774         CC_BASE="ccache $CC_BASE"
3775         AC_MSG_RESULT([no])
3776     fi
3777     CFLAGS=$save_CFLAGS
3778     AC_LANG_POP([C])
3781 # ===================================================================
3782 # check various GCC options that Clang does not support now but maybe
3783 # will somewhen in the future, check them even for GCC, so that the
3784 # flags are set
3785 # ===================================================================
3787 HAVE_GCC_GGDB2=
3788 if test "$GCC" = "yes"; then
3789     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3790     save_CFLAGS=$CFLAGS
3791     CFLAGS="$CFLAGS -Werror -ggdb2"
3792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3793     CFLAGS=$save_CFLAGS
3794     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3795         AC_MSG_RESULT([yes])
3796     else
3797         AC_MSG_RESULT([no])
3798     fi
3800     if test "$host_cpu" = "m68k"; then
3801         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3802         save_CFLAGS=$CFLAGS
3803         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3804         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3805         CFLAGS=$save_CFLAGS
3806         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3807             AC_MSG_RESULT([yes])
3808         else
3809             AC_MSG_ERROR([no])
3810         fi
3811     fi
3813 AC_SUBST(HAVE_GCC_GGDB2)
3815 dnl ===================================================================
3816 dnl  Test the gcc version
3817 dnl ===================================================================
3818 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3819     AC_MSG_CHECKING([the GCC version])
3820     _gcc_version=`$CC -dumpversion`
3821     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3822         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3823     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3825     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3827     if test "$gcc_full_version" -lt 70000; then
3828         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3829     fi
3830 else
3831     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3832     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3833     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3834     # (which reports itself as GCC 4.2.1).
3835     GCC_VERSION=
3837 AC_SUBST(GCC_VERSION)
3839 dnl Set the ENABLE_DBGUTIL variable
3840 dnl ===================================================================
3841 AC_MSG_CHECKING([whether to build with additional debug utilities])
3842 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3843     ENABLE_DBGUTIL="TRUE"
3844     # this is an extra var so it can have different default on different MSVC
3845     # versions (in case there are version specific problems with it)
3846     MSVC_USE_DEBUG_RUNTIME="TRUE"
3848     AC_MSG_RESULT([yes])
3849     # cppunit and graphite expose STL in public headers
3850     if test "$with_system_cppunit" = "yes"; then
3851         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3852     else
3853         with_system_cppunit=no
3854     fi
3855     if test "$with_system_graphite" = "yes"; then
3856         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3857     else
3858         with_system_graphite=no
3859     fi
3860     if test "$with_system_orcus" = "yes"; then
3861         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3862     else
3863         with_system_orcus=no
3864     fi
3865     if test "$with_system_libcmis" = "yes"; then
3866         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3867     else
3868         with_system_libcmis=no
3869     fi
3870     if test "$with_system_hunspell" = "yes"; then
3871         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3872     else
3873         with_system_hunspell=no
3874     fi
3875     if test "$with_system_gpgmepp" = "yes"; then
3876         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3877     else
3878         with_system_gpgmepp=no
3879     fi
3880     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3881     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3882     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3883     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3884     # of those two is using the system variant:
3885     if test "$with_system_libnumbertext" = "yes"; then
3886         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3887     else
3888         with_system_libnumbertext=no
3889     fi
3890     if test "$with_system_libwps" = "yes"; then
3891         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3892     else
3893         with_system_libwps=no
3894     fi
3895 else
3896     ENABLE_DBGUTIL=""
3897     MSVC_USE_DEBUG_RUNTIME=""
3898     AC_MSG_RESULT([no])
3900 AC_SUBST(ENABLE_DBGUTIL)
3901 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3903 dnl Set the ENABLE_DEBUG variable.
3904 dnl ===================================================================
3905 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3906     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3908 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3909     if test -z "$libo_fuzzed_enable_debug"; then
3910         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3911     else
3912         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3913         enable_debug=yes
3914     fi
3917 AC_MSG_CHECKING([whether to do a debug build])
3918 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3919     ENABLE_DEBUG="TRUE"
3920     if test -n "$ENABLE_DBGUTIL" ; then
3921         AC_MSG_RESULT([yes (dbgutil)])
3922     else
3923         AC_MSG_RESULT([yes])
3924     fi
3925 else
3926     ENABLE_DEBUG=""
3927     AC_MSG_RESULT([no])
3929 AC_SUBST(ENABLE_DEBUG)
3931 dnl ===================================================================
3932 dnl Select the linker to use (gold/lld/ld.bfd).
3933 dnl This is done only after compiler checks (need to know if Clang is
3934 dnl used, for different defaults) and after checking if a debug build
3935 dnl is wanted (non-debug builds get the default linker if not explicitly
3936 dnl specified otherwise).
3937 dnl All checks for linker features/options should come after this.
3938 dnl ===================================================================
3939 check_use_ld()
3941     use_ld=$1
3942     use_ld_fail_if_error=$2
3943     use_ld_ok=
3944     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3945     use_ld_ldflags_save="$LDFLAGS"
3946     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3947     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3948 #include <stdio.h>
3949         ],[
3950 printf ("hello world\n");
3951         ])], USE_LD=$use_ld, [])
3952     if test -n "$USE_LD"; then
3953         AC_MSG_RESULT( yes )
3954         use_ld_ok=yes
3955     else
3956         if test -n "$use_ld_fail_if_error"; then
3957             AC_MSG_ERROR( no )
3958         else
3959             AC_MSG_RESULT( no )
3960         fi
3961     fi
3962     if test -n "$use_ld_ok"; then
3963         dnl keep the value of LDFLAGS
3964         return 0
3965     fi
3966     LDFLAGS="$use_ld_ldflags_save"
3967     return 1
3969 USE_LD=
3970 if test "$enable_ld" != "no"; then
3971     if test "$GCC" = "yes"; then
3972         if test -n "$enable_ld"; then
3973             check_use_ld "$enable_ld" fail_if_error
3974         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3975             dnl non-debug builds default to the default linker
3976             true
3977         elif test -n "$COM_IS_CLANG"; then
3978             check_use_ld lld
3979             if test $? -ne 0; then
3980                 check_use_ld gold
3981             fi
3982         else
3983             # For gcc first try gold, new versions also support lld.
3984             check_use_ld gold
3985             if test $? -ne 0; then
3986                 check_use_ld lld
3987             fi
3988         fi
3989         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3990         rm conftest.out
3991         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3992         if test -z "$ld_used"; then
3993             ld_used="unknown"
3994         fi
3995         AC_MSG_CHECKING([for linker that is used])
3996         AC_MSG_RESULT([$ld_used])
3997         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3998             if echo "$ld_used" | grep -q "^GNU ld"; then
3999                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4000                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4001             fi
4002         fi
4003     else
4004         if test "$enable_ld" = "yes"; then
4005             AC_MSG_ERROR([--enable-ld not supported])
4006         fi
4007     fi
4009 AC_SUBST(USE_LD)
4011 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4012 if test "$GCC" = "yes"; then
4013     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4014     bsymbolic_functions_ldflags_save=$LDFLAGS
4015     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4016     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4017 #include <stdio.h>
4018         ],[
4019 printf ("hello world\n");
4020         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4021     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4022         AC_MSG_RESULT( found )
4023     else
4024         AC_MSG_RESULT( not found )
4025     fi
4026     LDFLAGS=$bsymbolic_functions_ldflags_save
4028 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4031 HAVE_GSPLIT_DWARF=
4032 if test "$enable_split_debug" != no; then
4033     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4034     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4035         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4036         save_CFLAGS=$CFLAGS
4037         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4038         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4039         CFLAGS=$save_CFLAGS
4040         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4041             AC_MSG_RESULT([yes])
4042         else
4043             if test "$enable_split_debug" = yes; then
4044                 AC_MSG_ERROR([no])
4045             else
4046                 AC_MSG_RESULT([no])
4047             fi
4048         fi
4049     fi
4050     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4051         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4052         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4053     fi
4055 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4057 ENABLE_GDB_INDEX=
4058 if test "$enable_gdb_index" != "no"; then
4059     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4060     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4061         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4062         save_CFLAGS=$CFLAGS
4063         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4064         have_ggnu_pubnames=
4065         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4066         if test "$have_ggnu_pubnames" != "TRUE"; then
4067             if test "$enable_gdb_index" = "yes"; then
4068                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4069             else
4070                 AC_MSG_RESULT( no )
4071             fi
4072         else
4073             AC_MSG_RESULT( yes )
4074             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4075             ldflags_save=$LDFLAGS
4076             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4077             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4078 #include <stdio.h>
4079                 ],[
4080 printf ("hello world\n");
4081                 ])], ENABLE_GDB_INDEX=TRUE, [])
4082             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4083                 AC_MSG_RESULT( yes )
4084             else
4085                 if test "$enable_gdb_index" = "yes"; then
4086                     AC_MSG_ERROR( no )
4087                 else
4088                     AC_MSG_RESULT( no )
4089                 fi
4090             fi
4091             LDFLAGS=$ldflags_save
4092         fi
4093         CFLAGS=$save_CFLAGS
4094         fi
4095     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4096         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4097         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4098     fi
4100 AC_SUBST(ENABLE_GDB_INDEX)
4102 if test "$enable_sal_log" = yes; then
4103     ENABLE_SAL_LOG=TRUE
4105 AC_SUBST(ENABLE_SAL_LOG)
4107 dnl Check for enable symbols option
4108 dnl ===================================================================
4109 AC_MSG_CHECKING([whether to generate debug information])
4110 if test -z "$enable_symbols"; then
4111     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4112         enable_symbols=yes
4113     else
4114         enable_symbols=no
4115     fi
4117 if test "$enable_symbols" = yes; then
4118     ENABLE_SYMBOLS_FOR=all
4119     AC_MSG_RESULT([yes])
4120 elif test "$enable_symbols" = no; then
4121     ENABLE_SYMBOLS_FOR=
4122     AC_MSG_RESULT([no])
4123 else
4124     # Selective debuginfo.
4125     ENABLE_SYMBOLS_FOR="$enable_symbols"
4126     AC_MSG_RESULT([for "$enable_symbols"])
4128 AC_SUBST(ENABLE_SYMBOLS_FOR)
4130 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4131     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4132     AC_MSG_CHECKING([whether enough memory is available for linking])
4133     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4134     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4135     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4136         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4137     else
4138         AC_MSG_RESULT([yes])
4139     fi
4142 AC_MSG_CHECKING([whether to compile with optimization flags])
4143 if test -z "$enable_optimized"; then
4144     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4145         enable_optimized=no
4146     else
4147         enable_optimized=yes
4148     fi
4150 if test "$enable_optimized" != no; then
4151     ENABLE_OPTIMIZED=TRUE
4152     AC_MSG_RESULT([yes])
4153 else
4154     ENABLE_OPTIMIZED=
4155     AC_MSG_RESULT([no])
4157 AC_SUBST(ENABLE_OPTIMIZED)
4160 # determine CPUNAME, OS, ...
4161 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4163 case "$host_os" in
4165 aix*)
4166     COM=GCC
4167     CPUNAME=POWERPC
4168     USING_X11=TRUE
4169     OS=AIX
4170     RTL_OS=AIX
4171     RTL_ARCH=PowerPC
4172     PLATFORMID=aix_powerpc
4173     P_SEP=:
4174     ;;
4176 cygwin*)
4177     COM=MSC
4178     USING_X11=
4179     OS=WNT
4180     RTL_OS=Windows
4181     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4182         P_SEP=";"
4183     else
4184         P_SEP=:
4185     fi
4186     case "$host_cpu" in
4187     i*86|x86_64)
4188         if test "$BITNESS_OVERRIDE" = 64; then
4189             CPUNAME=X86_64
4190             RTL_ARCH=X86_64
4191             PLATFORMID=windows_x86_64
4192             WINDOWS_X64=1
4193             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4194         else
4195             CPUNAME=INTEL
4196             RTL_ARCH=x86
4197             PLATFORMID=windows_x86
4198         fi
4199         ;;
4200     *)
4201         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4202         ;;
4203     esac
4204     SCPDEFS="$SCPDEFS -D_MSC_VER"
4205     ;;
4207 darwin*)
4208     COM=GCC
4209     USING_X11=
4210     OS=MACOSX
4211     RTL_OS=MacOSX
4212     P_SEP=:
4214     case "$host_cpu" in
4215     arm)
4216         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4217         ;;
4218     arm64)
4219         OS=iOS
4220         RTL_OS=iOS
4221         if test "$enable_ios_simulator" = "yes"; then
4222             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4223         else
4224             CPUNAME=ARM64
4225             RTL_ARCH=ARM_EABI
4226             PLATFORMID=ios_arm64
4227         fi
4228         ;;
4229     i*86)
4230         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4231         ;;
4232     x86_64)
4233         if test "$enable_ios_simulator" = "yes"; then
4234             OS=iOS
4235         fi
4236         CPUNAME=X86_64
4237         RTL_ARCH=X86_64
4238         PLATFORMID=macosx_x86_64
4239         ;;
4240     *)
4241         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4242         ;;
4243     esac
4244     ;;
4246 dragonfly*)
4247     COM=GCC
4248     USING_X11=TRUE
4249     OS=DRAGONFLY
4250     RTL_OS=DragonFly
4251     P_SEP=:
4253     case "$host_cpu" in
4254     i*86)
4255         CPUNAME=INTEL
4256         RTL_ARCH=x86
4257         PLATFORMID=dragonfly_x86
4258         ;;
4259     x86_64)
4260         CPUNAME=X86_64
4261         RTL_ARCH=X86_64
4262         PLATFORMID=dragonfly_x86_64
4263         ;;
4264     *)
4265         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4266         ;;
4267     esac
4268     ;;
4270 freebsd*)
4271     COM=GCC
4272     USING_X11=TRUE
4273     RTL_OS=FreeBSD
4274     OS=FREEBSD
4275     P_SEP=:
4277     case "$host_cpu" in
4278     i*86)
4279         CPUNAME=INTEL
4280         RTL_ARCH=x86
4281         PLATFORMID=freebsd_x86
4282         ;;
4283     x86_64|amd64)
4284         CPUNAME=X86_64
4285         RTL_ARCH=X86_64
4286         PLATFORMID=freebsd_x86_64
4287         ;;
4288     *)
4289         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4290         ;;
4291     esac
4292     ;;
4294 haiku*)
4295     COM=GCC
4296     USING_X11=
4297     GUIBASE=haiku
4298     RTL_OS=Haiku
4299     OS=HAIKU
4300     P_SEP=:
4302     case "$host_cpu" in
4303     i*86)
4304         CPUNAME=INTEL
4305         RTL_ARCH=x86
4306         PLATFORMID=haiku_x86
4307         ;;
4308     x86_64|amd64)
4309         CPUNAME=X86_64
4310         RTL_ARCH=X86_64
4311         PLATFORMID=haiku_x86_64
4312         ;;
4313     *)
4314         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4315         ;;
4316     esac
4317     ;;
4319 kfreebsd*)
4320     COM=GCC
4321     USING_X11=TRUE
4322     OS=LINUX
4323     RTL_OS=kFreeBSD
4324     P_SEP=:
4326     case "$host_cpu" in
4328     i*86)
4329         CPUNAME=INTEL
4330         RTL_ARCH=x86
4331         PLATFORMID=kfreebsd_x86
4332         ;;
4333     x86_64)
4334         CPUNAME=X86_64
4335         RTL_ARCH=X86_64
4336         PLATFORMID=kfreebsd_x86_64
4337         ;;
4338     *)
4339         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4340         ;;
4341     esac
4342     ;;
4344 linux-gnu*)
4345     COM=GCC
4346     USING_X11=TRUE
4347     OS=LINUX
4348     RTL_OS=Linux
4349     P_SEP=:
4351     case "$host_cpu" in
4353     aarch64)
4354         CPUNAME=AARCH64
4355         PLATFORMID=linux_aarch64
4356         RTL_ARCH=AARCH64
4357         ;;
4358     alpha)
4359         CPUNAME=AXP
4360         RTL_ARCH=ALPHA
4361         PLATFORMID=linux_alpha
4362         ;;
4363     arm*)
4364         CPUNAME=ARM
4365         EPM_FLAGS="-a arm"
4366         RTL_ARCH=ARM_EABI
4367         PLATFORMID=linux_arm_eabi
4368         case "$host_cpu" in
4369         arm*-linux)
4370             RTL_ARCH=ARM_OABI
4371             PLATFORMID=linux_arm_oabi
4372             ;;
4373         esac
4374         ;;
4375     hppa)
4376         CPUNAME=HPPA
4377         RTL_ARCH=HPPA
4378         EPM_FLAGS="-a hppa"
4379         PLATFORMID=linux_hppa
4380         ;;
4381     i*86)
4382         CPUNAME=INTEL
4383         RTL_ARCH=x86
4384         PLATFORMID=linux_x86
4385         ;;
4386     ia64)
4387         CPUNAME=IA64
4388         RTL_ARCH=IA64
4389         PLATFORMID=linux_ia64
4390         ;;
4391     mips)
4392         CPUNAME=GODSON
4393         RTL_ARCH=MIPS_EB
4394         EPM_FLAGS="-a mips"
4395         PLATFORMID=linux_mips_eb
4396         ;;
4397     mips64)
4398         CPUNAME=GODSON64
4399         RTL_ARCH=MIPS64_EB
4400         EPM_FLAGS="-a mips64"
4401         PLATFORMID=linux_mips64_eb
4402         ;;
4403     mips64el)
4404         CPUNAME=GODSON64
4405         RTL_ARCH=MIPS64_EL
4406         EPM_FLAGS="-a mips64el"
4407         PLATFORMID=linux_mips64_el
4408         ;;
4409     mipsel)
4410         CPUNAME=GODSON
4411         RTL_ARCH=MIPS_EL
4412         EPM_FLAGS="-a mipsel"
4413         PLATFORMID=linux_mips_el
4414         ;;
4415     m68k)
4416         CPUNAME=M68K
4417         RTL_ARCH=M68K
4418         PLATFORMID=linux_m68k
4419         ;;
4420     powerpc)
4421         CPUNAME=POWERPC
4422         RTL_ARCH=PowerPC
4423         PLATFORMID=linux_powerpc
4424         ;;
4425     powerpc64)
4426         CPUNAME=POWERPC64
4427         RTL_ARCH=PowerPC_64
4428         PLATFORMID=linux_powerpc64
4429         ;;
4430     powerpc64le)
4431         CPUNAME=POWERPC64
4432         RTL_ARCH=PowerPC_64_LE
4433         PLATFORMID=linux_powerpc64_le
4434         ;;
4435     sparc)
4436         CPUNAME=SPARC
4437         RTL_ARCH=SPARC
4438         PLATFORMID=linux_sparc
4439         ;;
4440     sparc64)
4441         CPUNAME=SPARC64
4442         RTL_ARCH=SPARC64
4443         PLATFORMID=linux_sparc64
4444         ;;
4445     s390)
4446         CPUNAME=S390
4447         RTL_ARCH=S390
4448         PLATFORMID=linux_s390
4449         ;;
4450     s390x)
4451         CPUNAME=S390X
4452         RTL_ARCH=S390x
4453         PLATFORMID=linux_s390x
4454         ;;
4455     x86_64)
4456         CPUNAME=X86_64
4457         RTL_ARCH=X86_64
4458         PLATFORMID=linux_x86_64
4459         ;;
4460     *)
4461         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4462         ;;
4463     esac
4464     ;;
4466 linux-android*)
4467     COM=GCC
4468     USING_X11=
4469     OS=ANDROID
4470     RTL_OS=Android
4471     P_SEP=:
4473     case "$host_cpu" in
4475     arm|armel)
4476         CPUNAME=ARM
4477         RTL_ARCH=ARM_EABI
4478         PLATFORMID=android_arm_eabi
4479         ;;
4480     aarch64)
4481         CPUNAME=AARCH64
4482         RTL_ARCH=AARCH64
4483         PLATFORMID=android_aarch64
4484         ;;
4485     i*86)
4486         CPUNAME=INTEL
4487         RTL_ARCH=x86
4488         PLATFORMID=android_x86
4489         ;;
4490     x86_64)
4491         CPUNAME=X86_64
4492         RTL_ARCH=X86_64
4493         PLATFORMID=android_x86_64
4494         ;;
4495     *)
4496         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4497         ;;
4498     esac
4499     ;;
4501 *netbsd*)
4502     COM=GCC
4503     USING_X11=TRUE
4504     OS=NETBSD
4505     RTL_OS=NetBSD
4506     P_SEP=:
4508     case "$host_cpu" in
4509     i*86)
4510         CPUNAME=INTEL
4511         RTL_ARCH=x86
4512         PLATFORMID=netbsd_x86
4513         ;;
4514     powerpc)
4515         CPUNAME=POWERPC
4516         RTL_ARCH=PowerPC
4517         PLATFORMID=netbsd_powerpc
4518         ;;
4519     sparc)
4520         CPUNAME=SPARC
4521         RTL_ARCH=SPARC
4522         PLATFORMID=netbsd_sparc
4523         ;;
4524     x86_64)
4525         CPUNAME=X86_64
4526         RTL_ARCH=X86_64
4527         PLATFORMID=netbsd_x86_64
4528         ;;
4529     *)
4530         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4531         ;;
4532     esac
4533     ;;
4535 openbsd*)
4536     COM=GCC
4537     USING_X11=TRUE
4538     OS=OPENBSD
4539     RTL_OS=OpenBSD
4540     P_SEP=:
4542     case "$host_cpu" in
4543     i*86)
4544         CPUNAME=INTEL
4545         RTL_ARCH=x86
4546         PLATFORMID=openbsd_x86
4547         ;;
4548     x86_64)
4549         CPUNAME=X86_64
4550         RTL_ARCH=X86_64
4551         PLATFORMID=openbsd_x86_64
4552         ;;
4553     *)
4554         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4555         ;;
4556     esac
4557     SOLARINC="$SOLARINC -I/usr/local/include"
4558     ;;
4560 solaris*)
4561     COM=GCC
4562     USING_X11=TRUE
4563     OS=SOLARIS
4564     RTL_OS=Solaris
4565     P_SEP=:
4567     case "$host_cpu" in
4568     i*86)
4569         CPUNAME=INTEL
4570         RTL_ARCH=x86
4571         PLATFORMID=solaris_x86
4572         ;;
4573     sparc)
4574         CPUNAME=SPARC
4575         RTL_ARCH=SPARC
4576         PLATFORMID=solaris_sparc
4577         ;;
4578     sparc64)
4579         CPUNAME=SPARC64
4580         RTL_ARCH=SPARC64
4581         PLATFORMID=solaris_sparc64
4582         ;;
4583     *)
4584         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4585         ;;
4586     esac
4587     SOLARINC="$SOLARINC -I/usr/local/include"
4588     ;;
4591     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4592     ;;
4593 esac
4595 if test "$with_x" = "no"; then
4596     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4599 DISABLE_GUI=""
4600 if test "$enable_gui" = "no"; then
4601     if test "$USING_X11" != TRUE; then
4602         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4603     fi
4604     USING_X11=
4605     DISABLE_GUI=TRUE
4606     AC_DEFINE(HAVE_FEATURE_UI,0)
4607     test_cairo=yes
4609 AC_SUBST(DISABLE_GUI)
4611 WORKDIR="${BUILDDIR}/workdir"
4612 INSTDIR="${BUILDDIR}/instdir"
4613 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4614 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4615 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4616 AC_SUBST(COM)
4617 AC_SUBST(CPUNAME)
4618 AC_SUBST(RTL_OS)
4619 AC_SUBST(RTL_ARCH)
4620 AC_SUBST(EPM_FLAGS)
4621 AC_SUBST(USING_X11)
4622 AC_SUBST([INSTDIR])
4623 AC_SUBST([INSTROOT])
4624 AC_SUBST([INSTROOTBASE])
4625 AC_SUBST(OS)
4626 AC_SUBST(P_SEP)
4627 AC_SUBST(WORKDIR)
4628 AC_SUBST(PLATFORMID)
4629 AC_SUBST(WINDOWS_X64)
4630 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4632 dnl ===================================================================
4633 dnl Test which package format to use
4634 dnl ===================================================================
4635 AC_MSG_CHECKING([which package format to use])
4636 if test -n "$with_package_format" -a "$with_package_format" != no; then
4637     for i in $with_package_format; do
4638         case "$i" in
4639         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4640             ;;
4641         *)
4642             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4643 aix - AIX software distribution
4644 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4645 deb - Debian software distribution
4646 pkg - Solaris software distribution
4647 rpm - RedHat software distribution
4649 LibreOffice additionally supports:
4650 archive - .tar.gz or .zip
4651 dmg - macOS .dmg
4652 installed - installation tree
4653 msi - Windows .msi
4654         ])
4655             ;;
4656         esac
4657     done
4658     # fakeroot is needed to ensure correct file ownerships/permissions
4659     # inside deb packages and tar archives created on Linux and Solaris.
4660     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4661         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4662         if test "$FAKEROOT" = "no"; then
4663             AC_MSG_ERROR(
4664                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4665         fi
4666     fi
4667     PKGFORMAT="$with_package_format"
4668     AC_MSG_RESULT([$PKGFORMAT])
4669 else
4670     PKGFORMAT=
4671     AC_MSG_RESULT([none])
4673 AC_SUBST(PKGFORMAT)
4675 dnl ===================================================================
4676 dnl Set up a different compiler to produce tools to run on the build
4677 dnl machine when doing cross-compilation
4678 dnl ===================================================================
4680 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4681 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4682 if test "$cross_compiling" = "yes"; then
4683     AC_MSG_CHECKING([for BUILD platform configuration])
4684     echo
4685     rm -rf CONF-FOR-BUILD config_build.mk
4686     mkdir CONF-FOR-BUILD
4687     # Here must be listed all files needed when running the configure script. In particular, also
4688     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4689     # keep them in the same order as there.
4690     (cd $SRC_ROOT && tar cf - \
4691         config.guess \
4692         bin/get_config_variables \
4693         solenv/bin/getcompver.awk \
4694         solenv/inc/langlist.mk \
4695         download.lst \
4696         config_host.mk.in \
4697         config_host_lang.mk.in \
4698         Makefile.in \
4699         bin/bffvalidator.sh.in \
4700         bin/odfvalidator.sh.in \
4701         bin/officeotron.sh.in \
4702         instsetoo_native/util/openoffice.lst.in \
4703         config_host/*.in \
4704         sysui/desktop/macosx/Info.plist.in) \
4705     | (cd CONF-FOR-BUILD && tar xf -)
4706     cp configure CONF-FOR-BUILD
4707     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4708     (
4709     unset COM USING_X11 OS CPUNAME
4710     unset CC CXX SYSBASE CFLAGS
4711     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4712     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4713     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4714     if test -n "$CC_FOR_BUILD"; then
4715         export CC="$CC_FOR_BUILD"
4716         CC_BASE=`first_arg_basename "$CC"`
4717     fi
4718     if test -n "$CXX_FOR_BUILD"; then
4719         export CXX="$CXX_FOR_BUILD"
4720         CXX_BASE=`first_arg_basename "$CXX"`
4721     fi
4722     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4723     cd CONF-FOR-BUILD
4724     sub_conf_opts=""
4725     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4726     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4727     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4728     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4729     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4730     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4731     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4732     # Don't bother having configure look for stuff not needed for the build platform anyway
4733     ./configure \
4734         --disable-cups \
4735         --disable-gstreamer-1-0 \
4736         --disable-gtk3 \
4737         --disable-pdfimport \
4738         --disable-postgresql-sdbc \
4739         --with-parallelism="$with_parallelism" \
4740         --without-doxygen \
4741         --without-java \
4742         $sub_conf_opts \
4743         --srcdir=$srcdir \
4744         2>&1 | sed -e 's/^/    /'
4745     test -f ./config_host.mk 2>/dev/null || exit
4746     cp config_host.mk ../config_build.mk
4747     cp config_host_lang.mk ../config_build_lang.mk
4748     mv config.log ../config.Build.log
4749     mkdir -p ../config_build
4750     mv config_host/*.h ../config_build
4751     . ./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
4753     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
4754         VV='$'$V
4755         VV=`eval "echo $VV"`
4756         if test -n "$VV"; then
4757             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4758             echo "$line" >>build-config
4759         fi
4760     done
4762     for V in INSTDIR INSTROOT WORKDIR; do
4763         VV='$'$V
4764         VV=`eval "echo $VV"`
4765         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4766         if test -n "$VV"; then
4767             line="${V}_FOR_BUILD='$VV'"
4768             echo "$line" >>build-config
4769         fi
4770     done
4772     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4773     echo "$line" >>build-config
4775     )
4776     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4777     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])
4778     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4779              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4781     eval `cat CONF-FOR-BUILD/build-config`
4783     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4785     rm -rf CONF-FOR-BUILD
4786 else
4787     OS_FOR_BUILD="$OS"
4788     CC_FOR_BUILD="$CC"
4789     CXX_FOR_BUILD="$CXX"
4790     INSTDIR_FOR_BUILD="$INSTDIR"
4791     INSTROOT_FOR_BUILD="$INSTROOT"
4792     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4793     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4794     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4795     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4796     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4797     WORKDIR_FOR_BUILD="$WORKDIR"
4799 AC_SUBST(OS_FOR_BUILD)
4800 AC_SUBST(INSTDIR_FOR_BUILD)
4801 AC_SUBST(INSTROOT_FOR_BUILD)
4802 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4803 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4804 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4805 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4806 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4807 AC_SUBST(WORKDIR_FOR_BUILD)
4809 dnl ===================================================================
4810 dnl Check for syslog header
4811 dnl ===================================================================
4812 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4814 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4815 dnl ===================================================================
4816 AC_MSG_CHECKING([whether to turn warnings to errors])
4817 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4818     ENABLE_WERROR="TRUE"
4819     AC_MSG_RESULT([yes])
4820 else
4821     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4822         ENABLE_WERROR="TRUE"
4823         AC_MSG_RESULT([yes])
4824     else
4825         AC_MSG_RESULT([no])
4826     fi
4828 AC_SUBST(ENABLE_WERROR)
4830 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4831 dnl ===================================================================
4832 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4833 if test -z "$enable_assert_always_abort"; then
4834    if test "$ENABLE_DEBUG" = TRUE; then
4835        enable_assert_always_abort=yes
4836    else
4837        enable_assert_always_abort=no
4838    fi
4840 if test "$enable_assert_always_abort" = "yes"; then
4841     ASSERT_ALWAYS_ABORT="TRUE"
4842     AC_MSG_RESULT([yes])
4843 else
4844     ASSERT_ALWAYS_ABORT="FALSE"
4845     AC_MSG_RESULT([no])
4847 AC_SUBST(ASSERT_ALWAYS_ABORT)
4849 # Determine whether to use ooenv for the instdir installation
4850 # ===================================================================
4851 if test $_os != "WINNT" -a $_os != "Darwin"; then
4852     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4853     if test "$enable_ooenv" = "no"; then
4854         AC_MSG_RESULT([no])
4855     else
4856         ENABLE_OOENV="TRUE"
4857         AC_MSG_RESULT([yes])
4858     fi
4860 AC_SUBST(ENABLE_OOENV)
4862 if test "$USING_X11" != TRUE; then
4863     # be sure to do not mess with unneeded stuff
4864     test_randr=no
4865     test_xrender=no
4866     test_cups=no
4867     test_dbus=no
4868     build_gstreamer_1_0=no
4869     test_kf5=no
4870     test_qt5=no
4871     test_gtk3_kde5=no
4872     enable_cairo_canvas=no
4875 if test "$OS" = "HAIKU"; then
4876     enable_cairo_canvas=yes
4877     test_kf5=yes
4880 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4881     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!])
4882     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!"
4883     enable_kf5=yes
4886 if test "$test_kf5" = "yes"; then
4887     test_qt5=yes
4890 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4891     if test "$enable_qt5" = "no"; then
4892         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4893     else
4894         enable_qt5=yes
4895     fi
4898 dnl ===================================================================
4899 dnl check for cups support
4900 dnl ===================================================================
4901 ENABLE_CUPS=""
4903 if test "$enable_cups" = "no"; then
4904     test_cups=no
4907 AC_MSG_CHECKING([whether to enable CUPS support])
4908 if test "$test_cups" = "yes"; then
4909     ENABLE_CUPS="TRUE"
4910     AC_MSG_RESULT([yes])
4912     AC_MSG_CHECKING([whether cups support is present])
4913     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4914     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4915     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4916         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4917     fi
4919 else
4920     AC_MSG_RESULT([no])
4923 AC_SUBST(ENABLE_CUPS)
4925 # fontconfig checks
4926 if test "$test_fontconfig" = "yes"; then
4927     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4928     SYSTEM_FONTCONFIG=TRUE
4929     FilterLibs "${FONTCONFIG_LIBS}"
4930     FONTCONFIG_LIBS="${filteredlibs}"
4932 AC_SUBST(FONTCONFIG_CFLAGS)
4933 AC_SUBST(FONTCONFIG_LIBS)
4934 AC_SUBST([SYSTEM_FONTCONFIG])
4936 dnl whether to find & fetch external tarballs?
4937 dnl ===================================================================
4938 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4939    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4940        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4941    else
4942        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4943    fi
4945 if test -z "$TARFILE_LOCATION"; then
4946     if test -d "$SRC_ROOT/src" ; then
4947         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4948         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4949     fi
4950     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4951 else
4952     AbsolutePath "$TARFILE_LOCATION"
4953     PathFormat "${absolute_path}"
4954     TARFILE_LOCATION="${formatted_path}"
4956 AC_SUBST(TARFILE_LOCATION)
4958 AC_MSG_CHECKING([whether we want to fetch tarballs])
4959 if test "$enable_fetch_external" != "no"; then
4960     if test "$with_all_tarballs" = "yes"; then
4961         AC_MSG_RESULT([yes, all of them])
4962         DO_FETCH_TARBALLS="ALL"
4963     else
4964         AC_MSG_RESULT([yes, if we use them])
4965         DO_FETCH_TARBALLS="TRUE"
4966     fi
4967 else
4968     AC_MSG_RESULT([no])
4969     DO_FETCH_TARBALLS=
4971 AC_SUBST(DO_FETCH_TARBALLS)
4973 AC_MSG_CHECKING([whether to build help])
4974 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4975     BUILD_TYPE="$BUILD_TYPE HELP"
4976     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4977     case "$with_help" in
4978     "html")
4979         ENABLE_HTMLHELP=TRUE
4980         SCPDEFS="$SCPDEFS -DWITH_HELP"
4981         AC_MSG_RESULT([HTML])
4982         ;;
4983     "online")
4984         ENABLE_HTMLHELP=TRUE
4985         HELP_ONLINE=TRUE
4986         AC_MSG_RESULT([HTML])
4987         ;;
4988     yes)
4989         SCPDEFS="$SCPDEFS -DWITH_HELP"
4990         AC_MSG_RESULT([yes])
4991         ;;
4992     *)
4993         AC_MSG_ERROR([Unknown --with-help=$with_help])
4994         ;;
4995     esac
4996 else
4997     AC_MSG_RESULT([no])
4999 AC_SUBST([ENABLE_HTMLHELP])
5000 AC_SUBST([HELP_ONLINE])
5002 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5003 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5004     BUILD_TYPE="$BUILD_TYPE HELP"
5005     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5006     case "$with_omindex" in
5007     "server")
5008         ENABLE_HTMLHELP=TRUE
5009         HELP_ONLINE=TRUE
5010         HELP_OMINDEX_PAGE=TRUE
5011         AC_MSG_RESULT([SERVER])
5012         ;;
5013     "noxap")
5014         ENABLE_HTMLHELP=TRUE
5015         HELP_ONLINE=TRUE
5016         HELP_OMINDEX_PAGE=FALSE
5017         AC_MSG_RESULT([NOXAP])
5018         ;;
5019     *)
5020         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5021         ;;
5022     esac
5023 else
5024     HELP_OMINDEX_PAGE=FALSE
5025     AC_MSG_RESULT([no])
5027 AC_SUBST([ENABLE_HTMLHELP])
5028 AC_SUBST([HELP_OMINDEX_PAGE])
5029 AC_SUBST([HELP_ONLINE])
5032 dnl Test whether to include MySpell dictionaries
5033 dnl ===================================================================
5034 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5035 if test "$with_myspell_dicts" = "yes"; then
5036     AC_MSG_RESULT([yes])
5037     WITH_MYSPELL_DICTS=TRUE
5038     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5039     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5040 else
5041     AC_MSG_RESULT([no])
5042     WITH_MYSPELL_DICTS=
5044 AC_SUBST(WITH_MYSPELL_DICTS)
5046 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5047 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5048     if test "$with_system_dicts" = yes; then
5049         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5050     fi
5051     with_system_dicts=no
5054 AC_MSG_CHECKING([whether to use dicts from external paths])
5055 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5056     AC_MSG_RESULT([yes])
5057     SYSTEM_DICTS=TRUE
5058     AC_MSG_CHECKING([for spelling dictionary directory])
5059     if test -n "$with_external_dict_dir"; then
5060         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5061     else
5062         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5063         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5064             DICT_SYSTEM_DIR=file:///usr/share/myspell
5065         fi
5066     fi
5067     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5068     AC_MSG_CHECKING([for hyphenation patterns directory])
5069     if test -n "$with_external_hyph_dir"; then
5070         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5071     else
5072         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5073     fi
5074     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5075     AC_MSG_CHECKING([for thesaurus directory])
5076     if test -n "$with_external_thes_dir"; then
5077         THES_SYSTEM_DIR=file://$with_external_thes_dir
5078     else
5079         THES_SYSTEM_DIR=file:///usr/share/mythes
5080     fi
5081     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5082 else
5083     AC_MSG_RESULT([no])
5084     SYSTEM_DICTS=
5086 AC_SUBST(SYSTEM_DICTS)
5087 AC_SUBST(DICT_SYSTEM_DIR)
5088 AC_SUBST(HYPH_SYSTEM_DIR)
5089 AC_SUBST(THES_SYSTEM_DIR)
5091 dnl ===================================================================
5092 dnl Precompiled headers.
5093 ENABLE_PCH=""
5094 AC_MSG_CHECKING([whether to enable pch feature])
5095 if test -z "$enable_pch"; then
5096     if test "$_os" = "WINNT"; then
5097         # Enabled by default on Windows.
5098         enable_pch=yes
5099     else
5100         enable_pch=no
5101     fi
5103 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5104     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5106 if test "$enable_pch" = "system"; then
5107     ENABLE_PCH="1"
5108     AC_MSG_RESULT([yes (system headers)])
5109 elif test "$enable_pch" = "base"; then
5110     ENABLE_PCH="2"
5111     AC_MSG_RESULT([yes (system and base headers)])
5112 elif test "$enable_pch" = "normal"; then
5113     ENABLE_PCH="3"
5114     AC_MSG_RESULT([yes (normal)])
5115 elif test "$enable_pch" = "full"; then
5116     ENABLE_PCH="4"
5117     AC_MSG_RESULT([yes (full)])
5118 elif test "$enable_pch" = "yes"; then
5119     # Pick a suitable default.
5120     if test "$GCC" = "yes"; then
5121         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5122         # while making the PCHs larger and rebuilds more likely.
5123         ENABLE_PCH="2"
5124         AC_MSG_RESULT([yes (system and base headers)])
5125     else
5126         # With MSVC the highest level makes a significant difference,
5127         # and it was the default when there used to be no PCH levels.
5128         ENABLE_PCH="4"
5129         AC_MSG_RESULT([yes (full)])
5130     fi
5131 elif test "$enable_pch" = "no"; then
5132     AC_MSG_RESULT([no])
5133 else
5134     AC_MSG_ERROR([Unknown value for --enable-pch])
5136 AC_SUBST(ENABLE_PCH)
5137 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5138 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5139     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5140     if test "$CCACHE_BIN" != "not found"; then
5141         AC_MSG_CHECKING([ccache version])
5142         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5143         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5144         AC_MSG_RESULT([$CCACHE_VERSION])
5145         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5146         if test "$CCACHE_NUMVER" -gt "030701"; then
5147             AC_MSG_RESULT([yes])
5148         else
5149             AC_MSG_RESULT([no (not newer than 3.7.1)])
5150             CCACHE_DEPEND_MODE=
5151         fi
5152     fi
5155 TAB=`printf '\t'`
5157 AC_MSG_CHECKING([the GNU Make version])
5158 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5159 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5160 if test "$_make_longver" -ge "038200"; then
5161     AC_MSG_RESULT([$GNUMAKE $_make_version])
5163 elif test "$_make_longver" -ge "038100"; then
5164     if test "$build_os" = "cygwin"; then
5165         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5166     fi
5167     AC_MSG_RESULT([$GNUMAKE $_make_version])
5169     dnl ===================================================================
5170     dnl Search all the common names for sha1sum
5171     dnl ===================================================================
5172     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5173     if test -z "$SHA1SUM"; then
5174         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5175     elif test "$SHA1SUM" = "openssl"; then
5176         SHA1SUM="openssl sha1"
5177     fi
5178     AC_MSG_CHECKING([for GNU Make bug 20033])
5179     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5180     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5181 A := \$(wildcard *.a)
5183 .PHONY: all
5184 all: \$(A:.a=.b)
5185 <TAB>@echo survived bug20033.
5187 .PHONY: setup
5188 setup:
5189 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5191 define d1
5192 @echo lala \$(1)
5193 @sleep 1
5194 endef
5196 define d2
5197 @echo tyty \$(1)
5198 @sleep 1
5199 endef
5201 %.b : %.a
5202 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5203 <TAB>\$(call d1,\$(CHECKSUM)),\
5204 <TAB>\$(call d2,\$(CHECKSUM)))
5206     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5207         no_parallelism_make="YES"
5208         AC_MSG_RESULT([yes, disable parallelism])
5209     else
5210         AC_MSG_RESULT([no, keep parallelism enabled])
5211     fi
5212     rm -rf $TESTGMAKEBUG20033
5213 else
5214     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5217 # find if gnumake support file function
5218 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5219 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5220 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5221     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5223 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5224 \$(file >test.txt,Success )
5226 .PHONY: all
5227 all:
5228 <TAB>@cat test.txt
5231 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5232 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5233     HAVE_GNUMAKE_FILE_FUNC=TRUE
5234     AC_MSG_RESULT([yes])
5235 else
5236     AC_MSG_RESULT([no])
5238 rm -rf $TESTGMAKEFILEFUNC
5239 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5240 AC_SUBST(GNUMAKE_WIN_NATIVE)
5242 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5243 STALE_MAKE=
5244 if test "$_make_ver_check" = ""; then
5245    STALE_MAKE=TRUE
5248 HAVE_LD_HASH_STYLE=FALSE
5249 WITH_LINKER_HASH_STYLE=
5250 AC_MSG_CHECKING([for --hash-style gcc linker support])
5251 if test "$GCC" = "yes"; then
5252     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5253         hash_styles="gnu sysv"
5254     elif test "$with_linker_hash_style" = "no"; then
5255         hash_styles=
5256     else
5257         hash_styles="$with_linker_hash_style"
5258     fi
5260     for hash_style in $hash_styles; do
5261         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5262         hash_style_ldflags_save=$LDFLAGS
5263         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5265         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5266             [
5267 #include <stdio.h>
5268             ],[
5269 printf ("");
5270             ])],
5271             [
5272                   HAVE_LD_HASH_STYLE=TRUE
5273                   WITH_LINKER_HASH_STYLE=$hash_style
5274             ],
5275             [HAVE_LD_HASH_STYLE=FALSE],
5276             [HAVE_LD_HASH_STYLE=FALSE])
5277         LDFLAGS=$hash_style_ldflags_save
5278     done
5280     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5281         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5282     else
5283         AC_MSG_RESULT( no )
5284     fi
5285     LDFLAGS=$hash_style_ldflags_save
5286 else
5287     AC_MSG_RESULT( no )
5289 AC_SUBST(HAVE_LD_HASH_STYLE)
5290 AC_SUBST(WITH_LINKER_HASH_STYLE)
5292 dnl ===================================================================
5293 dnl Check whether there's a Perl version available.
5294 dnl ===================================================================
5295 if test -z "$with_perl_home"; then
5296     AC_PATH_PROG(PERL, perl)
5297 else
5298     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5299     _perl_path="$with_perl_home/bin/perl"
5300     if test -x "$_perl_path"; then
5301         PERL=$_perl_path
5302     else
5303         AC_MSG_ERROR([$_perl_path not found])
5304     fi
5307 dnl ===================================================================
5308 dnl Testing for Perl version 5 or greater.
5309 dnl $] is the Perl version variable, it is returned as an integer
5310 dnl ===================================================================
5311 if test "$PERL"; then
5312     AC_MSG_CHECKING([the Perl version])
5313     ${PERL} -e "exit($]);"
5314     _perl_version=$?
5315     if test "$_perl_version" -lt 5; then
5316         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5317     fi
5318     AC_MSG_RESULT([Perl $_perl_version])
5319 else
5320     AC_MSG_ERROR([Perl not found, install Perl 5])
5323 dnl ===================================================================
5324 dnl Testing for required Perl modules
5325 dnl ===================================================================
5327 AC_MSG_CHECKING([for required Perl modules])
5328 perl_use_string="use Cwd ; use Digest::MD5"
5329 if test "$_os" = "WINNT"; then
5330     if test -n "$PKGFORMAT"; then
5331         for i in $PKGFORMAT; do
5332             case "$i" in
5333             msi)
5334                 # for getting fonts versions to use in MSI
5335                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5336                 ;;
5337             esac
5338         done
5339     fi
5341 if test "$with_system_hsqldb" = "yes"; then
5342     perl_use_string="$perl_use_string ; use Archive::Zip"
5344 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5345     AC_MSG_RESULT([all modules found])
5346 else
5347     AC_MSG_RESULT([failed to find some modules])
5348     # Find out which modules are missing.
5349     for i in $perl_use_string; do
5350         if test "$i" != "use" -a "$i" != ";"; then
5351             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5352                 missing_perl_modules="$missing_perl_modules $i"
5353             fi
5354         fi
5355     done
5356     AC_MSG_ERROR([
5357     The missing Perl modules are: $missing_perl_modules
5358     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5361 dnl ===================================================================
5362 dnl Check for pkg-config
5363 dnl ===================================================================
5364 if test "$_os" != "WINNT"; then
5365     PKG_PROG_PKG_CONFIG
5368 if test "$_os" != "WINNT"; then
5370     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5371     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5372     # explicitly. Or put /path/to/compiler in PATH yourself.
5374     # Use wrappers for LTO
5375     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5376         AC_CHECK_TOOL(AR,gcc-ar)
5377         AC_CHECK_TOOL(NM,gcc-nm)
5378         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5379     else
5380         AC_CHECK_TOOL(AR,ar)
5381         AC_CHECK_TOOL(NM,nm)
5382         AC_CHECK_TOOL(RANLIB,ranlib)
5383     fi
5384     AC_CHECK_TOOL(OBJDUMP,objdump)
5385     AC_CHECK_TOOL(READELF,readelf)
5386     AC_CHECK_TOOL(STRIP,strip)
5387     if test "$_os" = "WINNT"; then
5388         AC_CHECK_TOOL(DLLTOOL,dlltool)
5389         AC_CHECK_TOOL(WINDRES,windres)
5390     fi
5392 AC_SUBST(AR)
5393 AC_SUBST(DLLTOOL)
5394 AC_SUBST(NM)
5395 AC_SUBST(OBJDUMP)
5396 AC_SUBST(PKG_CONFIG)
5397 AC_SUBST(RANLIB)
5398 AC_SUBST(READELF)
5399 AC_SUBST(STRIP)
5400 AC_SUBST(WINDRES)
5402 dnl ===================================================================
5403 dnl pkg-config checks on macOS
5404 dnl ===================================================================
5406 if test $_os = Darwin; then
5407     AC_MSG_CHECKING([for bogus pkg-config])
5408     if test -n "$PKG_CONFIG"; then
5409         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5410             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5411         else
5412             if test "$enable_bogus_pkg_config" = "yes"; then
5413                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5414             else
5415                 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.])
5416             fi
5417         fi
5418     else
5419         AC_MSG_RESULT([no, good])
5420     fi
5423 find_csc()
5425     # Return value: $csctest
5427     unset csctest
5429     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5430     if test -n "$regvalue"; then
5431         csctest=$regvalue
5432         return
5433     fi
5436 find_al()
5438     # Return value: $altest
5440     unset altest
5442     # We need this check to detect 4.6.1 or above.
5443     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5444         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5445         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5446             altest=$regvalue
5447             return
5448         fi
5449     done
5451     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5452         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5453         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5454             altest=$regvalue
5455             return
5456         fi
5457     done
5462 find_dotnetsdk46()
5464     unset frametest
5466     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5467         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5468         if test -n "$regvalue"; then
5469             frametest=$regvalue
5470             return
5471         fi
5472     done
5475 find_winsdk_version()
5477     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5478     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5480     unset winsdktest winsdkbinsubdir winsdklibsubdir
5482     case "$1" in
5483     8.0|8.0A)
5484         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5485         if test -n "$regvalue"; then
5486             winsdktest=$regvalue
5487             winsdklibsubdir=win8
5488             return
5489         fi
5490         ;;
5491     8.1|8.1A)
5492         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5493         if test -n "$regvalue"; then
5494             winsdktest=$regvalue
5495             winsdklibsubdir=winv6.3
5496             return
5497         fi
5498         ;;
5499     10.0)
5500         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5501         if test -n "$regvalue"; then
5502             winsdktest=$regvalue
5503             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5504             if test -n "$regvalue"; then
5505                 winsdkbinsubdir="$regvalue".0
5506                 winsdklibsubdir=$winsdkbinsubdir
5507                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5508                 # test exist the SDK path
5509                 if test -d "$tmppath"; then
5510                    # when path is convertible to a short path then path is okay
5511                    cygpath -d "$tmppath" >/dev/null 2>&1
5512                    if test $? -ne 0; then
5513                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5514                    fi
5515                 else
5516                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5517                 fi
5518             fi
5519             return
5520         fi
5521         ;;
5522     esac
5525 find_winsdk()
5527     # Return value: From find_winsdk_version
5529     unset winsdktest
5531     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5532         find_winsdk_version $ver
5533         if test -n "$winsdktest"; then
5534             return
5535         fi
5536     done
5539 find_msms()
5541     AC_MSG_CHECKING([for MSVC merge modules directory])
5542     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5543     case "$VCVER" in
5544         150|160)
5545         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5546         ;;
5547     esac
5548     for f in $my_msm_files; do
5549         echo "$as_me:$LINENO: searching for $f" >&5
5550     done
5552     msmdir=
5553     for ver in 14.0 15.0; do
5554         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5555         if test -n "$regvalue"; then
5556             for f in ${my_msm_files}; do
5557                 if test -e "$regvalue/${f}"; then
5558                     msmdir=$regvalue
5559                     break
5560                 fi
5561             done
5562         fi
5563     done
5564     dnl Is the following fallback really necessary, or was it added in response
5565     dnl to never having started Visual Studio on a given machine, so the
5566     dnl registry keys checked above had presumably not yet been created?
5567     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5568     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5569     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5570     dnl expanding to "C:\Program Files\Common Files"), which would need
5571     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5572     dnl obtain its value from cygwin:
5573     if test -z "$msmdir"; then
5574         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5575         for f in ${my_msm_files}; do
5576             if test -e "$my_msm_dir/${f}"; then
5577                 msmdir=$my_msm_dir
5578             fi
5579         done
5580     fi
5582     dnl Starting from MSVC 15.0, merge modules are located in different directory
5583     case "$VCVER" in
5584     150|160)
5585         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5586             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5587             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5588             for f in ${my_msm_files}; do
5589                 if test -e "$my_msm_dir/${f}"; then
5590                     msmdir=$my_msm_dir
5591                     break
5592                 fi
5593             done
5594         done
5595         ;;
5596     esac
5598     if test -n "$msmdir"; then
5599         msmdir=`cygpath -m "$msmdir"`
5600         AC_MSG_RESULT([$msmdir])
5601     else
5602         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5603             AC_MSG_FAILURE([not found])
5604         else
5605             AC_MSG_WARN([not found (check config.log)])
5606             add_warning "MSM none of ${my_msm_files} found"
5607         fi
5608     fi
5611 find_msvc_x64_dlls()
5613     AC_MSG_CHECKING([for MSVC x64 DLL path])
5614     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5615     case "$VCVER" in
5616     150|160)
5617         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5618             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5619             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5620                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5621                 break
5622             fi
5623             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5624             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5625                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5626                 break
5627             fi
5628             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5629             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5630                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5631                 break
5632             fi
5633         done
5634         ;;
5635     esac
5636     AC_MSG_RESULT([$msvcdllpath])
5637     AC_MSG_CHECKING([for MSVC x64 DLLs])
5638     msvcdlls="msvcp140.dll vcruntime140.dll"
5639     for dll in $msvcdlls; do
5640         if ! test -f "$msvcdllpath/$dll"; then
5641             AC_MSG_FAILURE([missing $dll])
5642         fi
5643     done
5644     AC_MSG_RESULT([found all ($msvcdlls)])
5647 dnl =========================================
5648 dnl Check for the Windows  SDK.
5649 dnl =========================================
5650 if test "$_os" = "WINNT"; then
5651     AC_MSG_CHECKING([for Windows SDK])
5652     if test "$build_os" = "cygwin"; then
5653         find_winsdk
5654         WINDOWS_SDK_HOME=$winsdktest
5656         # normalize if found
5657         if test -n "$WINDOWS_SDK_HOME"; then
5658             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5659             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5660         fi
5662         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5663     fi
5665     if test -n "$WINDOWS_SDK_HOME"; then
5666         # Remove a possible trailing backslash
5667         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5669         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5670              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5671              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5672             have_windows_sdk_headers=yes
5673         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5674              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5675              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5676             have_windows_sdk_headers=yes
5677         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5678              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5679              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5680             have_windows_sdk_headers=yes
5681         else
5682             have_windows_sdk_headers=no
5683         fi
5685         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5686             have_windows_sdk_libs=yes
5687         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5688             have_windows_sdk_libs=yes
5689         else
5690             have_windows_sdk_libs=no
5691         fi
5693         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5694             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5695 the  Windows SDK are installed.])
5696         fi
5697     fi
5699     if test -z "$WINDOWS_SDK_HOME"; then
5700         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5701     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5702         WINDOWS_SDK_VERSION=80
5703         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5704     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5705         WINDOWS_SDK_VERSION=81
5706         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5707     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5708         WINDOWS_SDK_VERSION=10
5709         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5710     else
5711         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5712     fi
5713     PathFormat "$WINDOWS_SDK_HOME"
5714     WINDOWS_SDK_HOME="$formatted_path"
5715     if test "$build_os" = "cygwin"; then
5716         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5717         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5718             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5719         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5720             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5721         fi
5722     fi
5724     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5725     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5726     dnl but not in v8.0), so allow this to be overridden with a
5727     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5728     dnl and configuration error if no WiLangId.vbs is found would arguably be
5729     dnl better, but I do not know under which conditions exactly it is needed by
5730     dnl msiglobal.pm:
5731     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5732         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5733         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5734             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5735         fi
5736         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5737             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5738         fi
5739         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5740             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5741         fi
5742     fi
5743     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5744         if test -n "$with_package_format" -a "$with_package_format" != no; then
5745             for i in "$with_package_format"; do
5746                 if test "$i" = "msi"; then
5747                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5748                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5749                     fi
5750                 fi
5751             done
5752         fi
5753     fi
5755 AC_SUBST(WINDOWS_SDK_HOME)
5756 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5757 AC_SUBST(WINDOWS_SDK_VERSION)
5758 AC_SUBST(WINDOWS_SDK_WILANGID)
5760 if test "$build_os" = "cygwin"; then
5761     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5762     dnl dir, it also determines that dir's path w/o an arch segment if any,
5763     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5764     AC_MSG_CHECKING([for midl.exe])
5766     find_winsdk
5767     if test -n "$winsdkbinsubdir" \
5768         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5769     then
5770         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5771         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5772     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5773         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5774         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5775     elif test -f "$winsdktest/Bin/midl.exe"; then
5776         MIDL_PATH=$winsdktest/Bin
5777         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5778     fi
5779     if test ! -f "$MIDL_PATH/midl.exe"; then
5780         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5781     else
5782         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5783     fi
5785     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5786     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5788     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5789          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5790          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5791          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5792     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5793          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5794          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5795          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5796     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5797          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5798          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5799          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5800     else
5801         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5802     fi
5804     dnl Check csc.exe
5805     AC_MSG_CHECKING([for csc.exe])
5806     find_csc
5807     if test -f "$csctest/csc.exe"; then
5808         CSC_PATH="$csctest"
5809     fi
5810     if test ! -f "$CSC_PATH/csc.exe"; then
5811         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5812     else
5813         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5814     fi
5816     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5818     dnl Check al.exe
5819     AC_MSG_CHECKING([for al.exe])
5820     find_winsdk
5821     if test -n "$winsdkbinsubdir" \
5822         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5823     then
5824         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5825     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5826         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5827     elif test -f "$winsdktest/Bin/al.exe"; then
5828         AL_PATH="$winsdktest/Bin"
5829     fi
5831     if test -z "$AL_PATH"; then
5832         find_al
5833         if test -f "$altest/bin/al.exe"; then
5834             AL_PATH="$altest/bin"
5835         elif test -f "$altest/al.exe"; then
5836             AL_PATH="$altest"
5837         fi
5838     fi
5839     if test ! -f "$AL_PATH/al.exe"; then
5840         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5841     else
5842         AC_MSG_RESULT([$AL_PATH/al.exe])
5843     fi
5845     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5847     dnl Check mscoree.lib / .NET Framework dir
5848     AC_MSG_CHECKING(.NET Framework)
5849     find_dotnetsdk46
5850     PathFormat "$frametest"
5851     frametest="$formatted_path"
5852     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5853         DOTNET_FRAMEWORK_HOME="$frametest"
5854     else
5855         find_winsdk
5856         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5857             DOTNET_FRAMEWORK_HOME="$winsdktest"
5858         fi
5859     fi
5860     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
5861         AC_MSG_ERROR([mscoree.lib not found])
5862     fi
5863     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5865     PathFormat "$MIDL_PATH"
5866     MIDL_PATH="$formatted_path"
5868     PathFormat "$AL_PATH"
5869     AL_PATH="$formatted_path"
5871     PathFormat "$DOTNET_FRAMEWORK_HOME"
5872     DOTNET_FRAMEWORK_HOME="$formatted_path"
5874     PathFormat "$CSC_PATH"
5875     CSC_PATH="$formatted_path"
5878 dnl ===================================================================
5879 dnl Check if stdc headers are available excluding MSVC.
5880 dnl ===================================================================
5881 if test "$_os" != "WINNT"; then
5882     AC_HEADER_STDC
5885 dnl ===================================================================
5886 dnl Testing for C++ compiler and version...
5887 dnl ===================================================================
5889 if test "$_os" != "WINNT"; then
5890     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5891     save_CXXFLAGS=$CXXFLAGS
5892     AC_PROG_CXX
5893     CXXFLAGS=$save_CXXFLAGS
5894     if test -z "$CXX_BASE"; then
5895         CXX_BASE=`first_arg_basename "$CXX"`
5896     fi
5899 dnl check for GNU C++ compiler version
5900 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5901     AC_MSG_CHECKING([the GNU C++ compiler version])
5903     _gpp_version=`$CXX -dumpversion`
5904     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5906     if test "$_gpp_majmin" -lt "700"; then
5907         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5908     else
5909         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5910     fi
5912     dnl see https://code.google.com/p/android/issues/detail?id=41770
5913         glibcxx_threads=no
5914         AC_LANG_PUSH([C++])
5915         AC_REQUIRE_CPP
5916         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5917         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5918             #include <bits/c++config.h>]],[[
5919             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5920             && !defined(_GLIBCXX__PTHREADS) \
5921             && !defined(_GLIBCXX_HAS_GTHREADS)
5922             choke me
5923             #endif
5924         ]])],[AC_MSG_RESULT([yes])
5925         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5926         AC_LANG_POP([C++])
5927         if test $glibcxx_threads = yes; then
5928             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5929         fi
5931 AC_SUBST(BOOST_CXXFLAGS)
5934 # prefx CXX with ccache if needed
5936 if test "$CCACHE" != ""; then
5937     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5938     AC_LANG_PUSH([C++])
5939     save_CXXFLAGS=$CXXFLAGS
5940     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5941     dnl an empty program will do, we're checking the compiler flags
5942     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5943                       [use_ccache=yes], [use_ccache=no])
5944     if test $use_ccache = yes; then
5945         AC_MSG_RESULT([yes])
5946     else
5947         CXX="$CCACHE $CXX"
5948         CXX_BASE="ccache $CXX_BASE"
5949         AC_MSG_RESULT([no])
5950     fi
5951     CXXFLAGS=$save_CXXFLAGS
5952     AC_LANG_POP([C++])
5955 dnl ===================================================================
5956 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5957 dnl ===================================================================
5959 if test "$_os" != "WINNT"; then
5960     AC_PROG_CXXCPP
5962     dnl Check whether there's a C pre-processor.
5963     AC_PROG_CPP
5967 dnl ===================================================================
5968 dnl Find integral type sizes and alignments
5969 dnl ===================================================================
5971 if test "$_os" != "WINNT"; then
5973 if test "$_os" = "iOS"; then
5974     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5975     ac_cv_sizeof_long=8
5976     ac_cv_sizeof_short=2
5977     ac_cv_sizeof_int=4
5978     ac_cv_sizeof_long_long=8
5979     ac_cv_sizeof_double=8
5980     ac_cv_sizeof_voidp=8
5981 else
5982     AC_CHECK_SIZEOF(long)
5983     AC_CHECK_SIZEOF(short)
5984     AC_CHECK_SIZEOF(int)
5985     AC_CHECK_SIZEOF(long long)
5986     AC_CHECK_SIZEOF(double)
5987     AC_CHECK_SIZEOF(void*)
5990     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5991     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5992     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5993     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5994     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5996     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5997     m4_pattern_allow([AC_CHECK_ALIGNOF])
5998     m4_ifdef([AC_CHECK_ALIGNOF],
5999         [
6000             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6001             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6002             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6003             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6004         ],
6005         [
6006             case "$_os-$host_cpu" in
6007             Linux-i686)
6008                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6009                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6010                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6011                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6012                 ;;
6013             Linux-x86_64)
6014                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6015                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6016                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6017                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6018                 ;;
6019             *)
6020                 if test -z "$ac_cv_alignof_short" -o \
6021                         -z "$ac_cv_alignof_int" -o \
6022                         -z "$ac_cv_alignof_long" -o \
6023                         -z "$ac_cv_alignof_double"; then
6024                    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.])
6025                 fi
6026                 ;;
6027             esac
6028         ])
6030     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6031     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6032     if test $ac_cv_sizeof_long -eq 8; then
6033         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6034     elif test $ac_cv_sizeof_double -eq 8; then
6035         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6036     else
6037         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6038     fi
6040     dnl Check for large file support
6041     AC_SYS_LARGEFILE
6042     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6043         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6044     fi
6045     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6046         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6047     fi
6048 else
6049     # Hardcode for MSVC
6050     SAL_TYPES_SIZEOFSHORT=2
6051     SAL_TYPES_SIZEOFINT=4
6052     SAL_TYPES_SIZEOFLONG=4
6053     SAL_TYPES_SIZEOFLONGLONG=8
6054     if test "$BITNESS_OVERRIDE" = ""; then
6055         SAL_TYPES_SIZEOFPOINTER=4
6056     else
6057         SAL_TYPES_SIZEOFPOINTER=8
6058     fi
6059     SAL_TYPES_ALIGNMENT2=2
6060     SAL_TYPES_ALIGNMENT4=4
6061     SAL_TYPES_ALIGNMENT8=8
6062     LFS_CFLAGS=''
6064 AC_SUBST(LFS_CFLAGS)
6066 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6067 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6068 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6069 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6070 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6071 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6072 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6073 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6075 dnl ===================================================================
6076 dnl Check whether to enable runtime optimizations
6077 dnl ===================================================================
6078 ENABLE_RUNTIME_OPTIMIZATIONS=
6079 AC_MSG_CHECKING([whether to enable runtime optimizations])
6080 if test -z "$enable_runtime_optimizations"; then
6081     for i in $CC; do
6082         case $i in
6083         -fsanitize=*)
6084             enable_runtime_optimizations=no
6085             break
6086             ;;
6087         esac
6088     done
6090 if test "$enable_runtime_optimizations" != no; then
6091     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6092     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6093     AC_MSG_RESULT([yes])
6094 else
6095     AC_MSG_RESULT([no])
6097 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6099 dnl ===================================================================
6100 dnl Check if valgrind headers are available
6101 dnl ===================================================================
6102 ENABLE_VALGRIND=
6103 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6104     prev_cppflags=$CPPFLAGS
6105     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6106     # or where does it come from?
6107     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6108     AC_CHECK_HEADER([valgrind/valgrind.h],
6109         [ENABLE_VALGRIND=TRUE])
6110     CPPFLAGS=$prev_cppflags
6112 AC_SUBST([ENABLE_VALGRIND])
6113 if test -z "$ENABLE_VALGRIND"; then
6114     if test "$with_valgrind" = yes; then
6115         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6116     fi
6117     VALGRIND_CFLAGS=
6119 AC_SUBST([VALGRIND_CFLAGS])
6122 dnl ===================================================================
6123 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6124 dnl ===================================================================
6126 # We need at least the sys/sdt.h include header.
6127 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6128 if test "$SDT_H_FOUND" = "TRUE"; then
6129     # Found sys/sdt.h header, now make sure the c++ compiler works.
6130     # Old g++ versions had problems with probes in constructors/destructors.
6131     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6132     AC_LANG_PUSH([C++])
6133     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6134     #include <sys/sdt.h>
6135     class ProbeClass
6136     {
6137     private:
6138       int& ref;
6139       const char *name;
6141     public:
6142       ProbeClass(int& v, const char *n) : ref(v), name(n)
6143       {
6144         DTRACE_PROBE2(_test_, cons, name, ref);
6145       }
6147       void method(int min)
6148       {
6149         DTRACE_PROBE3(_test_, meth, name, ref, min);
6150         ref -= min;
6151       }
6153       ~ProbeClass()
6154       {
6155         DTRACE_PROBE2(_test_, dest, name, ref);
6156       }
6157     };
6158     ]],[[
6159     int i = 64;
6160     DTRACE_PROBE1(_test_, call, i);
6161     ProbeClass inst = ProbeClass(i, "call");
6162     inst.method(24);
6163     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6164           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6165     AC_LANG_POP([C++])
6167 AC_CONFIG_HEADERS([config_host/config_probes.h])
6169 dnl ===================================================================
6170 dnl GCC features
6171 dnl ===================================================================
6172 HAVE_GCC_STACK_CLASH_PROTECTION=
6173 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6174     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6175     save_CFLAGS=$CFLAGS
6176     CFLAGS="$CFLAGS -fstack-clash-protection"
6177     AC_LINK_IFELSE(
6178         [AC_LANG_PROGRAM(, [[return 0;]])],
6179         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6180         [AC_MSG_RESULT([no])])
6181     CFLAGS=$save_CFLAGS
6183     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6184     save_CFLAGS=$CFLAGS
6185     CFLAGS="$CFLAGS -Werror -mno-avx"
6186     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6187     CFLAGS=$save_CFLAGS
6188     if test "$HAVE_GCC_AVX" = "TRUE"; then
6189         AC_MSG_RESULT([yes])
6190     else
6191         AC_MSG_RESULT([no])
6192     fi
6194     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6195     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6196     int v = 0;
6197     if (__sync_add_and_fetch(&v, 1) != 1 ||
6198         __sync_sub_and_fetch(&v, 1) != 0)
6199         return 1;
6200     __sync_synchronize();
6201     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6202         v != 1)
6203         return 1;
6204     return 0;
6205 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6206     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6207         AC_MSG_RESULT([yes])
6208         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6209     else
6210         AC_MSG_RESULT([no])
6211     fi
6213     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6214     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6215     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6216         AC_MSG_RESULT([yes])
6217         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6218     else
6219         AC_MSG_RESULT([no])
6220     fi
6222     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6223     save_CFLAGS=$CFLAGS
6224     CFLAGS="$CFLAGS -Werror"
6225     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6226             __attribute__((deprecated("test"))) void f();
6227         ])], [
6228             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6229             AC_MSG_RESULT([yes])
6230         ], [AC_MSG_RESULT([no])])
6231     CFLAGS=$save_CFLAGS
6233     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6234     AC_LANG_PUSH([C++])
6235     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6236             #include <cstddef>
6237             #include <cxxabi.h>
6238             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6239         ])], [
6240             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6241             AC_MSG_RESULT([yes])
6242         ], [AC_MSG_RESULT([no])])
6243     AC_LANG_POP([C++])
6245     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6246     AC_LANG_PUSH([C++])
6247     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6248             #include <cstddef>
6249             #include <cxxabi.h>
6250             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6251         ])], [
6252             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6253             AC_MSG_RESULT([yes])
6254         ], [AC_MSG_RESULT([no])])
6255     AC_LANG_POP([C++])
6257     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6258     AC_LANG_PUSH([C++])
6259     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6260             #include <cxxabi.h>
6261             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6262         ])], [
6263             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6264             AC_MSG_RESULT([yes])
6265         ], [AC_MSG_RESULT([no])])
6266     AC_LANG_POP([C++])
6268     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6269     AC_LANG_PUSH([C++])
6270     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6271             #include <cstddef>
6272             #include <cxxabi.h>
6273             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6274         ])], [
6275             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6276             AC_MSG_RESULT([yes])
6277         ], [AC_MSG_RESULT([no])])
6278     AC_LANG_POP([C++])
6280     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6281     AC_LANG_PUSH([C++])
6282     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6283             #include <cstddef>
6284             #include <cxxabi.h>
6285             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6286         ])], [
6287             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6288             AC_MSG_RESULT([yes])
6289         ], [AC_MSG_RESULT([no])])
6290     AC_LANG_POP([C++])
6292     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6293     AC_LANG_PUSH([C++])
6294     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6295             #include <cxxabi.h>
6296             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6297         ])], [
6298             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6299             AC_MSG_RESULT([yes])
6300         ], [AC_MSG_RESULT([no])])
6301     AC_LANG_POP([C++])
6303     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6304     AC_LANG_PUSH([C++])
6305     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6306             #include <cxxabi.h>
6307             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6308         ])], [
6309             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6310             AC_MSG_RESULT([yes])
6311         ], [AC_MSG_RESULT([no])])
6312     AC_LANG_POP([C++])
6314     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6315     AC_LANG_PUSH([C++])
6316     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6317             #include <cxxabi.h>
6318             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6319         ])], [
6320             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6321             AC_MSG_RESULT([yes])
6322         ], [AC_MSG_RESULT([no])])
6323     AC_LANG_POP([C++])
6325     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6326     AC_LANG_PUSH([C++])
6327     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6328             #include <cstddef>
6329             #include <cxxabi.h>
6330             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6331         ])], [
6332             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6333             AC_MSG_RESULT([yes])
6334         ], [AC_MSG_RESULT([no])])
6335     AC_LANG_POP([C++])
6337     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6338     AC_LANG_PUSH([C++])
6339     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6340             #include <cstddef>
6341             #include <cxxabi.h>
6342             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6343         ])], [
6344             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6345             AC_MSG_RESULT([yes])
6346         ], [AC_MSG_RESULT([no])])
6347     AC_LANG_POP([C++])
6349     dnl Available in GCC 4.9 and at least since Clang 3.4:
6350     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6351     AC_LANG_PUSH([C++])
6352     save_CXXFLAGS=$CXXFLAGS
6353     CXXFLAGS="$CXXFLAGS -Werror"
6354     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6355             struct __attribute__((warn_unused)) dummy {};
6356         ])], [
6357             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6358             AC_MSG_RESULT([yes])
6359         ], [AC_MSG_RESULT([no])])
6360     CXXFLAGS=$save_CXXFLAGS
6361 AC_LANG_POP([C++])
6364 AC_SUBST(HAVE_GCC_AVX)
6365 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6366 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6367 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6369 dnl ===================================================================
6370 dnl Identify the C++ library
6371 dnl ===================================================================
6373 AC_MSG_CHECKING([what the C++ library is])
6374 AC_LANG_PUSH([C++])
6375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6376 #include <utility>
6377 #ifndef __GLIBCXX__
6378 foo bar
6379 #endif
6380 ]])],
6381     [CPP_LIBRARY=GLIBCXX
6382      cpp_library_name="GNU libstdc++"
6383     ],
6384     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6385 #include <utility>
6386 #ifndef _LIBCPP_VERSION
6387 foo bar
6388 #endif
6389 ]])],
6390     [CPP_LIBRARY=LIBCPP
6391      cpp_library_name="LLVM libc++"
6392      AC_DEFINE([HAVE_LIBCXX])
6393     ],
6394     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6395 #include <utility>
6396 #ifndef _MSC_VER
6397 foo bar
6398 #endif
6399 ]])],
6400     [CPP_LIBRARY=MSVCRT
6401      cpp_library_name="Microsoft"
6402     ],
6403     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6404 AC_MSG_RESULT([$cpp_library_name])
6405 AC_LANG_POP([C++])
6407 dnl ===================================================================
6408 dnl Check for gperf
6409 dnl ===================================================================
6410 AC_PATH_PROG(GPERF, gperf)
6411 if test -z "$GPERF"; then
6412     AC_MSG_ERROR([gperf not found but needed. Install it.])
6414 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6415     GPERF=`cygpath -m $GPERF`
6417 AC_MSG_CHECKING([whether gperf is new enough])
6418 my_gperf_ver1=$($GPERF --version | head -n 1)
6419 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6420 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6421 if test "$my_gperf_ver3" -ge 301; then
6422     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6423 else
6424     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6426 AC_SUBST(GPERF)
6428 dnl ===================================================================
6429 dnl Check for system libcmis
6430 dnl ===================================================================
6431 # libcmis requires curl and we can't build curl for iOS
6432 if test $_os != iOS; then
6433     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6434     ENABLE_LIBCMIS=TRUE
6435 else
6436     ENABLE_LIBCMIS=
6438 AC_SUBST(ENABLE_LIBCMIS)
6440 dnl ===================================================================
6441 dnl C++11
6442 dnl ===================================================================
6444 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6445 CXXFLAGS_CXX11=
6446 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6447     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6448 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6449     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6450     for flag in $my_flags; do
6451         if test "$COM" = MSC; then
6452             flag="-Xclang $flag"
6453         fi
6454         save_CXXFLAGS=$CXXFLAGS
6455         CXXFLAGS="$CXXFLAGS $flag -Werror"
6456         if test "$SYSTEM_LIBCMIS" = TRUE; then
6457             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6458         fi
6459         AC_LANG_PUSH([C++])
6460         dnl Clang 3.9 supports __float128 since
6461         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6462         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6463         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6464         dnl $flag is supported below, so check this first):
6465         my_float128hack=
6466         my_float128hack_impl=-D__float128=void
6467         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6468             #include <vector>
6469             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6470             // (__float128)
6471             ]])
6472         ],,[
6473             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6474             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6475             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6476             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6477             dnl place where __float128 is used is in a template specialization, -D__float128=void
6478             dnl will avoid the problem there while still causing a problem if somebody actually uses
6479             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6480             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6481             dnl "fixed" with this hack):
6482             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6483             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6484                 #include <vector>
6485                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6486                 // (__float128)
6487                 ]])
6488             ],[my_float128hack=$my_float128hack_impl])
6489         ])
6490         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6491             #include <algorithm>
6492             #include <functional>
6493             #include <vector>
6495             #if defined SYSTEM_LIBCMIS
6496             // See ucb/source/ucp/cmis/auth_provider.hxx:
6497             #if !defined __clang__
6498             #pragma GCC diagnostic push
6499             #pragma GCC diagnostic ignored "-Wdeprecated"
6500             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6501             #endif
6502             #include <libcmis/libcmis.hxx>
6503             #if !defined __clang__
6504             #pragma GCC diagnostic pop
6505             #endif
6506             #endif
6508             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6509                 std::sort(v.begin(), v.end(), fn);
6510             }
6511             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6512         AC_LANG_POP([C++])
6513         CXXFLAGS=$save_CXXFLAGS
6514         if test -n "$CXXFLAGS_CXX11"; then
6515             break
6516         fi
6517     done
6519 if test -n "$CXXFLAGS_CXX11"; then
6520     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6521 else
6522     AC_MSG_ERROR(no)
6524 AC_SUBST(CXXFLAGS_CXX11)
6526 if test "$GCC" = "yes"; then
6527     save_CXXFLAGS=$CXXFLAGS
6528     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6529     CHECK_L_ATOMIC
6530     CXXFLAGS=$save_CXXFLAGS
6531     AC_SUBST(ATOMIC_LIB)
6534 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6535 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6536 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6537 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6538 dnl again towards 4.7.2:
6539 if test $CPP_LIBRARY = GLIBCXX; then
6540     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6541     AC_LANG_PUSH([C++])
6542     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6543 #include <list>
6544 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6545     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6546     //   GCC 4.7.0: 20120322
6547     //   GCC 4.7.1: 20120614
6548     // and using a range check is not possible as the mapping between
6549     // __GLIBCXX__ values and GCC versions is not monotonic
6550 /* ok */
6551 #else
6552 abi broken
6553 #endif
6554         ]])], [AC_MSG_RESULT(no, ok)],
6555         [AC_MSG_ERROR(yes)])
6556     AC_LANG_POP([C++])
6559 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6560 save_CXXFLAGS=$CXXFLAGS
6561 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6562 AC_LANG_PUSH([C++])
6564 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6565 #include <stddef.h>
6567 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6569 namespace
6571         struct b
6572         {
6573                 int i;
6574                 int j;
6575         };
6577 ]], [[
6578 struct a
6580         int i;
6581         int j;
6583 a thinga[]={{0,0}, {1,1}};
6584 b thingb[]={{0,0}, {1,1}};
6585 size_t i = sizeof(sal_n_array_size(thinga));
6586 size_t j = sizeof(sal_n_array_size(thingb));
6587 return !(i != 0 && j != 0);
6589     ], [ AC_MSG_RESULT(yes) ],
6590     [ AC_MSG_ERROR(no)])
6591 AC_LANG_POP([C++])
6592 CXXFLAGS=$save_CXXFLAGS
6594 dnl _Pragma support (may require C++11)
6595 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6596     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6597     AC_LANG_PUSH([C++])
6598     save_CXXFLAGS=$CXXFLAGS
6599     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6600     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6601             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6602         ])], [
6603             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6604             AC_MSG_RESULT([yes])
6605         ], [AC_MSG_RESULT([no])])
6606     AC_LANG_POP([C++])
6607     CXXFLAGS=$save_CXXFLAGS
6610 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6611 if test "$GCC" = yes; then
6612     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6613     AC_LANG_PUSH([C++])
6614     save_CXXFLAGS=$CXXFLAGS
6615     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6616     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6617     CXXFLAGS=$save_CXXFLAGS
6618     AC_LANG_POP([C++])
6619     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6620         AC_MSG_RESULT([yes])
6621     else
6622         AC_MSG_RESULT([no])
6623     fi
6625 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6627 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6628 AC_LANG_PUSH([C++])
6629 save_CXXFLAGS=$CXXFLAGS
6630 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6631 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6632         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6633         // supporting it:
6634         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6635         struct S {
6636         private:
6637             S(S const &);
6638         public:
6639             S();
6640             ~S();
6641         };
6642         S copy();
6643         void f() { S c(copy()); }
6644         #endif
6645     ])], [
6646         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6647         AC_MSG_RESULT([yes])
6648     ], [AC_MSG_RESULT([no])])
6649 CXXFLAGS=$save_CXXFLAGS
6650 AC_LANG_POP([C++])
6652 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6653 AC_LANG_PUSH([C++])
6654 save_CXXFLAGS=$CXXFLAGS
6655 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6656 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6657         #include <algorithm>
6658         #include <initializer_list>
6659         #include <vector>
6660         template<typename T> class S {
6661         private:
6662             std::vector<T> v_;
6663         public:
6664             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6665         };
6666         constinit S<int> s{3, 2, 1};
6667     ])], [
6668         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6669         AC_MSG_RESULT([yes])
6670     ], [AC_MSG_RESULT([no])])
6671 CXXFLAGS=$save_CXXFLAGS
6672 AC_LANG_POP([C++])
6674 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6675 AC_LANG_PUSH([C++])
6676 save_CXXFLAGS=$CXXFLAGS
6677 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6678 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6679         struct S1 { S1(S1 &&); };
6680         struct S2: S1 {};
6681         S1 f(S2 s) { return s; }
6682     ])], [
6683         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6684         AC_MSG_RESULT([yes])
6685     ], [AC_MSG_RESULT([no])])
6686 CXXFLAGS=$save_CXXFLAGS
6687 AC_LANG_POP([C++])
6689 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6690 dnl uninitialized warning for code like
6692 dnl   OString f();
6693 dnl   boost::optional<OString> * g(bool b) {
6694 dnl       boost::optional<OString> o;
6695 dnl       if (b) o = f();
6696 dnl       return new boost::optional<OString>(o);
6697 dnl   }
6699 dnl (as is e.g. present, in a slightly more elaborate form, in
6700 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6701 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6702 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6703 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6704     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6705     AC_LANG_PUSH([C++])
6706     save_CXXFLAGS=$CXXFLAGS
6707     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6708     if test "$ENABLE_OPTIMIZED" = TRUE; then
6709         CXXFLAGS="$CXXFLAGS -O2"
6710     else
6711         CXXFLAGS="$CXXFLAGS -O0"
6712     fi
6713     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6714             #include <new>
6715             void f1(int);
6716             struct S1 {
6717                 ~S1() { f1(n); }
6718                 int n = 0;
6719             };
6720             struct S2 {
6721                 S2() {}
6722                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6723                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6724                 void set(S1 s) {
6725                     new (stg) S1(s);
6726                     init = true;
6727                 }
6728                 bool init = false;
6729                 char stg[sizeof (S1)];
6730             } ;
6731             S1 f2();
6732             S2 * f3(bool b) {
6733                 S2 o;
6734                 if (b) o.set(f2());
6735                 return new S2(o);
6736             }
6737         ]])], [AC_MSG_RESULT([no])], [
6738             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6739             AC_MSG_RESULT([yes])
6740         ])
6741     CXXFLAGS=$save_CXXFLAGS
6742     AC_LANG_POP([C++])
6744 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6746 dnl ===================================================================
6747 dnl CPU Intrinsics support - SSE, AVX
6748 dnl ===================================================================
6750 INTRINSICS_CXXFLAGS=""
6752 if test "$GCC" = "yes"; then
6753     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6754     AC_LANG_PUSH([C++])
6755     save_CXXFLAGS=$CXXFLAGS
6756     CXXFLAGS="$CXXFLAGS -msse2"
6757     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6758         #include <emmintrin.h>
6759         int main () {
6760             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6761             c = _mm_xor_si128 (a, b);
6762             return 0;
6763         }
6764         ])],
6765         [can_compile_sse2=yes],
6766         [can_compile_sse2=no])
6767     AC_LANG_POP([C++])
6768     CXXFLAGS=$save_CXXFLAGS
6769     AC_MSG_RESULT([${can_compile_sse2}])
6770     if test "${can_compile_sse2}" = "yes" ; then
6771         INTRINSICS_CXXFLAGS="-msse2"
6772     else
6773         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6774     fi
6776     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6777     AC_LANG_PUSH([C++])
6778     save_CXXFLAGS=$CXXFLAGS
6779     CXXFLAGS="$CXXFLAGS -mssse3"
6780     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6781         #include <tmmintrin.h>
6782         int main () {
6783             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6784             c = _mm_maddubs_epi16 (a, b);
6785             return 0;
6786         }
6787         ])],
6788         [can_compile_ssse3=yes],
6789         [can_compile_ssse3=no])
6790     AC_LANG_POP([C++])
6791     CXXFLAGS=$save_CXXFLAGS
6792     AC_MSG_RESULT([${can_compile_ssse3}])
6793     if test "${can_compile_ssse3}" = "yes" ; then
6794         INTRINSICS_CXXFLAGS="-mssse3"
6795     else
6796         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6797     fi
6799     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6800     AC_LANG_PUSH([C++])
6801     save_CXXFLAGS=$CXXFLAGS
6802     CXXFLAGS="$CXXFLAGS -mavx"
6803     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6804         #include <immintrin.h>
6805         int main () {
6806             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6807             c = _mm256_xor_ps(a, b);
6808             return 0;
6809         }
6810         ])],
6811         [can_compile_avx=yes],
6812         [can_compile_avx=no])
6813     AC_LANG_POP([C++])
6814     CXXFLAGS=$save_CXXFLAGS
6815     AC_MSG_RESULT([${can_compile_avx}])
6816     if test "${can_compile_avx}" = "yes" ; then
6817         INTRINSICS_CXXFLAGS="-mavx"
6818     else
6819         AC_MSG_WARN([cannot compile AVX intrinsics])
6820     fi
6822     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6823     AC_LANG_PUSH([C++])
6824     save_CXXFLAGS=$CXXFLAGS
6825     CXXFLAGS="$CXXFLAGS -mavx2"
6826     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6827         #include <immintrin.h>
6828         int main () {
6829             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6830             c = _mm256_maddubs_epi16(a, b);
6831             return 0;
6832         }
6833         ])],
6834         [can_compile_avx2=yes],
6835         [can_compile_avx2=no])
6836     AC_LANG_POP([C++])
6837     CXXFLAGS=$save_CXXFLAGS
6838     AC_MSG_RESULT([${can_compile_avx2}])
6839     if test "${can_compile_avx2}" = "yes" ; then
6840         INTRINSICS_CXXFLAGS="-mavx2"
6841     else
6842         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6843     fi
6846 AC_SUBST([INTRINSICS_CXXFLAGS])
6848 dnl ===================================================================
6849 dnl system stl sanity tests
6850 dnl ===================================================================
6851 if test "$_os" != "WINNT"; then
6853     AC_LANG_PUSH([C++])
6855     save_CPPFLAGS="$CPPFLAGS"
6856     if test -n "$MACOSX_SDK_PATH"; then
6857         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6858     fi
6860     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6861     # only.
6862     if test "$CPP_LIBRARY" = GLIBCXX; then
6863         dnl gcc#19664, gcc#22482, rhbz#162935
6864         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6865         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6866         AC_MSG_RESULT([$stlvisok])
6867         if test "$stlvisok" = "no"; then
6868             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6869         fi
6870     fi
6872     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6873     # when we don't make any dynamic libraries?
6874     if test "$DISABLE_DYNLOADING" = ""; then
6875         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6876         cat > conftestlib1.cc <<_ACEOF
6877 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6878 struct S2: S1<int> { virtual ~S2(); };
6879 S2::~S2() {}
6880 _ACEOF
6881         cat > conftestlib2.cc <<_ACEOF
6882 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6883 struct S2: S1<int> { virtual ~S2(); };
6884 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6885 _ACEOF
6886         gccvisinlineshiddenok=yes
6887         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6888             gccvisinlineshiddenok=no
6889         else
6890             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6891             dnl known to not work with -z defs (unsetting which makes the test
6892             dnl moot, though):
6893             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6894             if test "$COM_IS_CLANG" = TRUE; then
6895                 for i in $CXX $CXXFLAGS; do
6896                     case $i in
6897                     -fsanitize=*)
6898                         my_linkflagsnoundefs=
6899                         break
6900                         ;;
6901                     esac
6902                 done
6903             fi
6904             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6905                 gccvisinlineshiddenok=no
6906             fi
6907         fi
6909         rm -fr libconftest*
6910         AC_MSG_RESULT([$gccvisinlineshiddenok])
6911         if test "$gccvisinlineshiddenok" = "no"; then
6912             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6913         fi
6914     fi
6916    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6917     cat >visibility.cxx <<_ACEOF
6918 #pragma GCC visibility push(hidden)
6919 struct __attribute__ ((visibility ("default"))) TestStruct {
6920   static void Init();
6922 __attribute__ ((visibility ("default"))) void TestFunc() {
6923   TestStruct::Init();
6925 _ACEOF
6926     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6927         gccvisbroken=yes
6928     else
6929         case "$host_cpu" in
6930         i?86|x86_64)
6931             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6932                 gccvisbroken=no
6933             else
6934                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6935                     gccvisbroken=no
6936                 else
6937                     gccvisbroken=yes
6938                 fi
6939             fi
6940             ;;
6941         *)
6942             gccvisbroken=no
6943             ;;
6944         esac
6945     fi
6946     rm -f visibility.s visibility.cxx
6948     AC_MSG_RESULT([$gccvisbroken])
6949     if test "$gccvisbroken" = "yes"; then
6950         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6951     fi
6953     CPPFLAGS="$save_CPPFLAGS"
6955     AC_LANG_POP([C++])
6958 dnl ===================================================================
6959 dnl  Clang++ tests
6960 dnl ===================================================================
6962 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6963 if test "$GCC" = "yes"; then
6964     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6965     AC_LANG_PUSH([C++])
6966     save_CXXFLAGS=$CXXFLAGS
6967     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6968     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6969     CXXFLAGS=$save_CXXFLAGS
6970     AC_LANG_POP([C++])
6971     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6972         AC_MSG_RESULT([yes])
6973     else
6974         AC_MSG_RESULT([no])
6975     fi
6977 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6979 dnl ===================================================================
6980 dnl Compiler plugins
6981 dnl ===================================================================
6983 COMPILER_PLUGINS=
6984 # currently only Clang
6986 if test "$COM_IS_CLANG" != "TRUE"; then
6987     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6988         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6989         enable_compiler_plugins=no
6990     fi
6993 if test "$COM_IS_CLANG" = "TRUE"; then
6994     if test -n "$enable_compiler_plugins"; then
6995         compiler_plugins="$enable_compiler_plugins"
6996     elif test -n "$ENABLE_DBGUTIL"; then
6997         compiler_plugins=test
6998     else
6999         compiler_plugins=no
7000     fi
7001     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7002         if test "$CLANGVER" -lt 50002; then
7003             if test "$compiler_plugins" = yes; then
7004                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7005             else
7006                 compiler_plugins=no
7007             fi
7008         fi
7009     fi
7010     if test "$compiler_plugins" != "no"; then
7011         dnl The prefix where Clang resides, override to where Clang resides if
7012         dnl using a source build:
7013         if test -z "$CLANGDIR"; then
7014             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7015         fi
7016         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7017         if test -z "$COMPILER_PLUGINS_CXX"; then
7018             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7019         fi
7020         clangbindir=$CLANGDIR/bin
7021         if test "$build_os" = "cygwin"; then
7022             clangbindir=$(cygpath -u "$clangbindir")
7023         fi
7024         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7025         if test -n "$LLVM_CONFIG"; then
7026             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7027             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7028             if test -z "$CLANGLIBDIR"; then
7029                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7030             fi
7031             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7032             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7033             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7034             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7035                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7036             fi
7037             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7038             clangobjdir=$($LLVM_CONFIG --obj-root)
7039             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7040                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7041             fi
7042         fi
7043         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7044         AC_LANG_PUSH([C++])
7045         save_CXX=$CXX
7046         save_CXXCPP=$CXXCPP
7047         save_CPPFLAGS=$CPPFLAGS
7048         save_CXXFLAGS=$CXXFLAGS
7049         save_LDFLAGS=$LDFLAGS
7050         save_LIBS=$LIBS
7051         CXX=$COMPILER_PLUGINS_CXX
7052         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7053         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7054         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7055         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7056             [COMPILER_PLUGINS=TRUE],
7057             [
7058             if test "$compiler_plugins" = "yes"; then
7059                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7060             else
7061                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7062                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7063             fi
7064             ])
7065         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7066         dnl comment in compilerplugins/Makefile-clang.mk:
7067         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7068             LDFLAGS=""
7069             AC_MSG_CHECKING([for clang libraries to use])
7070             if test -z "$CLANGTOOLLIBS"; then
7071                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7072  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7073                 AC_LINK_IFELSE([
7074                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7075                         [[ clang::FullSourceLoc().dump(); ]])
7076                 ],[CLANGTOOLLIBS="$LIBS"],[])
7077             fi
7078             if test -z "$CLANGTOOLLIBS"; then
7079                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7080                 AC_LINK_IFELSE([
7081                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7082                         [[ clang::FullSourceLoc().dump(); ]])
7083                 ],[CLANGTOOLLIBS="$LIBS"],[])
7084             fi
7085             AC_MSG_RESULT([$CLANGTOOLLIBS])
7086             if test -z "$CLANGTOOLLIBS"; then
7087                 if test "$compiler_plugins" = "yes"; then
7088                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7089                 else
7090                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7091                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7092                 fi
7093                 COMPILER_PLUGINS=
7094             fi
7095             if test -n "$COMPILER_PLUGINS"; then
7096                 if test -z "$CLANGSYSINCLUDE"; then
7097                     if test -n "$LLVM_CONFIG"; then
7098                         # Path to the clang system headers (no idea if there's a better way to get it).
7099                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7100                     fi
7101                 fi
7102             fi
7103         fi
7104         CXX=$save_CXX
7105         CXXCPP=$save_CXXCPP
7106         CPPFLAGS=$save_CPPFLAGS
7107         CXXFLAGS=$save_CXXFLAGS
7108         LDFLAGS=$save_LDFLAGS
7109         LIBS="$save_LIBS"
7110         AC_LANG_POP([C++])
7111     fi
7112 else
7113     if test "$enable_compiler_plugins" = "yes"; then
7114         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7115     fi
7117 AC_SUBST(COMPILER_PLUGINS)
7118 AC_SUBST(COMPILER_PLUGINS_CXX)
7119 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7120 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7121 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7122 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7123 AC_SUBST(CLANGDIR)
7124 AC_SUBST(CLANGLIBDIR)
7125 AC_SUBST(CLANGTOOLLIBS)
7126 AC_SUBST(CLANGSYSINCLUDE)
7128 # Plugin to help linker.
7129 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7130 # This makes --enable-lto build with clang work.
7131 AC_SUBST(LD_PLUGIN)
7133 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7134 AC_SUBST(HAVE_POSIX_FALLOCATE)
7136 dnl ===================================================================
7137 dnl Custom build version
7138 dnl ===================================================================
7140 AC_MSG_CHECKING([whether to add custom build version])
7141 if test "$with_build_version" != ""; then
7142     BUILD_VER_STRING=$with_build_version
7143     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7144 else
7145     BUILD_VER_STRING=
7146     AC_MSG_RESULT([no])
7148 AC_SUBST(BUILD_VER_STRING)
7150 JITC_PROCESSOR_TYPE=""
7151 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7152     # IBMs JDK needs this...
7153     JITC_PROCESSOR_TYPE=6
7154     export JITC_PROCESSOR_TYPE
7156 AC_SUBST([JITC_PROCESSOR_TYPE])
7158 # Misc Windows Stuff
7159 AC_ARG_WITH(ucrt-dir,
7160     AS_HELP_STRING([--with-ucrt-dir],
7161         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7162         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7163         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7164             Windows6.1-KB2999226-x64.msu
7165             Windows6.1-KB2999226-x86.msu
7166             Windows8.1-KB2999226-x64.msu
7167             Windows8.1-KB2999226-x86.msu
7168             Windows8-RT-KB2999226-x64.msu
7169             Windows8-RT-KB2999226-x86.msu
7170         A zip archive including those files is available from Microsoft site:
7171         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7173 UCRT_REDISTDIR="$with_ucrt_dir"
7174 if test $_os = "WINNT"; then
7175     find_msvc_x64_dlls
7176     find_msms
7177     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7178     MSVC_DLLS="$msvcdlls"
7179     MSM_PATH=`win_short_path_for_make "$msmdir"`
7180     # MSVC 15.3 changed it to VC141
7181     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7182         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7183     else
7184         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7185     fi
7187     if test "$UCRT_REDISTDIR" = "no"; then
7188         dnl explicitly disabled
7189         UCRT_REDISTDIR=""
7190     else
7191         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7192                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7193                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7194                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7195                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7196                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7197             UCRT_REDISTDIR=""
7198             if test -n "$PKGFORMAT"; then
7199                for i in $PKGFORMAT; do
7200                    case "$i" in
7201                    msi)
7202                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7203                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7204                        ;;
7205                    esac
7206                done
7207             fi
7208         fi
7209     fi
7212 AC_SUBST(UCRT_REDISTDIR)
7213 AC_SUBST(MSVC_DLL_PATH)
7214 AC_SUBST(MSVC_DLLS)
7215 AC_SUBST(MSM_PATH)
7217 dnl ===================================================================
7218 dnl Checks for Java
7219 dnl ===================================================================
7220 if test "$ENABLE_JAVA" != ""; then
7222     # Windows-specific tests
7223     if test "$build_os" = "cygwin"; then
7224         if test "$BITNESS_OVERRIDE" = 64; then
7225             bitness=64
7226         else
7227             bitness=32
7228         fi
7230         if test -z "$with_jdk_home"; then
7231             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7232             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7233             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7234             if test -n "$regvalue"; then
7235                 ver=$regvalue
7236                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7237                 _jdk_home=$regvalue
7238             fi
7239             if test -z "$with_jdk_home"; then
7240                 for ver in 1.8; do
7241                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7242                     if test -n "$regvalue"; then
7243                         _jdk_home=$regvalue
7244                         break
7245                     fi
7246                 done
7247             fi
7248             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7249                 with_jdk_home="$_jdk_home"
7250                 howfound="found automatically"
7251             else
7252                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7253             fi
7254         else
7255             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7256             howfound="you passed"
7257         fi
7258     fi
7260     # 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.
7261     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7262     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7263         with_jdk_home=`/usr/libexec/java_home`
7264     fi
7266     JAVA_HOME=; export JAVA_HOME
7267     if test -z "$with_jdk_home"; then
7268         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7269     else
7270         _java_path="$with_jdk_home/bin/$with_java"
7271         dnl Check if there is a Java interpreter at all.
7272         if test -x "$_java_path"; then
7273             JAVAINTERPRETER=$_java_path
7274         else
7275             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7276         fi
7277     fi
7279     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7280     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7281     dnl loaded by java to run JunitTests:
7282     if test "$build_os" = "cygwin"; then
7283         shortjdkhome=`cygpath -d "$with_jdk_home"`
7284         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
7285             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7286             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7287         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
7288             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7289             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7290         fi
7292         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7293             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7294         fi
7295         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7296     elif test "$cross_compiling" != "yes"; then
7297         case $CPUNAME in
7298             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7299                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7300                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7301                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7302                 fi
7303                 ;;
7304             *) # assumption: everything else 32-bit
7305                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7306                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7307                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7308                 fi
7309                 ;;
7310         esac
7311     fi
7314 dnl ===================================================================
7315 dnl Checks for JDK.
7316 dnl ===================================================================
7318 # Note that JAVA_HOME as for now always means the *build* platform's
7319 # JAVA_HOME. Whether all the complexity here actually is needed any
7320 # more or not, no idea.
7322 if test "$ENABLE_JAVA" != ""; then
7323     _gij_longver=0
7324     AC_MSG_CHECKING([the installed JDK])
7325     if test -n "$JAVAINTERPRETER"; then
7326         dnl java -version sends output to stderr!
7327         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7328             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7329         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7330             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7331         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7332             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7333         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7334             JDK=ibm
7336             dnl IBM JDK specific tests
7337             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7338             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7340             if test "$_jdk_ver" -lt 10800; then
7341                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7342             fi
7344             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7346             if test "$with_jdk_home" = ""; then
7347                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7348 you must use the "--with-jdk-home" configure option explicitly])
7349             fi
7351             JAVA_HOME=$with_jdk_home
7352         else
7353             JDK=sun
7355             dnl Sun JDK specific tests
7356             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7357             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7359             if test "$_jdk_ver" -lt 10800; then
7360                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7361             fi
7362             if test "$_jdk_ver" -gt 10800; then
7363                 JAVA_CLASSPATH_NOT_SET=TRUE
7364             fi
7366             AC_MSG_RESULT([found (JDK $_jdk)])
7367             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7368             if test "$_os" = "WINNT"; then
7369                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7370             fi
7372             # set to limit VM usage for JunitTests
7373             JAVAIFLAGS=-Xmx64M
7374             # set to limit VM usage for javac
7375             JAVAFLAGS=-J-Xmx128M
7376         fi
7377     else
7378         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7379     fi
7380 else
7381     dnl Java disabled
7382     JAVA_HOME=
7383     export JAVA_HOME
7386 dnl ===================================================================
7387 dnl Checks for javac
7388 dnl ===================================================================
7389 if test "$ENABLE_JAVA" != ""; then
7390     javacompiler="javac"
7391     : ${JAVA_SOURCE_VER=8}
7392     : ${JAVA_TARGET_VER=8}
7393     if test -z "$with_jdk_home"; then
7394         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7395     else
7396         _javac_path="$with_jdk_home/bin/$javacompiler"
7397         dnl Check if there is a Java compiler at all.
7398         if test -x "$_javac_path"; then
7399             JAVACOMPILER=$_javac_path
7400         fi
7401     fi
7402     if test -z "$JAVACOMPILER"; then
7403         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7404     fi
7405     if test "$build_os" = "cygwin"; then
7406         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7407             JAVACOMPILER="${JAVACOMPILER}.exe"
7408         fi
7409         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7410     fi
7413 dnl ===================================================================
7414 dnl Checks for javadoc
7415 dnl ===================================================================
7416 if test "$ENABLE_JAVA" != ""; then
7417     if test -z "$with_jdk_home"; then
7418         AC_PATH_PROG(JAVADOC, javadoc)
7419     else
7420         _javadoc_path="$with_jdk_home/bin/javadoc"
7421         dnl Check if there is a javadoc at all.
7422         if test -x "$_javadoc_path"; then
7423             JAVADOC=$_javadoc_path
7424         else
7425             AC_PATH_PROG(JAVADOC, javadoc)
7426         fi
7427     fi
7428     if test -z "$JAVADOC"; then
7429         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7430     fi
7431     if test "$build_os" = "cygwin"; then
7432         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7433             JAVADOC="${JAVADOC}.exe"
7434         fi
7435         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7436     fi
7438     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7439     JAVADOCISGJDOC="yes"
7440     fi
7442 AC_SUBST(JAVADOCISGJDOC)
7444 if test "$ENABLE_JAVA" != ""; then
7445     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7446     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7447         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7448            # try to recover first by looking whether we have an alternative
7449            # system as in Debian or newer SuSEs where following /usr/bin/javac
7450            # over /etc/alternatives/javac leads to the right bindir where we
7451            # just need to strip a bit away to get a valid JAVA_HOME
7452            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7453         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7454             # maybe only one level of symlink (e.g. on Mac)
7455             JAVA_HOME=$(readlink $JAVACOMPILER)
7456             if test "$(dirname $JAVA_HOME)" = "."; then
7457                 # we've got no path to trim back
7458                 JAVA_HOME=""
7459             fi
7460         else
7461             # else warn
7462             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7463             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7464             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7465             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7466         fi
7467         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7468         if test "$JAVA_HOME" != "/usr"; then
7469             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7470                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7471                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7472                 dnl Tiger already returns a JDK path...
7473                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7474             else
7475                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7476                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7477                 dnl that checks which version to run
7478                 if test -f "$JAVA_HOME"; then
7479                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7480                 fi
7481             fi
7482         fi
7483     fi
7484     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7486     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7487     if test -z "$JAVA_HOME"; then
7488         if test "x$with_jdk_home" = "x"; then
7489             cat > findhome.java <<_ACEOF
7490 [import java.io.File;
7492 class findhome
7494     public static void main(String args[])
7495     {
7496         String jrelocation = System.getProperty("java.home");
7497         File jre = new File(jrelocation);
7498         System.out.println(jre.getParent());
7499     }
7501 _ACEOF
7502             AC_MSG_CHECKING([if javac works])
7503             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7504             AC_TRY_EVAL(javac_cmd)
7505             if test $? = 0 -a -f ./findhome.class; then
7506                 AC_MSG_RESULT([javac works])
7507             else
7508                 echo "configure: javac test failed" >&5
7509                 cat findhome.java >&5
7510                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7511             fi
7512             AC_MSG_CHECKING([if gij knows its java.home])
7513             JAVA_HOME=`$JAVAINTERPRETER findhome`
7514             if test $? = 0 -a "$JAVA_HOME" != ""; then
7515                 AC_MSG_RESULT([$JAVA_HOME])
7516             else
7517                 echo "configure: java test failed" >&5
7518                 cat findhome.java >&5
7519                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7520             fi
7521             # clean-up after ourselves
7522             rm -f ./findhome.java ./findhome.class
7523         else
7524             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7525         fi
7526     fi
7528     # now check if $JAVA_HOME is really valid
7529     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7530         case "${JAVA_HOME}" in
7531             /Library/Java/JavaVirtualMachines/*)
7532                 ;;
7533             *)
7534                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7535                 ;;
7536         esac
7537         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7538             JAVA_HOME_OK="NO"
7539         fi
7540     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7541         JAVA_HOME_OK="NO"
7542     fi
7543     if test "$JAVA_HOME_OK" = "NO"; then
7544         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7545         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7546         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7547         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7548         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7549         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7550     fi
7551     PathFormat "$JAVA_HOME"
7552     JAVA_HOME="$formatted_path"
7555 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7556     "$_os" != Darwin
7557 then
7558     AC_MSG_CHECKING([for JAWT lib])
7559     if test "$_os" = WINNT; then
7560         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7561         JAWTLIB=jawt.lib
7562     else
7563         case "$host_cpu" in
7564         arm*)
7565             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7566             JAVA_ARCH=$my_java_arch
7567             ;;
7568         i*86)
7569             my_java_arch=i386
7570             ;;
7571         m68k)
7572             my_java_arch=m68k
7573             ;;
7574         powerpc)
7575             my_java_arch=ppc
7576             ;;
7577         powerpc64)
7578             my_java_arch=ppc64
7579             ;;
7580         powerpc64le)
7581             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7582             JAVA_ARCH=$my_java_arch
7583             ;;
7584         sparc64)
7585             my_java_arch=sparcv9
7586             ;;
7587         x86_64)
7588             my_java_arch=amd64
7589             ;;
7590         *)
7591             my_java_arch=$host_cpu
7592             ;;
7593         esac
7594         # This is where JDK9 puts the library
7595         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7596             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7597         else
7598             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7599         fi
7600         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7601     fi
7602     AC_MSG_RESULT([$JAWTLIB])
7604 AC_SUBST(JAWTLIB)
7606 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7607     case "$host_os" in
7609     aix*)
7610         JAVAINC="-I$JAVA_HOME/include"
7611         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7612         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7613         ;;
7615     cygwin*)
7616         JAVAINC="-I$JAVA_HOME/include/win32"
7617         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7618         ;;
7620     darwin*)
7621         if test -d "$JAVA_HOME/include/darwin"; then
7622             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7623         else
7624             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7625         fi
7626         ;;
7628     dragonfly*)
7629         JAVAINC="-I$JAVA_HOME/include"
7630         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7631         ;;
7633     freebsd*)
7634         JAVAINC="-I$JAVA_HOME/include"
7635         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7636         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7637         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7638         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7639         ;;
7641     k*bsd*-gnu*)
7642         JAVAINC="-I$JAVA_HOME/include"
7643         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7644         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7645         ;;
7647     linux-gnu*)
7648         JAVAINC="-I$JAVA_HOME/include"
7649         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7650         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7651         ;;
7653     *netbsd*)
7654         JAVAINC="-I$JAVA_HOME/include"
7655         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7656         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7657        ;;
7659     openbsd*)
7660         JAVAINC="-I$JAVA_HOME/include"
7661         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7662         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7663         ;;
7665     solaris*)
7666         JAVAINC="-I$JAVA_HOME/include"
7667         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7668         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7669         ;;
7670     esac
7672 SOLARINC="$SOLARINC $JAVAINC"
7674 AC_SUBST(JAVACOMPILER)
7675 AC_SUBST(JAVADOC)
7676 AC_SUBST(JAVAINTERPRETER)
7677 AC_SUBST(JAVAIFLAGS)
7678 AC_SUBST(JAVAFLAGS)
7679 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7680 AC_SUBST(JAVA_HOME)
7681 AC_SUBST(JAVA_SOURCE_VER)
7682 AC_SUBST(JAVA_TARGET_VER)
7683 AC_SUBST(JDK)
7686 dnl ===================================================================
7687 dnl Export file validation
7688 dnl ===================================================================
7689 AC_MSG_CHECKING([whether to enable export file validation])
7690 if test "$with_export_validation" != "no"; then
7691     if test -z "$ENABLE_JAVA"; then
7692         if test "$with_export_validation" = "yes"; then
7693             AC_MSG_ERROR([requested, but Java is disabled])
7694         else
7695             AC_MSG_RESULT([no, as Java is disabled])
7696         fi
7697     elif ! test -d "${SRC_ROOT}/schema"; then
7698         if test "$with_export_validation" = "yes"; then
7699             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7700         else
7701             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7702         fi
7703     else
7704         AC_MSG_RESULT([yes])
7705         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7707         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7708         if test -z "$ODFVALIDATOR"; then
7709             # remember to download the ODF toolkit with validator later
7710             AC_MSG_NOTICE([no odfvalidator found, will download it])
7711             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7712             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7714             # and fetch name of odfvalidator jar name from download.lst
7715             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7716             AC_SUBST(ODFVALIDATOR_JAR)
7718             if test -z "$ODFVALIDATOR_JAR"; then
7719                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7720             fi
7721         fi
7722         if test "$build_os" = "cygwin"; then
7723             # In case of Cygwin it will be executed from Windows,
7724             # so we need to run bash and absolute path to validator
7725             # so instead of "odfvalidator" it will be
7726             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7727             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7728         else
7729             ODFVALIDATOR="sh $ODFVALIDATOR"
7730         fi
7731         AC_SUBST(ODFVALIDATOR)
7734         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7735         if test -z "$OFFICEOTRON"; then
7736             # remember to download the officeotron with validator later
7737             AC_MSG_NOTICE([no officeotron found, will download it])
7738             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7739             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7741             # and fetch name of officeotron jar name from download.lst
7742             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7743             AC_SUBST(OFFICEOTRON_JAR)
7745             if test -z "$OFFICEOTRON_JAR"; then
7746                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7747             fi
7748         else
7749             # check version of existing officeotron
7750             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7751             if test 0"$OFFICEOTRON_VER" -lt 704; then
7752                 AC_MSG_ERROR([officeotron too old])
7753             fi
7754         fi
7755         if test "$build_os" = "cygwin"; then
7756             # In case of Cygwin it will be executed from Windows,
7757             # so we need to run bash and absolute path to validator
7758             # so instead of "odfvalidator" it will be
7759             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7760             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7761         else
7762             OFFICEOTRON="sh $OFFICEOTRON"
7763         fi
7764     fi
7765     AC_SUBST(OFFICEOTRON)
7766 else
7767     AC_MSG_RESULT([no])
7770 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7771 if test "$with_bffvalidator" != "no"; then
7772     AC_DEFINE(HAVE_BFFVALIDATOR)
7774     if test "$with_export_validation" = "no"; then
7775         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7776     fi
7778     if test "$with_bffvalidator" = "yes"; then
7779         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7780     else
7781         BFFVALIDATOR="$with_bffvalidator"
7782     fi
7784     if test "$build_os" = "cygwin"; then
7785         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7786             AC_MSG_RESULT($BFFVALIDATOR)
7787         else
7788             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7789         fi
7790     elif test -n "$BFFVALIDATOR"; then
7791         # We are not in Cygwin but need to run Windows binary with wine
7792         AC_PATH_PROGS(WINE, wine)
7794         # so swap in a shell wrapper that converts paths transparently
7795         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7796         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7797         AC_SUBST(BFFVALIDATOR_EXE)
7798         AC_MSG_RESULT($BFFVALIDATOR)
7799     else
7800         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7801     fi
7802     AC_SUBST(BFFVALIDATOR)
7803 else
7804     AC_MSG_RESULT([no])
7807 dnl ===================================================================
7808 dnl Check for C preprocessor to use
7809 dnl ===================================================================
7810 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7811 if test -n "$with_idlc_cpp"; then
7812     AC_MSG_RESULT([$with_idlc_cpp])
7813     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7814 else
7815     AC_MSG_RESULT([ucpp])
7816     AC_MSG_CHECKING([which ucpp tp use])
7817     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7818         AC_MSG_RESULT([external])
7819         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7820     else
7821         AC_MSG_RESULT([internal])
7822         BUILD_TYPE="$BUILD_TYPE UCPP"
7823     fi
7825 AC_SUBST(SYSTEM_UCPP)
7827 dnl ===================================================================
7828 dnl Check for epm (not needed for Windows)
7829 dnl ===================================================================
7830 AC_MSG_CHECKING([whether to enable EPM for packing])
7831 if test "$enable_epm" = "yes"; then
7832     AC_MSG_RESULT([yes])
7833     if test "$_os" != "WINNT"; then
7834         if test $_os = Darwin; then
7835             EPM=internal
7836         elif test -n "$with_epm"; then
7837             EPM=$with_epm
7838         else
7839             AC_PATH_PROG(EPM, epm, no)
7840         fi
7841         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7842             AC_MSG_NOTICE([EPM will be built.])
7843             BUILD_TYPE="$BUILD_TYPE EPM"
7844             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7845         else
7846             # Gentoo has some epm which is something different...
7847             AC_MSG_CHECKING([whether the found epm is the right epm])
7848             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7849                 AC_MSG_RESULT([yes])
7850             else
7851                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7852             fi
7853             AC_MSG_CHECKING([epm version])
7854             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7855             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7856                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7857                 AC_MSG_RESULT([OK, >= 3.7])
7858             else
7859                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7860                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7861             fi
7862         fi
7863     fi
7865     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7866         AC_MSG_CHECKING([for rpm])
7867         for a in "$RPM" rpmbuild rpm; do
7868             $a --usage >/dev/null 2> /dev/null
7869             if test $? -eq 0; then
7870                 RPM=$a
7871                 break
7872             else
7873                 $a --version >/dev/null 2> /dev/null
7874                 if test $? -eq 0; then
7875                     RPM=$a
7876                     break
7877                 fi
7878             fi
7879         done
7880         if test -z "$RPM"; then
7881             AC_MSG_ERROR([not found])
7882         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7883             RPM_PATH=`which $RPM`
7884             AC_MSG_RESULT([$RPM_PATH])
7885             SCPDEFS="$SCPDEFS -DWITH_RPM"
7886         else
7887             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7888         fi
7889     fi
7890     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7891         AC_PATH_PROG(DPKG, dpkg, no)
7892         if test "$DPKG" = "no"; then
7893             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7894         fi
7895     fi
7896     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7897        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7898         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7899             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7900                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7901                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7902                     AC_MSG_RESULT([yes])
7903                 else
7904                     AC_MSG_RESULT([no])
7905                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7906                         _pt="rpm"
7907                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7908                         add_warning "the rpms will need to be installed with --nodeps"
7909                     else
7910                         _pt="pkg"
7911                     fi
7912                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7913                     add_warning "the ${_pt}s will not be relocatable"
7914                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7915                                  relocation will work, you need to patch your epm with the
7916                                  patch in epm/epm-3.7.patch or build with
7917                                  --with-epm=internal which will build a suitable epm])
7918                 fi
7919             fi
7920         fi
7921     fi
7922     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7923         AC_PATH_PROG(PKGMK, pkgmk, no)
7924         if test "$PKGMK" = "no"; then
7925             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7926         fi
7927     fi
7928     AC_SUBST(RPM)
7929     AC_SUBST(DPKG)
7930     AC_SUBST(PKGMK)
7931 else
7932     for i in $PKGFORMAT; do
7933         case "$i" in
7934         aix | bsd | deb | pkg | rpm | native | portable)
7935             AC_MSG_ERROR(
7936                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7937             ;;
7938         esac
7939     done
7940     AC_MSG_RESULT([no])
7941     EPM=NO
7943 AC_SUBST(EPM)
7945 ENABLE_LWP=
7946 if test "$enable_lotuswordpro" = "yes"; then
7947     ENABLE_LWP="TRUE"
7949 AC_SUBST(ENABLE_LWP)
7951 dnl ===================================================================
7952 dnl Check for building ODK
7953 dnl ===================================================================
7954 if test "$enable_odk" = no; then
7955     unset DOXYGEN
7956 else
7957     if test "$with_doxygen" = no; then
7958         AC_MSG_CHECKING([for doxygen])
7959         unset DOXYGEN
7960         AC_MSG_RESULT([no])
7961     else
7962         if test "$with_doxygen" = yes; then
7963             AC_PATH_PROG([DOXYGEN], [doxygen])
7964             if test -z "$DOXYGEN"; then
7965                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7966             fi
7967             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7968                 if ! dot -V 2>/dev/null; then
7969                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7970                 fi
7971             fi
7972         else
7973             AC_MSG_CHECKING([for doxygen])
7974             DOXYGEN=$with_doxygen
7975             AC_MSG_RESULT([$DOXYGEN])
7976         fi
7977         if test -n "$DOXYGEN"; then
7978             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7979             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7980             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7981                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7982             fi
7983         fi
7984     fi
7986 AC_SUBST([DOXYGEN])
7988 AC_MSG_CHECKING([whether to build the ODK])
7989 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7990     AC_MSG_RESULT([yes])
7992     if test "$with_java" != "no"; then
7993         AC_MSG_CHECKING([whether to build unowinreg.dll])
7994         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7995             # build on Win by default
7996             enable_build_unowinreg=yes
7997         fi
7998         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7999             AC_MSG_RESULT([no])
8000             BUILD_UNOWINREG=
8001         else
8002             AC_MSG_RESULT([yes])
8003             BUILD_UNOWINREG=TRUE
8004         fi
8005         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8006             if test -z "$with_mingw_cross_compiler"; then
8007                 dnl Guess...
8008                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8009             elif test -x "$with_mingw_cross_compiler"; then
8010                  MINGWCXX="$with_mingw_cross_compiler"
8011             else
8012                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8013             fi
8015             if test "$MINGWCXX" = "false"; then
8016                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8017             fi
8019             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8020             if test -x "$mingwstrip_test"; then
8021                 MINGWSTRIP="$mingwstrip_test"
8022             else
8023                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8024             fi
8026             if test "$MINGWSTRIP" = "false"; then
8027                 AC_MSG_ERROR(MinGW32 binutils not found.)
8028             fi
8029         fi
8030     fi
8031     BUILD_TYPE="$BUILD_TYPE ODK"
8032 else
8033     AC_MSG_RESULT([no])
8034     BUILD_UNOWINREG=
8036 AC_SUBST(BUILD_UNOWINREG)
8037 AC_SUBST(MINGWCXX)
8038 AC_SUBST(MINGWSTRIP)
8040 dnl ===================================================================
8041 dnl Check for system zlib
8042 dnl ===================================================================
8043 if test "$with_system_zlib" = "auto"; then
8044     case "$_os" in
8045     WINNT)
8046         with_system_zlib="$with_system_libs"
8047         ;;
8048     *)
8049         if test "$enable_fuzzers" != "yes"; then
8050             with_system_zlib=yes
8051         else
8052             with_system_zlib=no
8053         fi
8054         ;;
8055     esac
8058 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8059 dnl and has no pkg-config for it at least on some tinderboxes,
8060 dnl so leaving that out for now
8061 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8062 AC_MSG_CHECKING([which zlib to use])
8063 if test "$with_system_zlib" = "yes"; then
8064     AC_MSG_RESULT([external])
8065     SYSTEM_ZLIB=TRUE
8066     AC_CHECK_HEADER(zlib.h, [],
8067         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8068     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8069         [AC_MSG_ERROR(zlib not found or functional)], [])
8070 else
8071     AC_MSG_RESULT([internal])
8072     SYSTEM_ZLIB=
8073     BUILD_TYPE="$BUILD_TYPE ZLIB"
8074     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8075     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8077 AC_SUBST(ZLIB_CFLAGS)
8078 AC_SUBST(ZLIB_LIBS)
8079 AC_SUBST(SYSTEM_ZLIB)
8081 dnl ===================================================================
8082 dnl Check for system jpeg
8083 dnl ===================================================================
8084 AC_MSG_CHECKING([which libjpeg to use])
8085 if test "$with_system_jpeg" = "yes"; then
8086     AC_MSG_RESULT([external])
8087     SYSTEM_LIBJPEG=TRUE
8088     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8089         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8090     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8091         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8092 else
8093     SYSTEM_LIBJPEG=
8094     AC_MSG_RESULT([internal, libjpeg-turbo])
8095     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8096     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8097     if test "$COM" = "MSC"; then
8098         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8099     else
8100         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8101     fi
8103     case "$host_cpu" in
8104     x86_64 | amd64 | i*86 | x86 | ia32)
8105         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8106         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8107             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8108                 NASM="$LODE_HOME/opt/bin/nasm"
8109             elif test -x "/opt/lo/bin/nasm"; then
8110                 NASM="/opt/lo/bin/nasm"
8111             fi
8112         fi
8114         if test -n "$NASM"; then
8115             AC_MSG_CHECKING([for object file format of host system])
8116             case "$host_os" in
8117               cygwin* | mingw* | pw32* | interix*)
8118                 case "$host_cpu" in
8119                   x86_64)
8120                     objfmt='Win64-COFF'
8121                     ;;
8122                   *)
8123                     objfmt='Win32-COFF'
8124                     ;;
8125                 esac
8126               ;;
8127               msdosdjgpp* | go32*)
8128                 objfmt='COFF'
8129               ;;
8130               os2-emx*) # not tested
8131                 objfmt='MSOMF' # obj
8132               ;;
8133               linux*coff* | linux*oldld*)
8134                 objfmt='COFF' # ???
8135               ;;
8136               linux*aout*)
8137                 objfmt='a.out'
8138               ;;
8139               linux*)
8140                 case "$host_cpu" in
8141                   x86_64)
8142                     objfmt='ELF64'
8143                     ;;
8144                   *)
8145                     objfmt='ELF'
8146                     ;;
8147                 esac
8148               ;;
8149               kfreebsd* | freebsd* | netbsd* | openbsd*)
8150                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8151                   objfmt='BSD-a.out'
8152                 else
8153                   case "$host_cpu" in
8154                     x86_64 | amd64)
8155                       objfmt='ELF64'
8156                       ;;
8157                     *)
8158                       objfmt='ELF'
8159                       ;;
8160                   esac
8161                 fi
8162               ;;
8163               solaris* | sunos* | sysv* | sco*)
8164                 case "$host_cpu" in
8165                   x86_64)
8166                     objfmt='ELF64'
8167                     ;;
8168                   *)
8169                     objfmt='ELF'
8170                     ;;
8171                 esac
8172               ;;
8173               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8174                 case "$host_cpu" in
8175                   x86_64)
8176                     objfmt='Mach-O64'
8177                     ;;
8178                   *)
8179                     objfmt='Mach-O'
8180                     ;;
8181                 esac
8182               ;;
8183               *)
8184                 objfmt='ELF ?'
8185               ;;
8186             esac
8188             AC_MSG_RESULT([$objfmt])
8189             if test "$objfmt" = 'ELF ?'; then
8190               objfmt='ELF'
8191               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8192             fi
8194             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8195             case "$objfmt" in
8196               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8197               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8198               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8199               COFF)       NAFLAGS='-fcoff -DCOFF';;
8200               a.out)      NAFLAGS='-faout -DAOUT';;
8201               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8202               ELF)        NAFLAGS='-felf -DELF';;
8203               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8204               RDF)        NAFLAGS='-frdf -DRDF';;
8205               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8206               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8207             esac
8208             AC_MSG_RESULT([$NAFLAGS])
8210             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8211             cat > conftest.asm << EOF
8212             [%line __oline__ "configure"
8213                     section .text
8214                     global  _main,main
8215             _main:
8216             main:   xor     eax,eax
8217                     ret
8218             ]
8220             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8221             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8222               AC_MSG_RESULT(yes)
8223             else
8224               echo "configure: failed program was:" >&AC_FD_CC
8225               cat conftest.asm >&AC_FD_CC
8226               rm -rf conftest*
8227               AC_MSG_RESULT(no)
8228               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8229               NASM=""
8230             fi
8232         fi
8234         if test -z "$NASM"; then
8235 cat << _EOS
8236 ****************************************************************************
8237 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8238 To get one please:
8240 _EOS
8241             if test "$build_os" = "cygwin"; then
8242 cat << _EOS
8243 install a pre-compiled binary for Win32
8245 mkdir -p /opt/lo/bin
8246 cd /opt/lo/bin
8247 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8248 chmod +x nasm
8250 or get and install one from http://www.nasm.us/
8252 Then re-run autogen.sh
8254 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8255 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8257 _EOS
8258             else
8259 cat << _EOS
8260 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8262 _EOS
8263             fi
8264             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8265             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8266         fi
8267       ;;
8268     esac
8271 AC_SUBST(NASM)
8272 AC_SUBST(LIBJPEG_CFLAGS)
8273 AC_SUBST(LIBJPEG_LIBS)
8274 AC_SUBST(SYSTEM_LIBJPEG)
8276 dnl ===================================================================
8277 dnl Check for system clucene
8278 dnl ===================================================================
8279 dnl we should rather be using
8280 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8281 dnl but the contribs-lib check seems tricky
8282 AC_MSG_CHECKING([which clucene to use])
8283 if test "$with_system_clucene" = "yes"; then
8284     AC_MSG_RESULT([external])
8285     SYSTEM_CLUCENE=TRUE
8286     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8287     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8288     FilterLibs "${CLUCENE_LIBS}"
8289     CLUCENE_LIBS="${filteredlibs}"
8290     AC_LANG_PUSH([C++])
8291     save_CXXFLAGS=$CXXFLAGS
8292     save_CPPFLAGS=$CPPFLAGS
8293     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8294     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8295     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8296     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8297     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8298                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8299     CXXFLAGS=$save_CXXFLAGS
8300     CPPFLAGS=$save_CPPFLAGS
8301     AC_LANG_POP([C++])
8303     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8304 else
8305     AC_MSG_RESULT([internal])
8306     SYSTEM_CLUCENE=
8307     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8309 AC_SUBST(SYSTEM_CLUCENE)
8310 AC_SUBST(CLUCENE_CFLAGS)
8311 AC_SUBST(CLUCENE_LIBS)
8313 dnl ===================================================================
8314 dnl Check for system expat
8315 dnl ===================================================================
8316 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8318 dnl ===================================================================
8319 dnl Check for system xmlsec
8320 dnl ===================================================================
8321 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8323 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8324 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8325     ENABLE_EOT="TRUE"
8326     AC_DEFINE([ENABLE_EOT])
8327     AC_MSG_RESULT([yes])
8329     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8330 else
8331     ENABLE_EOT=
8332     AC_MSG_RESULT([no])
8334 AC_SUBST([ENABLE_EOT])
8336 dnl ===================================================================
8337 dnl Check for DLP libs
8338 dnl ===================================================================
8339 AS_IF([test "$COM" = "MSC"],
8340       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8341       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8343 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8345 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8347 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8349 AS_IF([test "$COM" = "MSC"],
8350       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8351       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8353 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8355 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8357 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8358 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8360 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8362 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8364 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8366 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8367 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8369 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8370 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8372 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8374 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8375 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8377 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8379 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8381 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8383 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8385 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8386 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8388 dnl ===================================================================
8389 dnl Check for system lcms2
8390 dnl ===================================================================
8391 if test "$with_system_lcms2" != "yes"; then
8392     SYSTEM_LCMS2=
8394 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8395 if test "$GCC" = "yes"; then
8396     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8398 if test "$COM" = "MSC"; then # override the above
8399     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8402 dnl ===================================================================
8403 dnl Check for system cppunit
8404 dnl ===================================================================
8405 if test "$_os" != "Android" ; then
8406     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8409 dnl ===================================================================
8410 dnl Check whether freetype is available
8411 dnl ===================================================================
8412 if test  "$test_freetype" = "yes"; then
8413     AC_MSG_CHECKING([whether freetype is available])
8414     # FreeType has 3 different kinds of versions
8415     # * release, like 2.4.10
8416     # * libtool, like 13.0.7 (this what pkg-config returns)
8417     # * soname
8418     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8419     #
8420     # 9.9.3 is 2.2.0
8421     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8422     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8423     FilterLibs "${FREETYPE_LIBS}"
8424     FREETYPE_LIBS="${filteredlibs}"
8425     SYSTEM_FREETYPE=TRUE
8426 else
8427     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8428     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8430 AC_SUBST(FREETYPE_CFLAGS)
8431 AC_SUBST(FREETYPE_LIBS)
8432 AC_SUBST([SYSTEM_FREETYPE])
8434 # ===================================================================
8435 # Check for system libxslt
8436 # to prevent incompatibilities between internal libxml2 and external libxslt,
8437 # or vice versa, use with_system_libxml here
8438 # ===================================================================
8439 if test "$with_system_libxml" = "auto"; then
8440     case "$_os" in
8441     WINNT|iOS|Android)
8442         with_system_libxml="$with_system_libs"
8443         ;;
8444     *)
8445         if test "$enable_fuzzers" != "yes"; then
8446             with_system_libxml=yes
8447         else
8448             with_system_libxml=no
8449         fi
8450         ;;
8451     esac
8454 AC_MSG_CHECKING([which libxslt to use])
8455 if test "$with_system_libxml" = "yes"; then
8456     AC_MSG_RESULT([external])
8457     SYSTEM_LIBXSLT=TRUE
8458     if test "$_os" = "Darwin"; then
8459         dnl make sure to use SDK path
8460         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8461         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8462         dnl omit -L/usr/lib
8463         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8464         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8465     else
8466         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8467         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8468         FilterLibs "${LIBXSLT_LIBS}"
8469         LIBXSLT_LIBS="${filteredlibs}"
8470         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8471         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8472         FilterLibs "${LIBEXSLT_LIBS}"
8473         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8474     fi
8476     dnl Check for xsltproc
8477     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8478     if test "$XSLTPROC" = "no"; then
8479         AC_MSG_ERROR([xsltproc is required])
8480     fi
8481 else
8482     AC_MSG_RESULT([internal])
8483     SYSTEM_LIBXSLT=
8484     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8486     if test "$cross_compiling" = "yes"; then
8487         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8488         if test "$XSLTPROC" = "no"; then
8489             AC_MSG_ERROR([xsltproc is required])
8490         fi
8491     fi
8493 AC_SUBST(SYSTEM_LIBXSLT)
8494 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8495     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8497 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8499 AC_SUBST(LIBEXSLT_CFLAGS)
8500 AC_SUBST(LIBEXSLT_LIBS)
8501 AC_SUBST(LIBXSLT_CFLAGS)
8502 AC_SUBST(LIBXSLT_LIBS)
8503 AC_SUBST(XSLTPROC)
8505 # ===================================================================
8506 # Check for system libxml
8507 # ===================================================================
8508 AC_MSG_CHECKING([which libxml to use])
8509 if test "$with_system_libxml" = "yes"; then
8510     AC_MSG_RESULT([external])
8511     SYSTEM_LIBXML=TRUE
8512     if test "$_os" = "Darwin"; then
8513         dnl make sure to use SDK path
8514         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8515         dnl omit -L/usr/lib
8516         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8517     elif test $_os = iOS; then
8518         dnl make sure to use SDK path
8519         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8520         LIBXML_CFLAGS="-I$usr/include/libxml2"
8521         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8522     else
8523         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8524         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8525         FilterLibs "${LIBXML_LIBS}"
8526         LIBXML_LIBS="${filteredlibs}"
8527     fi
8529     dnl Check for xmllint
8530     AC_PATH_PROG(XMLLINT, xmllint, no)
8531     if test "$XMLLINT" = "no"; then
8532         AC_MSG_ERROR([xmllint is required])
8533     fi
8534 else
8535     AC_MSG_RESULT([internal])
8536     SYSTEM_LIBXML=
8537     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8538     if test "$COM" = "MSC"; then
8539         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8540     fi
8541     if test "$COM" = "MSC"; then
8542         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8543     else
8544         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8545     fi
8546     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8548 AC_SUBST(SYSTEM_LIBXML)
8549 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8550     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8552 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8553 AC_SUBST(LIBXML_CFLAGS)
8554 AC_SUBST(LIBXML_LIBS)
8555 AC_SUBST(XMLLINT)
8557 # =====================================================================
8558 # Checking for a Python interpreter with version >= 2.7.
8559 # Build and runtime requires Python 3 compatible version (>= 2.7).
8560 # Optionally user can pass an option to configure, i. e.
8561 # ./configure PYTHON=/usr/bin/python
8562 # =====================================================================
8563 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8564     if test -n "$PYTHON"; then
8565         PYTHON_FOR_BUILD=$PYTHON
8566     else
8567         # This allows a lack of system python with no error, we use internal one in that case.
8568         AM_PATH_PYTHON([2.7],, [:])
8569         # Clean PYTHON_VERSION checked below if cross-compiling
8570         PYTHON_VERSION=""
8571         if test "$PYTHON" != ":"; then
8572             PYTHON_FOR_BUILD=$PYTHON
8573         fi
8574     fi
8576 AC_SUBST(PYTHON_FOR_BUILD)
8578 # Checks for Python to use for Pyuno
8579 AC_MSG_CHECKING([which Python to use for Pyuno])
8580 case "$enable_python" in
8581 no|disable)
8582     if test -z $PYTHON_FOR_BUILD; then
8583         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8584         # requirement from the choice whether to include Python stuff in the installer, but why
8585         # bother?
8586         AC_MSG_ERROR([Python is required at build time.])
8587     fi
8588     enable_python=no
8589     AC_MSG_RESULT([none])
8590     ;;
8591 ""|yes|auto)
8592     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8593         AC_MSG_RESULT([no, overridden by --disable-scripting])
8594         enable_python=no
8595     elif test $build_os = cygwin; then
8596         dnl When building on Windows we don't attempt to use any installed
8597         dnl "system"  Python.
8598         AC_MSG_RESULT([fully internal])
8599         enable_python=internal
8600     elif test "$cross_compiling" = yes; then
8601         AC_MSG_RESULT([system])
8602         enable_python=system
8603     else
8604         # Unset variables set by the above AM_PATH_PYTHON so that
8605         # we actually do check anew.
8606         AC_MSG_RESULT([])
8607         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
8608         AM_PATH_PYTHON([3.3],, [:])
8609         AC_MSG_CHECKING([which Python to use for Pyuno])
8610         if test "$PYTHON" = ":"; then
8611             if test -z "$PYTHON_FOR_BUILD"; then
8612                 AC_MSG_RESULT([fully internal])
8613             else
8614                 AC_MSG_RESULT([internal])
8615             fi
8616             enable_python=internal
8617         else
8618             AC_MSG_RESULT([system])
8619             enable_python=system
8620         fi
8621     fi
8622     ;;
8623 internal)
8624     AC_MSG_RESULT([internal])
8625     ;;
8626 fully-internal)
8627     AC_MSG_RESULT([fully internal])
8628     enable_python=internal
8629     ;;
8630 system)
8631     AC_MSG_RESULT([system])
8632     if test "$_os" = Darwin; then
8633         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])
8634     fi
8635     ;;
8637     AC_MSG_ERROR([Incorrect --enable-python option])
8638     ;;
8639 esac
8641 if test $enable_python != no; then
8642     BUILD_TYPE="$BUILD_TYPE PYUNO"
8645 if test $enable_python = system; then
8646     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8647         # Fallback: Accept these in the environment, or as set above
8648         # for MacOSX.
8649         :
8650     elif test "$cross_compiling" != yes; then
8651         # Unset variables set by the above AM_PATH_PYTHON so that
8652         # we actually do check anew.
8653         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
8654         # This causes an error if no python command is found
8655         AM_PATH_PYTHON([3.3])
8656         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8657         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8658         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8659         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8660         if test -z "$PKG_CONFIG"; then
8661             PYTHON_CFLAGS="-I$python_include"
8662             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8663         elif $PKG_CONFIG --exists python-$python_version-embed; then
8664             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8665             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8666         elif $PKG_CONFIG --exists python-$python_version; then
8667             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8668             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8669         else
8670             PYTHON_CFLAGS="-I$python_include"
8671             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8672         fi
8673         FilterLibs "${PYTHON_LIBS}"
8674         PYTHON_LIBS="${filteredlibs}"
8675     else
8676         dnl How to find out the cross-compilation Python installation path?
8677         AC_MSG_CHECKING([for python version])
8678         AS_IF([test -n "$PYTHON_VERSION"],
8679               [AC_MSG_RESULT([$PYTHON_VERSION])],
8680               [AC_MSG_RESULT([not found])
8681                AC_MSG_ERROR([no usable python found])])
8682         test -n "$PYTHON_CFLAGS" && break
8683     fi
8685     dnl Check if the headers really work
8686     save_CPPFLAGS="$CPPFLAGS"
8687     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8688     AC_CHECK_HEADER(Python.h)
8689     CPPFLAGS="$save_CPPFLAGS"
8691     # let the PYTHON_FOR_BUILD match the same python installation that
8692     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8693     # better for PythonTests.
8694     PYTHON_FOR_BUILD=$PYTHON
8697 if test "$with_lxml" != no; then
8698     if test -z "$PYTHON_FOR_BUILD"; then
8699         case $build_os in
8700             cygwin)
8701                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8702                 ;;
8703             *)
8704                 if test "$cross_compiling" != yes ; then
8705                     BUILD_TYPE="$BUILD_TYPE LXML"
8706                 fi
8707                 ;;
8708         esac
8709     else
8710         AC_MSG_CHECKING([for python lxml])
8711         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8712             AC_MSG_RESULT([yes])
8713         else
8714             case $build_os in
8715                 cygwin)
8716                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8717                     ;;
8718                 *)
8719                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8720                         BUILD_TYPE="$BUILD_TYPE LXML"
8721                         AC_MSG_RESULT([no, using internal lxml])
8722                     else
8723                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8724                     fi
8725                     ;;
8726             esac
8727         fi
8728     fi
8731 dnl By now enable_python should be "system", "internal" or "no"
8732 case $enable_python in
8733 system)
8734     SYSTEM_PYTHON=TRUE
8736     if test "x$ac_cv_header_Python_h" != "xyes"; then
8737        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8738     fi
8740     AC_LANG_PUSH(C)
8741     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8742     AC_MSG_CHECKING([for correct python library version])
8743        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8744 #include <Python.h>
8746 int main(int argc, char **argv) {
8747    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8748        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8749    else return 1;
8751        ]])],[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])])
8752     CFLAGS=$save_CFLAGS
8753     AC_LANG_POP(C)
8755     dnl FIXME Check if the Python library can be linked with, too?
8756     ;;
8758 internal)
8759     SYSTEM_PYTHON=
8760     PYTHON_VERSION_MAJOR=3
8761     PYTHON_VERSION_MINOR=5
8762     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8763     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8764         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8765     fi
8766     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8767     BUILD_TYPE="$BUILD_TYPE PYTHON"
8768     # Embedded Python dies without Home set
8769     if test "$HOME" = ""; then
8770         export HOME=""
8771     fi
8772     ;;
8774     DISABLE_PYTHON=TRUE
8775     SYSTEM_PYTHON=
8776     ;;
8778     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8779     ;;
8780 esac
8782 AC_SUBST(DISABLE_PYTHON)
8783 AC_SUBST(SYSTEM_PYTHON)
8784 AC_SUBST(PYTHON_CFLAGS)
8785 AC_SUBST(PYTHON_LIBS)
8786 AC_SUBST(PYTHON_VERSION)
8787 AC_SUBST(PYTHON_VERSION_MAJOR)
8788 AC_SUBST(PYTHON_VERSION_MINOR)
8790 ENABLE_MARIADBC=TRUE
8791 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8792     ENABLE_MARIADBC=
8794 MARIADBC_MAJOR=1
8795 MARIADBC_MINOR=0
8796 MARIADBC_MICRO=2
8797 if test "$ENABLE_MARIADBC" = "TRUE"; then
8798     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8801 AC_SUBST(ENABLE_MARIADBC)
8802 AC_SUBST(MARIADBC_MAJOR)
8803 AC_SUBST(MARIADBC_MINOR)
8804 AC_SUBST(MARIADBC_MICRO)
8806 if test "$ENABLE_MARIADBC" = "TRUE"; then
8807     dnl ===================================================================
8808     dnl Check for system MariaDB
8809     dnl ===================================================================
8810     AC_MSG_CHECKING([which MariaDB to use])
8811     if test "$with_system_mariadb" = "yes"; then
8812         AC_MSG_RESULT([external])
8813         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8814         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8815         if test -z "$MARIADBCONFIG"; then
8816             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8817             if test -z "$MARIADBCONFIG"; then
8818                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8819                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8820             fi
8821         fi
8822         AC_MSG_CHECKING([MariaDB version])
8823         MARIADB_VERSION=`$MARIADBCONFIG --version`
8824         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8825         if test "$MARIADB_MAJOR" -ge "5"; then
8826             AC_MSG_RESULT([OK])
8827         else
8828             AC_MSG_ERROR([too old, use 5.0.x or later])
8829         fi
8830         AC_MSG_CHECKING([for MariaDB Client library])
8831         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8832         if test "$COM_IS_CLANG" = TRUE; then
8833             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8834         fi
8835         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8836         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8837         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8838         dnl linux32:
8839         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8840             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8841             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8842                 | sed -e 's|/lib64/|/lib/|')
8843         fi
8844         FilterLibs "${MARIADB_LIBS}"
8845         MARIADB_LIBS="${filteredlibs}"
8846         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8847         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8848         if test "$enable_bundle_mariadb" = "yes"; then
8849             AC_MSG_RESULT([yes])
8850             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8851             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8853 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8855 /g' | grep -E '(mysqlclient|mariadb)')
8856             if test "$_os" = "Darwin"; then
8857                 LIBMARIADB=${LIBMARIADB}.dylib
8858             elif test "$_os" = "WINNT"; then
8859                 LIBMARIADB=${LIBMARIADB}.dll
8860             else
8861                 LIBMARIADB=${LIBMARIADB}.so
8862             fi
8863             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8864             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8865             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8866                 AC_MSG_RESULT([found.])
8867                 PathFormat "$LIBMARIADB_PATH"
8868                 LIBMARIADB_PATH="$formatted_path"
8869             else
8870                 AC_MSG_ERROR([not found.])
8871             fi
8872         else
8873             AC_MSG_RESULT([no])
8874             BUNDLE_MARIADB_CONNECTOR_C=
8875         fi
8876     else
8877         AC_MSG_RESULT([internal])
8878         SYSTEM_MARIADB_CONNECTOR_C=
8879         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8880         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8881         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8882     fi
8884     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8885     AC_SUBST(MARIADB_CFLAGS)
8886     AC_SUBST(MARIADB_LIBS)
8887     AC_SUBST(LIBMARIADB)
8888     AC_SUBST(LIBMARIADB_PATH)
8889     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8892 dnl ===================================================================
8893 dnl Check for system hsqldb
8894 dnl ===================================================================
8895 if test "$with_java" != "no"; then
8896     HSQLDB_USE_JDBC_4_1=
8897     AC_MSG_CHECKING([which hsqldb to use])
8898     if test "$with_system_hsqldb" = "yes"; then
8899         AC_MSG_RESULT([external])
8900         SYSTEM_HSQLDB=TRUE
8901         if test -z $HSQLDB_JAR; then
8902             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8903         fi
8904         if ! test -f $HSQLDB_JAR; then
8905                AC_MSG_ERROR(hsqldb.jar not found.)
8906         fi
8907         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8908         export HSQLDB_JAR
8909         if $PERL -e \
8910            'use Archive::Zip;
8911             my $file = "$ENV{'HSQLDB_JAR'}";
8912             my $zip = Archive::Zip->new( $file );
8913             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8914             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8915             {
8916                 push @l, split(/\n/, $mf);
8917                 foreach my $line (@l)
8918                 {
8919                     if ($line =~ m/Specification-Version:/)
8920                     {
8921                         ($t, $version) = split (/:/,$line);
8922                         $version =~ s/^\s//;
8923                         ($a, $b, $c, $d) = split (/\./,$version);
8924                         if ($c == "0" && $d > "8")
8925                         {
8926                             exit 0;
8927                         }
8928                         else
8929                         {
8930                             exit 1;
8931                         }
8932                     }
8933                 }
8934             }
8935             else
8936             {
8937                 exit 1;
8938             }'; then
8939             AC_MSG_RESULT([yes])
8940         else
8941             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8942         fi
8943     else
8944         AC_MSG_RESULT([internal])
8945         SYSTEM_HSQLDB=
8946         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8947         NEED_ANT=TRUE
8948         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8949         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8950         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8951             AC_MSG_RESULT([yes])
8952             HSQLDB_USE_JDBC_4_1=TRUE
8953         else
8954             AC_MSG_RESULT([no])
8955         fi
8956     fi
8957     AC_SUBST(SYSTEM_HSQLDB)
8958     AC_SUBST(HSQLDB_JAR)
8959     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8962 dnl ===================================================================
8963 dnl Check for PostgreSQL stuff
8964 dnl ===================================================================
8965 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8966 if test "x$enable_postgresql_sdbc" != "xno"; then
8967     AC_MSG_RESULT([yes])
8968     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8970     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8971         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8972     fi
8973     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8974         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8975     fi
8977     postgres_interface=""
8978     if test "$with_system_postgresql" = "yes"; then
8979         postgres_interface="external PostgreSQL"
8980         SYSTEM_POSTGRESQL=TRUE
8981         if test "$_os" = Darwin; then
8982             supp_path=''
8983             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8984                 pg_supp_path="$P_SEP$d$pg_supp_path"
8985             done
8986         fi
8987         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8988         if test -n "$PGCONFIG"; then
8989             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8990             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8991         else
8992             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8993               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8994               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8995             ],[
8996               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8997             ])
8998         fi
8999         FilterLibs "${POSTGRESQL_LIB}"
9000         POSTGRESQL_LIB="${filteredlibs}"
9001     else
9002         # if/when anything else than PostgreSQL uses Kerberos,
9003         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9004         WITH_KRB5=
9005         WITH_GSSAPI=
9006         case "$_os" in
9007         Darwin)
9008             # macOS has system MIT Kerberos 5 since 10.4
9009             if test "$with_krb5" != "no"; then
9010                 WITH_KRB5=TRUE
9011                 save_LIBS=$LIBS
9012                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9013                 # that the libraries where these functions are located on macOS will change, is it?
9014                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9015                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9016                 KRB5_LIBS=$LIBS
9017                 LIBS=$save_LIBS
9018                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9019                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9020                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9021                 LIBS=$save_LIBS
9022             fi
9023             if test "$with_gssapi" != "no"; then
9024                 WITH_GSSAPI=TRUE
9025                 save_LIBS=$LIBS
9026                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9027                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9028                 GSSAPI_LIBS=$LIBS
9029                 LIBS=$save_LIBS
9030             fi
9031             ;;
9032         WINNT)
9033             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9034                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9035             fi
9036             ;;
9037         Linux|GNU|*BSD|DragonFly)
9038             if test "$with_krb5" != "no"; then
9039                 WITH_KRB5=TRUE
9040                 save_LIBS=$LIBS
9041                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9042                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9043                 KRB5_LIBS=$LIBS
9044                 LIBS=$save_LIBS
9045                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9046                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9047                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9048                 LIBS=$save_LIBS
9049             fi
9050             if test "$with_gssapi" != "no"; then
9051                 WITH_GSSAPI=TRUE
9052                 save_LIBS=$LIBS
9053                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9054                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9055                 GSSAPI_LIBS=$LIBS
9056                 LIBS=$save_LIBS
9057             fi
9058             ;;
9059         *)
9060             if test "$with_krb5" = "yes"; then
9061                 WITH_KRB5=TRUE
9062                 save_LIBS=$LIBS
9063                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9064                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9065                 KRB5_LIBS=$LIBS
9066                 LIBS=$save_LIBS
9067                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9068                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9069                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9070                 LIBS=$save_LIBS
9071             fi
9072             if test "$with_gssapi" = "yes"; then
9073                 WITH_GSSAPI=TRUE
9074                 save_LIBS=$LIBS
9075                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9076                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9077                 LIBS=$save_LIBS
9078                 GSSAPI_LIBS=$LIBS
9079             fi
9080         esac
9082         if test -n "$with_libpq_path"; then
9083             SYSTEM_POSTGRESQL=TRUE
9084             postgres_interface="external libpq"
9085             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9086             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9087         else
9088             SYSTEM_POSTGRESQL=
9089             postgres_interface="internal"
9090             POSTGRESQL_LIB=""
9091             POSTGRESQL_INC="%OVERRIDE_ME%"
9092             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9093         fi
9094     fi
9096     AC_MSG_CHECKING([PostgreSQL C interface])
9097     AC_MSG_RESULT([$postgres_interface])
9099     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9100         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9101         save_CFLAGS=$CFLAGS
9102         save_CPPFLAGS=$CPPFLAGS
9103         save_LIBS=$LIBS
9104         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9105         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9106         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9107         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9108             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9109         CFLAGS=$save_CFLAGS
9110         CPPFLAGS=$save_CPPFLAGS
9111         LIBS=$save_LIBS
9112     fi
9113     BUILD_POSTGRESQL_SDBC=TRUE
9114 else
9115     AC_MSG_RESULT([no])
9117 AC_SUBST(WITH_KRB5)
9118 AC_SUBST(WITH_GSSAPI)
9119 AC_SUBST(GSSAPI_LIBS)
9120 AC_SUBST(KRB5_LIBS)
9121 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9122 AC_SUBST(SYSTEM_POSTGRESQL)
9123 AC_SUBST(POSTGRESQL_INC)
9124 AC_SUBST(POSTGRESQL_LIB)
9126 dnl ===================================================================
9127 dnl Check for Firebird stuff
9128 dnl ===================================================================
9129 ENABLE_FIREBIRD_SDBC=
9130 if test "$enable_firebird_sdbc" = "yes" ; then
9131     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9133     dnl ===================================================================
9134     dnl Check for system Firebird
9135     dnl ===================================================================
9136     AC_MSG_CHECKING([which Firebird to use])
9137     if test "$with_system_firebird" = "yes"; then
9138         AC_MSG_RESULT([external])
9139         SYSTEM_FIREBIRD=TRUE
9140         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9141         if test -z "$FIREBIRDCONFIG"; then
9142             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9143             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9144                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9145             ])
9146             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9147         else
9148             AC_MSG_NOTICE([fb_config found])
9149             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9150             AC_MSG_CHECKING([for Firebird Client library])
9151             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9152             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9153             FilterLibs "${FIREBIRD_LIBS}"
9154             FIREBIRD_LIBS="${filteredlibs}"
9155         fi
9156         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9157         AC_MSG_CHECKING([Firebird version])
9158         if test -n "${FIREBIRD_VERSION}"; then
9159             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9160             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9161             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9162                 AC_MSG_RESULT([OK])
9163             else
9164                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9165             fi
9166         else
9167             __save_CFLAGS="${CFLAGS}"
9168             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9169             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9170 #if defined(FB_API_VER) && FB_API_VER == 30
9171 int fb_api_is_30(void) { return 0; }
9172 #else
9173 #error "Wrong Firebird API version"
9174 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9175             CFLAGS="${__save_CFLAGS}"
9176         fi
9177         ENABLE_FIREBIRD_SDBC=TRUE
9178         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9179     elif test "$enable_database_connectivity" != yes; then
9180         AC_MSG_RESULT([none])
9181     elif test "$cross_compiling" = "yes"; then
9182         AC_MSG_RESULT([none])
9183     else
9184         dnl Embedded Firebird has version 3.0
9185         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9186         dnl We need libatomic_ops for any non X86/X64 system
9187         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9188             dnl ===================================================================
9189             dnl Check for system libatomic_ops
9190             dnl ===================================================================
9191             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9192             if test "$with_system_libatomic_ops" = "yes"; then
9193                 SYSTEM_LIBATOMIC_OPS=TRUE
9194                 AC_CHECK_HEADERS(atomic_ops.h, [],
9195                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9196             else
9197                 SYSTEM_LIBATOMIC_OPS=
9198                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9199                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9200                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9201             fi
9202         fi
9204         AC_MSG_RESULT([internal])
9205         SYSTEM_FIREBIRD=
9206         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9207         FIREBIRD_LIBS="-lfbclient"
9209         if test "$with_system_libtommath" = "yes"; then
9210             SYSTEM_LIBTOMMATH=TRUE
9211             dnl check for tommath presence
9212             save_LIBS=$LIBS
9213             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9214             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9215             LIBS=$save_LIBS
9216         else
9217             SYSTEM_LIBTOMMATH=
9218             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9219             LIBTOMMATH_LIBS="-ltommath"
9220             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9221         fi
9223         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9224         ENABLE_FIREBIRD_SDBC=TRUE
9225         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9226     fi
9228 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9229 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9230 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9231 AC_SUBST(LIBATOMIC_OPS_LIBS)
9232 AC_SUBST(SYSTEM_FIREBIRD)
9233 AC_SUBST(FIREBIRD_CFLAGS)
9234 AC_SUBST(FIREBIRD_LIBS)
9235 AC_SUBST([TOMMATH_CFLAGS])
9236 AC_SUBST([TOMMATH_LIBS])
9238 dnl ===================================================================
9239 dnl Check for system curl
9240 dnl ===================================================================
9241 AC_MSG_CHECKING([which libcurl to use])
9242 if test "$with_system_curl" = "auto"; then
9243     with_system_curl="$with_system_libs"
9246 if test "$with_system_curl" = "yes"; then
9247     AC_MSG_RESULT([external])
9248     SYSTEM_CURL=TRUE
9250     # First try PKGCONFIG and then fall back
9251     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9253     if test -n "$CURL_PKG_ERRORS"; then
9254         AC_PATH_PROG(CURLCONFIG, curl-config)
9255         if test -z "$CURLCONFIG"; then
9256             AC_MSG_ERROR([curl development files not found])
9257         fi
9258         CURL_LIBS=`$CURLCONFIG --libs`
9259         FilterLibs "${CURL_LIBS}"
9260         CURL_LIBS="${filteredlibs}"
9261         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9262         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9264         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9265         case $curl_version in
9266         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9267         dnl so they need to be doubled to end up in the configure script
9268         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9269             AC_MSG_RESULT([yes])
9270             ;;
9271         *)
9272             AC_MSG_ERROR([no, you have $curl_version])
9273             ;;
9274         esac
9275     fi
9277     ENABLE_CURL=TRUE
9278 elif test $_os = iOS; then
9279     # Let's see if we need curl, I think not?
9280     AC_MSG_RESULT([none])
9281     ENABLE_CURL=
9282 else
9283     AC_MSG_RESULT([internal])
9284     SYSTEM_CURL=
9285     BUILD_TYPE="$BUILD_TYPE CURL"
9286     ENABLE_CURL=TRUE
9288 AC_SUBST(SYSTEM_CURL)
9289 AC_SUBST(CURL_CFLAGS)
9290 AC_SUBST(CURL_LIBS)
9291 AC_SUBST(ENABLE_CURL)
9293 dnl ===================================================================
9294 dnl Check for system boost
9295 dnl ===================================================================
9296 AC_MSG_CHECKING([which boost to use])
9297 if test "$with_system_boost" = "yes"; then
9298     AC_MSG_RESULT([external])
9299     SYSTEM_BOOST=TRUE
9300     AX_BOOST_BASE(1.47)
9301     AX_BOOST_DATE_TIME
9302     AX_BOOST_FILESYSTEM
9303     AX_BOOST_IOSTREAMS
9304     AX_BOOST_LOCALE
9305     AC_LANG_PUSH([C++])
9306     save_CXXFLAGS=$CXXFLAGS
9307     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9308     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9309        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9310     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9311        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9312     CXXFLAGS=$save_CXXFLAGS
9313     AC_LANG_POP([C++])
9314     # this is in m4/ax_boost_base.m4
9315     FilterLibs "${BOOST_LDFLAGS}"
9316     BOOST_LDFLAGS="${filteredlibs}"
9317 else
9318     AC_MSG_RESULT([internal])
9319     BUILD_TYPE="$BUILD_TYPE BOOST"
9320     SYSTEM_BOOST=
9321     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9322         # use warning-suppressing wrapper headers
9323         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9324     else
9325         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9326     fi
9328 AC_SUBST(SYSTEM_BOOST)
9330 dnl ===================================================================
9331 dnl Check for system mdds
9332 dnl ===================================================================
9333 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9335 dnl ===================================================================
9336 dnl Check for system glm
9337 dnl ===================================================================
9338 AC_MSG_CHECKING([which glm to use])
9339 if test "$with_system_glm" = "yes"; then
9340     AC_MSG_RESULT([external])
9341     SYSTEM_GLM=TRUE
9342     AC_LANG_PUSH([C++])
9343     AC_CHECK_HEADER([glm/glm.hpp], [],
9344        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9345     AC_LANG_POP([C++])
9346 else
9347     AC_MSG_RESULT([internal])
9348     BUILD_TYPE="$BUILD_TYPE GLM"
9349     SYSTEM_GLM=
9350     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9352 AC_SUBST([GLM_CFLAGS])
9353 AC_SUBST([SYSTEM_GLM])
9355 dnl ===================================================================
9356 dnl Check for system odbc
9357 dnl ===================================================================
9358 AC_MSG_CHECKING([which odbc headers to use])
9359 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
9360     AC_MSG_RESULT([external])
9361     SYSTEM_ODBC_HEADERS=TRUE
9363     if test "$build_os" = "cygwin"; then
9364         save_CPPFLAGS=$CPPFLAGS
9365         find_winsdk
9366         PathFormat "$winsdktest"
9367         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"
9368         AC_CHECK_HEADER(sqlext.h, [],
9369             [AC_MSG_ERROR(odbc not found. install odbc)],
9370             [#include <windows.h>])
9371         CPPFLAGS=$save_CPPFLAGS
9372     else
9373         AC_CHECK_HEADER(sqlext.h, [],
9374             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9375     fi
9376 elif test "$enable_database_connectivity" != yes; then
9377     AC_MSG_RESULT([none])
9378 else
9379     AC_MSG_RESULT([internal])
9380     SYSTEM_ODBC_HEADERS=
9382 AC_SUBST(SYSTEM_ODBC_HEADERS)
9384 dnl ===================================================================
9385 dnl Enable LDAP support
9386 dnl ===================================================================
9388 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9389 AC_MSG_CHECKING([whether to enable LDAP support])
9390     if test "$enable_ldap" != "yes"; then
9391         AC_MSG_RESULT([no])
9392         ENABLE_LDAP=""
9393         enable_ldap=no
9394     else
9395         AC_MSG_RESULT([yes])
9396         ENABLE_LDAP="TRUE"
9397         AC_DEFINE(HAVE_FEATURE_LDAP)
9398     fi
9400 AC_SUBST(ENABLE_LDAP)
9402 dnl ===================================================================
9403 dnl Check for system openldap
9404 dnl ===================================================================
9406 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9407 AC_MSG_CHECKING([which openldap library to use])
9408 if test "$with_system_openldap" = "yes"; then
9409     AC_MSG_RESULT([external])
9410     SYSTEM_OPENLDAP=TRUE
9411     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9412     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9413     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9414 else
9415     AC_MSG_RESULT([internal])
9416     SYSTEM_OPENLDAP=
9417     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9420 AC_SUBST(SYSTEM_OPENLDAP)
9422 dnl ===================================================================
9423 dnl Check for system NSS
9424 dnl ===================================================================
9425 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9426     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9427     AC_DEFINE(HAVE_FEATURE_NSS)
9428     ENABLE_NSS="TRUE"
9429     AC_DEFINE(ENABLE_NSS)
9430 elif test $_os != iOS ; then
9431     with_tls=openssl
9433 AC_SUBST(ENABLE_NSS)
9435 dnl ===================================================================
9436 dnl Check for TLS/SSL and cryptographic implementation to use
9437 dnl ===================================================================
9438 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9439 if test -n "$with_tls"; then
9440     case $with_tls in
9441     openssl)
9442         AC_DEFINE(USE_TLS_OPENSSL)
9443         TLS=OPENSSL
9445         if test "$enable_openssl" != "yes"; then
9446             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9447         fi
9449         # warn that OpenSSL has been selected but not all TLS code has this option
9450         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9451         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9452         ;;
9453     nss)
9454         AC_DEFINE(USE_TLS_NSS)
9455         TLS=NSS
9456         ;;
9457     no)
9458         AC_MSG_WARN([Skipping TLS/SSL])
9459         ;;
9460     *)
9461         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9462 openssl - OpenSSL
9463 nss - Mozilla's Network Security Services (NSS)
9464     ])
9465         ;;
9466     esac
9467 else
9468     # default to using NSS, it results in smaller oox lib
9469     AC_DEFINE(USE_TLS_NSS)
9470     TLS=NSS
9472 AC_MSG_RESULT([$TLS])
9473 AC_SUBST(TLS)
9475 dnl ===================================================================
9476 dnl Check for system sane
9477 dnl ===================================================================
9478 AC_MSG_CHECKING([which sane header to use])
9479 if test "$with_system_sane" = "yes"; then
9480     AC_MSG_RESULT([external])
9481     AC_CHECK_HEADER(sane/sane.h, [],
9482       [AC_MSG_ERROR(sane not found. install sane)], [])
9483 else
9484     AC_MSG_RESULT([internal])
9485     BUILD_TYPE="$BUILD_TYPE SANE"
9488 dnl ===================================================================
9489 dnl Check for system icu
9490 dnl ===================================================================
9491 SYSTEM_GENBRK=
9492 SYSTEM_GENCCODE=
9493 SYSTEM_GENCMN=
9495 ICU_MAJOR=65
9496 ICU_MINOR=1
9497 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9498 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9499 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9500 AC_MSG_CHECKING([which icu to use])
9501 if test "$with_system_icu" = "yes"; then
9502     AC_MSG_RESULT([external])
9503     SYSTEM_ICU=TRUE
9504     AC_LANG_PUSH([C++])
9505     AC_MSG_CHECKING([for unicode/rbbi.h])
9506     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9507     AC_LANG_POP([C++])
9509     if test "$cross_compiling" != "yes"; then
9510         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9511         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9512         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9513         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9514     fi
9516     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9517         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9518         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9519         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9520         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9521         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9522             AC_MSG_RESULT([yes])
9523         else
9524             AC_MSG_RESULT([no])
9525             if test "$with_system_icu_for_build" != "force"; then
9526                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9527 You can use --with-system-icu-for-build=force to use it anyway.])
9528             fi
9529         fi
9530     fi
9532     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9533         # using the system icu tools can lead to version confusion, use the
9534         # ones from the build environment when cross-compiling
9535         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9536         if test -z "$SYSTEM_GENBRK"; then
9537             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9538         fi
9539         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9540         if test -z "$SYSTEM_GENCCODE"; then
9541             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9542         fi
9543         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9544         if test -z "$SYSTEM_GENCMN"; then
9545             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9546         fi
9547         if test "$ICU_MAJOR" -ge "49"; then
9548             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9549             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9550             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9551         else
9552             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9553             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9554             ICU_RECLASSIFIED_HEBREW_LETTER=
9555         fi
9556     fi
9558     if test "$cross_compiling" = "yes"; then
9559         if test "$ICU_MAJOR" -ge "50"; then
9560             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9561             ICU_MINOR=""
9562         fi
9563     fi
9564 else
9565     AC_MSG_RESULT([internal])
9566     SYSTEM_ICU=
9567     BUILD_TYPE="$BUILD_TYPE ICU"
9568     # surprisingly set these only for "internal" (to be used by various other
9569     # external libs): the system icu-config is quite unhelpful and spits out
9570     # dozens of weird flags and also default path -I/usr/include
9571     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9572     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9574 if test "$ICU_MAJOR" -ge "59"; then
9575     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9576     # with -std=c++11 but not all external libraries can be built with that,
9577     # for those use a bit-compatible typedef uint16_t UChar; see
9578     # icu/source/common/unicode/umachine.h
9579     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9580 else
9581     ICU_UCHAR_TYPE=""
9583 AC_SUBST(SYSTEM_ICU)
9584 AC_SUBST(SYSTEM_GENBRK)
9585 AC_SUBST(SYSTEM_GENCCODE)
9586 AC_SUBST(SYSTEM_GENCMN)
9587 AC_SUBST(ICU_MAJOR)
9588 AC_SUBST(ICU_MINOR)
9589 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9590 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9591 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9592 AC_SUBST(ICU_CFLAGS)
9593 AC_SUBST(ICU_LIBS)
9594 AC_SUBST(ICU_UCHAR_TYPE)
9596 dnl ==================================================================
9597 dnl Breakpad
9598 dnl ==================================================================
9599 DEFAULT_CRASHDUMP_VALUE="true"
9600 AC_MSG_CHECKING([whether to enable breakpad])
9601 if test "$enable_breakpad" != yes; then
9602     AC_MSG_RESULT([no])
9603 else
9604     AC_MSG_RESULT([yes])
9605     ENABLE_BREAKPAD="TRUE"
9606     AC_DEFINE(ENABLE_BREAKPAD)
9607     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9608     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9610     AC_MSG_CHECKING([for disable crash dump])
9611     if test "$enable_crashdump" = no; then
9612         DEFAULT_CRASHDUMP_VALUE="false"
9613         AC_MSG_RESULT([yes])
9614     else
9615        AC_MSG_RESULT([no])
9616     fi
9618     AC_MSG_CHECKING([for crashreport config])
9619     if test "$with_symbol_config" = "no"; then
9620         BREAKPAD_SYMBOL_CONFIG="invalid"
9621         AC_MSG_RESULT([no])
9622     else
9623         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9624         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9625         AC_MSG_RESULT([yes])
9626     fi
9627     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9629 AC_SUBST(ENABLE_BREAKPAD)
9630 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9632 dnl ==================================================================
9633 dnl libfuzzer
9634 dnl ==================================================================
9635 AC_MSG_CHECKING([whether to enable fuzzers])
9636 if test "$enable_fuzzers" != yes; then
9637     AC_MSG_RESULT([no])
9638 else
9639     AC_MSG_RESULT([yes])
9640     ENABLE_FUZZERS="TRUE"
9641     AC_DEFINE([ENABLE_FUZZERS],1)
9642     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9644 AC_SUBST(ENABLE_FUZZERS)
9646 dnl ===================================================================
9647 dnl Orcus
9648 dnl ===================================================================
9649 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9650 if test "$with_system_orcus" != "yes"; then
9651     if test "$SYSTEM_BOOST" = "TRUE"; then
9652         # ===========================================================
9653         # Determine if we are going to need to link with Boost.System
9654         # ===========================================================
9655         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9656         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9657         dnl in documentation has no effect.
9658         AC_MSG_CHECKING([if we need to link with Boost.System])
9659         AC_LANG_PUSH([C++])
9660         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9661                 @%:@include <boost/version.hpp>
9662             ]],[[
9663                 #if BOOST_VERSION >= 105000
9664                 #   error yes, we need to link with Boost.System
9665                 #endif
9666             ]])],[
9667                 AC_MSG_RESULT([no])
9668             ],[
9669                 AC_MSG_RESULT([yes])
9670                 AX_BOOST_SYSTEM
9671         ])
9672         AC_LANG_POP([C++])
9673     fi
9675 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9676 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9677 AC_SUBST([BOOST_SYSTEM_LIB])
9678 AC_SUBST(SYSTEM_LIBORCUS)
9680 dnl ===================================================================
9681 dnl HarfBuzz
9682 dnl ===================================================================
9683 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9684                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9685                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9687 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9688                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9689                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9691 if test "$COM" = "MSC"; then # override the above
9692     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9693     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9696 if test "$with_system_harfbuzz" = "yes"; then
9697     if test "$with_system_graphite" = "no"; then
9698         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9699     fi
9700     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9701     _save_libs="$LIBS"
9702     _save_cflags="$CFLAGS"
9703     LIBS="$LIBS $HARFBUZZ_LIBS"
9704     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9705     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9706     LIBS="$_save_libs"
9707     CFLAGS="$_save_cflags"
9708 else
9709     if test "$with_system_graphite" = "yes"; then
9710         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9711     fi
9714 AC_MSG_CHECKING([whether to use X11])
9715 dnl ***************************************
9716 dnl testing for X libraries and includes...
9717 dnl ***************************************
9718 if test "$USING_X11" = TRUE; then
9719     AC_DEFINE(HAVE_FEATURE_X11)
9721 AC_MSG_RESULT([$USING_X11])
9723 if test "$USING_X11" = TRUE; then
9724     AC_PATH_X
9725     AC_PATH_XTRA
9726     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9728     if test -z "$x_includes"; then
9729         x_includes="default_x_includes"
9730     fi
9731     if test -z "$x_libraries"; then
9732         x_libraries="default_x_libraries"
9733     fi
9734     CFLAGS="$CFLAGS $X_CFLAGS"
9735     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9736     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9737 else
9738     x_includes="no_x_includes"
9739     x_libraries="no_x_libraries"
9742 if test "$USING_X11" = TRUE; then
9743     dnl ===================================================================
9744     dnl Check for extension headers
9745     dnl ===================================================================
9746     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9747      [#include <X11/extensions/shape.h>])
9749     # vcl needs ICE and SM
9750     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9751     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9752         [AC_MSG_ERROR(ICE library not found)])
9753     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9754     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9755         [AC_MSG_ERROR(SM library not found)])
9758 dnl ===================================================================
9759 dnl Check for system Xrender
9760 dnl ===================================================================
9761 AC_MSG_CHECKING([whether to use Xrender])
9762 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9763     AC_MSG_RESULT([yes])
9764     PKG_CHECK_MODULES(XRENDER, xrender)
9765     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9766     FilterLibs "${XRENDER_LIBS}"
9767     XRENDER_LIBS="${filteredlibs}"
9768     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9769       [AC_MSG_ERROR(libXrender not found or functional)], [])
9770     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9771       [AC_MSG_ERROR(Xrender not found. install X)], [])
9772 else
9773     AC_MSG_RESULT([no])
9775 AC_SUBST(XRENDER_CFLAGS)
9776 AC_SUBST(XRENDER_LIBS)
9778 dnl ===================================================================
9779 dnl Check for XRandr
9780 dnl ===================================================================
9781 AC_MSG_CHECKING([whether to enable RandR support])
9782 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9783     AC_MSG_RESULT([yes])
9784     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9785     if test "$ENABLE_RANDR" != "TRUE"; then
9786         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9787                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9788         XRANDR_CFLAGS=" "
9789         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9790           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9791         XRANDR_LIBS="-lXrandr "
9792         ENABLE_RANDR="TRUE"
9793     fi
9794     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9795     FilterLibs "${XRANDR_LIBS}"
9796     XRANDR_LIBS="${filteredlibs}"
9797 else
9798     ENABLE_RANDR=""
9799     AC_MSG_RESULT([no])
9801 AC_SUBST(XRANDR_CFLAGS)
9802 AC_SUBST(XRANDR_LIBS)
9803 AC_SUBST(ENABLE_RANDR)
9805 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9806     WITH_WEBDAV="serf"
9808 if test $_os = iOS -o $_os = Android; then
9809     WITH_WEBDAV="no"
9811 AC_MSG_CHECKING([for webdav library])
9812 case "$WITH_WEBDAV" in
9813 serf)
9814     AC_MSG_RESULT([serf])
9815     # Check for system apr-util
9816     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9817                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9818                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9819     if test "$COM" = "MSC"; then
9820         APR_LIB_DIR="LibR"
9821         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9822         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9823     fi
9825     # Check for system serf
9826     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9827                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9828     if test "$COM" = "MSC"; then
9829         SERF_LIB_DIR="Release"
9830         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9831         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9832     fi
9833     ;;
9834 neon)
9835     AC_MSG_RESULT([neon])
9836     # Check for system neon
9837     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9838     if test "$with_system_neon" = "yes"; then
9839         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9840     else
9841         NEON_VERSION=0295
9842     fi
9843     AC_SUBST(NEON_VERSION)
9844     ;;
9846     AC_MSG_RESULT([none, disabled])
9847     WITH_WEBDAV=""
9848     ;;
9849 esac
9850 AC_SUBST(WITH_WEBDAV)
9852 dnl ===================================================================
9853 dnl Check for disabling cve_tests
9854 dnl ===================================================================
9855 AC_MSG_CHECKING([whether to execute CVE tests])
9856 # If not explicitly enabled or disabled, default
9857 if test -z "$enable_cve_tests"; then
9858     case "$OS" in
9859     WNT)
9860         # Default cves off for Windows with its wild and wonderful
9861         # variety of AV software kicking in and panicking
9862         enable_cve_tests=no
9863         ;;
9864     *)
9865         # otherwise yes
9866         enable_cve_tests=yes
9867         ;;
9868     esac
9870 if test "$enable_cve_tests" = "no"; then
9871     AC_MSG_RESULT([no])
9872     DISABLE_CVE_TESTS=TRUE
9873     AC_SUBST(DISABLE_CVE_TESTS)
9874 else
9875     AC_MSG_RESULT([yes])
9878 dnl ===================================================================
9879 dnl Check for enabling chart XShape tests
9880 dnl ===================================================================
9881 AC_MSG_CHECKING([whether to execute chart XShape tests])
9882 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9883     AC_MSG_RESULT([yes])
9884     ENABLE_CHART_TESTS=TRUE
9885     AC_SUBST(ENABLE_CHART_TESTS)
9886 else
9887     AC_MSG_RESULT([no])
9890 dnl ===================================================================
9891 dnl Check for system openssl
9892 dnl ===================================================================
9893 DISABLE_OPENSSL=
9894 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9895 if test "$enable_openssl" = "yes"; then
9896     AC_MSG_RESULT([no])
9897     if test "$_os" = Darwin ; then
9898         # OpenSSL is deprecated when building for 10.7 or later.
9899         #
9900         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9901         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9903         with_system_openssl=no
9904         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9905     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9906             && test "$with_system_openssl" != "no"; then
9907         with_system_openssl=yes
9908         SYSTEM_OPENSSL=TRUE
9909         OPENSSL_CFLAGS=
9910         OPENSSL_LIBS="-lssl -lcrypto"
9911     else
9912         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9913     fi
9914     if test "$with_system_openssl" = "yes"; then
9915         AC_MSG_CHECKING([whether openssl supports SHA512])
9916         AC_LANG_PUSH([C])
9917         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9918             SHA512_CTX context;
9919 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9920         AC_LANG_POP(C)
9921     fi
9922 else
9923     AC_MSG_RESULT([yes])
9924     DISABLE_OPENSSL=TRUE
9926     # warn that although OpenSSL is disabled, system libraries may depend on it
9927     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9928     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9931 AC_SUBST([DISABLE_OPENSSL])
9933 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9934     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9935         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9936         enable_cipher_openssl_backend=no
9937     else
9938         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9939     fi
9941 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9942 ENABLE_CIPHER_OPENSSL_BACKEND=
9943 if test "$enable_cipher_openssl_backend" = yes; then
9944     AC_MSG_RESULT([yes])
9945     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9946 else
9947     AC_MSG_RESULT([no])
9949 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9951 dnl ===================================================================
9952 dnl Check for building gnutls
9953 dnl ===================================================================
9954 AC_MSG_CHECKING([whether to use gnutls])
9955 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9956     AC_MSG_RESULT([yes])
9957     AM_PATH_LIBGCRYPT()
9958     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9959         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9960                       available in the system to use as replacement.]]))
9961     FilterLibs "${LIBGCRYPT_LIBS}"
9962     LIBGCRYPT_LIBS="${filteredlibs}"
9963 else
9964     AC_MSG_RESULT([no])
9967 AC_SUBST([LIBGCRYPT_CFLAGS])
9968 AC_SUBST([LIBGCRYPT_LIBS])
9970 dnl ===================================================================
9971 dnl Check for system redland
9972 dnl ===================================================================
9973 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9974 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9975 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9976 if test "$with_system_redland" = "yes"; then
9977     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9978             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9979 else
9980     RAPTOR_MAJOR="0"
9981     RASQAL_MAJOR="3"
9982     REDLAND_MAJOR="0"
9984 AC_SUBST(RAPTOR_MAJOR)
9985 AC_SUBST(RASQAL_MAJOR)
9986 AC_SUBST(REDLAND_MAJOR)
9988 dnl ===================================================================
9989 dnl Check for system hunspell
9990 dnl ===================================================================
9991 AC_MSG_CHECKING([which libhunspell to use])
9992 if test "$with_system_hunspell" = "yes"; then
9993     AC_MSG_RESULT([external])
9994     SYSTEM_HUNSPELL=TRUE
9995     AC_LANG_PUSH([C++])
9996     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9997     if test "$HUNSPELL_PC" != "TRUE"; then
9998         AC_CHECK_HEADER(hunspell.hxx, [],
9999             [
10000             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10001             [AC_MSG_ERROR(hunspell headers not found.)], [])
10002             ], [])
10003         AC_CHECK_LIB([hunspell], [main], [:],
10004            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10005         HUNSPELL_LIBS=-lhunspell
10006     fi
10007     AC_LANG_POP([C++])
10008     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10009     FilterLibs "${HUNSPELL_LIBS}"
10010     HUNSPELL_LIBS="${filteredlibs}"
10011 else
10012     AC_MSG_RESULT([internal])
10013     SYSTEM_HUNSPELL=
10014     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10015     if test "$COM" = "MSC"; then
10016         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10017     else
10018         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10019     fi
10020     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10022 AC_SUBST(SYSTEM_HUNSPELL)
10023 AC_SUBST(HUNSPELL_CFLAGS)
10024 AC_SUBST(HUNSPELL_LIBS)
10026 dnl ===================================================================
10027 dnl Check for system qrcodegen
10028 dnl ===================================================================
10029 AC_MSG_CHECKING([which libqrcodegen to use])
10030 if test "$with_system_qrcodegen" = "yes"; then
10031     AC_MSG_RESULT([external])
10032     SYSTEM_QRCODEGEN=TRUE
10033     AC_LANG_PUSH([C++])
10034     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10035         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10036     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10037         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10038     QRCODEGEN_LIBS=-lqrcodegencpp
10039     AC_LANG_POP([C++])
10040     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10041     FilterLibs "${QRCODEGEN_LIBS}"
10042     QRCODEGEN_LIBS="${filteredlibs}"
10043 else
10044     AC_MSG_RESULT([internal])
10045     SYSTEM_QRCODEGEN=
10046     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10048 AC_SUBST(SYSTEM_QRCODEGEN)
10049 AC_SUBST(QRCODEGEN_CFLAGS)
10050 AC_SUBST(QRCODEGEN_LIBS)
10052 dnl ===================================================================
10053 dnl Checking for altlinuxhyph
10054 dnl ===================================================================
10055 AC_MSG_CHECKING([which altlinuxhyph to use])
10056 if test "$with_system_altlinuxhyph" = "yes"; then
10057     AC_MSG_RESULT([external])
10058     SYSTEM_HYPH=TRUE
10059     AC_CHECK_HEADER(hyphen.h, [],
10060        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10061     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10062        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10063        [#include <hyphen.h>])
10064     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10065         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10066     if test -z "$HYPHEN_LIB"; then
10067         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10068            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10069     fi
10070     if test -z "$HYPHEN_LIB"; then
10071         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10072            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10073     fi
10074 else
10075     AC_MSG_RESULT([internal])
10076     SYSTEM_HYPH=
10077     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10078     if test "$COM" = "MSC"; then
10079         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10080     else
10081         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10082     fi
10084 AC_SUBST(SYSTEM_HYPH)
10085 AC_SUBST(HYPHEN_LIB)
10087 dnl ===================================================================
10088 dnl Checking for mythes
10089 dnl ===================================================================
10090 AC_MSG_CHECKING([which mythes to use])
10091 if test "$with_system_mythes" = "yes"; then
10092     AC_MSG_RESULT([external])
10093     SYSTEM_MYTHES=TRUE
10094     AC_LANG_PUSH([C++])
10095     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10096     if test "$MYTHES_PKGCONFIG" = "no"; then
10097         AC_CHECK_HEADER(mythes.hxx, [],
10098             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10099         AC_CHECK_LIB([mythes-1.2], [main], [:],
10100             [ MYTHES_FOUND=no], [])
10101     if test "$MYTHES_FOUND" = "no"; then
10102         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10103                 [ MYTHES_FOUND=no], [])
10104     fi
10105     if test "$MYTHES_FOUND" = "no"; then
10106         AC_MSG_ERROR([mythes library not found!.])
10107     fi
10108     fi
10109     AC_LANG_POP([C++])
10110     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10111     FilterLibs "${MYTHES_LIBS}"
10112     MYTHES_LIBS="${filteredlibs}"
10113 else
10114     AC_MSG_RESULT([internal])
10115     SYSTEM_MYTHES=
10116     BUILD_TYPE="$BUILD_TYPE MYTHES"
10117     if test "$COM" = "MSC"; then
10118         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10119     else
10120         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10121     fi
10123 AC_SUBST(SYSTEM_MYTHES)
10124 AC_SUBST(MYTHES_CFLAGS)
10125 AC_SUBST(MYTHES_LIBS)
10127 dnl ===================================================================
10128 dnl How should we build the linear programming solver ?
10129 dnl ===================================================================
10131 ENABLE_COINMP=
10132 AC_MSG_CHECKING([whether to build with CoinMP])
10133 if test "$enable_coinmp" != "no"; then
10134     ENABLE_COINMP=TRUE
10135     AC_MSG_RESULT([yes])
10136     if test "$with_system_coinmp" = "yes"; then
10137         SYSTEM_COINMP=TRUE
10138         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10139         FilterLibs "${COINMP_LIBS}"
10140         COINMP_LIBS="${filteredlibs}"
10141     else
10142         BUILD_TYPE="$BUILD_TYPE COINMP"
10143     fi
10144 else
10145     AC_MSG_RESULT([no])
10147 AC_SUBST(ENABLE_COINMP)
10148 AC_SUBST(SYSTEM_COINMP)
10149 AC_SUBST(COINMP_CFLAGS)
10150 AC_SUBST(COINMP_LIBS)
10152 ENABLE_LPSOLVE=
10153 AC_MSG_CHECKING([whether to build with lpsolve])
10154 if test "$enable_lpsolve" != "no"; then
10155     ENABLE_LPSOLVE=TRUE
10156     AC_MSG_RESULT([yes])
10157 else
10158     AC_MSG_RESULT([no])
10160 AC_SUBST(ENABLE_LPSOLVE)
10162 if test "$ENABLE_LPSOLVE" = TRUE; then
10163     AC_MSG_CHECKING([which lpsolve to use])
10164     if test "$with_system_lpsolve" = "yes"; then
10165         AC_MSG_RESULT([external])
10166         SYSTEM_LPSOLVE=TRUE
10167         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10168            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10169         save_LIBS=$LIBS
10170         # some systems need this. Like Ubuntu...
10171         AC_CHECK_LIB(m, floor)
10172         AC_CHECK_LIB(dl, dlopen)
10173         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10174             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10175         LIBS=$save_LIBS
10176     else
10177         AC_MSG_RESULT([internal])
10178         SYSTEM_LPSOLVE=
10179         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10180     fi
10182 AC_SUBST(SYSTEM_LPSOLVE)
10184 dnl ===================================================================
10185 dnl Checking for libexttextcat
10186 dnl ===================================================================
10187 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10188 if test "$with_system_libexttextcat" = "yes"; then
10189     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10191 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10193 dnl ===================================================================
10194 dnl Checking for libnumbertext
10195 dnl ===================================================================
10196 AC_MSG_CHECKING([whether to use libnumbertext])
10197 if test "$enable_libnumbertext" = "no"; then
10198     AC_MSG_RESULT([no])
10199     ENABLE_LIBNUMBERTEXT=
10200     SYSTEM_LIBNUMBERTEXT=
10201 else
10202     AC_MSG_RESULT([yes])
10203     ENABLE_LIBNUMBERTEXT=TRUE
10204     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10205     if test "$with_system_libnumbertext" = "yes"; then
10206         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10207         SYSTEM_LIBNUMBERTEXT=YES
10208     else
10209         SYSTEM_LIBNUMBERTEXT=
10210         AC_LANG_PUSH([C++])
10211         save_CPPFLAGS=$CPPFLAGS
10212         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10213         AC_CHECK_HEADERS([codecvt regex])
10214         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10215                 [ ENABLE_LIBNUMBERTEXT=''
10216                   LIBNUMBERTEXT_CFLAGS=''
10217                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10218                                Enable libnumbertext fallback (missing number to number name conversion).])
10219                 ])
10220         CPPFLAGS=$save_CPPFLAGS
10221         AC_LANG_POP([C++])
10222     fi
10223     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10224         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10225     fi
10227 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10228 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10229 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10230 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10232 dnl ***************************************
10233 dnl testing libc version for Linux...
10234 dnl ***************************************
10235 if test "$_os" = "Linux"; then
10236     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10237     exec 6>/dev/null # no output
10238     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10239     exec 6>&1 # output on again
10240     if test "$HAVE_LIBC"; then
10241         AC_MSG_RESULT([yes])
10242     else
10243         AC_MSG_ERROR([no, upgrade libc])
10244     fi
10247 dnl =========================================
10248 dnl Check for uuidgen
10249 dnl =========================================
10250 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10251     # presence is already tested above in the WINDOWS_SDK_HOME check
10252     UUIDGEN=uuidgen.exe
10253     AC_SUBST(UUIDGEN)
10254 else
10255     AC_PATH_PROG([UUIDGEN], [uuidgen])
10256     if test -z "$UUIDGEN"; then
10257         AC_MSG_WARN([uuid is needed for building installation sets])
10258     fi
10261 dnl ***************************************
10262 dnl Checking for bison and flex
10263 dnl ***************************************
10264 AC_PATH_PROG(BISON, bison)
10265 if test -z "$BISON"; then
10266     AC_MSG_ERROR([no bison found in \$PATH, install it])
10267 else
10268     AC_MSG_CHECKING([the bison version])
10269     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10270     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10271     # Accept newer than 2.0
10272     if test "$_bison_longver" -lt 2000; then
10273         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10274     fi
10277 AC_PATH_PROG(FLEX, flex)
10278 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10279     FLEX=`cygpath -m $FLEX`
10281 if test -z "$FLEX"; then
10282     AC_MSG_ERROR([no flex found in \$PATH, install it])
10283 else
10284     AC_MSG_CHECKING([the flex version])
10285     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10286     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10287         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10288     fi
10290 AC_SUBST([FLEX])
10291 dnl ***************************************
10292 dnl Checking for patch
10293 dnl ***************************************
10294 AC_PATH_PROG(PATCH, patch)
10295 if test -z "$PATCH"; then
10296     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10299 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10300 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10301     if test -z "$with_gnu_patch"; then
10302         GNUPATCH=$PATCH
10303     else
10304         if test -x "$with_gnu_patch"; then
10305             GNUPATCH=$with_gnu_patch
10306         else
10307             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10308         fi
10309     fi
10311     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10312     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10313         AC_MSG_RESULT([yes])
10314     else
10315         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10316     fi
10317 else
10318     GNUPATCH=$PATCH
10321 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10322     GNUPATCH=`cygpath -m $GNUPATCH`
10325 dnl We also need to check for --with-gnu-cp
10327 if test -z "$with_gnu_cp"; then
10328     # check the place where the good stuff is hidden on Solaris...
10329     if test -x /usr/gnu/bin/cp; then
10330         GNUCP=/usr/gnu/bin/cp
10331     else
10332         AC_PATH_PROGS(GNUCP, gnucp cp)
10333     fi
10334     if test -z $GNUCP; then
10335         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10336     fi
10337 else
10338     if test -x "$with_gnu_cp"; then
10339         GNUCP=$with_gnu_cp
10340     else
10341         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10342     fi
10345 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10346     GNUCP=`cygpath -m $GNUCP`
10349 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10350 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10351     AC_MSG_RESULT([yes])
10352 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10353     AC_MSG_RESULT([yes])
10354 else
10355     case "$build_os" in
10356     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10357         x_GNUCP=[\#]
10358         GNUCP=''
10359         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10360         ;;
10361     *)
10362         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10363         ;;
10364     esac
10367 AC_SUBST(GNUPATCH)
10368 AC_SUBST(GNUCP)
10369 AC_SUBST(x_GNUCP)
10371 dnl ***************************************
10372 dnl testing assembler path
10373 dnl ***************************************
10374 ML_EXE=""
10375 if test "$_os" = "WINNT"; then
10376     if test "$BITNESS_OVERRIDE" = ""; then
10377         assembler=ml.exe
10378     else
10379         assembler=ml64.exe
10380     fi
10382     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10383     if test -f "$CL_PATH/$assembler"; then
10384         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10385         AC_MSG_RESULT([$ML_EXE])
10386     else
10387         AC_MSG_ERROR([not found])
10388     fi
10391 AC_SUBST(ML_EXE)
10393 dnl ===================================================================
10394 dnl We need zip and unzip
10395 dnl ===================================================================
10396 AC_PATH_PROG(ZIP, zip)
10397 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10398 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10399     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],,)
10402 AC_PATH_PROG(UNZIP, unzip)
10403 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10405 dnl ===================================================================
10406 dnl Zip must be a specific type for different build types.
10407 dnl ===================================================================
10408 if test $build_os = cygwin; then
10409     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10410         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10411     fi
10414 dnl ===================================================================
10415 dnl We need touch with -h option support.
10416 dnl ===================================================================
10417 AC_PATH_PROG(TOUCH, touch)
10418 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10419 touch warn
10420 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10421     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],,)
10424 dnl ===================================================================
10425 dnl Check for system epoxy
10426 dnl ===================================================================
10427 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10429 dnl ===================================================================
10430 dnl Set vcl option: coordinate device in double or sal_Int32
10431 dnl ===================================================================
10433 dnl disabled for now, we don't want subtle differences between OSs
10434 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10435 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10436 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10437 dnl     AC_MSG_RESULT([double])
10438 dnl else
10439 dnl     AC_MSG_RESULT([sal_Int32])
10440 dnl fi
10442 dnl ===================================================================
10443 dnl Test which vclplugs have to be built.
10444 dnl ===================================================================
10445 R=""
10446 if test "$USING_X11" != TRUE; then
10447     enable_gtk3=no
10449 GTK3_CFLAGS=""
10450 GTK3_LIBS=""
10451 ENABLE_GTK3=""
10452 if test "x$enable_gtk3" = "xyes"; then
10453     if test "$with_system_cairo" = no; then
10454         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10455     fi
10456     : ${with_system_cairo:=yes}
10457     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="")
10458     if test "x$ENABLE_GTK3" = "xTRUE"; then
10459         AC_DEFINE(ENABLE_GTK3)
10460         R="gtk3"
10461     else
10462         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10463     fi
10464     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10465     FilterLibs "${GTK3_LIBS}"
10466     GTK3_LIBS="${filteredlibs}"
10468     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10469     if test "$with_system_epoxy" != "yes"; then
10470         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10471         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10472                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10473     fi
10475 AC_SUBST(GTK3_LIBS)
10476 AC_SUBST(GTK3_CFLAGS)
10477 AC_SUBST(ENABLE_GTK3)
10479 if test "$enable_introspection" = yes; then
10480     if test "$ENABLE_GTK3" = TRUE; then
10481         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10482     else
10483         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10484     fi
10487 ENABLE_QT5=""
10488 if test "x$enable_qt5" = "xyes"; then
10489     ENABLE_QT5="TRUE"
10490     AC_DEFINE(ENABLE_QT5)
10491     R="$R qt5"
10493 AC_SUBST(ENABLE_QT5)
10495 ENABLE_KF5=""
10496 if test "x$enable_kf5" = "xyes"; then
10497     ENABLE_KF5="TRUE"
10498     AC_DEFINE(ENABLE_KF5)
10499     R="$R kf5"
10501 AC_SUBST(ENABLE_KF5)
10503 ENABLE_GTK3_KDE5=""
10504 if test "x$enable_gtk3_kde5" = "xyes"; then
10505     ENABLE_GTK3_KDE5="TRUE"
10506     AC_DEFINE(ENABLE_GTK3_KDE5)
10507     R="$R gtk3_kde5"
10509 AC_SUBST(ENABLE_GTK3_KDE5)
10511 if test "$_os" = "WINNT"; then
10512     R="$R win"
10513 elif test "$_os" = "Darwin"; then
10514     R="$R osx"
10515 elif test "$_os" = "iOS"; then
10516     R="ios (builtin)"
10519 build_vcl_plugins="$R"
10520 if test -z "$build_vcl_plugins"; then
10521     build_vcl_plugins="none"
10523 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10525 dnl ===================================================================
10526 dnl check for dbus support
10527 dnl ===================================================================
10528 ENABLE_DBUS=""
10529 DBUS_CFLAGS=""
10530 DBUS_LIBS=""
10531 DBUS_GLIB_CFLAGS=""
10532 DBUS_GLIB_LIBS=""
10533 DBUS_HAVE_GLIB=""
10535 if test "$enable_dbus" = "no"; then
10536     test_dbus=no
10539 AC_MSG_CHECKING([whether to enable DBUS support])
10540 if test "$test_dbus" = "yes"; then
10541     ENABLE_DBUS="TRUE"
10542     AC_MSG_RESULT([yes])
10543     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10544     AC_DEFINE(ENABLE_DBUS)
10545     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10546     FilterLibs "${DBUS_LIBS}"
10547     DBUS_LIBS="${filteredlibs}"
10549     # Glib is needed for BluetoothServer
10550     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10551     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10552         [
10553             DBUS_HAVE_GLIB="TRUE"
10554             AC_DEFINE(DBUS_HAVE_GLIB,1)
10555         ],
10556         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10557     )
10558 else
10559     AC_MSG_RESULT([no])
10562 AC_SUBST(ENABLE_DBUS)
10563 AC_SUBST(DBUS_CFLAGS)
10564 AC_SUBST(DBUS_LIBS)
10565 AC_SUBST(DBUS_GLIB_CFLAGS)
10566 AC_SUBST(DBUS_GLIB_LIBS)
10567 AC_SUBST(DBUS_HAVE_GLIB)
10569 AC_MSG_CHECKING([whether to enable Impress remote control])
10570 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10571     AC_MSG_RESULT([yes])
10572     ENABLE_SDREMOTE=TRUE
10573     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10575     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10576         # The Bluetooth code doesn't compile with macOS SDK 10.15
10577         enable_sdremote_bluetooth=no
10578     fi
10579     # If not explicitly enabled or disabled, default
10580     if test -z "$enable_sdremote_bluetooth"; then
10581         case "$OS" in
10582         LINUX|MACOSX|WNT)
10583             # Default to yes for these
10584             enable_sdremote_bluetooth=yes
10585             ;;
10586         *)
10587             # otherwise no
10588             enable_sdremote_bluetooth=no
10589             ;;
10590         esac
10591     fi
10592     # $enable_sdremote_bluetooth is guaranteed non-empty now
10594     if test "$enable_sdremote_bluetooth" != "no"; then
10595         if test "$OS" = "LINUX"; then
10596             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10597                 AC_MSG_RESULT([yes])
10598                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10599                 dnl ===================================================================
10600                 dnl Check for system bluez
10601                 dnl ===================================================================
10602                 AC_MSG_CHECKING([which Bluetooth header to use])
10603                 if test "$with_system_bluez" = "yes"; then
10604                     AC_MSG_RESULT([external])
10605                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10606                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10607                     SYSTEM_BLUEZ=TRUE
10608                 else
10609                     AC_MSG_RESULT([internal])
10610                     SYSTEM_BLUEZ=
10611                 fi
10612             else
10613                 AC_MSG_RESULT([no, dbus disabled])
10614                 ENABLE_SDREMOTE_BLUETOOTH=
10615                 SYSTEM_BLUEZ=
10616             fi
10617         else
10618             AC_MSG_RESULT([yes])
10619             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10620             SYSTEM_BLUEZ=
10621         fi
10622     else
10623         AC_MSG_RESULT([no])
10624         ENABLE_SDREMOTE_BLUETOOTH=
10625         SYSTEM_BLUEZ=
10626     fi
10627 else
10628     ENABLE_SDREMOTE=
10629     SYSTEM_BLUEZ=
10630     AC_MSG_RESULT([no])
10632 AC_SUBST(ENABLE_SDREMOTE)
10633 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10634 AC_SUBST(SYSTEM_BLUEZ)
10636 dnl ===================================================================
10637 dnl Check whether to enable GIO support
10638 dnl ===================================================================
10639 if test "$ENABLE_GTK3" = "TRUE"; then
10640     AC_MSG_CHECKING([whether to enable GIO support])
10641     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10642         dnl Need at least 2.26 for the dbus support.
10643         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10644                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10645         if test "$ENABLE_GIO" = "TRUE"; then
10646             AC_DEFINE(ENABLE_GIO)
10647             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10648             FilterLibs "${GIO_LIBS}"
10649             GIO_LIBS="${filteredlibs}"
10650         fi
10651     else
10652         AC_MSG_RESULT([no])
10653     fi
10655 AC_SUBST(ENABLE_GIO)
10656 AC_SUBST(GIO_CFLAGS)
10657 AC_SUBST(GIO_LIBS)
10660 dnl ===================================================================
10662 SPLIT_APP_MODULES=""
10663 if test "$enable_split_app_modules" = "yes"; then
10664     SPLIT_APP_MODULES="TRUE"
10666 AC_SUBST(SPLIT_APP_MODULES)
10668 SPLIT_OPT_FEATURES=""
10669 if test "$enable_split_opt_features" = "yes"; then
10670     SPLIT_OPT_FEATURES="TRUE"
10672 AC_SUBST(SPLIT_OPT_FEATURES)
10674 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10675     if test "$enable_cairo_canvas" = yes; then
10676         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10677     fi
10678     enable_cairo_canvas=no
10679 elif test -z "$enable_cairo_canvas"; then
10680     enable_cairo_canvas=yes
10683 ENABLE_CAIRO_CANVAS=""
10684 if test "$enable_cairo_canvas" = "yes"; then
10685     test_cairo=yes
10686     ENABLE_CAIRO_CANVAS="TRUE"
10687     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10689 AC_SUBST(ENABLE_CAIRO_CANVAS)
10691 dnl ===================================================================
10692 dnl Check whether the GStreamer libraries are available.
10693 dnl ===================================================================
10695 ENABLE_GSTREAMER_1_0=""
10697 if test "$build_gstreamer_1_0" = "yes"; then
10699     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10700     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10701         ENABLE_GSTREAMER_1_0="TRUE"
10702         AC_MSG_RESULT([yes])
10703         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10704         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10705         FilterLibs "${GSTREAMER_1_0_LIBS}"
10706         GSTREAMER_1_0_LIBS="${filteredlibs}"
10707         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10708     else
10709         AC_MSG_RESULT([no])
10710     fi
10712 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10713 AC_SUBST(GSTREAMER_1_0_LIBS)
10714 AC_SUBST(ENABLE_GSTREAMER_1_0)
10716 dnl ===================================================================
10717 dnl Check whether to build the VLC avmedia backend
10718 dnl ===================================================================
10720 ENABLE_VLC=""
10722 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10723 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10724     ENABLE_VLC="TRUE"
10725     AC_MSG_RESULT([yes])
10726 else
10727     AC_MSG_RESULT([no])
10729 AC_SUBST(ENABLE_VLC)
10731 ENABLE_OPENGL_TRANSITIONS=
10732 ENABLE_OPENGL_CANVAS=
10733 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10734    : # disable
10735 elif test "$_os" = "Darwin"; then
10736     # We use frameworks on macOS, no need for detail checks
10737     ENABLE_OPENGL_TRANSITIONS=TRUE
10738     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10739     ENABLE_OPENGL_CANVAS=TRUE
10740 elif test $_os = WINNT; then
10741     ENABLE_OPENGL_TRANSITIONS=TRUE
10742     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10743     ENABLE_OPENGL_CANVAS=TRUE
10744 else
10745     if test "$USING_X11" = TRUE; then
10746         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10747         ENABLE_OPENGL_TRANSITIONS=TRUE
10748         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10749         ENABLE_OPENGL_CANVAS=TRUE
10750     fi
10753 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10754 AC_SUBST(ENABLE_OPENGL_CANVAS)
10756 dnl =================================================
10757 dnl Check whether to build with OpenCL support.
10758 dnl =================================================
10760 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10761     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10762     # platform (optional at run-time, used through clew).
10763     BUILD_TYPE="$BUILD_TYPE OPENCL"
10764     AC_DEFINE(HAVE_FEATURE_OPENCL)
10767 dnl =================================================
10768 dnl Check whether to build with dconf support.
10769 dnl =================================================
10771 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10772     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10773         if test "$enable_dconf" = yes; then
10774             AC_MSG_ERROR([dconf not found])
10775         else
10776             enable_dconf=no
10777         fi])
10779 AC_MSG_CHECKING([whether to enable dconf])
10780 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10781     DCONF_CFLAGS=
10782     DCONF_LIBS=
10783     ENABLE_DCONF=
10784     AC_MSG_RESULT([no])
10785 else
10786     ENABLE_DCONF=TRUE
10787     AC_DEFINE(ENABLE_DCONF)
10788     AC_MSG_RESULT([yes])
10790 AC_SUBST([DCONF_CFLAGS])
10791 AC_SUBST([DCONF_LIBS])
10792 AC_SUBST([ENABLE_DCONF])
10794 # pdf import?
10795 AC_MSG_CHECKING([whether to build the PDF import feature])
10796 ENABLE_PDFIMPORT=
10797 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10798     AC_MSG_RESULT([yes])
10799     ENABLE_PDFIMPORT=TRUE
10800     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10801 else
10802     AC_MSG_RESULT([no])
10805 # Pdfium?
10806 AC_MSG_CHECKING([whether to build PDFium])
10807 ENABLE_PDFIUM=
10808 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10809     AC_MSG_RESULT([yes])
10810     ENABLE_PDFIUM=TRUE
10811     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10812     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10813 else
10814     AC_MSG_RESULT([no])
10816 AC_SUBST(ENABLE_PDFIUM)
10818 dnl ===================================================================
10819 dnl Check for poppler
10820 dnl ===================================================================
10821 ENABLE_POPPLER=
10822 AC_MSG_CHECKING([whether to build Poppler])
10823 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10824     AC_MSG_RESULT([yes])
10825     ENABLE_POPPLER=TRUE
10826     AC_DEFINE(HAVE_FEATURE_POPPLER)
10827 else
10828     AC_MSG_RESULT([no])
10830 AC_SUBST(ENABLE_POPPLER)
10832 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10833     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10836 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10837     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10840 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10841     dnl ===================================================================
10842     dnl Check for system poppler
10843     dnl ===================================================================
10844     AC_MSG_CHECKING([which PDF import poppler to use])
10845     if test "$with_system_poppler" = "yes"; then
10846         AC_MSG_RESULT([external])
10847         SYSTEM_POPPLER=TRUE
10848         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10849         AC_LANG_PUSH([C++])
10850         save_CXXFLAGS=$CXXFLAGS
10851         save_CPPFLAGS=$CPPFLAGS
10852         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10853         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10854         AC_CHECK_HEADER([cpp/poppler-version.h],
10855             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10856             [])
10857         CXXFLAGS=$save_CXXFLAGS
10858         CPPFLAGS=$save_CPPFLAGS
10859         AC_LANG_POP([C++])
10860         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10862         FilterLibs "${POPPLER_LIBS}"
10863         POPPLER_LIBS="${filteredlibs}"
10864     else
10865         AC_MSG_RESULT([internal])
10866         SYSTEM_POPPLER=
10867         BUILD_TYPE="$BUILD_TYPE POPPLER"
10868         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10869     fi
10870     AC_DEFINE([ENABLE_PDFIMPORT],1)
10872 AC_SUBST(ENABLE_PDFIMPORT)
10873 AC_SUBST(SYSTEM_POPPLER)
10874 AC_SUBST(POPPLER_CFLAGS)
10875 AC_SUBST(POPPLER_LIBS)
10877 SYSTEM_GPGMEPP=
10879 if test "$build_for_ios" = "YES"; then
10880     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10881     AC_MSG_RESULT([yes])
10882 elif test "$enable_mpl_subset" = "yes"; then
10883     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10884     AC_MSG_RESULT([yes])
10885 elif test "$enable_fuzzers" = "yes"; then
10886     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10887     AC_MSG_RESULT([yes])
10888 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10889     dnl ===================================================================
10890     dnl Check for system gpgme
10891     dnl ===================================================================
10892     AC_MSG_CHECKING([which gpgmepp to use])
10893     if test "$with_system_gpgmepp" = "yes"; then
10894         AC_MSG_RESULT([external])
10895         SYSTEM_GPGMEPP=TRUE
10897         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10898         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10899             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10900         # progress_callback is the only func with plain C linkage
10901         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10902         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10903             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10904         AC_CHECK_HEADER(gpgme.h, [],
10905             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10906     else
10907         AC_MSG_RESULT([internal])
10908         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10909         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10911         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10912         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10913         if test "$_os" != "WINNT"; then
10914             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10915             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10916         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10917             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10918         fi
10919     fi
10920     ENABLE_GPGMEPP=TRUE
10921     AC_DEFINE([HAVE_FEATURE_GPGME])
10922     AC_PATH_PROG(GPG, gpg)
10923     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10924     # so let's exclude that manually for the moment
10925     if test -n "$GPG" -a "$_os" != "WINNT"; then
10926         # make sure we not only have a working gpgme, but a full working
10927         # gpg installation to run OpenPGP signature verification
10928         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10929     fi
10930     if test "$_os" = "Linux"; then
10931       uid=`id -u`
10932       AC_MSG_CHECKING([for /run/user/$uid])
10933       if test -d /run/user/$uid; then
10934         AC_MSG_RESULT([yes])
10935         AC_PATH_PROG(GPGCONF, gpgconf)
10937         # Older versions of gpgconf are not working as expected, since
10938         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10939         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10940         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10941         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10942         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10943         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10944         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10945           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10946           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10947           if $GPGCONF --dump-options > /dev/null ; then
10948             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10949               AC_MSG_RESULT([yes])
10950               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10951               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10952             else
10953               AC_MSG_RESULT([no])
10954             fi
10955           else
10956             AC_MSG_RESULT([no. missing or broken gpgconf?])
10957           fi
10958         else
10959           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10960         fi
10961       else
10962         AC_MSG_RESULT([no])
10963      fi
10964    fi
10966 AC_SUBST(ENABLE_GPGMEPP)
10967 AC_SUBST(SYSTEM_GPGMEPP)
10968 AC_SUBST(GPG_ERROR_CFLAGS)
10969 AC_SUBST(GPG_ERROR_LIBS)
10970 AC_SUBST(LIBASSUAN_CFLAGS)
10971 AC_SUBST(LIBASSUAN_LIBS)
10972 AC_SUBST(GPGMEPP_CFLAGS)
10973 AC_SUBST(GPGMEPP_LIBS)
10975 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10976 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10977     AC_MSG_RESULT([yes])
10978     ENABLE_MEDIAWIKI=TRUE
10979     BUILD_TYPE="$BUILD_TYPE XSLTML"
10980     if test  "x$with_java" = "xno"; then
10981         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10982     fi
10983 else
10984     AC_MSG_RESULT([no])
10985     ENABLE_MEDIAWIKI=
10986     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10988 AC_SUBST(ENABLE_MEDIAWIKI)
10990 AC_MSG_CHECKING([whether to build the Report Builder])
10991 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10992     AC_MSG_RESULT([yes])
10993     ENABLE_REPORTBUILDER=TRUE
10994     AC_MSG_CHECKING([which jfreereport libs to use])
10995     if test "$with_system_jfreereport" = "yes"; then
10996         SYSTEM_JFREEREPORT=TRUE
10997         AC_MSG_RESULT([external])
10998         if test -z $SAC_JAR; then
10999             SAC_JAR=/usr/share/java/sac.jar
11000         fi
11001         if ! test -f $SAC_JAR; then
11002              AC_MSG_ERROR(sac.jar not found.)
11003         fi
11005         if test -z $LIBXML_JAR; then
11006             if test -f /usr/share/java/libxml-1.0.0.jar; then
11007                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11008             elif test -f /usr/share/java/libxml.jar; then
11009                 LIBXML_JAR=/usr/share/java/libxml.jar
11010             else
11011                 AC_MSG_ERROR(libxml.jar replacement not found.)
11012             fi
11013         elif ! test -f $LIBXML_JAR; then
11014             AC_MSG_ERROR(libxml.jar not found.)
11015         fi
11017         if test -z $FLUTE_JAR; then
11018             if test -f/usr/share/java/flute-1.3.0.jar; then
11019                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11020             elif test -f /usr/share/java/flute.jar; then
11021                 FLUTE_JAR=/usr/share/java/flute.jar
11022             else
11023                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11024             fi
11025         elif ! test -f $FLUTE_JAR; then
11026             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11027         fi
11029         if test -z $JFREEREPORT_JAR; then
11030             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11031                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11032             elif test -f /usr/share/java/flow-engine.jar; then
11033                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11034             else
11035                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11036             fi
11037         elif ! test -f  $JFREEREPORT_JAR; then
11038                 AC_MSG_ERROR(jfreereport.jar not found.)
11039         fi
11041         if test -z $LIBLAYOUT_JAR; then
11042             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11043                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11044             elif test -f /usr/share/java/liblayout.jar; then
11045                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11046             else
11047                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11048             fi
11049         elif ! test -f $LIBLAYOUT_JAR; then
11050                 AC_MSG_ERROR(liblayout.jar not found.)
11051         fi
11053         if test -z $LIBLOADER_JAR; then
11054             if test -f /usr/share/java/libloader-1.0.0.jar; then
11055                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11056             elif test -f /usr/share/java/libloader.jar; then
11057                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11058             else
11059                 AC_MSG_ERROR(libloader.jar replacement not found.)
11060             fi
11061         elif ! test -f  $LIBLOADER_JAR; then
11062             AC_MSG_ERROR(libloader.jar not found.)
11063         fi
11065         if test -z $LIBFORMULA_JAR; then
11066             if test -f /usr/share/java/libformula-0.2.0.jar; then
11067                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11068             elif test -f /usr/share/java/libformula.jar; then
11069                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11070             else
11071                 AC_MSG_ERROR(libformula.jar replacement not found.)
11072             fi
11073         elif ! test -f $LIBFORMULA_JAR; then
11074                 AC_MSG_ERROR(libformula.jar not found.)
11075         fi
11077         if test -z $LIBREPOSITORY_JAR; then
11078             if test -f /usr/share/java/librepository-1.0.0.jar; then
11079                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11080             elif test -f /usr/share/java/librepository.jar; then
11081                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11082             else
11083                 AC_MSG_ERROR(librepository.jar replacement not found.)
11084             fi
11085         elif ! test -f $LIBREPOSITORY_JAR; then
11086             AC_MSG_ERROR(librepository.jar not found.)
11087         fi
11089         if test -z $LIBFONTS_JAR; then
11090             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11091                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11092             elif test -f /usr/share/java/libfonts.jar; then
11093                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11094             else
11095                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11096             fi
11097         elif ! test -f $LIBFONTS_JAR; then
11098                 AC_MSG_ERROR(libfonts.jar not found.)
11099         fi
11101         if test -z $LIBSERIALIZER_JAR; then
11102             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11103                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11104             elif test -f /usr/share/java/libserializer.jar; then
11105                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11106             else
11107                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11108             fi
11109         elif ! test -f $LIBSERIALIZER_JAR; then
11110                 AC_MSG_ERROR(libserializer.jar not found.)
11111         fi
11113         if test -z $LIBBASE_JAR; then
11114             if test -f /usr/share/java/libbase-1.0.0.jar; then
11115                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11116             elif test -f /usr/share/java/libbase.jar; then
11117                 LIBBASE_JAR=/usr/share/java/libbase.jar
11118             else
11119                 AC_MSG_ERROR(libbase.jar replacement not found.)
11120             fi
11121         elif ! test -f $LIBBASE_JAR; then
11122             AC_MSG_ERROR(libbase.jar not found.)
11123         fi
11125     else
11126         AC_MSG_RESULT([internal])
11127         SYSTEM_JFREEREPORT=
11128         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11129         NEED_ANT=TRUE
11130     fi
11131 else
11132     AC_MSG_RESULT([no])
11133     ENABLE_REPORTBUILDER=
11134     SYSTEM_JFREEREPORT=
11136 AC_SUBST(ENABLE_REPORTBUILDER)
11137 AC_SUBST(SYSTEM_JFREEREPORT)
11138 AC_SUBST(SAC_JAR)
11139 AC_SUBST(LIBXML_JAR)
11140 AC_SUBST(FLUTE_JAR)
11141 AC_SUBST(JFREEREPORT_JAR)
11142 AC_SUBST(LIBBASE_JAR)
11143 AC_SUBST(LIBLAYOUT_JAR)
11144 AC_SUBST(LIBLOADER_JAR)
11145 AC_SUBST(LIBFORMULA_JAR)
11146 AC_SUBST(LIBREPOSITORY_JAR)
11147 AC_SUBST(LIBFONTS_JAR)
11148 AC_SUBST(LIBSERIALIZER_JAR)
11150 # this has to be here because both the Wiki Publisher and the SRB use
11151 # commons-logging
11152 COMMONS_LOGGING_VERSION=1.2
11153 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11154     AC_MSG_CHECKING([which Apache commons-* libs to use])
11155     if test "$with_system_apache_commons" = "yes"; then
11156         SYSTEM_APACHE_COMMONS=TRUE
11157         AC_MSG_RESULT([external])
11158         if test -z $COMMONS_LOGGING_JAR; then
11159             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11160                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11161            elif test -f /usr/share/java/commons-logging.jar; then
11162                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11163             else
11164                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11165             fi
11166         elif ! test -f $COMMONS_LOGGING_JAR; then
11167             AC_MSG_ERROR(commons-logging.jar not found.)
11168         fi
11169     else
11170         AC_MSG_RESULT([internal])
11171         SYSTEM_APACHE_COMMONS=
11172         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11173         NEED_ANT=TRUE
11174     fi
11176 AC_SUBST(SYSTEM_APACHE_COMMONS)
11177 AC_SUBST(COMMONS_LOGGING_JAR)
11178 AC_SUBST(COMMONS_LOGGING_VERSION)
11180 # scripting provider for BeanShell?
11181 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11182 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11183     AC_MSG_RESULT([yes])
11184     ENABLE_SCRIPTING_BEANSHELL=TRUE
11186     dnl ===================================================================
11187     dnl Check for system beanshell
11188     dnl ===================================================================
11189     AC_MSG_CHECKING([which beanshell to use])
11190     if test "$with_system_beanshell" = "yes"; then
11191         AC_MSG_RESULT([external])
11192         SYSTEM_BSH=TRUE
11193         if test -z $BSH_JAR; then
11194             BSH_JAR=/usr/share/java/bsh.jar
11195         fi
11196         if ! test -f $BSH_JAR; then
11197             AC_MSG_ERROR(bsh.jar not found.)
11198         fi
11199     else
11200         AC_MSG_RESULT([internal])
11201         SYSTEM_BSH=
11202         BUILD_TYPE="$BUILD_TYPE BSH"
11203     fi
11204 else
11205     AC_MSG_RESULT([no])
11206     ENABLE_SCRIPTING_BEANSHELL=
11207     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11209 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11210 AC_SUBST(SYSTEM_BSH)
11211 AC_SUBST(BSH_JAR)
11213 # scripting provider for JavaScript?
11214 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11215 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11216     AC_MSG_RESULT([yes])
11217     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11219     dnl ===================================================================
11220     dnl Check for system rhino
11221     dnl ===================================================================
11222     AC_MSG_CHECKING([which rhino to use])
11223     if test "$with_system_rhino" = "yes"; then
11224         AC_MSG_RESULT([external])
11225         SYSTEM_RHINO=TRUE
11226         if test -z $RHINO_JAR; then
11227             RHINO_JAR=/usr/share/java/js.jar
11228         fi
11229         if ! test -f $RHINO_JAR; then
11230             AC_MSG_ERROR(js.jar not found.)
11231         fi
11232     else
11233         AC_MSG_RESULT([internal])
11234         SYSTEM_RHINO=
11235         BUILD_TYPE="$BUILD_TYPE RHINO"
11236         NEED_ANT=TRUE
11237     fi
11238 else
11239     AC_MSG_RESULT([no])
11240     ENABLE_SCRIPTING_JAVASCRIPT=
11241     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11243 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11244 AC_SUBST(SYSTEM_RHINO)
11245 AC_SUBST(RHINO_JAR)
11247 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11248 # paths should be added to library search path. So lets put all 64-bit
11249 # platforms there.
11250 supports_multilib=
11251 case "$host_cpu" in
11252 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11253     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11254         supports_multilib="yes"
11255     fi
11256     ;;
11258     ;;
11259 esac
11261 dnl ===================================================================
11262 dnl QT5 Integration
11263 dnl ===================================================================
11265 QT5_CFLAGS=""
11266 QT5_LIBS=""
11267 QMAKE5="qmake"
11268 MOC5="moc"
11269 QT5_GOBJECT_CFLAGS=""
11270 QT5_GOBJECT_LIBS=""
11271 QT5_HAVE_GOBJECT=""
11272 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11273         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11274         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11275 then
11276     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11277     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11279     if test -n "$supports_multilib"; then
11280         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11281     fi
11283     qt5_test_include="QtWidgets/qapplication.h"
11284     qt5_test_library="libQt5Widgets.so"
11286     dnl Check for qmake5
11287     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11288     if test "$QMAKE5" = "no"; then
11289         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11290     else
11291         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11292         if test -z "$qmake5_test_ver"; then
11293             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11294         fi
11295         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11296         qt5_minimal_minor="6"
11297         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11298             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11299         else
11300             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11301         fi
11302     fi
11304     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11305     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11307     AC_MSG_CHECKING([for Qt5 headers])
11308     qt5_incdir="no"
11309     for inc_dir in $qt5_incdirs; do
11310         if test -r "$inc_dir/$qt5_test_include"; then
11311             qt5_incdir="$inc_dir"
11312             break
11313         fi
11314     done
11315     AC_MSG_RESULT([$qt5_incdir])
11316     if test "x$qt5_incdir" = "xno"; then
11317         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11318     fi
11320     AC_MSG_CHECKING([for Qt5 libraries])
11321     qt5_libdir="no"
11322     for lib_dir in $qt5_libdirs; do
11323         if test -r "$lib_dir/$qt5_test_library"; then
11324             qt5_libdir="$lib_dir"
11325             break
11326         fi
11327     done
11328     AC_MSG_RESULT([$qt5_libdir])
11329     if test "x$qt5_libdir" = "xno"; then
11330         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11331     fi
11333     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11334     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11335     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11337     if test "$USING_X11" = TRUE; then
11338         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11339         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11340         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11341         QT5_USING_X11=1
11342         AC_DEFINE(QT5_USING_X11)
11343     fi
11345     dnl Check for Meta Object Compiler
11347     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11348     if test "$MOC5" = "no"; then
11349         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11350 the root of your Qt installation by exporting QT5DIR before running "configure".])
11351     fi
11353     if test "$build_gstreamer_1_0" = "yes"; then
11354         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11355                 QT5_HAVE_GOBJECT=1
11356                 AC_DEFINE(QT5_HAVE_GOBJECT)
11357             ],
11358             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11359         )
11360     fi
11362 AC_SUBST(QT5_CFLAGS)
11363 AC_SUBST(QT5_LIBS)
11364 AC_SUBST(MOC5)
11365 AC_SUBST(QT5_GOBJECT_CFLAGS)
11366 AC_SUBST(QT5_GOBJECT_LIBS)
11367 AC_SUBST(QT5_HAVE_GOBJECT)
11369 dnl ===================================================================
11370 dnl KF5 Integration
11371 dnl ===================================================================
11373 KF5_CFLAGS=""
11374 KF5_LIBS=""
11375 KF5_CONFIG="kf5-config"
11376 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11377         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11378 then
11379     if test "$OS" = "HAIKU"; then
11380         haiku_arch="`echo $RTL_ARCH | tr X x`"
11381         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11382         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11383     fi
11385     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11386     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11387     if test -n "$supports_multilib"; then
11388         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11389     fi
11391     kf5_test_include="KF5/kcoreaddons_version.h"
11392     kf5_test_library="libKF5CoreAddons.so"
11393     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11395     dnl kf5 KDE4 support compatibility installed
11396     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11397     if test "$KF5_CONFIG" != "no"; then
11398         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11399         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11400     fi
11402     dnl Check for KF5 headers
11403     AC_MSG_CHECKING([for KF5 headers])
11404     kf5_incdir="no"
11405     for kf5_check in $kf5_incdirs; do
11406         if test -r "$kf5_check/$kf5_test_include"; then
11407             kf5_incdir="$kf5_check/KF5"
11408             break
11409         fi
11410     done
11411     AC_MSG_RESULT([$kf5_incdir])
11412     if test "x$kf5_incdir" = "xno"; then
11413         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11414     fi
11416     dnl Check for KF5 libraries
11417     AC_MSG_CHECKING([for KF5 libraries])
11418     kf5_libdir="no"
11419     for kf5_check in $kf5_libdirs; do
11420         if test -r "$kf5_check/$kf5_test_library"; then
11421             kf5_libdir="$kf5_check"
11422             break
11423         fi
11424     done
11426     AC_MSG_RESULT([$kf5_libdir])
11427     if test "x$kf5_libdir" = "xno"; then
11428         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11429     fi
11431     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"
11432     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11433     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11435     if test "$USING_X11" = TRUE; then
11436         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11437     fi
11439     AC_LANG_PUSH([C++])
11440     save_CXXFLAGS=$CXXFLAGS
11441     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11442     AC_MSG_CHECKING([whether KDE is >= 5.0])
11443        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11444 #include <kcoreaddons_version.h>
11446 int main(int argc, char **argv) {
11447        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11448        else return 1;
11450        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11451     CXXFLAGS=$save_CXXFLAGS
11452     AC_LANG_POP([C++])
11454 AC_SUBST(KF5_CFLAGS)
11455 AC_SUBST(KF5_LIBS)
11457 dnl ===================================================================
11458 dnl Test whether to include Evolution 2 support
11459 dnl ===================================================================
11460 AC_MSG_CHECKING([whether to enable evolution 2 support])
11461 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11462     AC_MSG_RESULT([yes])
11463     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11464     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11465     FilterLibs "${GOBJECT_LIBS}"
11466     GOBJECT_LIBS="${filteredlibs}"
11467     ENABLE_EVOAB2="TRUE"
11468 else
11469     ENABLE_EVOAB2=""
11470     AC_MSG_RESULT([no])
11472 AC_SUBST(ENABLE_EVOAB2)
11473 AC_SUBST(GOBJECT_CFLAGS)
11474 AC_SUBST(GOBJECT_LIBS)
11476 dnl ===================================================================
11477 dnl Test which themes to include
11478 dnl ===================================================================
11479 AC_MSG_CHECKING([which themes to include])
11480 # if none given use default subset of available themes
11481 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11482     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11485 WITH_THEMES=""
11486 if test "x$with_theme" != "xno"; then
11487     for theme in $with_theme; do
11488         case $theme in
11489         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11490         default) real_theme=colibre ;;
11491         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11492         esac
11493         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11494     done
11496 AC_MSG_RESULT([$WITH_THEMES])
11497 AC_SUBST([WITH_THEMES])
11498 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11499 for theme in $with_theme; do
11500     case $theme in
11501     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11502     *) ;;
11503     esac
11504 done
11506 dnl ===================================================================
11507 dnl Test whether to integrate helppacks into the product's installer
11508 dnl ===================================================================
11509 AC_MSG_CHECKING([for helppack integration])
11510 if test "$with_helppack_integration" = "no"; then
11511     AC_MSG_RESULT([no integration])
11512 else
11513     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11514     AC_MSG_RESULT([integration])
11517 ###############################################################################
11518 # Extensions checking
11519 ###############################################################################
11520 AC_MSG_CHECKING([for extensions integration])
11521 if test "x$enable_extension_integration" != "xno"; then
11522     WITH_EXTENSION_INTEGRATION=TRUE
11523     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11524     AC_MSG_RESULT([yes, use integration])
11525 else
11526     WITH_EXTENSION_INTEGRATION=
11527     AC_MSG_RESULT([no, do not integrate])
11529 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11531 dnl Should any extra extensions be included?
11532 dnl There are standalone tests for each of these below.
11533 WITH_EXTRA_EXTENSIONS=
11534 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11536 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11537 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11538 if test "x$with_java" != "xno"; then
11539     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11540     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11543 AC_MSG_CHECKING([whether to build opens___.ttf])
11544 if test "$enable_build_opensymbol" = "yes"; then
11545     AC_MSG_RESULT([yes])
11546     AC_PATH_PROG(FONTFORGE, fontforge)
11547     if test -z "$FONTFORGE"; then
11548         AC_MSG_ERROR([fontforge not installed])
11549     fi
11550 else
11551     AC_MSG_RESULT([no])
11552     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11553     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11555 AC_SUBST(OPENSYMBOL_TTF)
11556 AC_SUBST(FONTFORGE)
11558 dnl ===================================================================
11559 dnl Test whether to include fonts
11560 dnl ===================================================================
11561 AC_MSG_CHECKING([whether to include third-party fonts])
11562 if test "$with_fonts" != "no"; then
11563     AC_MSG_RESULT([yes])
11564     WITH_FONTS=TRUE
11565     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11566     AC_DEFINE(HAVE_MORE_FONTS)
11567 else
11568     AC_MSG_RESULT([no])
11569     WITH_FONTS=
11570     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11572 AC_SUBST(WITH_FONTS)
11575 dnl ===================================================================
11576 dnl Test whether to enable online update service
11577 dnl ===================================================================
11578 AC_MSG_CHECKING([whether to enable online update])
11579 ENABLE_ONLINE_UPDATE=
11580 ENABLE_ONLINE_UPDATE_MAR=
11581 UPDATE_CONFIG=
11582 if test "$enable_online_update" = ""; then
11583     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11584         AC_MSG_RESULT([yes])
11585         ENABLE_ONLINE_UPDATE="TRUE"
11586     else
11587         AC_MSG_RESULT([no])
11588     fi
11589 else
11590     if test "$enable_online_update" = "mar"; then
11591         AC_MSG_RESULT([yes - MAR-based online update])
11592         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11593         if test "$with_update_config" = ""; then
11594             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11595         fi
11596         UPDATE_CONFIG="$with_update_config"
11597         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11598     elif test "$enable_online_update" = "yes"; then
11599         AC_MSG_RESULT([yes])
11600         ENABLE_ONLINE_UPDATE="TRUE"
11601     else
11602         AC_MSG_RESULT([no])
11603     fi
11605 AC_SUBST(ENABLE_ONLINE_UPDATE)
11606 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11607 AC_SUBST(UPDATE_CONFIG)
11609 dnl ===================================================================
11610 dnl Test whether we need bzip2
11611 dnl ===================================================================
11612 SYSTEM_BZIP2=
11613 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11614     AC_MSG_CHECKING([whether to use system bzip2])
11615     if test "$with_system_bzip2" = yes; then
11616         SYSTEM_BZIP2=TRUE
11617         AC_MSG_RESULT([yes])
11618         PKG_CHECK_MODULES(BZIP2, bzip2)
11619         FilterLibs "${BZIP2_LIBS}"
11620         BZIP2_LIBS="${filteredlibs}"
11621     else
11622         AC_MSG_RESULT([no])
11623         BUILD_TYPE="$BUILD_TYPE BZIP2"
11624     fi
11626 AC_SUBST(SYSTEM_BZIP2)
11627 AC_SUBST(BZIP2_CFLAGS)
11628 AC_SUBST(BZIP2_LIBS)
11630 dnl ===================================================================
11631 dnl Test whether to enable extension update
11632 dnl ===================================================================
11633 AC_MSG_CHECKING([whether to enable extension update])
11634 ENABLE_EXTENSION_UPDATE=
11635 if test "x$enable_extension_update" = "xno"; then
11636     AC_MSG_RESULT([no])
11637 else
11638     AC_MSG_RESULT([yes])
11639     ENABLE_EXTENSION_UPDATE="TRUE"
11640     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11641     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11643 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11646 dnl ===================================================================
11647 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11648 dnl ===================================================================
11649 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11650 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11651     AC_MSG_RESULT([no])
11652     ENABLE_SILENT_MSI=
11653 else
11654     AC_MSG_RESULT([yes])
11655     ENABLE_SILENT_MSI=TRUE
11656     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11658 AC_SUBST(ENABLE_SILENT_MSI)
11660 AC_MSG_CHECKING([whether and how to use Xinerama])
11661 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11662     if test "$x_libraries" = "default_x_libraries"; then
11663         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11664         if test "x$XINERAMALIB" = x; then
11665            XINERAMALIB="/usr/lib"
11666         fi
11667     else
11668         XINERAMALIB="$x_libraries"
11669     fi
11670     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11671         # we have both versions, let the user decide but use the dynamic one
11672         # per default
11673         USE_XINERAMA=TRUE
11674         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11675             XINERAMA_LINK=dynamic
11676         else
11677             XINERAMA_LINK=static
11678         fi
11679     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11680         # we have only the dynamic version
11681         USE_XINERAMA=TRUE
11682         XINERAMA_LINK=dynamic
11683     elif test -e "$XINERAMALIB/libXinerama.a"; then
11684         # static version
11685         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11686             USE_XINERAMA=TRUE
11687             XINERAMA_LINK=static
11688         else
11689             USE_XINERAMA=
11690             XINERAMA_LINK=none
11691         fi
11692     else
11693         # no Xinerama
11694         USE_XINERAMA=
11695         XINERAMA_LINK=none
11696     fi
11697     if test "$USE_XINERAMA" = "TRUE"; then
11698         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11699         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11700             [AC_MSG_ERROR(Xinerama header not found.)], [])
11701         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11702         if test "x$XEXTLIB" = x; then
11703            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11704         fi
11705         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11706         if test "$_os" = "FreeBSD"; then
11707             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11708         fi
11709         if test "$_os" = "Linux"; then
11710             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11711         fi
11712         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11713             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11714     else
11715         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11716     fi
11717 else
11718     USE_XINERAMA=
11719     XINERAMA_LINK=none
11720     AC_MSG_RESULT([no])
11722 AC_SUBST(USE_XINERAMA)
11723 AC_SUBST(XINERAMA_LINK)
11725 dnl ===================================================================
11726 dnl Test whether to build cairo or rely on the system version
11727 dnl ===================================================================
11729 if test "$USING_X11" = TRUE; then
11730     # Used in vcl/Library_vclplug_gen.mk
11731     test_cairo=yes
11734 if test "$test_cairo" = "yes"; then
11735     AC_MSG_CHECKING([whether to use the system cairo])
11737     : ${with_system_cairo:=$with_system_libs}
11738     if test "$with_system_cairo" = "yes"; then
11739         SYSTEM_CAIRO=TRUE
11740         AC_MSG_RESULT([yes])
11742         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11743         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11744         FilterLibs "${CAIRO_LIBS}"
11745         CAIRO_LIBS="${filteredlibs}"
11747         if test "$test_xrender" = "yes"; then
11748             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11749             AC_LANG_PUSH([C])
11750             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11751 #ifdef PictStandardA8
11752 #else
11753       return fail;
11754 #endif
11755 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11757             AC_LANG_POP([C])
11758         fi
11759     else
11760         SYSTEM_CAIRO=
11761         AC_MSG_RESULT([no])
11763         BUILD_TYPE="$BUILD_TYPE CAIRO"
11764     fi
11767 AC_SUBST(SYSTEM_CAIRO)
11768 AC_SUBST(CAIRO_CFLAGS)
11769 AC_SUBST(CAIRO_LIBS)
11771 dnl ===================================================================
11772 dnl Test whether to use avahi
11773 dnl ===================================================================
11774 if test "$_os" = "WINNT"; then
11775     # Windows uses bundled mDNSResponder
11776     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11777 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11778     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11779                       [ENABLE_AVAHI="TRUE"])
11780     AC_DEFINE(HAVE_FEATURE_AVAHI)
11781     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11782     FilterLibs "${AVAHI_LIBS}"
11783     AVAHI_LIBS="${filteredlibs}"
11786 AC_SUBST(ENABLE_AVAHI)
11787 AC_SUBST(AVAHI_CFLAGS)
11788 AC_SUBST(AVAHI_LIBS)
11790 dnl ===================================================================
11791 dnl Test whether to use liblangtag
11792 dnl ===================================================================
11793 SYSTEM_LIBLANGTAG=
11794 AC_MSG_CHECKING([whether to use system liblangtag])
11795 if test "$with_system_liblangtag" = yes; then
11796     SYSTEM_LIBLANGTAG=TRUE
11797     AC_MSG_RESULT([yes])
11798     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11799     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11800     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11801     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11802     FilterLibs "${LIBLANGTAG_LIBS}"
11803     LIBLANGTAG_LIBS="${filteredlibs}"
11804 else
11805     SYSTEM_LIBLANGTAG=
11806     AC_MSG_RESULT([no])
11807     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11808     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11809     if test "$COM" = "MSC"; then
11810         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11811     else
11812         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11813     fi
11815 AC_SUBST(SYSTEM_LIBLANGTAG)
11816 AC_SUBST(LIBLANGTAG_CFLAGS)
11817 AC_SUBST(LIBLANGTAG_LIBS)
11819 dnl ===================================================================
11820 dnl Test whether to build libpng or rely on the system version
11821 dnl ===================================================================
11823 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11825 dnl ===================================================================
11826 dnl Check for runtime JVM search path
11827 dnl ===================================================================
11828 if test "$ENABLE_JAVA" != ""; then
11829     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11830     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11831         AC_MSG_RESULT([yes])
11832         if ! test -d "$with_jvm_path"; then
11833             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11834         fi
11835         if ! test -d "$with_jvm_path"jvm; then
11836             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11837         fi
11838         JVM_ONE_PATH_CHECK="$with_jvm_path"
11839         AC_SUBST(JVM_ONE_PATH_CHECK)
11840     else
11841         AC_MSG_RESULT([no])
11842     fi
11845 dnl ===================================================================
11846 dnl Test for the presence of Ant and that it works
11847 dnl ===================================================================
11849 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11850     ANT_HOME=; export ANT_HOME
11851     WITH_ANT_HOME=; export WITH_ANT_HOME
11852     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11853         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11854             if test "$_os" = "WINNT"; then
11855                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11856             else
11857                 with_ant_home="$LODE_HOME/opt/ant"
11858             fi
11859         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11860             with_ant_home="$LODE_HOME/opt/ant"
11861         fi
11862     fi
11863     if test -z "$with_ant_home"; then
11864         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11865     else
11866         if test "$_os" = "WINNT"; then
11867             # AC_PATH_PROGS needs unix path
11868             with_ant_home=`cygpath -u "$with_ant_home"`
11869         fi
11870         AbsolutePath "$with_ant_home"
11871         with_ant_home=$absolute_path
11872         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11873         WITH_ANT_HOME=$with_ant_home
11874         ANT_HOME=$with_ant_home
11875     fi
11877     if test -z "$ANT"; then
11878         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11879     else
11880         # resolve relative or absolute symlink
11881         while test -h "$ANT"; do
11882             a_cwd=`pwd`
11883             a_basename=`basename "$ANT"`
11884             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11885             cd "`dirname "$ANT"`"
11886             cd "`dirname "$a_script"`"
11887             ANT="`pwd`"/"`basename "$a_script"`"
11888             cd "$a_cwd"
11889         done
11891         AC_MSG_CHECKING([if $ANT works])
11892         mkdir -p conftest.dir
11893         a_cwd=$(pwd)
11894         cd conftest.dir
11895         cat > conftest.java << EOF
11896         public class conftest {
11897             int testmethod(int a, int b) {
11898                     return a + b;
11899             }
11900         }
11903         cat > conftest.xml << EOF
11904         <project name="conftest" default="conftest">
11905         <target name="conftest">
11906             <javac srcdir="." includes="conftest.java">
11907             </javac>
11908         </target>
11909         </project>
11912         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11913         if test $? = 0 -a -f ./conftest.class; then
11914             AC_MSG_RESULT([Ant works])
11915             if test -z "$WITH_ANT_HOME"; then
11916                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11917                 if test -z "$ANT_HOME"; then
11918                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11919                 fi
11920             else
11921                 ANT_HOME="$WITH_ANT_HOME"
11922             fi
11923         else
11924             echo "configure: Ant test failed" >&5
11925             cat conftest.java >&5
11926             cat conftest.xml >&5
11927             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11928         fi
11929         cd "$a_cwd"
11930         rm -fr conftest.dir
11931     fi
11932     if test -z "$ANT_HOME"; then
11933         ANT_HOME="NO_ANT_HOME"
11934     else
11935         PathFormat "$ANT_HOME"
11936         ANT_HOME="$formatted_path"
11937         PathFormat "$ANT"
11938         ANT="$formatted_path"
11939     fi
11940     AC_SUBST(ANT_HOME)
11941     AC_SUBST(ANT)
11943     dnl Checking for ant.jar
11944     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11945         AC_MSG_CHECKING([Ant lib directory])
11946         if test -f $ANT_HOME/lib/ant.jar; then
11947             ANT_LIB="$ANT_HOME/lib"
11948         else
11949             if test -f $ANT_HOME/ant.jar; then
11950                 ANT_LIB="$ANT_HOME"
11951             else
11952                 if test -f /usr/share/java/ant.jar; then
11953                     ANT_LIB=/usr/share/java
11954                 else
11955                     if test -f /usr/share/ant-core/lib/ant.jar; then
11956                         ANT_LIB=/usr/share/ant-core/lib
11957                     else
11958                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11959                             ANT_LIB="$ANT_HOME/lib/ant"
11960                         else
11961                             if test -f /usr/share/lib/ant/ant.jar; then
11962                                 ANT_LIB=/usr/share/lib/ant
11963                             else
11964                                 AC_MSG_ERROR([Ant libraries not found!])
11965                             fi
11966                         fi
11967                     fi
11968                 fi
11969             fi
11970         fi
11971         PathFormat "$ANT_LIB"
11972         ANT_LIB="$formatted_path"
11973         AC_MSG_RESULT([Ant lib directory found.])
11974     fi
11975     AC_SUBST(ANT_LIB)
11977     ant_minver=1.6.0
11978     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11980     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11981     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
11982     ant_version_major=`echo $ant_version | cut -d. -f1`
11983     ant_version_minor=`echo $ant_version | cut -d. -f2`
11984     echo "configure: ant_version $ant_version " >&5
11985     echo "configure: ant_version_major $ant_version_major " >&5
11986     echo "configure: ant_version_minor $ant_version_minor " >&5
11987     if test "$ant_version_major" -ge "2"; then
11988         AC_MSG_RESULT([yes, $ant_version])
11989     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11990         AC_MSG_RESULT([yes, $ant_version])
11991     else
11992         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11993     fi
11995     rm -f conftest* core core.* *.core
11998 OOO_JUNIT_JAR=
11999 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12000     AC_MSG_CHECKING([for JUnit 4])
12001     if test "$with_junit" = "yes"; then
12002         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12003             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12004         elif test -e /usr/share/java/junit4.jar; then
12005             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12006         else
12007            if test -e /usr/share/lib/java/junit.jar; then
12008               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12009            else
12010               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12011            fi
12012         fi
12013     else
12014         OOO_JUNIT_JAR=$with_junit
12015     fi
12016     if test "$_os" = "WINNT"; then
12017         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12018     fi
12019     printf 'import org.junit.Before;' > conftest.java
12020     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12021         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12022     else
12023         AC_MSG_ERROR(
12024 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12025  specify its pathname via --with-junit=..., or disable it via --without-junit])
12026     fi
12027     rm -f conftest.class conftest.java
12028     if test $OOO_JUNIT_JAR != ""; then
12029     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12030     fi
12032 AC_SUBST(OOO_JUNIT_JAR)
12034 HAMCREST_JAR=
12035 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12036     AC_MSG_CHECKING([for included Hamcrest])
12037     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12038     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12039         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12040     else
12041         AC_MSG_RESULT([Not included])
12042         AC_MSG_CHECKING([for standalone hamcrest jar.])
12043         if test "$with_hamcrest" = "yes"; then
12044             if test -e /usr/share/lib/java/hamcrest.jar; then
12045                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12046             elif test -e /usr/share/java/hamcrest/core.jar; then
12047                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12048             else
12049                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12050             fi
12051         else
12052             HAMCREST_JAR=$with_hamcrest
12053         fi
12054         if test "$_os" = "WINNT"; then
12055             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12056         fi
12057         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12058             AC_MSG_RESULT([$HAMCREST_JAR])
12059         else
12060             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),
12061                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12062         fi
12063     fi
12064     rm -f conftest.class conftest.java
12066 AC_SUBST(HAMCREST_JAR)
12069 AC_SUBST(SCPDEFS)
12072 # check for wget and curl
12074 WGET=
12075 CURL=
12077 if test "$enable_fetch_external" != "no"; then
12079 CURL=`which curl 2>/dev/null`
12081 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12082     # wget new enough?
12083     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12084     if test $? -eq 0; then
12085         WGET=$i
12086         break
12087     fi
12088 done
12090 if test -z "$WGET" -a -z "$CURL"; then
12091     AC_MSG_ERROR([neither wget nor curl found!])
12096 AC_SUBST(WGET)
12097 AC_SUBST(CURL)
12100 # check for sha256sum
12102 SHA256SUM=
12104 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12105     eval "$i -a 256 --version" > /dev/null 2>&1
12106     ret=$?
12107     if test $ret -eq 0; then
12108         SHA256SUM="$i -a 256"
12109         break
12110     fi
12111 done
12113 if test -z "$SHA256SUM"; then
12114     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12115         eval "$i --version" > /dev/null 2>&1
12116         ret=$?
12117         if test $ret -eq 0; then
12118             SHA256SUM=$i
12119             break
12120         fi
12121     done
12124 if test -z "$SHA256SUM"; then
12125     AC_MSG_ERROR([no sha256sum found!])
12128 AC_SUBST(SHA256SUM)
12130 dnl ===================================================================
12131 dnl Dealing with l10n options
12132 dnl ===================================================================
12133 AC_MSG_CHECKING([which languages to be built])
12134 # get list of all languages
12135 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12136 # the sed command does the following:
12137 #   + if a line ends with a backslash, append the next line to it
12138 #   + adds " on the beginning of the value (after =)
12139 #   + adds " at the end of the value
12140 #   + removes en-US; we want to put it on the beginning
12141 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12142 [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)]
12143 ALL_LANGS="en-US $completelangiso"
12144 # check the configured localizations
12145 WITH_LANG="$with_lang"
12147 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12148 # (Norwegian is "nb" and "nn".)
12149 if test "$WITH_LANG" = "no"; then
12150     WITH_LANG=
12153 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12154     AC_MSG_RESULT([en-US])
12155 else
12156     AC_MSG_RESULT([$WITH_LANG])
12157     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12158     if test -z "$MSGFMT"; then
12159         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12160             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12161         elif test -x "/opt/lo/bin/msgfmt"; then
12162             MSGFMT="/opt/lo/bin/msgfmt"
12163         else
12164             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12165             if test -z "$MSGFMT"; then
12166                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12167             fi
12168         fi
12169     fi
12170     if test -z "$MSGUNIQ"; then
12171         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12172             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12173         elif test -x "/opt/lo/bin/msguniq"; then
12174             MSGUNIQ="/opt/lo/bin/msguniq"
12175         else
12176             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12177             if test -z "$MSGUNIQ"; then
12178                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12179             fi
12180         fi
12181     fi
12183 AC_SUBST(MSGFMT)
12184 AC_SUBST(MSGUNIQ)
12185 # check that the list is valid
12186 for lang in $WITH_LANG; do
12187     test "$lang" = "ALL" && continue
12188     # need to check for the exact string, so add space before and after the list of all languages
12189     for vl in $ALL_LANGS; do
12190         if test "$vl" = "$lang"; then
12191            break
12192         fi
12193     done
12194     if test "$vl" != "$lang"; then
12195         # if you're reading this - you prolly quoted your languages remove the quotes ...
12196         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12197     fi
12198 done
12199 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12200     echo $WITH_LANG | grep -q en-US
12201     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12203 # list with substituted ALL
12204 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12205 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12206 test "$WITH_LANG" = "en-US" && WITH_LANG=
12207 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12208     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12209     ALL_LANGS=`echo $ALL_LANGS qtz`
12211 AC_SUBST(ALL_LANGS)
12212 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12213 AC_SUBST(WITH_LANG)
12214 AC_SUBST(WITH_LANG_LIST)
12215 AC_SUBST(GIT_NEEDED_SUBMODULES)
12217 WITH_POOR_HELP_LOCALIZATIONS=
12218 if test -d "$SRC_ROOT/translations/source"; then
12219     for l in `ls -1 $SRC_ROOT/translations/source`; do
12220         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12221             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12222         fi
12223     done
12225 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12227 if test -n "$with_locales"; then
12228     WITH_LOCALES="$with_locales"
12230     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12231     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12232     # config_host/config_locales.h.in
12233     for locale in $WITH_LOCALES; do
12234         lang=${locale%_*}
12236         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12238         case $lang in
12239         hi|mr*ne)
12240             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12241             ;;
12242         bg|ru)
12243             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12244             ;;
12245         esac
12246     done
12247 else
12248     AC_DEFINE(WITH_LOCALE_ALL)
12250 AC_SUBST(WITH_LOCALES)
12252 dnl git submodule update --reference
12253 dnl ===================================================================
12254 if test -n "${GIT_REFERENCE_SRC}"; then
12255     for repo in ${GIT_NEEDED_SUBMODULES}; do
12256         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12257             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12258         fi
12259     done
12261 AC_SUBST(GIT_REFERENCE_SRC)
12263 dnl git submodules linked dirs
12264 dnl ===================================================================
12265 if test -n "${GIT_LINK_SRC}"; then
12266     for repo in ${GIT_NEEDED_SUBMODULES}; do
12267         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12268             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12269         fi
12270     done
12272 AC_SUBST(GIT_LINK_SRC)
12274 dnl branding
12275 dnl ===================================================================
12276 AC_MSG_CHECKING([for alternative branding images directory])
12277 # initialize mapped arrays
12278 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12279 brand_files="$BRAND_INTRO_IMAGES about.svg"
12281 if test -z "$with_branding" -o "$with_branding" = "no"; then
12282     AC_MSG_RESULT([none])
12283     DEFAULT_BRAND_IMAGES="$brand_files"
12284 else
12285     if ! test -d $with_branding ; then
12286         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12287     else
12288         AC_MSG_RESULT([$with_branding])
12289         CUSTOM_BRAND_DIR="$with_branding"
12290         for lfile in $brand_files
12291         do
12292             if ! test -f $with_branding/$lfile ; then
12293                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12294                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12295             else
12296                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12297             fi
12298         done
12299         check_for_progress="yes"
12300     fi
12302 AC_SUBST([BRAND_INTRO_IMAGES])
12303 AC_SUBST([CUSTOM_BRAND_DIR])
12304 AC_SUBST([CUSTOM_BRAND_IMAGES])
12305 AC_SUBST([DEFAULT_BRAND_IMAGES])
12308 AC_MSG_CHECKING([for 'intro' progress settings])
12309 PROGRESSBARCOLOR=
12310 PROGRESSSIZE=
12311 PROGRESSPOSITION=
12312 PROGRESSFRAMECOLOR=
12313 PROGRESSTEXTCOLOR=
12314 PROGRESSTEXTBASELINE=
12316 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12317     source "$with_branding/progress.conf"
12318     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12319 else
12320     AC_MSG_RESULT([none])
12323 AC_SUBST(PROGRESSBARCOLOR)
12324 AC_SUBST(PROGRESSSIZE)
12325 AC_SUBST(PROGRESSPOSITION)
12326 AC_SUBST(PROGRESSFRAMECOLOR)
12327 AC_SUBST(PROGRESSTEXTCOLOR)
12328 AC_SUBST(PROGRESSTEXTBASELINE)
12331 AC_MSG_CHECKING([for extra build ID])
12332 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12333     EXTRA_BUILDID="$with_extra_buildid"
12335 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12336 if test -n "$EXTRA_BUILDID" ; then
12337     AC_MSG_RESULT([$EXTRA_BUILDID])
12338 else
12339     AC_MSG_RESULT([not set])
12341 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12343 OOO_VENDOR=
12344 AC_MSG_CHECKING([for vendor])
12345 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12346     OOO_VENDOR="$USERNAME"
12348     if test -z "$OOO_VENDOR"; then
12349         OOO_VENDOR="$USER"
12350     fi
12352     if test -z "$OOO_VENDOR"; then
12353         OOO_VENDOR="`id -u -n`"
12354     fi
12356     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12357 else
12358     OOO_VENDOR="$with_vendor"
12359     AC_MSG_RESULT([$OOO_VENDOR])
12361 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12362 AC_SUBST(OOO_VENDOR)
12364 if test "$_os" = "Android" ; then
12365     ANDROID_PACKAGE_NAME=
12366     AC_MSG_CHECKING([for Android package name])
12367     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12368         if test -n "$ENABLE_DEBUG"; then
12369             # Default to the package name that makes ndk-gdb happy.
12370             ANDROID_PACKAGE_NAME="org.libreoffice"
12371         else
12372             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12373         fi
12375         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12376     else
12377         ANDROID_PACKAGE_NAME="$with_android_package_name"
12378         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12379     fi
12380     AC_SUBST(ANDROID_PACKAGE_NAME)
12383 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12384 if test "$with_compat_oowrappers" = "yes"; then
12385     WITH_COMPAT_OOWRAPPERS=TRUE
12386     AC_MSG_RESULT(yes)
12387 else
12388     WITH_COMPAT_OOWRAPPERS=
12389     AC_MSG_RESULT(no)
12391 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12393 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12394 AC_MSG_CHECKING([for install dirname])
12395 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12396     INSTALLDIRNAME="$with_install_dirname"
12398 AC_MSG_RESULT([$INSTALLDIRNAME])
12399 AC_SUBST(INSTALLDIRNAME)
12401 AC_MSG_CHECKING([for prefix])
12402 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12403 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12404 PREFIXDIR="$prefix"
12405 AC_MSG_RESULT([$PREFIXDIR])
12406 AC_SUBST(PREFIXDIR)
12408 LIBDIR=[$(eval echo $(eval echo $libdir))]
12409 AC_SUBST(LIBDIR)
12411 DATADIR=[$(eval echo $(eval echo $datadir))]
12412 AC_SUBST(DATADIR)
12414 MANDIR=[$(eval echo $(eval echo $mandir))]
12415 AC_SUBST(MANDIR)
12417 DOCDIR=[$(eval echo $(eval echo $docdir))]
12418 AC_SUBST(DOCDIR)
12420 BINDIR=[$(eval echo $(eval echo $bindir))]
12421 AC_SUBST(BINDIR)
12423 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12424 AC_SUBST(INSTALLDIR)
12426 TESTINSTALLDIR="${BUILDDIR}/test-install"
12427 AC_SUBST(TESTINSTALLDIR)
12430 # ===================================================================
12431 # OAuth2 id and secrets
12432 # ===================================================================
12434 AC_MSG_CHECKING([for Google Drive client id and secret])
12435 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12436     AC_MSG_RESULT([not set])
12437     GDRIVE_CLIENT_ID="\"\""
12438     GDRIVE_CLIENT_SECRET="\"\""
12439 else
12440     AC_MSG_RESULT([set])
12441     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12442     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12444 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12445 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12447 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12448 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12449     AC_MSG_RESULT([not set])
12450     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12451     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12452 else
12453     AC_MSG_RESULT([set])
12454     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12455     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12457 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12458 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12460 AC_MSG_CHECKING([for OneDrive client id and secret])
12461 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12462     AC_MSG_RESULT([not set])
12463     ONEDRIVE_CLIENT_ID="\"\""
12464     ONEDRIVE_CLIENT_SECRET="\"\""
12465 else
12466     AC_MSG_RESULT([set])
12467     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12468     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12470 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12471 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12474 dnl ===================================================================
12475 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12476 dnl --enable-dependency-tracking configure option
12477 dnl ===================================================================
12478 AC_MSG_CHECKING([whether to enable dependency tracking])
12479 if test "$enable_dependency_tracking" = "no"; then
12480     nodep=TRUE
12481     AC_MSG_RESULT([no])
12482 else
12483     AC_MSG_RESULT([yes])
12485 AC_SUBST(nodep)
12487 dnl ===================================================================
12488 dnl Number of CPUs to use during the build
12489 dnl ===================================================================
12490 AC_MSG_CHECKING([for number of processors to use])
12491 # plain --with-parallelism is just the default
12492 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12493     if test "$with_parallelism" = "no"; then
12494         PARALLELISM=0
12495     else
12496         PARALLELISM=$with_parallelism
12497     fi
12498 else
12499     if test "$enable_icecream" = "yes"; then
12500         PARALLELISM="40"
12501     else
12502         case `uname -s` in
12504         Darwin|FreeBSD|NetBSD|OpenBSD)
12505             PARALLELISM=`sysctl -n hw.ncpu`
12506             ;;
12508         Linux)
12509             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12510         ;;
12511         # what else than above does profit here *and* has /proc?
12512         *)
12513             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12514             ;;
12515         esac
12517         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12518         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12519     fi
12522 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12523     if test -z "$with_parallelism"; then
12524             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12525             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12526             PARALLELISM="1"
12527     else
12528         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."
12529     fi
12532 if test $PARALLELISM -eq 0; then
12533     AC_MSG_RESULT([explicit make -j option needed])
12534 else
12535     AC_MSG_RESULT([$PARALLELISM])
12537 AC_SUBST(PARALLELISM)
12539 IWYU_PATH="$with_iwyu"
12540 AC_SUBST(IWYU_PATH)
12541 if test ! -z "$IWYU_PATH"; then
12542     if test ! -f "$IWYU_PATH"; then
12543         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12544     fi
12548 # Set up ILIB for MSVC build
12550 ILIB1=
12551 if test "$build_os" = "cygwin"; then
12552     ILIB="."
12553     if test -n "$JAVA_HOME"; then
12554         ILIB="$ILIB;$JAVA_HOME/lib"
12555     fi
12556     ILIB1=-link
12557     if test "$BITNESS_OVERRIDE" = 64; then
12558         ILIB="$ILIB;$COMPATH/lib/x64"
12559         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12560         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12561         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12562         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12563             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12564             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12565         fi
12566         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12567         ucrtlibpath_formatted=$formatted_path
12568         ILIB="$ILIB;$ucrtlibpath_formatted"
12569         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12570     else
12571         ILIB="$ILIB;$COMPATH/lib/x86"
12572         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12573         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12574         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12575         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12576             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12577             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12578         fi
12579         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12580         ucrtlibpath_formatted=$formatted_path
12581         ILIB="$ILIB;$ucrtlibpath_formatted"
12582         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12583     fi
12584     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12585         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12586     else
12587         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12588     fi
12590     AC_SUBST(ILIB)
12593 # ===================================================================
12594 # Creating bigger shared library to link against
12595 # ===================================================================
12596 AC_MSG_CHECKING([whether to create huge library])
12597 MERGELIBS=
12599 if test $_os = iOS -o $_os = Android; then
12600     # Never any point in mergelibs for these as we build just static
12601     # libraries anyway...
12602     enable_mergelibs=no
12605 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12606     if test $_os != Linux -a $_os != WINNT; then
12607         add_warning "--enable-mergelibs is not tested for this platform"
12608     fi
12609     MERGELIBS="TRUE"
12610     AC_MSG_RESULT([yes])
12611 else
12612     AC_MSG_RESULT([no])
12614 AC_SUBST([MERGELIBS])
12616 dnl ===================================================================
12617 dnl icerun is a wrapper that stops us spawning tens of processes
12618 dnl locally - for tools that can't be executed on the compile cluster
12619 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12620 dnl ===================================================================
12621 AC_MSG_CHECKING([whether to use icerun wrapper])
12622 ICECREAM_RUN=
12623 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12624     ICECREAM_RUN=icerun
12625     AC_MSG_RESULT([yes])
12626 else
12627     AC_MSG_RESULT([no])
12629 AC_SUBST(ICECREAM_RUN)
12631 dnl ===================================================================
12632 dnl Setup the ICECC_VERSION for the build the same way it was set for
12633 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12634 dnl ===================================================================
12635 x_ICECC_VERSION=[\#]
12636 if test -n "$ICECC_VERSION" ; then
12637     x_ICECC_VERSION=
12639 AC_SUBST(x_ICECC_VERSION)
12640 AC_SUBST(ICECC_VERSION)
12642 dnl ===================================================================
12644 AC_MSG_CHECKING([MPL subset])
12645 MPL_SUBSET=
12647 if test "$enable_mpl_subset" = "yes"; then
12648     warn_report=false
12649     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12650         warn_report=true
12651     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12652         warn_report=true
12653     fi
12654     if test "$warn_report" = "true"; then
12655         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12656     fi
12657     if test "x$enable_postgresql_sdbc" != "xno"; then
12658         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12659     fi
12660     if test "$enable_lotuswordpro" = "yes"; then
12661         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12662     fi
12663     if test "$WITH_WEBDAV" = "neon"; then
12664         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12665     fi
12666     if test -n "$ENABLE_POPPLER"; then
12667         if test "x$SYSTEM_POPPLER" = "x"; then
12668             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12669         fi
12670     fi
12671     # cf. m4/libo_check_extension.m4
12672     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12673         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12674     fi
12675     for theme in $WITH_THEMES; do
12676         case $theme in
12677         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12678             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12679         *) : ;;
12680         esac
12681     done
12683     ENABLE_OPENGL_TRANSITIONS=
12685     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12686         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12687     fi
12689     MPL_SUBSET="TRUE"
12690     AC_DEFINE(MPL_HAVE_SUBSET)
12691     AC_MSG_RESULT([only])
12692 else
12693     AC_MSG_RESULT([no restrictions])
12695 AC_SUBST(MPL_SUBSET)
12697 dnl ===================================================================
12699 AC_MSG_CHECKING([formula logger])
12700 ENABLE_FORMULA_LOGGER=
12702 if test "x$enable_formula_logger" = "xyes"; then
12703     AC_MSG_RESULT([yes])
12704     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12705     ENABLE_FORMULA_LOGGER=TRUE
12706 elif test -n "$ENABLE_DBGUTIL" ; then
12707     AC_MSG_RESULT([yes])
12708     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12709     ENABLE_FORMULA_LOGGER=TRUE
12710 else
12711     AC_MSG_RESULT([no])
12714 AC_SUBST(ENABLE_FORMULA_LOGGER)
12716 dnl ===================================================================
12717 dnl Setting up the environment.
12718 dnl ===================================================================
12719 AC_MSG_NOTICE([setting up the build environment variables...])
12721 AC_SUBST(COMPATH)
12723 if test "$build_os" = "cygwin"; then
12724     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12725         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12726         ATL_INCLUDE="$COMPATH/atlmfc/include"
12727     elif test -d "$COMPATH/atlmfc/lib"; then
12728         ATL_LIB="$COMPATH/atlmfc/lib"
12729         ATL_INCLUDE="$COMPATH/atlmfc/include"
12730     else
12731         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12732         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12733     fi
12734     if test "$BITNESS_OVERRIDE" = 64; then
12735         ATL_LIB="$ATL_LIB/x64"
12736     else
12737         ATL_LIB="$ATL_LIB/x86"
12738     fi
12739     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12740     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12742     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12743     PathFormat "/usr/bin/find.exe"
12744     FIND="$formatted_path"
12745     PathFormat "/usr/bin/sort.exe"
12746     SORT="$formatted_path"
12747     PathFormat "/usr/bin/grep.exe"
12748     WIN_GREP="$formatted_path"
12749     PathFormat "/usr/bin/ls.exe"
12750     WIN_LS="$formatted_path"
12751     PathFormat "/usr/bin/touch.exe"
12752     WIN_TOUCH="$formatted_path"
12753 else
12754     FIND=find
12755     SORT=sort
12758 AC_SUBST(ATL_INCLUDE)
12759 AC_SUBST(ATL_LIB)
12760 AC_SUBST(FIND)
12761 AC_SUBST(SORT)
12762 AC_SUBST(WIN_GREP)
12763 AC_SUBST(WIN_LS)
12764 AC_SUBST(WIN_TOUCH)
12766 AC_SUBST(BUILD_TYPE)
12768 AC_SUBST(SOLARINC)
12770 PathFormat "$PERL"
12771 PERL="$formatted_path"
12772 AC_SUBST(PERL)
12774 if test -n "$TMPDIR"; then
12775     TEMP_DIRECTORY="$TMPDIR"
12776 else
12777     TEMP_DIRECTORY="/tmp"
12779 if test "$build_os" = "cygwin"; then
12780     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12782 AC_SUBST(TEMP_DIRECTORY)
12784 # setup the PATH for the environment
12785 if test -n "$LO_PATH_FOR_BUILD"; then
12786     LO_PATH="$LO_PATH_FOR_BUILD"
12787 else
12788     LO_PATH="$PATH"
12790     case "$host_os" in
12792     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12793         if test "$ENABLE_JAVA" != ""; then
12794             pathmunge "$JAVA_HOME/bin" "after"
12795         fi
12796         ;;
12798     cygwin*)
12799         # Win32 make needs native paths
12800         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12801             LO_PATH=`cygpath -p -m "$PATH"`
12802         fi
12803         if test "$BITNESS_OVERRIDE" = 64; then
12804             # needed for msi packaging
12805             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12806         fi
12807         # .NET 4.6 and higher don't have bin directory
12808         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12809             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12810         fi
12811         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12812         pathmunge "$CSC_PATH" "before"
12813         pathmunge "$MIDL_PATH" "before"
12814         pathmunge "$AL_PATH" "before"
12815         pathmunge "$MSPDB_PATH" "before"
12816         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12817             pathmunge "$CL_PATH" "before"
12818         fi
12819         if test -n "$MSBUILD_PATH" ; then
12820             pathmunge "$MSBUILD_PATH" "before"
12821         fi
12822         if test "$BITNESS_OVERRIDE" = 64; then
12823             pathmunge "$COMPATH/bin/amd64" "before"
12824             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12825         else
12826             pathmunge "$COMPATH/bin" "before"
12827             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12828         fi
12829         if test "$ENABLE_JAVA" != ""; then
12830             if test -d "$JAVA_HOME/jre/bin/client"; then
12831                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12832             fi
12833             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12834                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12835             fi
12836             pathmunge "$JAVA_HOME/bin" "before"
12837         fi
12838         ;;
12840     solaris*)
12841         pathmunge "/usr/css/bin" "before"
12842         if test "$ENABLE_JAVA" != ""; then
12843             pathmunge "$JAVA_HOME/bin" "after"
12844         fi
12845         ;;
12846     esac
12849 AC_SUBST(LO_PATH)
12851 libo_FUZZ_SUMMARY
12853 # Generate a configuration sha256 we can use for deps
12854 if test -f config_host.mk; then
12855     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12857 if test -f config_host_lang.mk; then
12858     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12861 CFLAGS=$my_original_CFLAGS
12862 CXXFLAGS=$my_original_CXXFLAGS
12863 CPPFLAGS=$my_original_CPPFLAGS
12865 AC_CONFIG_FILES([config_host.mk
12866                  config_host_lang.mk
12867                  Makefile
12868                  bin/bffvalidator.sh
12869                  bin/odfvalidator.sh
12870                  bin/officeotron.sh
12871                  instsetoo_native/util/openoffice.lst
12872                  sysui/desktop/macosx/Info.plist])
12873 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12874 AC_CONFIG_HEADERS([config_host/config_clang.h])
12875 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12876 AC_CONFIG_HEADERS([config_host/config_eot.h])
12877 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12878 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12879 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12880 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12881 AC_CONFIG_HEADERS([config_host/config_features.h])
12882 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12883 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12884 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12885 AC_CONFIG_HEADERS([config_host/config_folders.h])
12886 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12887 AC_CONFIG_HEADERS([config_host/config_gio.h])
12888 AC_CONFIG_HEADERS([config_host/config_global.h])
12889 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12890 AC_CONFIG_HEADERS([config_host/config_java.h])
12891 AC_CONFIG_HEADERS([config_host/config_langs.h])
12892 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12893 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12894 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12895 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12896 AC_CONFIG_HEADERS([config_host/config_locales.h])
12897 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12898 AC_CONFIG_HEADERS([config_host/config_oox.h])
12899 AC_CONFIG_HEADERS([config_host/config_options.h])
12900 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12901 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12902 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12903 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12904 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12905 AC_CONFIG_HEADERS([config_host/config_version.h])
12906 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12907 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12908 AC_CONFIG_HEADERS([config_host/config_python.h])
12909 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12910 AC_OUTPUT
12912 if test "$CROSS_COMPILING" = TRUE; then
12913     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12916 # touch the config timestamp file
12917 if test ! -f config_host.mk.stamp; then
12918     echo > config_host.mk.stamp
12919 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12920     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12921 else
12922     echo > config_host.mk.stamp
12925 # touch the config lang timestamp file
12926 if test ! -f config_host_lang.mk.stamp; then
12927     echo > config_host_lang.mk.stamp
12928 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12929     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12930 else
12931     echo > config_host_lang.mk.stamp
12935 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12936         -a "$build_os" = "cygwin"; then
12938 cat << _EOS
12939 ****************************************************************************
12940 WARNING:
12941 Your make version is known to be horribly slow, and hard to debug
12942 problems with. To get a reasonably functional make please do:
12944 to install a pre-compiled binary make for Win32
12946  mkdir -p /opt/lo/bin
12947  cd /opt/lo/bin
12948  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12949  cp make-4.2.1-msvc.exe make
12950  chmod +x make
12952 to install from source:
12953 place yourself in a working directory of you choice.
12955  git clone git://git.savannah.gnu.org/make.git
12957  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12958  set PATH=%PATH%;C:\Cygwin\bin
12959  [or Cygwin64, if that is what you have]
12960  cd path-to-make-repo-you-cloned-above
12961  build_w32.bat --without-guile
12963 should result in a WinRel/gnumake.exe.
12964 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12966 Then re-run autogen.sh
12968 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12969 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12971 _EOS
12972 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12973     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12978 cat << _EOF
12979 ****************************************************************************
12981 To build, run:
12982 $GNUMAKE
12984 To view some help, run:
12985 $GNUMAKE help
12987 _EOF
12989 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12990     cat << _EOF
12991 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12992 _EOF
12994     if test $_os = Darwin; then
12995         echo open instdir/$PRODUCTNAME.app
12996     else
12997         echo instdir/program/soffice
12998     fi
12999     cat << _EOF
13001 If you want to run the smoketest, run:
13002 $GNUMAKE check
13004 _EOF
13007 if test -f warn; then
13008     cat warn
13009     rm warn
13012 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: