tdf#118947 sw tablestyle: manually scan parents for ::SET
[LibreOffice.git] / configure.ac
blob04f8330a9ac86de9df240b6f79bfe15bf8bae8c8
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.5.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 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     build_skia=yes
594     _os=SunOS
596     dnl ===========================================================
597     dnl Check whether we're using Solaris 10 - SPARC or Intel.
598     dnl ===========================================================
599     AC_MSG_CHECKING([the Solaris operating system release])
600     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
601     if test "$_os_release" -lt "10"; then
602         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
603     else
604         AC_MSG_RESULT([ok ($_os_release)])
605     fi
607     dnl Check whether we're using a SPARC or i386 processor
608     AC_MSG_CHECKING([the processor type])
609     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
610         AC_MSG_RESULT([ok ($host_cpu)])
611     else
612         AC_MSG_ERROR([only SPARC and i386 processors are supported])
613     fi
614     ;;
616 linux-gnu*|k*bsd*-gnu*)
617     build_gstreamer_1_0=yes
618     test_kf5=yes
619     test_gtk3_kde5=yes
620     build_skia=yes
621     test_gdb_index=yes
622     test_split_debug=yes
623     if test "$enable_fuzzers" != yes; then
624         test_freetype=yes
625         test_fontconfig=yes
626     else
627         test_freetype=no
628         test_fontconfig=no
629         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
630     fi
631     _os=Linux
632     ;;
634 gnu)
635     test_randr=no
636     test_xrender=no
637     _os=GNU
638      ;;
640 cygwin*|interix*)
642     # When building on Windows normally with MSVC under Cygwin,
643     # configure thinks that the host platform (the platform the
644     # built code will run on) is Cygwin, even if it obviously is
645     # Windows, which in Autoconf terminology is called
646     # "mingw32". (Which is misleading as MinGW is the name of the
647     # tool-chain, not an operating system.)
649     # Somewhat confusing, yes. But this configure script doesn't
650     # look at $host etc that much, it mostly uses its own $_os
651     # variable, set here in this case statement.
653     test_cups=no
654     test_dbus=no
655     test_randr=no
656     test_xrender=no
657     test_freetype=no
658     test_fontconfig=no
659     build_skia=yes
660     _os=WINNT
662     DLLPOST=".dll"
663     LINKFLAGSNOUNDEFS=
664     ;;
666 darwin*) # macOS or iOS
667     test_randr=no
668     test_xrender=no
669     test_freetype=no
670     test_fontconfig=no
671     test_dbus=no
672     if test -n "$LODE_HOME" ; then
673         mac_sanitize_path
674         AC_MSG_NOTICE([sanitized the PATH to $PATH])
675     fi
676     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
677         build_for_ios=YES
678         _os=iOS
679         test_cups=no
680         enable_mpl_subset=yes
681         enable_lotuswordpro=no
682         enable_coinmp=no
683         enable_lpsolve=no
684         enable_postgresql_sdbc=no
685         enable_extension_integration=no
686         enable_report_builder=no
687         with_ppds=no
688         if test "$enable_ios_simulator" = "yes"; then
689             host=x86_64-apple-darwin
690         fi
691     else
692         _os=Darwin
693         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
694         INSTROOTCONTENTSUFFIX=/Contents
695         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
696     fi
697     # See comment above the case "$host_os"
698     LINKFLAGSSHL="-dynamiclib -single_module"
700     # -fPIC is default
701     PICSWITCH=""
703     DLLPOST=".dylib"
705     # -undefined error is the default
706     LINKFLAGSNOUNDEFS=""
709 freebsd*)
710     build_gstreamer_1_0=yes
711     test_kf5=yes
712     test_gtk3_kde5=yes
713     test_freetype=yes
714     build_skia=yes
715     AC_MSG_CHECKING([the FreeBSD operating system release])
716     if test -n "$with_os_version"; then
717         OSVERSION="$with_os_version"
718     else
719         OSVERSION=`/sbin/sysctl -n kern.osreldate`
720     fi
721     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
722     AC_MSG_CHECKING([which thread library to use])
723     if test "$OSVERSION" -lt "500016"; then
724         PTHREAD_CFLAGS="-D_THREAD_SAFE"
725         PTHREAD_LIBS="-pthread"
726     elif test "$OSVERSION" -lt "502102"; then
727         PTHREAD_CFLAGS="-D_THREAD_SAFE"
728         PTHREAD_LIBS="-lc_r"
729     else
730         PTHREAD_CFLAGS=""
731         PTHREAD_LIBS="-pthread"
732     fi
733     AC_MSG_RESULT([$PTHREAD_LIBS])
734     _os=FreeBSD
735     ;;
737 *netbsd*)
738     build_gstreamer_1_0=yes
739     test_kf5=yes
740     test_gtk3_kde5=yes
741     test_freetype=yes
742     build_skia=yes
743     PTHREAD_LIBS="-pthread -lpthread"
744     _os=NetBSD
745     ;;
747 aix*)
748     test_randr=no
749     test_freetype=yes
750     PTHREAD_LIBS=-pthread
751     _os=AIX
752     ;;
754 openbsd*)
755     test_freetype=yes
756     PTHREAD_CFLAGS="-D_THREAD_SAFE"
757     PTHREAD_LIBS="-pthread"
758     _os=OpenBSD
759     ;;
761 dragonfly*)
762     build_gstreamer_1_0=yes
763     test_kf5=yes
764     test_gtk3_kde5=yes
765     test_freetype=yes
766     build_skia=yes
767     PTHREAD_LIBS="-pthread"
768     _os=DragonFly
769     ;;
771 linux-android*)
772     build_gstreamer_1_0=no
773     enable_lotuswordpro=no
774     enable_mpl_subset=yes
775     enable_coinmp=yes
776     enable_lpsolve=no
777     enable_report_builder=no
778     enable_odk=no
779     enable_postgresql_sdbc=no
780     enable_python=no
781     test_cups=no
782     test_dbus=no
783     test_fontconfig=no
784     test_freetype=no
785     test_kf5=no
786     test_qt5=no
787     test_gtk3_kde5=no
788     test_randr=no
789     test_xrender=no
790     _os=Android
792     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
793     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
794     ;;
796 haiku*)
797     test_cups=no
798     test_dbus=no
799     test_randr=no
800     test_xrender=no
801     test_freetype=yes
802     enable_odk=no
803     enable_gstreamer_1_0=no
804     enable_vlc=no
805     enable_coinmp=no
806     enable_pdfium=no
807     enable_sdremote=no
808     enable_postgresql_sdbc=no
809     enable_firebird_sdbc=no
810     _os=Haiku
811     ;;
814     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
815     ;;
816 esac
818 if test "$_os" = "Android" ; then
819     # Verify that the NDK and SDK options are proper
820     if test -z "$with_android_ndk"; then
821         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
822     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
823         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
824     fi
826     if test -z "$ANDROID_SDK_HOME"; then
827         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
828     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
829         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
830     fi
832     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
833     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
834         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
835                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
836                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
837         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
838         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
839         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
840     fi
841     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
842         AC_MSG_WARN([android support repository not found - install with
843                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
844                      to allow the build to download the specified version of the android support libraries])
845         add_warning "android support repository not found - install with"
846         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
847         add_warning "to allow the build to download the specified version of the android support libraries"
848     fi
851 if test "$_os" = "AIX"; then
852     AC_PATH_PROG(GAWK, gawk)
853     if test -z "$GAWK"; then
854         AC_MSG_ERROR([gawk not found in \$PATH])
855     fi
858 AC_SUBST(SDKDIRNAME)
860 AC_SUBST(PTHREAD_CFLAGS)
861 AC_SUBST(PTHREAD_LIBS)
863 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
864 # By default use the ones specified by our build system,
865 # but explicit override is possible.
866 AC_MSG_CHECKING(for explicit AFLAGS)
867 if test -n "$AFLAGS"; then
868     AC_MSG_RESULT([$AFLAGS])
869     x_AFLAGS=
870 else
871     AC_MSG_RESULT(no)
872     x_AFLAGS=[\#]
874 AC_MSG_CHECKING(for explicit CFLAGS)
875 if test -n "$CFLAGS"; then
876     AC_MSG_RESULT([$CFLAGS])
877     x_CFLAGS=
878 else
879     AC_MSG_RESULT(no)
880     x_CFLAGS=[\#]
882 AC_MSG_CHECKING(for explicit CXXFLAGS)
883 if test -n "$CXXFLAGS"; then
884     AC_MSG_RESULT([$CXXFLAGS])
885     x_CXXFLAGS=
886 else
887     AC_MSG_RESULT(no)
888     x_CXXFLAGS=[\#]
890 AC_MSG_CHECKING(for explicit OBJCFLAGS)
891 if test -n "$OBJCFLAGS"; then
892     AC_MSG_RESULT([$OBJCFLAGS])
893     x_OBJCFLAGS=
894 else
895     AC_MSG_RESULT(no)
896     x_OBJCFLAGS=[\#]
898 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
899 if test -n "$OBJCXXFLAGS"; then
900     AC_MSG_RESULT([$OBJCXXFLAGS])
901     x_OBJCXXFLAGS=
902 else
903     AC_MSG_RESULT(no)
904     x_OBJCXXFLAGS=[\#]
906 AC_MSG_CHECKING(for explicit LDFLAGS)
907 if test -n "$LDFLAGS"; then
908     AC_MSG_RESULT([$LDFLAGS])
909     x_LDFLAGS=
910 else
911     AC_MSG_RESULT(no)
912     x_LDFLAGS=[\#]
914 AC_SUBST(AFLAGS)
915 AC_SUBST(CFLAGS)
916 AC_SUBST(CXXFLAGS)
917 AC_SUBST(OBJCFLAGS)
918 AC_SUBST(OBJCXXFLAGS)
919 AC_SUBST(LDFLAGS)
920 AC_SUBST(x_AFLAGS)
921 AC_SUBST(x_CFLAGS)
922 AC_SUBST(x_CXXFLAGS)
923 AC_SUBST(x_OBJCFLAGS)
924 AC_SUBST(x_OBJCXXFLAGS)
925 AC_SUBST(x_LDFLAGS)
927 dnl These are potentially set for MSVC, in the code checking for UCRT below:
928 my_original_CFLAGS=$CFLAGS
929 my_original_CXXFLAGS=$CXXFLAGS
930 my_original_CPPFLAGS=$CPPFLAGS
932 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
933 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
934 dnl AC_PROG_CC internally.
935 if test "$_os" != "WINNT"; then
936     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
937     save_CFLAGS=$CFLAGS
938     AC_PROG_CC
939     CFLAGS=$save_CFLAGS
940     if test -z "$CC_BASE"; then
941         CC_BASE=`first_arg_basename "$CC"`
942     fi
945 if test "$_os" != "WINNT"; then
946     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
947 else
948     ENDIANNESS=little
950 AC_SUBST(ENDIANNESS)
952 if test $_os != "WINNT"; then
953     save_LIBS="$LIBS"
954     AC_SEARCH_LIBS([dlsym], [dl],
955         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
956         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
957     LIBS="$save_LIBS"
959 AC_SUBST(DLOPEN_LIBS)
961 AC_ARG_ENABLE(ios-simulator,
962     AS_HELP_STRING([--enable-ios-simulator],
963         [build i386 or x86_64 for ios simulator])
966 AC_ARG_ENABLE(ios-libreofficelight-app,
967     AS_HELP_STRING([--enable-ios-libreofficelight-app],
968         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
969          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
970          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
973 ENABLE_IOS_LIBREOFFICELIGHT_APP=
974 if test "$enable_ios_libreofficelight_app" = yes; then
975     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
977 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
979 ###############################################################################
980 # Extensions switches --enable/--disable
981 ###############################################################################
982 # By default these should be enabled unless having extra dependencies.
983 # If there is extra dependency over configure options then the enable should
984 # be automagic based on whether the requiring feature is enabled or not.
985 # All this options change anything only with --enable-extension-integration.
987 # The name of this option and its help string makes it sound as if
988 # extensions are built anyway, just not integrated in the installer,
989 # if you use --disable-extension-integration. Is that really the
990 # case?
992 libo_FUZZ_ARG_ENABLE(extension-integration,
993     AS_HELP_STRING([--disable-extension-integration],
994         [Disable integration of the built extensions in the installer of the
995          product. Use this switch to disable the integration.])
998 AC_ARG_ENABLE(avmedia,
999     AS_HELP_STRING([--disable-avmedia],
1000         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1003 AC_ARG_ENABLE(database-connectivity,
1004     AS_HELP_STRING([--disable-database-connectivity],
1005         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1008 # This doesn't mean not building (or "integrating") extensions
1009 # (although it probably should; i.e. it should imply
1010 # --disable-extension-integration I guess), it means not supporting
1011 # any extension mechanism at all
1012 libo_FUZZ_ARG_ENABLE(extensions,
1013     AS_HELP_STRING([--disable-extensions],
1014         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1017 AC_ARG_ENABLE(scripting,
1018     AS_HELP_STRING([--disable-scripting],
1019         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1022 # This is mainly for Android and iOS, but could potentially be used in some
1023 # special case otherwise, too, so factored out as a separate setting
1025 AC_ARG_ENABLE(dynamic-loading,
1026     AS_HELP_STRING([--disable-dynamic-loading],
1027         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1030 libo_FUZZ_ARG_ENABLE(report-builder,
1031     AS_HELP_STRING([--disable-report-builder],
1032         [Disable the Report Builder.])
1035 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1036     AS_HELP_STRING([--enable-ext-wiki-publisher],
1037         [Enable the Wiki Publisher extension.])
1040 libo_FUZZ_ARG_ENABLE(lpsolve,
1041     AS_HELP_STRING([--disable-lpsolve],
1042         [Disable compilation of the lp solve solver ])
1044 libo_FUZZ_ARG_ENABLE(coinmp,
1045     AS_HELP_STRING([--disable-coinmp],
1046         [Disable compilation of the CoinMP solver ])
1049 libo_FUZZ_ARG_ENABLE(pdfimport,
1050     AS_HELP_STRING([--disable-pdfimport],
1051         [Disable building the PDF import feature.])
1054 libo_FUZZ_ARG_ENABLE(pdfium,
1055     AS_HELP_STRING([--disable-pdfium],
1056         [Disable building PDFium.])
1059 libo_FUZZ_ARG_ENABLE(skia,
1060     AS_HELP_STRING([--disable-skia],
1061         [Disable building Skia.])
1064 ###############################################################################
1066 dnl ---------- *** ----------
1068 libo_FUZZ_ARG_ENABLE(mergelibs,
1069     AS_HELP_STRING([--enable-mergelibs],
1070         [Merge several of the smaller libraries into one big, "merged", one.])
1073 libo_FUZZ_ARG_ENABLE(breakpad,
1074     AS_HELP_STRING([--enable-breakpad],
1075         [Enables breakpad for crash reporting.])
1078 libo_FUZZ_ARG_ENABLE(crashdump,
1079     AS_HELP_STRING([--disable-crashdump],
1080         [Disable dump.ini and dump-file, when --enable-breakpad])
1083 AC_ARG_ENABLE(fetch-external,
1084     AS_HELP_STRING([--disable-fetch-external],
1085         [Disables fetching external tarballs from web sources.])
1088 AC_ARG_ENABLE(fuzzers,
1089     AS_HELP_STRING([--enable-fuzzers],
1090         [Enables building libfuzzer targets for fuzz testing.])
1093 libo_FUZZ_ARG_ENABLE(pch,
1094     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1095         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1096          Using 'system' will include only external headers, 'base' will add also headers
1097          from base modules, 'normal' will also add all headers except from the module built,
1098          'full' will use all suitable headers even from a module itself.])
1101 libo_FUZZ_ARG_ENABLE(epm,
1102     AS_HELP_STRING([--enable-epm],
1103         [LibreOffice includes self-packaging code, that requires epm, however epm is
1104          useless for large scale package building.])
1107 libo_FUZZ_ARG_ENABLE(odk,
1108     AS_HELP_STRING([--disable-odk],
1109         [LibreOffice includes an ODK, office development kit which some packagers may
1110          wish to build without.])
1113 AC_ARG_ENABLE(mpl-subset,
1114     AS_HELP_STRING([--enable-mpl-subset],
1115         [Don't compile any pieces which are not MPL or more liberally licensed])
1118 libo_FUZZ_ARG_ENABLE(evolution2,
1119     AS_HELP_STRING([--enable-evolution2],
1120         [Allows the built-in evolution 2 addressbook connectivity build to be
1121          enabled.])
1124 AC_ARG_ENABLE(avahi,
1125     AS_HELP_STRING([--enable-avahi],
1126         [Determines whether to use Avahi to advertise Impress to remote controls.])
1129 libo_FUZZ_ARG_ENABLE(werror,
1130     AS_HELP_STRING([--enable-werror],
1131         [Turn warnings to errors. (Has no effect in modules where the treating
1132          of warnings as errors is disabled explicitly.)]),
1135 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1136     AS_HELP_STRING([--enable-assert-always-abort],
1137         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1140 libo_FUZZ_ARG_ENABLE(dbgutil,
1141     AS_HELP_STRING([--enable-dbgutil],
1142         [Provide debugging support from --enable-debug and include additional debugging
1143          utilities such as object counting or more expensive checks.
1144          This is the recommended option for developers.
1145          Note that this makes the build ABI incompatible, it is not possible to mix object
1146          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1148 libo_FUZZ_ARG_ENABLE(debug,
1149     AS_HELP_STRING([--enable-debug],
1150         [Include debugging information, disable compiler optimization and inlining plus
1151          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1153 libo_FUZZ_ARG_ENABLE(split-debug,
1154     AS_HELP_STRING([--disable-split-debug],
1155         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1156          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1158 libo_FUZZ_ARG_ENABLE(gdb-index,
1159     AS_HELP_STRING([--disable-gdb-index],
1160         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1161          The feature requires the gold or lld linker.]))
1163 libo_FUZZ_ARG_ENABLE(sal-log,
1164     AS_HELP_STRING([--enable-sal-log],
1165         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1167 libo_FUZZ_ARG_ENABLE(symbols,
1168     AS_HELP_STRING([--enable-symbols],
1169         [Generate debug information.
1170          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1171          otherwise. It is possible to explicitly specify gbuild build targets
1172          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1173          everything in the directory; there is no ordering, more specific overrides
1174          more general, and disabling takes precedence).
1175          Example: --enable-symbols="all -sw/ -Library_sc".]))
1177 libo_FUZZ_ARG_ENABLE(optimized,
1178     AS_HELP_STRING([--disable-optimized],
1179         [Whether to compile with optimization flags.
1180          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1181          otherwise.]))
1183 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1184     AS_HELP_STRING([--disable-runtime-optimizations],
1185         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1186          JVM JIT) that are known to interact badly with certain dynamic analysis
1187          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1188          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1189          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1191 AC_ARG_WITH(valgrind,
1192     AS_HELP_STRING([--with-valgrind],
1193         [Make availability of Valgrind headers a hard requirement.]))
1195 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1196     AS_HELP_STRING([--enable-compiler-plugins],
1197         [Enable compiler plugins that will perform additional checks during
1198          building. Enabled automatically by --enable-dbgutil.
1199          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1200 COMPILER_PLUGINS_DEBUG=
1201 if test "$enable_compiler_plugins" = debug; then
1202     enable_compiler_plugins=yes
1203     COMPILER_PLUGINS_DEBUG=TRUE
1206 libo_FUZZ_ARG_ENABLE(ooenv,
1207     AS_HELP_STRING([--disable-ooenv],
1208         [Disable ooenv for the instdir installation.]))
1210 libo_FUZZ_ARG_ENABLE(libnumbertext,
1211     AS_HELP_STRING([--disable-libnumbertext],
1212         [Disable use of numbertext external library.]))
1214 AC_ARG_ENABLE(lto,
1215     AS_HELP_STRING([--enable-lto],
1216         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1217          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1218          linker. For MSVC, this option is broken at the moment. This is experimental work
1219          in progress that shouldn't be used unless you are working on it.)]))
1221 AC_ARG_ENABLE(python,
1222     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1223         [Enables or disables Python support at run-time.
1224          Also specifies what Python to use. 'auto' is the default.
1225          'fully-internal' even forces the internal version for uses of Python
1226          during the build.]))
1228 libo_FUZZ_ARG_ENABLE(gtk3,
1229     AS_HELP_STRING([--disable-gtk3],
1230         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1231 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1233 AC_ARG_ENABLE(introspection,
1234     AS_HELP_STRING([--enable-introspection],
1235         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1236          Linux distributions.)]))
1238 AC_ARG_ENABLE(split-app-modules,
1239     AS_HELP_STRING([--enable-split-app-modules],
1240         [Split file lists for app modules, e.g. base, calc.
1241          Has effect only with make distro-pack-install]),
1244 AC_ARG_ENABLE(split-opt-features,
1245     AS_HELP_STRING([--enable-split-opt-features],
1246         [Split file lists for some optional features, e.g. pyuno, testtool.
1247          Has effect only with make distro-pack-install]),
1250 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1251     AS_HELP_STRING([--disable-cairo-canvas],
1252         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1255 libo_FUZZ_ARG_ENABLE(dbus,
1256     AS_HELP_STRING([--disable-dbus],
1257         [Determines whether to enable features that depend on dbus.
1258          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1259 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1261 libo_FUZZ_ARG_ENABLE(sdremote,
1262     AS_HELP_STRING([--disable-sdremote],
1263         [Determines whether to enable Impress remote control (i.e. the server component).]),
1264 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1266 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1267     AS_HELP_STRING([--disable-sdremote-bluetooth],
1268         [Determines whether to build sdremote with bluetooth support.
1269          Requires dbus on Linux.]))
1271 libo_FUZZ_ARG_ENABLE(gio,
1272     AS_HELP_STRING([--disable-gio],
1273         [Determines whether to use the GIO support.]),
1274 ,test "${enable_gio+set}" = set || enable_gio=yes)
1276 AC_ARG_ENABLE(qt5,
1277     AS_HELP_STRING([--enable-qt5],
1278         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1279          available.]),
1282 AC_ARG_ENABLE(kf5,
1283     AS_HELP_STRING([--enable-kf5],
1284         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1285          KF5 are available.]),
1288 AC_ARG_ENABLE(kde5,
1289     AS_HELP_STRING([--enable-kde5],
1290         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1293 AC_ARG_ENABLE(gtk3_kde5,
1294     AS_HELP_STRING([--enable-gtk3-kde5],
1295         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1296          platforms where Gtk3, Qt5 and Plasma is available.]),
1299 AC_ARG_ENABLE(gui,
1300     AS_HELP_STRING([--disable-gui],
1301         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1302 ,enable_gui=yes)
1304 libo_FUZZ_ARG_ENABLE(randr,
1305     AS_HELP_STRING([--disable-randr],
1306         [Disable RandR support in the vcl project.]),
1307 ,test "${enable_randr+set}" = set || enable_randr=yes)
1309 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1310     AS_HELP_STRING([--disable-gstreamer-1-0],
1311         [Disable building with the gstreamer 1.0 avmedia backend.]),
1312 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1314 libo_FUZZ_ARG_ENABLE(vlc,
1315     AS_HELP_STRING([--enable-vlc],
1316         [Enable building with the (experimental) VLC avmedia backend.]),
1317 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1319 libo_FUZZ_ARG_ENABLE(neon,
1320     AS_HELP_STRING([--disable-neon],
1321         [Disable neon and the compilation of webdav binding.]),
1324 libo_FUZZ_ARG_ENABLE([eot],
1325     [AS_HELP_STRING([--enable-eot],
1326         [Enable support for Embedded OpenType fonts.])],
1327 ,test "${enable_eot+set}" = set || enable_eot=no)
1329 libo_FUZZ_ARG_ENABLE(cve-tests,
1330     AS_HELP_STRING([--disable-cve-tests],
1331         [Prevent CVE tests to be executed]),
1334 libo_FUZZ_ARG_ENABLE(chart-tests,
1335     AS_HELP_STRING([--enable-chart-tests],
1336         [Executes chart XShape tests. In a perfect world these tests would be
1337          stable and everyone could run them, in reality it is best to run them
1338          only on a few machines that are known to work and maintained by people
1339          who can judge if a test failure is a regression or not.]),
1342 AC_ARG_ENABLE(build-unowinreg,
1343     AS_HELP_STRING([--enable-build-unowinreg],
1344         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1345          compiler is needed on Linux.]),
1348 AC_ARG_ENABLE(build-opensymbol,
1349     AS_HELP_STRING([--enable-build-opensymbol],
1350         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1351          fontforge installed.]),
1354 AC_ARG_ENABLE(dependency-tracking,
1355     AS_HELP_STRING([--enable-dependency-tracking],
1356         [Do not reject slow dependency extractors.])[
1357   --disable-dependency-tracking
1358                           Disables generation of dependency information.
1359                           Speed up one-time builds.],
1362 AC_ARG_ENABLE(icecream,
1363     AS_HELP_STRING([--enable-icecream],
1364         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1365          It defaults to /opt/icecream for the location of the icecream gcc/g++
1366          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1369 AC_ARG_ENABLE(ld,
1370     AS_HELP_STRING([--enable-ld=<linker>],
1371         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1372          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1375 libo_FUZZ_ARG_ENABLE(cups,
1376     AS_HELP_STRING([--disable-cups],
1377         [Do not build cups support.])
1380 AC_ARG_ENABLE(ccache,
1381     AS_HELP_STRING([--disable-ccache],
1382         [Do not try to use ccache automatically.
1383          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1384          CC/CXX are not yet set, and --enable-icecream is not given, we
1385          attempt to use ccache. --disable-ccache disables ccache completely.
1386          Additionally ccache's depend mode is enabled if possible,
1387          use --enable-ccache=nodepend to enable ccache without depend mode.
1391 AC_ARG_ENABLE(64-bit,
1392     AS_HELP_STRING([--enable-64-bit],
1393         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1394          At the moment meaningful only for Windows.]), ,)
1396 libo_FUZZ_ARG_ENABLE(online-update,
1397     AS_HELP_STRING([--enable-online-update],
1398         [Enable the online update service that will check for new versions of
1399          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1400          If the value is "mar", the experimental Mozilla-like update will be
1401          enabled instead of the traditional update mechanism.]),
1404 AC_ARG_WITH(update-config,
1405     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1406                    [Path to the update config ini file]))
1408 libo_FUZZ_ARG_ENABLE(extension-update,
1409     AS_HELP_STRING([--disable-extension-update],
1410         [Disable possibility to update installed extensions.]),
1413 libo_FUZZ_ARG_ENABLE(release-build,
1414     AS_HELP_STRING([--enable-release-build],
1415         [Enable release build. Note that the "release build" choice is orthogonal to
1416          whether symbols are present, debug info is generated, or optimization
1417          is done.
1418          See http://wiki.documentfoundation.org/Development/DevBuild]),
1421 AC_ARG_ENABLE(windows-build-signing,
1422     AS_HELP_STRING([--enable-windows-build-signing],
1423         [Enable signing of windows binaries (*.exe, *.dll)]),
1426 AC_ARG_ENABLE(silent-msi,
1427     AS_HELP_STRING([--enable-silent-msi],
1428         [Enable MSI with LIMITUI=1 (silent install).]),
1431 AC_ARG_ENABLE(macosx-code-signing,
1432     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1433         [Sign executables, dylibs, frameworks and the app bundle. If you
1434          don't provide an identity the first suitable certificate
1435          in your keychain is used.]),
1438 AC_ARG_ENABLE(macosx-package-signing,
1439     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1440         [Create a .pkg suitable for uploading to the Mac App Store and sign
1441          it. If you don't provide an identity the first suitable certificate
1442          in your keychain is used.]),
1445 AC_ARG_ENABLE(macosx-sandbox,
1446     AS_HELP_STRING([--enable-macosx-sandbox],
1447         [Make the app bundle run in a sandbox. Requires code signing.
1448          Is required by apps distributed in the Mac App Store, and implies
1449          adherence to App Store rules.]),
1452 AC_ARG_WITH(macosx-bundle-identifier,
1453     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1454         [Define the macOS bundle identifier. Default is the somewhat weird
1455          org.libreoffice.script ("script", huh?).]),
1456 ,with_macosx_bundle_identifier=org.libreoffice.script)
1458 AC_ARG_WITH(product-name,
1459     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1460         [Define the product name. Default is AC_PACKAGE_NAME.]),
1461 ,with_product_name=$PRODUCTNAME)
1463 AC_ARG_WITH(package-version,
1464     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1465         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1468 libo_FUZZ_ARG_ENABLE(readonly-installset,
1469     AS_HELP_STRING([--enable-readonly-installset],
1470         [Prevents any attempts by LibreOffice to write into its installation. That means
1471          at least that no "system-wide" extensions can be added. Partly experimental work in
1472          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1475 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1476     AS_HELP_STRING([--disable-postgresql-sdbc],
1477         [Disable the build of the PostgreSQL-SDBC driver.])
1480 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1481     AS_HELP_STRING([--disable-lotuswordpro],
1482         [Disable the build of the Lotus Word Pro filter.]),
1483 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1485 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1486     AS_HELP_STRING([--disable-firebird-sdbc],
1487         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1488 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1490 AC_ARG_ENABLE(bogus-pkg-config,
1491     AS_HELP_STRING([--enable-bogus-pkg-config],
1492         [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.]),
1495 AC_ARG_ENABLE(openssl,
1496     AS_HELP_STRING([--disable-openssl],
1497         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1498          components will either use GNUTLS or NSS. Work in progress,
1499          use only if you are hacking on it.]),
1500 ,enable_openssl=yes)
1502 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1503     AS_HELP_STRING([--enable-cipher-openssl-backend],
1504         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1505          Requires --enable-openssl.]))
1507 AC_ARG_ENABLE(library-bin-tar,
1508     AS_HELP_STRING([--enable-library-bin-tar],
1509         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1510         Some libraries can save their build result in a tarball
1511         stored in TARFILE_LOCATION. That binary tarball is
1512         uniquely identified by the source tarball,
1513         the content of the config_host.mk file and the content
1514         of the top-level directory in core for that library
1515         If this option is enabled, then if such a tarfile exist, it will be untarred
1516         instead of the source tarfile, and the build step will be skipped for that
1517         library.
1518         If a proper tarfile does not exist, then the normal source-based
1519         build is done for that library and a proper binary tarfile is created
1520         for the next time.]),
1523 AC_ARG_ENABLE(dconf,
1524     AS_HELP_STRING([--disable-dconf],
1525         [Disable the dconf configuration backend (enabled by default where
1526          available).]))
1528 libo_FUZZ_ARG_ENABLE(formula-logger,
1529     AS_HELP_STRING(
1530         [--enable-formula-logger],
1531         [Enable formula logger for logging formula calculation flow in Calc.]
1532     )
1535 AC_ARG_ENABLE(ldap,
1536     AS_HELP_STRING([--disable-ldap],
1537         [Disable LDAP support.]),
1538 ,enable_ldap=yes)
1540 dnl ===================================================================
1541 dnl Optional Packages (--with/without-)
1542 dnl ===================================================================
1544 AC_ARG_WITH(gcc-home,
1545     AS_HELP_STRING([--with-gcc-home],
1546         [Specify the location of gcc/g++ manually. This can be used in conjunction
1547          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1548          non-default path.]),
1551 AC_ARG_WITH(gnu-patch,
1552     AS_HELP_STRING([--with-gnu-patch],
1553         [Specify location of GNU patch on Solaris or FreeBSD.]),
1556 AC_ARG_WITH(build-platform-configure-options,
1557     AS_HELP_STRING([--with-build-platform-configure-options],
1558         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1561 AC_ARG_WITH(gnu-cp,
1562     AS_HELP_STRING([--with-gnu-cp],
1563         [Specify location of GNU cp on Solaris or FreeBSD.]),
1566 AC_ARG_WITH(external-tar,
1567     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1568         [Specify an absolute path of where to find (and store) tarfiles.]),
1569     TARFILE_LOCATION=$withval ,
1572 AC_ARG_WITH(referenced-git,
1573     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1574         [Specify another checkout directory to reference. This makes use of
1575                  git submodule update --reference, and saves a lot of diskspace
1576                  when having multiple trees side-by-side.]),
1577     GIT_REFERENCE_SRC=$withval ,
1580 AC_ARG_WITH(linked-git,
1581     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1582         [Specify a directory where the repositories of submodules are located.
1583          This uses a method similar to git-new-workdir to get submodules.]),
1584     GIT_LINK_SRC=$withval ,
1587 AC_ARG_WITH(galleries,
1588     AS_HELP_STRING([--with-galleries],
1589         [Specify how galleries should be built. It is possible either to
1590          build these internally from source ("build"),
1591          or to disable them ("no")]),
1594 AC_ARG_WITH(theme,
1595     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1596         [Choose which themes to include. By default those themes with an '*' are included.
1597          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1598          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *tango.]),
1601 libo_FUZZ_ARG_WITH(helppack-integration,
1602     AS_HELP_STRING([--without-helppack-integration],
1603         [It will not integrate the helppacks to the installer
1604          of the product. Please use this switch to use the online help
1605          or separate help packages.]),
1608 libo_FUZZ_ARG_WITH(fonts,
1609     AS_HELP_STRING([--without-fonts],
1610         [LibreOffice includes some third-party fonts to provide a reliable basis for
1611          help content, templates, samples, etc. When these fonts are already
1612          known to be available on the system then you should use this option.]),
1615 AC_ARG_WITH(epm,
1616     AS_HELP_STRING([--with-epm],
1617         [Decides which epm to use. Default is to use the one from the system if
1618          one is built. When either this is not there or you say =internal epm
1619          will be built.]),
1622 AC_ARG_WITH(package-format,
1623     AS_HELP_STRING([--with-package-format],
1624         [Specify package format(s) for LibreOffice installation sets. The
1625          implicit --without-package-format leads to no installation sets being
1626          generated. Possible values: aix, archive, bsd, deb, dmg,
1627          installed, msi, pkg, and rpm.
1628          Example: --with-package-format='deb rpm']),
1631 AC_ARG_WITH(tls,
1632     AS_HELP_STRING([--with-tls],
1633         [Decides which TLS/SSL and cryptographic implementations to use for
1634          LibreOffice's code. Notice that this doesn't apply for depending
1635          libraries like "neon", for example. Default is to use OpenSSL
1636          although NSS is also possible. Notice that selecting NSS restricts
1637          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1638          restrict by now the usage of NSS in LO's code. Possible values:
1639          openssl, nss. Example: --with-tls="nss"]),
1642 AC_ARG_WITH(system-libs,
1643     AS_HELP_STRING([--with-system-libs],
1644         [Use libraries already on system -- enables all --with-system-* flags.]),
1647 AC_ARG_WITH(system-bzip2,
1648     AS_HELP_STRING([--with-system-bzip2],
1649         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1650     [with_system_bzip2="$with_system_libs"])
1652 AC_ARG_WITH(system-headers,
1653     AS_HELP_STRING([--with-system-headers],
1654         [Use headers already on system -- enables all --with-system-* flags for
1655          external packages whose headers are the only entities used i.e.
1656          boost/odbc/sane-header(s).]),,
1657     [with_system_headers="$with_system_libs"])
1659 AC_ARG_WITH(system-jars,
1660     AS_HELP_STRING([--without-system-jars],
1661         [When building with --with-system-libs, also the needed jars are expected
1662          on the system. Use this to disable that]),,
1663     [with_system_jars="$with_system_libs"])
1665 AC_ARG_WITH(system-cairo,
1666     AS_HELP_STRING([--with-system-cairo],
1667         [Use cairo libraries already on system.  Happens automatically for
1668          (implicit) --enable-gtk3.]))
1670 AC_ARG_WITH(system-epoxy,
1671     AS_HELP_STRING([--with-system-epoxy],
1672         [Use epoxy libraries already on system.  Happens automatically for
1673          (implicit) --enable-gtk3.]),,
1674        [with_system_epoxy="$with_system_libs"])
1676 AC_ARG_WITH(myspell-dicts,
1677     AS_HELP_STRING([--with-myspell-dicts],
1678         [Adds myspell dictionaries to the LibreOffice installation set]),
1681 AC_ARG_WITH(system-dicts,
1682     AS_HELP_STRING([--without-system-dicts],
1683         [Do not use dictionaries from system paths.]),
1686 AC_ARG_WITH(external-dict-dir,
1687     AS_HELP_STRING([--with-external-dict-dir],
1688         [Specify external dictionary dir.]),
1691 AC_ARG_WITH(external-hyph-dir,
1692     AS_HELP_STRING([--with-external-hyph-dir],
1693         [Specify external hyphenation pattern dir.]),
1696 AC_ARG_WITH(external-thes-dir,
1697     AS_HELP_STRING([--with-external-thes-dir],
1698         [Specify external thesaurus dir.]),
1701 AC_ARG_WITH(system-zlib,
1702     AS_HELP_STRING([--with-system-zlib],
1703         [Use zlib already on system.]),,
1704     [with_system_zlib=auto])
1706 AC_ARG_WITH(system-jpeg,
1707     AS_HELP_STRING([--with-system-jpeg],
1708         [Use jpeg already on system.]),,
1709     [with_system_jpeg="$with_system_libs"])
1711 AC_ARG_WITH(system-clucene,
1712     AS_HELP_STRING([--with-system-clucene],
1713         [Use clucene already on system.]),,
1714     [with_system_clucene="$with_system_libs"])
1716 AC_ARG_WITH(system-expat,
1717     AS_HELP_STRING([--with-system-expat],
1718         [Use expat already on system.]),,
1719     [with_system_expat="$with_system_libs"])
1721 AC_ARG_WITH(system-libxml,
1722     AS_HELP_STRING([--with-system-libxml],
1723         [Use libxml/libxslt already on system.]),,
1724     [with_system_libxml=auto])
1726 AC_ARG_WITH(system-icu,
1727     AS_HELP_STRING([--with-system-icu],
1728         [Use icu already on system.]),,
1729     [with_system_icu="$with_system_libs"])
1731 AC_ARG_WITH(system-ucpp,
1732     AS_HELP_STRING([--with-system-ucpp],
1733         [Use ucpp already on system.]),,
1734     [])
1736 AC_ARG_WITH(system-openldap,
1737     AS_HELP_STRING([--with-system-openldap],
1738         [Use the OpenLDAP LDAP SDK already on system.]),,
1739     [with_system_openldap="$with_system_libs"])
1741 libo_FUZZ_ARG_ENABLE(poppler,
1742     AS_HELP_STRING([--disable-poppler],
1743         [Disable building Poppler.])
1746 AC_ARG_WITH(system-poppler,
1747     AS_HELP_STRING([--with-system-poppler],
1748         [Use system poppler (only needed for PDF import).]),,
1749     [with_system_poppler="$with_system_libs"])
1751 AC_ARG_WITH(system-gpgmepp,
1752     AS_HELP_STRING([--with-system-gpgmepp],
1753         [Use gpgmepp already on system]),,
1754     [with_system_gpgmepp="$with_system_libs"])
1756 AC_ARG_WITH(system-apache-commons,
1757     AS_HELP_STRING([--with-system-apache-commons],
1758         [Use Apache commons libraries already on system.]),,
1759     [with_system_apache_commons="$with_system_jars"])
1761 AC_ARG_WITH(system-mariadb,
1762     AS_HELP_STRING([--with-system-mariadb],
1763         [Use MariaDB/MySQL libraries already on system.]),,
1764     [with_system_mariadb="$with_system_libs"])
1766 AC_ARG_ENABLE(bundle-mariadb,
1767     AS_HELP_STRING([--enable-bundle-mariadb],
1768         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1771 AC_ARG_WITH(system-postgresql,
1772     AS_HELP_STRING([--with-system-postgresql],
1773         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1774          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1775     [with_system_postgresql="$with_system_libs"])
1777 AC_ARG_WITH(libpq-path,
1778     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1779         [Use this PostgreSQL C interface (libpq) installation for building
1780          the PostgreSQL-SDBC extension.]),
1783 AC_ARG_WITH(system-firebird,
1784     AS_HELP_STRING([--with-system-firebird],
1785         [Use Firebird libraries already on system, for building the Firebird-SDBC
1786          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1787     [with_system_firebird="$with_system_libs"])
1789 AC_ARG_WITH(system-libtommath,
1790             AS_HELP_STRING([--with-system-libtommath],
1791                            [Use libtommath already on system]),,
1792             [with_system_libtommath="$with_system_libs"])
1794 AC_ARG_WITH(system-hsqldb,
1795     AS_HELP_STRING([--with-system-hsqldb],
1796         [Use hsqldb already on system.]))
1798 AC_ARG_WITH(hsqldb-jar,
1799     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1800         [Specify path to jarfile manually.]),
1801     HSQLDB_JAR=$withval)
1803 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1804     AS_HELP_STRING([--disable-scripting-beanshell],
1805         [Disable support for scripts in BeanShell.]),
1809 AC_ARG_WITH(system-beanshell,
1810     AS_HELP_STRING([--with-system-beanshell],
1811         [Use beanshell already on system.]),,
1812     [with_system_beanshell="$with_system_jars"])
1814 AC_ARG_WITH(beanshell-jar,
1815     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     BSH_JAR=$withval)
1819 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1820     AS_HELP_STRING([--disable-scripting-javascript],
1821         [Disable support for scripts in JavaScript.]),
1825 AC_ARG_WITH(system-rhino,
1826     AS_HELP_STRING([--with-system-rhino],
1827         [Use rhino already on system.]),,)
1828 #    [with_system_rhino="$with_system_jars"])
1829 # Above is not used as we have different debug interface
1830 # patched into internal rhino. This code needs to be fixed
1831 # before we can enable it by default.
1833 AC_ARG_WITH(rhino-jar,
1834     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     RHINO_JAR=$withval)
1838 AC_ARG_WITH(commons-logging-jar,
1839     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     COMMONS_LOGGING_JAR=$withval)
1843 AC_ARG_WITH(system-jfreereport,
1844     AS_HELP_STRING([--with-system-jfreereport],
1845         [Use JFreeReport already on system.]),,
1846     [with_system_jfreereport="$with_system_jars"])
1848 AC_ARG_WITH(sac-jar,
1849     AS_HELP_STRING([--with-sac-jar=JARFILE],
1850         [Specify path to jarfile manually.]),
1851     SAC_JAR=$withval)
1853 AC_ARG_WITH(libxml-jar,
1854     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     LIBXML_JAR=$withval)
1858 AC_ARG_WITH(flute-jar,
1859     AS_HELP_STRING([--with-flute-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     FLUTE_JAR=$withval)
1863 AC_ARG_WITH(jfreereport-jar,
1864     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     JFREEREPORT_JAR=$withval)
1868 AC_ARG_WITH(liblayout-jar,
1869     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     LIBLAYOUT_JAR=$withval)
1873 AC_ARG_WITH(libloader-jar,
1874     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBLOADER_JAR=$withval)
1878 AC_ARG_WITH(libformula-jar,
1879     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBFORMULA_JAR=$withval)
1883 AC_ARG_WITH(librepository-jar,
1884     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1885         [Specify path to jarfile manually.]),
1886     LIBREPOSITORY_JAR=$withval)
1888 AC_ARG_WITH(libfonts-jar,
1889     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1890         [Specify path to jarfile manually.]),
1891     LIBFONTS_JAR=$withval)
1893 AC_ARG_WITH(libserializer-jar,
1894     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1895         [Specify path to jarfile manually.]),
1896     LIBSERIALIZER_JAR=$withval)
1898 AC_ARG_WITH(libbase-jar,
1899     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1900         [Specify path to jarfile manually.]),
1901     LIBBASE_JAR=$withval)
1903 AC_ARG_WITH(system-odbc,
1904     AS_HELP_STRING([--with-system-odbc],
1905         [Use the odbc headers already on system.]),,
1906     [with_system_odbc="auto"])
1908 AC_ARG_WITH(system-sane,
1909     AS_HELP_STRING([--with-system-sane],
1910         [Use sane.h already on system.]),,
1911     [with_system_sane="$with_system_headers"])
1913 AC_ARG_WITH(system-bluez,
1914     AS_HELP_STRING([--with-system-bluez],
1915         [Use bluetooth.h already on system.]),,
1916     [with_system_bluez="$with_system_headers"])
1918 AC_ARG_WITH(system-curl,
1919     AS_HELP_STRING([--with-system-curl],
1920         [Use curl already on system.]),,
1921     [with_system_curl=auto])
1923 AC_ARG_WITH(system-boost,
1924     AS_HELP_STRING([--with-system-boost],
1925         [Use boost already on system.]),,
1926     [with_system_boost="$with_system_headers"])
1928 AC_ARG_WITH(system-glm,
1929     AS_HELP_STRING([--with-system-glm],
1930         [Use glm already on system.]),,
1931     [with_system_glm="$with_system_headers"])
1933 AC_ARG_WITH(system-hunspell,
1934     AS_HELP_STRING([--with-system-hunspell],
1935         [Use libhunspell already on system.]),,
1936     [with_system_hunspell="$with_system_libs"])
1938 AC_ARG_WITH(system-qrcodegen,
1939     AS_HELP_STRING([--with-system-qrcodegen],
1940         [Use libqrcodegen already on system.]),,
1941     [with_system_qrcodegen="$with_system_libs"])
1943 AC_ARG_WITH(system-mythes,
1944     AS_HELP_STRING([--with-system-mythes],
1945         [Use mythes already on system.]),,
1946     [with_system_mythes="$with_system_libs"])
1948 AC_ARG_WITH(system-altlinuxhyph,
1949     AS_HELP_STRING([--with-system-altlinuxhyph],
1950         [Use ALTLinuxhyph already on system.]),,
1951     [with_system_altlinuxhyph="$with_system_libs"])
1953 AC_ARG_WITH(system-lpsolve,
1954     AS_HELP_STRING([--with-system-lpsolve],
1955         [Use lpsolve already on system.]),,
1956     [with_system_lpsolve="$with_system_libs"])
1958 AC_ARG_WITH(system-coinmp,
1959     AS_HELP_STRING([--with-system-coinmp],
1960         [Use CoinMP already on system.]),,
1961     [with_system_coinmp="$with_system_libs"])
1963 AC_ARG_WITH(system-liblangtag,
1964     AS_HELP_STRING([--with-system-liblangtag],
1965         [Use liblangtag library already on system.]),,
1966     [with_system_liblangtag="$with_system_libs"])
1968 AC_ARG_WITH(webdav,
1969     AS_HELP_STRING([--with-webdav],
1970         [Specify which library to use for webdav implementation.
1971          Possible values: "neon", "serf", "no". The default value is "neon".
1972          Example: --with-webdav="serf"]),
1973     WITH_WEBDAV=$withval,
1974     WITH_WEBDAV="neon")
1976 AC_ARG_WITH(linker-hash-style,
1977     AS_HELP_STRING([--with-linker-hash-style],
1978         [Use linker with --hash-style=<style> when linking shared objects.
1979          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1980          if supported on the build system, and "sysv" otherwise.]))
1982 AC_ARG_WITH(jdk-home,
1983     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1984         [If you have installed JDK 8 or later on your system please supply the
1985          path here. Note that this is not the location of the java command but the
1986          location of the entire distribution.]),
1989 AC_ARG_WITH(help,
1990     AS_HELP_STRING([--with-help],
1991         [Enable the build of help. There is a special parameter "common" that
1992          can be used to bundle only the common part, .e.g help-specific icons.
1993          This is useful when you build the helpcontent separately.])
1994     [
1995                           Usage:     --with-help    build the old local help
1996                                  --without-help     no local help (default)
1997                                  --with-help=html   build the new HTML local help
1998                                  --with-help=online build the new HTML online help
1999     ],
2002 AC_ARG_WITH(omindex,
2003    AS_HELP_STRING([--with-omindex],
2004         [Enable the support of xapian-omega index for online help.])
2005    [
2006                          Usage: --with-omindex=server prepare the pages for omindex
2007                                 but let xapian-omega be built in server.
2008                                 --with-omindex=noxap do not prepare online pages
2009                                 for xapian-omega
2010   ],
2013 libo_FUZZ_ARG_WITH(java,
2014     AS_HELP_STRING([--with-java=<java command>],
2015         [Specify the name of the Java interpreter command. Typically "java"
2016          which is the default.
2018          To build without support for Java components, applets, accessibility
2019          or the XML filters written in Java, use --without-java or --with-java=no.]),
2020     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2021     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2024 AC_ARG_WITH(jvm-path,
2025     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2026         [Use a specific JVM search path at runtime.
2027          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2030 AC_ARG_WITH(ant-home,
2031     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2032         [If you have installed Apache Ant on your system, please supply the path here.
2033          Note that this is not the location of the Ant binary but the location
2034          of the entire distribution.]),
2037 AC_ARG_WITH(symbol-config,
2038     AS_HELP_STRING([--with-symbol-config],
2039         [Configuration for the crashreport symbol upload]),
2040         [],
2041         [with_symbol_config=no])
2043 AC_ARG_WITH(export-validation,
2044     AS_HELP_STRING([--without-export-validation],
2045         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2046 ,with_export_validation=auto)
2048 AC_ARG_WITH(bffvalidator,
2049     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2050         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2051          Requires installed Microsoft Office Binary File Format Validator.
2052          Note: export-validation (--with-export-validation) is required to be turned on.
2053          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2054 ,with_bffvalidator=no)
2056 libo_FUZZ_ARG_WITH(junit,
2057     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2058         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2059          --without-junit disables those tests. Not relevant in the --without-java case.]),
2060 ,with_junit=yes)
2062 AC_ARG_WITH(hamcrest,
2063     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2064         [Specifies the hamcrest jar file to use for JUnit-based tests.
2065          --without-junit disables those tests. Not relevant in the --without-java case.]),
2066 ,with_hamcrest=yes)
2068 AC_ARG_WITH(perl-home,
2069     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2070         [If you have installed Perl 5 Distribution, on your system, please
2071          supply the path here. Note that this is not the location of the Perl
2072          binary but the location of the entire distribution.]),
2075 libo_FUZZ_ARG_WITH(doxygen,
2076     AS_HELP_STRING(
2077         [--with-doxygen=<absolute path to doxygen executable>],
2078         [Specifies the doxygen executable to use when generating ODK C/C++
2079          documentation. --without-doxygen disables generation of ODK C/C++
2080          documentation. Not relevant in the --disable-odk case.]),
2081 ,with_doxygen=yes)
2083 AC_ARG_WITH(visual-studio,
2084     AS_HELP_STRING([--with-visual-studio=<2017>],
2085         [Specify which Visual Studio version to use in case several are
2086          installed. Currently only 2017 is supported.]),
2089 AC_ARG_WITH(windows-sdk,
2090     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2091         [Specify which Windows SDK, or "Windows Kit", version to use
2092          in case the one that came with the selected Visual Studio
2093          is not what you want for some reason. Note that not all compiler/SDK
2094          combinations are supported. The intent is that this option should not
2095          be needed.]),
2098 AC_ARG_WITH(lang,
2099     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2100         [Use this option to build LibreOffice with additional UI language support.
2101          English (US) is always included by default.
2102          Separate multiple languages with space.
2103          For all languages, use --with-lang=ALL.]),
2106 AC_ARG_WITH(locales,
2107     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2108         [Use this option to limit the locale information built in.
2109          Separate multiple locales with space.
2110          Very experimental and might well break stuff.
2111          Just a desperate measure to shrink code and data size.
2112          By default all the locales available is included.
2113          This option is completely unrelated to --with-lang.])
2114     [
2115                           Affects also our character encoding conversion
2116                           tables for encodings mainly targeted for a
2117                           particular locale, like EUC-CN and EUC-TW for
2118                           zh, ISO-2022-JP for ja.
2120                           Affects also our add-on break iterator data for
2121                           some languages.
2123                           For the default, all locales, don't use this switch at all.
2124                           Specifying just the language part of a locale means all matching
2125                           locales will be included.
2126     ],
2129 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2130 libo_FUZZ_ARG_WITH(krb5,
2131     AS_HELP_STRING([--with-krb5],
2132         [Enable MIT Kerberos 5 support in modules that support it.
2133          By default automatically enabled on platforms
2134          where a good system Kerberos 5 is available.]),
2137 libo_FUZZ_ARG_WITH(gssapi,
2138     AS_HELP_STRING([--with-gssapi],
2139         [Enable GSSAPI support in modules that support it.
2140          By default automatically enabled on platforms
2141          where a good system GSSAPI is available.]),
2144 AC_ARG_WITH(iwyu,
2145     AS_HELP_STRING([--with-iwyu],
2146         [Use given IWYU binary path to check unneeded includes instead of building.
2147          Use only if you are hacking on it.]),
2150 libo_FUZZ_ARG_WITH(lxml,
2151     AS_HELP_STRING([--without-lxml],
2152         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2153          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2154          report widget classes and ids.]),
2157 dnl ===================================================================
2158 dnl Branding
2159 dnl ===================================================================
2161 AC_ARG_WITH(branding,
2162     AS_HELP_STRING([--with-branding=/path/to/images],
2163         [Use given path to retrieve branding images set.])
2164     [
2165                           Search for intro.png about.svg and flat_logo.svg.
2166                           If any is missing, default ones will be used instead.
2168                           Search also progress.conf for progress
2169                           settings on intro screen :
2171                           PROGRESSBARCOLOR="255,255,255" Set color of
2172                           progress bar. Comma separated RGB decimal values.
2173                           PROGRESSSIZE="407,6" Set size of progress bar.
2174                           Comma separated decimal values (width, height).
2175                           PROGRESSPOSITION="61,317" Set position of progress
2176                           bar from left,top. Comma separated decimal values.
2177                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2178                           bar frame. Comma separated RGB decimal values.
2179                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2180                           bar text. Comma separated RGB decimal values.
2181                           PROGRESSTEXTBASELINE="287" Set vertical position of
2182                           progress bar text from top. Decimal value.
2184                           Default values will be used if not found.
2185     ],
2189 AC_ARG_WITH(extra-buildid,
2190     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2191         [Show addition build identification in about dialog.]),
2195 AC_ARG_WITH(vendor,
2196     AS_HELP_STRING([--with-vendor="John the Builder"],
2197         [Set vendor of the build.]),
2200 AC_ARG_WITH(android-package-name,
2201     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2202         [Set Android package name of the build.]),
2205 AC_ARG_WITH(compat-oowrappers,
2206     AS_HELP_STRING([--with-compat-oowrappers],
2207         [Install oo* wrappers in parallel with
2208          lo* ones to keep backward compatibility.
2209          Has effect only with make distro-pack-install]),
2212 AC_ARG_WITH(os-version,
2213     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2214         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2217 AC_ARG_WITH(mingw-cross-compiler,
2218     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2219         [Specify the MinGW cross-compiler to use.
2220          When building on the ODK on Unix and building unowinreg.dll,
2221          specify the MinGW C++ cross-compiler.]),
2224 AC_ARG_WITH(idlc-cpp,
2225     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2226         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2229 AC_ARG_WITH(build-version,
2230     AS_HELP_STRING([--with-build-version="Built by Jim"],
2231         [Allows the builder to add a custom version tag that will appear in the
2232          Help/About box for QA purposes.]),
2233 with_build_version=$withval,
2236 AC_ARG_WITH(parallelism,
2237     AS_HELP_STRING([--with-parallelism],
2238         [Number of jobs to run simultaneously during build. Parallel builds can
2239         save a lot of time on multi-cpu machines. Defaults to the number of
2240         CPUs on the machine, unless you configure --enable-icecream - then to
2241         40.]),
2244 AC_ARG_WITH(all-tarballs,
2245     AS_HELP_STRING([--with-all-tarballs],
2246         [Download all external tarballs unconditionally]))
2248 AC_ARG_WITH(gdrive-client-id,
2249     AS_HELP_STRING([--with-gdrive-client-id],
2250         [Provides the client id of the application for OAuth2 authentication
2251         on Google Drive. If either this or --with-gdrive-client-secret is
2252         empty, the feature will be disabled]),
2255 AC_ARG_WITH(gdrive-client-secret,
2256     AS_HELP_STRING([--with-gdrive-client-secret],
2257         [Provides the client secret of the application for OAuth2
2258         authentication on Google Drive. If either this or
2259         --with-gdrive-client-id is empty, the feature will be disabled]),
2262 AC_ARG_WITH(alfresco-cloud-client-id,
2263     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2264         [Provides the client id of the application for OAuth2 authentication
2265         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2266         empty, the feature will be disabled]),
2269 AC_ARG_WITH(alfresco-cloud-client-secret,
2270     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2271         [Provides the client secret of the application for OAuth2
2272         authentication on Alfresco Cloud. If either this or
2273         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2276 AC_ARG_WITH(onedrive-client-id,
2277     AS_HELP_STRING([--with-onedrive-client-id],
2278         [Provides the client id of the application for OAuth2 authentication
2279         on OneDrive. If either this or --with-onedrive-client-secret is
2280         empty, the feature will be disabled]),
2283 AC_ARG_WITH(onedrive-client-secret,
2284     AS_HELP_STRING([--with-onedrive-client-secret],
2285         [Provides the client secret of the application for OAuth2
2286         authentication on OneDrive. If either this or
2287         --with-onedrive-client-id is empty, the feature will be disabled]),
2289 dnl ===================================================================
2290 dnl Do we want to use pre-build binary tarball for recompile
2291 dnl ===================================================================
2293 if test "$enable_library_bin_tar" = "yes" ; then
2294     USE_LIBRARY_BIN_TAR=TRUE
2295 else
2296     USE_LIBRARY_BIN_TAR=
2298 AC_SUBST(USE_LIBRARY_BIN_TAR)
2300 dnl ===================================================================
2301 dnl Test whether build target is Release Build
2302 dnl ===================================================================
2303 AC_MSG_CHECKING([whether build target is Release Build])
2304 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2305     AC_MSG_RESULT([no])
2306     ENABLE_RELEASE_BUILD=
2307 else
2308     AC_MSG_RESULT([yes])
2309     ENABLE_RELEASE_BUILD=TRUE
2311 AC_SUBST(ENABLE_RELEASE_BUILD)
2313 dnl ===================================================================
2314 dnl Test whether to sign Windows Build
2315 dnl ===================================================================
2316 AC_MSG_CHECKING([whether to sign windows build])
2317 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2318     AC_MSG_RESULT([yes])
2319     WINDOWS_BUILD_SIGNING="TRUE"
2320 else
2321     AC_MSG_RESULT([no])
2322     WINDOWS_BUILD_SIGNING="FALSE"
2324 AC_SUBST(WINDOWS_BUILD_SIGNING)
2326 dnl ===================================================================
2327 dnl MacOSX build and runtime environment options
2328 dnl ===================================================================
2330 AC_ARG_WITH(macosx-sdk,
2331     AS_HELP_STRING([--with-macosx-sdk=<version>],
2332         [Prefer a specific SDK for building.])
2333     [
2334                           If the requested SDK is not available, a search for the oldest one will be done.
2335                           With current Xcode versions, only the latest SDK is included, so this option is
2336                           not terribly useful. It works fine to build with a new SDK and run the result
2337                           on an older OS.
2339                           e. g.: --with-macosx-sdk=10.10
2341                           there are 3 options to control the MacOSX build:
2342                           --with-macosx-sdk (referred as 'sdk' below)
2343                           --with-macosx-version-min-required (referred as 'min' below)
2344                           --with-macosx-version-max-allowed (referred as 'max' below)
2346                           the connection between these value and the default they take is as follow:
2347                           ( ? means not specified on the command line, s means the SDK version found,
2348                           constraint: 8 <= x <= y <= z)
2350                           ==========================================
2351                            command line      || config result
2352                           ==========================================
2353                           min  | max  | sdk  || min   | max  | sdk  |
2354                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2355                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2356                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2357                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2358                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2359                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2360                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2361                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2364                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2365                           for a detailed technical explanation of these variables
2367                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2368     ],
2371 AC_ARG_WITH(macosx-version-min-required,
2372     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2373         [set the minimum OS version needed to run the built LibreOffice])
2374     [
2375                           e. g.: --with-macos-version-min-required=10.10
2376                           see --with-macosx-sdk for more info
2377     ],
2380 AC_ARG_WITH(macosx-version-max-allowed,
2381     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2382         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2383     [
2384                           e. g.: --with-macos-version-max-allowed=10.10
2385                           see --with-macosx-sdk for more info
2386     ],
2390 dnl ===================================================================
2391 dnl options for stuff used during cross-compilation build
2392 dnl Not quite superseded by --with-build-platform-configure-options.
2393 dnl TODO: check, if the "force" option is still needed anywhere.
2394 dnl ===================================================================
2396 AC_ARG_WITH(system-icu-for-build,
2397     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2398         [Use icu already on system for build tools (cross-compilation only).]))
2401 dnl ===================================================================
2402 dnl Check for incompatible options set by fuzzing, and reset those
2403 dnl automatically to working combinations
2404 dnl ===================================================================
2406 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2407         "$enable_dbus" != "$enable_avahi"; then
2408     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2409     enable_avahi=$enable_dbus
2412 add_lopath_after ()
2414     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2415         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2416     fi
2419 add_lopath_before ()
2421     local IFS=${P_SEP}
2422     local path_cleanup
2423     local dir
2424     for dir in $LO_PATH ; do
2425         if test "$dir" != "$1" ; then
2426             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2427         fi
2428     done
2429     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2432 dnl ===================================================================
2433 dnl check for required programs (grep, awk, sed, bash)
2434 dnl ===================================================================
2436 pathmunge ()
2438     if test -n "$1"; then
2439         if test "$build_os" = "cygwin"; then
2440             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2441                 PathFormat "$1"
2442                 new_path=`cygpath -sm "$formatted_path"`
2443             else
2444                 PathFormat "$1"
2445                 new_path=`cygpath -u "$formatted_path"`
2446             fi
2447         else
2448             new_path="$1"
2449         fi
2450         if test "$2" = "after"; then
2451             add_lopath_after "$new_path"
2452         else
2453             add_lopath_before "$new_path"
2454         fi
2455         unset new_path
2456     fi
2459 AC_PROG_AWK
2460 AC_PATH_PROG( AWK, $AWK)
2461 if test -z "$AWK"; then
2462     AC_MSG_ERROR([install awk to run this script])
2465 AC_PATH_PROG(BASH, bash)
2466 if test -z "$BASH"; then
2467     AC_MSG_ERROR([bash not found in \$PATH])
2469 AC_SUBST(BASH)
2471 AC_MSG_CHECKING([for GNU or BSD tar])
2472 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2473     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2474     if test $? -eq 0;  then
2475         GNUTAR=$a
2476         break
2477     fi
2478 done
2479 AC_MSG_RESULT($GNUTAR)
2480 if test -z "$GNUTAR"; then
2481     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2483 AC_SUBST(GNUTAR)
2485 AC_MSG_CHECKING([for tar's option to strip components])
2486 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2487 if test $? -eq 0; then
2488     STRIP_COMPONENTS="--strip-components"
2489 else
2490     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2491     if test $? -eq 0; then
2492         STRIP_COMPONENTS="--strip-path"
2493     else
2494         STRIP_COMPONENTS="unsupported"
2495     fi
2497 AC_MSG_RESULT($STRIP_COMPONENTS)
2498 if test x$STRIP_COMPONENTS = xunsupported; then
2499     AC_MSG_ERROR([you need a tar that is able to strip components.])
2501 AC_SUBST(STRIP_COMPONENTS)
2503 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2504 dnl desktop OSes from "mobile" ones.
2506 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2507 dnl In other words, that when building for an OS that is not a
2508 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2510 dnl Note the direction of the implication; there is no assumption that
2511 dnl cross-compiling would imply a non-desktop OS.
2513 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2514     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2515     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2516     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2519 # Whether to build "avmedia" functionality or not.
2521 if test -z "$enable_avmedia"; then
2522     enable_avmedia=yes
2525 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2526 if test "$enable_avmedia" = yes; then
2527     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2528 else
2529     USE_AVMEDIA_DUMMY='TRUE'
2531 AC_SUBST(USE_AVMEDIA_DUMMY)
2533 # Decide whether to build database connectivity stuff (including
2534 # Base) or not. We probably don't want to on non-desktop OSes.
2535 if test -z "$enable_database_connectivity"; then
2536     # --disable-database-connectivity is unfinished work in progress
2537     # and the iOS test app doesn't link if we actually try to use it.
2538     # if test $_os != iOS -a $_os != Android; then
2539     if test $_os != iOS; then
2540         enable_database_connectivity=yes
2541     fi
2544 if test "$enable_database_connectivity" = yes; then
2545     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2546     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2549 if test -z "$enable_extensions"; then
2550     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2551     if test $_os != iOS -a $_os != Android; then
2552         enable_extensions=yes
2553     fi
2556 if test "$enable_extensions" = yes; then
2557     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2558     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2561 if test -z "$enable_scripting"; then
2562     # Disable scripting for iOS unless specifically overridden
2563     # with --enable-scripting.
2564     if test $_os != iOS; then
2565         enable_scripting=yes
2566     fi
2569 DISABLE_SCRIPTING=''
2570 if test "$enable_scripting" = yes; then
2571     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2572     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2573 else
2574     DISABLE_SCRIPTING='TRUE'
2575     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2578 if test $_os = iOS -o $_os = Android; then
2579     # Disable dynamic_loading always for iOS and Android
2580     enable_dynamic_loading=no
2581 elif test -z "$enable_dynamic_loading"; then
2582     # Otherwise enable it unless specifically disabled
2583     enable_dynamic_loading=yes
2586 DISABLE_DYNLOADING=''
2587 if test "$enable_dynamic_loading" = yes; then
2588     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2589 else
2590     DISABLE_DYNLOADING='TRUE'
2592 AC_SUBST(DISABLE_DYNLOADING)
2594 # remember SYSBASE value
2595 AC_SUBST(SYSBASE)
2597 dnl ===================================================================
2598 dnl  Sort out various gallery compilation options
2599 dnl ===================================================================
2600 AC_MSG_CHECKING([how to build and package galleries])
2601 if test -n "${with_galleries}"; then
2602     if test "$with_galleries" = "build"; then
2603         WITH_GALLERY_BUILD=TRUE
2604         AC_MSG_RESULT([build from source images internally])
2605     elif test "$with_galleries" = "no"; then
2606         WITH_GALLERY_BUILD=
2607         AC_MSG_RESULT([disable non-internal gallery build])
2608     else
2609         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2610     fi
2611 else
2612     if test $_os != iOS -a $_os != Android; then
2613         WITH_GALLERY_BUILD=TRUE
2614         AC_MSG_RESULT([internal src images for desktop])
2615     else
2616         WITH_GALLERY_BUILD=
2617         AC_MSG_RESULT([disable src image build])
2618     fi
2620 AC_SUBST(WITH_GALLERY_BUILD)
2622 dnl ===================================================================
2623 dnl  Checks if ccache is available
2624 dnl ===================================================================
2625 CCACHE_DEPEND_MODE=
2626 if test "$_os" = "WINNT"; then
2627     # on windows/VC build do not use ccache
2628     CCACHE=""
2629 elif test "$enable_ccache" = "no"; then
2630     CCACHE=""
2631 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2632     case "%$CC%$CXX%" in
2633     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2634     # assume that's good then
2635     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2636         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2637         CCACHE_DEPEND_MODE=1
2638         ;;
2639     *)
2640         AC_PATH_PROG([CCACHE],[ccache],[not found])
2641         if test "$CCACHE" = "not found"; then
2642             CCACHE=""
2643         else
2644             CCACHE_DEPEND_MODE=1
2645             # Need to check for ccache version: otherwise prevents
2646             # caching of the results (like "-x objective-c++" for Mac)
2647             if test $_os = Darwin -o $_os = iOS; then
2648                 # Check ccache version
2649                 AC_MSG_CHECKING([whether version of ccache is suitable])
2650                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2651                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2652                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2653                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2654                 else
2655                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2656                     CCACHE=""
2657                     CCACHE_DEPEND_MODE=
2658                 fi
2659             fi
2660         fi
2661         ;;
2662     esac
2663 else
2664     CCACHE=""
2666 if test "$enable_ccache" = "nodepend"; then
2667     CCACHE_DEPEND_MODE=""
2669 AC_SUBST(CCACHE_DEPEND_MODE)
2671 if test "$CCACHE" != ""; then
2672     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2673     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2674     if test "$ccache_size" = ""; then
2675         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2676         if test "$ccache_size" = ""; then
2677             ccache_size=0
2678         fi
2679         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2680         if test $ccache_size -lt 1024; then
2681             CCACHE=""
2682             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2683             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2684         else
2685             # warn that ccache may be too small for debug build
2686             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2687             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2688         fi
2689     else
2690         if test $ccache_size -lt 5; then
2691             #warn that ccache may be too small for debug build
2692             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2693             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2694         fi
2695     fi
2698 dnl ===================================================================
2699 dnl  Checks for C compiler,
2700 dnl  The check for the C++ compiler is later on.
2701 dnl ===================================================================
2702 if test "$_os" != "WINNT"; then
2703     GCC_HOME_SET="true"
2704     AC_MSG_CHECKING([gcc home])
2705     if test -z "$with_gcc_home"; then
2706         if test "$enable_icecream" = "yes"; then
2707             if test -d "/usr/lib/icecc/bin"; then
2708                 GCC_HOME="/usr/lib/icecc/"
2709             elif test -d "/usr/libexec/icecc/bin"; then
2710                 GCC_HOME="/usr/libexec/icecc/"
2711             elif test -d "/opt/icecream/bin"; then
2712                 GCC_HOME="/opt/icecream/"
2713             else
2714                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2716             fi
2717         else
2718             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2719             GCC_HOME_SET="false"
2720         fi
2721     else
2722         GCC_HOME="$with_gcc_home"
2723     fi
2724     AC_MSG_RESULT($GCC_HOME)
2725     AC_SUBST(GCC_HOME)
2727     if test "$GCC_HOME_SET" = "true"; then
2728         if test -z "$CC"; then
2729             CC="$GCC_HOME/bin/gcc"
2730             CC_BASE="gcc"
2731         fi
2732         if test -z "$CXX"; then
2733             CXX="$GCC_HOME/bin/g++"
2734             CXX_BASE="g++"
2735         fi
2736     fi
2739 COMPATH=`dirname "$CC"`
2740 if test "$COMPATH" = "."; then
2741     AC_PATH_PROGS(COMPATH, $CC)
2742     dnl double square bracket to get single because of M4 quote...
2743     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2745 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2747 dnl ===================================================================
2748 dnl Java support
2749 dnl ===================================================================
2750 AC_MSG_CHECKING([whether to build with Java support])
2751 if test "$with_java" != "no"; then
2752     if test "$DISABLE_SCRIPTING" = TRUE; then
2753         AC_MSG_RESULT([no, overridden by --disable-scripting])
2754         ENABLE_JAVA=""
2755         with_java=no
2756     else
2757         AC_MSG_RESULT([yes])
2758         ENABLE_JAVA="TRUE"
2759         AC_DEFINE(HAVE_FEATURE_JAVA)
2760     fi
2761 else
2762     AC_MSG_RESULT([no])
2763     ENABLE_JAVA=""
2766 AC_SUBST(ENABLE_JAVA)
2768 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2770 dnl ENABLE_JAVA="" indicate no Java support at all
2772 dnl ===================================================================
2773 dnl Check macOS SDK and compiler
2774 dnl ===================================================================
2776 if test $_os = Darwin; then
2778     # If no --with-macosx-sdk option is given, look for one
2780     # The intent is that for "most" Mac-based developers, a suitable
2781     # SDK will be found automatically without any configure options.
2783     # For developers with a current Xcode, the lowest-numbered SDK
2784     # higher than or equal to the minimum required should be found.
2786     AC_MSG_CHECKING([what macOS SDK to use])
2787     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2788         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2789         if test -d "$MACOSX_SDK_PATH"; then
2790             with_macosx_sdk="${_macosx_sdk}"
2791             break
2792         else
2793             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2794             if test -d "$MACOSX_SDK_PATH"; then
2795                 with_macosx_sdk="${_macosx_sdk}"
2796                 break
2797             fi
2798         fi
2799     done
2800     if test ! -d "$MACOSX_SDK_PATH"; then
2801         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2802     fi
2804     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2806     case $with_macosx_sdk in
2807     10.12)
2808         MACOSX_SDK_VERSION=101200
2809         ;;
2810     10.13)
2811         MACOSX_SDK_VERSION=101300
2812         ;;
2813     10.14)
2814         MACOSX_SDK_VERSION=101400
2815         ;;
2816     10.15)
2817         MACOSX_SDK_VERSION=101500
2818         ;;
2819     *)
2820         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2821         ;;
2822     esac
2824     if test "$with_macosx_version_min_required" = "" ; then
2825         with_macosx_version_min_required="10.10";
2826     fi
2828     if test "$with_macosx_version_max_allowed" = "" ; then
2829         with_macosx_version_max_allowed="$with_macosx_sdk"
2830     fi
2832     # export this so that "xcrun" invocations later return matching values
2833     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2834     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2835     export DEVELOPER_DIR
2836     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2837     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2839     AC_MSG_CHECKING([whether Xcode is new enough])
2840     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2841     my_xcode_ver2=${my_xcode_ver1#Xcode }
2842     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2843     if test "$my_xcode_ver3" -ge 903; then
2844         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2845     else
2846         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2847     fi
2849     case "$with_macosx_version_min_required" in
2850     10.10)
2851         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2852         ;;
2853     10.11)
2854         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2855         ;;
2856     10.12)
2857         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2858         ;;
2859     10.13)
2860         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2861         ;;
2862     10.14)
2863         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2864         ;;
2865     10.15)
2866         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2867         ;;
2868     *)
2869         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2870         ;;
2871     esac
2872     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2874     LIBTOOL=/usr/bin/libtool
2875     INSTALL_NAME_TOOL=install_name_tool
2876     if test -z "$save_CC"; then
2877         stdlib=-stdlib=libc++
2878         if test "$ENABLE_LTO" = TRUE; then
2879             lto=-flto
2880         fi
2882         AC_MSG_CHECKING([what C compiler to use])
2883         CC="`xcrun -find clang`"
2884         CC_BASE=`first_arg_basename "$CC"`
2885         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2886         AC_MSG_RESULT([$CC])
2888         AC_MSG_CHECKING([what C++ compiler to use])
2889         CXX="`xcrun -find clang++`"
2890         CXX_BASE=`first_arg_basename "$CXX"`
2891         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2892         AC_MSG_RESULT([$CXX])
2894         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2895         AR=`xcrun -find ar`
2896         NM=`xcrun -find nm`
2897         STRIP=`xcrun -find strip`
2898         LIBTOOL=`xcrun -find libtool`
2899         RANLIB=`xcrun -find ranlib`
2900     fi
2902     case "$with_macosx_version_max_allowed" in
2903     10.10)
2904         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2905         ;;
2906     10.11)
2907         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2908         ;;
2909     10.12)
2910         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2911         ;;
2912     10.13)
2913         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2914         ;;
2915     10.14)
2916         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2917         ;;
2918     10.15)
2919         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2920         ;;
2921     *)
2922         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2923         ;;
2924     esac
2926     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2927     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2928         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])
2929     else
2930         AC_MSG_RESULT([ok])
2931     fi
2933     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2934     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2935         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2936     else
2937         AC_MSG_RESULT([ok])
2938     fi
2939     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2940     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2942     AC_MSG_CHECKING([whether to do code signing])
2944     if test "$enable_macosx_code_signing" = yes; then
2945         # By default use the first suitable certificate (?).
2947         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2948         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2949         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2950         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2951         # "Developer ID Application" one.
2953         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2954         if test -n "$identity"; then
2955             MACOSX_CODESIGNING_IDENTITY=$identity
2956             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2957             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2958         else
2959             AC_MSG_ERROR([cannot determine identity to use])
2960         fi
2961     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2962         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2963         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2964         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2965     else
2966         AC_MSG_RESULT([no])
2967     fi
2969     AC_MSG_CHECKING([whether to create a Mac App Store package])
2971     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2972         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2973     elif test "$enable_macosx_package_signing" = yes; then
2974         # By default use the first suitable certificate.
2975         # It should be a "3rd Party Mac Developer Installer" one
2977         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2978         if test -n "$identity"; then
2979             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2980             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2981             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2982         else
2983             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2984         fi
2985     elif test -n "$enable_macosx_package_signing"; then
2986         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2987         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2988         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2989     else
2990         AC_MSG_RESULT([no])
2991     fi
2993     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2994         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2995     fi
2997     AC_MSG_CHECKING([whether to sandbox the application])
2999     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3000         AC_MSG_ERROR([macOS sandboxing requires code signing])
3001     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3002         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3003     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3004         ENABLE_MACOSX_SANDBOX=TRUE
3005         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3006         AC_MSG_RESULT([yes])
3007     else
3008         AC_MSG_RESULT([no])
3009     fi
3011     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3012     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3013     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3015 AC_SUBST(MACOSX_SDK_PATH)
3016 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3017 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3018 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3019 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3020 AC_SUBST(INSTALL_NAME_TOOL)
3021 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3022 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3023 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3024 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3025 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3027 dnl ===================================================================
3028 dnl Check iOS SDK and compiler
3029 dnl ===================================================================
3031 if test $_os = iOS; then
3032     AC_MSG_CHECKING([what iOS SDK to use])
3033     current_sdk_ver=13.2
3034     older_sdk_vers="13.1 13.0 12.4 12.2"
3035     if test "$enable_ios_simulator" = "yes"; then
3036         platform=iPhoneSimulator
3037         versionmin=-mios-simulator-version-min=12.2
3038     else
3039         platform=iPhoneOS
3040         versionmin=-miphoneos-version-min=12.2
3041     fi
3042     xcode_developer=`xcode-select -print-path`
3044     for sdkver in $current_sdk_ver $older_sdk_vers; do
3045         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3046         if test -d $t; then
3047             sysroot=$t
3048             break
3049         fi
3050     done
3052     if test -z "$sysroot"; then
3053         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3054     fi
3056     AC_MSG_RESULT($sysroot)
3058     # LTO is not really recommended for iOS builds,
3059     # the link time will be astronomical
3060     if test "$ENABLE_LTO" = TRUE; then
3061         lto=-flto
3062     fi
3064     stdlib="-stdlib=libc++"
3066     AC_MSG_CHECKING([what C compiler to use])
3067     CC="`xcrun -find clang`"
3068     CC_BASE=`first_arg_basename "$CC"`
3069     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3070     AC_MSG_RESULT([$CC])
3072     AC_MSG_CHECKING([what C++ compiler to use])
3073     CXX="`xcrun -find clang++`"
3074     CXX_BASE=`first_arg_basename "$CXX"`
3075     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3076     AC_MSG_RESULT([$CXX])
3078     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3079     AR=`xcrun -find ar`
3080     NM=`xcrun -find nm`
3081     STRIP=`xcrun -find strip`
3082     LIBTOOL=`xcrun -find libtool`
3083     RANLIB=`xcrun -find ranlib`
3086 AC_MSG_CHECKING([whether to treat the installation as read-only])
3088 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3089         "$enable_extensions" != yes; then
3090     enable_readonly_installset=yes
3092 if test "$enable_readonly_installset" = yes; then
3093     AC_MSG_RESULT([yes])
3094     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3095 else
3096     AC_MSG_RESULT([no])
3099 dnl ===================================================================
3100 dnl Structure of install set
3101 dnl ===================================================================
3103 if test $_os = Darwin; then
3104     LIBO_BIN_FOLDER=MacOS
3105     LIBO_ETC_FOLDER=Resources
3106     LIBO_LIBEXEC_FOLDER=MacOS
3107     LIBO_LIB_FOLDER=Frameworks
3108     LIBO_LIB_PYUNO_FOLDER=Resources
3109     LIBO_SHARE_FOLDER=Resources
3110     LIBO_SHARE_HELP_FOLDER=Resources/help
3111     LIBO_SHARE_JAVA_FOLDER=Resources/java
3112     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3113     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3114     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3115     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3116     LIBO_URE_BIN_FOLDER=MacOS
3117     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3118     LIBO_URE_LIB_FOLDER=Frameworks
3119     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3120     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3121 elif test $_os = WINNT; then
3122     LIBO_BIN_FOLDER=program
3123     LIBO_ETC_FOLDER=program
3124     LIBO_LIBEXEC_FOLDER=program
3125     LIBO_LIB_FOLDER=program
3126     LIBO_LIB_PYUNO_FOLDER=program
3127     LIBO_SHARE_FOLDER=share
3128     LIBO_SHARE_HELP_FOLDER=help
3129     LIBO_SHARE_JAVA_FOLDER=program/classes
3130     LIBO_SHARE_PRESETS_FOLDER=presets
3131     LIBO_SHARE_READMES_FOLDER=readmes
3132     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3133     LIBO_SHARE_SHELL_FOLDER=program/shell
3134     LIBO_URE_BIN_FOLDER=program
3135     LIBO_URE_ETC_FOLDER=program
3136     LIBO_URE_LIB_FOLDER=program
3137     LIBO_URE_MISC_FOLDER=program
3138     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3139 else
3140     LIBO_BIN_FOLDER=program
3141     LIBO_ETC_FOLDER=program
3142     LIBO_LIBEXEC_FOLDER=program
3143     LIBO_LIB_FOLDER=program
3144     LIBO_LIB_PYUNO_FOLDER=program
3145     LIBO_SHARE_FOLDER=share
3146     LIBO_SHARE_HELP_FOLDER=help
3147     LIBO_SHARE_JAVA_FOLDER=program/classes
3148     LIBO_SHARE_PRESETS_FOLDER=presets
3149     LIBO_SHARE_READMES_FOLDER=readmes
3150     if test "$enable_fuzzers" != yes; then
3151         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3152     else
3153         LIBO_SHARE_RESOURCE_FOLDER=resource
3154     fi
3155     LIBO_SHARE_SHELL_FOLDER=program/shell
3156     LIBO_URE_BIN_FOLDER=program
3157     LIBO_URE_ETC_FOLDER=program
3158     LIBO_URE_LIB_FOLDER=program
3159     LIBO_URE_MISC_FOLDER=program
3160     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3162 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3172 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3173 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3177 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3179 # Not all of them needed in config_host.mk, add more if need arises
3180 AC_SUBST(LIBO_BIN_FOLDER)
3181 AC_SUBST(LIBO_ETC_FOLDER)
3182 AC_SUBST(LIBO_LIB_FOLDER)
3183 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3184 AC_SUBST(LIBO_SHARE_FOLDER)
3185 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3186 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3187 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3188 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3189 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3190 AC_SUBST(LIBO_URE_BIN_FOLDER)
3191 AC_SUBST(LIBO_URE_ETC_FOLDER)
3192 AC_SUBST(LIBO_URE_LIB_FOLDER)
3193 AC_SUBST(LIBO_URE_MISC_FOLDER)
3194 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3196 dnl ===================================================================
3197 dnl Windows specific tests and stuff
3198 dnl ===================================================================
3200 reg_get_value()
3202     # Return value: $regvalue
3203     unset regvalue
3205     local _regentry="/proc/registry${1}/${2}"
3206     if test -f "$_regentry"; then
3207         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3208         # Registry keys read via /proc/registry* are always \0 terminated!
3209         local _regvalue=$(tr -d '\0' < "$_regentry")
3210         if test $? -eq 0; then
3211             regvalue=$_regvalue
3212         fi
3213     fi
3216 # Get a value from the 32-bit side of the Registry
3217 reg_get_value_32()
3219     reg_get_value "32" "$1"
3222 # Get a value from the 64-bit side of the Registry
3223 reg_get_value_64()
3225     reg_get_value "64" "$1"
3228 if test "$_os" = "WINNT"; then
3229     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3230     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3231         AC_MSG_RESULT([no])
3232         WINDOWS_SDK_ARCH="x86"
3233     else
3234         AC_MSG_RESULT([yes])
3235         WINDOWS_SDK_ARCH="x64"
3236         BITNESS_OVERRIDE=64
3237     fi
3239 if test "$_os" = "iOS"; then
3240     cross_compiling="yes"
3243 if test "$cross_compiling" = "yes"; then
3244     export CROSS_COMPILING=TRUE
3245 else
3246     CROSS_COMPILING=
3247     BUILD_TYPE="$BUILD_TYPE NATIVE"
3249 AC_SUBST(CROSS_COMPILING)
3251 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3252 # NOTE: must _not_ be used for bundled external libraries!
3253 ISYSTEM=
3254 if test "$GCC" = "yes"; then
3255     AC_MSG_CHECKING( for -isystem )
3256     save_CFLAGS=$CFLAGS
3257     CFLAGS="$CFLAGS -Werror"
3258     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3259     CFLAGS=$save_CFLAGS
3260     if test -n "$ISYSTEM"; then
3261         AC_MSG_RESULT(yes)
3262     else
3263         AC_MSG_RESULT(no)
3264     fi
3266 if test -z "$ISYSTEM"; then
3267     # fall back to using -I
3268     ISYSTEM=-I
3270 AC_SUBST(ISYSTEM)
3272 dnl ===================================================================
3273 dnl  Check which Visual Studio compiler is used
3274 dnl ===================================================================
3276 map_vs_year_to_version()
3278     # Return value: $vsversion
3280     unset vsversion
3282     case $1 in
3283     2017)
3284         vsversion=15;;
3285     2019)
3286         vsversion=16;;
3287     *)
3288         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3289     esac
3292 vs_versions_to_check()
3294     # Args: $1 (optional) : versions to check, in the order of preference
3295     # Return value: $vsversions
3297     unset vsversions
3299     if test -n "$1"; then
3300         map_vs_year_to_version "$1"
3301         vsversions=$vsversion
3302     else
3303         # We accept only 2017
3304         vsversions="15"
3305     fi
3308 win_get_env_from_vsvars32bat()
3310     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3311     # Also seems to be located in another directory under the same name: vsvars32.bat
3312     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3313     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3314     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3315     chmod +x $WRAPPERBATCHFILEPATH
3316     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3317     rm -f $WRAPPERBATCHFILEPATH
3318     printf '%s' "$_win_get_env_from_vsvars32bat"
3321 find_ucrt()
3323     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3324     if test -n "$regvalue"; then
3325         PathFormat "$regvalue"
3326         UCRTSDKDIR=$formatted_path
3327         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3328         UCRTVERSION=$regvalue
3329         # Rest if not exist
3330         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3331           UCRTSDKDIR=
3332         fi
3333     fi
3334     if test -z "$UCRTSDKDIR"; then
3335         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3336         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3337         if test -f "$ide_env_file"; then
3338             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3339             UCRTSDKDIR=$formatted_path
3340             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3341             dnl Hack needed at least by tml:
3342             if test "$UCRTVERSION" = 10.0.15063.0 \
3343                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3344                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3345             then
3346                 UCRTVERSION=10.0.14393.0
3347             fi
3348         else
3349           AC_MSG_ERROR([No UCRT found])
3350         fi
3351     fi
3354 find_msvc()
3356     # Find Visual C++ 2017/2019
3357     # Args: $1 (optional) : The VS version year
3358     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3360     unset vctest vcnum vcnumwithdot vcbuildnumber
3362     vs_versions_to_check "$1"
3363     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3364     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3365     PathFormat "$vswhere"
3366     vswhere=$formatted_path
3367     for ver in $vsversions; do
3368         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3369         if test -n "$vswhereoutput"; then
3370             PathFormat "$vswhereoutput"
3371             vctest=$formatted_path
3372             break
3373         fi
3374     done
3376     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3377     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3378     # should be removed when upgrading baseline.
3379     if ! test -n "$vctest"; then
3380         for ver in $vsversions; do
3381             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3382             if test -n "$regvalue"; then
3383                 vctest=$regvalue
3384                 break
3385             fi
3386             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3387             if test -n "$regvalue"; then
3388                 AC_MSG_RESULT([found: $regvalue])
3389                 PathFormat "$regvalue"
3390                 vctest=$formatted_path
3391                 break
3392             fi
3393         done
3394     fi
3396     if test -n "$vctest"; then
3397         vcnumwithdot="$ver.0"
3398         case "$vcnumwithdot" in
3399         15.0)
3400             vcyear=2017
3401             vcnum=150
3402             ;;
3403         16.0)
3404             vcyear=2019
3405             vcnum=160
3406             ;;
3407         esac
3408         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3410     fi
3413 SOLARINC=
3414 MSBUILD_PATH=
3415 DEVENV=
3416 if test "$_os" = "WINNT"; then
3417     AC_MSG_CHECKING([Visual C++])
3418     find_msvc "$with_visual_studio"
3419     if test -z "$vctest"; then
3420         if test -n "$with_visual_studio"; then
3421             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3422         else
3423             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3424         fi
3425     fi
3427     if test "$BITNESS_OVERRIDE" = ""; then
3428         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3429             VC_PRODUCT_DIR=$vctest/VC
3430         else
3431             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3432         fi
3433     else
3434         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3435             VC_PRODUCT_DIR=$vctest/VC
3436         else
3437             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3438         fi
3439     fi
3440     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3442     AC_MSG_CHECKING([for short pathname of VC product directory])
3443     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3444     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3446     UCRTSDKDIR=
3447     UCRTVERSION=
3449     AC_MSG_CHECKING([for UCRT location])
3450     find_ucrt
3451     # find_ucrt errors out if it doesn't find it
3452     AC_MSG_RESULT([found])
3453     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3454     ucrtincpath_formatted=$formatted_path
3455     # SOLARINC is used for external modules and must be set too.
3456     # And no, it's not sufficient to set SOLARINC only, as configure
3457     # itself doesn't honour it.
3458     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3459     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3460     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3461     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3463     AC_SUBST(UCRTSDKDIR)
3464     AC_SUBST(UCRTVERSION)
3466     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3467     # Find the proper version of MSBuild.exe to use based on the VS version
3468     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3469     if test -n "$regvalue" ; then
3470         AC_MSG_RESULT([found: $regvalue])
3471         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3472     else
3473         if test "$vcnumwithdot" = "16.0"; then
3474             if test "$BITNESS_OVERRIDE" = ""; then
3475                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3476             else
3477                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3478             fi
3479         else
3480             if test "$BITNESS_OVERRIDE" = ""; then
3481                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3482             else
3483                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3484             fi
3485         fi
3486         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3487         AC_MSG_RESULT([$regvalue])
3488     fi
3490     # Find the version of devenv.exe
3491     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3492     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3493     if test ! -e "$DEVENV"; then
3494         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3495     fi
3497     dnl ===========================================================
3498     dnl  Check for the corresponding mspdb*.dll
3499     dnl ===========================================================
3501     VC_HOST_DIR=
3502     MSPDB_PATH=
3503     CL_PATH=
3505     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3506         VC_HOST_DIR="HostX64"
3507         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3508     else
3509         VC_HOST_DIR="HostX86"
3510         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3511     fi
3513     if test "$BITNESS_OVERRIDE" = ""; then
3514         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3515     else
3516         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3517     fi
3519     # MSVC 15.0 has libraries from 14.0?
3520     mspdbnum="140"
3522     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3523         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3524     fi
3526     dnl The path needs to be added before cl is called
3527     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3528     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3530     AC_MSG_CHECKING([cl.exe])
3532     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3533     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3534     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3535     # is not enough?
3537     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3538     dnl needed when building CLR code:
3539     if test -z "$MSVC_CXX"; then
3540         if test -f "$CL_PATH/cl.exe"; then
3541             MSVC_CXX="$CL_PATH/cl.exe"
3542         fi
3544         # This gives us a posix path with 8.3 filename restrictions
3545         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3546     fi
3548     if test -z "$CC"; then
3549         CC=$MSVC_CXX
3550         CC_BASE=`first_arg_basename "$CC"`
3551     fi
3552     if test "$BITNESS_OVERRIDE" = ""; then
3553         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3554         MSVC_CXX="$MSVC_CXX -arch:SSE"
3555     fi
3556     if test -z "$CXX"; then
3557         CXX=$MSVC_CXX
3558         CXX_BASE=`first_arg_basename "$CXX"`
3559     fi
3561     if test -n "$CC"; then
3562         # Remove /cl.exe from CC case insensitive
3563         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3564         if test "$BITNESS_OVERRIDE" = ""; then
3565            COMPATH="$VC_PRODUCT_DIR"
3566         else
3567             if test -n "$VC_PRODUCT_DIR"; then
3568                 COMPATH=$VC_PRODUCT_DIR
3569             fi
3570         fi
3571         if test "$BITNESS_OVERRIDE" = ""; then
3572             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3573             CC="$CC -arch:SSE"
3574         fi
3576         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3578         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3580         PathFormat "$COMPATH"
3581         COMPATH=`win_short_path_for_make "$formatted_path"`
3583         VCVER=$vcnum
3584         MSVSVER=$vcyear
3586         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3587         # are always "better", we list them in reverse chronological order.
3589         case "$vcnum" in
3590         150|160)
3591             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3592             ;;
3593         esac
3595         # The expectation is that --with-windows-sdk should not need to be used
3596         if test -n "$with_windows_sdk"; then
3597             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3598             *" "$with_windows_sdk" "*)
3599                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3600                 ;;
3601             *)
3602                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3603                 ;;
3604             esac
3605         fi
3607         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3608         ac_objext=obj
3609         ac_exeext=exe
3611     else
3612         AC_MSG_ERROR([Visual C++ not found after all, huh])
3613     fi
3615     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3616     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3617         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3618         // between Visual Studio versions and _MSC_VER:
3619         #if _MSC_VER < 1914
3620         #error
3621         #endif
3622     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3624     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3625     # version of the Explorer extension (and maybe other small
3626     # bits, too) needed when installing a 32-bit LibreOffice on a
3627     # 64-bit OS. The 64-bit Explorer extension is a feature that
3628     # has been present since long in OOo. Don't confuse it with
3629     # building LibreOffice itself as 64-bit code.
3631     BUILD_X64=
3632     CXX_X64_BINARY=
3634     if test "$BITNESS_OVERRIDE" = ""; then
3635         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3636         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3637              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3638             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3639                 BUILD_X64=TRUE
3640                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3641             fi
3642         fi
3643         if test "$BUILD_X64" = TRUE; then
3644             AC_MSG_RESULT([found])
3645         else
3646             AC_MSG_RESULT([not found])
3647             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3648         fi
3649     else
3650         CXX_X64_BINARY=$CXX
3651     fi
3652     AC_SUBST(BUILD_X64)
3654     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3655     AC_SUBST(CXX_X64_BINARY)
3657     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3658     # needed to support TWAIN scan on both 32- and 64-bit systems
3660     BUILD_X86=
3662     if test "$BITNESS_OVERRIDE" = "64"; then
3663         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3664         if test -n "$CXX_X86_BINARY"; then
3665             BUILD_X86=TRUE
3666             AC_MSG_RESULT([preset])
3667         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3668             BUILD_X86=TRUE
3669             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3670             CXX_X86_BINARY+=" /arch:SSE"
3671             AC_MSG_RESULT([found])
3672         else
3673             CXX_X86_BINARY=
3674             AC_MSG_RESULT([not found])
3675             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3676         fi
3677     else
3678         BUILD_X86=TRUE
3679         CXX_X86_BINARY=$MSVC_CXX
3680     fi
3681     AC_SUBST(BUILD_X86)
3682     AC_SUBST(CXX_X86_BINARY)
3684 AC_SUBST(VCVER)
3685 AC_SUBST(DEVENV)
3686 AC_SUBST(MSVC_CXX)
3689 # unowinreg.dll
3691 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3692 AC_SUBST(UNOWINREG_DLL)
3694 COM_IS_CLANG=
3695 AC_MSG_CHECKING([whether the compiler is actually Clang])
3696 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3697     #ifndef __clang__
3698     you lose
3699     #endif
3700     int foo=42;
3701     ]])],
3702     [AC_MSG_RESULT([yes])
3703      COM_IS_CLANG=TRUE],
3704     [AC_MSG_RESULT([no])])
3705 AC_SUBST(COM_IS_CLANG)
3707 CC_PLAIN=$CC
3708 CLANGVER=
3709 if test "$COM_IS_CLANG" = TRUE; then
3710     AC_MSG_CHECKING([whether Clang is new enough])
3711     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3712         #if !defined __apple_build_version__
3713         #error
3714         #endif
3715         ]])],
3716         [my_apple_clang=yes],[my_apple_clang=])
3717     if test "$my_apple_clang" = yes; then
3718         AC_MSG_RESULT([assumed yes (Apple Clang)])
3719     else
3720         if test "$_os" = WINNT; then
3721             dnl In which case, assume clang-cl:
3722             my_args="/EP /TC"
3723             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3724             dnl clang-cl:
3725             CC_PLAIN=
3726             for i in $CC; do
3727                 case $i in
3728                 -FIIntrin.h)
3729                     ;;
3730                 *)
3731                     CC_PLAIN="$CC_PLAIN $i"
3732                     ;;
3733                 esac
3734             done
3735         else
3736             my_args="-E -P"
3737         fi
3738         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3739         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3740         CLANGVER=`echo $clang_version \
3741             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3742         if test "$CLANGVER" -ge 50002; then
3743             AC_MSG_RESULT([yes ($clang_version)])
3744         else
3745             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3746         fi
3747         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3748         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3749     fi
3752 SHOWINCLUDES_PREFIX=
3753 if test "$_os" = WINNT; then
3754     dnl We need to guess the prefix of the -showIncludes output, it can be
3755     dnl localized
3756     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3757     echo "#include <stdlib.h>" > conftest.c
3758     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3759         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3760     rm -f conftest.c conftest.obj
3761     if test -z "$SHOWINCLUDES_PREFIX"; then
3762         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3763     else
3764         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3765     fi
3767 AC_SUBST(SHOWINCLUDES_PREFIX)
3770 # prefix C with ccache if needed
3772 if test "$CCACHE" != ""; then
3773     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3775     AC_LANG_PUSH([C])
3776     save_CFLAGS=$CFLAGS
3777     CFLAGS="$CFLAGS --ccache-skip -O2"
3778     dnl an empty program will do, we're checking the compiler flags
3779     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3780                       [use_ccache=yes], [use_ccache=no])
3781     if test $use_ccache = yes; then
3782         AC_MSG_RESULT([yes])
3783     else
3784         CC="$CCACHE $CC"
3785         CC_BASE="ccache $CC_BASE"
3786         AC_MSG_RESULT([no])
3787     fi
3788     CFLAGS=$save_CFLAGS
3789     AC_LANG_POP([C])
3792 # ===================================================================
3793 # check various GCC options that Clang does not support now but maybe
3794 # will somewhen in the future, check them even for GCC, so that the
3795 # flags are set
3796 # ===================================================================
3798 HAVE_GCC_GGDB2=
3799 if test "$GCC" = "yes"; then
3800     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3801     save_CFLAGS=$CFLAGS
3802     CFLAGS="$CFLAGS -Werror -ggdb2"
3803     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3804     CFLAGS=$save_CFLAGS
3805     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3806         AC_MSG_RESULT([yes])
3807     else
3808         AC_MSG_RESULT([no])
3809     fi
3811     if test "$host_cpu" = "m68k"; then
3812         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3813         save_CFLAGS=$CFLAGS
3814         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3815         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3816         CFLAGS=$save_CFLAGS
3817         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3818             AC_MSG_RESULT([yes])
3819         else
3820             AC_MSG_ERROR([no])
3821         fi
3822     fi
3824 AC_SUBST(HAVE_GCC_GGDB2)
3826 dnl ===================================================================
3827 dnl  Test the gcc version
3828 dnl ===================================================================
3829 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3830     AC_MSG_CHECKING([the GCC version])
3831     _gcc_version=`$CC -dumpversion`
3832     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3833         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3834     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3836     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3838     if test "$gcc_full_version" -lt 70000; then
3839         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3840     fi
3841 else
3842     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3843     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3844     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3845     # (which reports itself as GCC 4.2.1).
3846     GCC_VERSION=
3848 AC_SUBST(GCC_VERSION)
3850 dnl Set the ENABLE_DBGUTIL variable
3851 dnl ===================================================================
3852 AC_MSG_CHECKING([whether to build with additional debug utilities])
3853 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3854     ENABLE_DBGUTIL="TRUE"
3855     # this is an extra var so it can have different default on different MSVC
3856     # versions (in case there are version specific problems with it)
3857     MSVC_USE_DEBUG_RUNTIME="TRUE"
3859     AC_MSG_RESULT([yes])
3860     # cppunit and graphite expose STL in public headers
3861     if test "$with_system_cppunit" = "yes"; then
3862         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3863     else
3864         with_system_cppunit=no
3865     fi
3866     if test "$with_system_graphite" = "yes"; then
3867         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3868     else
3869         with_system_graphite=no
3870     fi
3871     if test "$with_system_orcus" = "yes"; then
3872         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3873     else
3874         with_system_orcus=no
3875     fi
3876     if test "$with_system_libcmis" = "yes"; then
3877         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3878     else
3879         with_system_libcmis=no
3880     fi
3881     if test "$with_system_hunspell" = "yes"; then
3882         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3883     else
3884         with_system_hunspell=no
3885     fi
3886     if test "$with_system_gpgmepp" = "yes"; then
3887         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3888     else
3889         with_system_gpgmepp=no
3890     fi
3891     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3892     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3893     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3894     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3895     # of those two is using the system variant:
3896     if test "$with_system_libnumbertext" = "yes"; then
3897         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3898     else
3899         with_system_libnumbertext=no
3900     fi
3901     if test "$with_system_libwps" = "yes"; then
3902         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3903     else
3904         with_system_libwps=no
3905     fi
3906 else
3907     ENABLE_DBGUTIL=""
3908     MSVC_USE_DEBUG_RUNTIME=""
3909     AC_MSG_RESULT([no])
3911 AC_SUBST(ENABLE_DBGUTIL)
3912 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3914 dnl Set the ENABLE_DEBUG variable.
3915 dnl ===================================================================
3916 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3917     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3919 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3920     if test -z "$libo_fuzzed_enable_debug"; then
3921         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3922     else
3923         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3924         enable_debug=yes
3925     fi
3928 AC_MSG_CHECKING([whether to do a debug build])
3929 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3930     ENABLE_DEBUG="TRUE"
3931     if test -n "$ENABLE_DBGUTIL" ; then
3932         AC_MSG_RESULT([yes (dbgutil)])
3933     else
3934         AC_MSG_RESULT([yes])
3935     fi
3936 else
3937     ENABLE_DEBUG=""
3938     AC_MSG_RESULT([no])
3940 AC_SUBST(ENABLE_DEBUG)
3942 dnl ===================================================================
3943 dnl Select the linker to use (gold/lld/ld.bfd).
3944 dnl This is done only after compiler checks (need to know if Clang is
3945 dnl used, for different defaults) and after checking if a debug build
3946 dnl is wanted (non-debug builds get the default linker if not explicitly
3947 dnl specified otherwise).
3948 dnl All checks for linker features/options should come after this.
3949 dnl ===================================================================
3950 check_use_ld()
3952     use_ld=$1
3953     use_ld_fail_if_error=$2
3954     use_ld_ok=
3955     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3956     use_ld_ldflags_save="$LDFLAGS"
3957     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3958     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3959 #include <stdio.h>
3960         ],[
3961 printf ("hello world\n");
3962         ])], USE_LD=$use_ld, [])
3963     if test -n "$USE_LD"; then
3964         AC_MSG_RESULT( yes )
3965         use_ld_ok=yes
3966     else
3967         if test -n "$use_ld_fail_if_error"; then
3968             AC_MSG_ERROR( no )
3969         else
3970             AC_MSG_RESULT( no )
3971         fi
3972     fi
3973     if test -n "$use_ld_ok"; then
3974         dnl keep the value of LDFLAGS
3975         return 0
3976     fi
3977     LDFLAGS="$use_ld_ldflags_save"
3978     return 1
3980 USE_LD=
3981 if test "$enable_ld" != "no"; then
3982     if test "$GCC" = "yes"; then
3983         if test -n "$enable_ld"; then
3984             check_use_ld "$enable_ld" fail_if_error
3985         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3986             dnl non-debug builds default to the default linker
3987             true
3988         elif test -n "$COM_IS_CLANG"; then
3989             check_use_ld lld
3990             if test $? -ne 0; then
3991                 check_use_ld gold
3992             fi
3993         else
3994             # For gcc first try gold, new versions also support lld.
3995             check_use_ld gold
3996             if test $? -ne 0; then
3997                 check_use_ld lld
3998             fi
3999         fi
4000         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4001         rm conftest.out
4002         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4003         if test -z "$ld_used"; then
4004             ld_used="unknown"
4005         fi
4006         AC_MSG_CHECKING([for linker that is used])
4007         AC_MSG_RESULT([$ld_used])
4008         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4009             if echo "$ld_used" | grep -q "^GNU ld"; then
4010                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4011                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4012             fi
4013         fi
4014     else
4015         if test "$enable_ld" = "yes"; then
4016             AC_MSG_ERROR([--enable-ld not supported])
4017         fi
4018     fi
4020 AC_SUBST(USE_LD)
4022 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4023 if test "$GCC" = "yes"; then
4024     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4025     bsymbolic_functions_ldflags_save=$LDFLAGS
4026     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4027     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4028 #include <stdio.h>
4029         ],[
4030 printf ("hello world\n");
4031         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4032     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4033         AC_MSG_RESULT( found )
4034     else
4035         AC_MSG_RESULT( not found )
4036     fi
4037     LDFLAGS=$bsymbolic_functions_ldflags_save
4039 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4042 HAVE_GSPLIT_DWARF=
4043 if test "$enable_split_debug" != no; then
4044     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4045     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4046         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4047         save_CFLAGS=$CFLAGS
4048         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4049         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4050         CFLAGS=$save_CFLAGS
4051         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4052             AC_MSG_RESULT([yes])
4053         else
4054             if test "$enable_split_debug" = yes; then
4055                 AC_MSG_ERROR([no])
4056             else
4057                 AC_MSG_RESULT([no])
4058             fi
4059         fi
4060     fi
4061     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4062         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4063         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4064     fi
4066 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4068 ENABLE_GDB_INDEX=
4069 if test "$enable_gdb_index" != "no"; then
4070     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4071     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4072         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4073         save_CFLAGS=$CFLAGS
4074         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4075         have_ggnu_pubnames=
4076         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4077         if test "$have_ggnu_pubnames" != "TRUE"; then
4078             if test "$enable_gdb_index" = "yes"; then
4079                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4080             else
4081                 AC_MSG_RESULT( no )
4082             fi
4083         else
4084             AC_MSG_RESULT( yes )
4085             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4086             ldflags_save=$LDFLAGS
4087             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4088             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4089 #include <stdio.h>
4090                 ],[
4091 printf ("hello world\n");
4092                 ])], ENABLE_GDB_INDEX=TRUE, [])
4093             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4094                 AC_MSG_RESULT( yes )
4095             else
4096                 if test "$enable_gdb_index" = "yes"; then
4097                     AC_MSG_ERROR( no )
4098                 else
4099                     AC_MSG_RESULT( no )
4100                 fi
4101             fi
4102             LDFLAGS=$ldflags_save
4103         fi
4104         CFLAGS=$save_CFLAGS
4105         fi
4106     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4107         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4108         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4109     fi
4111 AC_SUBST(ENABLE_GDB_INDEX)
4113 if test "$enable_sal_log" = yes; then
4114     ENABLE_SAL_LOG=TRUE
4116 AC_SUBST(ENABLE_SAL_LOG)
4118 dnl Check for enable symbols option
4119 dnl ===================================================================
4120 AC_MSG_CHECKING([whether to generate debug information])
4121 if test -z "$enable_symbols"; then
4122     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4123         enable_symbols=yes
4124     else
4125         enable_symbols=no
4126     fi
4128 if test "$enable_symbols" = yes; then
4129     ENABLE_SYMBOLS_FOR=all
4130     AC_MSG_RESULT([yes])
4131 elif test "$enable_symbols" = no; then
4132     ENABLE_SYMBOLS_FOR=
4133     AC_MSG_RESULT([no])
4134 else
4135     # Selective debuginfo.
4136     ENABLE_SYMBOLS_FOR="$enable_symbols"
4137     AC_MSG_RESULT([for "$enable_symbols"])
4139 AC_SUBST(ENABLE_SYMBOLS_FOR)
4141 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4142     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4143     AC_MSG_CHECKING([whether enough memory is available for linking])
4144     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4145     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4146     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4147         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4148     else
4149         AC_MSG_RESULT([yes])
4150     fi
4153 AC_MSG_CHECKING([whether to compile with optimization flags])
4154 if test -z "$enable_optimized"; then
4155     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4156         enable_optimized=no
4157     else
4158         enable_optimized=yes
4159     fi
4161 if test "$enable_optimized" != no; then
4162     ENABLE_OPTIMIZED=TRUE
4163     AC_MSG_RESULT([yes])
4164 else
4165     ENABLE_OPTIMIZED=
4166     AC_MSG_RESULT([no])
4168 AC_SUBST(ENABLE_OPTIMIZED)
4171 # determine CPUNAME, OS, ...
4172 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4174 case "$host_os" in
4176 aix*)
4177     COM=GCC
4178     CPUNAME=POWERPC
4179     USING_X11=TRUE
4180     OS=AIX
4181     RTL_OS=AIX
4182     RTL_ARCH=PowerPC
4183     PLATFORMID=aix_powerpc
4184     P_SEP=:
4185     ;;
4187 cygwin*)
4188     COM=MSC
4189     USING_X11=
4190     OS=WNT
4191     RTL_OS=Windows
4192     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4193         P_SEP=";"
4194     else
4195         P_SEP=:
4196     fi
4197     case "$host_cpu" in
4198     i*86|x86_64)
4199         if test "$BITNESS_OVERRIDE" = 64; then
4200             CPUNAME=X86_64
4201             RTL_ARCH=X86_64
4202             PLATFORMID=windows_x86_64
4203             WINDOWS_X64=1
4204             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4205         else
4206             CPUNAME=INTEL
4207             RTL_ARCH=x86
4208             PLATFORMID=windows_x86
4209         fi
4210         ;;
4211     *)
4212         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4213         ;;
4214     esac
4215     SCPDEFS="$SCPDEFS -D_MSC_VER"
4216     ;;
4218 darwin*)
4219     COM=GCC
4220     USING_X11=
4221     OS=MACOSX
4222     RTL_OS=MacOSX
4223     P_SEP=:
4225     case "$host_cpu" in
4226     arm)
4227         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4228         ;;
4229     arm64)
4230         OS=iOS
4231         RTL_OS=iOS
4232         if test "$enable_ios_simulator" = "yes"; then
4233             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4234         else
4235             CPUNAME=ARM64
4236             RTL_ARCH=ARM_EABI
4237             PLATFORMID=ios_arm64
4238         fi
4239         ;;
4240     i*86)
4241         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4242         ;;
4243     x86_64)
4244         if test "$enable_ios_simulator" = "yes"; then
4245             OS=iOS
4246         fi
4247         CPUNAME=X86_64
4248         RTL_ARCH=X86_64
4249         PLATFORMID=macosx_x86_64
4250         ;;
4251     *)
4252         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4253         ;;
4254     esac
4255     ;;
4257 dragonfly*)
4258     COM=GCC
4259     USING_X11=TRUE
4260     OS=DRAGONFLY
4261     RTL_OS=DragonFly
4262     P_SEP=:
4264     case "$host_cpu" in
4265     i*86)
4266         CPUNAME=INTEL
4267         RTL_ARCH=x86
4268         PLATFORMID=dragonfly_x86
4269         ;;
4270     x86_64)
4271         CPUNAME=X86_64
4272         RTL_ARCH=X86_64
4273         PLATFORMID=dragonfly_x86_64
4274         ;;
4275     *)
4276         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4277         ;;
4278     esac
4279     ;;
4281 freebsd*)
4282     COM=GCC
4283     USING_X11=TRUE
4284     RTL_OS=FreeBSD
4285     OS=FREEBSD
4286     P_SEP=:
4288     case "$host_cpu" in
4289     i*86)
4290         CPUNAME=INTEL
4291         RTL_ARCH=x86
4292         PLATFORMID=freebsd_x86
4293         ;;
4294     x86_64|amd64)
4295         CPUNAME=X86_64
4296         RTL_ARCH=X86_64
4297         PLATFORMID=freebsd_x86_64
4298         ;;
4299     *)
4300         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4301         ;;
4302     esac
4303     ;;
4305 haiku*)
4306     COM=GCC
4307     USING_X11=
4308     GUIBASE=haiku
4309     RTL_OS=Haiku
4310     OS=HAIKU
4311     P_SEP=:
4313     case "$host_cpu" in
4314     i*86)
4315         CPUNAME=INTEL
4316         RTL_ARCH=x86
4317         PLATFORMID=haiku_x86
4318         ;;
4319     x86_64|amd64)
4320         CPUNAME=X86_64
4321         RTL_ARCH=X86_64
4322         PLATFORMID=haiku_x86_64
4323         ;;
4324     *)
4325         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4326         ;;
4327     esac
4328     ;;
4330 kfreebsd*)
4331     COM=GCC
4332     USING_X11=TRUE
4333     OS=LINUX
4334     RTL_OS=kFreeBSD
4335     P_SEP=:
4337     case "$host_cpu" in
4339     i*86)
4340         CPUNAME=INTEL
4341         RTL_ARCH=x86
4342         PLATFORMID=kfreebsd_x86
4343         ;;
4344     x86_64)
4345         CPUNAME=X86_64
4346         RTL_ARCH=X86_64
4347         PLATFORMID=kfreebsd_x86_64
4348         ;;
4349     *)
4350         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4351         ;;
4352     esac
4353     ;;
4355 linux-gnu*)
4356     COM=GCC
4357     USING_X11=TRUE
4358     OS=LINUX
4359     RTL_OS=Linux
4360     P_SEP=:
4362     case "$host_cpu" in
4364     aarch64)
4365         CPUNAME=AARCH64
4366         PLATFORMID=linux_aarch64
4367         RTL_ARCH=AARCH64
4368         ;;
4369     alpha)
4370         CPUNAME=AXP
4371         RTL_ARCH=ALPHA
4372         PLATFORMID=linux_alpha
4373         ;;
4374     arm*)
4375         CPUNAME=ARM
4376         EPM_FLAGS="-a arm"
4377         RTL_ARCH=ARM_EABI
4378         PLATFORMID=linux_arm_eabi
4379         case "$host_cpu" in
4380         arm*-linux)
4381             RTL_ARCH=ARM_OABI
4382             PLATFORMID=linux_arm_oabi
4383             ;;
4384         esac
4385         ;;
4386     hppa)
4387         CPUNAME=HPPA
4388         RTL_ARCH=HPPA
4389         EPM_FLAGS="-a hppa"
4390         PLATFORMID=linux_hppa
4391         ;;
4392     i*86)
4393         CPUNAME=INTEL
4394         RTL_ARCH=x86
4395         PLATFORMID=linux_x86
4396         ;;
4397     ia64)
4398         CPUNAME=IA64
4399         RTL_ARCH=IA64
4400         PLATFORMID=linux_ia64
4401         ;;
4402     mips)
4403         CPUNAME=GODSON
4404         RTL_ARCH=MIPS_EB
4405         EPM_FLAGS="-a mips"
4406         PLATFORMID=linux_mips_eb
4407         ;;
4408     mips64)
4409         CPUNAME=GODSON64
4410         RTL_ARCH=MIPS64_EB
4411         EPM_FLAGS="-a mips64"
4412         PLATFORMID=linux_mips64_eb
4413         ;;
4414     mips64el)
4415         CPUNAME=GODSON64
4416         RTL_ARCH=MIPS64_EL
4417         EPM_FLAGS="-a mips64el"
4418         PLATFORMID=linux_mips64_el
4419         ;;
4420     mipsel)
4421         CPUNAME=GODSON
4422         RTL_ARCH=MIPS_EL
4423         EPM_FLAGS="-a mipsel"
4424         PLATFORMID=linux_mips_el
4425         ;;
4426     m68k)
4427         CPUNAME=M68K
4428         RTL_ARCH=M68K
4429         PLATFORMID=linux_m68k
4430         ;;
4431     powerpc)
4432         CPUNAME=POWERPC
4433         RTL_ARCH=PowerPC
4434         PLATFORMID=linux_powerpc
4435         ;;
4436     powerpc64)
4437         CPUNAME=POWERPC64
4438         RTL_ARCH=PowerPC_64
4439         PLATFORMID=linux_powerpc64
4440         ;;
4441     powerpc64le)
4442         CPUNAME=POWERPC64
4443         RTL_ARCH=PowerPC_64_LE
4444         PLATFORMID=linux_powerpc64_le
4445         ;;
4446     sparc)
4447         CPUNAME=SPARC
4448         RTL_ARCH=SPARC
4449         PLATFORMID=linux_sparc
4450         ;;
4451     sparc64)
4452         CPUNAME=SPARC64
4453         RTL_ARCH=SPARC64
4454         PLATFORMID=linux_sparc64
4455         ;;
4456     s390)
4457         CPUNAME=S390
4458         RTL_ARCH=S390
4459         PLATFORMID=linux_s390
4460         ;;
4461     s390x)
4462         CPUNAME=S390X
4463         RTL_ARCH=S390x
4464         PLATFORMID=linux_s390x
4465         ;;
4466     x86_64)
4467         CPUNAME=X86_64
4468         RTL_ARCH=X86_64
4469         PLATFORMID=linux_x86_64
4470         ;;
4471     *)
4472         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4473         ;;
4474     esac
4475     ;;
4477 linux-android*)
4478     COM=GCC
4479     USING_X11=
4480     OS=ANDROID
4481     RTL_OS=Android
4482     P_SEP=:
4484     case "$host_cpu" in
4486     arm|armel)
4487         CPUNAME=ARM
4488         RTL_ARCH=ARM_EABI
4489         PLATFORMID=android_arm_eabi
4490         ;;
4491     aarch64)
4492         CPUNAME=AARCH64
4493         RTL_ARCH=AARCH64
4494         PLATFORMID=android_aarch64
4495         ;;
4496     i*86)
4497         CPUNAME=INTEL
4498         RTL_ARCH=x86
4499         PLATFORMID=android_x86
4500         ;;
4501     x86_64)
4502         CPUNAME=X86_64
4503         RTL_ARCH=X86_64
4504         PLATFORMID=android_x86_64
4505         ;;
4506     *)
4507         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4508         ;;
4509     esac
4510     ;;
4512 *netbsd*)
4513     COM=GCC
4514     USING_X11=TRUE
4515     OS=NETBSD
4516     RTL_OS=NetBSD
4517     P_SEP=:
4519     case "$host_cpu" in
4520     i*86)
4521         CPUNAME=INTEL
4522         RTL_ARCH=x86
4523         PLATFORMID=netbsd_x86
4524         ;;
4525     powerpc)
4526         CPUNAME=POWERPC
4527         RTL_ARCH=PowerPC
4528         PLATFORMID=netbsd_powerpc
4529         ;;
4530     sparc)
4531         CPUNAME=SPARC
4532         RTL_ARCH=SPARC
4533         PLATFORMID=netbsd_sparc
4534         ;;
4535     x86_64)
4536         CPUNAME=X86_64
4537         RTL_ARCH=X86_64
4538         PLATFORMID=netbsd_x86_64
4539         ;;
4540     *)
4541         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4542         ;;
4543     esac
4544     ;;
4546 openbsd*)
4547     COM=GCC
4548     USING_X11=TRUE
4549     OS=OPENBSD
4550     RTL_OS=OpenBSD
4551     P_SEP=:
4553     case "$host_cpu" in
4554     i*86)
4555         CPUNAME=INTEL
4556         RTL_ARCH=x86
4557         PLATFORMID=openbsd_x86
4558         ;;
4559     x86_64)
4560         CPUNAME=X86_64
4561         RTL_ARCH=X86_64
4562         PLATFORMID=openbsd_x86_64
4563         ;;
4564     *)
4565         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4566         ;;
4567     esac
4568     SOLARINC="$SOLARINC -I/usr/local/include"
4569     ;;
4571 solaris*)
4572     COM=GCC
4573     USING_X11=TRUE
4574     OS=SOLARIS
4575     RTL_OS=Solaris
4576     P_SEP=:
4578     case "$host_cpu" in
4579     i*86)
4580         CPUNAME=INTEL
4581         RTL_ARCH=x86
4582         PLATFORMID=solaris_x86
4583         ;;
4584     sparc)
4585         CPUNAME=SPARC
4586         RTL_ARCH=SPARC
4587         PLATFORMID=solaris_sparc
4588         ;;
4589     sparc64)
4590         CPUNAME=SPARC64
4591         RTL_ARCH=SPARC64
4592         PLATFORMID=solaris_sparc64
4593         ;;
4594     *)
4595         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4596         ;;
4597     esac
4598     SOLARINC="$SOLARINC -I/usr/local/include"
4599     ;;
4602     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4603     ;;
4604 esac
4606 if test "$with_x" = "no"; then
4607     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4610 DISABLE_GUI=""
4611 if test "$enable_gui" = "no"; then
4612     if test "$USING_X11" != TRUE; then
4613         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4614     fi
4615     USING_X11=
4616     DISABLE_GUI=TRUE
4617     AC_DEFINE(HAVE_FEATURE_UI,0)
4618     test_cairo=yes
4620 AC_SUBST(DISABLE_GUI)
4622 WORKDIR="${BUILDDIR}/workdir"
4623 INSTDIR="${BUILDDIR}/instdir"
4624 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4625 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4626 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4627 AC_SUBST(COM)
4628 AC_SUBST(CPUNAME)
4629 AC_SUBST(RTL_OS)
4630 AC_SUBST(RTL_ARCH)
4631 AC_SUBST(EPM_FLAGS)
4632 AC_SUBST(USING_X11)
4633 AC_SUBST([INSTDIR])
4634 AC_SUBST([INSTROOT])
4635 AC_SUBST([INSTROOTBASE])
4636 AC_SUBST(OS)
4637 AC_SUBST(P_SEP)
4638 AC_SUBST(WORKDIR)
4639 AC_SUBST(PLATFORMID)
4640 AC_SUBST(WINDOWS_X64)
4641 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4643 dnl ===================================================================
4644 dnl Test which package format to use
4645 dnl ===================================================================
4646 AC_MSG_CHECKING([which package format to use])
4647 if test -n "$with_package_format" -a "$with_package_format" != no; then
4648     for i in $with_package_format; do
4649         case "$i" in
4650         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4651             ;;
4652         *)
4653             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4654 aix - AIX software distribution
4655 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4656 deb - Debian software distribution
4657 pkg - Solaris software distribution
4658 rpm - RedHat software distribution
4660 LibreOffice additionally supports:
4661 archive - .tar.gz or .zip
4662 dmg - macOS .dmg
4663 installed - installation tree
4664 msi - Windows .msi
4665         ])
4666             ;;
4667         esac
4668     done
4669     # fakeroot is needed to ensure correct file ownerships/permissions
4670     # inside deb packages and tar archives created on Linux and Solaris.
4671     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4672         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4673         if test "$FAKEROOT" = "no"; then
4674             AC_MSG_ERROR(
4675                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4676         fi
4677     fi
4678     PKGFORMAT="$with_package_format"
4679     AC_MSG_RESULT([$PKGFORMAT])
4680 else
4681     PKGFORMAT=
4682     AC_MSG_RESULT([none])
4684 AC_SUBST(PKGFORMAT)
4686 dnl ===================================================================
4687 dnl Set up a different compiler to produce tools to run on the build
4688 dnl machine when doing cross-compilation
4689 dnl ===================================================================
4691 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4692 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4693 if test "$cross_compiling" = "yes"; then
4694     AC_MSG_CHECKING([for BUILD platform configuration])
4695     echo
4696     rm -rf CONF-FOR-BUILD config_build.mk
4697     mkdir CONF-FOR-BUILD
4698     # Here must be listed all files needed when running the configure script. In particular, also
4699     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4700     # keep them in the same order as there.
4701     (cd $SRC_ROOT && tar cf - \
4702         config.guess \
4703         bin/get_config_variables \
4704         solenv/bin/getcompver.awk \
4705         solenv/inc/langlist.mk \
4706         download.lst \
4707         config_host.mk.in \
4708         config_host_lang.mk.in \
4709         Makefile.in \
4710         bin/bffvalidator.sh.in \
4711         bin/odfvalidator.sh.in \
4712         bin/officeotron.sh.in \
4713         instsetoo_native/util/openoffice.lst.in \
4714         config_host/*.in \
4715         sysui/desktop/macosx/Info.plist.in) \
4716     | (cd CONF-FOR-BUILD && tar xf -)
4717     cp configure CONF-FOR-BUILD
4718     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4719     (
4720     unset COM USING_X11 OS CPUNAME
4721     unset CC CXX SYSBASE CFLAGS
4722     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4723     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4724     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4725     if test -n "$CC_FOR_BUILD"; then
4726         export CC="$CC_FOR_BUILD"
4727         CC_BASE=`first_arg_basename "$CC"`
4728     fi
4729     if test -n "$CXX_FOR_BUILD"; then
4730         export CXX="$CXX_FOR_BUILD"
4731         CXX_BASE=`first_arg_basename "$CXX"`
4732     fi
4733     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4734     cd CONF-FOR-BUILD
4735     sub_conf_opts=""
4736     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4737     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4738     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4739     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4740     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4741     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4742     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4743     # Don't bother having configure look for stuff not needed for the build platform anyway
4744     ./configure \
4745         --disable-cups \
4746         --disable-gstreamer-1-0 \
4747         --disable-gtk3 \
4748         --disable-pdfimport \
4749         --disable-postgresql-sdbc \
4750         --with-parallelism="$with_parallelism" \
4751         --without-doxygen \
4752         --without-java \
4753         $sub_conf_opts \
4754         --srcdir=$srcdir \
4755         2>&1 | sed -e 's/^/    /'
4756     test -f ./config_host.mk 2>/dev/null || exit
4757     cp config_host.mk ../config_build.mk
4758     cp config_host_lang.mk ../config_build_lang.mk
4759     mv config.log ../config.Build.log
4760     mkdir -p ../config_build
4761     mv config_host/*.h ../config_build
4762     . ./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
4764     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
4765         VV='$'$V
4766         VV=`eval "echo $VV"`
4767         if test -n "$VV"; then
4768             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4769             echo "$line" >>build-config
4770         fi
4771     done
4773     for V in INSTDIR INSTROOT WORKDIR; do
4774         VV='$'$V
4775         VV=`eval "echo $VV"`
4776         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4777         if test -n "$VV"; then
4778             line="${V}_FOR_BUILD='$VV'"
4779             echo "$line" >>build-config
4780         fi
4781     done
4783     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4784     echo "$line" >>build-config
4786     )
4787     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4788     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])
4789     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4790              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4792     eval `cat CONF-FOR-BUILD/build-config`
4794     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4796     rm -rf CONF-FOR-BUILD
4797 else
4798     OS_FOR_BUILD="$OS"
4799     CC_FOR_BUILD="$CC"
4800     CXX_FOR_BUILD="$CXX"
4801     INSTDIR_FOR_BUILD="$INSTDIR"
4802     INSTROOT_FOR_BUILD="$INSTROOT"
4803     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4804     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4805     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4806     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4807     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4808     WORKDIR_FOR_BUILD="$WORKDIR"
4810 AC_SUBST(OS_FOR_BUILD)
4811 AC_SUBST(INSTDIR_FOR_BUILD)
4812 AC_SUBST(INSTROOT_FOR_BUILD)
4813 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4814 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4815 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4816 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4817 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4818 AC_SUBST(WORKDIR_FOR_BUILD)
4820 dnl ===================================================================
4821 dnl Check for syslog header
4822 dnl ===================================================================
4823 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4825 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4826 dnl ===================================================================
4827 AC_MSG_CHECKING([whether to turn warnings to errors])
4828 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4829     ENABLE_WERROR="TRUE"
4830     AC_MSG_RESULT([yes])
4831 else
4832     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4833         ENABLE_WERROR="TRUE"
4834         AC_MSG_RESULT([yes])
4835     else
4836         AC_MSG_RESULT([no])
4837     fi
4839 AC_SUBST(ENABLE_WERROR)
4841 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4842 dnl ===================================================================
4843 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4844 if test -z "$enable_assert_always_abort"; then
4845    if test "$ENABLE_DEBUG" = TRUE; then
4846        enable_assert_always_abort=yes
4847    else
4848        enable_assert_always_abort=no
4849    fi
4851 if test "$enable_assert_always_abort" = "yes"; then
4852     ASSERT_ALWAYS_ABORT="TRUE"
4853     AC_MSG_RESULT([yes])
4854 else
4855     ASSERT_ALWAYS_ABORT="FALSE"
4856     AC_MSG_RESULT([no])
4858 AC_SUBST(ASSERT_ALWAYS_ABORT)
4860 # Determine whether to use ooenv for the instdir installation
4861 # ===================================================================
4862 if test $_os != "WINNT" -a $_os != "Darwin"; then
4863     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4864     if test "$enable_ooenv" = "no"; then
4865         AC_MSG_RESULT([no])
4866     else
4867         ENABLE_OOENV="TRUE"
4868         AC_MSG_RESULT([yes])
4869     fi
4871 AC_SUBST(ENABLE_OOENV)
4873 if test "$USING_X11" != TRUE; then
4874     # be sure to do not mess with unneeded stuff
4875     test_randr=no
4876     test_xrender=no
4877     test_cups=no
4878     test_dbus=no
4879     build_gstreamer_1_0=no
4880     test_kf5=no
4881     test_qt5=no
4882     test_gtk3_kde5=no
4883     enable_cairo_canvas=no
4886 if test "$OS" = "HAIKU"; then
4887     enable_cairo_canvas=yes
4888     test_kf5=yes
4891 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4892     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!])
4893     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!"
4894     enable_kf5=yes
4897 if test "$test_kf5" = "yes"; then
4898     test_qt5=yes
4901 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4902     if test "$enable_qt5" = "no"; then
4903         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4904     else
4905         enable_qt5=yes
4906     fi
4909 dnl ===================================================================
4910 dnl check for cups support
4911 dnl ===================================================================
4912 ENABLE_CUPS=""
4914 if test "$enable_cups" = "no"; then
4915     test_cups=no
4918 AC_MSG_CHECKING([whether to enable CUPS support])
4919 if test "$test_cups" = "yes"; then
4920     ENABLE_CUPS="TRUE"
4921     AC_MSG_RESULT([yes])
4923     AC_MSG_CHECKING([whether cups support is present])
4924     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4925     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4926     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4927         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4928     fi
4930 else
4931     AC_MSG_RESULT([no])
4934 AC_SUBST(ENABLE_CUPS)
4936 # fontconfig checks
4937 if test "$test_fontconfig" = "yes"; then
4938     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4939     SYSTEM_FONTCONFIG=TRUE
4940     FilterLibs "${FONTCONFIG_LIBS}"
4941     FONTCONFIG_LIBS="${filteredlibs}"
4943 AC_SUBST(FONTCONFIG_CFLAGS)
4944 AC_SUBST(FONTCONFIG_LIBS)
4945 AC_SUBST([SYSTEM_FONTCONFIG])
4947 dnl whether to find & fetch external tarballs?
4948 dnl ===================================================================
4949 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4950    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4951        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4952    else
4953        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4954    fi
4956 if test -z "$TARFILE_LOCATION"; then
4957     if test -d "$SRC_ROOT/src" ; then
4958         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4959         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4960     fi
4961     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4962 else
4963     AbsolutePath "$TARFILE_LOCATION"
4964     PathFormat "${absolute_path}"
4965     TARFILE_LOCATION="${formatted_path}"
4967 AC_SUBST(TARFILE_LOCATION)
4969 AC_MSG_CHECKING([whether we want to fetch tarballs])
4970 if test "$enable_fetch_external" != "no"; then
4971     if test "$with_all_tarballs" = "yes"; then
4972         AC_MSG_RESULT([yes, all of them])
4973         DO_FETCH_TARBALLS="ALL"
4974     else
4975         AC_MSG_RESULT([yes, if we use them])
4976         DO_FETCH_TARBALLS="TRUE"
4977     fi
4978 else
4979     AC_MSG_RESULT([no])
4980     DO_FETCH_TARBALLS=
4982 AC_SUBST(DO_FETCH_TARBALLS)
4984 AC_MSG_CHECKING([whether to build help])
4985 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4986     BUILD_TYPE="$BUILD_TYPE HELP"
4987     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4988     case "$with_help" in
4989     "html")
4990         ENABLE_HTMLHELP=TRUE
4991         SCPDEFS="$SCPDEFS -DWITH_HELP"
4992         AC_MSG_RESULT([HTML])
4993         ;;
4994     "online")
4995         ENABLE_HTMLHELP=TRUE
4996         HELP_ONLINE=TRUE
4997         AC_MSG_RESULT([HTML])
4998         ;;
4999     yes)
5000         SCPDEFS="$SCPDEFS -DWITH_HELP"
5001         AC_MSG_RESULT([yes])
5002         ;;
5003     *)
5004         AC_MSG_ERROR([Unknown --with-help=$with_help])
5005         ;;
5006     esac
5007 else
5008     AC_MSG_RESULT([no])
5010 AC_SUBST([ENABLE_HTMLHELP])
5011 AC_SUBST([HELP_ONLINE])
5013 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5014 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5015     BUILD_TYPE="$BUILD_TYPE HELP"
5016     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5017     case "$with_omindex" in
5018     "server")
5019         ENABLE_HTMLHELP=TRUE
5020         HELP_ONLINE=TRUE
5021         HELP_OMINDEX_PAGE=TRUE
5022         AC_MSG_RESULT([SERVER])
5023         ;;
5024     "noxap")
5025         ENABLE_HTMLHELP=TRUE
5026         HELP_ONLINE=TRUE
5027         HELP_OMINDEX_PAGE=FALSE
5028         AC_MSG_RESULT([NOXAP])
5029         ;;
5030     *)
5031         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5032         ;;
5033     esac
5034 else
5035     HELP_OMINDEX_PAGE=FALSE
5036     AC_MSG_RESULT([no])
5038 AC_SUBST([ENABLE_HTMLHELP])
5039 AC_SUBST([HELP_OMINDEX_PAGE])
5040 AC_SUBST([HELP_ONLINE])
5043 dnl Test whether to include MySpell dictionaries
5044 dnl ===================================================================
5045 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5046 if test "$with_myspell_dicts" = "yes"; then
5047     AC_MSG_RESULT([yes])
5048     WITH_MYSPELL_DICTS=TRUE
5049     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5050     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5051 else
5052     AC_MSG_RESULT([no])
5053     WITH_MYSPELL_DICTS=
5055 AC_SUBST(WITH_MYSPELL_DICTS)
5057 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5058 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5059     if test "$with_system_dicts" = yes; then
5060         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5061     fi
5062     with_system_dicts=no
5065 AC_MSG_CHECKING([whether to use dicts from external paths])
5066 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5067     AC_MSG_RESULT([yes])
5068     SYSTEM_DICTS=TRUE
5069     AC_MSG_CHECKING([for spelling dictionary directory])
5070     if test -n "$with_external_dict_dir"; then
5071         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5072     else
5073         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5074         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5075             DICT_SYSTEM_DIR=file:///usr/share/myspell
5076         fi
5077     fi
5078     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5079     AC_MSG_CHECKING([for hyphenation patterns directory])
5080     if test -n "$with_external_hyph_dir"; then
5081         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5082     else
5083         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5084     fi
5085     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5086     AC_MSG_CHECKING([for thesaurus directory])
5087     if test -n "$with_external_thes_dir"; then
5088         THES_SYSTEM_DIR=file://$with_external_thes_dir
5089     else
5090         THES_SYSTEM_DIR=file:///usr/share/mythes
5091     fi
5092     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5093 else
5094     AC_MSG_RESULT([no])
5095     SYSTEM_DICTS=
5097 AC_SUBST(SYSTEM_DICTS)
5098 AC_SUBST(DICT_SYSTEM_DIR)
5099 AC_SUBST(HYPH_SYSTEM_DIR)
5100 AC_SUBST(THES_SYSTEM_DIR)
5102 dnl ===================================================================
5103 dnl Precompiled headers.
5104 ENABLE_PCH=""
5105 AC_MSG_CHECKING([whether to enable pch feature])
5106 if test -z "$enable_pch"; then
5107     if test "$_os" = "WINNT"; then
5108         # Enabled by default on Windows.
5109         enable_pch=yes
5110     else
5111         enable_pch=no
5112     fi
5114 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5115     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5117 if test "$enable_pch" = "system"; then
5118     ENABLE_PCH="1"
5119     AC_MSG_RESULT([yes (system headers)])
5120 elif test "$enable_pch" = "base"; then
5121     ENABLE_PCH="2"
5122     AC_MSG_RESULT([yes (system and base headers)])
5123 elif test "$enable_pch" = "normal"; then
5124     ENABLE_PCH="3"
5125     AC_MSG_RESULT([yes (normal)])
5126 elif test "$enable_pch" = "full"; then
5127     ENABLE_PCH="4"
5128     AC_MSG_RESULT([yes (full)])
5129 elif test "$enable_pch" = "yes"; then
5130     # Pick a suitable default.
5131     if test "$GCC" = "yes"; then
5132         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5133         # while making the PCHs larger and rebuilds more likely.
5134         ENABLE_PCH="2"
5135         AC_MSG_RESULT([yes (system and base headers)])
5136     else
5137         # With MSVC the highest level makes a significant difference,
5138         # and it was the default when there used to be no PCH levels.
5139         ENABLE_PCH="4"
5140         AC_MSG_RESULT([yes (full)])
5141     fi
5142 elif test "$enable_pch" = "no"; then
5143     AC_MSG_RESULT([no])
5144 else
5145     AC_MSG_ERROR([Unknown value for --enable-pch])
5147 AC_SUBST(ENABLE_PCH)
5148 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5149 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5150     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5151     if test "$CCACHE_BIN" != "not found"; then
5152         AC_MSG_CHECKING([ccache version])
5153         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5154         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5155         AC_MSG_RESULT([$CCACHE_VERSION])
5156         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5157         if test "$CCACHE_NUMVER" -gt "030701"; then
5158             AC_MSG_RESULT([yes])
5159         else
5160             AC_MSG_RESULT([no (not newer than 3.7.1)])
5161             CCACHE_DEPEND_MODE=
5162         fi
5163     fi
5166 TAB=`printf '\t'`
5168 AC_MSG_CHECKING([the GNU Make version])
5169 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5170 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5171 if test "$_make_longver" -ge "038200"; then
5172     AC_MSG_RESULT([$GNUMAKE $_make_version])
5174 elif test "$_make_longver" -ge "038100"; then
5175     if test "$build_os" = "cygwin"; then
5176         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5177     fi
5178     AC_MSG_RESULT([$GNUMAKE $_make_version])
5180     dnl ===================================================================
5181     dnl Search all the common names for sha1sum
5182     dnl ===================================================================
5183     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5184     if test -z "$SHA1SUM"; then
5185         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5186     elif test "$SHA1SUM" = "openssl"; then
5187         SHA1SUM="openssl sha1"
5188     fi
5189     AC_MSG_CHECKING([for GNU Make bug 20033])
5190     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5191     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5192 A := \$(wildcard *.a)
5194 .PHONY: all
5195 all: \$(A:.a=.b)
5196 <TAB>@echo survived bug20033.
5198 .PHONY: setup
5199 setup:
5200 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5202 define d1
5203 @echo lala \$(1)
5204 @sleep 1
5205 endef
5207 define d2
5208 @echo tyty \$(1)
5209 @sleep 1
5210 endef
5212 %.b : %.a
5213 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5214 <TAB>\$(call d1,\$(CHECKSUM)),\
5215 <TAB>\$(call d2,\$(CHECKSUM)))
5217     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5218         no_parallelism_make="YES"
5219         AC_MSG_RESULT([yes, disable parallelism])
5220     else
5221         AC_MSG_RESULT([no, keep parallelism enabled])
5222     fi
5223     rm -rf $TESTGMAKEBUG20033
5224 else
5225     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5228 # find if gnumake support file function
5229 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5230 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5231 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5232     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5234 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5235 \$(file >test.txt,Success )
5237 .PHONY: all
5238 all:
5239 <TAB>@cat test.txt
5242 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5243 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5244     HAVE_GNUMAKE_FILE_FUNC=TRUE
5245     AC_MSG_RESULT([yes])
5246 else
5247     AC_MSG_RESULT([no])
5249 rm -rf $TESTGMAKEFILEFUNC
5250 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5251 AC_SUBST(GNUMAKE_WIN_NATIVE)
5253 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5254 STALE_MAKE=
5255 if test "$_make_ver_check" = ""; then
5256    STALE_MAKE=TRUE
5259 HAVE_LD_HASH_STYLE=FALSE
5260 WITH_LINKER_HASH_STYLE=
5261 AC_MSG_CHECKING([for --hash-style gcc linker support])
5262 if test "$GCC" = "yes"; then
5263     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5264         hash_styles="gnu sysv"
5265     elif test "$with_linker_hash_style" = "no"; then
5266         hash_styles=
5267     else
5268         hash_styles="$with_linker_hash_style"
5269     fi
5271     for hash_style in $hash_styles; do
5272         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5273         hash_style_ldflags_save=$LDFLAGS
5274         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5276         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5277             [
5278 #include <stdio.h>
5279             ],[
5280 printf ("");
5281             ])],
5282             [
5283                   HAVE_LD_HASH_STYLE=TRUE
5284                   WITH_LINKER_HASH_STYLE=$hash_style
5285             ],
5286             [HAVE_LD_HASH_STYLE=FALSE],
5287             [HAVE_LD_HASH_STYLE=FALSE])
5288         LDFLAGS=$hash_style_ldflags_save
5289     done
5291     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5292         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5293     else
5294         AC_MSG_RESULT( no )
5295     fi
5296     LDFLAGS=$hash_style_ldflags_save
5297 else
5298     AC_MSG_RESULT( no )
5300 AC_SUBST(HAVE_LD_HASH_STYLE)
5301 AC_SUBST(WITH_LINKER_HASH_STYLE)
5303 dnl ===================================================================
5304 dnl Check whether there's a Perl version available.
5305 dnl ===================================================================
5306 if test -z "$with_perl_home"; then
5307     AC_PATH_PROG(PERL, perl)
5308 else
5309     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5310     _perl_path="$with_perl_home/bin/perl"
5311     if test -x "$_perl_path"; then
5312         PERL=$_perl_path
5313     else
5314         AC_MSG_ERROR([$_perl_path not found])
5315     fi
5318 dnl ===================================================================
5319 dnl Testing for Perl version 5 or greater.
5320 dnl $] is the Perl version variable, it is returned as an integer
5321 dnl ===================================================================
5322 if test "$PERL"; then
5323     AC_MSG_CHECKING([the Perl version])
5324     ${PERL} -e "exit($]);"
5325     _perl_version=$?
5326     if test "$_perl_version" -lt 5; then
5327         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5328     fi
5329     AC_MSG_RESULT([Perl $_perl_version])
5330 else
5331     AC_MSG_ERROR([Perl not found, install Perl 5])
5334 dnl ===================================================================
5335 dnl Testing for required Perl modules
5336 dnl ===================================================================
5338 AC_MSG_CHECKING([for required Perl modules])
5339 perl_use_string="use Cwd ; use Digest::MD5"
5340 if test "$_os" = "WINNT"; then
5341     if test -n "$PKGFORMAT"; then
5342         for i in $PKGFORMAT; do
5343             case "$i" in
5344             msi)
5345                 # for getting fonts versions to use in MSI
5346                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5347                 ;;
5348             esac
5349         done
5350     fi
5352 if test "$with_system_hsqldb" = "yes"; then
5353     perl_use_string="$perl_use_string ; use Archive::Zip"
5355 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5356     AC_MSG_RESULT([all modules found])
5357 else
5358     AC_MSG_RESULT([failed to find some modules])
5359     # Find out which modules are missing.
5360     for i in $perl_use_string; do
5361         if test "$i" != "use" -a "$i" != ";"; then
5362             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5363                 missing_perl_modules="$missing_perl_modules $i"
5364             fi
5365         fi
5366     done
5367     AC_MSG_ERROR([
5368     The missing Perl modules are: $missing_perl_modules
5369     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5372 dnl ===================================================================
5373 dnl Check for pkg-config
5374 dnl ===================================================================
5375 if test "$_os" != "WINNT"; then
5376     PKG_PROG_PKG_CONFIG
5379 if test "$_os" != "WINNT"; then
5381     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5382     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5383     # explicitly. Or put /path/to/compiler in PATH yourself.
5385     # Use wrappers for LTO
5386     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5387         AC_CHECK_TOOL(AR,gcc-ar)
5388         AC_CHECK_TOOL(NM,gcc-nm)
5389         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5390     else
5391         AC_CHECK_TOOL(AR,ar)
5392         AC_CHECK_TOOL(NM,nm)
5393         AC_CHECK_TOOL(RANLIB,ranlib)
5394     fi
5395     AC_CHECK_TOOL(OBJDUMP,objdump)
5396     AC_CHECK_TOOL(READELF,readelf)
5397     AC_CHECK_TOOL(STRIP,strip)
5398     if test "$_os" = "WINNT"; then
5399         AC_CHECK_TOOL(DLLTOOL,dlltool)
5400         AC_CHECK_TOOL(WINDRES,windres)
5401     fi
5403 AC_SUBST(AR)
5404 AC_SUBST(DLLTOOL)
5405 AC_SUBST(NM)
5406 AC_SUBST(OBJDUMP)
5407 AC_SUBST(PKG_CONFIG)
5408 AC_SUBST(RANLIB)
5409 AC_SUBST(READELF)
5410 AC_SUBST(STRIP)
5411 AC_SUBST(WINDRES)
5413 dnl ===================================================================
5414 dnl pkg-config checks on macOS
5415 dnl ===================================================================
5417 if test $_os = Darwin; then
5418     AC_MSG_CHECKING([for bogus pkg-config])
5419     if test -n "$PKG_CONFIG"; then
5420         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5421             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5422         else
5423             if test "$enable_bogus_pkg_config" = "yes"; then
5424                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5425             else
5426                 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.])
5427             fi
5428         fi
5429     else
5430         AC_MSG_RESULT([no, good])
5431     fi
5434 find_csc()
5436     # Return value: $csctest
5438     unset csctest
5440     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5441     if test -n "$regvalue"; then
5442         csctest=$regvalue
5443         return
5444     fi
5447 find_al()
5449     # Return value: $altest
5451     unset altest
5453     # We need this check to detect 4.6.1 or above.
5454     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5455         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5456         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5457             altest=$regvalue
5458             return
5459         fi
5460     done
5462     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5463         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5464         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5465             altest=$regvalue
5466             return
5467         fi
5468     done
5473 find_dotnetsdk46()
5475     unset frametest
5477     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5478         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5479         if test -n "$regvalue"; then
5480             frametest=$regvalue
5481             return
5482         fi
5483     done
5486 find_winsdk_version()
5488     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5489     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5491     unset winsdktest winsdkbinsubdir winsdklibsubdir
5493     case "$1" in
5494     8.0|8.0A)
5495         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5496         if test -n "$regvalue"; then
5497             winsdktest=$regvalue
5498             winsdklibsubdir=win8
5499             return
5500         fi
5501         ;;
5502     8.1|8.1A)
5503         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5504         if test -n "$regvalue"; then
5505             winsdktest=$regvalue
5506             winsdklibsubdir=winv6.3
5507             return
5508         fi
5509         ;;
5510     10.0)
5511         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5512         if test -n "$regvalue"; then
5513             winsdktest=$regvalue
5514             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5515             if test -n "$regvalue"; then
5516                 winsdkbinsubdir="$regvalue".0
5517                 winsdklibsubdir=$winsdkbinsubdir
5518                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5519                 # test exist the SDK path
5520                 if test -d "$tmppath"; then
5521                    # when path is convertible to a short path then path is okay
5522                    cygpath -d "$tmppath" >/dev/null 2>&1
5523                    if test $? -ne 0; then
5524                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5525                    fi
5526                 else
5527                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5528                 fi
5529             fi
5530             return
5531         fi
5532         ;;
5533     esac
5536 find_winsdk()
5538     # Return value: From find_winsdk_version
5540     unset winsdktest
5542     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5543         find_winsdk_version $ver
5544         if test -n "$winsdktest"; then
5545             return
5546         fi
5547     done
5550 find_msms()
5552     AC_MSG_CHECKING([for MSVC merge modules directory])
5553     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5554     case "$VCVER" in
5555         150|160)
5556         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5557         ;;
5558     esac
5559     for f in $my_msm_files; do
5560         echo "$as_me:$LINENO: searching for $f" >&5
5561     done
5563     msmdir=
5564     for ver in 14.0 15.0; do
5565         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5566         if test -n "$regvalue"; then
5567             for f in ${my_msm_files}; do
5568                 if test -e "$regvalue/${f}"; then
5569                     msmdir=$regvalue
5570                     break
5571                 fi
5572             done
5573         fi
5574     done
5575     dnl Is the following fallback really necessary, or was it added in response
5576     dnl to never having started Visual Studio on a given machine, so the
5577     dnl registry keys checked above had presumably not yet been created?
5578     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5579     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5580     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5581     dnl expanding to "C:\Program Files\Common Files"), which would need
5582     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5583     dnl obtain its value from cygwin:
5584     if test -z "$msmdir"; then
5585         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5586         for f in ${my_msm_files}; do
5587             if test -e "$my_msm_dir/${f}"; then
5588                 msmdir=$my_msm_dir
5589             fi
5590         done
5591     fi
5593     dnl Starting from MSVC 15.0, merge modules are located in different directory
5594     case "$VCVER" in
5595     150|160)
5596         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5597             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5598             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5599             for f in ${my_msm_files}; do
5600                 if test -e "$my_msm_dir/${f}"; then
5601                     msmdir=$my_msm_dir
5602                     break
5603                 fi
5604             done
5605         done
5606         ;;
5607     esac
5609     if test -n "$msmdir"; then
5610         msmdir=`cygpath -m "$msmdir"`
5611         AC_MSG_RESULT([$msmdir])
5612     else
5613         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5614             AC_MSG_FAILURE([not found])
5615         else
5616             AC_MSG_WARN([not found (check config.log)])
5617             add_warning "MSM none of ${my_msm_files} found"
5618         fi
5619     fi
5622 find_msvc_x64_dlls()
5624     AC_MSG_CHECKING([for MSVC x64 DLL path])
5625     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5626     case "$VCVER" in
5627     150|160)
5628         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5629             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5630             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5631                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5632                 break
5633             fi
5634             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5635             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5636                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5637                 break
5638             fi
5639             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5640             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5641                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5642                 break
5643             fi
5644         done
5645         ;;
5646     esac
5647     AC_MSG_RESULT([$msvcdllpath])
5648     AC_MSG_CHECKING([for MSVC x64 DLLs])
5649     msvcdlls="msvcp140.dll vcruntime140.dll"
5650     for dll in $msvcdlls; do
5651         if ! test -f "$msvcdllpath/$dll"; then
5652             AC_MSG_FAILURE([missing $dll])
5653         fi
5654     done
5655     AC_MSG_RESULT([found all ($msvcdlls)])
5658 dnl =========================================
5659 dnl Check for the Windows  SDK.
5660 dnl =========================================
5661 if test "$_os" = "WINNT"; then
5662     AC_MSG_CHECKING([for Windows SDK])
5663     if test "$build_os" = "cygwin"; then
5664         find_winsdk
5665         WINDOWS_SDK_HOME=$winsdktest
5667         # normalize if found
5668         if test -n "$WINDOWS_SDK_HOME"; then
5669             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5670             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5671         fi
5673         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5674     fi
5676     if test -n "$WINDOWS_SDK_HOME"; then
5677         # Remove a possible trailing backslash
5678         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5680         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5681              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5682              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5683             have_windows_sdk_headers=yes
5684         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5685              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5686              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5687             have_windows_sdk_headers=yes
5688         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5689              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5690              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5691             have_windows_sdk_headers=yes
5692         else
5693             have_windows_sdk_headers=no
5694         fi
5696         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5697             have_windows_sdk_libs=yes
5698         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5699             have_windows_sdk_libs=yes
5700         else
5701             have_windows_sdk_libs=no
5702         fi
5704         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5705             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5706 the  Windows SDK are installed.])
5707         fi
5708     fi
5710     if test -z "$WINDOWS_SDK_HOME"; then
5711         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5712     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5713         WINDOWS_SDK_VERSION=80
5714         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5715     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5716         WINDOWS_SDK_VERSION=81
5717         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5718     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5719         WINDOWS_SDK_VERSION=10
5720         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5721     else
5722         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5723     fi
5724     PathFormat "$WINDOWS_SDK_HOME"
5725     WINDOWS_SDK_HOME="$formatted_path"
5726     if test "$build_os" = "cygwin"; then
5727         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5728         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5729             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5730         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5731             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5732         fi
5733     fi
5735     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5736     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5737     dnl but not in v8.0), so allow this to be overridden with a
5738     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5739     dnl and configuration error if no WiLangId.vbs is found would arguably be
5740     dnl better, but I do not know under which conditions exactly it is needed by
5741     dnl msiglobal.pm:
5742     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5743         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5744         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5745             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5746         fi
5747         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5748             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5749         fi
5750         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5751             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5752         fi
5753     fi
5754     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5755         if test -n "$with_package_format" -a "$with_package_format" != no; then
5756             for i in "$with_package_format"; do
5757                 if test "$i" = "msi"; then
5758                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5759                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5760                     fi
5761                 fi
5762             done
5763         fi
5764     fi
5766 AC_SUBST(WINDOWS_SDK_HOME)
5767 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5768 AC_SUBST(WINDOWS_SDK_VERSION)
5769 AC_SUBST(WINDOWS_SDK_WILANGID)
5771 if test "$build_os" = "cygwin"; then
5772     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5773     dnl dir, it also determines that dir's path w/o an arch segment if any,
5774     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5775     AC_MSG_CHECKING([for midl.exe])
5777     find_winsdk
5778     if test -n "$winsdkbinsubdir" \
5779         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5780     then
5781         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5782         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5783     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5784         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5785         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5786     elif test -f "$winsdktest/Bin/midl.exe"; then
5787         MIDL_PATH=$winsdktest/Bin
5788         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5789     fi
5790     if test ! -f "$MIDL_PATH/midl.exe"; then
5791         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5792     else
5793         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5794     fi
5796     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5797     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5799     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5800          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5801          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5802          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5803     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5804          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5805          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5806          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5807     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5808          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5809          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5810          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5811     else
5812         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5813     fi
5815     dnl Check csc.exe
5816     AC_MSG_CHECKING([for csc.exe])
5817     find_csc
5818     if test -f "$csctest/csc.exe"; then
5819         CSC_PATH="$csctest"
5820     fi
5821     if test ! -f "$CSC_PATH/csc.exe"; then
5822         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5823     else
5824         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5825     fi
5827     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5829     dnl Check al.exe
5830     AC_MSG_CHECKING([for al.exe])
5831     find_winsdk
5832     if test -n "$winsdkbinsubdir" \
5833         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5834     then
5835         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5836     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5837         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5838     elif test -f "$winsdktest/Bin/al.exe"; then
5839         AL_PATH="$winsdktest/Bin"
5840     fi
5842     if test -z "$AL_PATH"; then
5843         find_al
5844         if test -f "$altest/bin/al.exe"; then
5845             AL_PATH="$altest/bin"
5846         elif test -f "$altest/al.exe"; then
5847             AL_PATH="$altest"
5848         fi
5849     fi
5850     if test ! -f "$AL_PATH/al.exe"; then
5851         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5852     else
5853         AC_MSG_RESULT([$AL_PATH/al.exe])
5854     fi
5856     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5858     dnl Check mscoree.lib / .NET Framework dir
5859     AC_MSG_CHECKING(.NET Framework)
5860     find_dotnetsdk46
5861     PathFormat "$frametest"
5862     frametest="$formatted_path"
5863     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5864         DOTNET_FRAMEWORK_HOME="$frametest"
5865     else
5866         find_winsdk
5867         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5868             DOTNET_FRAMEWORK_HOME="$winsdktest"
5869         fi
5870     fi
5871     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
5872         AC_MSG_ERROR([mscoree.lib not found])
5873     fi
5874     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5876     PathFormat "$MIDL_PATH"
5877     MIDL_PATH="$formatted_path"
5879     PathFormat "$AL_PATH"
5880     AL_PATH="$formatted_path"
5882     PathFormat "$DOTNET_FRAMEWORK_HOME"
5883     DOTNET_FRAMEWORK_HOME="$formatted_path"
5885     PathFormat "$CSC_PATH"
5886     CSC_PATH="$formatted_path"
5889 dnl ===================================================================
5890 dnl Check if stdc headers are available excluding MSVC.
5891 dnl ===================================================================
5892 if test "$_os" != "WINNT"; then
5893     AC_HEADER_STDC
5896 dnl ===================================================================
5897 dnl Testing for C++ compiler and version...
5898 dnl ===================================================================
5900 if test "$_os" != "WINNT"; then
5901     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5902     save_CXXFLAGS=$CXXFLAGS
5903     AC_PROG_CXX
5904     CXXFLAGS=$save_CXXFLAGS
5905     if test -z "$CXX_BASE"; then
5906         CXX_BASE=`first_arg_basename "$CXX"`
5907     fi
5910 dnl check for GNU C++ compiler version
5911 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5912     AC_MSG_CHECKING([the GNU C++ compiler version])
5914     _gpp_version=`$CXX -dumpversion`
5915     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5917     if test "$_gpp_majmin" -lt "700"; then
5918         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5919     else
5920         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5921     fi
5923     dnl see https://code.google.com/p/android/issues/detail?id=41770
5924         glibcxx_threads=no
5925         AC_LANG_PUSH([C++])
5926         AC_REQUIRE_CPP
5927         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5928         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5929             #include <bits/c++config.h>]],[[
5930             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5931             && !defined(_GLIBCXX__PTHREADS) \
5932             && !defined(_GLIBCXX_HAS_GTHREADS)
5933             choke me
5934             #endif
5935         ]])],[AC_MSG_RESULT([yes])
5936         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5937         AC_LANG_POP([C++])
5938         if test $glibcxx_threads = yes; then
5939             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5940         fi
5942 AC_SUBST(BOOST_CXXFLAGS)
5945 # prefx CXX with ccache if needed
5947 if test "$CCACHE" != ""; then
5948     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5949     AC_LANG_PUSH([C++])
5950     save_CXXFLAGS=$CXXFLAGS
5951     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5952     dnl an empty program will do, we're checking the compiler flags
5953     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5954                       [use_ccache=yes], [use_ccache=no])
5955     if test $use_ccache = yes; then
5956         AC_MSG_RESULT([yes])
5957     else
5958         CXX="$CCACHE $CXX"
5959         CXX_BASE="ccache $CXX_BASE"
5960         AC_MSG_RESULT([no])
5961     fi
5962     CXXFLAGS=$save_CXXFLAGS
5963     AC_LANG_POP([C++])
5966 dnl ===================================================================
5967 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5968 dnl ===================================================================
5970 if test "$_os" != "WINNT"; then
5971     AC_PROG_CXXCPP
5973     dnl Check whether there's a C pre-processor.
5974     AC_PROG_CPP
5978 dnl ===================================================================
5979 dnl Find integral type sizes and alignments
5980 dnl ===================================================================
5982 if test "$_os" != "WINNT"; then
5984 if test "$_os" = "iOS"; then
5985     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5986     ac_cv_sizeof_long=8
5987     ac_cv_sizeof_short=2
5988     ac_cv_sizeof_int=4
5989     ac_cv_sizeof_long_long=8
5990     ac_cv_sizeof_double=8
5991     ac_cv_sizeof_voidp=8
5992 else
5993     AC_CHECK_SIZEOF(long)
5994     AC_CHECK_SIZEOF(short)
5995     AC_CHECK_SIZEOF(int)
5996     AC_CHECK_SIZEOF(long long)
5997     AC_CHECK_SIZEOF(double)
5998     AC_CHECK_SIZEOF(void*)
6001     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6002     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6003     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6004     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6005     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6007     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6008     m4_pattern_allow([AC_CHECK_ALIGNOF])
6009     m4_ifdef([AC_CHECK_ALIGNOF],
6010         [
6011             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6012             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6013             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6014             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6015         ],
6016         [
6017             case "$_os-$host_cpu" in
6018             Linux-i686)
6019                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6020                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6021                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6022                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6023                 ;;
6024             Linux-x86_64)
6025                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6026                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6027                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6028                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6029                 ;;
6030             *)
6031                 if test -z "$ac_cv_alignof_short" -o \
6032                         -z "$ac_cv_alignof_int" -o \
6033                         -z "$ac_cv_alignof_long" -o \
6034                         -z "$ac_cv_alignof_double"; then
6035                    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.])
6036                 fi
6037                 ;;
6038             esac
6039         ])
6041     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6042     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6043     if test $ac_cv_sizeof_long -eq 8; then
6044         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6045     elif test $ac_cv_sizeof_double -eq 8; then
6046         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6047     else
6048         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6049     fi
6051     dnl Check for large file support
6052     AC_SYS_LARGEFILE
6053     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6054         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6055     fi
6056     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6057         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6058     fi
6059 else
6060     # Hardcode for MSVC
6061     SAL_TYPES_SIZEOFSHORT=2
6062     SAL_TYPES_SIZEOFINT=4
6063     SAL_TYPES_SIZEOFLONG=4
6064     SAL_TYPES_SIZEOFLONGLONG=8
6065     if test "$BITNESS_OVERRIDE" = ""; then
6066         SAL_TYPES_SIZEOFPOINTER=4
6067     else
6068         SAL_TYPES_SIZEOFPOINTER=8
6069     fi
6070     SAL_TYPES_ALIGNMENT2=2
6071     SAL_TYPES_ALIGNMENT4=4
6072     SAL_TYPES_ALIGNMENT8=8
6073     LFS_CFLAGS=''
6075 AC_SUBST(LFS_CFLAGS)
6077 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6078 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6079 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6080 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6081 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6082 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6083 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6084 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6086 dnl ===================================================================
6087 dnl Check whether to enable runtime optimizations
6088 dnl ===================================================================
6089 ENABLE_RUNTIME_OPTIMIZATIONS=
6090 AC_MSG_CHECKING([whether to enable runtime optimizations])
6091 if test -z "$enable_runtime_optimizations"; then
6092     for i in $CC; do
6093         case $i in
6094         -fsanitize=*)
6095             enable_runtime_optimizations=no
6096             break
6097             ;;
6098         esac
6099     done
6101 if test "$enable_runtime_optimizations" != no; then
6102     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6103     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6104     AC_MSG_RESULT([yes])
6105 else
6106     AC_MSG_RESULT([no])
6108 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6110 dnl ===================================================================
6111 dnl Check if valgrind headers are available
6112 dnl ===================================================================
6113 ENABLE_VALGRIND=
6114 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6115     prev_cppflags=$CPPFLAGS
6116     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6117     # or where does it come from?
6118     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6119     AC_CHECK_HEADER([valgrind/valgrind.h],
6120         [ENABLE_VALGRIND=TRUE])
6121     CPPFLAGS=$prev_cppflags
6123 AC_SUBST([ENABLE_VALGRIND])
6124 if test -z "$ENABLE_VALGRIND"; then
6125     if test "$with_valgrind" = yes; then
6126         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6127     fi
6128     VALGRIND_CFLAGS=
6130 AC_SUBST([VALGRIND_CFLAGS])
6133 dnl ===================================================================
6134 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6135 dnl ===================================================================
6137 # We need at least the sys/sdt.h include header.
6138 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6139 if test "$SDT_H_FOUND" = "TRUE"; then
6140     # Found sys/sdt.h header, now make sure the c++ compiler works.
6141     # Old g++ versions had problems with probes in constructors/destructors.
6142     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6143     AC_LANG_PUSH([C++])
6144     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6145     #include <sys/sdt.h>
6146     class ProbeClass
6147     {
6148     private:
6149       int& ref;
6150       const char *name;
6152     public:
6153       ProbeClass(int& v, const char *n) : ref(v), name(n)
6154       {
6155         DTRACE_PROBE2(_test_, cons, name, ref);
6156       }
6158       void method(int min)
6159       {
6160         DTRACE_PROBE3(_test_, meth, name, ref, min);
6161         ref -= min;
6162       }
6164       ~ProbeClass()
6165       {
6166         DTRACE_PROBE2(_test_, dest, name, ref);
6167       }
6168     };
6169     ]],[[
6170     int i = 64;
6171     DTRACE_PROBE1(_test_, call, i);
6172     ProbeClass inst = ProbeClass(i, "call");
6173     inst.method(24);
6174     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6175           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6176     AC_LANG_POP([C++])
6178 AC_CONFIG_HEADERS([config_host/config_probes.h])
6180 dnl ===================================================================
6181 dnl GCC features
6182 dnl ===================================================================
6183 HAVE_GCC_STACK_CLASH_PROTECTION=
6184 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6185     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6186     save_CFLAGS=$CFLAGS
6187     CFLAGS="$CFLAGS -fstack-clash-protection"
6188     AC_LINK_IFELSE(
6189         [AC_LANG_PROGRAM(, [[return 0;]])],
6190         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6191         [AC_MSG_RESULT([no])])
6192     CFLAGS=$save_CFLAGS
6194     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6195     save_CFLAGS=$CFLAGS
6196     CFLAGS="$CFLAGS -Werror -mno-avx"
6197     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6198     CFLAGS=$save_CFLAGS
6199     if test "$HAVE_GCC_AVX" = "TRUE"; then
6200         AC_MSG_RESULT([yes])
6201     else
6202         AC_MSG_RESULT([no])
6203     fi
6205     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6206     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6207     int v = 0;
6208     if (__sync_add_and_fetch(&v, 1) != 1 ||
6209         __sync_sub_and_fetch(&v, 1) != 0)
6210         return 1;
6211     __sync_synchronize();
6212     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6213         v != 1)
6214         return 1;
6215     return 0;
6216 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6217     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6218         AC_MSG_RESULT([yes])
6219         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6220     else
6221         AC_MSG_RESULT([no])
6222     fi
6224     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6225     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6226     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6227         AC_MSG_RESULT([yes])
6228         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6229     else
6230         AC_MSG_RESULT([no])
6231     fi
6233     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6234     save_CFLAGS=$CFLAGS
6235     CFLAGS="$CFLAGS -Werror"
6236     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6237             __attribute__((deprecated("test"))) void f();
6238         ])], [
6239             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6240             AC_MSG_RESULT([yes])
6241         ], [AC_MSG_RESULT([no])])
6242     CFLAGS=$save_CFLAGS
6244     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6245     AC_LANG_PUSH([C++])
6246     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6247             #include <cstddef>
6248             #include <cxxabi.h>
6249             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6250         ])], [
6251             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6252             AC_MSG_RESULT([yes])
6253         ], [AC_MSG_RESULT([no])])
6254     AC_LANG_POP([C++])
6256     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6257     AC_LANG_PUSH([C++])
6258     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6259             #include <cstddef>
6260             #include <cxxabi.h>
6261             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6262         ])], [
6263             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6264             AC_MSG_RESULT([yes])
6265         ], [AC_MSG_RESULT([no])])
6266     AC_LANG_POP([C++])
6268     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6269     AC_LANG_PUSH([C++])
6270     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6271             #include <cxxabi.h>
6272             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6273         ])], [
6274             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6275             AC_MSG_RESULT([yes])
6276         ], [AC_MSG_RESULT([no])])
6277     AC_LANG_POP([C++])
6279     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6280     AC_LANG_PUSH([C++])
6281     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6282             #include <cstddef>
6283             #include <cxxabi.h>
6284             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6285         ])], [
6286             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6287             AC_MSG_RESULT([yes])
6288         ], [AC_MSG_RESULT([no])])
6289     AC_LANG_POP([C++])
6291     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6292     AC_LANG_PUSH([C++])
6293     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6294             #include <cstddef>
6295             #include <cxxabi.h>
6296             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6297         ])], [
6298             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[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_get_globals 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_get_globals(); }
6308         ])], [
6309             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[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_current_exception_type in cxxabi.h])
6315     AC_LANG_PUSH([C++])
6316     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6317             #include <cxxabi.h>
6318             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6319         ])], [
6320             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6321             AC_MSG_RESULT([yes])
6322         ], [AC_MSG_RESULT([no])])
6323     AC_LANG_POP([C++])
6325     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6326     AC_LANG_PUSH([C++])
6327     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6328             #include <cxxabi.h>
6329             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6330         ])], [
6331             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6332             AC_MSG_RESULT([yes])
6333         ], [AC_MSG_RESULT([no])])
6334     AC_LANG_POP([C++])
6336     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6337     AC_LANG_PUSH([C++])
6338     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6339             #include <cstddef>
6340             #include <cxxabi.h>
6341             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6342         ])], [
6343             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6344             AC_MSG_RESULT([yes])
6345         ], [AC_MSG_RESULT([no])])
6346     AC_LANG_POP([C++])
6348     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6349     AC_LANG_PUSH([C++])
6350     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6351             #include <cstddef>
6352             #include <cxxabi.h>
6353             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6354         ])], [
6355             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6356             AC_MSG_RESULT([yes])
6357         ], [AC_MSG_RESULT([no])])
6358     AC_LANG_POP([C++])
6360     dnl Available in GCC 4.9 and at least since Clang 3.4:
6361     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6362     AC_LANG_PUSH([C++])
6363     save_CXXFLAGS=$CXXFLAGS
6364     CXXFLAGS="$CXXFLAGS -Werror"
6365     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6366             struct __attribute__((warn_unused)) dummy {};
6367         ])], [
6368             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6369             AC_MSG_RESULT([yes])
6370         ], [AC_MSG_RESULT([no])])
6371     CXXFLAGS=$save_CXXFLAGS
6372 AC_LANG_POP([C++])
6375 AC_SUBST(HAVE_GCC_AVX)
6376 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6377 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6378 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6380 dnl ===================================================================
6381 dnl Identify the C++ library
6382 dnl ===================================================================
6384 AC_MSG_CHECKING([what the C++ library is])
6385 AC_LANG_PUSH([C++])
6386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6387 #include <utility>
6388 #ifndef __GLIBCXX__
6389 foo bar
6390 #endif
6391 ]])],
6392     [CPP_LIBRARY=GLIBCXX
6393      cpp_library_name="GNU libstdc++"
6394     ],
6395     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6396 #include <utility>
6397 #ifndef _LIBCPP_VERSION
6398 foo bar
6399 #endif
6400 ]])],
6401     [CPP_LIBRARY=LIBCPP
6402      cpp_library_name="LLVM libc++"
6403      AC_DEFINE([HAVE_LIBCXX])
6404     ],
6405     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6406 #include <utility>
6407 #ifndef _MSC_VER
6408 foo bar
6409 #endif
6410 ]])],
6411     [CPP_LIBRARY=MSVCRT
6412      cpp_library_name="Microsoft"
6413     ],
6414     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6415 AC_MSG_RESULT([$cpp_library_name])
6416 AC_LANG_POP([C++])
6418 dnl ===================================================================
6419 dnl Check for gperf
6420 dnl ===================================================================
6421 AC_PATH_PROG(GPERF, gperf)
6422 if test -z "$GPERF"; then
6423     AC_MSG_ERROR([gperf not found but needed. Install it.])
6425 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6426     GPERF=`cygpath -m $GPERF`
6428 AC_MSG_CHECKING([whether gperf is new enough])
6429 my_gperf_ver1=$($GPERF --version | head -n 1)
6430 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6431 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6432 if test "$my_gperf_ver3" -ge 301; then
6433     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6434 else
6435     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6437 AC_SUBST(GPERF)
6439 dnl ===================================================================
6440 dnl Check for system libcmis
6441 dnl ===================================================================
6442 # libcmis requires curl and we can't build curl for iOS
6443 if test $_os != iOS; then
6444     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6445     ENABLE_LIBCMIS=TRUE
6446 else
6447     ENABLE_LIBCMIS=
6449 AC_SUBST(ENABLE_LIBCMIS)
6451 dnl ===================================================================
6452 dnl C++11
6453 dnl ===================================================================
6455 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6456 CXXFLAGS_CXX11=
6457 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6458     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6459 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6460     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6461     for flag in $my_flags; do
6462         if test "$COM" = MSC; then
6463             flag="-Xclang $flag"
6464         fi
6465         save_CXXFLAGS=$CXXFLAGS
6466         CXXFLAGS="$CXXFLAGS $flag -Werror"
6467         if test "$SYSTEM_LIBCMIS" = TRUE; then
6468             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6469         fi
6470         AC_LANG_PUSH([C++])
6471         dnl Clang 3.9 supports __float128 since
6472         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6473         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6474         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6475         dnl $flag is supported below, so check this first):
6476         my_float128hack=
6477         my_float128hack_impl=-D__float128=void
6478         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6479             #include <vector>
6480             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6481             // (__float128)
6482             ]])
6483         ],,[
6484             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6485             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6486             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6487             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6488             dnl place where __float128 is used is in a template specialization, -D__float128=void
6489             dnl will avoid the problem there while still causing a problem if somebody actually uses
6490             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6491             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6492             dnl "fixed" with this hack):
6493             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6494             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6495                 #include <vector>
6496                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6497                 // (__float128)
6498                 ]])
6499             ],[my_float128hack=$my_float128hack_impl])
6500         ])
6501         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6502             #include <algorithm>
6503             #include <functional>
6504             #include <vector>
6506             #if defined SYSTEM_LIBCMIS
6507             // See ucb/source/ucp/cmis/auth_provider.hxx:
6508             #if !defined __clang__
6509             #pragma GCC diagnostic push
6510             #pragma GCC diagnostic ignored "-Wdeprecated"
6511             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6512             #endif
6513             #include <libcmis/libcmis.hxx>
6514             #if !defined __clang__
6515             #pragma GCC diagnostic pop
6516             #endif
6517             #endif
6519             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6520                 std::sort(v.begin(), v.end(), fn);
6521             }
6522             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6523         AC_LANG_POP([C++])
6524         CXXFLAGS=$save_CXXFLAGS
6525         if test -n "$CXXFLAGS_CXX11"; then
6526             break
6527         fi
6528     done
6530 if test -n "$CXXFLAGS_CXX11"; then
6531     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6532 else
6533     AC_MSG_ERROR(no)
6535 AC_SUBST(CXXFLAGS_CXX11)
6537 if test "$GCC" = "yes"; then
6538     save_CXXFLAGS=$CXXFLAGS
6539     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6540     CHECK_L_ATOMIC
6541     CXXFLAGS=$save_CXXFLAGS
6542     AC_SUBST(ATOMIC_LIB)
6545 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6546 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6547 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6548 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6549 dnl again towards 4.7.2:
6550 if test $CPP_LIBRARY = GLIBCXX; then
6551     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6552     AC_LANG_PUSH([C++])
6553     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6554 #include <list>
6555 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6556     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6557     //   GCC 4.7.0: 20120322
6558     //   GCC 4.7.1: 20120614
6559     // and using a range check is not possible as the mapping between
6560     // __GLIBCXX__ values and GCC versions is not monotonic
6561 /* ok */
6562 #else
6563 abi broken
6564 #endif
6565         ]])], [AC_MSG_RESULT(no, ok)],
6566         [AC_MSG_ERROR(yes)])
6567     AC_LANG_POP([C++])
6570 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6571 save_CXXFLAGS=$CXXFLAGS
6572 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6573 AC_LANG_PUSH([C++])
6575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6576 #include <stddef.h>
6578 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6580 namespace
6582         struct b
6583         {
6584                 int i;
6585                 int j;
6586         };
6588 ]], [[
6589 struct a
6591         int i;
6592         int j;
6594 a thinga[]={{0,0}, {1,1}};
6595 b thingb[]={{0,0}, {1,1}};
6596 size_t i = sizeof(sal_n_array_size(thinga));
6597 size_t j = sizeof(sal_n_array_size(thingb));
6598 return !(i != 0 && j != 0);
6600     ], [ AC_MSG_RESULT(yes) ],
6601     [ AC_MSG_ERROR(no)])
6602 AC_LANG_POP([C++])
6603 CXXFLAGS=$save_CXXFLAGS
6605 dnl _Pragma support (may require C++11)
6606 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6607     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6608     AC_LANG_PUSH([C++])
6609     save_CXXFLAGS=$CXXFLAGS
6610     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6611     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6612             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6613         ])], [
6614             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6615             AC_MSG_RESULT([yes])
6616         ], [AC_MSG_RESULT([no])])
6617     AC_LANG_POP([C++])
6618     CXXFLAGS=$save_CXXFLAGS
6621 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6622 if test "$GCC" = yes; then
6623     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6624     AC_LANG_PUSH([C++])
6625     save_CXXFLAGS=$CXXFLAGS
6626     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6627     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6628     CXXFLAGS=$save_CXXFLAGS
6629     AC_LANG_POP([C++])
6630     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6631         AC_MSG_RESULT([yes])
6632     else
6633         AC_MSG_RESULT([no])
6634     fi
6636 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6638 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6639 AC_LANG_PUSH([C++])
6640 save_CXXFLAGS=$CXXFLAGS
6641 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6642 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6643         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6644         // supporting it:
6645         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6646         struct S {
6647         private:
6648             S(S const &);
6649         public:
6650             S();
6651             ~S();
6652         };
6653         S copy();
6654         void f() { S c(copy()); }
6655         #endif
6656     ])], [
6657         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6658         AC_MSG_RESULT([yes])
6659     ], [AC_MSG_RESULT([no])])
6660 CXXFLAGS=$save_CXXFLAGS
6661 AC_LANG_POP([C++])
6663 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6664 AC_LANG_PUSH([C++])
6665 save_CXXFLAGS=$CXXFLAGS
6666 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6667 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6668         #include <algorithm>
6669         #include <initializer_list>
6670         #include <vector>
6671         template<typename T> class S {
6672         private:
6673             std::vector<T> v_;
6674         public:
6675             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6676         };
6677         constinit S<int> s{3, 2, 1};
6678     ])], [
6679         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6680         AC_MSG_RESULT([yes])
6681     ], [AC_MSG_RESULT([no])])
6682 CXXFLAGS=$save_CXXFLAGS
6683 AC_LANG_POP([C++])
6685 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6686 AC_LANG_PUSH([C++])
6687 save_CXXFLAGS=$CXXFLAGS
6688 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6689 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6690         struct S1 { S1(S1 &&); };
6691         struct S2: S1 {};
6692         S1 f(S2 s) { return s; }
6693     ])], [
6694         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6695         AC_MSG_RESULT([yes])
6696     ], [AC_MSG_RESULT([no])])
6697 CXXFLAGS=$save_CXXFLAGS
6698 AC_LANG_POP([C++])
6700 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6701 dnl uninitialized warning for code like
6703 dnl   OString f();
6704 dnl   boost::optional<OString> * g(bool b) {
6705 dnl       boost::optional<OString> o;
6706 dnl       if (b) o = f();
6707 dnl       return new boost::optional<OString>(o);
6708 dnl   }
6710 dnl (as is e.g. present, in a slightly more elaborate form, in
6711 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6712 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6713 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6714 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6715     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6716     AC_LANG_PUSH([C++])
6717     save_CXXFLAGS=$CXXFLAGS
6718     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6719     if test "$ENABLE_OPTIMIZED" = TRUE; then
6720         CXXFLAGS="$CXXFLAGS -O2"
6721     else
6722         CXXFLAGS="$CXXFLAGS -O0"
6723     fi
6724     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6725             #include <new>
6726             void f1(int);
6727             struct S1 {
6728                 ~S1() { f1(n); }
6729                 int n = 0;
6730             };
6731             struct S2 {
6732                 S2() {}
6733                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6734                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6735                 void set(S1 s) {
6736                     new (stg) S1(s);
6737                     init = true;
6738                 }
6739                 bool init = false;
6740                 char stg[sizeof (S1)];
6741             } ;
6742             S1 f2();
6743             S2 * f3(bool b) {
6744                 S2 o;
6745                 if (b) o.set(f2());
6746                 return new S2(o);
6747             }
6748         ]])], [AC_MSG_RESULT([no])], [
6749             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6750             AC_MSG_RESULT([yes])
6751         ])
6752     CXXFLAGS=$save_CXXFLAGS
6753     AC_LANG_POP([C++])
6755 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6757 dnl ===================================================================
6758 dnl CPU Intrinsics support - SSE, AVX
6759 dnl ===================================================================
6761 INTRINSICS_CXXFLAGS=""
6763 if test "$GCC" = "yes"; then
6764     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6765     AC_LANG_PUSH([C++])
6766     save_CXXFLAGS=$CXXFLAGS
6767     CXXFLAGS="$CXXFLAGS -msse2"
6768     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6769         #include <emmintrin.h>
6770         int main () {
6771             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6772             c = _mm_xor_si128 (a, b);
6773             return 0;
6774         }
6775         ])],
6776         [can_compile_sse2=yes],
6777         [can_compile_sse2=no])
6778     AC_LANG_POP([C++])
6779     CXXFLAGS=$save_CXXFLAGS
6780     AC_MSG_RESULT([${can_compile_sse2}])
6781     if test "${can_compile_sse2}" = "yes" ; then
6782         INTRINSICS_CXXFLAGS="-msse2"
6783     else
6784         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6785     fi
6787     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6788     AC_LANG_PUSH([C++])
6789     save_CXXFLAGS=$CXXFLAGS
6790     CXXFLAGS="$CXXFLAGS -mssse3"
6791     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6792         #include <tmmintrin.h>
6793         int main () {
6794             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6795             c = _mm_maddubs_epi16 (a, b);
6796             return 0;
6797         }
6798         ])],
6799         [can_compile_ssse3=yes],
6800         [can_compile_ssse3=no])
6801     AC_LANG_POP([C++])
6802     CXXFLAGS=$save_CXXFLAGS
6803     AC_MSG_RESULT([${can_compile_ssse3}])
6804     if test "${can_compile_ssse3}" = "yes" ; then
6805         INTRINSICS_CXXFLAGS="-mssse3"
6806     else
6807         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6808     fi
6810     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6811     AC_LANG_PUSH([C++])
6812     save_CXXFLAGS=$CXXFLAGS
6813     CXXFLAGS="$CXXFLAGS -mavx"
6814     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6815         #include <immintrin.h>
6816         int main () {
6817             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6818             c = _mm256_xor_ps(a, b);
6819             return 0;
6820         }
6821         ])],
6822         [can_compile_avx=yes],
6823         [can_compile_avx=no])
6824     AC_LANG_POP([C++])
6825     CXXFLAGS=$save_CXXFLAGS
6826     AC_MSG_RESULT([${can_compile_avx}])
6827     if test "${can_compile_avx}" = "yes" ; then
6828         INTRINSICS_CXXFLAGS="-mavx"
6829     else
6830         AC_MSG_WARN([cannot compile AVX intrinsics])
6831     fi
6833     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6834     AC_LANG_PUSH([C++])
6835     save_CXXFLAGS=$CXXFLAGS
6836     CXXFLAGS="$CXXFLAGS -mavx2"
6837     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6838         #include <immintrin.h>
6839         int main () {
6840             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6841             c = _mm256_maddubs_epi16(a, b);
6842             return 0;
6843         }
6844         ])],
6845         [can_compile_avx2=yes],
6846         [can_compile_avx2=no])
6847     AC_LANG_POP([C++])
6848     CXXFLAGS=$save_CXXFLAGS
6849     AC_MSG_RESULT([${can_compile_avx2}])
6850     if test "${can_compile_avx2}" = "yes" ; then
6851         INTRINSICS_CXXFLAGS="-mavx2"
6852     else
6853         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6854     fi
6857 AC_SUBST([INTRINSICS_CXXFLAGS])
6859 dnl ===================================================================
6860 dnl system stl sanity tests
6861 dnl ===================================================================
6862 if test "$_os" != "WINNT"; then
6864     AC_LANG_PUSH([C++])
6866     save_CPPFLAGS="$CPPFLAGS"
6867     if test -n "$MACOSX_SDK_PATH"; then
6868         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6869     fi
6871     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6872     # only.
6873     if test "$CPP_LIBRARY" = GLIBCXX; then
6874         dnl gcc#19664, gcc#22482, rhbz#162935
6875         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6876         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6877         AC_MSG_RESULT([$stlvisok])
6878         if test "$stlvisok" = "no"; then
6879             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6880         fi
6881     fi
6883     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6884     # when we don't make any dynamic libraries?
6885     if test "$DISABLE_DYNLOADING" = ""; then
6886         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6887         cat > conftestlib1.cc <<_ACEOF
6888 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6889 struct S2: S1<int> { virtual ~S2(); };
6890 S2::~S2() {}
6891 _ACEOF
6892         cat > conftestlib2.cc <<_ACEOF
6893 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6894 struct S2: S1<int> { virtual ~S2(); };
6895 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6896 _ACEOF
6897         gccvisinlineshiddenok=yes
6898         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6899             gccvisinlineshiddenok=no
6900         else
6901             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6902             dnl known to not work with -z defs (unsetting which makes the test
6903             dnl moot, though):
6904             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6905             if test "$COM_IS_CLANG" = TRUE; then
6906                 for i in $CXX $CXXFLAGS; do
6907                     case $i in
6908                     -fsanitize=*)
6909                         my_linkflagsnoundefs=
6910                         break
6911                         ;;
6912                     esac
6913                 done
6914             fi
6915             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6916                 gccvisinlineshiddenok=no
6917             fi
6918         fi
6920         rm -fr libconftest*
6921         AC_MSG_RESULT([$gccvisinlineshiddenok])
6922         if test "$gccvisinlineshiddenok" = "no"; then
6923             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6924         fi
6925     fi
6927    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6928     cat >visibility.cxx <<_ACEOF
6929 #pragma GCC visibility push(hidden)
6930 struct __attribute__ ((visibility ("default"))) TestStruct {
6931   static void Init();
6933 __attribute__ ((visibility ("default"))) void TestFunc() {
6934   TestStruct::Init();
6936 _ACEOF
6937     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6938         gccvisbroken=yes
6939     else
6940         case "$host_cpu" in
6941         i?86|x86_64)
6942             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6943                 gccvisbroken=no
6944             else
6945                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6946                     gccvisbroken=no
6947                 else
6948                     gccvisbroken=yes
6949                 fi
6950             fi
6951             ;;
6952         *)
6953             gccvisbroken=no
6954             ;;
6955         esac
6956     fi
6957     rm -f visibility.s visibility.cxx
6959     AC_MSG_RESULT([$gccvisbroken])
6960     if test "$gccvisbroken" = "yes"; then
6961         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6962     fi
6964     CPPFLAGS="$save_CPPFLAGS"
6966     AC_LANG_POP([C++])
6969 dnl ===================================================================
6970 dnl  Clang++ tests
6971 dnl ===================================================================
6973 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6974 if test "$GCC" = "yes"; then
6975     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6976     AC_LANG_PUSH([C++])
6977     save_CXXFLAGS=$CXXFLAGS
6978     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6979     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6980     CXXFLAGS=$save_CXXFLAGS
6981     AC_LANG_POP([C++])
6982     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6983         AC_MSG_RESULT([yes])
6984     else
6985         AC_MSG_RESULT([no])
6986     fi
6988 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6990 dnl ===================================================================
6991 dnl Compiler plugins
6992 dnl ===================================================================
6994 COMPILER_PLUGINS=
6995 # currently only Clang
6997 if test "$COM_IS_CLANG" != "TRUE"; then
6998     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6999         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7000         enable_compiler_plugins=no
7001     fi
7004 if test "$COM_IS_CLANG" = "TRUE"; then
7005     if test -n "$enable_compiler_plugins"; then
7006         compiler_plugins="$enable_compiler_plugins"
7007     elif test -n "$ENABLE_DBGUTIL"; then
7008         compiler_plugins=test
7009     else
7010         compiler_plugins=no
7011     fi
7012     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7013         if test "$CLANGVER" -lt 50002; then
7014             if test "$compiler_plugins" = yes; then
7015                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7016             else
7017                 compiler_plugins=no
7018             fi
7019         fi
7020     fi
7021     if test "$compiler_plugins" != "no"; then
7022         dnl The prefix where Clang resides, override to where Clang resides if
7023         dnl using a source build:
7024         if test -z "$CLANGDIR"; then
7025             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7026         fi
7027         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7028         if test -z "$COMPILER_PLUGINS_CXX"; then
7029             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7030         fi
7031         clangbindir=$CLANGDIR/bin
7032         if test "$build_os" = "cygwin"; then
7033             clangbindir=$(cygpath -u "$clangbindir")
7034         fi
7035         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7036         if test -n "$LLVM_CONFIG"; then
7037             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7038             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7039             if test -z "$CLANGLIBDIR"; then
7040                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7041             fi
7042             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7043             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7044             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7045             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7046                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7047             fi
7048             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7049             clangobjdir=$($LLVM_CONFIG --obj-root)
7050             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7051                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7052             fi
7053         fi
7054         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7055         AC_LANG_PUSH([C++])
7056         save_CXX=$CXX
7057         save_CXXCPP=$CXXCPP
7058         save_CPPFLAGS=$CPPFLAGS
7059         save_CXXFLAGS=$CXXFLAGS
7060         save_LDFLAGS=$LDFLAGS
7061         save_LIBS=$LIBS
7062         CXX=$COMPILER_PLUGINS_CXX
7063         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7064         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7065         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7066         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7067             [COMPILER_PLUGINS=TRUE],
7068             [
7069             if test "$compiler_plugins" = "yes"; then
7070                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7071             else
7072                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7073                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7074             fi
7075             ])
7076         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7077         dnl comment in compilerplugins/Makefile-clang.mk:
7078         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7079             LDFLAGS=""
7080             AC_MSG_CHECKING([for clang libraries to use])
7081             if test -z "$CLANGTOOLLIBS"; then
7082                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7083  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7084                 AC_LINK_IFELSE([
7085                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7086                         [[ clang::FullSourceLoc().dump(); ]])
7087                 ],[CLANGTOOLLIBS="$LIBS"],[])
7088             fi
7089             if test -z "$CLANGTOOLLIBS"; then
7090                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7091                 AC_LINK_IFELSE([
7092                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7093                         [[ clang::FullSourceLoc().dump(); ]])
7094                 ],[CLANGTOOLLIBS="$LIBS"],[])
7095             fi
7096             AC_MSG_RESULT([$CLANGTOOLLIBS])
7097             if test -z "$CLANGTOOLLIBS"; then
7098                 if test "$compiler_plugins" = "yes"; then
7099                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7100                 else
7101                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7102                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7103                 fi
7104                 COMPILER_PLUGINS=
7105             fi
7106             if test -n "$COMPILER_PLUGINS"; then
7107                 if test -z "$CLANGSYSINCLUDE"; then
7108                     if test -n "$LLVM_CONFIG"; then
7109                         # Path to the clang system headers (no idea if there's a better way to get it).
7110                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7111                     fi
7112                 fi
7113             fi
7114         fi
7115         CXX=$save_CXX
7116         CXXCPP=$save_CXXCPP
7117         CPPFLAGS=$save_CPPFLAGS
7118         CXXFLAGS=$save_CXXFLAGS
7119         LDFLAGS=$save_LDFLAGS
7120         LIBS="$save_LIBS"
7121         AC_LANG_POP([C++])
7122     fi
7123 else
7124     if test "$enable_compiler_plugins" = "yes"; then
7125         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7126     fi
7128 AC_SUBST(COMPILER_PLUGINS)
7129 AC_SUBST(COMPILER_PLUGINS_CXX)
7130 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7131 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7132 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7133 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7134 AC_SUBST(CLANGDIR)
7135 AC_SUBST(CLANGLIBDIR)
7136 AC_SUBST(CLANGTOOLLIBS)
7137 AC_SUBST(CLANGSYSINCLUDE)
7139 # Plugin to help linker.
7140 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7141 # This makes --enable-lto build with clang work.
7142 AC_SUBST(LD_PLUGIN)
7144 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7145 AC_SUBST(HAVE_POSIX_FALLOCATE)
7147 dnl ===================================================================
7148 dnl Custom build version
7149 dnl ===================================================================
7151 AC_MSG_CHECKING([whether to add custom build version])
7152 if test "$with_build_version" != ""; then
7153     BUILD_VER_STRING=$with_build_version
7154     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7155 else
7156     BUILD_VER_STRING=
7157     AC_MSG_RESULT([no])
7159 AC_SUBST(BUILD_VER_STRING)
7161 JITC_PROCESSOR_TYPE=""
7162 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7163     # IBMs JDK needs this...
7164     JITC_PROCESSOR_TYPE=6
7165     export JITC_PROCESSOR_TYPE
7167 AC_SUBST([JITC_PROCESSOR_TYPE])
7169 # Misc Windows Stuff
7170 AC_ARG_WITH(ucrt-dir,
7171     AS_HELP_STRING([--with-ucrt-dir],
7172         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7173         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7174         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7175             Windows6.1-KB2999226-x64.msu
7176             Windows6.1-KB2999226-x86.msu
7177             Windows8.1-KB2999226-x64.msu
7178             Windows8.1-KB2999226-x86.msu
7179             Windows8-RT-KB2999226-x64.msu
7180             Windows8-RT-KB2999226-x86.msu
7181         A zip archive including those files is available from Microsoft site:
7182         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7184 UCRT_REDISTDIR="$with_ucrt_dir"
7185 if test $_os = "WINNT"; then
7186     find_msvc_x64_dlls
7187     find_msms
7188     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7189     MSVC_DLLS="$msvcdlls"
7190     MSM_PATH=`win_short_path_for_make "$msmdir"`
7191     # MSVC 15.3 changed it to VC141
7192     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7193         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7194     else
7195         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7196     fi
7198     if test "$UCRT_REDISTDIR" = "no"; then
7199         dnl explicitly disabled
7200         UCRT_REDISTDIR=""
7201     else
7202         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7203                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7204                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7205                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7206                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7207                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7208             UCRT_REDISTDIR=""
7209             if test -n "$PKGFORMAT"; then
7210                for i in $PKGFORMAT; do
7211                    case "$i" in
7212                    msi)
7213                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7214                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7215                        ;;
7216                    esac
7217                done
7218             fi
7219         fi
7220     fi
7223 AC_SUBST(UCRT_REDISTDIR)
7224 AC_SUBST(MSVC_DLL_PATH)
7225 AC_SUBST(MSVC_DLLS)
7226 AC_SUBST(MSM_PATH)
7228 dnl ===================================================================
7229 dnl Checks for Java
7230 dnl ===================================================================
7231 if test "$ENABLE_JAVA" != ""; then
7233     # Windows-specific tests
7234     if test "$build_os" = "cygwin"; then
7235         if test "$BITNESS_OVERRIDE" = 64; then
7236             bitness=64
7237         else
7238             bitness=32
7239         fi
7241         if test -z "$with_jdk_home"; then
7242             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7243             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7244             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7245             if test -n "$regvalue"; then
7246                 ver=$regvalue
7247                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7248                 _jdk_home=$regvalue
7249             fi
7250             if test -z "$with_jdk_home"; then
7251                 for ver in 1.8; do
7252                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7253                     if test -n "$regvalue"; then
7254                         _jdk_home=$regvalue
7255                         break
7256                     fi
7257                 done
7258             fi
7259             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7260                 with_jdk_home="$_jdk_home"
7261                 howfound="found automatically"
7262             else
7263                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7264             fi
7265         else
7266             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7267             howfound="you passed"
7268         fi
7269     fi
7271     # 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.
7272     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7273     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7274         with_jdk_home=`/usr/libexec/java_home`
7275     fi
7277     JAVA_HOME=; export JAVA_HOME
7278     if test -z "$with_jdk_home"; then
7279         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7280     else
7281         _java_path="$with_jdk_home/bin/$with_java"
7282         dnl Check if there is a Java interpreter at all.
7283         if test -x "$_java_path"; then
7284             JAVAINTERPRETER=$_java_path
7285         else
7286             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7287         fi
7288     fi
7290     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7291     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7292     dnl loaded by java to run JunitTests:
7293     if test "$build_os" = "cygwin"; then
7294         shortjdkhome=`cygpath -d "$with_jdk_home"`
7295         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
7296             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7297             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7298         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
7299             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7300             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7301         fi
7303         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7304             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7305         fi
7306         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7307     elif test "$cross_compiling" != "yes"; then
7308         case $CPUNAME in
7309             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7310                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7311                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7312                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7313                 fi
7314                 ;;
7315             *) # assumption: everything else 32-bit
7316                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7317                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7318                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7319                 fi
7320                 ;;
7321         esac
7322     fi
7325 dnl ===================================================================
7326 dnl Checks for JDK.
7327 dnl ===================================================================
7329 # Note that JAVA_HOME as for now always means the *build* platform's
7330 # JAVA_HOME. Whether all the complexity here actually is needed any
7331 # more or not, no idea.
7333 if test "$ENABLE_JAVA" != ""; then
7334     _gij_longver=0
7335     AC_MSG_CHECKING([the installed JDK])
7336     if test -n "$JAVAINTERPRETER"; then
7337         dnl java -version sends output to stderr!
7338         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7339             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7340         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7341             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7342         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7343             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7344         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7345             JDK=ibm
7347             dnl IBM JDK specific tests
7348             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7349             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7351             if test "$_jdk_ver" -lt 10800; then
7352                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7353             fi
7355             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7357             if test "$with_jdk_home" = ""; then
7358                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7359 you must use the "--with-jdk-home" configure option explicitly])
7360             fi
7362             JAVA_HOME=$with_jdk_home
7363         else
7364             JDK=sun
7366             dnl Sun JDK specific tests
7367             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7368             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7370             if test "$_jdk_ver" -lt 10800; then
7371                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7372             fi
7373             if test "$_jdk_ver" -gt 10800; then
7374                 JAVA_CLASSPATH_NOT_SET=TRUE
7375             fi
7377             AC_MSG_RESULT([found (JDK $_jdk)])
7378             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7379             if test "$_os" = "WINNT"; then
7380                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7381             fi
7383             # set to limit VM usage for JunitTests
7384             JAVAIFLAGS=-Xmx64M
7385             # set to limit VM usage for javac
7386             JAVAFLAGS=-J-Xmx128M
7387         fi
7388     else
7389         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7390     fi
7391 else
7392     dnl Java disabled
7393     JAVA_HOME=
7394     export JAVA_HOME
7397 dnl ===================================================================
7398 dnl Checks for javac
7399 dnl ===================================================================
7400 if test "$ENABLE_JAVA" != ""; then
7401     javacompiler="javac"
7402     : ${JAVA_SOURCE_VER=8}
7403     : ${JAVA_TARGET_VER=8}
7404     if test -z "$with_jdk_home"; then
7405         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7406     else
7407         _javac_path="$with_jdk_home/bin/$javacompiler"
7408         dnl Check if there is a Java compiler at all.
7409         if test -x "$_javac_path"; then
7410             JAVACOMPILER=$_javac_path
7411         fi
7412     fi
7413     if test -z "$JAVACOMPILER"; then
7414         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7415     fi
7416     if test "$build_os" = "cygwin"; then
7417         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7418             JAVACOMPILER="${JAVACOMPILER}.exe"
7419         fi
7420         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7421     fi
7424 dnl ===================================================================
7425 dnl Checks for javadoc
7426 dnl ===================================================================
7427 if test "$ENABLE_JAVA" != ""; then
7428     if test -z "$with_jdk_home"; then
7429         AC_PATH_PROG(JAVADOC, javadoc)
7430     else
7431         _javadoc_path="$with_jdk_home/bin/javadoc"
7432         dnl Check if there is a javadoc at all.
7433         if test -x "$_javadoc_path"; then
7434             JAVADOC=$_javadoc_path
7435         else
7436             AC_PATH_PROG(JAVADOC, javadoc)
7437         fi
7438     fi
7439     if test -z "$JAVADOC"; then
7440         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7441     fi
7442     if test "$build_os" = "cygwin"; then
7443         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7444             JAVADOC="${JAVADOC}.exe"
7445         fi
7446         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7447     fi
7449     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7450     JAVADOCISGJDOC="yes"
7451     fi
7453 AC_SUBST(JAVADOCISGJDOC)
7455 if test "$ENABLE_JAVA" != ""; then
7456     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7457     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7458         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7459            # try to recover first by looking whether we have an alternative
7460            # system as in Debian or newer SuSEs where following /usr/bin/javac
7461            # over /etc/alternatives/javac leads to the right bindir where we
7462            # just need to strip a bit away to get a valid JAVA_HOME
7463            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7464         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7465             # maybe only one level of symlink (e.g. on Mac)
7466             JAVA_HOME=$(readlink $JAVACOMPILER)
7467             if test "$(dirname $JAVA_HOME)" = "."; then
7468                 # we've got no path to trim back
7469                 JAVA_HOME=""
7470             fi
7471         else
7472             # else warn
7473             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7474             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7475             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7476             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7477         fi
7478         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7479         if test "$JAVA_HOME" != "/usr"; then
7480             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7481                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7482                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7483                 dnl Tiger already returns a JDK path...
7484                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7485             else
7486                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7487                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7488                 dnl that checks which version to run
7489                 if test -f "$JAVA_HOME"; then
7490                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7491                 fi
7492             fi
7493         fi
7494     fi
7495     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7497     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7498     if test -z "$JAVA_HOME"; then
7499         if test "x$with_jdk_home" = "x"; then
7500             cat > findhome.java <<_ACEOF
7501 [import java.io.File;
7503 class findhome
7505     public static void main(String args[])
7506     {
7507         String jrelocation = System.getProperty("java.home");
7508         File jre = new File(jrelocation);
7509         System.out.println(jre.getParent());
7510     }
7512 _ACEOF
7513             AC_MSG_CHECKING([if javac works])
7514             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7515             AC_TRY_EVAL(javac_cmd)
7516             if test $? = 0 -a -f ./findhome.class; then
7517                 AC_MSG_RESULT([javac works])
7518             else
7519                 echo "configure: javac test failed" >&5
7520                 cat findhome.java >&5
7521                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7522             fi
7523             AC_MSG_CHECKING([if gij knows its java.home])
7524             JAVA_HOME=`$JAVAINTERPRETER findhome`
7525             if test $? = 0 -a "$JAVA_HOME" != ""; then
7526                 AC_MSG_RESULT([$JAVA_HOME])
7527             else
7528                 echo "configure: java test failed" >&5
7529                 cat findhome.java >&5
7530                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7531             fi
7532             # clean-up after ourselves
7533             rm -f ./findhome.java ./findhome.class
7534         else
7535             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7536         fi
7537     fi
7539     # now check if $JAVA_HOME is really valid
7540     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7541         case "${JAVA_HOME}" in
7542             /Library/Java/JavaVirtualMachines/*)
7543                 ;;
7544             *)
7545                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7546                 ;;
7547         esac
7548         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7549             JAVA_HOME_OK="NO"
7550         fi
7551     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7552         JAVA_HOME_OK="NO"
7553     fi
7554     if test "$JAVA_HOME_OK" = "NO"; then
7555         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7556         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7557         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7558         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7559         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7560         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7561     fi
7562     PathFormat "$JAVA_HOME"
7563     JAVA_HOME="$formatted_path"
7566 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7567     "$_os" != Darwin
7568 then
7569     AC_MSG_CHECKING([for JAWT lib])
7570     if test "$_os" = WINNT; then
7571         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7572         JAWTLIB=jawt.lib
7573     else
7574         case "$host_cpu" in
7575         arm*)
7576             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7577             JAVA_ARCH=$my_java_arch
7578             ;;
7579         i*86)
7580             my_java_arch=i386
7581             ;;
7582         m68k)
7583             my_java_arch=m68k
7584             ;;
7585         powerpc)
7586             my_java_arch=ppc
7587             ;;
7588         powerpc64)
7589             my_java_arch=ppc64
7590             ;;
7591         powerpc64le)
7592             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7593             JAVA_ARCH=$my_java_arch
7594             ;;
7595         sparc64)
7596             my_java_arch=sparcv9
7597             ;;
7598         x86_64)
7599             my_java_arch=amd64
7600             ;;
7601         *)
7602             my_java_arch=$host_cpu
7603             ;;
7604         esac
7605         # This is where JDK9 puts the library
7606         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7607             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7608         else
7609             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7610         fi
7611         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7612     fi
7613     AC_MSG_RESULT([$JAWTLIB])
7615 AC_SUBST(JAWTLIB)
7617 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7618     case "$host_os" in
7620     aix*)
7621         JAVAINC="-I$JAVA_HOME/include"
7622         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7623         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7624         ;;
7626     cygwin*)
7627         JAVAINC="-I$JAVA_HOME/include/win32"
7628         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7629         ;;
7631     darwin*)
7632         if test -d "$JAVA_HOME/include/darwin"; then
7633             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7634         else
7635             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7636         fi
7637         ;;
7639     dragonfly*)
7640         JAVAINC="-I$JAVA_HOME/include"
7641         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7642         ;;
7644     freebsd*)
7645         JAVAINC="-I$JAVA_HOME/include"
7646         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7647         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7648         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7649         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7650         ;;
7652     k*bsd*-gnu*)
7653         JAVAINC="-I$JAVA_HOME/include"
7654         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7655         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7656         ;;
7658     linux-gnu*)
7659         JAVAINC="-I$JAVA_HOME/include"
7660         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7661         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7662         ;;
7664     *netbsd*)
7665         JAVAINC="-I$JAVA_HOME/include"
7666         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7667         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7668        ;;
7670     openbsd*)
7671         JAVAINC="-I$JAVA_HOME/include"
7672         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7673         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7674         ;;
7676     solaris*)
7677         JAVAINC="-I$JAVA_HOME/include"
7678         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7679         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7680         ;;
7681     esac
7683 SOLARINC="$SOLARINC $JAVAINC"
7685 AC_SUBST(JAVACOMPILER)
7686 AC_SUBST(JAVADOC)
7687 AC_SUBST(JAVAINTERPRETER)
7688 AC_SUBST(JAVAIFLAGS)
7689 AC_SUBST(JAVAFLAGS)
7690 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7691 AC_SUBST(JAVA_HOME)
7692 AC_SUBST(JAVA_SOURCE_VER)
7693 AC_SUBST(JAVA_TARGET_VER)
7694 AC_SUBST(JDK)
7697 dnl ===================================================================
7698 dnl Export file validation
7699 dnl ===================================================================
7700 AC_MSG_CHECKING([whether to enable export file validation])
7701 if test "$with_export_validation" != "no"; then
7702     if test -z "$ENABLE_JAVA"; then
7703         if test "$with_export_validation" = "yes"; then
7704             AC_MSG_ERROR([requested, but Java is disabled])
7705         else
7706             AC_MSG_RESULT([no, as Java is disabled])
7707         fi
7708     elif ! test -d "${SRC_ROOT}/schema"; then
7709         if test "$with_export_validation" = "yes"; then
7710             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7711         else
7712             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7713         fi
7714     else
7715         AC_MSG_RESULT([yes])
7716         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7718         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7719         if test -z "$ODFVALIDATOR"; then
7720             # remember to download the ODF toolkit with validator later
7721             AC_MSG_NOTICE([no odfvalidator found, will download it])
7722             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7723             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7725             # and fetch name of odfvalidator jar name from download.lst
7726             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7727             AC_SUBST(ODFVALIDATOR_JAR)
7729             if test -z "$ODFVALIDATOR_JAR"; then
7730                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7731             fi
7732         fi
7733         if test "$build_os" = "cygwin"; then
7734             # In case of Cygwin it will be executed from Windows,
7735             # so we need to run bash and absolute path to validator
7736             # so instead of "odfvalidator" it will be
7737             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7738             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7739         else
7740             ODFVALIDATOR="sh $ODFVALIDATOR"
7741         fi
7742         AC_SUBST(ODFVALIDATOR)
7745         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7746         if test -z "$OFFICEOTRON"; then
7747             # remember to download the officeotron with validator later
7748             AC_MSG_NOTICE([no officeotron found, will download it])
7749             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7750             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7752             # and fetch name of officeotron jar name from download.lst
7753             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7754             AC_SUBST(OFFICEOTRON_JAR)
7756             if test -z "$OFFICEOTRON_JAR"; then
7757                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7758             fi
7759         else
7760             # check version of existing officeotron
7761             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7762             if test 0"$OFFICEOTRON_VER" -lt 704; then
7763                 AC_MSG_ERROR([officeotron too old])
7764             fi
7765         fi
7766         if test "$build_os" = "cygwin"; then
7767             # In case of Cygwin it will be executed from Windows,
7768             # so we need to run bash and absolute path to validator
7769             # so instead of "odfvalidator" it will be
7770             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7771             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7772         else
7773             OFFICEOTRON="sh $OFFICEOTRON"
7774         fi
7775     fi
7776     AC_SUBST(OFFICEOTRON)
7777 else
7778     AC_MSG_RESULT([no])
7781 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7782 if test "$with_bffvalidator" != "no"; then
7783     AC_DEFINE(HAVE_BFFVALIDATOR)
7785     if test "$with_export_validation" = "no"; then
7786         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7787     fi
7789     if test "$with_bffvalidator" = "yes"; then
7790         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7791     else
7792         BFFVALIDATOR="$with_bffvalidator"
7793     fi
7795     if test "$build_os" = "cygwin"; then
7796         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7797             AC_MSG_RESULT($BFFVALIDATOR)
7798         else
7799             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7800         fi
7801     elif test -n "$BFFVALIDATOR"; then
7802         # We are not in Cygwin but need to run Windows binary with wine
7803         AC_PATH_PROGS(WINE, wine)
7805         # so swap in a shell wrapper that converts paths transparently
7806         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7807         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7808         AC_SUBST(BFFVALIDATOR_EXE)
7809         AC_MSG_RESULT($BFFVALIDATOR)
7810     else
7811         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7812     fi
7813     AC_SUBST(BFFVALIDATOR)
7814 else
7815     AC_MSG_RESULT([no])
7818 dnl ===================================================================
7819 dnl Check for C preprocessor to use
7820 dnl ===================================================================
7821 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7822 if test -n "$with_idlc_cpp"; then
7823     AC_MSG_RESULT([$with_idlc_cpp])
7824     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7825 else
7826     AC_MSG_RESULT([ucpp])
7827     AC_MSG_CHECKING([which ucpp tp use])
7828     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7829         AC_MSG_RESULT([external])
7830         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7831     else
7832         AC_MSG_RESULT([internal])
7833         BUILD_TYPE="$BUILD_TYPE UCPP"
7834     fi
7836 AC_SUBST(SYSTEM_UCPP)
7838 dnl ===================================================================
7839 dnl Check for epm (not needed for Windows)
7840 dnl ===================================================================
7841 AC_MSG_CHECKING([whether to enable EPM for packing])
7842 if test "$enable_epm" = "yes"; then
7843     AC_MSG_RESULT([yes])
7844     if test "$_os" != "WINNT"; then
7845         if test $_os = Darwin; then
7846             EPM=internal
7847         elif test -n "$with_epm"; then
7848             EPM=$with_epm
7849         else
7850             AC_PATH_PROG(EPM, epm, no)
7851         fi
7852         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7853             AC_MSG_NOTICE([EPM will be built.])
7854             BUILD_TYPE="$BUILD_TYPE EPM"
7855             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7856         else
7857             # Gentoo has some epm which is something different...
7858             AC_MSG_CHECKING([whether the found epm is the right epm])
7859             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7860                 AC_MSG_RESULT([yes])
7861             else
7862                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7863             fi
7864             AC_MSG_CHECKING([epm version])
7865             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7866             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7867                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7868                 AC_MSG_RESULT([OK, >= 3.7])
7869             else
7870                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7871                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7872             fi
7873         fi
7874     fi
7876     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7877         AC_MSG_CHECKING([for rpm])
7878         for a in "$RPM" rpmbuild rpm; do
7879             $a --usage >/dev/null 2> /dev/null
7880             if test $? -eq 0; then
7881                 RPM=$a
7882                 break
7883             else
7884                 $a --version >/dev/null 2> /dev/null
7885                 if test $? -eq 0; then
7886                     RPM=$a
7887                     break
7888                 fi
7889             fi
7890         done
7891         if test -z "$RPM"; then
7892             AC_MSG_ERROR([not found])
7893         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7894             RPM_PATH=`which $RPM`
7895             AC_MSG_RESULT([$RPM_PATH])
7896             SCPDEFS="$SCPDEFS -DWITH_RPM"
7897         else
7898             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7899         fi
7900     fi
7901     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7902         AC_PATH_PROG(DPKG, dpkg, no)
7903         if test "$DPKG" = "no"; then
7904             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7905         fi
7906     fi
7907     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7908        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7909         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7910             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7911                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7912                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7913                     AC_MSG_RESULT([yes])
7914                 else
7915                     AC_MSG_RESULT([no])
7916                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7917                         _pt="rpm"
7918                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7919                         add_warning "the rpms will need to be installed with --nodeps"
7920                     else
7921                         _pt="pkg"
7922                     fi
7923                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7924                     add_warning "the ${_pt}s will not be relocatable"
7925                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7926                                  relocation will work, you need to patch your epm with the
7927                                  patch in epm/epm-3.7.patch or build with
7928                                  --with-epm=internal which will build a suitable epm])
7929                 fi
7930             fi
7931         fi
7932     fi
7933     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7934         AC_PATH_PROG(PKGMK, pkgmk, no)
7935         if test "$PKGMK" = "no"; then
7936             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7937         fi
7938     fi
7939     AC_SUBST(RPM)
7940     AC_SUBST(DPKG)
7941     AC_SUBST(PKGMK)
7942 else
7943     for i in $PKGFORMAT; do
7944         case "$i" in
7945         aix | bsd | deb | pkg | rpm | native | portable)
7946             AC_MSG_ERROR(
7947                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7948             ;;
7949         esac
7950     done
7951     AC_MSG_RESULT([no])
7952     EPM=NO
7954 AC_SUBST(EPM)
7956 ENABLE_LWP=
7957 if test "$enable_lotuswordpro" = "yes"; then
7958     ENABLE_LWP="TRUE"
7960 AC_SUBST(ENABLE_LWP)
7962 dnl ===================================================================
7963 dnl Check for building ODK
7964 dnl ===================================================================
7965 if test "$enable_odk" = no; then
7966     unset DOXYGEN
7967 else
7968     if test "$with_doxygen" = no; then
7969         AC_MSG_CHECKING([for doxygen])
7970         unset DOXYGEN
7971         AC_MSG_RESULT([no])
7972     else
7973         if test "$with_doxygen" = yes; then
7974             AC_PATH_PROG([DOXYGEN], [doxygen])
7975             if test -z "$DOXYGEN"; then
7976                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7977             fi
7978             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7979                 if ! dot -V 2>/dev/null; then
7980                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7981                 fi
7982             fi
7983         else
7984             AC_MSG_CHECKING([for doxygen])
7985             DOXYGEN=$with_doxygen
7986             AC_MSG_RESULT([$DOXYGEN])
7987         fi
7988         if test -n "$DOXYGEN"; then
7989             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7990             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7991             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7992                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7993             fi
7994         fi
7995     fi
7997 AC_SUBST([DOXYGEN])
7999 AC_MSG_CHECKING([whether to build the ODK])
8000 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8001     AC_MSG_RESULT([yes])
8003     if test "$with_java" != "no"; then
8004         AC_MSG_CHECKING([whether to build unowinreg.dll])
8005         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8006             # build on Win by default
8007             enable_build_unowinreg=yes
8008         fi
8009         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8010             AC_MSG_RESULT([no])
8011             BUILD_UNOWINREG=
8012         else
8013             AC_MSG_RESULT([yes])
8014             BUILD_UNOWINREG=TRUE
8015         fi
8016         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8017             if test -z "$with_mingw_cross_compiler"; then
8018                 dnl Guess...
8019                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8020             elif test -x "$with_mingw_cross_compiler"; then
8021                  MINGWCXX="$with_mingw_cross_compiler"
8022             else
8023                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8024             fi
8026             if test "$MINGWCXX" = "false"; then
8027                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8028             fi
8030             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8031             if test -x "$mingwstrip_test"; then
8032                 MINGWSTRIP="$mingwstrip_test"
8033             else
8034                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8035             fi
8037             if test "$MINGWSTRIP" = "false"; then
8038                 AC_MSG_ERROR(MinGW32 binutils not found.)
8039             fi
8040         fi
8041     fi
8042     BUILD_TYPE="$BUILD_TYPE ODK"
8043 else
8044     AC_MSG_RESULT([no])
8045     BUILD_UNOWINREG=
8047 AC_SUBST(BUILD_UNOWINREG)
8048 AC_SUBST(MINGWCXX)
8049 AC_SUBST(MINGWSTRIP)
8051 dnl ===================================================================
8052 dnl Check for system zlib
8053 dnl ===================================================================
8054 if test "$with_system_zlib" = "auto"; then
8055     case "$_os" in
8056     WINNT)
8057         with_system_zlib="$with_system_libs"
8058         ;;
8059     *)
8060         if test "$enable_fuzzers" != "yes"; then
8061             with_system_zlib=yes
8062         else
8063             with_system_zlib=no
8064         fi
8065         ;;
8066     esac
8069 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8070 dnl and has no pkg-config for it at least on some tinderboxes,
8071 dnl so leaving that out for now
8072 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8073 AC_MSG_CHECKING([which zlib to use])
8074 if test "$with_system_zlib" = "yes"; then
8075     AC_MSG_RESULT([external])
8076     SYSTEM_ZLIB=TRUE
8077     AC_CHECK_HEADER(zlib.h, [],
8078         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8079     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8080         [AC_MSG_ERROR(zlib not found or functional)], [])
8081 else
8082     AC_MSG_RESULT([internal])
8083     SYSTEM_ZLIB=
8084     BUILD_TYPE="$BUILD_TYPE ZLIB"
8085     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8086     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8088 AC_SUBST(ZLIB_CFLAGS)
8089 AC_SUBST(ZLIB_LIBS)
8090 AC_SUBST(SYSTEM_ZLIB)
8092 dnl ===================================================================
8093 dnl Check for system jpeg
8094 dnl ===================================================================
8095 AC_MSG_CHECKING([which libjpeg to use])
8096 if test "$with_system_jpeg" = "yes"; then
8097     AC_MSG_RESULT([external])
8098     SYSTEM_LIBJPEG=TRUE
8099     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8100         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8101     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8102         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8103 else
8104     SYSTEM_LIBJPEG=
8105     AC_MSG_RESULT([internal, libjpeg-turbo])
8106     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8107     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8108     if test "$COM" = "MSC"; then
8109         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8110     else
8111         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8112     fi
8114     case "$host_cpu" in
8115     x86_64 | amd64 | i*86 | x86 | ia32)
8116         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8117         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8118             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8119                 NASM="$LODE_HOME/opt/bin/nasm"
8120             elif test -x "/opt/lo/bin/nasm"; then
8121                 NASM="/opt/lo/bin/nasm"
8122             fi
8123         fi
8125         if test -n "$NASM"; then
8126             AC_MSG_CHECKING([for object file format of host system])
8127             case "$host_os" in
8128               cygwin* | mingw* | pw32* | interix*)
8129                 case "$host_cpu" in
8130                   x86_64)
8131                     objfmt='Win64-COFF'
8132                     ;;
8133                   *)
8134                     objfmt='Win32-COFF'
8135                     ;;
8136                 esac
8137               ;;
8138               msdosdjgpp* | go32*)
8139                 objfmt='COFF'
8140               ;;
8141               os2-emx*) # not tested
8142                 objfmt='MSOMF' # obj
8143               ;;
8144               linux*coff* | linux*oldld*)
8145                 objfmt='COFF' # ???
8146               ;;
8147               linux*aout*)
8148                 objfmt='a.out'
8149               ;;
8150               linux*)
8151                 case "$host_cpu" in
8152                   x86_64)
8153                     objfmt='ELF64'
8154                     ;;
8155                   *)
8156                     objfmt='ELF'
8157                     ;;
8158                 esac
8159               ;;
8160               kfreebsd* | freebsd* | netbsd* | openbsd*)
8161                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8162                   objfmt='BSD-a.out'
8163                 else
8164                   case "$host_cpu" in
8165                     x86_64 | amd64)
8166                       objfmt='ELF64'
8167                       ;;
8168                     *)
8169                       objfmt='ELF'
8170                       ;;
8171                   esac
8172                 fi
8173               ;;
8174               solaris* | sunos* | sysv* | sco*)
8175                 case "$host_cpu" in
8176                   x86_64)
8177                     objfmt='ELF64'
8178                     ;;
8179                   *)
8180                     objfmt='ELF'
8181                     ;;
8182                 esac
8183               ;;
8184               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8185                 case "$host_cpu" in
8186                   x86_64)
8187                     objfmt='Mach-O64'
8188                     ;;
8189                   *)
8190                     objfmt='Mach-O'
8191                     ;;
8192                 esac
8193               ;;
8194               *)
8195                 objfmt='ELF ?'
8196               ;;
8197             esac
8199             AC_MSG_RESULT([$objfmt])
8200             if test "$objfmt" = 'ELF ?'; then
8201               objfmt='ELF'
8202               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8203             fi
8205             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8206             case "$objfmt" in
8207               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8208               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8209               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8210               COFF)       NAFLAGS='-fcoff -DCOFF';;
8211               a.out)      NAFLAGS='-faout -DAOUT';;
8212               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8213               ELF)        NAFLAGS='-felf -DELF';;
8214               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8215               RDF)        NAFLAGS='-frdf -DRDF';;
8216               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8217               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8218             esac
8219             AC_MSG_RESULT([$NAFLAGS])
8221             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8222             cat > conftest.asm << EOF
8223             [%line __oline__ "configure"
8224                     section .text
8225                     global  _main,main
8226             _main:
8227             main:   xor     eax,eax
8228                     ret
8229             ]
8231             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8232             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8233               AC_MSG_RESULT(yes)
8234             else
8235               echo "configure: failed program was:" >&AC_FD_CC
8236               cat conftest.asm >&AC_FD_CC
8237               rm -rf conftest*
8238               AC_MSG_RESULT(no)
8239               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8240               NASM=""
8241             fi
8243         fi
8245         if test -z "$NASM"; then
8246 cat << _EOS
8247 ****************************************************************************
8248 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8249 To get one please:
8251 _EOS
8252             if test "$build_os" = "cygwin"; then
8253 cat << _EOS
8254 install a pre-compiled binary for Win32
8256 mkdir -p /opt/lo/bin
8257 cd /opt/lo/bin
8258 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8259 chmod +x nasm
8261 or get and install one from http://www.nasm.us/
8263 Then re-run autogen.sh
8265 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8266 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8268 _EOS
8269             else
8270 cat << _EOS
8271 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8273 _EOS
8274             fi
8275             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8276             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8277         fi
8278       ;;
8279     esac
8282 AC_SUBST(NASM)
8283 AC_SUBST(LIBJPEG_CFLAGS)
8284 AC_SUBST(LIBJPEG_LIBS)
8285 AC_SUBST(SYSTEM_LIBJPEG)
8287 dnl ===================================================================
8288 dnl Check for system clucene
8289 dnl ===================================================================
8290 dnl we should rather be using
8291 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8292 dnl but the contribs-lib check seems tricky
8293 AC_MSG_CHECKING([which clucene to use])
8294 if test "$with_system_clucene" = "yes"; then
8295     AC_MSG_RESULT([external])
8296     SYSTEM_CLUCENE=TRUE
8297     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8298     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8299     FilterLibs "${CLUCENE_LIBS}"
8300     CLUCENE_LIBS="${filteredlibs}"
8301     AC_LANG_PUSH([C++])
8302     save_CXXFLAGS=$CXXFLAGS
8303     save_CPPFLAGS=$CPPFLAGS
8304     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8305     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8306     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8307     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8308     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8309                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8310     CXXFLAGS=$save_CXXFLAGS
8311     CPPFLAGS=$save_CPPFLAGS
8312     AC_LANG_POP([C++])
8314     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8315 else
8316     AC_MSG_RESULT([internal])
8317     SYSTEM_CLUCENE=
8318     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8320 AC_SUBST(SYSTEM_CLUCENE)
8321 AC_SUBST(CLUCENE_CFLAGS)
8322 AC_SUBST(CLUCENE_LIBS)
8324 dnl ===================================================================
8325 dnl Check for system expat
8326 dnl ===================================================================
8327 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8329 dnl ===================================================================
8330 dnl Check for system xmlsec
8331 dnl ===================================================================
8332 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8334 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8335 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8336     ENABLE_EOT="TRUE"
8337     AC_DEFINE([ENABLE_EOT])
8338     AC_MSG_RESULT([yes])
8340     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8341 else
8342     ENABLE_EOT=
8343     AC_MSG_RESULT([no])
8345 AC_SUBST([ENABLE_EOT])
8347 dnl ===================================================================
8348 dnl Check for DLP libs
8349 dnl ===================================================================
8350 AS_IF([test "$COM" = "MSC"],
8351       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8352       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8354 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8356 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8358 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8360 AS_IF([test "$COM" = "MSC"],
8361       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8362       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8364 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8366 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8368 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8369 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8371 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8373 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8375 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8377 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8378 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8380 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8381 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8383 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8385 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8386 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8388 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8390 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8392 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8394 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8396 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8397 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8399 dnl ===================================================================
8400 dnl Check for system lcms2
8401 dnl ===================================================================
8402 if test "$with_system_lcms2" != "yes"; then
8403     SYSTEM_LCMS2=
8405 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8406 if test "$GCC" = "yes"; then
8407     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8409 if test "$COM" = "MSC"; then # override the above
8410     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8413 dnl ===================================================================
8414 dnl Check for system cppunit
8415 dnl ===================================================================
8416 if test "$_os" != "Android" ; then
8417     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8420 dnl ===================================================================
8421 dnl Check whether freetype is available
8422 dnl ===================================================================
8423 if test  "$test_freetype" = "yes"; then
8424     AC_MSG_CHECKING([whether freetype is available])
8425     # FreeType has 3 different kinds of versions
8426     # * release, like 2.4.10
8427     # * libtool, like 13.0.7 (this what pkg-config returns)
8428     # * soname
8429     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8430     #
8431     # 9.9.3 is 2.2.0
8432     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8433     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8434     FilterLibs "${FREETYPE_LIBS}"
8435     FREETYPE_LIBS="${filteredlibs}"
8436     SYSTEM_FREETYPE=TRUE
8437 else
8438     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8439     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8441 AC_SUBST(FREETYPE_CFLAGS)
8442 AC_SUBST(FREETYPE_LIBS)
8443 AC_SUBST([SYSTEM_FREETYPE])
8445 # ===================================================================
8446 # Check for system libxslt
8447 # to prevent incompatibilities between internal libxml2 and external libxslt,
8448 # or vice versa, use with_system_libxml here
8449 # ===================================================================
8450 if test "$with_system_libxml" = "auto"; then
8451     case "$_os" in
8452     WINNT|iOS|Android)
8453         with_system_libxml="$with_system_libs"
8454         ;;
8455     *)
8456         if test "$enable_fuzzers" != "yes"; then
8457             with_system_libxml=yes
8458         else
8459             with_system_libxml=no
8460         fi
8461         ;;
8462     esac
8465 AC_MSG_CHECKING([which libxslt to use])
8466 if test "$with_system_libxml" = "yes"; then
8467     AC_MSG_RESULT([external])
8468     SYSTEM_LIBXSLT=TRUE
8469     if test "$_os" = "Darwin"; then
8470         dnl make sure to use SDK path
8471         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8472         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8473         dnl omit -L/usr/lib
8474         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8475         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8476     else
8477         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8478         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8479         FilterLibs "${LIBXSLT_LIBS}"
8480         LIBXSLT_LIBS="${filteredlibs}"
8481         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8482         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8483         FilterLibs "${LIBEXSLT_LIBS}"
8484         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8485     fi
8487     dnl Check for xsltproc
8488     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8489     if test "$XSLTPROC" = "no"; then
8490         AC_MSG_ERROR([xsltproc is required])
8491     fi
8492 else
8493     AC_MSG_RESULT([internal])
8494     SYSTEM_LIBXSLT=
8495     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8497     if test "$cross_compiling" = "yes"; then
8498         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8499         if test "$XSLTPROC" = "no"; then
8500             AC_MSG_ERROR([xsltproc is required])
8501         fi
8502     fi
8504 AC_SUBST(SYSTEM_LIBXSLT)
8505 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8506     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8508 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8510 AC_SUBST(LIBEXSLT_CFLAGS)
8511 AC_SUBST(LIBEXSLT_LIBS)
8512 AC_SUBST(LIBXSLT_CFLAGS)
8513 AC_SUBST(LIBXSLT_LIBS)
8514 AC_SUBST(XSLTPROC)
8516 # ===================================================================
8517 # Check for system libxml
8518 # ===================================================================
8519 AC_MSG_CHECKING([which libxml to use])
8520 if test "$with_system_libxml" = "yes"; then
8521     AC_MSG_RESULT([external])
8522     SYSTEM_LIBXML=TRUE
8523     if test "$_os" = "Darwin"; then
8524         dnl make sure to use SDK path
8525         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8526         dnl omit -L/usr/lib
8527         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8528     elif test $_os = iOS; then
8529         dnl make sure to use SDK path
8530         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8531         LIBXML_CFLAGS="-I$usr/include/libxml2"
8532         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8533     else
8534         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8535         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8536         FilterLibs "${LIBXML_LIBS}"
8537         LIBXML_LIBS="${filteredlibs}"
8538     fi
8540     dnl Check for xmllint
8541     AC_PATH_PROG(XMLLINT, xmllint, no)
8542     if test "$XMLLINT" = "no"; then
8543         AC_MSG_ERROR([xmllint is required])
8544     fi
8545 else
8546     AC_MSG_RESULT([internal])
8547     SYSTEM_LIBXML=
8548     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8549     if test "$COM" = "MSC"; then
8550         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8551     fi
8552     if test "$COM" = "MSC"; then
8553         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8554     else
8555         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8556     fi
8557     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8559 AC_SUBST(SYSTEM_LIBXML)
8560 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8561     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8563 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8564 AC_SUBST(LIBXML_CFLAGS)
8565 AC_SUBST(LIBXML_LIBS)
8566 AC_SUBST(XMLLINT)
8568 # =====================================================================
8569 # Checking for a Python interpreter with version >= 2.7.
8570 # Build and runtime requires Python 3 compatible version (>= 2.7).
8571 # Optionally user can pass an option to configure, i. e.
8572 # ./configure PYTHON=/usr/bin/python
8573 # =====================================================================
8574 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8575     if test -n "$PYTHON"; then
8576         PYTHON_FOR_BUILD=$PYTHON
8577     else
8578         # This allows a lack of system python with no error, we use internal one in that case.
8579         AM_PATH_PYTHON([2.7],, [:])
8580         # Clean PYTHON_VERSION checked below if cross-compiling
8581         PYTHON_VERSION=""
8582         if test "$PYTHON" != ":"; then
8583             PYTHON_FOR_BUILD=$PYTHON
8584         fi
8585     fi
8587 AC_SUBST(PYTHON_FOR_BUILD)
8589 # Checks for Python to use for Pyuno
8590 AC_MSG_CHECKING([which Python to use for Pyuno])
8591 case "$enable_python" in
8592 no|disable)
8593     if test -z $PYTHON_FOR_BUILD; then
8594         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8595         # requirement from the choice whether to include Python stuff in the installer, but why
8596         # bother?
8597         AC_MSG_ERROR([Python is required at build time.])
8598     fi
8599     enable_python=no
8600     AC_MSG_RESULT([none])
8601     ;;
8602 ""|yes|auto)
8603     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8604         AC_MSG_RESULT([no, overridden by --disable-scripting])
8605         enable_python=no
8606     elif test $build_os = cygwin; then
8607         dnl When building on Windows we don't attempt to use any installed
8608         dnl "system"  Python.
8609         AC_MSG_RESULT([fully internal])
8610         enable_python=internal
8611     elif test "$cross_compiling" = yes; then
8612         AC_MSG_RESULT([system])
8613         enable_python=system
8614     else
8615         # Unset variables set by the above AM_PATH_PYTHON so that
8616         # we actually do check anew.
8617         AC_MSG_RESULT([])
8618         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
8619         AM_PATH_PYTHON([3.3],, [:])
8620         AC_MSG_CHECKING([which Python to use for Pyuno])
8621         if test "$PYTHON" = ":"; then
8622             if test -z "$PYTHON_FOR_BUILD"; then
8623                 AC_MSG_RESULT([fully internal])
8624             else
8625                 AC_MSG_RESULT([internal])
8626             fi
8627             enable_python=internal
8628         else
8629             AC_MSG_RESULT([system])
8630             enable_python=system
8631         fi
8632     fi
8633     ;;
8634 internal)
8635     AC_MSG_RESULT([internal])
8636     ;;
8637 fully-internal)
8638     AC_MSG_RESULT([fully internal])
8639     enable_python=internal
8640     ;;
8641 system)
8642     AC_MSG_RESULT([system])
8643     if test "$_os" = Darwin; then
8644         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])
8645     fi
8646     ;;
8648     AC_MSG_ERROR([Incorrect --enable-python option])
8649     ;;
8650 esac
8652 if test $enable_python != no; then
8653     BUILD_TYPE="$BUILD_TYPE PYUNO"
8656 if test $enable_python = system; then
8657     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8658         # Fallback: Accept these in the environment, or as set above
8659         # for MacOSX.
8660         :
8661     elif test "$cross_compiling" != yes; then
8662         # Unset variables set by the above AM_PATH_PYTHON so that
8663         # we actually do check anew.
8664         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
8665         # This causes an error if no python command is found
8666         AM_PATH_PYTHON([3.3])
8667         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8668         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8669         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8670         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8671         if test -z "$PKG_CONFIG"; then
8672             PYTHON_CFLAGS="-I$python_include"
8673             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8674         elif $PKG_CONFIG --exists python-$python_version-embed; then
8675             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8676             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8677         elif $PKG_CONFIG --exists python-$python_version; then
8678             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8679             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8680         else
8681             PYTHON_CFLAGS="-I$python_include"
8682             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8683         fi
8684         FilterLibs "${PYTHON_LIBS}"
8685         PYTHON_LIBS="${filteredlibs}"
8686     else
8687         dnl How to find out the cross-compilation Python installation path?
8688         AC_MSG_CHECKING([for python version])
8689         AS_IF([test -n "$PYTHON_VERSION"],
8690               [AC_MSG_RESULT([$PYTHON_VERSION])],
8691               [AC_MSG_RESULT([not found])
8692                AC_MSG_ERROR([no usable python found])])
8693         test -n "$PYTHON_CFLAGS" && break
8694     fi
8696     dnl Check if the headers really work
8697     save_CPPFLAGS="$CPPFLAGS"
8698     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8699     AC_CHECK_HEADER(Python.h)
8700     CPPFLAGS="$save_CPPFLAGS"
8702     # let the PYTHON_FOR_BUILD match the same python installation that
8703     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8704     # better for PythonTests.
8705     PYTHON_FOR_BUILD=$PYTHON
8708 if test "$with_lxml" != no; then
8709     if test -z "$PYTHON_FOR_BUILD"; then
8710         case $build_os in
8711             cygwin)
8712                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8713                 ;;
8714             *)
8715                 if test "$cross_compiling" != yes ; then
8716                     BUILD_TYPE="$BUILD_TYPE LXML"
8717                 fi
8718                 ;;
8719         esac
8720     else
8721         AC_MSG_CHECKING([for python lxml])
8722         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8723             AC_MSG_RESULT([yes])
8724         else
8725             case $build_os in
8726                 cygwin)
8727                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8728                     ;;
8729                 *)
8730                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8731                         BUILD_TYPE="$BUILD_TYPE LXML"
8732                         AC_MSG_RESULT([no, using internal lxml])
8733                     else
8734                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8735                     fi
8736                     ;;
8737             esac
8738         fi
8739     fi
8742 dnl By now enable_python should be "system", "internal" or "no"
8743 case $enable_python in
8744 system)
8745     SYSTEM_PYTHON=TRUE
8747     if test "x$ac_cv_header_Python_h" != "xyes"; then
8748        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8749     fi
8751     AC_LANG_PUSH(C)
8752     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8753     AC_MSG_CHECKING([for correct python library version])
8754        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8755 #include <Python.h>
8757 int main(int argc, char **argv) {
8758    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8759        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8760    else return 1;
8762        ]])],[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])])
8763     CFLAGS=$save_CFLAGS
8764     AC_LANG_POP(C)
8766     dnl FIXME Check if the Python library can be linked with, too?
8767     ;;
8769 internal)
8770     SYSTEM_PYTHON=
8771     PYTHON_VERSION_MAJOR=3
8772     PYTHON_VERSION_MINOR=5
8773     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
8774     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8775         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8776     fi
8777     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8778     BUILD_TYPE="$BUILD_TYPE PYTHON"
8779     # Embedded Python dies without Home set
8780     if test "$HOME" = ""; then
8781         export HOME=""
8782     fi
8783     ;;
8785     DISABLE_PYTHON=TRUE
8786     SYSTEM_PYTHON=
8787     ;;
8789     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8790     ;;
8791 esac
8793 AC_SUBST(DISABLE_PYTHON)
8794 AC_SUBST(SYSTEM_PYTHON)
8795 AC_SUBST(PYTHON_CFLAGS)
8796 AC_SUBST(PYTHON_LIBS)
8797 AC_SUBST(PYTHON_VERSION)
8798 AC_SUBST(PYTHON_VERSION_MAJOR)
8799 AC_SUBST(PYTHON_VERSION_MINOR)
8801 ENABLE_MARIADBC=TRUE
8802 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8803     ENABLE_MARIADBC=
8805 MARIADBC_MAJOR=1
8806 MARIADBC_MINOR=0
8807 MARIADBC_MICRO=2
8808 if test "$ENABLE_MARIADBC" = "TRUE"; then
8809     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8812 AC_SUBST(ENABLE_MARIADBC)
8813 AC_SUBST(MARIADBC_MAJOR)
8814 AC_SUBST(MARIADBC_MINOR)
8815 AC_SUBST(MARIADBC_MICRO)
8817 if test "$ENABLE_MARIADBC" = "TRUE"; then
8818     dnl ===================================================================
8819     dnl Check for system MariaDB
8820     dnl ===================================================================
8821     AC_MSG_CHECKING([which MariaDB to use])
8822     if test "$with_system_mariadb" = "yes"; then
8823         AC_MSG_RESULT([external])
8824         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8825         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8826         if test -z "$MARIADBCONFIG"; then
8827             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8828             if test -z "$MARIADBCONFIG"; then
8829                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8830                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8831             fi
8832         fi
8833         AC_MSG_CHECKING([MariaDB version])
8834         MARIADB_VERSION=`$MARIADBCONFIG --version`
8835         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8836         if test "$MARIADB_MAJOR" -ge "5"; then
8837             AC_MSG_RESULT([OK])
8838         else
8839             AC_MSG_ERROR([too old, use 5.0.x or later])
8840         fi
8841         AC_MSG_CHECKING([for MariaDB Client library])
8842         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8843         if test "$COM_IS_CLANG" = TRUE; then
8844             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8845         fi
8846         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8847         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8848         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8849         dnl linux32:
8850         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8851             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8852             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8853                 | sed -e 's|/lib64/|/lib/|')
8854         fi
8855         FilterLibs "${MARIADB_LIBS}"
8856         MARIADB_LIBS="${filteredlibs}"
8857         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8858         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8859         if test "$enable_bundle_mariadb" = "yes"; then
8860             AC_MSG_RESULT([yes])
8861             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8862             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8864 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8866 /g' | grep -E '(mysqlclient|mariadb)')
8867             if test "$_os" = "Darwin"; then
8868                 LIBMARIADB=${LIBMARIADB}.dylib
8869             elif test "$_os" = "WINNT"; then
8870                 LIBMARIADB=${LIBMARIADB}.dll
8871             else
8872                 LIBMARIADB=${LIBMARIADB}.so
8873             fi
8874             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8875             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8876             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8877                 AC_MSG_RESULT([found.])
8878                 PathFormat "$LIBMARIADB_PATH"
8879                 LIBMARIADB_PATH="$formatted_path"
8880             else
8881                 AC_MSG_ERROR([not found.])
8882             fi
8883         else
8884             AC_MSG_RESULT([no])
8885             BUNDLE_MARIADB_CONNECTOR_C=
8886         fi
8887     else
8888         AC_MSG_RESULT([internal])
8889         SYSTEM_MARIADB_CONNECTOR_C=
8890         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8891         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8892         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8893     fi
8895     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8896     AC_SUBST(MARIADB_CFLAGS)
8897     AC_SUBST(MARIADB_LIBS)
8898     AC_SUBST(LIBMARIADB)
8899     AC_SUBST(LIBMARIADB_PATH)
8900     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8903 dnl ===================================================================
8904 dnl Check for system hsqldb
8905 dnl ===================================================================
8906 if test "$with_java" != "no"; then
8907     HSQLDB_USE_JDBC_4_1=
8908     AC_MSG_CHECKING([which hsqldb to use])
8909     if test "$with_system_hsqldb" = "yes"; then
8910         AC_MSG_RESULT([external])
8911         SYSTEM_HSQLDB=TRUE
8912         if test -z $HSQLDB_JAR; then
8913             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8914         fi
8915         if ! test -f $HSQLDB_JAR; then
8916                AC_MSG_ERROR(hsqldb.jar not found.)
8917         fi
8918         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8919         export HSQLDB_JAR
8920         if $PERL -e \
8921            'use Archive::Zip;
8922             my $file = "$ENV{'HSQLDB_JAR'}";
8923             my $zip = Archive::Zip->new( $file );
8924             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8925             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8926             {
8927                 push @l, split(/\n/, $mf);
8928                 foreach my $line (@l)
8929                 {
8930                     if ($line =~ m/Specification-Version:/)
8931                     {
8932                         ($t, $version) = split (/:/,$line);
8933                         $version =~ s/^\s//;
8934                         ($a, $b, $c, $d) = split (/\./,$version);
8935                         if ($c == "0" && $d > "8")
8936                         {
8937                             exit 0;
8938                         }
8939                         else
8940                         {
8941                             exit 1;
8942                         }
8943                     }
8944                 }
8945             }
8946             else
8947             {
8948                 exit 1;
8949             }'; then
8950             AC_MSG_RESULT([yes])
8951         else
8952             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8953         fi
8954     else
8955         AC_MSG_RESULT([internal])
8956         SYSTEM_HSQLDB=
8957         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8958         NEED_ANT=TRUE
8959         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8960         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8961         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8962             AC_MSG_RESULT([yes])
8963             HSQLDB_USE_JDBC_4_1=TRUE
8964         else
8965             AC_MSG_RESULT([no])
8966         fi
8967     fi
8968     AC_SUBST(SYSTEM_HSQLDB)
8969     AC_SUBST(HSQLDB_JAR)
8970     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8973 dnl ===================================================================
8974 dnl Check for PostgreSQL stuff
8975 dnl ===================================================================
8976 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8977 if test "x$enable_postgresql_sdbc" != "xno"; then
8978     AC_MSG_RESULT([yes])
8979     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8981     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8982         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8983     fi
8984     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8985         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8986     fi
8988     postgres_interface=""
8989     if test "$with_system_postgresql" = "yes"; then
8990         postgres_interface="external PostgreSQL"
8991         SYSTEM_POSTGRESQL=TRUE
8992         if test "$_os" = Darwin; then
8993             supp_path=''
8994             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8995                 pg_supp_path="$P_SEP$d$pg_supp_path"
8996             done
8997         fi
8998         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8999         if test -n "$PGCONFIG"; then
9000             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9001             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9002         else
9003             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9004               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9005               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9006             ],[
9007               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9008             ])
9009         fi
9010         FilterLibs "${POSTGRESQL_LIB}"
9011         POSTGRESQL_LIB="${filteredlibs}"
9012     else
9013         # if/when anything else than PostgreSQL uses Kerberos,
9014         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9015         WITH_KRB5=
9016         WITH_GSSAPI=
9017         case "$_os" in
9018         Darwin)
9019             # macOS has system MIT Kerberos 5 since 10.4
9020             if test "$with_krb5" != "no"; then
9021                 WITH_KRB5=TRUE
9022                 save_LIBS=$LIBS
9023                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9024                 # that the libraries where these functions are located on macOS will change, is it?
9025                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9026                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9027                 KRB5_LIBS=$LIBS
9028                 LIBS=$save_LIBS
9029                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9030                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9031                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9032                 LIBS=$save_LIBS
9033             fi
9034             if test "$with_gssapi" != "no"; then
9035                 WITH_GSSAPI=TRUE
9036                 save_LIBS=$LIBS
9037                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9038                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9039                 GSSAPI_LIBS=$LIBS
9040                 LIBS=$save_LIBS
9041             fi
9042             ;;
9043         WINNT)
9044             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9045                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9046             fi
9047             ;;
9048         Linux|GNU|*BSD|DragonFly)
9049             if test "$with_krb5" != "no"; then
9050                 WITH_KRB5=TRUE
9051                 save_LIBS=$LIBS
9052                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9053                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9054                 KRB5_LIBS=$LIBS
9055                 LIBS=$save_LIBS
9056                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9057                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9058                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9059                 LIBS=$save_LIBS
9060             fi
9061             if test "$with_gssapi" != "no"; then
9062                 WITH_GSSAPI=TRUE
9063                 save_LIBS=$LIBS
9064                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9065                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9066                 GSSAPI_LIBS=$LIBS
9067                 LIBS=$save_LIBS
9068             fi
9069             ;;
9070         *)
9071             if test "$with_krb5" = "yes"; then
9072                 WITH_KRB5=TRUE
9073                 save_LIBS=$LIBS
9074                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9075                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9076                 KRB5_LIBS=$LIBS
9077                 LIBS=$save_LIBS
9078                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9079                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9080                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9081                 LIBS=$save_LIBS
9082             fi
9083             if test "$with_gssapi" = "yes"; then
9084                 WITH_GSSAPI=TRUE
9085                 save_LIBS=$LIBS
9086                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9087                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9088                 LIBS=$save_LIBS
9089                 GSSAPI_LIBS=$LIBS
9090             fi
9091         esac
9093         if test -n "$with_libpq_path"; then
9094             SYSTEM_POSTGRESQL=TRUE
9095             postgres_interface="external libpq"
9096             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9097             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9098         else
9099             SYSTEM_POSTGRESQL=
9100             postgres_interface="internal"
9101             POSTGRESQL_LIB=""
9102             POSTGRESQL_INC="%OVERRIDE_ME%"
9103             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9104         fi
9105     fi
9107     AC_MSG_CHECKING([PostgreSQL C interface])
9108     AC_MSG_RESULT([$postgres_interface])
9110     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9111         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9112         save_CFLAGS=$CFLAGS
9113         save_CPPFLAGS=$CPPFLAGS
9114         save_LIBS=$LIBS
9115         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9116         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9117         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9118         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9119             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9120         CFLAGS=$save_CFLAGS
9121         CPPFLAGS=$save_CPPFLAGS
9122         LIBS=$save_LIBS
9123     fi
9124     BUILD_POSTGRESQL_SDBC=TRUE
9125 else
9126     AC_MSG_RESULT([no])
9128 AC_SUBST(WITH_KRB5)
9129 AC_SUBST(WITH_GSSAPI)
9130 AC_SUBST(GSSAPI_LIBS)
9131 AC_SUBST(KRB5_LIBS)
9132 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9133 AC_SUBST(SYSTEM_POSTGRESQL)
9134 AC_SUBST(POSTGRESQL_INC)
9135 AC_SUBST(POSTGRESQL_LIB)
9137 dnl ===================================================================
9138 dnl Check for Firebird stuff
9139 dnl ===================================================================
9140 ENABLE_FIREBIRD_SDBC=
9141 if test "$enable_firebird_sdbc" = "yes" ; then
9142     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9144     dnl ===================================================================
9145     dnl Check for system Firebird
9146     dnl ===================================================================
9147     AC_MSG_CHECKING([which Firebird to use])
9148     if test "$with_system_firebird" = "yes"; then
9149         AC_MSG_RESULT([external])
9150         SYSTEM_FIREBIRD=TRUE
9151         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9152         if test -z "$FIREBIRDCONFIG"; then
9153             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9154             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9155                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9156             ])
9157             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9158         else
9159             AC_MSG_NOTICE([fb_config found])
9160             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9161             AC_MSG_CHECKING([for Firebird Client library])
9162             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9163             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9164             FilterLibs "${FIREBIRD_LIBS}"
9165             FIREBIRD_LIBS="${filteredlibs}"
9166         fi
9167         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9168         AC_MSG_CHECKING([Firebird version])
9169         if test -n "${FIREBIRD_VERSION}"; then
9170             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9171             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9172             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9173                 AC_MSG_RESULT([OK])
9174             else
9175                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9176             fi
9177         else
9178             __save_CFLAGS="${CFLAGS}"
9179             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9180             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9181 #if defined(FB_API_VER) && FB_API_VER == 30
9182 int fb_api_is_30(void) { return 0; }
9183 #else
9184 #error "Wrong Firebird API version"
9185 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9186             CFLAGS="${__save_CFLAGS}"
9187         fi
9188         ENABLE_FIREBIRD_SDBC=TRUE
9189         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9190     elif test "$enable_database_connectivity" != yes; then
9191         AC_MSG_RESULT([none])
9192     elif test "$cross_compiling" = "yes"; then
9193         AC_MSG_RESULT([none])
9194     else
9195         dnl Embedded Firebird has version 3.0
9196         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9197         dnl We need libatomic_ops for any non X86/X64 system
9198         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9199             dnl ===================================================================
9200             dnl Check for system libatomic_ops
9201             dnl ===================================================================
9202             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9203             if test "$with_system_libatomic_ops" = "yes"; then
9204                 SYSTEM_LIBATOMIC_OPS=TRUE
9205                 AC_CHECK_HEADERS(atomic_ops.h, [],
9206                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9207             else
9208                 SYSTEM_LIBATOMIC_OPS=
9209                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9210                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9211                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9212             fi
9213         fi
9215         AC_MSG_RESULT([internal])
9216         SYSTEM_FIREBIRD=
9217         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9218         FIREBIRD_LIBS="-lfbclient"
9220         if test "$with_system_libtommath" = "yes"; then
9221             SYSTEM_LIBTOMMATH=TRUE
9222             dnl check for tommath presence
9223             save_LIBS=$LIBS
9224             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9225             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9226             LIBS=$save_LIBS
9227         else
9228             SYSTEM_LIBTOMMATH=
9229             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9230             LIBTOMMATH_LIBS="-ltommath"
9231             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9232         fi
9234         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9235         ENABLE_FIREBIRD_SDBC=TRUE
9236         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9237     fi
9239 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9240 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9241 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9242 AC_SUBST(LIBATOMIC_OPS_LIBS)
9243 AC_SUBST(SYSTEM_FIREBIRD)
9244 AC_SUBST(FIREBIRD_CFLAGS)
9245 AC_SUBST(FIREBIRD_LIBS)
9246 AC_SUBST([TOMMATH_CFLAGS])
9247 AC_SUBST([TOMMATH_LIBS])
9249 dnl ===================================================================
9250 dnl Check for system curl
9251 dnl ===================================================================
9252 AC_MSG_CHECKING([which libcurl to use])
9253 if test "$with_system_curl" = "auto"; then
9254     with_system_curl="$with_system_libs"
9257 if test "$with_system_curl" = "yes"; then
9258     AC_MSG_RESULT([external])
9259     SYSTEM_CURL=TRUE
9261     # First try PKGCONFIG and then fall back
9262     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9264     if test -n "$CURL_PKG_ERRORS"; then
9265         AC_PATH_PROG(CURLCONFIG, curl-config)
9266         if test -z "$CURLCONFIG"; then
9267             AC_MSG_ERROR([curl development files not found])
9268         fi
9269         CURL_LIBS=`$CURLCONFIG --libs`
9270         FilterLibs "${CURL_LIBS}"
9271         CURL_LIBS="${filteredlibs}"
9272         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9273         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9275         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9276         case $curl_version in
9277         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9278         dnl so they need to be doubled to end up in the configure script
9279         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9280             AC_MSG_RESULT([yes])
9281             ;;
9282         *)
9283             AC_MSG_ERROR([no, you have $curl_version])
9284             ;;
9285         esac
9286     fi
9288     ENABLE_CURL=TRUE
9289 elif test $_os = iOS; then
9290     # Let's see if we need curl, I think not?
9291     AC_MSG_RESULT([none])
9292     ENABLE_CURL=
9293 else
9294     AC_MSG_RESULT([internal])
9295     SYSTEM_CURL=
9296     BUILD_TYPE="$BUILD_TYPE CURL"
9297     ENABLE_CURL=TRUE
9299 AC_SUBST(SYSTEM_CURL)
9300 AC_SUBST(CURL_CFLAGS)
9301 AC_SUBST(CURL_LIBS)
9302 AC_SUBST(ENABLE_CURL)
9304 dnl ===================================================================
9305 dnl Check for system boost
9306 dnl ===================================================================
9307 AC_MSG_CHECKING([which boost to use])
9308 if test "$with_system_boost" = "yes"; then
9309     AC_MSG_RESULT([external])
9310     SYSTEM_BOOST=TRUE
9311     AX_BOOST_BASE(1.47)
9312     AX_BOOST_DATE_TIME
9313     AX_BOOST_FILESYSTEM
9314     AX_BOOST_IOSTREAMS
9315     AX_BOOST_LOCALE
9316     AC_LANG_PUSH([C++])
9317     save_CXXFLAGS=$CXXFLAGS
9318     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9319     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9320        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9321     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9322        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9323     CXXFLAGS=$save_CXXFLAGS
9324     AC_LANG_POP([C++])
9325     # this is in m4/ax_boost_base.m4
9326     FilterLibs "${BOOST_LDFLAGS}"
9327     BOOST_LDFLAGS="${filteredlibs}"
9328 else
9329     AC_MSG_RESULT([internal])
9330     BUILD_TYPE="$BUILD_TYPE BOOST"
9331     SYSTEM_BOOST=
9332     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9333         # use warning-suppressing wrapper headers
9334         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9335     else
9336         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9337     fi
9339 AC_SUBST(SYSTEM_BOOST)
9341 dnl ===================================================================
9342 dnl Check for system mdds
9343 dnl ===================================================================
9344 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9346 dnl ===================================================================
9347 dnl Check for system glm
9348 dnl ===================================================================
9349 AC_MSG_CHECKING([which glm to use])
9350 if test "$with_system_glm" = "yes"; then
9351     AC_MSG_RESULT([external])
9352     SYSTEM_GLM=TRUE
9353     AC_LANG_PUSH([C++])
9354     AC_CHECK_HEADER([glm/glm.hpp], [],
9355        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9356     AC_LANG_POP([C++])
9357 else
9358     AC_MSG_RESULT([internal])
9359     BUILD_TYPE="$BUILD_TYPE GLM"
9360     SYSTEM_GLM=
9361     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9363 AC_SUBST([GLM_CFLAGS])
9364 AC_SUBST([SYSTEM_GLM])
9366 dnl ===================================================================
9367 dnl Check for system odbc
9368 dnl ===================================================================
9369 AC_MSG_CHECKING([which odbc headers to use])
9370 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
9371     AC_MSG_RESULT([external])
9372     SYSTEM_ODBC_HEADERS=TRUE
9374     if test "$build_os" = "cygwin"; then
9375         save_CPPFLAGS=$CPPFLAGS
9376         find_winsdk
9377         PathFormat "$winsdktest"
9378         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"
9379         AC_CHECK_HEADER(sqlext.h, [],
9380             [AC_MSG_ERROR(odbc not found. install odbc)],
9381             [#include <windows.h>])
9382         CPPFLAGS=$save_CPPFLAGS
9383     else
9384         AC_CHECK_HEADER(sqlext.h, [],
9385             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9386     fi
9387 elif test "$enable_database_connectivity" != yes; then
9388     AC_MSG_RESULT([none])
9389 else
9390     AC_MSG_RESULT([internal])
9391     SYSTEM_ODBC_HEADERS=
9393 AC_SUBST(SYSTEM_ODBC_HEADERS)
9395 dnl ===================================================================
9396 dnl Enable LDAP support
9397 dnl ===================================================================
9399 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9400 AC_MSG_CHECKING([whether to enable LDAP support])
9401     if test "$enable_ldap" != "yes"; then
9402         AC_MSG_RESULT([no])
9403         ENABLE_LDAP=""
9404         enable_ldap=no
9405     else
9406         AC_MSG_RESULT([yes])
9407         ENABLE_LDAP="TRUE"
9408         AC_DEFINE(HAVE_FEATURE_LDAP)
9409     fi
9411 AC_SUBST(ENABLE_LDAP)
9413 dnl ===================================================================
9414 dnl Check for system openldap
9415 dnl ===================================================================
9417 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9418 AC_MSG_CHECKING([which openldap library to use])
9419 if test "$with_system_openldap" = "yes"; then
9420     AC_MSG_RESULT([external])
9421     SYSTEM_OPENLDAP=TRUE
9422     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9423     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9424     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9425 else
9426     AC_MSG_RESULT([internal])
9427     SYSTEM_OPENLDAP=
9428     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9431 AC_SUBST(SYSTEM_OPENLDAP)
9433 dnl ===================================================================
9434 dnl Check for system NSS
9435 dnl ===================================================================
9436 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9437     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9438     AC_DEFINE(HAVE_FEATURE_NSS)
9439     ENABLE_NSS="TRUE"
9440     AC_DEFINE(ENABLE_NSS)
9441 elif test $_os != iOS ; then
9442     with_tls=openssl
9444 AC_SUBST(ENABLE_NSS)
9446 dnl ===================================================================
9447 dnl Check for TLS/SSL and cryptographic implementation to use
9448 dnl ===================================================================
9449 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9450 if test -n "$with_tls"; then
9451     case $with_tls in
9452     openssl)
9453         AC_DEFINE(USE_TLS_OPENSSL)
9454         TLS=OPENSSL
9456         if test "$enable_openssl" != "yes"; then
9457             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9458         fi
9460         # warn that OpenSSL has been selected but not all TLS code has this option
9461         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9462         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9463         ;;
9464     nss)
9465         AC_DEFINE(USE_TLS_NSS)
9466         TLS=NSS
9467         ;;
9468     no)
9469         AC_MSG_WARN([Skipping TLS/SSL])
9470         ;;
9471     *)
9472         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9473 openssl - OpenSSL
9474 nss - Mozilla's Network Security Services (NSS)
9475     ])
9476         ;;
9477     esac
9478 else
9479     # default to using NSS, it results in smaller oox lib
9480     AC_DEFINE(USE_TLS_NSS)
9481     TLS=NSS
9483 AC_MSG_RESULT([$TLS])
9484 AC_SUBST(TLS)
9486 dnl ===================================================================
9487 dnl Check for system sane
9488 dnl ===================================================================
9489 AC_MSG_CHECKING([which sane header to use])
9490 if test "$with_system_sane" = "yes"; then
9491     AC_MSG_RESULT([external])
9492     AC_CHECK_HEADER(sane/sane.h, [],
9493       [AC_MSG_ERROR(sane not found. install sane)], [])
9494 else
9495     AC_MSG_RESULT([internal])
9496     BUILD_TYPE="$BUILD_TYPE SANE"
9499 dnl ===================================================================
9500 dnl Check for system icu
9501 dnl ===================================================================
9502 SYSTEM_GENBRK=
9503 SYSTEM_GENCCODE=
9504 SYSTEM_GENCMN=
9506 ICU_MAJOR=65
9507 ICU_MINOR=1
9508 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9509 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9510 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9511 AC_MSG_CHECKING([which icu to use])
9512 if test "$with_system_icu" = "yes"; then
9513     AC_MSG_RESULT([external])
9514     SYSTEM_ICU=TRUE
9515     AC_LANG_PUSH([C++])
9516     AC_MSG_CHECKING([for unicode/rbbi.h])
9517     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9518     AC_LANG_POP([C++])
9520     if test "$cross_compiling" != "yes"; then
9521         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9522         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9523         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9524         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9525     fi
9527     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9528         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9529         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9530         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9531         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9532         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9533             AC_MSG_RESULT([yes])
9534         else
9535             AC_MSG_RESULT([no])
9536             if test "$with_system_icu_for_build" != "force"; then
9537                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9538 You can use --with-system-icu-for-build=force to use it anyway.])
9539             fi
9540         fi
9541     fi
9543     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9544         # using the system icu tools can lead to version confusion, use the
9545         # ones from the build environment when cross-compiling
9546         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9547         if test -z "$SYSTEM_GENBRK"; then
9548             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9549         fi
9550         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9551         if test -z "$SYSTEM_GENCCODE"; then
9552             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9553         fi
9554         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9555         if test -z "$SYSTEM_GENCMN"; then
9556             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9557         fi
9558         if test "$ICU_MAJOR" -ge "49"; then
9559             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9560             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9561             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9562         else
9563             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9564             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9565             ICU_RECLASSIFIED_HEBREW_LETTER=
9566         fi
9567     fi
9569     if test "$cross_compiling" = "yes"; then
9570         if test "$ICU_MAJOR" -ge "50"; then
9571             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9572             ICU_MINOR=""
9573         fi
9574     fi
9575 else
9576     AC_MSG_RESULT([internal])
9577     SYSTEM_ICU=
9578     BUILD_TYPE="$BUILD_TYPE ICU"
9579     # surprisingly set these only for "internal" (to be used by various other
9580     # external libs): the system icu-config is quite unhelpful and spits out
9581     # dozens of weird flags and also default path -I/usr/include
9582     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9583     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9585 if test "$ICU_MAJOR" -ge "59"; then
9586     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9587     # with -std=c++11 but not all external libraries can be built with that,
9588     # for those use a bit-compatible typedef uint16_t UChar; see
9589     # icu/source/common/unicode/umachine.h
9590     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9591 else
9592     ICU_UCHAR_TYPE=""
9594 AC_SUBST(SYSTEM_ICU)
9595 AC_SUBST(SYSTEM_GENBRK)
9596 AC_SUBST(SYSTEM_GENCCODE)
9597 AC_SUBST(SYSTEM_GENCMN)
9598 AC_SUBST(ICU_MAJOR)
9599 AC_SUBST(ICU_MINOR)
9600 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9601 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9602 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9603 AC_SUBST(ICU_CFLAGS)
9604 AC_SUBST(ICU_LIBS)
9605 AC_SUBST(ICU_UCHAR_TYPE)
9607 dnl ==================================================================
9608 dnl Breakpad
9609 dnl ==================================================================
9610 DEFAULT_CRASHDUMP_VALUE="true"
9611 AC_MSG_CHECKING([whether to enable breakpad])
9612 if test "$enable_breakpad" != yes; then
9613     AC_MSG_RESULT([no])
9614 else
9615     AC_MSG_RESULT([yes])
9616     ENABLE_BREAKPAD="TRUE"
9617     AC_DEFINE(ENABLE_BREAKPAD)
9618     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9619     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9621     AC_MSG_CHECKING([for disable crash dump])
9622     if test "$enable_crashdump" = no; then
9623         DEFAULT_CRASHDUMP_VALUE="false"
9624         AC_MSG_RESULT([yes])
9625     else
9626        AC_MSG_RESULT([no])
9627     fi
9629     AC_MSG_CHECKING([for crashreport config])
9630     if test "$with_symbol_config" = "no"; then
9631         BREAKPAD_SYMBOL_CONFIG="invalid"
9632         AC_MSG_RESULT([no])
9633     else
9634         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9635         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9636         AC_MSG_RESULT([yes])
9637     fi
9638     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9640 AC_SUBST(ENABLE_BREAKPAD)
9641 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9643 dnl ==================================================================
9644 dnl libfuzzer
9645 dnl ==================================================================
9646 AC_MSG_CHECKING([whether to enable fuzzers])
9647 if test "$enable_fuzzers" != yes; then
9648     AC_MSG_RESULT([no])
9649 else
9650     AC_MSG_RESULT([yes])
9651     ENABLE_FUZZERS="TRUE"
9652     AC_DEFINE([ENABLE_FUZZERS],1)
9653     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9655 AC_SUBST(ENABLE_FUZZERS)
9657 dnl ===================================================================
9658 dnl Orcus
9659 dnl ===================================================================
9660 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9661 if test "$with_system_orcus" != "yes"; then
9662     if test "$SYSTEM_BOOST" = "TRUE"; then
9663         # ===========================================================
9664         # Determine if we are going to need to link with Boost.System
9665         # ===========================================================
9666         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9667         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9668         dnl in documentation has no effect.
9669         AC_MSG_CHECKING([if we need to link with Boost.System])
9670         AC_LANG_PUSH([C++])
9671         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9672                 @%:@include <boost/version.hpp>
9673             ]],[[
9674                 #if BOOST_VERSION >= 105000
9675                 #   error yes, we need to link with Boost.System
9676                 #endif
9677             ]])],[
9678                 AC_MSG_RESULT([no])
9679             ],[
9680                 AC_MSG_RESULT([yes])
9681                 AX_BOOST_SYSTEM
9682         ])
9683         AC_LANG_POP([C++])
9684     fi
9686 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9687 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9688 AC_SUBST([BOOST_SYSTEM_LIB])
9689 AC_SUBST(SYSTEM_LIBORCUS)
9691 dnl ===================================================================
9692 dnl HarfBuzz
9693 dnl ===================================================================
9694 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9695                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9696                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9698 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9699                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9700                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9702 if test "$COM" = "MSC"; then # override the above
9703     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9704     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9707 if test "$with_system_harfbuzz" = "yes"; then
9708     if test "$with_system_graphite" = "no"; then
9709         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9710     fi
9711     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9712     _save_libs="$LIBS"
9713     _save_cflags="$CFLAGS"
9714     LIBS="$LIBS $HARFBUZZ_LIBS"
9715     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9716     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9717     LIBS="$_save_libs"
9718     CFLAGS="$_save_cflags"
9719 else
9720     if test "$with_system_graphite" = "yes"; then
9721         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9722     fi
9725 AC_MSG_CHECKING([whether to use X11])
9726 dnl ***************************************
9727 dnl testing for X libraries and includes...
9728 dnl ***************************************
9729 if test "$USING_X11" = TRUE; then
9730     AC_DEFINE(HAVE_FEATURE_X11)
9732 AC_MSG_RESULT([$USING_X11])
9734 if test "$USING_X11" = TRUE; then
9735     AC_PATH_X
9736     AC_PATH_XTRA
9737     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9739     if test -z "$x_includes"; then
9740         x_includes="default_x_includes"
9741     fi
9742     if test -z "$x_libraries"; then
9743         x_libraries="default_x_libraries"
9744     fi
9745     CFLAGS="$CFLAGS $X_CFLAGS"
9746     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9747     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9748 else
9749     x_includes="no_x_includes"
9750     x_libraries="no_x_libraries"
9753 if test "$USING_X11" = TRUE; then
9754     dnl ===================================================================
9755     dnl Check for extension headers
9756     dnl ===================================================================
9757     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9758      [#include <X11/extensions/shape.h>])
9760     # vcl needs ICE and SM
9761     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9762     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9763         [AC_MSG_ERROR(ICE library not found)])
9764     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9765     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9766         [AC_MSG_ERROR(SM library not found)])
9769 dnl ===================================================================
9770 dnl Check for system Xrender
9771 dnl ===================================================================
9772 AC_MSG_CHECKING([whether to use Xrender])
9773 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9774     AC_MSG_RESULT([yes])
9775     PKG_CHECK_MODULES(XRENDER, xrender)
9776     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9777     FilterLibs "${XRENDER_LIBS}"
9778     XRENDER_LIBS="${filteredlibs}"
9779     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9780       [AC_MSG_ERROR(libXrender not found or functional)], [])
9781     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9782       [AC_MSG_ERROR(Xrender not found. install X)], [])
9783 else
9784     AC_MSG_RESULT([no])
9786 AC_SUBST(XRENDER_CFLAGS)
9787 AC_SUBST(XRENDER_LIBS)
9789 dnl ===================================================================
9790 dnl Check for XRandr
9791 dnl ===================================================================
9792 AC_MSG_CHECKING([whether to enable RandR support])
9793 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9794     AC_MSG_RESULT([yes])
9795     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9796     if test "$ENABLE_RANDR" != "TRUE"; then
9797         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9798                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9799         XRANDR_CFLAGS=" "
9800         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9801           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9802         XRANDR_LIBS="-lXrandr "
9803         ENABLE_RANDR="TRUE"
9804     fi
9805     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9806     FilterLibs "${XRANDR_LIBS}"
9807     XRANDR_LIBS="${filteredlibs}"
9808 else
9809     ENABLE_RANDR=""
9810     AC_MSG_RESULT([no])
9812 AC_SUBST(XRANDR_CFLAGS)
9813 AC_SUBST(XRANDR_LIBS)
9814 AC_SUBST(ENABLE_RANDR)
9816 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9817     WITH_WEBDAV="serf"
9819 if test $_os = iOS -o $_os = Android; then
9820     WITH_WEBDAV="no"
9822 AC_MSG_CHECKING([for webdav library])
9823 case "$WITH_WEBDAV" in
9824 serf)
9825     AC_MSG_RESULT([serf])
9826     # Check for system apr-util
9827     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9828                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9829                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9830     if test "$COM" = "MSC"; then
9831         APR_LIB_DIR="LibR"
9832         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9833         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9834     fi
9836     # Check for system serf
9837     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9838                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9839     if test "$COM" = "MSC"; then
9840         SERF_LIB_DIR="Release"
9841         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9842         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9843     fi
9844     ;;
9845 neon)
9846     AC_MSG_RESULT([neon])
9847     # Check for system neon
9848     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9849     if test "$with_system_neon" = "yes"; then
9850         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9851     else
9852         NEON_VERSION=0295
9853     fi
9854     AC_SUBST(NEON_VERSION)
9855     ;;
9857     AC_MSG_RESULT([none, disabled])
9858     WITH_WEBDAV=""
9859     ;;
9860 esac
9861 AC_SUBST(WITH_WEBDAV)
9863 dnl ===================================================================
9864 dnl Check for disabling cve_tests
9865 dnl ===================================================================
9866 AC_MSG_CHECKING([whether to execute CVE tests])
9867 # If not explicitly enabled or disabled, default
9868 if test -z "$enable_cve_tests"; then
9869     case "$OS" in
9870     WNT)
9871         # Default cves off for Windows with its wild and wonderful
9872         # variety of AV software kicking in and panicking
9873         enable_cve_tests=no
9874         ;;
9875     *)
9876         # otherwise yes
9877         enable_cve_tests=yes
9878         ;;
9879     esac
9881 if test "$enable_cve_tests" = "no"; then
9882     AC_MSG_RESULT([no])
9883     DISABLE_CVE_TESTS=TRUE
9884     AC_SUBST(DISABLE_CVE_TESTS)
9885 else
9886     AC_MSG_RESULT([yes])
9889 dnl ===================================================================
9890 dnl Check for enabling chart XShape tests
9891 dnl ===================================================================
9892 AC_MSG_CHECKING([whether to execute chart XShape tests])
9893 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9894     AC_MSG_RESULT([yes])
9895     ENABLE_CHART_TESTS=TRUE
9896     AC_SUBST(ENABLE_CHART_TESTS)
9897 else
9898     AC_MSG_RESULT([no])
9901 dnl ===================================================================
9902 dnl Check for system openssl
9903 dnl ===================================================================
9904 DISABLE_OPENSSL=
9905 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9906 if test "$enable_openssl" = "yes"; then
9907     AC_MSG_RESULT([no])
9908     if test "$_os" = Darwin ; then
9909         # OpenSSL is deprecated when building for 10.7 or later.
9910         #
9911         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9912         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9914         with_system_openssl=no
9915         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9916     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9917             && test "$with_system_openssl" != "no"; then
9918         with_system_openssl=yes
9919         SYSTEM_OPENSSL=TRUE
9920         OPENSSL_CFLAGS=
9921         OPENSSL_LIBS="-lssl -lcrypto"
9922     else
9923         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9924     fi
9925     if test "$with_system_openssl" = "yes"; then
9926         AC_MSG_CHECKING([whether openssl supports SHA512])
9927         AC_LANG_PUSH([C])
9928         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9929             SHA512_CTX context;
9930 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9931         AC_LANG_POP(C)
9932     fi
9933 else
9934     AC_MSG_RESULT([yes])
9935     DISABLE_OPENSSL=TRUE
9937     # warn that although OpenSSL is disabled, system libraries may depend on it
9938     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9939     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9942 AC_SUBST([DISABLE_OPENSSL])
9944 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9945     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9946         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9947         enable_cipher_openssl_backend=no
9948     else
9949         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9950     fi
9952 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9953 ENABLE_CIPHER_OPENSSL_BACKEND=
9954 if test "$enable_cipher_openssl_backend" = yes; then
9955     AC_MSG_RESULT([yes])
9956     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9957 else
9958     AC_MSG_RESULT([no])
9960 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9962 dnl ===================================================================
9963 dnl Check for building gnutls
9964 dnl ===================================================================
9965 AC_MSG_CHECKING([whether to use gnutls])
9966 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9967     AC_MSG_RESULT([yes])
9968     AM_PATH_LIBGCRYPT()
9969     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9970         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9971                       available in the system to use as replacement.]]))
9972     FilterLibs "${LIBGCRYPT_LIBS}"
9973     LIBGCRYPT_LIBS="${filteredlibs}"
9974 else
9975     AC_MSG_RESULT([no])
9978 AC_SUBST([LIBGCRYPT_CFLAGS])
9979 AC_SUBST([LIBGCRYPT_LIBS])
9981 dnl ===================================================================
9982 dnl Check for system redland
9983 dnl ===================================================================
9984 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9985 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9986 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9987 if test "$with_system_redland" = "yes"; then
9988     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9989             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9990 else
9991     RAPTOR_MAJOR="0"
9992     RASQAL_MAJOR="3"
9993     REDLAND_MAJOR="0"
9995 AC_SUBST(RAPTOR_MAJOR)
9996 AC_SUBST(RASQAL_MAJOR)
9997 AC_SUBST(REDLAND_MAJOR)
9999 dnl ===================================================================
10000 dnl Check for system hunspell
10001 dnl ===================================================================
10002 AC_MSG_CHECKING([which libhunspell to use])
10003 if test "$with_system_hunspell" = "yes"; then
10004     AC_MSG_RESULT([external])
10005     SYSTEM_HUNSPELL=TRUE
10006     AC_LANG_PUSH([C++])
10007     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10008     if test "$HUNSPELL_PC" != "TRUE"; then
10009         AC_CHECK_HEADER(hunspell.hxx, [],
10010             [
10011             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10012             [AC_MSG_ERROR(hunspell headers not found.)], [])
10013             ], [])
10014         AC_CHECK_LIB([hunspell], [main], [:],
10015            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10016         HUNSPELL_LIBS=-lhunspell
10017     fi
10018     AC_LANG_POP([C++])
10019     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10020     FilterLibs "${HUNSPELL_LIBS}"
10021     HUNSPELL_LIBS="${filteredlibs}"
10022 else
10023     AC_MSG_RESULT([internal])
10024     SYSTEM_HUNSPELL=
10025     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10026     if test "$COM" = "MSC"; then
10027         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10028     else
10029         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10030     fi
10031     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10033 AC_SUBST(SYSTEM_HUNSPELL)
10034 AC_SUBST(HUNSPELL_CFLAGS)
10035 AC_SUBST(HUNSPELL_LIBS)
10037 dnl ===================================================================
10038 dnl Check for system qrcodegen
10039 dnl ===================================================================
10040 AC_MSG_CHECKING([which libqrcodegen to use])
10041 if test "$with_system_qrcodegen" = "yes"; then
10042     AC_MSG_RESULT([external])
10043     SYSTEM_QRCODEGEN=TRUE
10044     AC_LANG_PUSH([C++])
10045     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10046         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10047     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10048         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10049     QRCODEGEN_LIBS=-lqrcodegencpp
10050     AC_LANG_POP([C++])
10051     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10052     FilterLibs "${QRCODEGEN_LIBS}"
10053     QRCODEGEN_LIBS="${filteredlibs}"
10054 else
10055     AC_MSG_RESULT([internal])
10056     SYSTEM_QRCODEGEN=
10057     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10059 AC_SUBST(SYSTEM_QRCODEGEN)
10060 AC_SUBST(QRCODEGEN_CFLAGS)
10061 AC_SUBST(QRCODEGEN_LIBS)
10063 dnl ===================================================================
10064 dnl Checking for altlinuxhyph
10065 dnl ===================================================================
10066 AC_MSG_CHECKING([which altlinuxhyph to use])
10067 if test "$with_system_altlinuxhyph" = "yes"; then
10068     AC_MSG_RESULT([external])
10069     SYSTEM_HYPH=TRUE
10070     AC_CHECK_HEADER(hyphen.h, [],
10071        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10072     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10073        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10074        [#include <hyphen.h>])
10075     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10076         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10077     if test -z "$HYPHEN_LIB"; then
10078         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10079            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10080     fi
10081     if test -z "$HYPHEN_LIB"; then
10082         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10083            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10084     fi
10085 else
10086     AC_MSG_RESULT([internal])
10087     SYSTEM_HYPH=
10088     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10089     if test "$COM" = "MSC"; then
10090         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10091     else
10092         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10093     fi
10095 AC_SUBST(SYSTEM_HYPH)
10096 AC_SUBST(HYPHEN_LIB)
10098 dnl ===================================================================
10099 dnl Checking for mythes
10100 dnl ===================================================================
10101 AC_MSG_CHECKING([which mythes to use])
10102 if test "$with_system_mythes" = "yes"; then
10103     AC_MSG_RESULT([external])
10104     SYSTEM_MYTHES=TRUE
10105     AC_LANG_PUSH([C++])
10106     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10107     if test "$MYTHES_PKGCONFIG" = "no"; then
10108         AC_CHECK_HEADER(mythes.hxx, [],
10109             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10110         AC_CHECK_LIB([mythes-1.2], [main], [:],
10111             [ MYTHES_FOUND=no], [])
10112     if test "$MYTHES_FOUND" = "no"; then
10113         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10114                 [ MYTHES_FOUND=no], [])
10115     fi
10116     if test "$MYTHES_FOUND" = "no"; then
10117         AC_MSG_ERROR([mythes library not found!.])
10118     fi
10119     fi
10120     AC_LANG_POP([C++])
10121     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10122     FilterLibs "${MYTHES_LIBS}"
10123     MYTHES_LIBS="${filteredlibs}"
10124 else
10125     AC_MSG_RESULT([internal])
10126     SYSTEM_MYTHES=
10127     BUILD_TYPE="$BUILD_TYPE MYTHES"
10128     if test "$COM" = "MSC"; then
10129         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10130     else
10131         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10132     fi
10134 AC_SUBST(SYSTEM_MYTHES)
10135 AC_SUBST(MYTHES_CFLAGS)
10136 AC_SUBST(MYTHES_LIBS)
10138 dnl ===================================================================
10139 dnl How should we build the linear programming solver ?
10140 dnl ===================================================================
10142 ENABLE_COINMP=
10143 AC_MSG_CHECKING([whether to build with CoinMP])
10144 if test "$enable_coinmp" != "no"; then
10145     ENABLE_COINMP=TRUE
10146     AC_MSG_RESULT([yes])
10147     if test "$with_system_coinmp" = "yes"; then
10148         SYSTEM_COINMP=TRUE
10149         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10150         FilterLibs "${COINMP_LIBS}"
10151         COINMP_LIBS="${filteredlibs}"
10152     else
10153         BUILD_TYPE="$BUILD_TYPE COINMP"
10154     fi
10155 else
10156     AC_MSG_RESULT([no])
10158 AC_SUBST(ENABLE_COINMP)
10159 AC_SUBST(SYSTEM_COINMP)
10160 AC_SUBST(COINMP_CFLAGS)
10161 AC_SUBST(COINMP_LIBS)
10163 ENABLE_LPSOLVE=
10164 AC_MSG_CHECKING([whether to build with lpsolve])
10165 if test "$enable_lpsolve" != "no"; then
10166     ENABLE_LPSOLVE=TRUE
10167     AC_MSG_RESULT([yes])
10168 else
10169     AC_MSG_RESULT([no])
10171 AC_SUBST(ENABLE_LPSOLVE)
10173 if test "$ENABLE_LPSOLVE" = TRUE; then
10174     AC_MSG_CHECKING([which lpsolve to use])
10175     if test "$with_system_lpsolve" = "yes"; then
10176         AC_MSG_RESULT([external])
10177         SYSTEM_LPSOLVE=TRUE
10178         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10179            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10180         save_LIBS=$LIBS
10181         # some systems need this. Like Ubuntu...
10182         AC_CHECK_LIB(m, floor)
10183         AC_CHECK_LIB(dl, dlopen)
10184         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10185             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10186         LIBS=$save_LIBS
10187     else
10188         AC_MSG_RESULT([internal])
10189         SYSTEM_LPSOLVE=
10190         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10191     fi
10193 AC_SUBST(SYSTEM_LPSOLVE)
10195 dnl ===================================================================
10196 dnl Checking for libexttextcat
10197 dnl ===================================================================
10198 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10199 if test "$with_system_libexttextcat" = "yes"; then
10200     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10202 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10204 dnl ===================================================================
10205 dnl Checking for libnumbertext
10206 dnl ===================================================================
10207 AC_MSG_CHECKING([whether to use libnumbertext])
10208 if test "$enable_libnumbertext" = "no"; then
10209     AC_MSG_RESULT([no])
10210     ENABLE_LIBNUMBERTEXT=
10211     SYSTEM_LIBNUMBERTEXT=
10212 else
10213     AC_MSG_RESULT([yes])
10214     ENABLE_LIBNUMBERTEXT=TRUE
10215     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10216     if test "$with_system_libnumbertext" = "yes"; then
10217         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10218         SYSTEM_LIBNUMBERTEXT=YES
10219     else
10220         SYSTEM_LIBNUMBERTEXT=
10221         AC_LANG_PUSH([C++])
10222         save_CPPFLAGS=$CPPFLAGS
10223         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10224         AC_CHECK_HEADERS([codecvt regex])
10225         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10226                 [ ENABLE_LIBNUMBERTEXT=''
10227                   LIBNUMBERTEXT_CFLAGS=''
10228                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10229                                Enable libnumbertext fallback (missing number to number name conversion).])
10230                 ])
10231         CPPFLAGS=$save_CPPFLAGS
10232         AC_LANG_POP([C++])
10233     fi
10234     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10235         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10236     fi
10238 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10239 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10240 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10241 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10243 dnl ***************************************
10244 dnl testing libc version for Linux...
10245 dnl ***************************************
10246 if test "$_os" = "Linux"; then
10247     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10248     exec 6>/dev/null # no output
10249     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10250     exec 6>&1 # output on again
10251     if test "$HAVE_LIBC"; then
10252         AC_MSG_RESULT([yes])
10253     else
10254         AC_MSG_ERROR([no, upgrade libc])
10255     fi
10258 dnl =========================================
10259 dnl Check for uuidgen
10260 dnl =========================================
10261 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10262     # presence is already tested above in the WINDOWS_SDK_HOME check
10263     UUIDGEN=uuidgen.exe
10264     AC_SUBST(UUIDGEN)
10265 else
10266     AC_PATH_PROG([UUIDGEN], [uuidgen])
10267     if test -z "$UUIDGEN"; then
10268         AC_MSG_WARN([uuid is needed for building installation sets])
10269     fi
10272 dnl ***************************************
10273 dnl Checking for bison and flex
10274 dnl ***************************************
10275 AC_PATH_PROG(BISON, bison)
10276 if test -z "$BISON"; then
10277     AC_MSG_ERROR([no bison found in \$PATH, install it])
10278 else
10279     AC_MSG_CHECKING([the bison version])
10280     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10281     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10282     # Accept newer than 2.0
10283     if test "$_bison_longver" -lt 2000; then
10284         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10285     fi
10288 AC_PATH_PROG(FLEX, flex)
10289 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10290     FLEX=`cygpath -m $FLEX`
10292 if test -z "$FLEX"; then
10293     AC_MSG_ERROR([no flex found in \$PATH, install it])
10294 else
10295     AC_MSG_CHECKING([the flex version])
10296     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10297     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10298         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10299     fi
10301 AC_SUBST([FLEX])
10302 dnl ***************************************
10303 dnl Checking for patch
10304 dnl ***************************************
10305 AC_PATH_PROG(PATCH, patch)
10306 if test -z "$PATCH"; then
10307     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10310 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10311 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10312     if test -z "$with_gnu_patch"; then
10313         GNUPATCH=$PATCH
10314     else
10315         if test -x "$with_gnu_patch"; then
10316             GNUPATCH=$with_gnu_patch
10317         else
10318             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10319         fi
10320     fi
10322     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10323     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10324         AC_MSG_RESULT([yes])
10325     else
10326         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10327     fi
10328 else
10329     GNUPATCH=$PATCH
10332 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10333     GNUPATCH=`cygpath -m $GNUPATCH`
10336 dnl We also need to check for --with-gnu-cp
10338 if test -z "$with_gnu_cp"; then
10339     # check the place where the good stuff is hidden on Solaris...
10340     if test -x /usr/gnu/bin/cp; then
10341         GNUCP=/usr/gnu/bin/cp
10342     else
10343         AC_PATH_PROGS(GNUCP, gnucp cp)
10344     fi
10345     if test -z $GNUCP; then
10346         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10347     fi
10348 else
10349     if test -x "$with_gnu_cp"; then
10350         GNUCP=$with_gnu_cp
10351     else
10352         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10353     fi
10356 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10357     GNUCP=`cygpath -m $GNUCP`
10360 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10361 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10362     AC_MSG_RESULT([yes])
10363 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10364     AC_MSG_RESULT([yes])
10365 else
10366     case "$build_os" in
10367     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10368         x_GNUCP=[\#]
10369         GNUCP=''
10370         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10371         ;;
10372     *)
10373         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10374         ;;
10375     esac
10378 AC_SUBST(GNUPATCH)
10379 AC_SUBST(GNUCP)
10380 AC_SUBST(x_GNUCP)
10382 dnl ***************************************
10383 dnl testing assembler path
10384 dnl ***************************************
10385 ML_EXE=""
10386 if test "$_os" = "WINNT"; then
10387     if test "$BITNESS_OVERRIDE" = ""; then
10388         assembler=ml.exe
10389     else
10390         assembler=ml64.exe
10391     fi
10393     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10394     if test -f "$CL_PATH/$assembler"; then
10395         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10396         AC_MSG_RESULT([$ML_EXE])
10397     else
10398         AC_MSG_ERROR([not found])
10399     fi
10402 AC_SUBST(ML_EXE)
10404 dnl ===================================================================
10405 dnl We need zip and unzip
10406 dnl ===================================================================
10407 AC_PATH_PROG(ZIP, zip)
10408 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10409 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10410     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],,)
10413 AC_PATH_PROG(UNZIP, unzip)
10414 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10416 dnl ===================================================================
10417 dnl Zip must be a specific type for different build types.
10418 dnl ===================================================================
10419 if test $build_os = cygwin; then
10420     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10421         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10422     fi
10425 dnl ===================================================================
10426 dnl We need touch with -h option support.
10427 dnl ===================================================================
10428 AC_PATH_PROG(TOUCH, touch)
10429 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10430 touch warn
10431 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10432     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],,)
10435 dnl ===================================================================
10436 dnl Check for system epoxy
10437 dnl ===================================================================
10438 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10440 dnl ===================================================================
10441 dnl Set vcl option: coordinate device in double or sal_Int32
10442 dnl ===================================================================
10444 dnl disabled for now, we don't want subtle differences between OSs
10445 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10446 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10447 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10448 dnl     AC_MSG_RESULT([double])
10449 dnl else
10450 dnl     AC_MSG_RESULT([sal_Int32])
10451 dnl fi
10453 dnl ===================================================================
10454 dnl Test which vclplugs have to be built.
10455 dnl ===================================================================
10456 R=""
10457 if test "$USING_X11" != TRUE; then
10458     enable_gtk3=no
10460 GTK3_CFLAGS=""
10461 GTK3_LIBS=""
10462 ENABLE_GTK3=""
10463 if test "x$enable_gtk3" = "xyes"; then
10464     if test "$with_system_cairo" = no; then
10465         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10466     fi
10467     : ${with_system_cairo:=yes}
10468     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="")
10469     if test "x$ENABLE_GTK3" = "xTRUE"; then
10470         AC_DEFINE(ENABLE_GTK3)
10471         R="gtk3"
10472     else
10473         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10474     fi
10475     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10476     FilterLibs "${GTK3_LIBS}"
10477     GTK3_LIBS="${filteredlibs}"
10479     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10480     if test "$with_system_epoxy" != "yes"; then
10481         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10482         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10483                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10484     fi
10486 AC_SUBST(GTK3_LIBS)
10487 AC_SUBST(GTK3_CFLAGS)
10488 AC_SUBST(ENABLE_GTK3)
10490 if test "$enable_introspection" = yes; then
10491     if test "$ENABLE_GTK3" = TRUE; then
10492         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10493     else
10494         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10495     fi
10498 ENABLE_QT5=""
10499 if test "x$enable_qt5" = "xyes"; then
10500     ENABLE_QT5="TRUE"
10501     AC_DEFINE(ENABLE_QT5)
10502     R="$R qt5"
10504 AC_SUBST(ENABLE_QT5)
10506 ENABLE_KF5=""
10507 if test "x$enable_kf5" = "xyes"; then
10508     ENABLE_KF5="TRUE"
10509     AC_DEFINE(ENABLE_KF5)
10510     R="$R kf5"
10512 AC_SUBST(ENABLE_KF5)
10514 ENABLE_GTK3_KDE5=""
10515 if test "x$enable_gtk3_kde5" = "xyes"; then
10516     ENABLE_GTK3_KDE5="TRUE"
10517     AC_DEFINE(ENABLE_GTK3_KDE5)
10518     R="$R gtk3_kde5"
10520 AC_SUBST(ENABLE_GTK3_KDE5)
10522 if test "$_os" = "WINNT"; then
10523     R="$R win"
10524 elif test "$_os" = "Darwin"; then
10525     R="$R osx"
10526 elif test "$_os" = "iOS"; then
10527     R="ios (builtin)"
10530 build_vcl_plugins="$R"
10531 if test -z "$build_vcl_plugins"; then
10532     build_vcl_plugins="none"
10534 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10536 dnl ===================================================================
10537 dnl check for dbus support
10538 dnl ===================================================================
10539 ENABLE_DBUS=""
10540 DBUS_CFLAGS=""
10541 DBUS_LIBS=""
10542 DBUS_GLIB_CFLAGS=""
10543 DBUS_GLIB_LIBS=""
10544 DBUS_HAVE_GLIB=""
10546 if test "$enable_dbus" = "no"; then
10547     test_dbus=no
10550 AC_MSG_CHECKING([whether to enable DBUS support])
10551 if test "$test_dbus" = "yes"; then
10552     ENABLE_DBUS="TRUE"
10553     AC_MSG_RESULT([yes])
10554     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10555     AC_DEFINE(ENABLE_DBUS)
10556     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10557     FilterLibs "${DBUS_LIBS}"
10558     DBUS_LIBS="${filteredlibs}"
10560     # Glib is needed for BluetoothServer
10561     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10562     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10563         [
10564             DBUS_HAVE_GLIB="TRUE"
10565             AC_DEFINE(DBUS_HAVE_GLIB,1)
10566         ],
10567         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10568     )
10569 else
10570     AC_MSG_RESULT([no])
10573 AC_SUBST(ENABLE_DBUS)
10574 AC_SUBST(DBUS_CFLAGS)
10575 AC_SUBST(DBUS_LIBS)
10576 AC_SUBST(DBUS_GLIB_CFLAGS)
10577 AC_SUBST(DBUS_GLIB_LIBS)
10578 AC_SUBST(DBUS_HAVE_GLIB)
10580 AC_MSG_CHECKING([whether to enable Impress remote control])
10581 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10582     AC_MSG_RESULT([yes])
10583     ENABLE_SDREMOTE=TRUE
10584     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10586     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10587         # The Bluetooth code doesn't compile with macOS SDK 10.15
10588         enable_sdremote_bluetooth=no
10589     fi
10590     # If not explicitly enabled or disabled, default
10591     if test -z "$enable_sdremote_bluetooth"; then
10592         case "$OS" in
10593         LINUX|MACOSX|WNT)
10594             # Default to yes for these
10595             enable_sdremote_bluetooth=yes
10596             ;;
10597         *)
10598             # otherwise no
10599             enable_sdremote_bluetooth=no
10600             ;;
10601         esac
10602     fi
10603     # $enable_sdremote_bluetooth is guaranteed non-empty now
10605     if test "$enable_sdremote_bluetooth" != "no"; then
10606         if test "$OS" = "LINUX"; then
10607             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10608                 AC_MSG_RESULT([yes])
10609                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10610                 dnl ===================================================================
10611                 dnl Check for system bluez
10612                 dnl ===================================================================
10613                 AC_MSG_CHECKING([which Bluetooth header to use])
10614                 if test "$with_system_bluez" = "yes"; then
10615                     AC_MSG_RESULT([external])
10616                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10617                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10618                     SYSTEM_BLUEZ=TRUE
10619                 else
10620                     AC_MSG_RESULT([internal])
10621                     SYSTEM_BLUEZ=
10622                 fi
10623             else
10624                 AC_MSG_RESULT([no, dbus disabled])
10625                 ENABLE_SDREMOTE_BLUETOOTH=
10626                 SYSTEM_BLUEZ=
10627             fi
10628         else
10629             AC_MSG_RESULT([yes])
10630             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10631             SYSTEM_BLUEZ=
10632         fi
10633     else
10634         AC_MSG_RESULT([no])
10635         ENABLE_SDREMOTE_BLUETOOTH=
10636         SYSTEM_BLUEZ=
10637     fi
10638 else
10639     ENABLE_SDREMOTE=
10640     SYSTEM_BLUEZ=
10641     AC_MSG_RESULT([no])
10643 AC_SUBST(ENABLE_SDREMOTE)
10644 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10645 AC_SUBST(SYSTEM_BLUEZ)
10647 dnl ===================================================================
10648 dnl Check whether to enable GIO support
10649 dnl ===================================================================
10650 if test "$ENABLE_GTK3" = "TRUE"; then
10651     AC_MSG_CHECKING([whether to enable GIO support])
10652     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10653         dnl Need at least 2.26 for the dbus support.
10654         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10655                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10656         if test "$ENABLE_GIO" = "TRUE"; then
10657             AC_DEFINE(ENABLE_GIO)
10658             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10659             FilterLibs "${GIO_LIBS}"
10660             GIO_LIBS="${filteredlibs}"
10661         fi
10662     else
10663         AC_MSG_RESULT([no])
10664     fi
10666 AC_SUBST(ENABLE_GIO)
10667 AC_SUBST(GIO_CFLAGS)
10668 AC_SUBST(GIO_LIBS)
10671 dnl ===================================================================
10673 SPLIT_APP_MODULES=""
10674 if test "$enable_split_app_modules" = "yes"; then
10675     SPLIT_APP_MODULES="TRUE"
10677 AC_SUBST(SPLIT_APP_MODULES)
10679 SPLIT_OPT_FEATURES=""
10680 if test "$enable_split_opt_features" = "yes"; then
10681     SPLIT_OPT_FEATURES="TRUE"
10683 AC_SUBST(SPLIT_OPT_FEATURES)
10685 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10686     if test "$enable_cairo_canvas" = yes; then
10687         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10688     fi
10689     enable_cairo_canvas=no
10690 elif test -z "$enable_cairo_canvas"; then
10691     enable_cairo_canvas=yes
10694 ENABLE_CAIRO_CANVAS=""
10695 if test "$enable_cairo_canvas" = "yes"; then
10696     test_cairo=yes
10697     ENABLE_CAIRO_CANVAS="TRUE"
10698     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10700 AC_SUBST(ENABLE_CAIRO_CANVAS)
10702 dnl ===================================================================
10703 dnl Check whether the GStreamer libraries are available.
10704 dnl ===================================================================
10706 ENABLE_GSTREAMER_1_0=""
10708 if test "$build_gstreamer_1_0" = "yes"; then
10710     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10711     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10712         ENABLE_GSTREAMER_1_0="TRUE"
10713         AC_MSG_RESULT([yes])
10714         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10715         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10716         FilterLibs "${GSTREAMER_1_0_LIBS}"
10717         GSTREAMER_1_0_LIBS="${filteredlibs}"
10718         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10719     else
10720         AC_MSG_RESULT([no])
10721     fi
10723 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10724 AC_SUBST(GSTREAMER_1_0_LIBS)
10725 AC_SUBST(ENABLE_GSTREAMER_1_0)
10727 dnl ===================================================================
10728 dnl Check whether to build the VLC avmedia backend
10729 dnl ===================================================================
10731 ENABLE_VLC=""
10733 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10734 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10735     ENABLE_VLC="TRUE"
10736     AC_MSG_RESULT([yes])
10737 else
10738     AC_MSG_RESULT([no])
10740 AC_SUBST(ENABLE_VLC)
10742 ENABLE_OPENGL_TRANSITIONS=
10743 ENABLE_OPENGL_CANVAS=
10744 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10745    : # disable
10746 elif test "$_os" = "Darwin"; then
10747     # We use frameworks on macOS, no need for detail checks
10748     ENABLE_OPENGL_TRANSITIONS=TRUE
10749     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10750     ENABLE_OPENGL_CANVAS=TRUE
10751 elif test $_os = WINNT; then
10752     ENABLE_OPENGL_TRANSITIONS=TRUE
10753     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10754     ENABLE_OPENGL_CANVAS=TRUE
10755 else
10756     if test "$USING_X11" = TRUE; then
10757         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10758         ENABLE_OPENGL_TRANSITIONS=TRUE
10759         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10760         ENABLE_OPENGL_CANVAS=TRUE
10761     fi
10764 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10765 AC_SUBST(ENABLE_OPENGL_CANVAS)
10767 dnl =================================================
10768 dnl Check whether to build with OpenCL support.
10769 dnl =================================================
10771 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10772     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10773     # platform (optional at run-time, used through clew).
10774     BUILD_TYPE="$BUILD_TYPE OPENCL"
10775     AC_DEFINE(HAVE_FEATURE_OPENCL)
10778 dnl =================================================
10779 dnl Check whether to build with dconf support.
10780 dnl =================================================
10782 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10783     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10784         if test "$enable_dconf" = yes; then
10785             AC_MSG_ERROR([dconf not found])
10786         else
10787             enable_dconf=no
10788         fi])
10790 AC_MSG_CHECKING([whether to enable dconf])
10791 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10792     DCONF_CFLAGS=
10793     DCONF_LIBS=
10794     ENABLE_DCONF=
10795     AC_MSG_RESULT([no])
10796 else
10797     ENABLE_DCONF=TRUE
10798     AC_DEFINE(ENABLE_DCONF)
10799     AC_MSG_RESULT([yes])
10801 AC_SUBST([DCONF_CFLAGS])
10802 AC_SUBST([DCONF_LIBS])
10803 AC_SUBST([ENABLE_DCONF])
10805 # pdf import?
10806 AC_MSG_CHECKING([whether to build the PDF import feature])
10807 ENABLE_PDFIMPORT=
10808 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10809     AC_MSG_RESULT([yes])
10810     ENABLE_PDFIMPORT=TRUE
10811     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10812 else
10813     AC_MSG_RESULT([no])
10816 # Pdfium?
10817 AC_MSG_CHECKING([whether to build PDFium])
10818 ENABLE_PDFIUM=
10819 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10820     AC_MSG_RESULT([yes])
10821     ENABLE_PDFIUM=TRUE
10822     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10823     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10824 else
10825     AC_MSG_RESULT([no])
10827 AC_SUBST(ENABLE_PDFIUM)
10829 dnl ===================================================================
10830 dnl Check for poppler
10831 dnl ===================================================================
10832 ENABLE_POPPLER=
10833 AC_MSG_CHECKING([whether to build Poppler])
10834 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10835     AC_MSG_RESULT([yes])
10836     ENABLE_POPPLER=TRUE
10837     AC_DEFINE(HAVE_FEATURE_POPPLER)
10838 else
10839     AC_MSG_RESULT([no])
10841 AC_SUBST(ENABLE_POPPLER)
10843 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10844     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10847 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10848     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10851 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10852     dnl ===================================================================
10853     dnl Check for system poppler
10854     dnl ===================================================================
10855     AC_MSG_CHECKING([which PDF import poppler to use])
10856     if test "$with_system_poppler" = "yes"; then
10857         AC_MSG_RESULT([external])
10858         SYSTEM_POPPLER=TRUE
10859         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10860         AC_LANG_PUSH([C++])
10861         save_CXXFLAGS=$CXXFLAGS
10862         save_CPPFLAGS=$CPPFLAGS
10863         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10864         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10865         AC_CHECK_HEADER([cpp/poppler-version.h],
10866             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10867             [])
10868         CXXFLAGS=$save_CXXFLAGS
10869         CPPFLAGS=$save_CPPFLAGS
10870         AC_LANG_POP([C++])
10871         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10873         FilterLibs "${POPPLER_LIBS}"
10874         POPPLER_LIBS="${filteredlibs}"
10875     else
10876         AC_MSG_RESULT([internal])
10877         SYSTEM_POPPLER=
10878         BUILD_TYPE="$BUILD_TYPE POPPLER"
10879         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10880     fi
10881     AC_DEFINE([ENABLE_PDFIMPORT],1)
10883 AC_SUBST(ENABLE_PDFIMPORT)
10884 AC_SUBST(SYSTEM_POPPLER)
10885 AC_SUBST(POPPLER_CFLAGS)
10886 AC_SUBST(POPPLER_LIBS)
10888 # Skia?
10889 AC_MSG_CHECKING([whether to build Skia])
10890 ENABLE_SKIA=
10891 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
10892     AC_MSG_RESULT([yes])
10893     ENABLE_SKIA=TRUE
10894     AC_DEFINE(HAVE_FEATURE_SKIA)
10895     BUILD_TYPE="$BUILD_TYPE SKIA"
10896 else
10897     AC_MSG_RESULT([no])
10899 AC_SUBST(ENABLE_SKIA)
10901 SYSTEM_GPGMEPP=
10903 if test "$build_for_ios" = "YES"; then
10904     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10905     AC_MSG_RESULT([yes])
10906 elif test "$enable_mpl_subset" = "yes"; then
10907     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10908     AC_MSG_RESULT([yes])
10909 elif test "$enable_fuzzers" = "yes"; then
10910     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10911     AC_MSG_RESULT([yes])
10912 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10913     dnl ===================================================================
10914     dnl Check for system gpgme
10915     dnl ===================================================================
10916     AC_MSG_CHECKING([which gpgmepp to use])
10917     if test "$with_system_gpgmepp" = "yes"; then
10918         AC_MSG_RESULT([external])
10919         SYSTEM_GPGMEPP=TRUE
10921         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10922         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10923             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10924         # progress_callback is the only func with plain C linkage
10925         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10926         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10927             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10928         AC_CHECK_HEADER(gpgme.h, [],
10929             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10930     else
10931         AC_MSG_RESULT([internal])
10932         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10933         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10935         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10936         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10937         if test "$_os" != "WINNT"; then
10938             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10939             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10940         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10941             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10942         fi
10943     fi
10944     ENABLE_GPGMEPP=TRUE
10945     AC_DEFINE([HAVE_FEATURE_GPGME])
10946     AC_PATH_PROG(GPG, gpg)
10947     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10948     # so let's exclude that manually for the moment
10949     if test -n "$GPG" -a "$_os" != "WINNT"; then
10950         # make sure we not only have a working gpgme, but a full working
10951         # gpg installation to run OpenPGP signature verification
10952         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10953     fi
10954     if test "$_os" = "Linux"; then
10955       uid=`id -u`
10956       AC_MSG_CHECKING([for /run/user/$uid])
10957       if test -d /run/user/$uid; then
10958         AC_MSG_RESULT([yes])
10959         AC_PATH_PROG(GPGCONF, gpgconf)
10961         # Older versions of gpgconf are not working as expected, since
10962         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10963         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10964         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10965         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10966         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10967         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10968         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10969           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10970           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10971           if $GPGCONF --dump-options > /dev/null ; then
10972             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10973               AC_MSG_RESULT([yes])
10974               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10975               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10976             else
10977               AC_MSG_RESULT([no])
10978             fi
10979           else
10980             AC_MSG_RESULT([no. missing or broken gpgconf?])
10981           fi
10982         else
10983           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10984         fi
10985       else
10986         AC_MSG_RESULT([no])
10987      fi
10988    fi
10990 AC_SUBST(ENABLE_GPGMEPP)
10991 AC_SUBST(SYSTEM_GPGMEPP)
10992 AC_SUBST(GPG_ERROR_CFLAGS)
10993 AC_SUBST(GPG_ERROR_LIBS)
10994 AC_SUBST(LIBASSUAN_CFLAGS)
10995 AC_SUBST(LIBASSUAN_LIBS)
10996 AC_SUBST(GPGMEPP_CFLAGS)
10997 AC_SUBST(GPGMEPP_LIBS)
10999 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11000 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11001     AC_MSG_RESULT([yes])
11002     ENABLE_MEDIAWIKI=TRUE
11003     BUILD_TYPE="$BUILD_TYPE XSLTML"
11004     if test  "x$with_java" = "xno"; then
11005         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11006     fi
11007 else
11008     AC_MSG_RESULT([no])
11009     ENABLE_MEDIAWIKI=
11010     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11012 AC_SUBST(ENABLE_MEDIAWIKI)
11014 AC_MSG_CHECKING([whether to build the Report Builder])
11015 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11016     AC_MSG_RESULT([yes])
11017     ENABLE_REPORTBUILDER=TRUE
11018     AC_MSG_CHECKING([which jfreereport libs to use])
11019     if test "$with_system_jfreereport" = "yes"; then
11020         SYSTEM_JFREEREPORT=TRUE
11021         AC_MSG_RESULT([external])
11022         if test -z $SAC_JAR; then
11023             SAC_JAR=/usr/share/java/sac.jar
11024         fi
11025         if ! test -f $SAC_JAR; then
11026              AC_MSG_ERROR(sac.jar not found.)
11027         fi
11029         if test -z $LIBXML_JAR; then
11030             if test -f /usr/share/java/libxml-1.0.0.jar; then
11031                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11032             elif test -f /usr/share/java/libxml.jar; then
11033                 LIBXML_JAR=/usr/share/java/libxml.jar
11034             else
11035                 AC_MSG_ERROR(libxml.jar replacement not found.)
11036             fi
11037         elif ! test -f $LIBXML_JAR; then
11038             AC_MSG_ERROR(libxml.jar not found.)
11039         fi
11041         if test -z $FLUTE_JAR; then
11042             if test -f/usr/share/java/flute-1.3.0.jar; then
11043                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11044             elif test -f /usr/share/java/flute.jar; then
11045                 FLUTE_JAR=/usr/share/java/flute.jar
11046             else
11047                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11048             fi
11049         elif ! test -f $FLUTE_JAR; then
11050             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11051         fi
11053         if test -z $JFREEREPORT_JAR; then
11054             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11055                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11056             elif test -f /usr/share/java/flow-engine.jar; then
11057                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11058             else
11059                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11060             fi
11061         elif ! test -f  $JFREEREPORT_JAR; then
11062                 AC_MSG_ERROR(jfreereport.jar not found.)
11063         fi
11065         if test -z $LIBLAYOUT_JAR; then
11066             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11067                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11068             elif test -f /usr/share/java/liblayout.jar; then
11069                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11070             else
11071                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11072             fi
11073         elif ! test -f $LIBLAYOUT_JAR; then
11074                 AC_MSG_ERROR(liblayout.jar not found.)
11075         fi
11077         if test -z $LIBLOADER_JAR; then
11078             if test -f /usr/share/java/libloader-1.0.0.jar; then
11079                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11080             elif test -f /usr/share/java/libloader.jar; then
11081                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11082             else
11083                 AC_MSG_ERROR(libloader.jar replacement not found.)
11084             fi
11085         elif ! test -f  $LIBLOADER_JAR; then
11086             AC_MSG_ERROR(libloader.jar not found.)
11087         fi
11089         if test -z $LIBFORMULA_JAR; then
11090             if test -f /usr/share/java/libformula-0.2.0.jar; then
11091                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11092             elif test -f /usr/share/java/libformula.jar; then
11093                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11094             else
11095                 AC_MSG_ERROR(libformula.jar replacement not found.)
11096             fi
11097         elif ! test -f $LIBFORMULA_JAR; then
11098                 AC_MSG_ERROR(libformula.jar not found.)
11099         fi
11101         if test -z $LIBREPOSITORY_JAR; then
11102             if test -f /usr/share/java/librepository-1.0.0.jar; then
11103                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11104             elif test -f /usr/share/java/librepository.jar; then
11105                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11106             else
11107                 AC_MSG_ERROR(librepository.jar replacement not found.)
11108             fi
11109         elif ! test -f $LIBREPOSITORY_JAR; then
11110             AC_MSG_ERROR(librepository.jar not found.)
11111         fi
11113         if test -z $LIBFONTS_JAR; then
11114             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11115                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11116             elif test -f /usr/share/java/libfonts.jar; then
11117                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11118             else
11119                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11120             fi
11121         elif ! test -f $LIBFONTS_JAR; then
11122                 AC_MSG_ERROR(libfonts.jar not found.)
11123         fi
11125         if test -z $LIBSERIALIZER_JAR; then
11126             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11127                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11128             elif test -f /usr/share/java/libserializer.jar; then
11129                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11130             else
11131                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11132             fi
11133         elif ! test -f $LIBSERIALIZER_JAR; then
11134                 AC_MSG_ERROR(libserializer.jar not found.)
11135         fi
11137         if test -z $LIBBASE_JAR; then
11138             if test -f /usr/share/java/libbase-1.0.0.jar; then
11139                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11140             elif test -f /usr/share/java/libbase.jar; then
11141                 LIBBASE_JAR=/usr/share/java/libbase.jar
11142             else
11143                 AC_MSG_ERROR(libbase.jar replacement not found.)
11144             fi
11145         elif ! test -f $LIBBASE_JAR; then
11146             AC_MSG_ERROR(libbase.jar not found.)
11147         fi
11149     else
11150         AC_MSG_RESULT([internal])
11151         SYSTEM_JFREEREPORT=
11152         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11153         NEED_ANT=TRUE
11154     fi
11155 else
11156     AC_MSG_RESULT([no])
11157     ENABLE_REPORTBUILDER=
11158     SYSTEM_JFREEREPORT=
11160 AC_SUBST(ENABLE_REPORTBUILDER)
11161 AC_SUBST(SYSTEM_JFREEREPORT)
11162 AC_SUBST(SAC_JAR)
11163 AC_SUBST(LIBXML_JAR)
11164 AC_SUBST(FLUTE_JAR)
11165 AC_SUBST(JFREEREPORT_JAR)
11166 AC_SUBST(LIBBASE_JAR)
11167 AC_SUBST(LIBLAYOUT_JAR)
11168 AC_SUBST(LIBLOADER_JAR)
11169 AC_SUBST(LIBFORMULA_JAR)
11170 AC_SUBST(LIBREPOSITORY_JAR)
11171 AC_SUBST(LIBFONTS_JAR)
11172 AC_SUBST(LIBSERIALIZER_JAR)
11174 # this has to be here because both the Wiki Publisher and the SRB use
11175 # commons-logging
11176 COMMONS_LOGGING_VERSION=1.2
11177 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11178     AC_MSG_CHECKING([which Apache commons-* libs to use])
11179     if test "$with_system_apache_commons" = "yes"; then
11180         SYSTEM_APACHE_COMMONS=TRUE
11181         AC_MSG_RESULT([external])
11182         if test -z $COMMONS_LOGGING_JAR; then
11183             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11184                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11185            elif test -f /usr/share/java/commons-logging.jar; then
11186                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11187             else
11188                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11189             fi
11190         elif ! test -f $COMMONS_LOGGING_JAR; then
11191             AC_MSG_ERROR(commons-logging.jar not found.)
11192         fi
11193     else
11194         AC_MSG_RESULT([internal])
11195         SYSTEM_APACHE_COMMONS=
11196         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11197         NEED_ANT=TRUE
11198     fi
11200 AC_SUBST(SYSTEM_APACHE_COMMONS)
11201 AC_SUBST(COMMONS_LOGGING_JAR)
11202 AC_SUBST(COMMONS_LOGGING_VERSION)
11204 # scripting provider for BeanShell?
11205 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11206 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11207     AC_MSG_RESULT([yes])
11208     ENABLE_SCRIPTING_BEANSHELL=TRUE
11210     dnl ===================================================================
11211     dnl Check for system beanshell
11212     dnl ===================================================================
11213     AC_MSG_CHECKING([which beanshell to use])
11214     if test "$with_system_beanshell" = "yes"; then
11215         AC_MSG_RESULT([external])
11216         SYSTEM_BSH=TRUE
11217         if test -z $BSH_JAR; then
11218             BSH_JAR=/usr/share/java/bsh.jar
11219         fi
11220         if ! test -f $BSH_JAR; then
11221             AC_MSG_ERROR(bsh.jar not found.)
11222         fi
11223     else
11224         AC_MSG_RESULT([internal])
11225         SYSTEM_BSH=
11226         BUILD_TYPE="$BUILD_TYPE BSH"
11227     fi
11228 else
11229     AC_MSG_RESULT([no])
11230     ENABLE_SCRIPTING_BEANSHELL=
11231     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11233 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11234 AC_SUBST(SYSTEM_BSH)
11235 AC_SUBST(BSH_JAR)
11237 # scripting provider for JavaScript?
11238 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11239 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11240     AC_MSG_RESULT([yes])
11241     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11243     dnl ===================================================================
11244     dnl Check for system rhino
11245     dnl ===================================================================
11246     AC_MSG_CHECKING([which rhino to use])
11247     if test "$with_system_rhino" = "yes"; then
11248         AC_MSG_RESULT([external])
11249         SYSTEM_RHINO=TRUE
11250         if test -z $RHINO_JAR; then
11251             RHINO_JAR=/usr/share/java/js.jar
11252         fi
11253         if ! test -f $RHINO_JAR; then
11254             AC_MSG_ERROR(js.jar not found.)
11255         fi
11256     else
11257         AC_MSG_RESULT([internal])
11258         SYSTEM_RHINO=
11259         BUILD_TYPE="$BUILD_TYPE RHINO"
11260         NEED_ANT=TRUE
11261     fi
11262 else
11263     AC_MSG_RESULT([no])
11264     ENABLE_SCRIPTING_JAVASCRIPT=
11265     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11267 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11268 AC_SUBST(SYSTEM_RHINO)
11269 AC_SUBST(RHINO_JAR)
11271 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11272 # paths should be added to library search path. So lets put all 64-bit
11273 # platforms there.
11274 supports_multilib=
11275 case "$host_cpu" in
11276 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11277     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11278         supports_multilib="yes"
11279     fi
11280     ;;
11282     ;;
11283 esac
11285 dnl ===================================================================
11286 dnl QT5 Integration
11287 dnl ===================================================================
11289 QT5_CFLAGS=""
11290 QT5_LIBS=""
11291 QMAKE5="qmake"
11292 MOC5="moc"
11293 QT5_GOBJECT_CFLAGS=""
11294 QT5_GOBJECT_LIBS=""
11295 QT5_HAVE_GOBJECT=""
11296 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11297         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11298         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11299 then
11300     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11301     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11303     if test -n "$supports_multilib"; then
11304         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11305     fi
11307     qt5_test_include="QtWidgets/qapplication.h"
11308     qt5_test_library="libQt5Widgets.so"
11310     dnl Check for qmake5
11311     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11312     if test "$QMAKE5" = "no"; then
11313         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11314     else
11315         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11316         if test -z "$qmake5_test_ver"; then
11317             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11318         fi
11319         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11320         qt5_minimal_minor="6"
11321         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11322             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11323         else
11324             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11325         fi
11326     fi
11328     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11329     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11331     AC_MSG_CHECKING([for Qt5 headers])
11332     qt5_incdir="no"
11333     for inc_dir in $qt5_incdirs; do
11334         if test -r "$inc_dir/$qt5_test_include"; then
11335             qt5_incdir="$inc_dir"
11336             break
11337         fi
11338     done
11339     AC_MSG_RESULT([$qt5_incdir])
11340     if test "x$qt5_incdir" = "xno"; then
11341         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11342     fi
11344     AC_MSG_CHECKING([for Qt5 libraries])
11345     qt5_libdir="no"
11346     for lib_dir in $qt5_libdirs; do
11347         if test -r "$lib_dir/$qt5_test_library"; then
11348             qt5_libdir="$lib_dir"
11349             break
11350         fi
11351     done
11352     AC_MSG_RESULT([$qt5_libdir])
11353     if test "x$qt5_libdir" = "xno"; then
11354         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11355     fi
11357     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11358     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11359     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11361     if test "$USING_X11" = TRUE; then
11362         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11363         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11364         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11365         QT5_USING_X11=1
11366         AC_DEFINE(QT5_USING_X11)
11367     fi
11369     dnl Check for Meta Object Compiler
11371     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11372     if test "$MOC5" = "no"; then
11373         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11374 the root of your Qt installation by exporting QT5DIR before running "configure".])
11375     fi
11377     if test "$build_gstreamer_1_0" = "yes"; then
11378         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11379                 QT5_HAVE_GOBJECT=1
11380                 AC_DEFINE(QT5_HAVE_GOBJECT)
11381             ],
11382             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11383         )
11384     fi
11386 AC_SUBST(QT5_CFLAGS)
11387 AC_SUBST(QT5_LIBS)
11388 AC_SUBST(MOC5)
11389 AC_SUBST(QT5_GOBJECT_CFLAGS)
11390 AC_SUBST(QT5_GOBJECT_LIBS)
11391 AC_SUBST(QT5_HAVE_GOBJECT)
11393 dnl ===================================================================
11394 dnl KF5 Integration
11395 dnl ===================================================================
11397 KF5_CFLAGS=""
11398 KF5_LIBS=""
11399 KF5_CONFIG="kf5-config"
11400 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11401         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11402 then
11403     if test "$OS" = "HAIKU"; then
11404         haiku_arch="`echo $RTL_ARCH | tr X x`"
11405         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11406         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11407     fi
11409     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11410     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11411     if test -n "$supports_multilib"; then
11412         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11413     fi
11415     kf5_test_include="KF5/kcoreaddons_version.h"
11416     kf5_test_library="libKF5CoreAddons.so"
11417     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11419     dnl kf5 KDE4 support compatibility installed
11420     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11421     if test "$KF5_CONFIG" != "no"; then
11422         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11423         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11424     fi
11426     dnl Check for KF5 headers
11427     AC_MSG_CHECKING([for KF5 headers])
11428     kf5_incdir="no"
11429     for kf5_check in $kf5_incdirs; do
11430         if test -r "$kf5_check/$kf5_test_include"; then
11431             kf5_incdir="$kf5_check/KF5"
11432             break
11433         fi
11434     done
11435     AC_MSG_RESULT([$kf5_incdir])
11436     if test "x$kf5_incdir" = "xno"; then
11437         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11438     fi
11440     dnl Check for KF5 libraries
11441     AC_MSG_CHECKING([for KF5 libraries])
11442     kf5_libdir="no"
11443     for kf5_check in $kf5_libdirs; do
11444         if test -r "$kf5_check/$kf5_test_library"; then
11445             kf5_libdir="$kf5_check"
11446             break
11447         fi
11448     done
11450     AC_MSG_RESULT([$kf5_libdir])
11451     if test "x$kf5_libdir" = "xno"; then
11452         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11453     fi
11455     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"
11456     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11457     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11459     if test "$USING_X11" = TRUE; then
11460         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11461     fi
11463     AC_LANG_PUSH([C++])
11464     save_CXXFLAGS=$CXXFLAGS
11465     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11466     AC_MSG_CHECKING([whether KDE is >= 5.0])
11467        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11468 #include <kcoreaddons_version.h>
11470 int main(int argc, char **argv) {
11471        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11472        else return 1;
11474        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11475     CXXFLAGS=$save_CXXFLAGS
11476     AC_LANG_POP([C++])
11478 AC_SUBST(KF5_CFLAGS)
11479 AC_SUBST(KF5_LIBS)
11481 dnl ===================================================================
11482 dnl Test whether to include Evolution 2 support
11483 dnl ===================================================================
11484 AC_MSG_CHECKING([whether to enable evolution 2 support])
11485 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11486     AC_MSG_RESULT([yes])
11487     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11488     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11489     FilterLibs "${GOBJECT_LIBS}"
11490     GOBJECT_LIBS="${filteredlibs}"
11491     ENABLE_EVOAB2="TRUE"
11492 else
11493     ENABLE_EVOAB2=""
11494     AC_MSG_RESULT([no])
11496 AC_SUBST(ENABLE_EVOAB2)
11497 AC_SUBST(GOBJECT_CFLAGS)
11498 AC_SUBST(GOBJECT_LIBS)
11500 dnl ===================================================================
11501 dnl Test which themes to include
11502 dnl ===================================================================
11503 AC_MSG_CHECKING([which themes to include])
11504 # if none given use default subset of available themes
11505 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11506     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11509 WITH_THEMES=""
11510 if test "x$with_theme" != "xno"; then
11511     for theme in $with_theme; do
11512         case $theme in
11513         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" ;;
11514         default) real_theme=colibre ;;
11515         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11516         esac
11517         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11518     done
11520 AC_MSG_RESULT([$WITH_THEMES])
11521 AC_SUBST([WITH_THEMES])
11522 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11523 for theme in $with_theme; do
11524     case $theme in
11525     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11526     *) ;;
11527     esac
11528 done
11530 dnl ===================================================================
11531 dnl Test whether to integrate helppacks into the product's installer
11532 dnl ===================================================================
11533 AC_MSG_CHECKING([for helppack integration])
11534 if test "$with_helppack_integration" = "no"; then
11535     AC_MSG_RESULT([no integration])
11536 else
11537     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11538     AC_MSG_RESULT([integration])
11541 ###############################################################################
11542 # Extensions checking
11543 ###############################################################################
11544 AC_MSG_CHECKING([for extensions integration])
11545 if test "x$enable_extension_integration" != "xno"; then
11546     WITH_EXTENSION_INTEGRATION=TRUE
11547     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11548     AC_MSG_RESULT([yes, use integration])
11549 else
11550     WITH_EXTENSION_INTEGRATION=
11551     AC_MSG_RESULT([no, do not integrate])
11553 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11555 dnl Should any extra extensions be included?
11556 dnl There are standalone tests for each of these below.
11557 WITH_EXTRA_EXTENSIONS=
11558 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11560 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11561 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11562 if test "x$with_java" != "xno"; then
11563     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11564     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11567 AC_MSG_CHECKING([whether to build opens___.ttf])
11568 if test "$enable_build_opensymbol" = "yes"; then
11569     AC_MSG_RESULT([yes])
11570     AC_PATH_PROG(FONTFORGE, fontforge)
11571     if test -z "$FONTFORGE"; then
11572         AC_MSG_ERROR([fontforge not installed])
11573     fi
11574 else
11575     AC_MSG_RESULT([no])
11576     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11577     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11579 AC_SUBST(OPENSYMBOL_TTF)
11580 AC_SUBST(FONTFORGE)
11582 dnl ===================================================================
11583 dnl Test whether to include fonts
11584 dnl ===================================================================
11585 AC_MSG_CHECKING([whether to include third-party fonts])
11586 if test "$with_fonts" != "no"; then
11587     AC_MSG_RESULT([yes])
11588     WITH_FONTS=TRUE
11589     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11590     AC_DEFINE(HAVE_MORE_FONTS)
11591 else
11592     AC_MSG_RESULT([no])
11593     WITH_FONTS=
11594     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11596 AC_SUBST(WITH_FONTS)
11599 dnl ===================================================================
11600 dnl Test whether to enable online update service
11601 dnl ===================================================================
11602 AC_MSG_CHECKING([whether to enable online update])
11603 ENABLE_ONLINE_UPDATE=
11604 ENABLE_ONLINE_UPDATE_MAR=
11605 UPDATE_CONFIG=
11606 if test "$enable_online_update" = ""; then
11607     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11608         AC_MSG_RESULT([yes])
11609         ENABLE_ONLINE_UPDATE="TRUE"
11610     else
11611         AC_MSG_RESULT([no])
11612     fi
11613 else
11614     if test "$enable_online_update" = "mar"; then
11615         AC_MSG_RESULT([yes - MAR-based online update])
11616         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11617         if test "$with_update_config" = ""; then
11618             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11619         fi
11620         UPDATE_CONFIG="$with_update_config"
11621         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11622     elif test "$enable_online_update" = "yes"; then
11623         AC_MSG_RESULT([yes])
11624         ENABLE_ONLINE_UPDATE="TRUE"
11625     else
11626         AC_MSG_RESULT([no])
11627     fi
11629 AC_SUBST(ENABLE_ONLINE_UPDATE)
11630 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11631 AC_SUBST(UPDATE_CONFIG)
11633 dnl ===================================================================
11634 dnl Test whether we need bzip2
11635 dnl ===================================================================
11636 SYSTEM_BZIP2=
11637 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11638     AC_MSG_CHECKING([whether to use system bzip2])
11639     if test "$with_system_bzip2" = yes; then
11640         SYSTEM_BZIP2=TRUE
11641         AC_MSG_RESULT([yes])
11642         PKG_CHECK_MODULES(BZIP2, bzip2)
11643         FilterLibs "${BZIP2_LIBS}"
11644         BZIP2_LIBS="${filteredlibs}"
11645     else
11646         AC_MSG_RESULT([no])
11647         BUILD_TYPE="$BUILD_TYPE BZIP2"
11648     fi
11650 AC_SUBST(SYSTEM_BZIP2)
11651 AC_SUBST(BZIP2_CFLAGS)
11652 AC_SUBST(BZIP2_LIBS)
11654 dnl ===================================================================
11655 dnl Test whether to enable extension update
11656 dnl ===================================================================
11657 AC_MSG_CHECKING([whether to enable extension update])
11658 ENABLE_EXTENSION_UPDATE=
11659 if test "x$enable_extension_update" = "xno"; then
11660     AC_MSG_RESULT([no])
11661 else
11662     AC_MSG_RESULT([yes])
11663     ENABLE_EXTENSION_UPDATE="TRUE"
11664     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11665     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11667 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11670 dnl ===================================================================
11671 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11672 dnl ===================================================================
11673 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11674 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11675     AC_MSG_RESULT([no])
11676     ENABLE_SILENT_MSI=
11677 else
11678     AC_MSG_RESULT([yes])
11679     ENABLE_SILENT_MSI=TRUE
11680     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11682 AC_SUBST(ENABLE_SILENT_MSI)
11684 AC_MSG_CHECKING([whether and how to use Xinerama])
11685 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11686     if test "$x_libraries" = "default_x_libraries"; then
11687         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11688         if test "x$XINERAMALIB" = x; then
11689            XINERAMALIB="/usr/lib"
11690         fi
11691     else
11692         XINERAMALIB="$x_libraries"
11693     fi
11694     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11695         # we have both versions, let the user decide but use the dynamic one
11696         # per default
11697         USE_XINERAMA=TRUE
11698         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11699             XINERAMA_LINK=dynamic
11700         else
11701             XINERAMA_LINK=static
11702         fi
11703     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11704         # we have only the dynamic version
11705         USE_XINERAMA=TRUE
11706         XINERAMA_LINK=dynamic
11707     elif test -e "$XINERAMALIB/libXinerama.a"; then
11708         # static version
11709         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11710             USE_XINERAMA=TRUE
11711             XINERAMA_LINK=static
11712         else
11713             USE_XINERAMA=
11714             XINERAMA_LINK=none
11715         fi
11716     else
11717         # no Xinerama
11718         USE_XINERAMA=
11719         XINERAMA_LINK=none
11720     fi
11721     if test "$USE_XINERAMA" = "TRUE"; then
11722         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11723         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11724             [AC_MSG_ERROR(Xinerama header not found.)], [])
11725         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11726         if test "x$XEXTLIB" = x; then
11727            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11728         fi
11729         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11730         if test "$_os" = "FreeBSD"; then
11731             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11732         fi
11733         if test "$_os" = "Linux"; then
11734             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11735         fi
11736         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11737             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11738     else
11739         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11740     fi
11741 else
11742     USE_XINERAMA=
11743     XINERAMA_LINK=none
11744     AC_MSG_RESULT([no])
11746 AC_SUBST(USE_XINERAMA)
11747 AC_SUBST(XINERAMA_LINK)
11749 dnl ===================================================================
11750 dnl Test whether to build cairo or rely on the system version
11751 dnl ===================================================================
11753 if test "$USING_X11" = TRUE; then
11754     # Used in vcl/Library_vclplug_gen.mk
11755     test_cairo=yes
11758 if test "$test_cairo" = "yes"; then
11759     AC_MSG_CHECKING([whether to use the system cairo])
11761     : ${with_system_cairo:=$with_system_libs}
11762     if test "$with_system_cairo" = "yes"; then
11763         SYSTEM_CAIRO=TRUE
11764         AC_MSG_RESULT([yes])
11766         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11767         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11768         FilterLibs "${CAIRO_LIBS}"
11769         CAIRO_LIBS="${filteredlibs}"
11771         if test "$test_xrender" = "yes"; then
11772             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11773             AC_LANG_PUSH([C])
11774             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11775 #ifdef PictStandardA8
11776 #else
11777       return fail;
11778 #endif
11779 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11781             AC_LANG_POP([C])
11782         fi
11783     else
11784         SYSTEM_CAIRO=
11785         AC_MSG_RESULT([no])
11787         BUILD_TYPE="$BUILD_TYPE CAIRO"
11788     fi
11791 AC_SUBST(SYSTEM_CAIRO)
11792 AC_SUBST(CAIRO_CFLAGS)
11793 AC_SUBST(CAIRO_LIBS)
11795 dnl ===================================================================
11796 dnl Test whether to use avahi
11797 dnl ===================================================================
11798 if test "$_os" = "WINNT"; then
11799     # Windows uses bundled mDNSResponder
11800     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11801 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11802     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11803                       [ENABLE_AVAHI="TRUE"])
11804     AC_DEFINE(HAVE_FEATURE_AVAHI)
11805     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11806     FilterLibs "${AVAHI_LIBS}"
11807     AVAHI_LIBS="${filteredlibs}"
11810 AC_SUBST(ENABLE_AVAHI)
11811 AC_SUBST(AVAHI_CFLAGS)
11812 AC_SUBST(AVAHI_LIBS)
11814 dnl ===================================================================
11815 dnl Test whether to use liblangtag
11816 dnl ===================================================================
11817 SYSTEM_LIBLANGTAG=
11818 AC_MSG_CHECKING([whether to use system liblangtag])
11819 if test "$with_system_liblangtag" = yes; then
11820     SYSTEM_LIBLANGTAG=TRUE
11821     AC_MSG_RESULT([yes])
11822     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11823     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11824     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11825     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11826     FilterLibs "${LIBLANGTAG_LIBS}"
11827     LIBLANGTAG_LIBS="${filteredlibs}"
11828 else
11829     SYSTEM_LIBLANGTAG=
11830     AC_MSG_RESULT([no])
11831     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11832     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11833     if test "$COM" = "MSC"; then
11834         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11835     else
11836         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11837     fi
11839 AC_SUBST(SYSTEM_LIBLANGTAG)
11840 AC_SUBST(LIBLANGTAG_CFLAGS)
11841 AC_SUBST(LIBLANGTAG_LIBS)
11843 dnl ===================================================================
11844 dnl Test whether to build libpng or rely on the system version
11845 dnl ===================================================================
11847 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11849 dnl ===================================================================
11850 dnl Check for runtime JVM search path
11851 dnl ===================================================================
11852 if test "$ENABLE_JAVA" != ""; then
11853     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11854     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11855         AC_MSG_RESULT([yes])
11856         if ! test -d "$with_jvm_path"; then
11857             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11858         fi
11859         if ! test -d "$with_jvm_path"jvm; then
11860             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11861         fi
11862         JVM_ONE_PATH_CHECK="$with_jvm_path"
11863         AC_SUBST(JVM_ONE_PATH_CHECK)
11864     else
11865         AC_MSG_RESULT([no])
11866     fi
11869 dnl ===================================================================
11870 dnl Test for the presence of Ant and that it works
11871 dnl ===================================================================
11873 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11874     ANT_HOME=; export ANT_HOME
11875     WITH_ANT_HOME=; export WITH_ANT_HOME
11876     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11877         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11878             if test "$_os" = "WINNT"; then
11879                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11880             else
11881                 with_ant_home="$LODE_HOME/opt/ant"
11882             fi
11883         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11884             with_ant_home="$LODE_HOME/opt/ant"
11885         fi
11886     fi
11887     if test -z "$with_ant_home"; then
11888         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11889     else
11890         if test "$_os" = "WINNT"; then
11891             # AC_PATH_PROGS needs unix path
11892             with_ant_home=`cygpath -u "$with_ant_home"`
11893         fi
11894         AbsolutePath "$with_ant_home"
11895         with_ant_home=$absolute_path
11896         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11897         WITH_ANT_HOME=$with_ant_home
11898         ANT_HOME=$with_ant_home
11899     fi
11901     if test -z "$ANT"; then
11902         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11903     else
11904         # resolve relative or absolute symlink
11905         while test -h "$ANT"; do
11906             a_cwd=`pwd`
11907             a_basename=`basename "$ANT"`
11908             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11909             cd "`dirname "$ANT"`"
11910             cd "`dirname "$a_script"`"
11911             ANT="`pwd`"/"`basename "$a_script"`"
11912             cd "$a_cwd"
11913         done
11915         AC_MSG_CHECKING([if $ANT works])
11916         mkdir -p conftest.dir
11917         a_cwd=$(pwd)
11918         cd conftest.dir
11919         cat > conftest.java << EOF
11920         public class conftest {
11921             int testmethod(int a, int b) {
11922                     return a + b;
11923             }
11924         }
11927         cat > conftest.xml << EOF
11928         <project name="conftest" default="conftest">
11929         <target name="conftest">
11930             <javac srcdir="." includes="conftest.java">
11931             </javac>
11932         </target>
11933         </project>
11936         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11937         if test $? = 0 -a -f ./conftest.class; then
11938             AC_MSG_RESULT([Ant works])
11939             if test -z "$WITH_ANT_HOME"; then
11940                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11941                 if test -z "$ANT_HOME"; then
11942                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11943                 fi
11944             else
11945                 ANT_HOME="$WITH_ANT_HOME"
11946             fi
11947         else
11948             echo "configure: Ant test failed" >&5
11949             cat conftest.java >&5
11950             cat conftest.xml >&5
11951             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11952         fi
11953         cd "$a_cwd"
11954         rm -fr conftest.dir
11955     fi
11956     if test -z "$ANT_HOME"; then
11957         ANT_HOME="NO_ANT_HOME"
11958     else
11959         PathFormat "$ANT_HOME"
11960         ANT_HOME="$formatted_path"
11961         PathFormat "$ANT"
11962         ANT="$formatted_path"
11963     fi
11964     AC_SUBST(ANT_HOME)
11965     AC_SUBST(ANT)
11967     dnl Checking for ant.jar
11968     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11969         AC_MSG_CHECKING([Ant lib directory])
11970         if test -f $ANT_HOME/lib/ant.jar; then
11971             ANT_LIB="$ANT_HOME/lib"
11972         else
11973             if test -f $ANT_HOME/ant.jar; then
11974                 ANT_LIB="$ANT_HOME"
11975             else
11976                 if test -f /usr/share/java/ant.jar; then
11977                     ANT_LIB=/usr/share/java
11978                 else
11979                     if test -f /usr/share/ant-core/lib/ant.jar; then
11980                         ANT_LIB=/usr/share/ant-core/lib
11981                     else
11982                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11983                             ANT_LIB="$ANT_HOME/lib/ant"
11984                         else
11985                             if test -f /usr/share/lib/ant/ant.jar; then
11986                                 ANT_LIB=/usr/share/lib/ant
11987                             else
11988                                 AC_MSG_ERROR([Ant libraries not found!])
11989                             fi
11990                         fi
11991                     fi
11992                 fi
11993             fi
11994         fi
11995         PathFormat "$ANT_LIB"
11996         ANT_LIB="$formatted_path"
11997         AC_MSG_RESULT([Ant lib directory found.])
11998     fi
11999     AC_SUBST(ANT_LIB)
12001     ant_minver=1.6.0
12002     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12004     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12005     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12006     ant_version_major=`echo $ant_version | cut -d. -f1`
12007     ant_version_minor=`echo $ant_version | cut -d. -f2`
12008     echo "configure: ant_version $ant_version " >&5
12009     echo "configure: ant_version_major $ant_version_major " >&5
12010     echo "configure: ant_version_minor $ant_version_minor " >&5
12011     if test "$ant_version_major" -ge "2"; then
12012         AC_MSG_RESULT([yes, $ant_version])
12013     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12014         AC_MSG_RESULT([yes, $ant_version])
12015     else
12016         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12017     fi
12019     rm -f conftest* core core.* *.core
12022 OOO_JUNIT_JAR=
12023 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12024     AC_MSG_CHECKING([for JUnit 4])
12025     if test "$with_junit" = "yes"; then
12026         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12027             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12028         elif test -e /usr/share/java/junit4.jar; then
12029             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12030         else
12031            if test -e /usr/share/lib/java/junit.jar; then
12032               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12033            else
12034               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12035            fi
12036         fi
12037     else
12038         OOO_JUNIT_JAR=$with_junit
12039     fi
12040     if test "$_os" = "WINNT"; then
12041         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12042     fi
12043     printf 'import org.junit.Before;' > conftest.java
12044     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12045         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12046     else
12047         AC_MSG_ERROR(
12048 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12049  specify its pathname via --with-junit=..., or disable it via --without-junit])
12050     fi
12051     rm -f conftest.class conftest.java
12052     if test $OOO_JUNIT_JAR != ""; then
12053     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12054     fi
12056 AC_SUBST(OOO_JUNIT_JAR)
12058 HAMCREST_JAR=
12059 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12060     AC_MSG_CHECKING([for included Hamcrest])
12061     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12062     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12063         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12064     else
12065         AC_MSG_RESULT([Not included])
12066         AC_MSG_CHECKING([for standalone hamcrest jar.])
12067         if test "$with_hamcrest" = "yes"; then
12068             if test -e /usr/share/lib/java/hamcrest.jar; then
12069                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12070             elif test -e /usr/share/java/hamcrest/core.jar; then
12071                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12072             else
12073                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12074             fi
12075         else
12076             HAMCREST_JAR=$with_hamcrest
12077         fi
12078         if test "$_os" = "WINNT"; then
12079             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12080         fi
12081         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12082             AC_MSG_RESULT([$HAMCREST_JAR])
12083         else
12084             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),
12085                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12086         fi
12087     fi
12088     rm -f conftest.class conftest.java
12090 AC_SUBST(HAMCREST_JAR)
12093 AC_SUBST(SCPDEFS)
12096 # check for wget and curl
12098 WGET=
12099 CURL=
12101 if test "$enable_fetch_external" != "no"; then
12103 CURL=`which curl 2>/dev/null`
12105 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12106     # wget new enough?
12107     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12108     if test $? -eq 0; then
12109         WGET=$i
12110         break
12111     fi
12112 done
12114 if test -z "$WGET" -a -z "$CURL"; then
12115     AC_MSG_ERROR([neither wget nor curl found!])
12120 AC_SUBST(WGET)
12121 AC_SUBST(CURL)
12124 # check for sha256sum
12126 SHA256SUM=
12128 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12129     eval "$i -a 256 --version" > /dev/null 2>&1
12130     ret=$?
12131     if test $ret -eq 0; then
12132         SHA256SUM="$i -a 256"
12133         break
12134     fi
12135 done
12137 if test -z "$SHA256SUM"; then
12138     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12139         eval "$i --version" > /dev/null 2>&1
12140         ret=$?
12141         if test $ret -eq 0; then
12142             SHA256SUM=$i
12143             break
12144         fi
12145     done
12148 if test -z "$SHA256SUM"; then
12149     AC_MSG_ERROR([no sha256sum found!])
12152 AC_SUBST(SHA256SUM)
12154 dnl ===================================================================
12155 dnl Dealing with l10n options
12156 dnl ===================================================================
12157 AC_MSG_CHECKING([which languages to be built])
12158 # get list of all languages
12159 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12160 # the sed command does the following:
12161 #   + if a line ends with a backslash, append the next line to it
12162 #   + adds " on the beginning of the value (after =)
12163 #   + adds " at the end of the value
12164 #   + removes en-US; we want to put it on the beginning
12165 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12166 [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)]
12167 ALL_LANGS="en-US $completelangiso"
12168 # check the configured localizations
12169 WITH_LANG="$with_lang"
12171 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12172 # (Norwegian is "nb" and "nn".)
12173 if test "$WITH_LANG" = "no"; then
12174     WITH_LANG=
12177 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12178     AC_MSG_RESULT([en-US])
12179 else
12180     AC_MSG_RESULT([$WITH_LANG])
12181     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12182     if test -z "$MSGFMT"; then
12183         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12184             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12185         elif test -x "/opt/lo/bin/msgfmt"; then
12186             MSGFMT="/opt/lo/bin/msgfmt"
12187         else
12188             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12189             if test -z "$MSGFMT"; then
12190                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12191             fi
12192         fi
12193     fi
12194     if test -z "$MSGUNIQ"; then
12195         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12196             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12197         elif test -x "/opt/lo/bin/msguniq"; then
12198             MSGUNIQ="/opt/lo/bin/msguniq"
12199         else
12200             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12201             if test -z "$MSGUNIQ"; then
12202                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12203             fi
12204         fi
12205     fi
12207 AC_SUBST(MSGFMT)
12208 AC_SUBST(MSGUNIQ)
12209 # check that the list is valid
12210 for lang in $WITH_LANG; do
12211     test "$lang" = "ALL" && continue
12212     # need to check for the exact string, so add space before and after the list of all languages
12213     for vl in $ALL_LANGS; do
12214         if test "$vl" = "$lang"; then
12215            break
12216         fi
12217     done
12218     if test "$vl" != "$lang"; then
12219         # if you're reading this - you prolly quoted your languages remove the quotes ...
12220         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12221     fi
12222 done
12223 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12224     echo $WITH_LANG | grep -q en-US
12225     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12227 # list with substituted ALL
12228 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12229 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12230 test "$WITH_LANG" = "en-US" && WITH_LANG=
12231 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12232     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12233     ALL_LANGS=`echo $ALL_LANGS qtz`
12235 AC_SUBST(ALL_LANGS)
12236 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12237 AC_SUBST(WITH_LANG)
12238 AC_SUBST(WITH_LANG_LIST)
12239 AC_SUBST(GIT_NEEDED_SUBMODULES)
12241 WITH_POOR_HELP_LOCALIZATIONS=
12242 if test -d "$SRC_ROOT/translations/source"; then
12243     for l in `ls -1 $SRC_ROOT/translations/source`; do
12244         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12245             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12246         fi
12247     done
12249 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12251 if test -n "$with_locales"; then
12252     WITH_LOCALES="$with_locales"
12254     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12255     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12256     # config_host/config_locales.h.in
12257     for locale in $WITH_LOCALES; do
12258         lang=${locale%_*}
12260         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12262         case $lang in
12263         hi|mr*ne)
12264             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12265             ;;
12266         bg|ru)
12267             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12268             ;;
12269         esac
12270     done
12271 else
12272     AC_DEFINE(WITH_LOCALE_ALL)
12274 AC_SUBST(WITH_LOCALES)
12276 dnl git submodule update --reference
12277 dnl ===================================================================
12278 if test -n "${GIT_REFERENCE_SRC}"; then
12279     for repo in ${GIT_NEEDED_SUBMODULES}; do
12280         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12281             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12282         fi
12283     done
12285 AC_SUBST(GIT_REFERENCE_SRC)
12287 dnl git submodules linked dirs
12288 dnl ===================================================================
12289 if test -n "${GIT_LINK_SRC}"; then
12290     for repo in ${GIT_NEEDED_SUBMODULES}; do
12291         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12292             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12293         fi
12294     done
12296 AC_SUBST(GIT_LINK_SRC)
12298 dnl branding
12299 dnl ===================================================================
12300 AC_MSG_CHECKING([for alternative branding images directory])
12301 # initialize mapped arrays
12302 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12303 brand_files="$BRAND_INTRO_IMAGES about.svg"
12305 if test -z "$with_branding" -o "$with_branding" = "no"; then
12306     AC_MSG_RESULT([none])
12307     DEFAULT_BRAND_IMAGES="$brand_files"
12308 else
12309     if ! test -d $with_branding ; then
12310         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12311     else
12312         AC_MSG_RESULT([$with_branding])
12313         CUSTOM_BRAND_DIR="$with_branding"
12314         for lfile in $brand_files
12315         do
12316             if ! test -f $with_branding/$lfile ; then
12317                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12318                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12319             else
12320                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12321             fi
12322         done
12323         check_for_progress="yes"
12324     fi
12326 AC_SUBST([BRAND_INTRO_IMAGES])
12327 AC_SUBST([CUSTOM_BRAND_DIR])
12328 AC_SUBST([CUSTOM_BRAND_IMAGES])
12329 AC_SUBST([DEFAULT_BRAND_IMAGES])
12332 AC_MSG_CHECKING([for 'intro' progress settings])
12333 PROGRESSBARCOLOR=
12334 PROGRESSSIZE=
12335 PROGRESSPOSITION=
12336 PROGRESSFRAMECOLOR=
12337 PROGRESSTEXTCOLOR=
12338 PROGRESSTEXTBASELINE=
12340 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12341     source "$with_branding/progress.conf"
12342     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12343 else
12344     AC_MSG_RESULT([none])
12347 AC_SUBST(PROGRESSBARCOLOR)
12348 AC_SUBST(PROGRESSSIZE)
12349 AC_SUBST(PROGRESSPOSITION)
12350 AC_SUBST(PROGRESSFRAMECOLOR)
12351 AC_SUBST(PROGRESSTEXTCOLOR)
12352 AC_SUBST(PROGRESSTEXTBASELINE)
12355 AC_MSG_CHECKING([for extra build ID])
12356 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12357     EXTRA_BUILDID="$with_extra_buildid"
12359 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12360 if test -n "$EXTRA_BUILDID" ; then
12361     AC_MSG_RESULT([$EXTRA_BUILDID])
12362 else
12363     AC_MSG_RESULT([not set])
12365 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12367 OOO_VENDOR=
12368 AC_MSG_CHECKING([for vendor])
12369 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12370     OOO_VENDOR="$USERNAME"
12372     if test -z "$OOO_VENDOR"; then
12373         OOO_VENDOR="$USER"
12374     fi
12376     if test -z "$OOO_VENDOR"; then
12377         OOO_VENDOR="`id -u -n`"
12378     fi
12380     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12381 else
12382     OOO_VENDOR="$with_vendor"
12383     AC_MSG_RESULT([$OOO_VENDOR])
12385 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12386 AC_SUBST(OOO_VENDOR)
12388 if test "$_os" = "Android" ; then
12389     ANDROID_PACKAGE_NAME=
12390     AC_MSG_CHECKING([for Android package name])
12391     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12392         if test -n "$ENABLE_DEBUG"; then
12393             # Default to the package name that makes ndk-gdb happy.
12394             ANDROID_PACKAGE_NAME="org.libreoffice"
12395         else
12396             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12397         fi
12399         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12400     else
12401         ANDROID_PACKAGE_NAME="$with_android_package_name"
12402         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12403     fi
12404     AC_SUBST(ANDROID_PACKAGE_NAME)
12407 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12408 if test "$with_compat_oowrappers" = "yes"; then
12409     WITH_COMPAT_OOWRAPPERS=TRUE
12410     AC_MSG_RESULT(yes)
12411 else
12412     WITH_COMPAT_OOWRAPPERS=
12413     AC_MSG_RESULT(no)
12415 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12417 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12418 AC_MSG_CHECKING([for install dirname])
12419 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12420     INSTALLDIRNAME="$with_install_dirname"
12422 AC_MSG_RESULT([$INSTALLDIRNAME])
12423 AC_SUBST(INSTALLDIRNAME)
12425 AC_MSG_CHECKING([for prefix])
12426 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12427 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12428 PREFIXDIR="$prefix"
12429 AC_MSG_RESULT([$PREFIXDIR])
12430 AC_SUBST(PREFIXDIR)
12432 LIBDIR=[$(eval echo $(eval echo $libdir))]
12433 AC_SUBST(LIBDIR)
12435 DATADIR=[$(eval echo $(eval echo $datadir))]
12436 AC_SUBST(DATADIR)
12438 MANDIR=[$(eval echo $(eval echo $mandir))]
12439 AC_SUBST(MANDIR)
12441 DOCDIR=[$(eval echo $(eval echo $docdir))]
12442 AC_SUBST(DOCDIR)
12444 BINDIR=[$(eval echo $(eval echo $bindir))]
12445 AC_SUBST(BINDIR)
12447 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12448 AC_SUBST(INSTALLDIR)
12450 TESTINSTALLDIR="${BUILDDIR}/test-install"
12451 AC_SUBST(TESTINSTALLDIR)
12454 # ===================================================================
12455 # OAuth2 id and secrets
12456 # ===================================================================
12458 AC_MSG_CHECKING([for Google Drive client id and secret])
12459 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12460     AC_MSG_RESULT([not set])
12461     GDRIVE_CLIENT_ID="\"\""
12462     GDRIVE_CLIENT_SECRET="\"\""
12463 else
12464     AC_MSG_RESULT([set])
12465     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12466     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12468 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12469 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12471 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12472 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12473     AC_MSG_RESULT([not set])
12474     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12475     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12476 else
12477     AC_MSG_RESULT([set])
12478     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12479     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12481 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12482 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12484 AC_MSG_CHECKING([for OneDrive client id and secret])
12485 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12486     AC_MSG_RESULT([not set])
12487     ONEDRIVE_CLIENT_ID="\"\""
12488     ONEDRIVE_CLIENT_SECRET="\"\""
12489 else
12490     AC_MSG_RESULT([set])
12491     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12492     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12494 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12495 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12498 dnl ===================================================================
12499 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12500 dnl --enable-dependency-tracking configure option
12501 dnl ===================================================================
12502 AC_MSG_CHECKING([whether to enable dependency tracking])
12503 if test "$enable_dependency_tracking" = "no"; then
12504     nodep=TRUE
12505     AC_MSG_RESULT([no])
12506 else
12507     AC_MSG_RESULT([yes])
12509 AC_SUBST(nodep)
12511 dnl ===================================================================
12512 dnl Number of CPUs to use during the build
12513 dnl ===================================================================
12514 AC_MSG_CHECKING([for number of processors to use])
12515 # plain --with-parallelism is just the default
12516 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12517     if test "$with_parallelism" = "no"; then
12518         PARALLELISM=0
12519     else
12520         PARALLELISM=$with_parallelism
12521     fi
12522 else
12523     if test "$enable_icecream" = "yes"; then
12524         PARALLELISM="40"
12525     else
12526         case `uname -s` in
12528         Darwin|FreeBSD|NetBSD|OpenBSD)
12529             PARALLELISM=`sysctl -n hw.ncpu`
12530             ;;
12532         Linux)
12533             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12534         ;;
12535         # what else than above does profit here *and* has /proc?
12536         *)
12537             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12538             ;;
12539         esac
12541         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12542         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12543     fi
12546 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12547     if test -z "$with_parallelism"; then
12548             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12549             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12550             PARALLELISM="1"
12551     else
12552         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."
12553     fi
12556 if test $PARALLELISM -eq 0; then
12557     AC_MSG_RESULT([explicit make -j option needed])
12558 else
12559     AC_MSG_RESULT([$PARALLELISM])
12561 AC_SUBST(PARALLELISM)
12563 IWYU_PATH="$with_iwyu"
12564 AC_SUBST(IWYU_PATH)
12565 if test ! -z "$IWYU_PATH"; then
12566     if test ! -f "$IWYU_PATH"; then
12567         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12568     fi
12572 # Set up ILIB for MSVC build
12574 ILIB1=
12575 if test "$build_os" = "cygwin"; then
12576     ILIB="."
12577     if test -n "$JAVA_HOME"; then
12578         ILIB="$ILIB;$JAVA_HOME/lib"
12579     fi
12580     ILIB1=-link
12581     if test "$BITNESS_OVERRIDE" = 64; then
12582         ILIB="$ILIB;$COMPATH/lib/x64"
12583         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12584         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12585         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12586         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12587             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12588             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12589         fi
12590         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12591         ucrtlibpath_formatted=$formatted_path
12592         ILIB="$ILIB;$ucrtlibpath_formatted"
12593         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12594     else
12595         ILIB="$ILIB;$COMPATH/lib/x86"
12596         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12597         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12598         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12599         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12600             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12601             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12602         fi
12603         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12604         ucrtlibpath_formatted=$formatted_path
12605         ILIB="$ILIB;$ucrtlibpath_formatted"
12606         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12607     fi
12608     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12609         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12610     else
12611         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12612     fi
12614     AC_SUBST(ILIB)
12617 # ===================================================================
12618 # Creating bigger shared library to link against
12619 # ===================================================================
12620 AC_MSG_CHECKING([whether to create huge library])
12621 MERGELIBS=
12623 if test $_os = iOS -o $_os = Android; then
12624     # Never any point in mergelibs for these as we build just static
12625     # libraries anyway...
12626     enable_mergelibs=no
12629 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12630     if test $_os != Linux -a $_os != WINNT; then
12631         add_warning "--enable-mergelibs is not tested for this platform"
12632     fi
12633     MERGELIBS="TRUE"
12634     AC_MSG_RESULT([yes])
12635 else
12636     AC_MSG_RESULT([no])
12638 AC_SUBST([MERGELIBS])
12640 dnl ===================================================================
12641 dnl icerun is a wrapper that stops us spawning tens of processes
12642 dnl locally - for tools that can't be executed on the compile cluster
12643 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12644 dnl ===================================================================
12645 AC_MSG_CHECKING([whether to use icerun wrapper])
12646 ICECREAM_RUN=
12647 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12648     ICECREAM_RUN=icerun
12649     AC_MSG_RESULT([yes])
12650 else
12651     AC_MSG_RESULT([no])
12653 AC_SUBST(ICECREAM_RUN)
12655 dnl ===================================================================
12656 dnl Setup the ICECC_VERSION for the build the same way it was set for
12657 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12658 dnl ===================================================================
12659 x_ICECC_VERSION=[\#]
12660 if test -n "$ICECC_VERSION" ; then
12661     x_ICECC_VERSION=
12663 AC_SUBST(x_ICECC_VERSION)
12664 AC_SUBST(ICECC_VERSION)
12666 dnl ===================================================================
12668 AC_MSG_CHECKING([MPL subset])
12669 MPL_SUBSET=
12671 if test "$enable_mpl_subset" = "yes"; then
12672     warn_report=false
12673     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12674         warn_report=true
12675     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12676         warn_report=true
12677     fi
12678     if test "$warn_report" = "true"; then
12679         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12680     fi
12681     if test "x$enable_postgresql_sdbc" != "xno"; then
12682         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12683     fi
12684     if test "$enable_lotuswordpro" = "yes"; then
12685         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12686     fi
12687     if test "$WITH_WEBDAV" = "neon"; then
12688         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12689     fi
12690     if test -n "$ENABLE_POPPLER"; then
12691         if test "x$SYSTEM_POPPLER" = "x"; then
12692             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12693         fi
12694     fi
12695     # cf. m4/libo_check_extension.m4
12696     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12697         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12698     fi
12699     for theme in $WITH_THEMES; do
12700         case $theme in
12701         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12702             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12703         *) : ;;
12704         esac
12705     done
12707     ENABLE_OPENGL_TRANSITIONS=
12709     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12710         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12711     fi
12713     MPL_SUBSET="TRUE"
12714     AC_DEFINE(MPL_HAVE_SUBSET)
12715     AC_MSG_RESULT([only])
12716 else
12717     AC_MSG_RESULT([no restrictions])
12719 AC_SUBST(MPL_SUBSET)
12721 dnl ===================================================================
12723 AC_MSG_CHECKING([formula logger])
12724 ENABLE_FORMULA_LOGGER=
12726 if test "x$enable_formula_logger" = "xyes"; then
12727     AC_MSG_RESULT([yes])
12728     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12729     ENABLE_FORMULA_LOGGER=TRUE
12730 elif test -n "$ENABLE_DBGUTIL" ; then
12731     AC_MSG_RESULT([yes])
12732     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12733     ENABLE_FORMULA_LOGGER=TRUE
12734 else
12735     AC_MSG_RESULT([no])
12738 AC_SUBST(ENABLE_FORMULA_LOGGER)
12740 dnl ===================================================================
12741 dnl Setting up the environment.
12742 dnl ===================================================================
12743 AC_MSG_NOTICE([setting up the build environment variables...])
12745 AC_SUBST(COMPATH)
12747 if test "$build_os" = "cygwin"; then
12748     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12749         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12750         ATL_INCLUDE="$COMPATH/atlmfc/include"
12751     elif test -d "$COMPATH/atlmfc/lib"; then
12752         ATL_LIB="$COMPATH/atlmfc/lib"
12753         ATL_INCLUDE="$COMPATH/atlmfc/include"
12754     else
12755         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12756         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12757     fi
12758     if test "$BITNESS_OVERRIDE" = 64; then
12759         ATL_LIB="$ATL_LIB/x64"
12760     else
12761         ATL_LIB="$ATL_LIB/x86"
12762     fi
12763     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12764     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12766     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12767     PathFormat "/usr/bin/find.exe"
12768     FIND="$formatted_path"
12769     PathFormat "/usr/bin/sort.exe"
12770     SORT="$formatted_path"
12771     PathFormat "/usr/bin/grep.exe"
12772     WIN_GREP="$formatted_path"
12773     PathFormat "/usr/bin/ls.exe"
12774     WIN_LS="$formatted_path"
12775     PathFormat "/usr/bin/touch.exe"
12776     WIN_TOUCH="$formatted_path"
12777 else
12778     FIND=find
12779     SORT=sort
12782 AC_SUBST(ATL_INCLUDE)
12783 AC_SUBST(ATL_LIB)
12784 AC_SUBST(FIND)
12785 AC_SUBST(SORT)
12786 AC_SUBST(WIN_GREP)
12787 AC_SUBST(WIN_LS)
12788 AC_SUBST(WIN_TOUCH)
12790 AC_SUBST(BUILD_TYPE)
12792 AC_SUBST(SOLARINC)
12794 PathFormat "$PERL"
12795 PERL="$formatted_path"
12796 AC_SUBST(PERL)
12798 if test -n "$TMPDIR"; then
12799     TEMP_DIRECTORY="$TMPDIR"
12800 else
12801     TEMP_DIRECTORY="/tmp"
12803 if test "$build_os" = "cygwin"; then
12804     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12806 AC_SUBST(TEMP_DIRECTORY)
12808 # setup the PATH for the environment
12809 if test -n "$LO_PATH_FOR_BUILD"; then
12810     LO_PATH="$LO_PATH_FOR_BUILD"
12811 else
12812     LO_PATH="$PATH"
12814     case "$host_os" in
12816     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12817         if test "$ENABLE_JAVA" != ""; then
12818             pathmunge "$JAVA_HOME/bin" "after"
12819         fi
12820         ;;
12822     cygwin*)
12823         # Win32 make needs native paths
12824         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12825             LO_PATH=`cygpath -p -m "$PATH"`
12826         fi
12827         if test "$BITNESS_OVERRIDE" = 64; then
12828             # needed for msi packaging
12829             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12830         fi
12831         # .NET 4.6 and higher don't have bin directory
12832         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12833             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12834         fi
12835         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12836         pathmunge "$CSC_PATH" "before"
12837         pathmunge "$MIDL_PATH" "before"
12838         pathmunge "$AL_PATH" "before"
12839         pathmunge "$MSPDB_PATH" "before"
12840         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12841             pathmunge "$CL_PATH" "before"
12842         fi
12843         if test -n "$MSBUILD_PATH" ; then
12844             pathmunge "$MSBUILD_PATH" "before"
12845         fi
12846         if test "$BITNESS_OVERRIDE" = 64; then
12847             pathmunge "$COMPATH/bin/amd64" "before"
12848             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12849         else
12850             pathmunge "$COMPATH/bin" "before"
12851             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12852         fi
12853         if test "$ENABLE_JAVA" != ""; then
12854             if test -d "$JAVA_HOME/jre/bin/client"; then
12855                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12856             fi
12857             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12858                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12859             fi
12860             pathmunge "$JAVA_HOME/bin" "before"
12861         fi
12862         ;;
12864     solaris*)
12865         pathmunge "/usr/css/bin" "before"
12866         if test "$ENABLE_JAVA" != ""; then
12867             pathmunge "$JAVA_HOME/bin" "after"
12868         fi
12869         ;;
12870     esac
12873 AC_SUBST(LO_PATH)
12875 libo_FUZZ_SUMMARY
12877 # Generate a configuration sha256 we can use for deps
12878 if test -f config_host.mk; then
12879     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12881 if test -f config_host_lang.mk; then
12882     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12885 CFLAGS=$my_original_CFLAGS
12886 CXXFLAGS=$my_original_CXXFLAGS
12887 CPPFLAGS=$my_original_CPPFLAGS
12889 AC_CONFIG_FILES([config_host.mk
12890                  config_host_lang.mk
12891                  Makefile
12892                  bin/bffvalidator.sh
12893                  bin/odfvalidator.sh
12894                  bin/officeotron.sh
12895                  instsetoo_native/util/openoffice.lst
12896                  sysui/desktop/macosx/Info.plist])
12897 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12898 AC_CONFIG_HEADERS([config_host/config_clang.h])
12899 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12900 AC_CONFIG_HEADERS([config_host/config_eot.h])
12901 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12902 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12903 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12904 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12905 AC_CONFIG_HEADERS([config_host/config_features.h])
12906 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12907 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12908 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12909 AC_CONFIG_HEADERS([config_host/config_folders.h])
12910 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12911 AC_CONFIG_HEADERS([config_host/config_gio.h])
12912 AC_CONFIG_HEADERS([config_host/config_global.h])
12913 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12914 AC_CONFIG_HEADERS([config_host/config_java.h])
12915 AC_CONFIG_HEADERS([config_host/config_langs.h])
12916 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12917 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12918 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12919 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12920 AC_CONFIG_HEADERS([config_host/config_locales.h])
12921 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12922 AC_CONFIG_HEADERS([config_host/config_oox.h])
12923 AC_CONFIG_HEADERS([config_host/config_options.h])
12924 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12925 AC_CONFIG_HEADERS([config_host/config_skia.h])
12926 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12927 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12928 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12929 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12930 AC_CONFIG_HEADERS([config_host/config_version.h])
12931 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12932 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12933 AC_CONFIG_HEADERS([config_host/config_python.h])
12934 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12935 AC_OUTPUT
12937 if test "$CROSS_COMPILING" = TRUE; then
12938     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12941 # touch the config timestamp file
12942 if test ! -f config_host.mk.stamp; then
12943     echo > config_host.mk.stamp
12944 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12945     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12946 else
12947     echo > config_host.mk.stamp
12950 # touch the config lang timestamp file
12951 if test ! -f config_host_lang.mk.stamp; then
12952     echo > config_host_lang.mk.stamp
12953 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12954     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12955 else
12956     echo > config_host_lang.mk.stamp
12960 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12961         -a "$build_os" = "cygwin"; then
12963 cat << _EOS
12964 ****************************************************************************
12965 WARNING:
12966 Your make version is known to be horribly slow, and hard to debug
12967 problems with. To get a reasonably functional make please do:
12969 to install a pre-compiled binary make for Win32
12971  mkdir -p /opt/lo/bin
12972  cd /opt/lo/bin
12973  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12974  cp make-4.2.1-msvc.exe make
12975  chmod +x make
12977 to install from source:
12978 place yourself in a working directory of you choice.
12980  git clone git://git.savannah.gnu.org/make.git
12982  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12983  set PATH=%PATH%;C:\Cygwin\bin
12984  [or Cygwin64, if that is what you have]
12985  cd path-to-make-repo-you-cloned-above
12986  build_w32.bat --without-guile
12988 should result in a WinRel/gnumake.exe.
12989 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12991 Then re-run autogen.sh
12993 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12994 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12996 _EOS
12997 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12998     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13003 cat << _EOF
13004 ****************************************************************************
13006 To build, run:
13007 $GNUMAKE
13009 To view some help, run:
13010 $GNUMAKE help
13012 _EOF
13014 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13015     cat << _EOF
13016 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13017 _EOF
13019     if test $_os = Darwin; then
13020         echo open instdir/$PRODUCTNAME.app
13021     else
13022         echo instdir/program/soffice
13023     fi
13024     cat << _EOF
13026 If you want to run the smoketest, run:
13027 $GNUMAKE check
13029 _EOF
13032 if test -f warn; then
13033     cat warn
13034     rm warn
13037 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: