Bump version to 6.4.0.1
[LibreOffice.git] / configure.ac
blob6ed1a489545ed391cd2ebbb5613b9260fac32c07
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 powered by CIB],[6.4.0.1.0],[],[],[http://libreoffice.cib.eu/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
569 test_gdb_index=no
570 test_split_debug=no
572 # Default values, as such probably valid just for Linux, set
573 # differently below just for Mac OSX, but at least better than
574 # hardcoding these as we used to do. Much of this is duplicated also
575 # in solenv for old build system and for gbuild, ideally we should
576 # perhaps define stuff like this only here in configure.ac?
578 LINKFLAGSSHL="-shared"
579 PICSWITCH="-fpic"
580 DLLPOST=".so"
582 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
584 INSTROOTBASESUFFIX=
585 INSTROOTCONTENTSUFFIX=
586 SDKDIRNAME=sdk
588 case "$host_os" in
590 solaris*)
591     build_gstreamer_1_0=yes
592     test_freetype=yes
593     _os=SunOS
595     dnl ===========================================================
596     dnl Check whether we're using Solaris 10 - SPARC or Intel.
597     dnl ===========================================================
598     AC_MSG_CHECKING([the Solaris operating system release])
599     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
600     if test "$_os_release" -lt "10"; then
601         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
602     else
603         AC_MSG_RESULT([ok ($_os_release)])
604     fi
606     dnl Check whether we're using a SPARC or i386 processor
607     AC_MSG_CHECKING([the processor type])
608     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
609         AC_MSG_RESULT([ok ($host_cpu)])
610     else
611         AC_MSG_ERROR([only SPARC and i386 processors are supported])
612     fi
613     ;;
615 linux-gnu*|k*bsd*-gnu*)
616     build_gstreamer_1_0=yes
617     test_kf5=yes
618     test_gtk3_kde5=yes
619     test_gdb_index=yes
620     test_split_debug=yes
621     if test "$enable_fuzzers" != yes; then
622         test_freetype=yes
623         test_fontconfig=yes
624     else
625         test_freetype=no
626         test_fontconfig=no
627         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
628     fi
629     _os=Linux
630     ;;
632 gnu)
633     test_randr=no
634     test_xrender=no
635     _os=GNU
636      ;;
638 cygwin*|interix*)
640     # When building on Windows normally with MSVC under Cygwin,
641     # configure thinks that the host platform (the platform the
642     # built code will run on) is Cygwin, even if it obviously is
643     # Windows, which in Autoconf terminology is called
644     # "mingw32". (Which is misleading as MinGW is the name of the
645     # tool-chain, not an operating system.)
647     # Somewhat confusing, yes. But this configure script doesn't
648     # look at $host etc that much, it mostly uses its own $_os
649     # variable, set here in this case statement.
651     test_cups=no
652     test_dbus=no
653     test_randr=no
654     test_xrender=no
655     test_freetype=no
656     test_fontconfig=no
657     _os=WINNT
659     DLLPOST=".dll"
660     LINKFLAGSNOUNDEFS=
661     ;;
663 darwin*) # macOS or iOS
664     test_randr=no
665     test_xrender=no
666     test_freetype=no
667     test_fontconfig=no
668     test_dbus=no
669     if test -n "$LODE_HOME" ; then
670         mac_sanitize_path
671         AC_MSG_NOTICE([sanitized the PATH to $PATH])
672     fi
673     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
674         build_for_ios=YES
675         _os=iOS
676         test_cups=no
677         enable_mpl_subset=yes
678         enable_lotuswordpro=no
679         enable_coinmp=no
680         enable_lpsolve=no
681         enable_postgresql_sdbc=no
682         enable_extension_integration=no
683         enable_report_builder=no
684         with_ppds=no
685         if test "$enable_ios_simulator" = "yes"; then
686             host=x86_64-apple-darwin
687         fi
688     else
689         _os=Darwin
690         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
691         INSTROOTCONTENTSUFFIX=/Contents
692         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
693     fi
694     # See comment above the case "$host_os"
695     LINKFLAGSSHL="-dynamiclib -single_module"
697     # -fPIC is default
698     PICSWITCH=""
700     DLLPOST=".dylib"
702     # -undefined error is the default
703     LINKFLAGSNOUNDEFS=""
706 freebsd*)
707     build_gstreamer_1_0=yes
708     test_kf5=yes
709     test_gtk3_kde5=yes
710     test_freetype=yes
711     AC_MSG_CHECKING([the FreeBSD operating system release])
712     if test -n "$with_os_version"; then
713         OSVERSION="$with_os_version"
714     else
715         OSVERSION=`/sbin/sysctl -n kern.osreldate`
716     fi
717     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
718     AC_MSG_CHECKING([which thread library to use])
719     if test "$OSVERSION" -lt "500016"; then
720         PTHREAD_CFLAGS="-D_THREAD_SAFE"
721         PTHREAD_LIBS="-pthread"
722     elif test "$OSVERSION" -lt "502102"; then
723         PTHREAD_CFLAGS="-D_THREAD_SAFE"
724         PTHREAD_LIBS="-lc_r"
725     else
726         PTHREAD_CFLAGS=""
727         PTHREAD_LIBS="-pthread"
728     fi
729     AC_MSG_RESULT([$PTHREAD_LIBS])
730     _os=FreeBSD
731     ;;
733 *netbsd*)
734     build_gstreamer_1_0=yes
735     test_kf5=yes
736     test_gtk3_kde5=yes
737     test_freetype=yes
738     PTHREAD_LIBS="-pthread -lpthread"
739     _os=NetBSD
740     ;;
742 aix*)
743     test_randr=no
744     test_freetype=yes
745     PTHREAD_LIBS=-pthread
746     _os=AIX
747     ;;
749 openbsd*)
750     test_freetype=yes
751     PTHREAD_CFLAGS="-D_THREAD_SAFE"
752     PTHREAD_LIBS="-pthread"
753     _os=OpenBSD
754     ;;
756 dragonfly*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     enable_lotuswordpro=no
768     enable_mpl_subset=yes
769     enable_coinmp=yes
770     enable_lpsolve=no
771     enable_report_builder=no
772     enable_odk=no
773     enable_postgresql_sdbc=no
774     enable_python=no
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_kf5=no
780     test_qt5=no
781     test_gtk3_kde5=no
782     test_randr=no
783     test_xrender=no
784     _os=Android
786     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
787     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
788     ;;
790 haiku*)
791     test_cups=no
792     test_dbus=no
793     test_randr=no
794     test_xrender=no
795     test_freetype=yes
796     enable_odk=no
797     enable_gstreamer_1_0=no
798     enable_vlc=no
799     enable_coinmp=no
800     enable_pdfium=no
801     enable_sdremote=no
802     enable_postgresql_sdbc=no
803     enable_firebird_sdbc=no
804     _os=Haiku
805     ;;
808     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
809     ;;
810 esac
812 if test "$_os" = "Android" ; then
813     # Verify that the NDK and SDK options are proper
814     if test -z "$with_android_ndk"; then
815         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
816     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
817         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
818     fi
820     if test -z "$ANDROID_SDK_HOME"; then
821         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
822     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
823         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
824     fi
826     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
827     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
828         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
829                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
830                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
831         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
832         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
833         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
834     fi
835     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
836         AC_MSG_WARN([android support repository not found - install with
837                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
838                      to allow the build to download the specified version of the android support libraries])
839         add_warning "android support repository not found - install with"
840         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
841         add_warning "to allow the build to download the specified version of the android support libraries"
842     fi
845 if test "$_os" = "AIX"; then
846     AC_PATH_PROG(GAWK, gawk)
847     if test -z "$GAWK"; then
848         AC_MSG_ERROR([gawk not found in \$PATH])
849     fi
852 AC_SUBST(SDKDIRNAME)
854 AC_SUBST(PTHREAD_CFLAGS)
855 AC_SUBST(PTHREAD_LIBS)
857 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
858 # By default use the ones specified by our build system,
859 # but explicit override is possible.
860 AC_MSG_CHECKING(for explicit AFLAGS)
861 if test -n "$AFLAGS"; then
862     AC_MSG_RESULT([$AFLAGS])
863     x_AFLAGS=
864 else
865     AC_MSG_RESULT(no)
866     x_AFLAGS=[\#]
868 AC_MSG_CHECKING(for explicit CFLAGS)
869 if test -n "$CFLAGS"; then
870     AC_MSG_RESULT([$CFLAGS])
871     x_CFLAGS=
872 else
873     AC_MSG_RESULT(no)
874     x_CFLAGS=[\#]
876 AC_MSG_CHECKING(for explicit CXXFLAGS)
877 if test -n "$CXXFLAGS"; then
878     AC_MSG_RESULT([$CXXFLAGS])
879     x_CXXFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_CXXFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit OBJCFLAGS)
885 if test -n "$OBJCFLAGS"; then
886     AC_MSG_RESULT([$OBJCFLAGS])
887     x_OBJCFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_OBJCFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
893 if test -n "$OBJCXXFLAGS"; then
894     AC_MSG_RESULT([$OBJCXXFLAGS])
895     x_OBJCXXFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_OBJCXXFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit LDFLAGS)
901 if test -n "$LDFLAGS"; then
902     AC_MSG_RESULT([$LDFLAGS])
903     x_LDFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_LDFLAGS=[\#]
908 AC_SUBST(AFLAGS)
909 AC_SUBST(CFLAGS)
910 AC_SUBST(CXXFLAGS)
911 AC_SUBST(OBJCFLAGS)
912 AC_SUBST(OBJCXXFLAGS)
913 AC_SUBST(LDFLAGS)
914 AC_SUBST(x_AFLAGS)
915 AC_SUBST(x_CFLAGS)
916 AC_SUBST(x_CXXFLAGS)
917 AC_SUBST(x_OBJCFLAGS)
918 AC_SUBST(x_OBJCXXFLAGS)
919 AC_SUBST(x_LDFLAGS)
921 dnl These are potentially set for MSVC, in the code checking for UCRT below:
922 my_original_CFLAGS=$CFLAGS
923 my_original_CXXFLAGS=$CXXFLAGS
924 my_original_CPPFLAGS=$CPPFLAGS
926 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
927 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
928 dnl AC_PROG_CC internally.
929 if test "$_os" != "WINNT"; then
930     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
931     save_CFLAGS=$CFLAGS
932     AC_PROG_CC
933     CFLAGS=$save_CFLAGS
934     if test -z "$CC_BASE"; then
935         CC_BASE=`first_arg_basename "$CC"`
936     fi
939 if test "$_os" != "WINNT"; then
940     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942     ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 libo_FUZZ_ARG_ENABLE(crashdump,
1068     AS_HELP_STRING([--disable-crashdump],
1069         [Disable dump.ini and dump-file, when --enable-breakpad])
1072 AC_ARG_ENABLE(fetch-external,
1073     AS_HELP_STRING([--disable-fetch-external],
1074         [Disables fetching external tarballs from web sources.])
1077 AC_ARG_ENABLE(fuzzers,
1078     AS_HELP_STRING([--enable-fuzzers],
1079         [Enables building libfuzzer targets for fuzz testing.])
1082 libo_FUZZ_ARG_ENABLE(pch,
1083     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1084         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1085          Using 'system' will include only external headers, 'base' will add also headers
1086          from base modules, 'normal' will also add all headers except from the module built,
1087          'full' will use all suitable headers even from a module itself.])
1090 libo_FUZZ_ARG_ENABLE(epm,
1091     AS_HELP_STRING([--enable-epm],
1092         [LibreOffice includes self-packaging code, that requires epm, however epm is
1093          useless for large scale package building.])
1096 libo_FUZZ_ARG_ENABLE(odk,
1097     AS_HELP_STRING([--disable-odk],
1098         [LibreOffice includes an ODK, office development kit which some packagers may
1099          wish to build without.])
1102 AC_ARG_ENABLE(mpl-subset,
1103     AS_HELP_STRING([--enable-mpl-subset],
1104         [Don't compile any pieces which are not MPL or more liberally licensed])
1107 libo_FUZZ_ARG_ENABLE(evolution2,
1108     AS_HELP_STRING([--enable-evolution2],
1109         [Allows the built-in evolution 2 addressbook connectivity build to be
1110          enabled.])
1113 AC_ARG_ENABLE(avahi,
1114     AS_HELP_STRING([--enable-avahi],
1115         [Determines whether to use Avahi to advertise Impress to remote controls.])
1118 libo_FUZZ_ARG_ENABLE(werror,
1119     AS_HELP_STRING([--enable-werror],
1120         [Turn warnings to errors. (Has no effect in modules where the treating
1121          of warnings as errors is disabled explicitly.)]),
1124 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1125     AS_HELP_STRING([--enable-assert-always-abort],
1126         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1129 libo_FUZZ_ARG_ENABLE(dbgutil,
1130     AS_HELP_STRING([--enable-dbgutil],
1131         [Provide debugging support from --enable-debug and include additional debugging
1132          utilities such as object counting or more expensive checks.
1133          This is the recommended option for developers.
1134          Note that this makes the build ABI incompatible, it is not possible to mix object
1135          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1137 libo_FUZZ_ARG_ENABLE(debug,
1138     AS_HELP_STRING([--enable-debug],
1139         [Include debugging information, disable compiler optimization and inlining plus
1140          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1142 libo_FUZZ_ARG_ENABLE(split-debug,
1143     AS_HELP_STRING([--disable-split-debug],
1144         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1145          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1147 libo_FUZZ_ARG_ENABLE(gdb-index,
1148     AS_HELP_STRING([--disable-gdb-index],
1149         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1150          The feature requires the gold or lld linker.]))
1152 libo_FUZZ_ARG_ENABLE(sal-log,
1153     AS_HELP_STRING([--enable-sal-log],
1154         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1156 libo_FUZZ_ARG_ENABLE(symbols,
1157     AS_HELP_STRING([--enable-symbols],
1158         [Generate debug information.
1159          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1160          otherwise. It is possible to explicitly specify gbuild build targets
1161          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1162          everything in the directory; there is no ordering, more specific overrides
1163          more general, and disabling takes precedence).
1164          Example: --enable-symbols="all -sw/ -Library_sc".]))
1166 libo_FUZZ_ARG_ENABLE(optimized,
1167     AS_HELP_STRING([--disable-optimized],
1168         [Whether to compile with optimization flags.
1169          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1170          otherwise.]))
1172 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1173     AS_HELP_STRING([--disable-runtime-optimizations],
1174         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1175          JVM JIT) that are known to interact badly with certain dynamic analysis
1176          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1177          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1178          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1180 AC_ARG_WITH(valgrind,
1181     AS_HELP_STRING([--with-valgrind],
1182         [Make availability of Valgrind headers a hard requirement.]))
1184 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1185     AS_HELP_STRING([--enable-compiler-plugins],
1186         [Enable compiler plugins that will perform additional checks during
1187          building. Enabled automatically by --enable-dbgutil.
1188          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1189 COMPILER_PLUGINS_DEBUG=
1190 if test "$enable_compiler_plugins" = debug; then
1191     enable_compiler_plugins=yes
1192     COMPILER_PLUGINS_DEBUG=TRUE
1195 libo_FUZZ_ARG_ENABLE(ooenv,
1196     AS_HELP_STRING([--disable-ooenv],
1197         [Disable ooenv for the instdir installation.]))
1199 libo_FUZZ_ARG_ENABLE(libnumbertext,
1200     AS_HELP_STRING([--disable-libnumbertext],
1201         [Disable use of numbertext external library.]))
1203 AC_ARG_ENABLE(lto,
1204     AS_HELP_STRING([--enable-lto],
1205         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1206          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1207          linker. For MSVC, this option is broken at the moment. This is experimental work
1208          in progress that shouldn't be used unless you are working on it.)]))
1210 AC_ARG_ENABLE(python,
1211     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1212         [Enables or disables Python support at run-time.
1213          Also specifies what Python to use. 'auto' is the default.
1214          'fully-internal' even forces the internal version for uses of Python
1215          during the build.]))
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(introspection,
1223     AS_HELP_STRING([--enable-introspection],
1224         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1225          Linux distributions.)]))
1227 AC_ARG_ENABLE(split-app-modules,
1228     AS_HELP_STRING([--enable-split-app-modules],
1229         [Split file lists for app modules, e.g. base, calc.
1230          Has effect only with make distro-pack-install]),
1233 AC_ARG_ENABLE(split-opt-features,
1234     AS_HELP_STRING([--enable-split-opt-features],
1235         [Split file lists for some optional features, e.g. pyuno, testtool.
1236          Has effect only with make distro-pack-install]),
1239 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1240     AS_HELP_STRING([--disable-cairo-canvas],
1241         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1244 libo_FUZZ_ARG_ENABLE(dbus,
1245     AS_HELP_STRING([--disable-dbus],
1246         [Determines whether to enable features that depend on dbus.
1247          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1248 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote,
1251     AS_HELP_STRING([--disable-sdremote],
1252         [Determines whether to enable Impress remote control (i.e. the server component).]),
1253 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1255 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1256     AS_HELP_STRING([--disable-sdremote-bluetooth],
1257         [Determines whether to build sdremote with bluetooth support.
1258          Requires dbus on Linux.]))
1260 libo_FUZZ_ARG_ENABLE(gio,
1261     AS_HELP_STRING([--disable-gio],
1262         [Determines whether to use the GIO support.]),
1263 ,test "${enable_gio+set}" = set || enable_gio=yes)
1265 AC_ARG_ENABLE(qt5,
1266     AS_HELP_STRING([--enable-qt5],
1267         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1268          available.]),
1271 AC_ARG_ENABLE(kf5,
1272     AS_HELP_STRING([--enable-kf5],
1273         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1274          KF5 are available.]),
1277 AC_ARG_ENABLE(kde5,
1278     AS_HELP_STRING([--enable-kde5],
1279         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1282 AC_ARG_ENABLE(gtk3_kde5,
1283     AS_HELP_STRING([--enable-gtk3-kde5],
1284         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1285          platforms where Gtk3, Qt5 and Plasma is available.]),
1288 AC_ARG_ENABLE(gui,
1289     AS_HELP_STRING([--disable-gui],
1290         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1291 ,enable_gui=yes)
1293 libo_FUZZ_ARG_ENABLE(randr,
1294     AS_HELP_STRING([--disable-randr],
1295         [Disable RandR support in the vcl project.]),
1296 ,test "${enable_randr+set}" = set || enable_randr=yes)
1298 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1299     AS_HELP_STRING([--disable-gstreamer-1-0],
1300         [Disable building with the gstreamer 1.0 avmedia backend.]),
1301 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1375          Additionally ccache's depend mode is enabled if possible,
1376          use --enable-ccache=nodepend to enable ccache without depend mode.
1380 AC_ARG_ENABLE(64-bit,
1381     AS_HELP_STRING([--enable-64-bit],
1382         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1383          At the moment meaningful only for Windows.]), ,)
1385 libo_FUZZ_ARG_ENABLE(online-update,
1386     AS_HELP_STRING([--enable-online-update],
1387         [Enable the online update service that will check for new versions of
1388          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1389          If the value is "mar", the experimental Mozilla-like update will be
1390          enabled instead of the traditional update mechanism.]),
1393 AC_ARG_WITH(update-config,
1394     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1395                    [Path to the update config ini file]))
1397 libo_FUZZ_ARG_ENABLE(extension-update,
1398     AS_HELP_STRING([--disable-extension-update],
1399         [Disable possibility to update installed extensions.]),
1402 libo_FUZZ_ARG_ENABLE(release-build,
1403     AS_HELP_STRING([--enable-release-build],
1404         [Enable release build. Note that the "release build" choice is orthogonal to
1405          whether symbols are present, debug info is generated, or optimization
1406          is done.
1407          See http://wiki.documentfoundation.org/Development/DevBuild]),
1410 AC_ARG_ENABLE(windows-build-signing,
1411     AS_HELP_STRING([--enable-windows-build-signing],
1412         [Enable signing of windows binaries (*.exe, *.dll)]),
1415 AC_ARG_ENABLE(silent-msi,
1416     AS_HELP_STRING([--enable-silent-msi],
1417         [Enable MSI with LIMITUI=1 (silent install).]),
1420 AC_ARG_ENABLE(macosx-code-signing,
1421     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1422         [Sign executables, dylibs, frameworks and the app bundle. If you
1423          don't provide an identity the first suitable certificate
1424          in your keychain is used.]),
1427 AC_ARG_ENABLE(macosx-package-signing,
1428     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1429         [Create a .pkg suitable for uploading to the Mac App Store and sign
1430          it. If you don't provide an identity the first suitable certificate
1431          in your keychain is used.]),
1434 AC_ARG_ENABLE(macosx-sandbox,
1435     AS_HELP_STRING([--enable-macosx-sandbox],
1436         [Make the app bundle run in a sandbox. Requires code signing.
1437          Is required by apps distributed in the Mac App Store, and implies
1438          adherence to App Store rules.]),
1441 AC_ARG_WITH(macosx-bundle-identifier,
1442     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1443         [Define the macOS bundle identifier. Default is the somewhat weird
1444          org.libreoffice.script ("script", huh?).]),
1445 ,with_macosx_bundle_identifier=org.libreoffice.script)
1447 AC_ARG_WITH(product-name,
1448     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1449         [Define the product name. Default is AC_PACKAGE_NAME.]),
1450 ,with_product_name=$PRODUCTNAME)
1452 AC_ARG_WITH(package-version,
1453     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1454         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1457 libo_FUZZ_ARG_ENABLE(readonly-installset,
1458     AS_HELP_STRING([--enable-readonly-installset],
1459         [Prevents any attempts by LibreOffice to write into its installation. That means
1460          at least that no "system-wide" extensions can be added. Partly experimental work in
1461          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1464 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1465     AS_HELP_STRING([--disable-postgresql-sdbc],
1466         [Disable the build of the PostgreSQL-SDBC driver.])
1469 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1470     AS_HELP_STRING([--disable-lotuswordpro],
1471         [Disable the build of the Lotus Word Pro filter.]),
1472 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1474 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1475     AS_HELP_STRING([--disable-firebird-sdbc],
1476         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1477 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1479 AC_ARG_ENABLE(bogus-pkg-config,
1480     AS_HELP_STRING([--enable-bogus-pkg-config],
1481         [MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
1484 AC_ARG_ENABLE(openssl,
1485     AS_HELP_STRING([--disable-openssl],
1486         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1487          components will either use GNUTLS or NSS. Work in progress,
1488          use only if you are hacking on it.]),
1489 ,enable_openssl=yes)
1491 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1492     AS_HELP_STRING([--enable-cipher-openssl-backend],
1493         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1494          Requires --enable-openssl.]))
1496 AC_ARG_ENABLE(library-bin-tar,
1497     AS_HELP_STRING([--enable-library-bin-tar],
1498         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1499         Some libraries can save their build result in a tarball
1500         stored in TARFILE_LOCATION. That binary tarball is
1501         uniquely identified by the source tarball,
1502         the content of the config_host.mk file and the content
1503         of the top-level directory in core for that library
1504         If this option is enabled, then if such a tarfile exist, it will be untarred
1505         instead of the source tarfile, and the build step will be skipped for that
1506         library.
1507         If a proper tarfile does not exist, then the normal source-based
1508         build is done for that library and a proper binary tarfile is created
1509         for the next time.]),
1512 AC_ARG_ENABLE(dconf,
1513     AS_HELP_STRING([--disable-dconf],
1514         [Disable the dconf configuration backend (enabled by default where
1515          available).]))
1517 libo_FUZZ_ARG_ENABLE(formula-logger,
1518     AS_HELP_STRING(
1519         [--enable-formula-logger],
1520         [Enable formula logger for logging formula calculation flow in Calc.]
1521     )
1524 AC_ARG_ENABLE(ldap,
1525     AS_HELP_STRING([--disable-ldap],
1526         [Disable LDAP support.]),
1527 ,enable_ldap=yes)
1529 dnl ===================================================================
1530 dnl Optional Packages (--with/without-)
1531 dnl ===================================================================
1533 AC_ARG_WITH(gcc-home,
1534     AS_HELP_STRING([--with-gcc-home],
1535         [Specify the location of gcc/g++ manually. This can be used in conjunction
1536          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1537          non-default path.]),
1540 AC_ARG_WITH(gnu-patch,
1541     AS_HELP_STRING([--with-gnu-patch],
1542         [Specify location of GNU patch on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(build-platform-configure-options,
1546     AS_HELP_STRING([--with-build-platform-configure-options],
1547         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1550 AC_ARG_WITH(gnu-cp,
1551     AS_HELP_STRING([--with-gnu-cp],
1552         [Specify location of GNU cp on Solaris or FreeBSD.]),
1555 AC_ARG_WITH(external-tar,
1556     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1557         [Specify an absolute path of where to find (and store) tarfiles.]),
1558     TARFILE_LOCATION=$withval ,
1561 AC_ARG_WITH(referenced-git,
1562     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1563         [Specify another checkout directory to reference. This makes use of
1564                  git submodule update --reference, and saves a lot of diskspace
1565                  when having multiple trees side-by-side.]),
1566     GIT_REFERENCE_SRC=$withval ,
1569 AC_ARG_WITH(linked-git,
1570     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1571         [Specify a directory where the repositories of submodules are located.
1572          This uses a method similar to git-new-workdir to get submodules.]),
1573     GIT_LINK_SRC=$withval ,
1576 AC_ARG_WITH(galleries,
1577     AS_HELP_STRING([--with-galleries],
1578         [Specify how galleries should be built. It is possible either to
1579          build these internally from source ("build"),
1580          or to disable them ("no")]),
1583 AC_ARG_WITH(theme,
1584     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1585         [Choose which themes to include. By default those themes with an '*' are included.
1586          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *cib, *colibre, *colibre_svg, *elementary,
1587          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1590 libo_FUZZ_ARG_WITH(helppack-integration,
1591     AS_HELP_STRING([--without-helppack-integration],
1592         [It will not integrate the helppacks to the installer
1593          of the product. Please use this switch to use the online help
1594          or separate help packages.]),
1597 libo_FUZZ_ARG_WITH(fonts,
1598     AS_HELP_STRING([--without-fonts],
1599         [LibreOffice includes some third-party fonts to provide a reliable basis for
1600          help content, templates, samples, etc. When these fonts are already
1601          known to be available on the system then you should use this option.]),
1604 AC_ARG_WITH(epm,
1605     AS_HELP_STRING([--with-epm],
1606         [Decides which epm to use. Default is to use the one from the system if
1607          one is built. When either this is not there or you say =internal epm
1608          will be built.]),
1611 AC_ARG_WITH(package-format,
1612     AS_HELP_STRING([--with-package-format],
1613         [Specify package format(s) for LibreOffice installation sets. The
1614          implicit --without-package-format leads to no installation sets being
1615          generated. Possible values: aix, archive, bsd, deb, dmg,
1616          installed, msi, pkg, and rpm.
1617          Example: --with-package-format='deb rpm']),
1620 AC_ARG_WITH(tls,
1621     AS_HELP_STRING([--with-tls],
1622         [Decides which TLS/SSL and cryptographic implementations to use for
1623          LibreOffice's code. Notice that this doesn't apply for depending
1624          libraries like "neon", for example. Default is to use OpenSSL
1625          although NSS is also possible. Notice that selecting NSS restricts
1626          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1627          restrict by now the usage of NSS in LO's code. Possible values:
1628          openssl, nss. Example: --with-tls="nss"]),
1631 AC_ARG_WITH(system-libs,
1632     AS_HELP_STRING([--with-system-libs],
1633         [Use libraries already on system -- enables all --with-system-* flags.]),
1636 AC_ARG_WITH(system-bzip2,
1637     AS_HELP_STRING([--with-system-bzip2],
1638         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1639     [with_system_bzip2="$with_system_libs"])
1641 AC_ARG_WITH(system-headers,
1642     AS_HELP_STRING([--with-system-headers],
1643         [Use headers already on system -- enables all --with-system-* flags for
1644          external packages whose headers are the only entities used i.e.
1645          boost/odbc/sane-header(s).]),,
1646     [with_system_headers="$with_system_libs"])
1648 AC_ARG_WITH(system-jars,
1649     AS_HELP_STRING([--without-system-jars],
1650         [When building with --with-system-libs, also the needed jars are expected
1651          on the system. Use this to disable that]),,
1652     [with_system_jars="$with_system_libs"])
1654 AC_ARG_WITH(system-cairo,
1655     AS_HELP_STRING([--with-system-cairo],
1656         [Use cairo libraries already on system.  Happens automatically for
1657          (implicit) --enable-gtk3.]))
1659 AC_ARG_WITH(system-epoxy,
1660     AS_HELP_STRING([--with-system-epoxy],
1661         [Use epoxy libraries already on system.  Happens automatically for
1662          (implicit) --enable-gtk3.]),,
1663        [with_system_epoxy="$with_system_libs"])
1665 AC_ARG_WITH(myspell-dicts,
1666     AS_HELP_STRING([--with-myspell-dicts],
1667         [Adds myspell dictionaries to the LibreOffice installation set]),
1670 AC_ARG_WITH(system-dicts,
1671     AS_HELP_STRING([--without-system-dicts],
1672         [Do not use dictionaries from system paths.]),
1675 AC_ARG_WITH(external-dict-dir,
1676     AS_HELP_STRING([--with-external-dict-dir],
1677         [Specify external dictionary dir.]),
1680 AC_ARG_WITH(external-hyph-dir,
1681     AS_HELP_STRING([--with-external-hyph-dir],
1682         [Specify external hyphenation pattern dir.]),
1685 AC_ARG_WITH(external-thes-dir,
1686     AS_HELP_STRING([--with-external-thes-dir],
1687         [Specify external thesaurus dir.]),
1690 AC_ARG_WITH(system-zlib,
1691     AS_HELP_STRING([--with-system-zlib],
1692         [Use zlib already on system.]),,
1693     [with_system_zlib=auto])
1695 AC_ARG_WITH(system-jpeg,
1696     AS_HELP_STRING([--with-system-jpeg],
1697         [Use jpeg already on system.]),,
1698     [with_system_jpeg="$with_system_libs"])
1700 AC_ARG_WITH(system-clucene,
1701     AS_HELP_STRING([--with-system-clucene],
1702         [Use clucene already on system.]),,
1703     [with_system_clucene="$with_system_libs"])
1705 AC_ARG_WITH(system-expat,
1706     AS_HELP_STRING([--with-system-expat],
1707         [Use expat already on system.]),,
1708     [with_system_expat="$with_system_libs"])
1710 AC_ARG_WITH(system-libxml,
1711     AS_HELP_STRING([--with-system-libxml],
1712         [Use libxml/libxslt already on system.]),,
1713     [with_system_libxml=auto])
1715 AC_ARG_WITH(system-icu,
1716     AS_HELP_STRING([--with-system-icu],
1717         [Use icu already on system.]),,
1718     [with_system_icu="$with_system_libs"])
1720 AC_ARG_WITH(system-ucpp,
1721     AS_HELP_STRING([--with-system-ucpp],
1722         [Use ucpp already on system.]),,
1723     [])
1725 AC_ARG_WITH(system-openldap,
1726     AS_HELP_STRING([--with-system-openldap],
1727         [Use the OpenLDAP LDAP SDK already on system.]),,
1728     [with_system_openldap="$with_system_libs"])
1730 libo_FUZZ_ARG_ENABLE(poppler,
1731     AS_HELP_STRING([--disable-poppler],
1732         [Disable building Poppler.])
1735 AC_ARG_WITH(system-poppler,
1736     AS_HELP_STRING([--with-system-poppler],
1737         [Use system poppler (only needed for PDF import).]),,
1738     [with_system_poppler="$with_system_libs"])
1740 AC_ARG_WITH(system-gpgmepp,
1741     AS_HELP_STRING([--with-system-gpgmepp],
1742         [Use gpgmepp already on system]),,
1743     [with_system_gpgmepp="$with_system_libs"])
1745 AC_ARG_WITH(system-apache-commons,
1746     AS_HELP_STRING([--with-system-apache-commons],
1747         [Use Apache commons libraries already on system.]),,
1748     [with_system_apache_commons="$with_system_jars"])
1750 AC_ARG_WITH(system-mariadb,
1751     AS_HELP_STRING([--with-system-mariadb],
1752         [Use MariaDB/MySQL libraries already on system.]),,
1753     [with_system_mariadb="$with_system_libs"])
1755 AC_ARG_ENABLE(bundle-mariadb,
1756     AS_HELP_STRING([--enable-bundle-mariadb],
1757         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1760 AC_ARG_WITH(system-postgresql,
1761     AS_HELP_STRING([--with-system-postgresql],
1762         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1763          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1764     [with_system_postgresql="$with_system_libs"])
1766 AC_ARG_WITH(libpq-path,
1767     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1768         [Use this PostgreSQL C interface (libpq) installation for building
1769          the PostgreSQL-SDBC extension.]),
1772 AC_ARG_WITH(system-firebird,
1773     AS_HELP_STRING([--with-system-firebird],
1774         [Use Firebird libraries already on system, for building the Firebird-SDBC
1775          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1776     [with_system_firebird="$with_system_libs"])
1778 AC_ARG_WITH(system-libtommath,
1779             AS_HELP_STRING([--with-system-libtommath],
1780                            [Use libtommath already on system]),,
1781             [with_system_libtommath="$with_system_libs"])
1783 AC_ARG_WITH(system-hsqldb,
1784     AS_HELP_STRING([--with-system-hsqldb],
1785         [Use hsqldb already on system.]))
1787 AC_ARG_WITH(hsqldb-jar,
1788     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     HSQLDB_JAR=$withval)
1792 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1793     AS_HELP_STRING([--disable-scripting-beanshell],
1794         [Disable support for scripts in BeanShell.]),
1798 AC_ARG_WITH(system-beanshell,
1799     AS_HELP_STRING([--with-system-beanshell],
1800         [Use beanshell already on system.]),,
1801     [with_system_beanshell="$with_system_jars"])
1803 AC_ARG_WITH(beanshell-jar,
1804     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     BSH_JAR=$withval)
1808 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1809     AS_HELP_STRING([--disable-scripting-javascript],
1810         [Disable support for scripts in JavaScript.]),
1814 AC_ARG_WITH(system-rhino,
1815     AS_HELP_STRING([--with-system-rhino],
1816         [Use rhino already on system.]),,)
1817 #    [with_system_rhino="$with_system_jars"])
1818 # Above is not used as we have different debug interface
1819 # patched into internal rhino. This code needs to be fixed
1820 # before we can enable it by default.
1822 AC_ARG_WITH(rhino-jar,
1823     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     RHINO_JAR=$withval)
1827 AC_ARG_WITH(commons-logging-jar,
1828     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     COMMONS_LOGGING_JAR=$withval)
1832 AC_ARG_WITH(system-jfreereport,
1833     AS_HELP_STRING([--with-system-jfreereport],
1834         [Use JFreeReport already on system.]),,
1835     [with_system_jfreereport="$with_system_jars"])
1837 AC_ARG_WITH(sac-jar,
1838     AS_HELP_STRING([--with-sac-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     SAC_JAR=$withval)
1842 AC_ARG_WITH(libxml-jar,
1843     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     LIBXML_JAR=$withval)
1847 AC_ARG_WITH(flute-jar,
1848     AS_HELP_STRING([--with-flute-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     FLUTE_JAR=$withval)
1852 AC_ARG_WITH(jfreereport-jar,
1853     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     JFREEREPORT_JAR=$withval)
1857 AC_ARG_WITH(liblayout-jar,
1858     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBLAYOUT_JAR=$withval)
1862 AC_ARG_WITH(libloader-jar,
1863     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBLOADER_JAR=$withval)
1867 AC_ARG_WITH(libformula-jar,
1868     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFORMULA_JAR=$withval)
1872 AC_ARG_WITH(librepository-jar,
1873     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBREPOSITORY_JAR=$withval)
1877 AC_ARG_WITH(libfonts-jar,
1878     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBFONTS_JAR=$withval)
1882 AC_ARG_WITH(libserializer-jar,
1883     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBSERIALIZER_JAR=$withval)
1887 AC_ARG_WITH(libbase-jar,
1888     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBBASE_JAR=$withval)
1892 AC_ARG_WITH(system-odbc,
1893     AS_HELP_STRING([--with-system-odbc],
1894         [Use the odbc headers already on system.]),,
1895     [with_system_odbc="auto"])
1897 AC_ARG_WITH(system-sane,
1898     AS_HELP_STRING([--with-system-sane],
1899         [Use sane.h already on system.]),,
1900     [with_system_sane="$with_system_headers"])
1902 AC_ARG_WITH(system-bluez,
1903     AS_HELP_STRING([--with-system-bluez],
1904         [Use bluetooth.h already on system.]),,
1905     [with_system_bluez="$with_system_headers"])
1907 AC_ARG_WITH(system-curl,
1908     AS_HELP_STRING([--with-system-curl],
1909         [Use curl already on system.]),,
1910     [with_system_curl=auto])
1912 AC_ARG_WITH(system-boost,
1913     AS_HELP_STRING([--with-system-boost],
1914         [Use boost already on system.]),,
1915     [with_system_boost="$with_system_headers"])
1917 AC_ARG_WITH(system-glm,
1918     AS_HELP_STRING([--with-system-glm],
1919         [Use glm already on system.]),,
1920     [with_system_glm="$with_system_headers"])
1922 AC_ARG_WITH(system-hunspell,
1923     AS_HELP_STRING([--with-system-hunspell],
1924         [Use libhunspell already on system.]),,
1925     [with_system_hunspell="$with_system_libs"])
1927 libo_FUZZ_ARG_ENABLE(qrcodegen,
1928     AS_HELP_STRING([--disable-qrcodegen],
1929         [Disable use of qrcodegen external library.]))
1931 AC_ARG_WITH(system-qrcodegen,
1932     AS_HELP_STRING([--with-system-qrcodegen],
1933         [Use libqrcodegen already on system.]),,
1934     [with_system_qrcodegen="$with_system_libs"])
1936 AC_ARG_WITH(system-mythes,
1937     AS_HELP_STRING([--with-system-mythes],
1938         [Use mythes already on system.]),,
1939     [with_system_mythes="$with_system_libs"])
1941 AC_ARG_WITH(system-altlinuxhyph,
1942     AS_HELP_STRING([--with-system-altlinuxhyph],
1943         [Use ALTLinuxhyph already on system.]),,
1944     [with_system_altlinuxhyph="$with_system_libs"])
1946 AC_ARG_WITH(system-lpsolve,
1947     AS_HELP_STRING([--with-system-lpsolve],
1948         [Use lpsolve already on system.]),,
1949     [with_system_lpsolve="$with_system_libs"])
1951 AC_ARG_WITH(system-coinmp,
1952     AS_HELP_STRING([--with-system-coinmp],
1953         [Use CoinMP already on system.]),,
1954     [with_system_coinmp="$with_system_libs"])
1956 AC_ARG_WITH(system-liblangtag,
1957     AS_HELP_STRING([--with-system-liblangtag],
1958         [Use liblangtag library already on system.]),,
1959     [with_system_liblangtag="$with_system_libs"])
1961 AC_ARG_WITH(webdav,
1962     AS_HELP_STRING([--with-webdav],
1963         [Specify which library to use for webdav implementation.
1964          Possible values: "neon", "serf", "no". The default value is "neon".
1965          Example: --with-webdav="serf"]),
1966     WITH_WEBDAV=$withval,
1967     WITH_WEBDAV="neon")
1969 AC_ARG_WITH(linker-hash-style,
1970     AS_HELP_STRING([--with-linker-hash-style],
1971         [Use linker with --hash-style=<style> when linking shared objects.
1972          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1973          if supported on the build system, and "sysv" otherwise.]))
1975 AC_ARG_WITH(jdk-home,
1976     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1977         [If you have installed JDK 8 or later on your system please supply the
1978          path here. Note that this is not the location of the java command but the
1979          location of the entire distribution.]),
1982 AC_ARG_WITH(help,
1983     AS_HELP_STRING([--with-help],
1984         [Enable the build of help. There is a special parameter "common" that
1985          can be used to bundle only the common part, .e.g help-specific icons.
1986          This is useful when you build the helpcontent separately.])
1987     [
1988                           Usage:     --with-help    build the old local help
1989                                  --without-help     no local help (default)
1990                                  --with-help=html   build the new HTML local help
1991                                  --with-help=online build the new HTML online help
1992     ],
1995 AC_ARG_WITH(omindex,
1996    AS_HELP_STRING([--with-omindex],
1997         [Enable the support of xapian-omega index for online help.])
1998    [
1999                          Usage: --with-omindex=server prepare the pages for omindex
2000                                 but let xapian-omega be built in server.
2001                                 --with-omindex=noxap do not prepare online pages
2002                                 for xapian-omega
2003   ],
2006 libo_FUZZ_ARG_WITH(java,
2007     AS_HELP_STRING([--with-java=<java command>],
2008         [Specify the name of the Java interpreter command. Typically "java"
2009          which is the default.
2011          To build without support for Java components, applets, accessibility
2012          or the XML filters written in Java, use --without-java or --with-java=no.]),
2013     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2014     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2017 AC_ARG_WITH(jvm-path,
2018     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2019         [Use a specific JVM search path at runtime.
2020          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2023 AC_ARG_WITH(ant-home,
2024     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2025         [If you have installed Apache Ant on your system, please supply the path here.
2026          Note that this is not the location of the Ant binary but the location
2027          of the entire distribution.]),
2030 AC_ARG_WITH(symbol-config,
2031     AS_HELP_STRING([--with-symbol-config],
2032         [Configuration for the crashreport symbol upload]),
2033         [],
2034         [with_symbol_config=no])
2036 AC_ARG_WITH(export-validation,
2037     AS_HELP_STRING([--without-export-validation],
2038         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2039 ,with_export_validation=auto)
2041 AC_ARG_WITH(bffvalidator,
2042     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2043         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2044          Requires installed Microsoft Office Binary File Format Validator.
2045          Note: export-validation (--with-export-validation) is required to be turned on.
2046          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2047 ,with_bffvalidator=no)
2049 libo_FUZZ_ARG_WITH(junit,
2050     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2051         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2052          --without-junit disables those tests. Not relevant in the --without-java case.]),
2053 ,with_junit=yes)
2055 AC_ARG_WITH(hamcrest,
2056     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2057         [Specifies the hamcrest jar file to use for JUnit-based tests.
2058          --without-junit disables those tests. Not relevant in the --without-java case.]),
2059 ,with_hamcrest=yes)
2061 AC_ARG_WITH(perl-home,
2062     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2063         [If you have installed Perl 5 Distribution, on your system, please
2064          supply the path here. Note that this is not the location of the Perl
2065          binary but the location of the entire distribution.]),
2068 libo_FUZZ_ARG_WITH(doxygen,
2069     AS_HELP_STRING(
2070         [--with-doxygen=<absolute path to doxygen executable>],
2071         [Specifies the doxygen executable to use when generating ODK C/C++
2072          documentation. --without-doxygen disables generation of ODK C/C++
2073          documentation. Not relevant in the --disable-odk case.]),
2074 ,with_doxygen=yes)
2076 AC_ARG_WITH(visual-studio,
2077     AS_HELP_STRING([--with-visual-studio=<2017>],
2078         [Specify which Visual Studio version to use in case several are
2079          installed. Currently only 2017 is supported.]),
2082 AC_ARG_WITH(windows-sdk,
2083     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2084         [Specify which Windows SDK, or "Windows Kit", version to use
2085          in case the one that came with the selected Visual Studio
2086          is not what you want for some reason. Note that not all compiler/SDK
2087          combinations are supported. The intent is that this option should not
2088          be needed.]),
2091 AC_ARG_WITH(lang,
2092     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2093         [Use this option to build LibreOffice with additional UI language support.
2094          English (US) is always included by default.
2095          Separate multiple languages with space.
2096          For all languages, use --with-lang=ALL.]),
2099 AC_ARG_WITH(locales,
2100     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2101         [Use this option to limit the locale information built in.
2102          Separate multiple locales with space.
2103          Very experimental and might well break stuff.
2104          Just a desperate measure to shrink code and data size.
2105          By default all the locales available is included.
2106          This option is completely unrelated to --with-lang.])
2107     [
2108                           Affects also our character encoding conversion
2109                           tables for encodings mainly targeted for a
2110                           particular locale, like EUC-CN and EUC-TW for
2111                           zh, ISO-2022-JP for ja.
2113                           Affects also our add-on break iterator data for
2114                           some languages.
2116                           For the default, all locales, don't use this switch at all.
2117                           Specifying just the language part of a locale means all matching
2118                           locales will be included.
2119     ],
2122 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2123 libo_FUZZ_ARG_WITH(krb5,
2124     AS_HELP_STRING([--with-krb5],
2125         [Enable MIT Kerberos 5 support in modules that support it.
2126          By default automatically enabled on platforms
2127          where a good system Kerberos 5 is available.]),
2130 libo_FUZZ_ARG_WITH(gssapi,
2131     AS_HELP_STRING([--with-gssapi],
2132         [Enable GSSAPI support in modules that support it.
2133          By default automatically enabled on platforms
2134          where a good system GSSAPI is available.]),
2137 AC_ARG_WITH(iwyu,
2138     AS_HELP_STRING([--with-iwyu],
2139         [Use given IWYU binary path to check unneeded includes instead of building.
2140          Use only if you are hacking on it.]),
2143 libo_FUZZ_ARG_WITH(lxml,
2144     AS_HELP_STRING([--without-lxml],
2145         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2146          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2147          report widget classes and ids.]),
2150 libo_FUZZ_ARG_WITH(latest-c++,
2151     AS_HELP_STRING([--with-latest-c++],
2152         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2153          published standard.]),,
2154         [with_latest_c__=no])
2156 dnl ===================================================================
2157 dnl Branding
2158 dnl ===================================================================
2160 AC_ARG_WITH(branding,
2161     AS_HELP_STRING([--with-branding=/path/to/images],
2162         [Use given path to retrieve branding images set.])
2163     [
2164                           Search for intro.png about.svg and flat_logo.svg.
2165                           If any is missing, default ones will be used instead.
2167                           Search also progress.conf for progress
2168                           settings on intro screen :
2170                           PROGRESSBARCOLOR="255,255,255" Set color of
2171                           progress bar. Comma separated RGB decimal values.
2172                           PROGRESSSIZE="407,6" Set size of progress bar.
2173                           Comma separated decimal values (width, height).
2174                           PROGRESSPOSITION="61,317" Set position of progress
2175                           bar from left,top. Comma separated decimal values.
2176                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2177                           bar frame. Comma separated RGB decimal values.
2178                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2179                           bar text. Comma separated RGB decimal values.
2180                           PROGRESSTEXTBASELINE="287" Set vertical position of
2181                           progress bar text from top. Decimal value.
2183                           Default values will be used if not found.
2184     ],
2188 AC_ARG_WITH(extra-buildid,
2189     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2190         [Show addition build identification in about dialog.]),
2194 AC_ARG_WITH(vendor,
2195     AS_HELP_STRING([--with-vendor="John the Builder"],
2196         [Set vendor of the build.]),
2199 AC_ARG_WITH(android-package-name,
2200     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2201         [Set Android package name of the build.]),
2204 AC_ARG_WITH(compat-oowrappers,
2205     AS_HELP_STRING([--with-compat-oowrappers],
2206         [Install oo* wrappers in parallel with
2207          lo* ones to keep backward compatibility.
2208          Has effect only with make distro-pack-install]),
2211 AC_ARG_WITH(os-version,
2212     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2213         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2216 AC_ARG_WITH(mingw-cross-compiler,
2217     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2218         [Specify the MinGW cross-compiler to use.
2219          When building on the ODK on Unix and building unowinreg.dll,
2220          specify the MinGW C++ cross-compiler.]),
2223 AC_ARG_WITH(idlc-cpp,
2224     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2225         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2228 AC_ARG_WITH(build-version,
2229     AS_HELP_STRING([--with-build-version="Built by Jim"],
2230         [Allows the builder to add a custom version tag that will appear in the
2231          Help/About box for QA purposes.]),
2232 with_build_version=$withval,
2235 AC_ARG_WITH(parallelism,
2236     AS_HELP_STRING([--with-parallelism],
2237         [Number of jobs to run simultaneously during build. Parallel builds can
2238         save a lot of time on multi-cpu machines. Defaults to the number of
2239         CPUs on the machine, unless you configure --enable-icecream - then to
2240         40.]),
2243 AC_ARG_WITH(all-tarballs,
2244     AS_HELP_STRING([--with-all-tarballs],
2245         [Download all external tarballs unconditionally]))
2247 AC_ARG_WITH(gdrive-client-id,
2248     AS_HELP_STRING([--with-gdrive-client-id],
2249         [Provides the client id of the application for OAuth2 authentication
2250         on Google Drive. If either this or --with-gdrive-client-secret is
2251         empty, the feature will be disabled]),
2254 AC_ARG_WITH(gdrive-client-secret,
2255     AS_HELP_STRING([--with-gdrive-client-secret],
2256         [Provides the client secret of the application for OAuth2
2257         authentication on Google Drive. If either this or
2258         --with-gdrive-client-id is empty, the feature will be disabled]),
2261 AC_ARG_WITH(alfresco-cloud-client-id,
2262     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2263         [Provides the client id of the application for OAuth2 authentication
2264         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2265         empty, the feature will be disabled]),
2268 AC_ARG_WITH(alfresco-cloud-client-secret,
2269     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2270         [Provides the client secret of the application for OAuth2
2271         authentication on Alfresco Cloud. If either this or
2272         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2275 AC_ARG_WITH(onedrive-client-id,
2276     AS_HELP_STRING([--with-onedrive-client-id],
2277         [Provides the client id of the application for OAuth2 authentication
2278         on OneDrive. If either this or --with-onedrive-client-secret is
2279         empty, the feature will be disabled]),
2282 AC_ARG_WITH(onedrive-client-secret,
2283     AS_HELP_STRING([--with-onedrive-client-secret],
2284         [Provides the client secret of the application for OAuth2
2285         authentication on OneDrive. If either this or
2286         --with-onedrive-client-id is empty, the feature will be disabled]),
2288 dnl ===================================================================
2289 dnl Do we want to use pre-build binary tarball for recompile
2290 dnl ===================================================================
2292 if test "$enable_library_bin_tar" = "yes" ; then
2293     USE_LIBRARY_BIN_TAR=TRUE
2294 else
2295     USE_LIBRARY_BIN_TAR=
2297 AC_SUBST(USE_LIBRARY_BIN_TAR)
2299 dnl ===================================================================
2300 dnl Test whether build target is Release Build
2301 dnl ===================================================================
2302 AC_MSG_CHECKING([whether build target is Release Build])
2303 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2304     AC_MSG_RESULT([no])
2305     ENABLE_RELEASE_BUILD=
2306 else
2307     AC_MSG_RESULT([yes])
2308     ENABLE_RELEASE_BUILD=TRUE
2310 AC_SUBST(ENABLE_RELEASE_BUILD)
2312 dnl ===================================================================
2313 dnl Test whether to sign Windows Build
2314 dnl ===================================================================
2315 AC_MSG_CHECKING([whether to sign windows build])
2316 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2317     AC_MSG_RESULT([yes])
2318     WINDOWS_BUILD_SIGNING="TRUE"
2319 else
2320     AC_MSG_RESULT([no])
2321     WINDOWS_BUILD_SIGNING="FALSE"
2323 AC_SUBST(WINDOWS_BUILD_SIGNING)
2325 dnl ===================================================================
2326 dnl MacOSX build and runtime environment options
2327 dnl ===================================================================
2329 AC_ARG_WITH(macosx-sdk,
2330     AS_HELP_STRING([--with-macosx-sdk=<version>],
2331         [Prefer a specific SDK for building.])
2332     [
2333                           If the requested SDK is not available, a search for the oldest one will be done.
2334                           With current Xcode versions, only the latest SDK is included, so this option is
2335                           not terribly useful. It works fine to build with a new SDK and run the result
2336                           on an older OS.
2338                           e. g.: --with-macosx-sdk=10.10
2340                           there are 3 options to control the MacOSX build:
2341                           --with-macosx-sdk (referred as 'sdk' below)
2342                           --with-macosx-version-min-required (referred as 'min' below)
2343                           --with-macosx-version-max-allowed (referred as 'max' below)
2345                           the connection between these value and the default they take is as follow:
2346                           ( ? means not specified on the command line, s means the SDK version found,
2347                           constraint: 8 <= x <= y <= z)
2349                           ==========================================
2350                            command line      || config result
2351                           ==========================================
2352                           min  | max  | sdk  || min   | max  | sdk  |
2353                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2354                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2355                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2356                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2357                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2358                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2359                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2360                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2363                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2364                           for a detailed technical explanation of these variables
2366                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2367     ],
2370 AC_ARG_WITH(macosx-version-min-required,
2371     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2372         [set the minimum OS version needed to run the built LibreOffice])
2373     [
2374                           e. g.: --with-macos-version-min-required=10.10
2375                           see --with-macosx-sdk for more info
2376     ],
2379 AC_ARG_WITH(macosx-version-max-allowed,
2380     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2381         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2382     [
2383                           e. g.: --with-macos-version-max-allowed=10.10
2384                           see --with-macosx-sdk for more info
2385     ],
2389 dnl ===================================================================
2390 dnl options for stuff used during cross-compilation build
2391 dnl Not quite superseded by --with-build-platform-configure-options.
2392 dnl TODO: check, if the "force" option is still needed anywhere.
2393 dnl ===================================================================
2395 AC_ARG_WITH(system-icu-for-build,
2396     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2397         [Use icu already on system for build tools (cross-compilation only).]))
2400 dnl ===================================================================
2401 dnl Check for incompatible options set by fuzzing, and reset those
2402 dnl automatically to working combinations
2403 dnl ===================================================================
2405 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2406         "$enable_dbus" != "$enable_avahi"; then
2407     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2408     enable_avahi=$enable_dbus
2411 add_lopath_after ()
2413     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2414         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2415     fi
2418 add_lopath_before ()
2420     local IFS=${P_SEP}
2421     local path_cleanup
2422     local dir
2423     for dir in $LO_PATH ; do
2424         if test "$dir" != "$1" ; then
2425             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2426         fi
2427     done
2428     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2431 dnl ===================================================================
2432 dnl check for required programs (grep, awk, sed, bash)
2433 dnl ===================================================================
2435 pathmunge ()
2437     if test -n "$1"; then
2438         if test "$build_os" = "cygwin"; then
2439             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2440                 PathFormat "$1"
2441                 new_path=`cygpath -sm "$formatted_path"`
2442             else
2443                 PathFormat "$1"
2444                 new_path=`cygpath -u "$formatted_path"`
2445             fi
2446         else
2447             new_path="$1"
2448         fi
2449         if test "$2" = "after"; then
2450             add_lopath_after "$new_path"
2451         else
2452             add_lopath_before "$new_path"
2453         fi
2454         unset new_path
2455     fi
2458 AC_PROG_AWK
2459 AC_PATH_PROG( AWK, $AWK)
2460 if test -z "$AWK"; then
2461     AC_MSG_ERROR([install awk to run this script])
2464 AC_PATH_PROG(BASH, bash)
2465 if test -z "$BASH"; then
2466     AC_MSG_ERROR([bash not found in \$PATH])
2468 AC_SUBST(BASH)
2470 AC_MSG_CHECKING([for GNU or BSD tar])
2471 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2472     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2473     if test $? -eq 0;  then
2474         GNUTAR=$a
2475         break
2476     fi
2477 done
2478 AC_MSG_RESULT($GNUTAR)
2479 if test -z "$GNUTAR"; then
2480     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2482 AC_SUBST(GNUTAR)
2484 AC_MSG_CHECKING([for tar's option to strip components])
2485 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2486 if test $? -eq 0; then
2487     STRIP_COMPONENTS="--strip-components"
2488 else
2489     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2490     if test $? -eq 0; then
2491         STRIP_COMPONENTS="--strip-path"
2492     else
2493         STRIP_COMPONENTS="unsupported"
2494     fi
2496 AC_MSG_RESULT($STRIP_COMPONENTS)
2497 if test x$STRIP_COMPONENTS = xunsupported; then
2498     AC_MSG_ERROR([you need a tar that is able to strip components.])
2500 AC_SUBST(STRIP_COMPONENTS)
2502 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2503 dnl desktop OSes from "mobile" ones.
2505 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2506 dnl In other words, that when building for an OS that is not a
2507 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2509 dnl Note the direction of the implication; there is no assumption that
2510 dnl cross-compiling would imply a non-desktop OS.
2512 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2513     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2514     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2515     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2518 # Whether to build "avmedia" functionality or not.
2520 if test -z "$enable_avmedia"; then
2521     enable_avmedia=yes
2524 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2525 if test "$enable_avmedia" = yes; then
2526     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2527 else
2528     USE_AVMEDIA_DUMMY='TRUE'
2530 AC_SUBST(USE_AVMEDIA_DUMMY)
2532 # Decide whether to build database connectivity stuff (including
2533 # Base) or not. We probably don't want to on non-desktop OSes.
2534 if test -z "$enable_database_connectivity"; then
2535     # --disable-database-connectivity is unfinished work in progress
2536     # and the iOS test app doesn't link if we actually try to use it.
2537     # if test $_os != iOS -a $_os != Android; then
2538     if test $_os != iOS; then
2539         enable_database_connectivity=yes
2540     fi
2543 if test "$enable_database_connectivity" = yes; then
2544     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2545     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2548 if test -z "$enable_extensions"; then
2549     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2550     if test $_os != iOS -a $_os != Android; then
2551         enable_extensions=yes
2552     fi
2555 if test "$enable_extensions" = yes; then
2556     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2557     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2560 if test -z "$enable_scripting"; then
2561     # Disable scripting for iOS unless specifically overridden
2562     # with --enable-scripting.
2563     if test $_os != iOS; then
2564         enable_scripting=yes
2565     fi
2568 DISABLE_SCRIPTING=''
2569 if test "$enable_scripting" = yes; then
2570     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2571     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2572 else
2573     DISABLE_SCRIPTING='TRUE'
2574     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2577 if test $_os = iOS -o $_os = Android; then
2578     # Disable dynamic_loading always for iOS and Android
2579     enable_dynamic_loading=no
2580 elif test -z "$enable_dynamic_loading"; then
2581     # Otherwise enable it unless specifically disabled
2582     enable_dynamic_loading=yes
2585 DISABLE_DYNLOADING=''
2586 if test "$enable_dynamic_loading" = yes; then
2587     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2588 else
2589     DISABLE_DYNLOADING='TRUE'
2591 AC_SUBST(DISABLE_DYNLOADING)
2593 # remember SYSBASE value
2594 AC_SUBST(SYSBASE)
2596 dnl ===================================================================
2597 dnl  Sort out various gallery compilation options
2598 dnl ===================================================================
2599 AC_MSG_CHECKING([how to build and package galleries])
2600 if test -n "${with_galleries}"; then
2601     if test "$with_galleries" = "build"; then
2602         WITH_GALLERY_BUILD=TRUE
2603         AC_MSG_RESULT([build from source images internally])
2604     elif test "$with_galleries" = "no"; then
2605         WITH_GALLERY_BUILD=
2606         AC_MSG_RESULT([disable non-internal gallery build])
2607     else
2608         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2609     fi
2610 else
2611     if test $_os != iOS -a $_os != Android; then
2612         WITH_GALLERY_BUILD=TRUE
2613         AC_MSG_RESULT([internal src images for desktop])
2614     else
2615         WITH_GALLERY_BUILD=
2616         AC_MSG_RESULT([disable src image build])
2617     fi
2619 AC_SUBST(WITH_GALLERY_BUILD)
2621 dnl ===================================================================
2622 dnl  Checks if ccache is available
2623 dnl ===================================================================
2624 CCACHE_DEPEND_MODE=
2625 if test "$_os" = "WINNT"; then
2626     # on windows/VC build do not use ccache
2627     CCACHE=""
2628 elif test "$enable_ccache" = "no"; then
2629     CCACHE=""
2630 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2631     case "%$CC%$CXX%" in
2632     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2633     # assume that's good then
2634     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2635         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2636         CCACHE_DEPEND_MODE=1
2637         ;;
2638     *)
2639         AC_PATH_PROG([CCACHE],[ccache],[not found])
2640         if test "$CCACHE" = "not found"; then
2641             CCACHE=""
2642         else
2643             CCACHE_DEPEND_MODE=1
2644             # Need to check for ccache version: otherwise prevents
2645             # caching of the results (like "-x objective-c++" for Mac)
2646             if test $_os = Darwin -o $_os = iOS; then
2647                 # Check ccache version
2648                 AC_MSG_CHECKING([whether version of ccache is suitable])
2649                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2650                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2651                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2652                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2653                 else
2654                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2655                     CCACHE=""
2656                     CCACHE_DEPEND_MODE=
2657                 fi
2658             fi
2659         fi
2660         ;;
2661     esac
2662 else
2663     CCACHE=""
2665 if test "$enable_ccache" = "nodepend"; then
2666     CCACHE_DEPEND_MODE=""
2668 AC_SUBST(CCACHE_DEPEND_MODE)
2670 if test "$CCACHE" != ""; then
2671     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2672     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2673     if test "$ccache_size" = ""; then
2674         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2675         if test "$ccache_size" = ""; then
2676             ccache_size=0
2677         fi
2678         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2679         if test $ccache_size -lt 1024; then
2680             CCACHE=""
2681             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2682             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2683         else
2684             # warn that ccache may be too small for debug build
2685             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2686             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2687         fi
2688     else
2689         if test $ccache_size -lt 5; then
2690             #warn that ccache may be too small for debug build
2691             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2692             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2693         fi
2694     fi
2697 dnl ===================================================================
2698 dnl  Checks for C compiler,
2699 dnl  The check for the C++ compiler is later on.
2700 dnl ===================================================================
2701 if test "$_os" != "WINNT"; then
2702     GCC_HOME_SET="true"
2703     AC_MSG_CHECKING([gcc home])
2704     if test -z "$with_gcc_home"; then
2705         if test "$enable_icecream" = "yes"; then
2706             if test -d "/usr/lib/icecc/bin"; then
2707                 GCC_HOME="/usr/lib/icecc/"
2708             elif test -d "/usr/libexec/icecc/bin"; then
2709                 GCC_HOME="/usr/libexec/icecc/"
2710             elif test -d "/opt/icecream/bin"; then
2711                 GCC_HOME="/opt/icecream/"
2712             else
2713                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2715             fi
2716         else
2717             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2718             GCC_HOME_SET="false"
2719         fi
2720     else
2721         GCC_HOME="$with_gcc_home"
2722     fi
2723     AC_MSG_RESULT($GCC_HOME)
2724     AC_SUBST(GCC_HOME)
2726     if test "$GCC_HOME_SET" = "true"; then
2727         if test -z "$CC"; then
2728             CC="$GCC_HOME/bin/gcc"
2729             CC_BASE="gcc"
2730         fi
2731         if test -z "$CXX"; then
2732             CXX="$GCC_HOME/bin/g++"
2733             CXX_BASE="g++"
2734         fi
2735     fi
2738 COMPATH=`dirname "$CC"`
2739 if test "$COMPATH" = "."; then
2740     AC_PATH_PROGS(COMPATH, $CC)
2741     dnl double square bracket to get single because of M4 quote...
2742     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2744 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2746 dnl ===================================================================
2747 dnl Java support
2748 dnl ===================================================================
2749 AC_MSG_CHECKING([whether to build with Java support])
2750 if test "$with_java" != "no"; then
2751     if test "$DISABLE_SCRIPTING" = TRUE; then
2752         AC_MSG_RESULT([no, overridden by --disable-scripting])
2753         ENABLE_JAVA=""
2754         with_java=no
2755     else
2756         AC_MSG_RESULT([yes])
2757         ENABLE_JAVA="TRUE"
2758         AC_DEFINE(HAVE_FEATURE_JAVA)
2759     fi
2760 else
2761     AC_MSG_RESULT([no])
2762     ENABLE_JAVA=""
2765 AC_SUBST(ENABLE_JAVA)
2767 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2769 dnl ENABLE_JAVA="" indicate no Java support at all
2771 dnl ===================================================================
2772 dnl Check macOS SDK and compiler
2773 dnl ===================================================================
2775 HAVE_MACOS_LD_PLATFORMVERSION=
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_MSG_CHECKING([whether the linker supports -platform_version])
3016     save_LDFLAGS=$LDFLAGS
3017     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3018         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3019     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3020         [AC_MSG_RESULT([yes])
3021          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3022         [AC_MSG_RESULT([no])])
3023     LDFLAGS=$save_LDFLAGS
3025 AC_SUBST(MACOSX_SDK_PATH)
3026 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3027 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3028 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3029 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3030 AC_SUBST(INSTALL_NAME_TOOL)
3031 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3032 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3033 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3034 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3035 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3036 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3038 dnl ===================================================================
3039 dnl Check iOS SDK and compiler
3040 dnl ===================================================================
3042 if test $_os = iOS; then
3043     AC_MSG_CHECKING([what iOS SDK to use])
3044     current_sdk_ver=13.2
3045     older_sdk_vers="13.1 13.0 12.4 12.2"
3046     if test "$enable_ios_simulator" = "yes"; then
3047         platform=iPhoneSimulator
3048         versionmin=-mios-simulator-version-min=12.2
3049     else
3050         platform=iPhoneOS
3051         versionmin=-miphoneos-version-min=12.2
3052     fi
3053     xcode_developer=`xcode-select -print-path`
3055     for sdkver in $current_sdk_ver $older_sdk_vers; do
3056         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3057         if test -d $t; then
3058             sysroot=$t
3059             break
3060         fi
3061     done
3063     if test -z "$sysroot"; then
3064         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3065     fi
3067     AC_MSG_RESULT($sysroot)
3069     # LTO is not really recommended for iOS builds,
3070     # the link time will be astronomical
3071     if test "$ENABLE_LTO" = TRUE; then
3072         lto=-flto
3073     fi
3075     stdlib="-stdlib=libc++"
3077     AC_MSG_CHECKING([what C compiler to use])
3078     CC="`xcrun -find clang`"
3079     CC_BASE=`first_arg_basename "$CC"`
3080     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3081     AC_MSG_RESULT([$CC])
3083     AC_MSG_CHECKING([what C++ compiler to use])
3084     CXX="`xcrun -find clang++`"
3085     CXX_BASE=`first_arg_basename "$CXX"`
3086     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3087     AC_MSG_RESULT([$CXX])
3089     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3090     AR=`xcrun -find ar`
3091     NM=`xcrun -find nm`
3092     STRIP=`xcrun -find strip`
3093     LIBTOOL=`xcrun -find libtool`
3094     RANLIB=`xcrun -find ranlib`
3097 AC_MSG_CHECKING([whether to treat the installation as read-only])
3099 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3100         "$enable_extensions" != yes; then
3101     enable_readonly_installset=yes
3103 if test "$enable_readonly_installset" = yes; then
3104     AC_MSG_RESULT([yes])
3105     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3106 else
3107     AC_MSG_RESULT([no])
3110 dnl ===================================================================
3111 dnl Structure of install set
3112 dnl ===================================================================
3114 if test $_os = Darwin; then
3115     LIBO_BIN_FOLDER=MacOS
3116     LIBO_ETC_FOLDER=Resources
3117     LIBO_LIBEXEC_FOLDER=MacOS
3118     LIBO_LIB_FOLDER=Frameworks
3119     LIBO_LIB_PYUNO_FOLDER=Resources
3120     LIBO_SHARE_FOLDER=Resources
3121     LIBO_SHARE_HELP_FOLDER=Resources/help
3122     LIBO_SHARE_JAVA_FOLDER=Resources/java
3123     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3124     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3125     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3126     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3127     LIBO_URE_BIN_FOLDER=MacOS
3128     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3129     LIBO_URE_LIB_FOLDER=Frameworks
3130     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3131     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3132 elif test $_os = WINNT; then
3133     LIBO_BIN_FOLDER=program
3134     LIBO_ETC_FOLDER=program
3135     LIBO_LIBEXEC_FOLDER=program
3136     LIBO_LIB_FOLDER=program
3137     LIBO_LIB_PYUNO_FOLDER=program
3138     LIBO_SHARE_FOLDER=share
3139     LIBO_SHARE_HELP_FOLDER=help
3140     LIBO_SHARE_JAVA_FOLDER=program/classes
3141     LIBO_SHARE_PRESETS_FOLDER=presets
3142     LIBO_SHARE_READMES_FOLDER=readmes
3143     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3144     LIBO_SHARE_SHELL_FOLDER=program/shell
3145     LIBO_URE_BIN_FOLDER=program
3146     LIBO_URE_ETC_FOLDER=program
3147     LIBO_URE_LIB_FOLDER=program
3148     LIBO_URE_MISC_FOLDER=program
3149     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3150 else
3151     LIBO_BIN_FOLDER=program
3152     LIBO_ETC_FOLDER=program
3153     LIBO_LIBEXEC_FOLDER=program
3154     LIBO_LIB_FOLDER=program
3155     LIBO_LIB_PYUNO_FOLDER=program
3156     LIBO_SHARE_FOLDER=share
3157     LIBO_SHARE_HELP_FOLDER=help
3158     LIBO_SHARE_JAVA_FOLDER=program/classes
3159     LIBO_SHARE_PRESETS_FOLDER=presets
3160     LIBO_SHARE_READMES_FOLDER=readmes
3161     if test "$enable_fuzzers" != yes; then
3162         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3163     else
3164         LIBO_SHARE_RESOURCE_FOLDER=resource
3165     fi
3166     LIBO_SHARE_SHELL_FOLDER=program/shell
3167     LIBO_URE_BIN_FOLDER=program
3168     LIBO_URE_ETC_FOLDER=program
3169     LIBO_URE_LIB_FOLDER=program
3170     LIBO_URE_MISC_FOLDER=program
3171     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3173 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3177 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3178 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3179 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3180 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3181 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3182 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3183 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3184 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3185 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3186 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3187 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3188 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3190 # Not all of them needed in config_host.mk, add more if need arises
3191 AC_SUBST(LIBO_BIN_FOLDER)
3192 AC_SUBST(LIBO_ETC_FOLDER)
3193 AC_SUBST(LIBO_LIB_FOLDER)
3194 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3195 AC_SUBST(LIBO_SHARE_FOLDER)
3196 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3197 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3198 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3199 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3200 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3201 AC_SUBST(LIBO_URE_BIN_FOLDER)
3202 AC_SUBST(LIBO_URE_ETC_FOLDER)
3203 AC_SUBST(LIBO_URE_LIB_FOLDER)
3204 AC_SUBST(LIBO_URE_MISC_FOLDER)
3205 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3207 dnl ===================================================================
3208 dnl Windows specific tests and stuff
3209 dnl ===================================================================
3211 reg_get_value()
3213     # Return value: $regvalue
3214     unset regvalue
3216     local _regentry="/proc/registry${1}/${2}"
3217     if test -f "$_regentry"; then
3218         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3219         # Registry keys read via /proc/registry* are always \0 terminated!
3220         local _regvalue=$(tr -d '\0' < "$_regentry")
3221         if test $? -eq 0; then
3222             regvalue=$_regvalue
3223         fi
3224     fi
3227 # Get a value from the 32-bit side of the Registry
3228 reg_get_value_32()
3230     reg_get_value "32" "$1"
3233 # Get a value from the 64-bit side of the Registry
3234 reg_get_value_64()
3236     reg_get_value "64" "$1"
3239 if test "$_os" = "WINNT"; then
3240     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3241     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3242         AC_MSG_RESULT([no])
3243         WINDOWS_SDK_ARCH="x86"
3244     else
3245         AC_MSG_RESULT([yes])
3246         WINDOWS_SDK_ARCH="x64"
3247         BITNESS_OVERRIDE=64
3248     fi
3250 if test "$_os" = "iOS"; then
3251     cross_compiling="yes"
3254 if test "$cross_compiling" = "yes"; then
3255     export CROSS_COMPILING=TRUE
3256 else
3257     CROSS_COMPILING=
3258     BUILD_TYPE="$BUILD_TYPE NATIVE"
3260 AC_SUBST(CROSS_COMPILING)
3262 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3263 # NOTE: must _not_ be used for bundled external libraries!
3264 ISYSTEM=
3265 if test "$GCC" = "yes"; then
3266     AC_MSG_CHECKING( for -isystem )
3267     save_CFLAGS=$CFLAGS
3268     CFLAGS="$CFLAGS -Werror"
3269     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3270     CFLAGS=$save_CFLAGS
3271     if test -n "$ISYSTEM"; then
3272         AC_MSG_RESULT(yes)
3273     else
3274         AC_MSG_RESULT(no)
3275     fi
3277 if test -z "$ISYSTEM"; then
3278     # fall back to using -I
3279     ISYSTEM=-I
3281 AC_SUBST(ISYSTEM)
3283 dnl ===================================================================
3284 dnl  Check which Visual Studio compiler is used
3285 dnl ===================================================================
3287 map_vs_year_to_version()
3289     # Return value: $vsversion
3291     unset vsversion
3293     case $1 in
3294     2017)
3295         vsversion=15;;
3296     2019)
3297         vsversion=16;;
3298     *)
3299         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3300     esac
3303 vs_versions_to_check()
3305     # Args: $1 (optional) : versions to check, in the order of preference
3306     # Return value: $vsversions
3308     unset vsversions
3310     if test -n "$1"; then
3311         map_vs_year_to_version "$1"
3312         vsversions=$vsversion
3313     else
3314         # We accept only 2017
3315         vsversions="15"
3316     fi
3319 win_get_env_from_vsvars32bat()
3321     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3322     # Also seems to be located in another directory under the same name: vsvars32.bat
3323     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3324     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3325     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3326     chmod +x $WRAPPERBATCHFILEPATH
3327     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3328     rm -f $WRAPPERBATCHFILEPATH
3329     printf '%s' "$_win_get_env_from_vsvars32bat"
3332 find_ucrt()
3334     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3335     if test -n "$regvalue"; then
3336         PathFormat "$regvalue"
3337         UCRTSDKDIR=$formatted_path
3338         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3339         UCRTVERSION=$regvalue
3340         # Rest if not exist
3341         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3342           UCRTSDKDIR=
3343         fi
3344     fi
3345     if test -z "$UCRTSDKDIR"; then
3346         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3347         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3348         if test -f "$ide_env_file"; then
3349             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3350             UCRTSDKDIR=$formatted_path
3351             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3352             dnl Hack needed at least by tml:
3353             if test "$UCRTVERSION" = 10.0.15063.0 \
3354                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3355                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3356             then
3357                 UCRTVERSION=10.0.14393.0
3358             fi
3359         else
3360           AC_MSG_ERROR([No UCRT found])
3361         fi
3362     fi
3365 find_msvc()
3367     # Find Visual C++ 2017/2019
3368     # Args: $1 (optional) : The VS version year
3369     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3371     unset vctest vcnum vcnumwithdot vcbuildnumber
3373     vs_versions_to_check "$1"
3374     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3375     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3376     PathFormat "$vswhere"
3377     vswhere=$formatted_path
3378     for ver in $vsversions; do
3379         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3380         if test -n "$vswhereoutput"; then
3381             PathFormat "$vswhereoutput"
3382             vctest=$formatted_path
3383             break
3384         fi
3385     done
3387     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3388     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3389     # should be removed when upgrading baseline.
3390     if ! test -n "$vctest"; then
3391         for ver in $vsversions; do
3392             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3393             if test -n "$regvalue"; then
3394                 vctest=$regvalue
3395                 break
3396             fi
3397             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3398             if test -n "$regvalue"; then
3399                 AC_MSG_RESULT([found: $regvalue])
3400                 PathFormat "$regvalue"
3401                 vctest=$formatted_path
3402                 break
3403             fi
3404         done
3405     fi
3407     if test -n "$vctest"; then
3408         vcnumwithdot="$ver.0"
3409         case "$vcnumwithdot" in
3410         15.0)
3411             vcyear=2017
3412             vcnum=150
3413             ;;
3414         16.0)
3415             vcyear=2019
3416             vcnum=160
3417             ;;
3418         esac
3419         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3421     fi
3424 SOLARINC=
3425 MSBUILD_PATH=
3426 DEVENV=
3427 if test "$_os" = "WINNT"; then
3428     AC_MSG_CHECKING([Visual C++])
3429     find_msvc "$with_visual_studio"
3430     if test -z "$vctest"; then
3431         if test -n "$with_visual_studio"; then
3432             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3433         else
3434             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3435         fi
3436     fi
3438     if test "$BITNESS_OVERRIDE" = ""; then
3439         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3440             VC_PRODUCT_DIR=$vctest/VC
3441         else
3442             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3443         fi
3444     else
3445         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3446             VC_PRODUCT_DIR=$vctest/VC
3447         else
3448             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3449         fi
3450     fi
3451     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3453     AC_MSG_CHECKING([for short pathname of VC product directory])
3454     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3455     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3457     UCRTSDKDIR=
3458     UCRTVERSION=
3460     AC_MSG_CHECKING([for UCRT location])
3461     find_ucrt
3462     # find_ucrt errors out if it doesn't find it
3463     AC_MSG_RESULT([found])
3464     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3465     ucrtincpath_formatted=$formatted_path
3466     # SOLARINC is used for external modules and must be set too.
3467     # And no, it's not sufficient to set SOLARINC only, as configure
3468     # itself doesn't honour it.
3469     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3470     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3471     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3472     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3474     AC_SUBST(UCRTSDKDIR)
3475     AC_SUBST(UCRTVERSION)
3477     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3478     # Find the proper version of MSBuild.exe to use based on the VS version
3479     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3480     if test -n "$regvalue" ; then
3481         AC_MSG_RESULT([found: $regvalue])
3482         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3483     else
3484         if test "$vcnumwithdot" = "16.0"; then
3485             if test "$BITNESS_OVERRIDE" = ""; then
3486                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3487             else
3488                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3489             fi
3490         else
3491             if test "$BITNESS_OVERRIDE" = ""; then
3492                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3493             else
3494                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3495             fi
3496         fi
3497         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3498         AC_MSG_RESULT([$regvalue])
3499     fi
3501     # Find the version of devenv.exe
3502     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3503     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3504     if test ! -e "$DEVENV"; then
3505         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3506     fi
3508     dnl ===========================================================
3509     dnl  Check for the corresponding mspdb*.dll
3510     dnl ===========================================================
3512     VC_HOST_DIR=
3513     MSPDB_PATH=
3514     CL_PATH=
3516     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3517         VC_HOST_DIR="HostX64"
3518         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3519     else
3520         VC_HOST_DIR="HostX86"
3521         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3522     fi
3524     if test "$BITNESS_OVERRIDE" = ""; then
3525         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3526     else
3527         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3528     fi
3530     # MSVC 15.0 has libraries from 14.0?
3531     mspdbnum="140"
3533     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3534         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3535     fi
3537     dnl The path needs to be added before cl is called
3538     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3539     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3541     AC_MSG_CHECKING([cl.exe])
3543     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3544     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3545     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3546     # is not enough?
3548     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3549     dnl needed when building CLR code:
3550     if test -z "$MSVC_CXX"; then
3551         if test -f "$CL_PATH/cl.exe"; then
3552             MSVC_CXX="$CL_PATH/cl.exe"
3553         fi
3555         # This gives us a posix path with 8.3 filename restrictions
3556         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3557     fi
3559     if test -z "$CC"; then
3560         CC=$MSVC_CXX
3561         CC_BASE=`first_arg_basename "$CC"`
3562     fi
3563     if test "$BITNESS_OVERRIDE" = ""; then
3564         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3565         MSVC_CXX="$MSVC_CXX -arch:SSE"
3566     fi
3567     if test -z "$CXX"; then
3568         CXX=$MSVC_CXX
3569         CXX_BASE=`first_arg_basename "$CXX"`
3570     fi
3572     if test -n "$CC"; then
3573         # Remove /cl.exe from CC case insensitive
3574         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3575         if test "$BITNESS_OVERRIDE" = ""; then
3576            COMPATH="$VC_PRODUCT_DIR"
3577         else
3578             if test -n "$VC_PRODUCT_DIR"; then
3579                 COMPATH=$VC_PRODUCT_DIR
3580             fi
3581         fi
3582         if test "$BITNESS_OVERRIDE" = ""; then
3583             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3584             CC="$CC -arch:SSE"
3585         fi
3587         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3589         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3591         PathFormat "$COMPATH"
3592         COMPATH=`win_short_path_for_make "$formatted_path"`
3594         VCVER=$vcnum
3595         MSVSVER=$vcyear
3597         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3598         # are always "better", we list them in reverse chronological order.
3600         case "$vcnum" in
3601         150|160)
3602             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3603             ;;
3604         esac
3606         # The expectation is that --with-windows-sdk should not need to be used
3607         if test -n "$with_windows_sdk"; then
3608             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3609             *" "$with_windows_sdk" "*)
3610                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3611                 ;;
3612             *)
3613                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3614                 ;;
3615             esac
3616         fi
3618         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3619         ac_objext=obj
3620         ac_exeext=exe
3622     else
3623         AC_MSG_ERROR([Visual C++ not found after all, huh])
3624     fi
3626     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3627     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3628         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3629         // between Visual Studio versions and _MSC_VER:
3630         #if _MSC_VER < 1914
3631         #error
3632         #endif
3633     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3635     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3636     # version of the Explorer extension (and maybe other small
3637     # bits, too) needed when installing a 32-bit LibreOffice on a
3638     # 64-bit OS. The 64-bit Explorer extension is a feature that
3639     # has been present since long in OOo. Don't confuse it with
3640     # building LibreOffice itself as 64-bit code.
3642     BUILD_X64=
3643     CXX_X64_BINARY=
3645     if test "$BITNESS_OVERRIDE" = ""; then
3646         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3647         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3648              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3649             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3650                 BUILD_X64=TRUE
3651                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3652             fi
3653         fi
3654         if test "$BUILD_X64" = TRUE; then
3655             AC_MSG_RESULT([found])
3656         else
3657             AC_MSG_RESULT([not found])
3658             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3659         fi
3660     else
3661         CXX_X64_BINARY=$CXX
3662     fi
3663     AC_SUBST(BUILD_X64)
3665     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3666     AC_SUBST(CXX_X64_BINARY)
3668     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3669     # needed to support TWAIN scan on both 32- and 64-bit systems
3671     BUILD_X86=
3673     if test "$BITNESS_OVERRIDE" = "64"; then
3674         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3675         if test -n "$CXX_X86_BINARY"; then
3676             BUILD_X86=TRUE
3677             AC_MSG_RESULT([preset])
3678         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3679             BUILD_X86=TRUE
3680             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3681             CXX_X86_BINARY+=" /arch:SSE"
3682             AC_MSG_RESULT([found])
3683         else
3684             CXX_X86_BINARY=
3685             AC_MSG_RESULT([not found])
3686             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3687         fi
3688     else
3689         BUILD_X86=TRUE
3690         CXX_X86_BINARY=$MSVC_CXX
3691     fi
3692     AC_SUBST(BUILD_X86)
3693     AC_SUBST(CXX_X86_BINARY)
3695 AC_SUBST(VCVER)
3696 AC_SUBST(DEVENV)
3697 AC_SUBST(MSVC_CXX)
3700 # unowinreg.dll
3702 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3703 AC_SUBST(UNOWINREG_DLL)
3705 COM_IS_CLANG=
3706 AC_MSG_CHECKING([whether the compiler is actually Clang])
3707 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3708     #ifndef __clang__
3709     you lose
3710     #endif
3711     int foo=42;
3712     ]])],
3713     [AC_MSG_RESULT([yes])
3714      COM_IS_CLANG=TRUE],
3715     [AC_MSG_RESULT([no])])
3716 AC_SUBST(COM_IS_CLANG)
3718 CC_PLAIN=$CC
3719 CLANGVER=
3720 if test "$COM_IS_CLANG" = TRUE; then
3721     AC_MSG_CHECKING([whether Clang is new enough])
3722     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3723         #if !defined __apple_build_version__
3724         #error
3725         #endif
3726         ]])],
3727         [my_apple_clang=yes],[my_apple_clang=])
3728     if test "$my_apple_clang" = yes; then
3729         AC_MSG_RESULT([assumed yes (Apple Clang)])
3730     else
3731         if test "$_os" = WINNT; then
3732             dnl In which case, assume clang-cl:
3733             my_args="/EP /TC"
3734             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3735             dnl clang-cl:
3736             CC_PLAIN=
3737             for i in $CC; do
3738                 case $i in
3739                 -FIIntrin.h)
3740                     ;;
3741                 *)
3742                     CC_PLAIN="$CC_PLAIN $i"
3743                     ;;
3744                 esac
3745             done
3746         else
3747             my_args="-E -P"
3748         fi
3749         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3750         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3751         CLANGVER=`echo $clang_version \
3752             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3753         if test "$CLANGVER" -ge 50002; then
3754             AC_MSG_RESULT([yes ($clang_version)])
3755         else
3756             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3757         fi
3758         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3759         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3760     fi
3763 SHOWINCLUDES_PREFIX=
3764 if test "$_os" = WINNT; then
3765     dnl We need to guess the prefix of the -showIncludes output, it can be
3766     dnl localized
3767     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3768     echo "#include <stdlib.h>" > conftest.c
3769     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3770         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3771     rm -f conftest.c conftest.obj
3772     if test -z "$SHOWINCLUDES_PREFIX"; then
3773         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3774     else
3775         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3776     fi
3778 AC_SUBST(SHOWINCLUDES_PREFIX)
3781 # prefix C with ccache if needed
3783 if test "$CCACHE" != ""; then
3784     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3786     AC_LANG_PUSH([C])
3787     save_CFLAGS=$CFLAGS
3788     CFLAGS="$CFLAGS --ccache-skip -O2"
3789     dnl an empty program will do, we're checking the compiler flags
3790     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3791                       [use_ccache=yes], [use_ccache=no])
3792     if test $use_ccache = yes; then
3793         AC_MSG_RESULT([yes])
3794     else
3795         CC="$CCACHE $CC"
3796         CC_BASE="ccache $CC_BASE"
3797         AC_MSG_RESULT([no])
3798     fi
3799     CFLAGS=$save_CFLAGS
3800     AC_LANG_POP([C])
3803 # ===================================================================
3804 # check various GCC options that Clang does not support now but maybe
3805 # will somewhen in the future, check them even for GCC, so that the
3806 # flags are set
3807 # ===================================================================
3809 HAVE_GCC_GGDB2=
3810 if test "$GCC" = "yes"; then
3811     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3812     save_CFLAGS=$CFLAGS
3813     CFLAGS="$CFLAGS -Werror -ggdb2"
3814     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3815     CFLAGS=$save_CFLAGS
3816     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3817         AC_MSG_RESULT([yes])
3818     else
3819         AC_MSG_RESULT([no])
3820     fi
3822     if test "$host_cpu" = "m68k"; then
3823         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3824         save_CFLAGS=$CFLAGS
3825         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3826         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3827         CFLAGS=$save_CFLAGS
3828         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3829             AC_MSG_RESULT([yes])
3830         else
3831             AC_MSG_ERROR([no])
3832         fi
3833     fi
3835 AC_SUBST(HAVE_GCC_GGDB2)
3837 dnl ===================================================================
3838 dnl  Test the gcc version
3839 dnl ===================================================================
3840 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3841     AC_MSG_CHECKING([the GCC version])
3842     _gcc_version=`$CC -dumpversion`
3843     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3844         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3845     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3847     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3849     if test "$gcc_full_version" -lt 70000; then
3850         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3851     fi
3852 else
3853     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3854     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3855     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3856     # (which reports itself as GCC 4.2.1).
3857     GCC_VERSION=
3859 AC_SUBST(GCC_VERSION)
3861 dnl Set the ENABLE_DBGUTIL variable
3862 dnl ===================================================================
3863 AC_MSG_CHECKING([whether to build with additional debug utilities])
3864 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3865     ENABLE_DBGUTIL="TRUE"
3866     # this is an extra var so it can have different default on different MSVC
3867     # versions (in case there are version specific problems with it)
3868     MSVC_USE_DEBUG_RUNTIME="TRUE"
3870     AC_MSG_RESULT([yes])
3871     # cppunit and graphite expose STL in public headers
3872     if test "$with_system_cppunit" = "yes"; then
3873         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3874     else
3875         with_system_cppunit=no
3876     fi
3877     if test "$with_system_graphite" = "yes"; then
3878         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3879     else
3880         with_system_graphite=no
3881     fi
3882     if test "$with_system_orcus" = "yes"; then
3883         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3884     else
3885         with_system_orcus=no
3886     fi
3887     if test "$with_system_libcmis" = "yes"; then
3888         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3889     else
3890         with_system_libcmis=no
3891     fi
3892     if test "$with_system_hunspell" = "yes"; then
3893         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3894     else
3895         with_system_hunspell=no
3896     fi
3897     if test "$with_system_gpgmepp" = "yes"; then
3898         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3899     else
3900         with_system_gpgmepp=no
3901     fi
3902     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3903     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3904     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3905     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3906     # of those two is using the system variant:
3907     if test "$with_system_libnumbertext" = "yes"; then
3908         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3909     else
3910         with_system_libnumbertext=no
3911     fi
3912     if test "$with_system_libwps" = "yes"; then
3913         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3914     else
3915         with_system_libwps=no
3916     fi
3917 else
3918     ENABLE_DBGUTIL=""
3919     MSVC_USE_DEBUG_RUNTIME=""
3920     AC_MSG_RESULT([no])
3922 AC_SUBST(ENABLE_DBGUTIL)
3923 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3925 dnl Set the ENABLE_DEBUG variable.
3926 dnl ===================================================================
3927 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3928     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3930 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3931     if test -z "$libo_fuzzed_enable_debug"; then
3932         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3933     else
3934         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3935         enable_debug=yes
3936     fi
3939 AC_MSG_CHECKING([whether to do a debug build])
3940 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3941     ENABLE_DEBUG="TRUE"
3942     if test -n "$ENABLE_DBGUTIL" ; then
3943         AC_MSG_RESULT([yes (dbgutil)])
3944     else
3945         AC_MSG_RESULT([yes])
3946     fi
3947 else
3948     ENABLE_DEBUG=""
3949     AC_MSG_RESULT([no])
3951 AC_SUBST(ENABLE_DEBUG)
3953 dnl ===================================================================
3954 dnl Select the linker to use (gold/lld/ld.bfd).
3955 dnl This is done only after compiler checks (need to know if Clang is
3956 dnl used, for different defaults) and after checking if a debug build
3957 dnl is wanted (non-debug builds get the default linker if not explicitly
3958 dnl specified otherwise).
3959 dnl All checks for linker features/options should come after this.
3960 dnl ===================================================================
3961 check_use_ld()
3963     use_ld=$1
3964     use_ld_fail_if_error=$2
3965     use_ld_ok=
3966     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3967     use_ld_ldflags_save="$LDFLAGS"
3968     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3969     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3970 #include <stdio.h>
3971         ],[
3972 printf ("hello world\n");
3973         ])], USE_LD=$use_ld, [])
3974     if test -n "$USE_LD"; then
3975         AC_MSG_RESULT( yes )
3976         use_ld_ok=yes
3977     else
3978         if test -n "$use_ld_fail_if_error"; then
3979             AC_MSG_ERROR( no )
3980         else
3981             AC_MSG_RESULT( no )
3982         fi
3983     fi
3984     if test -n "$use_ld_ok"; then
3985         dnl keep the value of LDFLAGS
3986         return 0
3987     fi
3988     LDFLAGS="$use_ld_ldflags_save"
3989     return 1
3991 USE_LD=
3992 if test "$enable_ld" != "no"; then
3993     if test "$GCC" = "yes"; then
3994         if test -n "$enable_ld"; then
3995             check_use_ld "$enable_ld" fail_if_error
3996         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3997             dnl non-debug builds default to the default linker
3998             true
3999         elif test -n "$COM_IS_CLANG"; then
4000             check_use_ld lld
4001             if test $? -ne 0; then
4002                 check_use_ld gold
4003             fi
4004         else
4005             # For gcc first try gold, new versions also support lld.
4006             check_use_ld gold
4007             if test $? -ne 0; then
4008                 check_use_ld lld
4009             fi
4010         fi
4011         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4012         rm conftest.out
4013         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4014         if test -z "$ld_used"; then
4015             ld_used="unknown"
4016         fi
4017         AC_MSG_CHECKING([for linker that is used])
4018         AC_MSG_RESULT([$ld_used])
4019         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4020             if echo "$ld_used" | grep -q "^GNU ld"; then
4021                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4022                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4023             fi
4024         fi
4025     else
4026         if test "$enable_ld" = "yes"; then
4027             AC_MSG_ERROR([--enable-ld not supported])
4028         fi
4029     fi
4031 AC_SUBST(USE_LD)
4033 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4034 if test "$GCC" = "yes"; then
4035     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4036     bsymbolic_functions_ldflags_save=$LDFLAGS
4037     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4038     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4039 #include <stdio.h>
4040         ],[
4041 printf ("hello world\n");
4042         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4043     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4044         AC_MSG_RESULT( found )
4045     else
4046         AC_MSG_RESULT( not found )
4047     fi
4048     LDFLAGS=$bsymbolic_functions_ldflags_save
4050 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4053 HAVE_GSPLIT_DWARF=
4054 if test "$enable_split_debug" != no; then
4055     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4056     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4057         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4058         save_CFLAGS=$CFLAGS
4059         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4060         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4061         CFLAGS=$save_CFLAGS
4062         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4063             AC_MSG_RESULT([yes])
4064         else
4065             if test "$enable_split_debug" = yes; then
4066                 AC_MSG_ERROR([no])
4067             else
4068                 AC_MSG_RESULT([no])
4069             fi
4070         fi
4071     fi
4072     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4073         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4074         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4075     fi
4077 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4079 ENABLE_GDB_INDEX=
4080 if test "$enable_gdb_index" != "no"; then
4081     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4082     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4083         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4084         save_CFLAGS=$CFLAGS
4085         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4086         have_ggnu_pubnames=
4087         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4088         if test "$have_ggnu_pubnames" != "TRUE"; then
4089             if test "$enable_gdb_index" = "yes"; then
4090                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4091             else
4092                 AC_MSG_RESULT( no )
4093             fi
4094         else
4095             AC_MSG_RESULT( yes )
4096             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4097             ldflags_save=$LDFLAGS
4098             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4099             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4100 #include <stdio.h>
4101                 ],[
4102 printf ("hello world\n");
4103                 ])], ENABLE_GDB_INDEX=TRUE, [])
4104             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4105                 AC_MSG_RESULT( yes )
4106             else
4107                 if test "$enable_gdb_index" = "yes"; then
4108                     AC_MSG_ERROR( no )
4109                 else
4110                     AC_MSG_RESULT( no )
4111                 fi
4112             fi
4113             LDFLAGS=$ldflags_save
4114         fi
4115         CFLAGS=$save_CFLAGS
4116         fi
4117     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4118         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4119         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4120     fi
4122 AC_SUBST(ENABLE_GDB_INDEX)
4124 if test "$enable_sal_log" = yes; then
4125     ENABLE_SAL_LOG=TRUE
4127 AC_SUBST(ENABLE_SAL_LOG)
4129 dnl Check for enable symbols option
4130 dnl ===================================================================
4131 AC_MSG_CHECKING([whether to generate debug information])
4132 if test -z "$enable_symbols"; then
4133     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4134         enable_symbols=yes
4135     else
4136         enable_symbols=no
4137     fi
4139 if test "$enable_symbols" = yes; then
4140     ENABLE_SYMBOLS_FOR=all
4141     AC_MSG_RESULT([yes])
4142 elif test "$enable_symbols" = no; then
4143     ENABLE_SYMBOLS_FOR=
4144     AC_MSG_RESULT([no])
4145 else
4146     # Selective debuginfo.
4147     ENABLE_SYMBOLS_FOR="$enable_symbols"
4148     AC_MSG_RESULT([for "$enable_symbols"])
4150 AC_SUBST(ENABLE_SYMBOLS_FOR)
4152 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4153     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4154     AC_MSG_CHECKING([whether enough memory is available for linking])
4155     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4156     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4157     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4158         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4159     else
4160         AC_MSG_RESULT([yes])
4161     fi
4164 AC_MSG_CHECKING([whether to compile with optimization flags])
4165 if test -z "$enable_optimized"; then
4166     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4167         enable_optimized=no
4168     else
4169         enable_optimized=yes
4170     fi
4172 if test "$enable_optimized" != no; then
4173     ENABLE_OPTIMIZED=TRUE
4174     AC_MSG_RESULT([yes])
4175 else
4176     ENABLE_OPTIMIZED=
4177     AC_MSG_RESULT([no])
4179 AC_SUBST(ENABLE_OPTIMIZED)
4182 # determine CPUNAME, OS, ...
4183 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4185 case "$host_os" in
4187 aix*)
4188     COM=GCC
4189     CPUNAME=POWERPC
4190     USING_X11=TRUE
4191     OS=AIX
4192     RTL_OS=AIX
4193     RTL_ARCH=PowerPC
4194     PLATFORMID=aix_powerpc
4195     P_SEP=:
4196     ;;
4198 cygwin*)
4199     COM=MSC
4200     USING_X11=
4201     OS=WNT
4202     RTL_OS=Windows
4203     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4204         P_SEP=";"
4205     else
4206         P_SEP=:
4207     fi
4208     case "$host_cpu" in
4209     i*86|x86_64)
4210         if test "$BITNESS_OVERRIDE" = 64; then
4211             CPUNAME=X86_64
4212             RTL_ARCH=X86_64
4213             PLATFORMID=windows_x86_64
4214             WINDOWS_X64=1
4215             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4216         else
4217             CPUNAME=INTEL
4218             RTL_ARCH=x86
4219             PLATFORMID=windows_x86
4220         fi
4221         ;;
4222     *)
4223         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4224         ;;
4225     esac
4226     SCPDEFS="$SCPDEFS -D_MSC_VER"
4227     ;;
4229 darwin*)
4230     COM=GCC
4231     USING_X11=
4232     OS=MACOSX
4233     RTL_OS=MacOSX
4234     P_SEP=:
4236     case "$host_cpu" in
4237     arm)
4238         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4239         ;;
4240     arm64)
4241         OS=iOS
4242         RTL_OS=iOS
4243         if test "$enable_ios_simulator" = "yes"; then
4244             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4245         else
4246             CPUNAME=ARM64
4247             RTL_ARCH=ARM_EABI
4248             PLATFORMID=ios_arm64
4249         fi
4250         ;;
4251     i*86)
4252         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4253         ;;
4254     x86_64)
4255         if test "$enable_ios_simulator" = "yes"; then
4256             OS=iOS
4257         fi
4258         CPUNAME=X86_64
4259         RTL_ARCH=X86_64
4260         PLATFORMID=macosx_x86_64
4261         ;;
4262     *)
4263         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4264         ;;
4265     esac
4266     ;;
4268 dragonfly*)
4269     COM=GCC
4270     USING_X11=TRUE
4271     OS=DRAGONFLY
4272     RTL_OS=DragonFly
4273     P_SEP=:
4275     case "$host_cpu" in
4276     i*86)
4277         CPUNAME=INTEL
4278         RTL_ARCH=x86
4279         PLATFORMID=dragonfly_x86
4280         ;;
4281     x86_64)
4282         CPUNAME=X86_64
4283         RTL_ARCH=X86_64
4284         PLATFORMID=dragonfly_x86_64
4285         ;;
4286     *)
4287         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4288         ;;
4289     esac
4290     ;;
4292 freebsd*)
4293     COM=GCC
4294     USING_X11=TRUE
4295     RTL_OS=FreeBSD
4296     OS=FREEBSD
4297     P_SEP=:
4299     case "$host_cpu" in
4300     i*86)
4301         CPUNAME=INTEL
4302         RTL_ARCH=x86
4303         PLATFORMID=freebsd_x86
4304         ;;
4305     x86_64|amd64)
4306         CPUNAME=X86_64
4307         RTL_ARCH=X86_64
4308         PLATFORMID=freebsd_x86_64
4309         ;;
4310     *)
4311         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4312         ;;
4313     esac
4314     ;;
4316 haiku*)
4317     COM=GCC
4318     USING_X11=
4319     GUIBASE=haiku
4320     RTL_OS=Haiku
4321     OS=HAIKU
4322     P_SEP=:
4324     case "$host_cpu" in
4325     i*86)
4326         CPUNAME=INTEL
4327         RTL_ARCH=x86
4328         PLATFORMID=haiku_x86
4329         ;;
4330     x86_64|amd64)
4331         CPUNAME=X86_64
4332         RTL_ARCH=X86_64
4333         PLATFORMID=haiku_x86_64
4334         ;;
4335     *)
4336         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4337         ;;
4338     esac
4339     ;;
4341 kfreebsd*)
4342     COM=GCC
4343     USING_X11=TRUE
4344     OS=LINUX
4345     RTL_OS=kFreeBSD
4346     P_SEP=:
4348     case "$host_cpu" in
4350     i*86)
4351         CPUNAME=INTEL
4352         RTL_ARCH=x86
4353         PLATFORMID=kfreebsd_x86
4354         ;;
4355     x86_64)
4356         CPUNAME=X86_64
4357         RTL_ARCH=X86_64
4358         PLATFORMID=kfreebsd_x86_64
4359         ;;
4360     *)
4361         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4362         ;;
4363     esac
4364     ;;
4366 linux-gnu*)
4367     COM=GCC
4368     USING_X11=TRUE
4369     OS=LINUX
4370     RTL_OS=Linux
4371     P_SEP=:
4373     case "$host_cpu" in
4375     aarch64)
4376         CPUNAME=AARCH64
4377         PLATFORMID=linux_aarch64
4378         RTL_ARCH=AARCH64
4379         ;;
4380     alpha)
4381         CPUNAME=AXP
4382         RTL_ARCH=ALPHA
4383         PLATFORMID=linux_alpha
4384         ;;
4385     arm*)
4386         CPUNAME=ARM
4387         EPM_FLAGS="-a arm"
4388         RTL_ARCH=ARM_EABI
4389         PLATFORMID=linux_arm_eabi
4390         case "$host_cpu" in
4391         arm*-linux)
4392             RTL_ARCH=ARM_OABI
4393             PLATFORMID=linux_arm_oabi
4394             ;;
4395         esac
4396         ;;
4397     hppa)
4398         CPUNAME=HPPA
4399         RTL_ARCH=HPPA
4400         EPM_FLAGS="-a hppa"
4401         PLATFORMID=linux_hppa
4402         ;;
4403     i*86)
4404         CPUNAME=INTEL
4405         RTL_ARCH=x86
4406         PLATFORMID=linux_x86
4407         ;;
4408     ia64)
4409         CPUNAME=IA64
4410         RTL_ARCH=IA64
4411         PLATFORMID=linux_ia64
4412         ;;
4413     mips)
4414         CPUNAME=GODSON
4415         RTL_ARCH=MIPS_EB
4416         EPM_FLAGS="-a mips"
4417         PLATFORMID=linux_mips_eb
4418         ;;
4419     mips64)
4420         CPUNAME=GODSON64
4421         RTL_ARCH=MIPS64_EB
4422         EPM_FLAGS="-a mips64"
4423         PLATFORMID=linux_mips64_eb
4424         ;;
4425     mips64el)
4426         CPUNAME=GODSON64
4427         RTL_ARCH=MIPS64_EL
4428         EPM_FLAGS="-a mips64el"
4429         PLATFORMID=linux_mips64_el
4430         ;;
4431     mipsel)
4432         CPUNAME=GODSON
4433         RTL_ARCH=MIPS_EL
4434         EPM_FLAGS="-a mipsel"
4435         PLATFORMID=linux_mips_el
4436         ;;
4437     m68k)
4438         CPUNAME=M68K
4439         RTL_ARCH=M68K
4440         PLATFORMID=linux_m68k
4441         ;;
4442     powerpc)
4443         CPUNAME=POWERPC
4444         RTL_ARCH=PowerPC
4445         PLATFORMID=linux_powerpc
4446         ;;
4447     powerpc64)
4448         CPUNAME=POWERPC64
4449         RTL_ARCH=PowerPC_64
4450         PLATFORMID=linux_powerpc64
4451         ;;
4452     powerpc64le)
4453         CPUNAME=POWERPC64
4454         RTL_ARCH=PowerPC_64_LE
4455         PLATFORMID=linux_powerpc64_le
4456         ;;
4457     sparc)
4458         CPUNAME=SPARC
4459         RTL_ARCH=SPARC
4460         PLATFORMID=linux_sparc
4461         ;;
4462     sparc64)
4463         CPUNAME=SPARC64
4464         RTL_ARCH=SPARC64
4465         PLATFORMID=linux_sparc64
4466         ;;
4467     s390)
4468         CPUNAME=S390
4469         RTL_ARCH=S390
4470         PLATFORMID=linux_s390
4471         ;;
4472     s390x)
4473         CPUNAME=S390X
4474         RTL_ARCH=S390x
4475         PLATFORMID=linux_s390x
4476         ;;
4477     x86_64)
4478         CPUNAME=X86_64
4479         RTL_ARCH=X86_64
4480         PLATFORMID=linux_x86_64
4481         ;;
4482     *)
4483         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4484         ;;
4485     esac
4486     ;;
4488 linux-android*)
4489     COM=GCC
4490     USING_X11=
4491     OS=ANDROID
4492     RTL_OS=Android
4493     P_SEP=:
4495     case "$host_cpu" in
4497     arm|armel)
4498         CPUNAME=ARM
4499         RTL_ARCH=ARM_EABI
4500         PLATFORMID=android_arm_eabi
4501         ;;
4502     aarch64)
4503         CPUNAME=AARCH64
4504         RTL_ARCH=AARCH64
4505         PLATFORMID=android_aarch64
4506         ;;
4507     i*86)
4508         CPUNAME=INTEL
4509         RTL_ARCH=x86
4510         PLATFORMID=android_x86
4511         ;;
4512     x86_64)
4513         CPUNAME=X86_64
4514         RTL_ARCH=X86_64
4515         PLATFORMID=android_x86_64
4516         ;;
4517     *)
4518         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4519         ;;
4520     esac
4521     ;;
4523 *netbsd*)
4524     COM=GCC
4525     USING_X11=TRUE
4526     OS=NETBSD
4527     RTL_OS=NetBSD
4528     P_SEP=:
4530     case "$host_cpu" in
4531     i*86)
4532         CPUNAME=INTEL
4533         RTL_ARCH=x86
4534         PLATFORMID=netbsd_x86
4535         ;;
4536     powerpc)
4537         CPUNAME=POWERPC
4538         RTL_ARCH=PowerPC
4539         PLATFORMID=netbsd_powerpc
4540         ;;
4541     sparc)
4542         CPUNAME=SPARC
4543         RTL_ARCH=SPARC
4544         PLATFORMID=netbsd_sparc
4545         ;;
4546     x86_64)
4547         CPUNAME=X86_64
4548         RTL_ARCH=X86_64
4549         PLATFORMID=netbsd_x86_64
4550         ;;
4551     *)
4552         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4553         ;;
4554     esac
4555     ;;
4557 openbsd*)
4558     COM=GCC
4559     USING_X11=TRUE
4560     OS=OPENBSD
4561     RTL_OS=OpenBSD
4562     P_SEP=:
4564     case "$host_cpu" in
4565     i*86)
4566         CPUNAME=INTEL
4567         RTL_ARCH=x86
4568         PLATFORMID=openbsd_x86
4569         ;;
4570     x86_64)
4571         CPUNAME=X86_64
4572         RTL_ARCH=X86_64
4573         PLATFORMID=openbsd_x86_64
4574         ;;
4575     *)
4576         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4577         ;;
4578     esac
4579     SOLARINC="$SOLARINC -I/usr/local/include"
4580     ;;
4582 solaris*)
4583     COM=GCC
4584     USING_X11=TRUE
4585     OS=SOLARIS
4586     RTL_OS=Solaris
4587     P_SEP=:
4589     case "$host_cpu" in
4590     i*86)
4591         CPUNAME=INTEL
4592         RTL_ARCH=x86
4593         PLATFORMID=solaris_x86
4594         ;;
4595     sparc)
4596         CPUNAME=SPARC
4597         RTL_ARCH=SPARC
4598         PLATFORMID=solaris_sparc
4599         ;;
4600     sparc64)
4601         CPUNAME=SPARC64
4602         RTL_ARCH=SPARC64
4603         PLATFORMID=solaris_sparc64
4604         ;;
4605     *)
4606         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4607         ;;
4608     esac
4609     SOLARINC="$SOLARINC -I/usr/local/include"
4610     ;;
4613     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4614     ;;
4615 esac
4617 if test "$with_x" = "no"; then
4618     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4621 DISABLE_GUI=""
4622 if test "$enable_gui" = "no"; then
4623     if test "$USING_X11" != TRUE; then
4624         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4625     fi
4626     USING_X11=
4627     DISABLE_GUI=TRUE
4628     AC_DEFINE(HAVE_FEATURE_UI,0)
4629     test_cairo=yes
4631 AC_SUBST(DISABLE_GUI)
4633 WORKDIR="${BUILDDIR}/workdir"
4634 INSTDIR="${BUILDDIR}/instdir"
4635 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4636 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4637 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4638 AC_SUBST(COM)
4639 AC_SUBST(CPUNAME)
4640 AC_SUBST(RTL_OS)
4641 AC_SUBST(RTL_ARCH)
4642 AC_SUBST(EPM_FLAGS)
4643 AC_SUBST(USING_X11)
4644 AC_SUBST([INSTDIR])
4645 AC_SUBST([INSTROOT])
4646 AC_SUBST([INSTROOTBASE])
4647 AC_SUBST(OS)
4648 AC_SUBST(P_SEP)
4649 AC_SUBST(WORKDIR)
4650 AC_SUBST(PLATFORMID)
4651 AC_SUBST(WINDOWS_X64)
4652 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4654 dnl ===================================================================
4655 dnl Test which package format to use
4656 dnl ===================================================================
4657 AC_MSG_CHECKING([which package format to use])
4658 if test -n "$with_package_format" -a "$with_package_format" != no; then
4659     for i in $with_package_format; do
4660         case "$i" in
4661         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4662             ;;
4663         *)
4664             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4665 aix - AIX software distribution
4666 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4667 deb - Debian software distribution
4668 pkg - Solaris software distribution
4669 rpm - RedHat software distribution
4671 LibreOffice additionally supports:
4672 archive - .tar.gz or .zip
4673 dmg - macOS .dmg
4674 installed - installation tree
4675 msi - Windows .msi
4676         ])
4677             ;;
4678         esac
4679     done
4680     # fakeroot is needed to ensure correct file ownerships/permissions
4681     # inside deb packages and tar archives created on Linux and Solaris.
4682     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4683         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4684         if test "$FAKEROOT" = "no"; then
4685             AC_MSG_ERROR(
4686                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4687         fi
4688     fi
4689     PKGFORMAT="$with_package_format"
4690     AC_MSG_RESULT([$PKGFORMAT])
4691 else
4692     PKGFORMAT=
4693     AC_MSG_RESULT([none])
4695 AC_SUBST(PKGFORMAT)
4697 dnl ===================================================================
4698 dnl Set up a different compiler to produce tools to run on the build
4699 dnl machine when doing cross-compilation
4700 dnl ===================================================================
4702 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4703 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4704 if test "$cross_compiling" = "yes"; then
4705     AC_MSG_CHECKING([for BUILD platform configuration])
4706     echo
4707     rm -rf CONF-FOR-BUILD config_build.mk
4708     mkdir CONF-FOR-BUILD
4709     # Here must be listed all files needed when running the configure script. In particular, also
4710     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4711     # keep them in the same order as there.
4712     (cd $SRC_ROOT && tar cf - \
4713         config.guess \
4714         bin/get_config_variables \
4715         solenv/bin/getcompver.awk \
4716         solenv/inc/langlist.mk \
4717         download.lst \
4718         config_host.mk.in \
4719         config_host_lang.mk.in \
4720         Makefile.in \
4721         bin/bffvalidator.sh.in \
4722         bin/odfvalidator.sh.in \
4723         bin/officeotron.sh.in \
4724         instsetoo_native/util/openoffice.lst.in \
4725         config_host/*.in \
4726         sysui/desktop/macosx/Info.plist.in) \
4727     | (cd CONF-FOR-BUILD && tar xf -)
4728     cp configure CONF-FOR-BUILD
4729     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4730     (
4731     unset COM USING_X11 OS CPUNAME
4732     unset CC CXX SYSBASE CFLAGS
4733     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4734     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4735     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4736     if test -n "$CC_FOR_BUILD"; then
4737         export CC="$CC_FOR_BUILD"
4738         CC_BASE=`first_arg_basename "$CC"`
4739     fi
4740     if test -n "$CXX_FOR_BUILD"; then
4741         export CXX="$CXX_FOR_BUILD"
4742         CXX_BASE=`first_arg_basename "$CXX"`
4743     fi
4744     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4745     cd CONF-FOR-BUILD
4746     sub_conf_opts=""
4747     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4748     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4749     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4750     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4751     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4752     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4753     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4754     # Don't bother having configure look for stuff not needed for the build platform anyway
4755     ./configure \
4756         --disable-cups \
4757         --disable-gstreamer-1-0 \
4758         --disable-gtk3 \
4759         --disable-pdfimport \
4760         --disable-postgresql-sdbc \
4761         --with-parallelism="$with_parallelism" \
4762         --without-doxygen \
4763         --without-java \
4764         $sub_conf_opts \
4765         --srcdir=$srcdir \
4766         2>&1 | sed -e 's/^/    /'
4767     test -f ./config_host.mk 2>/dev/null || exit
4768     cp config_host.mk ../config_build.mk
4769     cp config_host_lang.mk ../config_build_lang.mk
4770     mv config.log ../config.Build.log
4771     mkdir -p ../config_build
4772     mv config_host/*.h ../config_build
4773     . ./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
4775     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
4776         VV='$'$V
4777         VV=`eval "echo $VV"`
4778         if test -n "$VV"; then
4779             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4780             echo "$line" >>build-config
4781         fi
4782     done
4784     for V in INSTDIR INSTROOT WORKDIR; do
4785         VV='$'$V
4786         VV=`eval "echo $VV"`
4787         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4788         if test -n "$VV"; then
4789             line="${V}_FOR_BUILD='$VV'"
4790             echo "$line" >>build-config
4791         fi
4792     done
4794     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4795     echo "$line" >>build-config
4797     )
4798     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4799     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])
4800     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4801              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4803     eval `cat CONF-FOR-BUILD/build-config`
4805     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4807     rm -rf CONF-FOR-BUILD
4808 else
4809     OS_FOR_BUILD="$OS"
4810     CC_FOR_BUILD="$CC"
4811     CXX_FOR_BUILD="$CXX"
4812     INSTDIR_FOR_BUILD="$INSTDIR"
4813     INSTROOT_FOR_BUILD="$INSTROOT"
4814     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4815     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4816     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4817     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4818     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4819     WORKDIR_FOR_BUILD="$WORKDIR"
4821 AC_SUBST(OS_FOR_BUILD)
4822 AC_SUBST(INSTDIR_FOR_BUILD)
4823 AC_SUBST(INSTROOT_FOR_BUILD)
4824 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4825 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4826 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4827 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4828 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4829 AC_SUBST(WORKDIR_FOR_BUILD)
4831 dnl ===================================================================
4832 dnl Check for syslog header
4833 dnl ===================================================================
4834 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4836 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4837 dnl ===================================================================
4838 AC_MSG_CHECKING([whether to turn warnings to errors])
4839 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4840     ENABLE_WERROR="TRUE"
4841     AC_MSG_RESULT([yes])
4842 else
4843     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4844         ENABLE_WERROR="TRUE"
4845         AC_MSG_RESULT([yes])
4846     else
4847         AC_MSG_RESULT([no])
4848     fi
4850 AC_SUBST(ENABLE_WERROR)
4852 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4853 dnl ===================================================================
4854 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4855 if test -z "$enable_assert_always_abort"; then
4856    if test "$ENABLE_DEBUG" = TRUE; then
4857        enable_assert_always_abort=yes
4858    else
4859        enable_assert_always_abort=no
4860    fi
4862 if test "$enable_assert_always_abort" = "yes"; then
4863     ASSERT_ALWAYS_ABORT="TRUE"
4864     AC_MSG_RESULT([yes])
4865 else
4866     ASSERT_ALWAYS_ABORT="FALSE"
4867     AC_MSG_RESULT([no])
4869 AC_SUBST(ASSERT_ALWAYS_ABORT)
4871 # Determine whether to use ooenv for the instdir installation
4872 # ===================================================================
4873 if test $_os != "WINNT" -a $_os != "Darwin"; then
4874     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4875     if test "$enable_ooenv" = "no"; then
4876         AC_MSG_RESULT([no])
4877     else
4878         ENABLE_OOENV="TRUE"
4879         AC_MSG_RESULT([yes])
4880     fi
4882 AC_SUBST(ENABLE_OOENV)
4884 if test "$USING_X11" != TRUE; then
4885     # be sure to do not mess with unneeded stuff
4886     test_randr=no
4887     test_xrender=no
4888     test_cups=no
4889     test_dbus=no
4890     build_gstreamer_1_0=no
4891     test_kf5=no
4892     test_qt5=no
4893     test_gtk3_kde5=no
4894     enable_cairo_canvas=no
4897 if test "$OS" = "HAIKU"; then
4898     enable_cairo_canvas=yes
4899     test_kf5=yes
4902 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4903     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!])
4904     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!"
4905     enable_kf5=yes
4908 if test "$test_kf5" = "yes"; then
4909     test_qt5=yes
4912 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4913     if test "$enable_qt5" = "no"; then
4914         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4915     else
4916         enable_qt5=yes
4917     fi
4920 dnl ===================================================================
4921 dnl check for cups support
4922 dnl ===================================================================
4923 ENABLE_CUPS=""
4925 if test "$enable_cups" = "no"; then
4926     test_cups=no
4929 AC_MSG_CHECKING([whether to enable CUPS support])
4930 if test "$test_cups" = "yes"; then
4931     ENABLE_CUPS="TRUE"
4932     AC_MSG_RESULT([yes])
4934     AC_MSG_CHECKING([whether cups support is present])
4935     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4936     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4937     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4938         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4939     fi
4941 else
4942     AC_MSG_RESULT([no])
4945 AC_SUBST(ENABLE_CUPS)
4947 # fontconfig checks
4948 if test "$test_fontconfig" = "yes"; then
4949     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4950     SYSTEM_FONTCONFIG=TRUE
4951     FilterLibs "${FONTCONFIG_LIBS}"
4952     FONTCONFIG_LIBS="${filteredlibs}"
4954 AC_SUBST(FONTCONFIG_CFLAGS)
4955 AC_SUBST(FONTCONFIG_LIBS)
4956 AC_SUBST([SYSTEM_FONTCONFIG])
4958 dnl whether to find & fetch external tarballs?
4959 dnl ===================================================================
4960 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4961    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4962        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4963    else
4964        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4965    fi
4967 if test -z "$TARFILE_LOCATION"; then
4968     if test -d "$SRC_ROOT/src" ; then
4969         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4970         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4971     fi
4972     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4973 else
4974     AbsolutePath "$TARFILE_LOCATION"
4975     PathFormat "${absolute_path}"
4976     TARFILE_LOCATION="${formatted_path}"
4978 AC_SUBST(TARFILE_LOCATION)
4980 AC_MSG_CHECKING([whether we want to fetch tarballs])
4981 if test "$enable_fetch_external" != "no"; then
4982     if test "$with_all_tarballs" = "yes"; then
4983         AC_MSG_RESULT([yes, all of them])
4984         DO_FETCH_TARBALLS="ALL"
4985     else
4986         AC_MSG_RESULT([yes, if we use them])
4987         DO_FETCH_TARBALLS="TRUE"
4988     fi
4989 else
4990     AC_MSG_RESULT([no])
4991     DO_FETCH_TARBALLS=
4993 AC_SUBST(DO_FETCH_TARBALLS)
4995 AC_MSG_CHECKING([whether to build help])
4996 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4997     BUILD_TYPE="$BUILD_TYPE HELP"
4998     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4999     case "$with_help" in
5000     "html")
5001         ENABLE_HTMLHELP=TRUE
5002         SCPDEFS="$SCPDEFS -DWITH_HELP"
5003         AC_MSG_RESULT([HTML])
5004         ;;
5005     "online")
5006         ENABLE_HTMLHELP=TRUE
5007         HELP_ONLINE=TRUE
5008         AC_MSG_RESULT([HTML])
5009         ;;
5010     yes)
5011         SCPDEFS="$SCPDEFS -DWITH_HELP"
5012         AC_MSG_RESULT([yes])
5013         ;;
5014     *)
5015         AC_MSG_ERROR([Unknown --with-help=$with_help])
5016         ;;
5017     esac
5018 else
5019     AC_MSG_RESULT([no])
5021 AC_SUBST([ENABLE_HTMLHELP])
5022 AC_SUBST([HELP_ONLINE])
5024 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5025 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5026     BUILD_TYPE="$BUILD_TYPE HELP"
5027     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5028     case "$with_omindex" in
5029     "server")
5030         ENABLE_HTMLHELP=TRUE
5031         HELP_ONLINE=TRUE
5032         HELP_OMINDEX_PAGE=TRUE
5033         AC_MSG_RESULT([SERVER])
5034         ;;
5035     "noxap")
5036         ENABLE_HTMLHELP=TRUE
5037         HELP_ONLINE=TRUE
5038         HELP_OMINDEX_PAGE=FALSE
5039         AC_MSG_RESULT([NOXAP])
5040         ;;
5041     *)
5042         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5043         ;;
5044     esac
5045 else
5046     HELP_OMINDEX_PAGE=FALSE
5047     AC_MSG_RESULT([no])
5049 AC_SUBST([ENABLE_HTMLHELP])
5050 AC_SUBST([HELP_OMINDEX_PAGE])
5051 AC_SUBST([HELP_ONLINE])
5054 dnl Test whether to include MySpell dictionaries
5055 dnl ===================================================================
5056 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5057 if test "$with_myspell_dicts" = "yes"; then
5058     AC_MSG_RESULT([yes])
5059     WITH_MYSPELL_DICTS=TRUE
5060     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5061     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5062 else
5063     AC_MSG_RESULT([no])
5064     WITH_MYSPELL_DICTS=
5066 AC_SUBST(WITH_MYSPELL_DICTS)
5068 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5069 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5070     if test "$with_system_dicts" = yes; then
5071         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5072     fi
5073     with_system_dicts=no
5076 AC_MSG_CHECKING([whether to use dicts from external paths])
5077 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5078     AC_MSG_RESULT([yes])
5079     SYSTEM_DICTS=TRUE
5080     AC_MSG_CHECKING([for spelling dictionary directory])
5081     if test -n "$with_external_dict_dir"; then
5082         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5083     else
5084         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5085         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5086             DICT_SYSTEM_DIR=file:///usr/share/myspell
5087         fi
5088     fi
5089     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5090     AC_MSG_CHECKING([for hyphenation patterns directory])
5091     if test -n "$with_external_hyph_dir"; then
5092         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5093     else
5094         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5095     fi
5096     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5097     AC_MSG_CHECKING([for thesaurus directory])
5098     if test -n "$with_external_thes_dir"; then
5099         THES_SYSTEM_DIR=file://$with_external_thes_dir
5100     else
5101         THES_SYSTEM_DIR=file:///usr/share/mythes
5102     fi
5103     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5104 else
5105     AC_MSG_RESULT([no])
5106     SYSTEM_DICTS=
5108 AC_SUBST(SYSTEM_DICTS)
5109 AC_SUBST(DICT_SYSTEM_DIR)
5110 AC_SUBST(HYPH_SYSTEM_DIR)
5111 AC_SUBST(THES_SYSTEM_DIR)
5113 dnl ===================================================================
5114 dnl Precompiled headers.
5115 ENABLE_PCH=""
5116 AC_MSG_CHECKING([whether to enable pch feature])
5117 if test -z "$enable_pch"; then
5118     if test "$_os" = "WINNT"; then
5119         # Enabled by default on Windows.
5120         enable_pch=yes
5121     else
5122         enable_pch=no
5123     fi
5125 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5126     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5128 if test "$enable_pch" = "system"; then
5129     ENABLE_PCH="1"
5130     AC_MSG_RESULT([yes (system headers)])
5131 elif test "$enable_pch" = "base"; then
5132     ENABLE_PCH="2"
5133     AC_MSG_RESULT([yes (system and base headers)])
5134 elif test "$enable_pch" = "normal"; then
5135     ENABLE_PCH="3"
5136     AC_MSG_RESULT([yes (normal)])
5137 elif test "$enable_pch" = "full"; then
5138     ENABLE_PCH="4"
5139     AC_MSG_RESULT([yes (full)])
5140 elif test "$enable_pch" = "yes"; then
5141     # Pick a suitable default.
5142     if test "$GCC" = "yes"; then
5143         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5144         # while making the PCHs larger and rebuilds more likely.
5145         ENABLE_PCH="2"
5146         AC_MSG_RESULT([yes (system and base headers)])
5147     else
5148         # With MSVC the highest level makes a significant difference,
5149         # and it was the default when there used to be no PCH levels.
5150         ENABLE_PCH="4"
5151         AC_MSG_RESULT([yes (full)])
5152     fi
5153 elif test "$enable_pch" = "no"; then
5154     AC_MSG_RESULT([no])
5155 else
5156     AC_MSG_ERROR([Unknown value for --enable-pch])
5158 AC_SUBST(ENABLE_PCH)
5159 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5160 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5161     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5162     if test "$CCACHE_BIN" != "not found"; then
5163         AC_MSG_CHECKING([ccache version])
5164         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5165         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5166         AC_MSG_RESULT([$CCACHE_VERSION])
5167         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5168         if test "$CCACHE_NUMVER" -gt "030701"; then
5169             AC_MSG_RESULT([yes])
5170         else
5171             AC_MSG_RESULT([no (not newer than 3.7.1)])
5172             CCACHE_DEPEND_MODE=
5173         fi
5174     fi
5177 TAB=`printf '\t'`
5179 AC_MSG_CHECKING([the GNU Make version])
5180 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5181 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5182 if test "$_make_longver" -ge "038200"; then
5183     AC_MSG_RESULT([$GNUMAKE $_make_version])
5185 elif test "$_make_longver" -ge "038100"; then
5186     if test "$build_os" = "cygwin"; then
5187         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5188     fi
5189     AC_MSG_RESULT([$GNUMAKE $_make_version])
5191     dnl ===================================================================
5192     dnl Search all the common names for sha1sum
5193     dnl ===================================================================
5194     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5195     if test -z "$SHA1SUM"; then
5196         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5197     elif test "$SHA1SUM" = "openssl"; then
5198         SHA1SUM="openssl sha1"
5199     fi
5200     AC_MSG_CHECKING([for GNU Make bug 20033])
5201     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5202     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5203 A := \$(wildcard *.a)
5205 .PHONY: all
5206 all: \$(A:.a=.b)
5207 <TAB>@echo survived bug20033.
5209 .PHONY: setup
5210 setup:
5211 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5213 define d1
5214 @echo lala \$(1)
5215 @sleep 1
5216 endef
5218 define d2
5219 @echo tyty \$(1)
5220 @sleep 1
5221 endef
5223 %.b : %.a
5224 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5225 <TAB>\$(call d1,\$(CHECKSUM)),\
5226 <TAB>\$(call d2,\$(CHECKSUM)))
5228     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5229         no_parallelism_make="YES"
5230         AC_MSG_RESULT([yes, disable parallelism])
5231     else
5232         AC_MSG_RESULT([no, keep parallelism enabled])
5233     fi
5234     rm -rf $TESTGMAKEBUG20033
5235 else
5236     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5239 # find if gnumake support file function
5240 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5241 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5242 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5243     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5245 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5246 \$(file >test.txt,Success )
5248 .PHONY: all
5249 all:
5250 <TAB>@cat test.txt
5253 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5254 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5255     HAVE_GNUMAKE_FILE_FUNC=TRUE
5256     AC_MSG_RESULT([yes])
5257 else
5258     AC_MSG_RESULT([no])
5260 rm -rf $TESTGMAKEFILEFUNC
5261 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5262 AC_SUBST(GNUMAKE_WIN_NATIVE)
5264 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5265 STALE_MAKE=
5266 if test "$_make_ver_check" = ""; then
5267    STALE_MAKE=TRUE
5270 HAVE_LD_HASH_STYLE=FALSE
5271 WITH_LINKER_HASH_STYLE=
5272 AC_MSG_CHECKING([for --hash-style gcc linker support])
5273 if test "$GCC" = "yes"; then
5274     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5275         hash_styles="gnu sysv"
5276     elif test "$with_linker_hash_style" = "no"; then
5277         hash_styles=
5278     else
5279         hash_styles="$with_linker_hash_style"
5280     fi
5282     for hash_style in $hash_styles; do
5283         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5284         hash_style_ldflags_save=$LDFLAGS
5285         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5287         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5288             [
5289 #include <stdio.h>
5290             ],[
5291 printf ("");
5292             ])],
5293             [
5294                   HAVE_LD_HASH_STYLE=TRUE
5295                   WITH_LINKER_HASH_STYLE=$hash_style
5296             ],
5297             [HAVE_LD_HASH_STYLE=FALSE],
5298             [HAVE_LD_HASH_STYLE=FALSE])
5299         LDFLAGS=$hash_style_ldflags_save
5300     done
5302     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5303         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5304     else
5305         AC_MSG_RESULT( no )
5306     fi
5307     LDFLAGS=$hash_style_ldflags_save
5308 else
5309     AC_MSG_RESULT( no )
5311 AC_SUBST(HAVE_LD_HASH_STYLE)
5312 AC_SUBST(WITH_LINKER_HASH_STYLE)
5314 dnl ===================================================================
5315 dnl Check whether there's a Perl version available.
5316 dnl ===================================================================
5317 if test -z "$with_perl_home"; then
5318     AC_PATH_PROG(PERL, perl)
5319 else
5320     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5321     _perl_path="$with_perl_home/bin/perl"
5322     if test -x "$_perl_path"; then
5323         PERL=$_perl_path
5324     else
5325         AC_MSG_ERROR([$_perl_path not found])
5326     fi
5329 dnl ===================================================================
5330 dnl Testing for Perl version 5 or greater.
5331 dnl $] is the Perl version variable, it is returned as an integer
5332 dnl ===================================================================
5333 if test "$PERL"; then
5334     AC_MSG_CHECKING([the Perl version])
5335     ${PERL} -e "exit($]);"
5336     _perl_version=$?
5337     if test "$_perl_version" -lt 5; then
5338         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5339     fi
5340     AC_MSG_RESULT([Perl $_perl_version])
5341 else
5342     AC_MSG_ERROR([Perl not found, install Perl 5])
5345 dnl ===================================================================
5346 dnl Testing for required Perl modules
5347 dnl ===================================================================
5349 AC_MSG_CHECKING([for required Perl modules])
5350 perl_use_string="use Cwd ; use Digest::MD5"
5351 if test "$_os" = "WINNT"; then
5352     if test -n "$PKGFORMAT"; then
5353         for i in $PKGFORMAT; do
5354             case "$i" in
5355             msi)
5356                 # for getting fonts versions to use in MSI
5357                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5358                 ;;
5359             esac
5360         done
5361     fi
5363 if test "$with_system_hsqldb" = "yes"; then
5364     perl_use_string="$perl_use_string ; use Archive::Zip"
5366 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5367     AC_MSG_RESULT([all modules found])
5368 else
5369     AC_MSG_RESULT([failed to find some modules])
5370     # Find out which modules are missing.
5371     for i in $perl_use_string; do
5372         if test "$i" != "use" -a "$i" != ";"; then
5373             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5374                 missing_perl_modules="$missing_perl_modules $i"
5375             fi
5376         fi
5377     done
5378     AC_MSG_ERROR([
5379     The missing Perl modules are: $missing_perl_modules
5380     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5383 dnl ===================================================================
5384 dnl Check for pkg-config
5385 dnl ===================================================================
5386 if test "$_os" != "WINNT"; then
5387     PKG_PROG_PKG_CONFIG
5390 if test "$_os" != "WINNT"; then
5392     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5393     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5394     # explicitly. Or put /path/to/compiler in PATH yourself.
5396     # Use wrappers for LTO
5397     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5398         AC_CHECK_TOOL(AR,gcc-ar)
5399         AC_CHECK_TOOL(NM,gcc-nm)
5400         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5401     else
5402         AC_CHECK_TOOL(AR,ar)
5403         AC_CHECK_TOOL(NM,nm)
5404         AC_CHECK_TOOL(RANLIB,ranlib)
5405     fi
5406     AC_CHECK_TOOL(OBJDUMP,objdump)
5407     AC_CHECK_TOOL(READELF,readelf)
5408     AC_CHECK_TOOL(STRIP,strip)
5409     if test "$_os" = "WINNT"; then
5410         AC_CHECK_TOOL(DLLTOOL,dlltool)
5411         AC_CHECK_TOOL(WINDRES,windres)
5412     fi
5414 AC_SUBST(AR)
5415 AC_SUBST(DLLTOOL)
5416 AC_SUBST(NM)
5417 AC_SUBST(OBJDUMP)
5418 AC_SUBST(PKG_CONFIG)
5419 AC_SUBST(RANLIB)
5420 AC_SUBST(READELF)
5421 AC_SUBST(STRIP)
5422 AC_SUBST(WINDRES)
5424 dnl ===================================================================
5425 dnl pkg-config checks on macOS
5426 dnl ===================================================================
5428 if test $_os = Darwin; then
5429     AC_MSG_CHECKING([for bogus pkg-config])
5430     if test -n "$PKG_CONFIG"; then
5431         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5432             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5433         else
5434             if test "$enable_bogus_pkg_config" = "yes"; then
5435                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5436             else
5437                 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.])
5438             fi
5439         fi
5440     else
5441         AC_MSG_RESULT([no, good])
5442     fi
5445 find_csc()
5447     # Return value: $csctest
5449     unset csctest
5451     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5452     if test -n "$regvalue"; then
5453         csctest=$regvalue
5454         return
5455     fi
5458 find_al()
5460     # Return value: $altest
5462     unset altest
5464     # We need this check to detect 4.6.1 or above.
5465     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5466         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5467         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5468             altest=$regvalue
5469             return
5470         fi
5471     done
5473     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5474         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5475         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5476             altest=$regvalue
5477             return
5478         fi
5479     done
5484 find_dotnetsdk46()
5486     unset frametest
5488     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5489         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5490         if test -n "$regvalue"; then
5491             frametest=$regvalue
5492             return
5493         fi
5494     done
5497 find_winsdk_version()
5499     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5500     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5502     unset winsdktest winsdkbinsubdir winsdklibsubdir
5504     case "$1" in
5505     8.0|8.0A)
5506         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5507         if test -n "$regvalue"; then
5508             winsdktest=$regvalue
5509             winsdklibsubdir=win8
5510             return
5511         fi
5512         ;;
5513     8.1|8.1A)
5514         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5515         if test -n "$regvalue"; then
5516             winsdktest=$regvalue
5517             winsdklibsubdir=winv6.3
5518             return
5519         fi
5520         ;;
5521     10.0)
5522         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5523         if test -n "$regvalue"; then
5524             winsdktest=$regvalue
5525             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5526             if test -n "$regvalue"; then
5527                 winsdkbinsubdir="$regvalue".0
5528                 winsdklibsubdir=$winsdkbinsubdir
5529                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5530                 # test exist the SDK path
5531                 if test -d "$tmppath"; then
5532                    # when path is convertible to a short path then path is okay
5533                    cygpath -d "$tmppath" >/dev/null 2>&1
5534                    if test $? -ne 0; then
5535                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5536                    fi
5537                 else
5538                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5539                 fi
5540             fi
5541             return
5542         fi
5543         ;;
5544     esac
5547 find_winsdk()
5549     # Return value: From find_winsdk_version
5551     unset winsdktest
5553     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5554         find_winsdk_version $ver
5555         if test -n "$winsdktest"; then
5556             return
5557         fi
5558     done
5561 find_msms()
5563     AC_MSG_CHECKING([for MSVC merge modules directory])
5564     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5565     case "$VCVER" in
5566         150|160)
5567         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5568         ;;
5569     esac
5570     for f in $my_msm_files; do
5571         echo "$as_me:$LINENO: searching for $f" >&5
5572     done
5574     msmdir=
5575     for ver in 14.0 15.0; do
5576         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5577         if test -n "$regvalue"; then
5578             for f in ${my_msm_files}; do
5579                 if test -e "$regvalue/${f}"; then
5580                     msmdir=$regvalue
5581                     break
5582                 fi
5583             done
5584         fi
5585     done
5586     dnl Is the following fallback really necessary, or was it added in response
5587     dnl to never having started Visual Studio on a given machine, so the
5588     dnl registry keys checked above had presumably not yet been created?
5589     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5590     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5591     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5592     dnl expanding to "C:\Program Files\Common Files"), which would need
5593     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5594     dnl obtain its value from cygwin:
5595     if test -z "$msmdir"; then
5596         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5597         for f in ${my_msm_files}; do
5598             if test -e "$my_msm_dir/${f}"; then
5599                 msmdir=$my_msm_dir
5600             fi
5601         done
5602     fi
5604     dnl Starting from MSVC 15.0, merge modules are located in different directory
5605     case "$VCVER" in
5606     150|160)
5607         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5608             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5609             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5610             for f in ${my_msm_files}; do
5611                 if test -e "$my_msm_dir/${f}"; then
5612                     msmdir=$my_msm_dir
5613                     break
5614                 fi
5615             done
5616         done
5617         ;;
5618     esac
5620     if test -n "$msmdir"; then
5621         msmdir=`cygpath -m "$msmdir"`
5622         AC_MSG_RESULT([$msmdir])
5623     else
5624         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5625             AC_MSG_FAILURE([not found])
5626         else
5627             AC_MSG_WARN([not found (check config.log)])
5628             add_warning "MSM none of ${my_msm_files} found"
5629         fi
5630     fi
5633 find_msvc_x64_dlls()
5635     AC_MSG_CHECKING([for MSVC x64 DLL path])
5636     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5637     case "$VCVER" in
5638     150|160)
5639         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5640             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5641             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5642                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5643                 break
5644             fi
5645             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5646             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5647                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5648                 break
5649             fi
5650             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5651             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5652                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5653                 break
5654             fi
5655         done
5656         ;;
5657     esac
5658     AC_MSG_RESULT([$msvcdllpath])
5659     AC_MSG_CHECKING([for MSVC x64 DLLs])
5660     msvcdlls="msvcp140.dll vcruntime140.dll"
5661     for dll in $msvcdlls; do
5662         if ! test -f "$msvcdllpath/$dll"; then
5663             AC_MSG_FAILURE([missing $dll])
5664         fi
5665     done
5666     AC_MSG_RESULT([found all ($msvcdlls)])
5669 dnl =========================================
5670 dnl Check for the Windows  SDK.
5671 dnl =========================================
5672 if test "$_os" = "WINNT"; then
5673     AC_MSG_CHECKING([for Windows SDK])
5674     if test "$build_os" = "cygwin"; then
5675         find_winsdk
5676         WINDOWS_SDK_HOME=$winsdktest
5678         # normalize if found
5679         if test -n "$WINDOWS_SDK_HOME"; then
5680             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5681             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5682         fi
5684         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5685     fi
5687     if test -n "$WINDOWS_SDK_HOME"; then
5688         # Remove a possible trailing backslash
5689         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5691         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5692              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5693              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5694             have_windows_sdk_headers=yes
5695         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5696              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5697              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5698             have_windows_sdk_headers=yes
5699         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5700              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5701              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5702             have_windows_sdk_headers=yes
5703         else
5704             have_windows_sdk_headers=no
5705         fi
5707         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5708             have_windows_sdk_libs=yes
5709         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5710             have_windows_sdk_libs=yes
5711         else
5712             have_windows_sdk_libs=no
5713         fi
5715         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5716             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5717 the  Windows SDK are installed.])
5718         fi
5719     fi
5721     if test -z "$WINDOWS_SDK_HOME"; then
5722         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5723     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5724         WINDOWS_SDK_VERSION=80
5725         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5726     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5727         WINDOWS_SDK_VERSION=81
5728         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5729     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5730         WINDOWS_SDK_VERSION=10
5731         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5732     else
5733         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5734     fi
5735     PathFormat "$WINDOWS_SDK_HOME"
5736     WINDOWS_SDK_HOME="$formatted_path"
5737     if test "$build_os" = "cygwin"; then
5738         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5739         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5740             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5741         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5742             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5743         fi
5744     fi
5746     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5747     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5748     dnl but not in v8.0), so allow this to be overridden with a
5749     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5750     dnl and configuration error if no WiLangId.vbs is found would arguably be
5751     dnl better, but I do not know under which conditions exactly it is needed by
5752     dnl msiglobal.pm:
5753     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5754         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5755         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5756             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5757         fi
5758         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5759             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5760         fi
5761         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5762             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5763         fi
5764     fi
5765     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5766         if test -n "$with_package_format" -a "$with_package_format" != no; then
5767             for i in "$with_package_format"; do
5768                 if test "$i" = "msi"; then
5769                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5770                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5771                     fi
5772                 fi
5773             done
5774         fi
5775     fi
5777 AC_SUBST(WINDOWS_SDK_HOME)
5778 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5779 AC_SUBST(WINDOWS_SDK_VERSION)
5780 AC_SUBST(WINDOWS_SDK_WILANGID)
5782 if test "$build_os" = "cygwin"; then
5783     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5784     dnl dir, it also determines that dir's path w/o an arch segment if any,
5785     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5786     AC_MSG_CHECKING([for midl.exe])
5788     find_winsdk
5789     if test -n "$winsdkbinsubdir" \
5790         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5791     then
5792         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5793         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5794     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5795         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5796         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5797     elif test -f "$winsdktest/Bin/midl.exe"; then
5798         MIDL_PATH=$winsdktest/Bin
5799         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5800     fi
5801     if test ! -f "$MIDL_PATH/midl.exe"; then
5802         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5803     else
5804         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5805     fi
5807     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5808     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5810     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5811          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5812          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5813          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5814     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5815          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5816          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5817          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5818     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5819          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5820          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5821          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5822     else
5823         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5824     fi
5826     dnl Check csc.exe
5827     AC_MSG_CHECKING([for csc.exe])
5828     find_csc
5829     if test -f "$csctest/csc.exe"; then
5830         CSC_PATH="$csctest"
5831     fi
5832     if test ! -f "$CSC_PATH/csc.exe"; then
5833         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5834     else
5835         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5836     fi
5838     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5840     dnl Check al.exe
5841     AC_MSG_CHECKING([for al.exe])
5842     find_winsdk
5843     if test -n "$winsdkbinsubdir" \
5844         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5845     then
5846         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5847     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5848         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5849     elif test -f "$winsdktest/Bin/al.exe"; then
5850         AL_PATH="$winsdktest/Bin"
5851     fi
5853     if test -z "$AL_PATH"; then
5854         find_al
5855         if test -f "$altest/bin/al.exe"; then
5856             AL_PATH="$altest/bin"
5857         elif test -f "$altest/al.exe"; then
5858             AL_PATH="$altest"
5859         fi
5860     fi
5861     if test ! -f "$AL_PATH/al.exe"; then
5862         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5863     else
5864         AC_MSG_RESULT([$AL_PATH/al.exe])
5865     fi
5867     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5869     dnl Check mscoree.lib / .NET Framework dir
5870     AC_MSG_CHECKING(.NET Framework)
5871     find_dotnetsdk46
5872     PathFormat "$frametest"
5873     frametest="$formatted_path"
5874     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5875         DOTNET_FRAMEWORK_HOME="$frametest"
5876     else
5877         find_winsdk
5878         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5879             DOTNET_FRAMEWORK_HOME="$winsdktest"
5880         fi
5881     fi
5882     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
5883         AC_MSG_ERROR([mscoree.lib not found])
5884     fi
5885     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5887     PathFormat "$MIDL_PATH"
5888     MIDL_PATH="$formatted_path"
5890     PathFormat "$AL_PATH"
5891     AL_PATH="$formatted_path"
5893     PathFormat "$DOTNET_FRAMEWORK_HOME"
5894     DOTNET_FRAMEWORK_HOME="$formatted_path"
5896     PathFormat "$CSC_PATH"
5897     CSC_PATH="$formatted_path"
5900 dnl ===================================================================
5901 dnl Check if stdc headers are available excluding MSVC.
5902 dnl ===================================================================
5903 if test "$_os" != "WINNT"; then
5904     AC_HEADER_STDC
5907 dnl ===================================================================
5908 dnl Testing for C++ compiler and version...
5909 dnl ===================================================================
5911 if test "$_os" != "WINNT"; then
5912     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5913     save_CXXFLAGS=$CXXFLAGS
5914     AC_PROG_CXX
5915     CXXFLAGS=$save_CXXFLAGS
5916     if test -z "$CXX_BASE"; then
5917         CXX_BASE=`first_arg_basename "$CXX"`
5918     fi
5921 dnl check for GNU C++ compiler version
5922 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5923     AC_MSG_CHECKING([the GNU C++ compiler version])
5925     _gpp_version=`$CXX -dumpversion`
5926     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5928     if test "$_gpp_majmin" -lt "700"; then
5929         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5930     else
5931         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5932     fi
5934     dnl see https://code.google.com/p/android/issues/detail?id=41770
5935         glibcxx_threads=no
5936         AC_LANG_PUSH([C++])
5937         AC_REQUIRE_CPP
5938         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5939         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5940             #include <bits/c++config.h>]],[[
5941             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5942             && !defined(_GLIBCXX__PTHREADS) \
5943             && !defined(_GLIBCXX_HAS_GTHREADS)
5944             choke me
5945             #endif
5946         ]])],[AC_MSG_RESULT([yes])
5947         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5948         AC_LANG_POP([C++])
5949         if test $glibcxx_threads = yes; then
5950             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5951         fi
5953 AC_SUBST(BOOST_CXXFLAGS)
5956 # prefx CXX with ccache if needed
5958 if test "$CCACHE" != ""; then
5959     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5960     AC_LANG_PUSH([C++])
5961     save_CXXFLAGS=$CXXFLAGS
5962     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5963     dnl an empty program will do, we're checking the compiler flags
5964     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5965                       [use_ccache=yes], [use_ccache=no])
5966     if test $use_ccache = yes; then
5967         AC_MSG_RESULT([yes])
5968     else
5969         CXX="$CCACHE $CXX"
5970         CXX_BASE="ccache $CXX_BASE"
5971         AC_MSG_RESULT([no])
5972     fi
5973     CXXFLAGS=$save_CXXFLAGS
5974     AC_LANG_POP([C++])
5977 dnl ===================================================================
5978 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5979 dnl ===================================================================
5981 if test "$_os" != "WINNT"; then
5982     AC_PROG_CXXCPP
5984     dnl Check whether there's a C pre-processor.
5985     AC_PROG_CPP
5989 dnl ===================================================================
5990 dnl Find integral type sizes and alignments
5991 dnl ===================================================================
5993 if test "$_os" != "WINNT"; then
5995 if test "$_os" = "iOS"; then
5996     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5997     ac_cv_sizeof_long=8
5998     ac_cv_sizeof_short=2
5999     ac_cv_sizeof_int=4
6000     ac_cv_sizeof_long_long=8
6001     ac_cv_sizeof_double=8
6002     ac_cv_sizeof_voidp=8
6003 else
6004     AC_CHECK_SIZEOF(long)
6005     AC_CHECK_SIZEOF(short)
6006     AC_CHECK_SIZEOF(int)
6007     AC_CHECK_SIZEOF(long long)
6008     AC_CHECK_SIZEOF(double)
6009     AC_CHECK_SIZEOF(void*)
6012     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6013     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6014     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6015     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6016     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6018     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6019     m4_pattern_allow([AC_CHECK_ALIGNOF])
6020     m4_ifdef([AC_CHECK_ALIGNOF],
6021         [
6022             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6023             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6024             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6025             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6026         ],
6027         [
6028             case "$_os-$host_cpu" in
6029             Linux-i686)
6030                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6031                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6032                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6033                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6034                 ;;
6035             Linux-x86_64)
6036                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6037                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6038                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6039                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6040                 ;;
6041             *)
6042                 if test -z "$ac_cv_alignof_short" -o \
6043                         -z "$ac_cv_alignof_int" -o \
6044                         -z "$ac_cv_alignof_long" -o \
6045                         -z "$ac_cv_alignof_double"; then
6046                    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.])
6047                 fi
6048                 ;;
6049             esac
6050         ])
6052     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6053     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6054     if test $ac_cv_sizeof_long -eq 8; then
6055         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6056     elif test $ac_cv_sizeof_double -eq 8; then
6057         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6058     else
6059         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6060     fi
6062     dnl Check for large file support
6063     AC_SYS_LARGEFILE
6064     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6065         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6066     fi
6067     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6068         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6069     fi
6070 else
6071     # Hardcode for MSVC
6072     SAL_TYPES_SIZEOFSHORT=2
6073     SAL_TYPES_SIZEOFINT=4
6074     SAL_TYPES_SIZEOFLONG=4
6075     SAL_TYPES_SIZEOFLONGLONG=8
6076     if test "$BITNESS_OVERRIDE" = ""; then
6077         SAL_TYPES_SIZEOFPOINTER=4
6078     else
6079         SAL_TYPES_SIZEOFPOINTER=8
6080     fi
6081     SAL_TYPES_ALIGNMENT2=2
6082     SAL_TYPES_ALIGNMENT4=4
6083     SAL_TYPES_ALIGNMENT8=8
6084     LFS_CFLAGS=''
6086 AC_SUBST(LFS_CFLAGS)
6088 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6089 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6090 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6091 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6092 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6093 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6094 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6095 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6097 dnl ===================================================================
6098 dnl Check whether to enable runtime optimizations
6099 dnl ===================================================================
6100 ENABLE_RUNTIME_OPTIMIZATIONS=
6101 AC_MSG_CHECKING([whether to enable runtime optimizations])
6102 if test -z "$enable_runtime_optimizations"; then
6103     for i in $CC; do
6104         case $i in
6105         -fsanitize=*)
6106             enable_runtime_optimizations=no
6107             break
6108             ;;
6109         esac
6110     done
6112 if test "$enable_runtime_optimizations" != no; then
6113     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6114     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6115     AC_MSG_RESULT([yes])
6116 else
6117     AC_MSG_RESULT([no])
6119 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6121 dnl ===================================================================
6122 dnl Check if valgrind headers are available
6123 dnl ===================================================================
6124 ENABLE_VALGRIND=
6125 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6126     prev_cppflags=$CPPFLAGS
6127     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6128     # or where does it come from?
6129     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6130     AC_CHECK_HEADER([valgrind/valgrind.h],
6131         [ENABLE_VALGRIND=TRUE])
6132     CPPFLAGS=$prev_cppflags
6134 AC_SUBST([ENABLE_VALGRIND])
6135 if test -z "$ENABLE_VALGRIND"; then
6136     if test "$with_valgrind" = yes; then
6137         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6138     fi
6139     VALGRIND_CFLAGS=
6141 AC_SUBST([VALGRIND_CFLAGS])
6144 dnl ===================================================================
6145 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6146 dnl ===================================================================
6148 # We need at least the sys/sdt.h include header.
6149 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6150 if test "$SDT_H_FOUND" = "TRUE"; then
6151     # Found sys/sdt.h header, now make sure the c++ compiler works.
6152     # Old g++ versions had problems with probes in constructors/destructors.
6153     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6154     AC_LANG_PUSH([C++])
6155     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6156     #include <sys/sdt.h>
6157     class ProbeClass
6158     {
6159     private:
6160       int& ref;
6161       const char *name;
6163     public:
6164       ProbeClass(int& v, const char *n) : ref(v), name(n)
6165       {
6166         DTRACE_PROBE2(_test_, cons, name, ref);
6167       }
6169       void method(int min)
6170       {
6171         DTRACE_PROBE3(_test_, meth, name, ref, min);
6172         ref -= min;
6173       }
6175       ~ProbeClass()
6176       {
6177         DTRACE_PROBE2(_test_, dest, name, ref);
6178       }
6179     };
6180     ]],[[
6181     int i = 64;
6182     DTRACE_PROBE1(_test_, call, i);
6183     ProbeClass inst = ProbeClass(i, "call");
6184     inst.method(24);
6185     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6186           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6187     AC_LANG_POP([C++])
6189 AC_CONFIG_HEADERS([config_host/config_probes.h])
6191 dnl ===================================================================
6192 dnl GCC features
6193 dnl ===================================================================
6194 HAVE_GCC_STACK_CLASH_PROTECTION=
6195 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6196     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6197     save_CFLAGS=$CFLAGS
6198     CFLAGS="$CFLAGS -fstack-clash-protection"
6199     AC_LINK_IFELSE(
6200         [AC_LANG_PROGRAM(, [[return 0;]])],
6201         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6202         [AC_MSG_RESULT([no])])
6203     CFLAGS=$save_CFLAGS
6205     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6206     save_CFLAGS=$CFLAGS
6207     CFLAGS="$CFLAGS -Werror -mno-avx"
6208     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6209     CFLAGS=$save_CFLAGS
6210     if test "$HAVE_GCC_AVX" = "TRUE"; then
6211         AC_MSG_RESULT([yes])
6212     else
6213         AC_MSG_RESULT([no])
6214     fi
6216     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6217     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6218     int v = 0;
6219     if (__sync_add_and_fetch(&v, 1) != 1 ||
6220         __sync_sub_and_fetch(&v, 1) != 0)
6221         return 1;
6222     __sync_synchronize();
6223     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6224         v != 1)
6225         return 1;
6226     return 0;
6227 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6228     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6229         AC_MSG_RESULT([yes])
6230         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6231     else
6232         AC_MSG_RESULT([no])
6233     fi
6235     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6236     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6237     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6238         AC_MSG_RESULT([yes])
6239         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6240     else
6241         AC_MSG_RESULT([no])
6242     fi
6244     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6245     save_CFLAGS=$CFLAGS
6246     CFLAGS="$CFLAGS -Werror"
6247     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6248             __attribute__((deprecated("test"))) void f();
6249         ])], [
6250             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6251             AC_MSG_RESULT([yes])
6252         ], [AC_MSG_RESULT([no])])
6253     CFLAGS=$save_CFLAGS
6255     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6256     AC_LANG_PUSH([C++])
6257     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6258             #include <cstddef>
6259             #include <cxxabi.h>
6260             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6261         ])], [
6262             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6263             AC_MSG_RESULT([yes])
6264         ], [AC_MSG_RESULT([no])])
6265     AC_LANG_POP([C++])
6267     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6268     AC_LANG_PUSH([C++])
6269     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6270             #include <cstddef>
6271             #include <cxxabi.h>
6272             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6273         ])], [
6274             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6275             AC_MSG_RESULT([yes])
6276         ], [AC_MSG_RESULT([no])])
6277     AC_LANG_POP([C++])
6279     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6280     AC_LANG_PUSH([C++])
6281     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6282             #include <cxxabi.h>
6283             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6284         ])], [
6285             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6286             AC_MSG_RESULT([yes])
6287         ], [AC_MSG_RESULT([no])])
6288     AC_LANG_POP([C++])
6290     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6291     AC_LANG_PUSH([C++])
6292     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6293             #include <cstddef>
6294             #include <cxxabi.h>
6295             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6296         ])], [
6297             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6298             AC_MSG_RESULT([yes])
6299         ], [AC_MSG_RESULT([no])])
6300     AC_LANG_POP([C++])
6302     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6303     AC_LANG_PUSH([C++])
6304     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6305             #include <cstddef>
6306             #include <cxxabi.h>
6307             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6308         ])], [
6309             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[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_get_globals 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_get_globals(); }
6319         ])], [
6320             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[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_current_exception_type in cxxabi.h])
6326     AC_LANG_PUSH([C++])
6327     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6328             #include <cxxabi.h>
6329             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6330         ])], [
6331             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6332             AC_MSG_RESULT([yes])
6333         ], [AC_MSG_RESULT([no])])
6334     AC_LANG_POP([C++])
6336     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6337     AC_LANG_PUSH([C++])
6338     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6339             #include <cxxabi.h>
6340             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6341         ])], [
6342             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6343             AC_MSG_RESULT([yes])
6344         ], [AC_MSG_RESULT([no])])
6345     AC_LANG_POP([C++])
6347     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6348     AC_LANG_PUSH([C++])
6349     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6350             #include <cstddef>
6351             #include <cxxabi.h>
6352             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6353         ])], [
6354             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6355             AC_MSG_RESULT([yes])
6356         ], [AC_MSG_RESULT([no])])
6357     AC_LANG_POP([C++])
6359     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6360     AC_LANG_PUSH([C++])
6361     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6362             #include <cstddef>
6363             #include <cxxabi.h>
6364             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6365         ])], [
6366             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6367             AC_MSG_RESULT([yes])
6368         ], [AC_MSG_RESULT([no])])
6369     AC_LANG_POP([C++])
6371     dnl Available in GCC 4.9 and at least since Clang 3.4:
6372     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6373     AC_LANG_PUSH([C++])
6374     save_CXXFLAGS=$CXXFLAGS
6375     CXXFLAGS="$CXXFLAGS -Werror"
6376     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6377             struct __attribute__((warn_unused)) dummy {};
6378         ])], [
6379             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6380             AC_MSG_RESULT([yes])
6381         ], [AC_MSG_RESULT([no])])
6382     CXXFLAGS=$save_CXXFLAGS
6383 AC_LANG_POP([C++])
6386 AC_SUBST(HAVE_GCC_AVX)
6387 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6388 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6389 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6391 dnl ===================================================================
6392 dnl Identify the C++ library
6393 dnl ===================================================================
6395 AC_MSG_CHECKING([what the C++ library is])
6396 AC_LANG_PUSH([C++])
6397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6398 #include <utility>
6399 #ifndef __GLIBCXX__
6400 foo bar
6401 #endif
6402 ]])],
6403     [CPP_LIBRARY=GLIBCXX
6404      cpp_library_name="GNU libstdc++"
6405     ],
6406     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6407 #include <utility>
6408 #ifndef _LIBCPP_VERSION
6409 foo bar
6410 #endif
6411 ]])],
6412     [CPP_LIBRARY=LIBCPP
6413      cpp_library_name="LLVM libc++"
6414      AC_DEFINE([HAVE_LIBCXX])
6415     ],
6416     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6417 #include <utility>
6418 #ifndef _MSC_VER
6419 foo bar
6420 #endif
6421 ]])],
6422     [CPP_LIBRARY=MSVCRT
6423      cpp_library_name="Microsoft"
6424     ],
6425     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6426 AC_MSG_RESULT([$cpp_library_name])
6427 AC_LANG_POP([C++])
6429 dnl ===================================================================
6430 dnl Check for gperf
6431 dnl ===================================================================
6432 AC_PATH_PROG(GPERF, gperf)
6433 if test -z "$GPERF"; then
6434     AC_MSG_ERROR([gperf not found but needed. Install it.])
6436 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6437     GPERF=`cygpath -m $GPERF`
6439 AC_MSG_CHECKING([whether gperf is new enough])
6440 my_gperf_ver1=$($GPERF --version | head -n 1)
6441 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6442 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6443 if test "$my_gperf_ver3" -ge 301; then
6444     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6445 else
6446     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6448 AC_SUBST(GPERF)
6450 dnl ===================================================================
6451 dnl Check for system libcmis
6452 dnl ===================================================================
6453 # libcmis requires curl and we can't build curl for iOS
6454 if test $_os != iOS; then
6455     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6456     ENABLE_LIBCMIS=TRUE
6457 else
6458     ENABLE_LIBCMIS=
6460 AC_SUBST(ENABLE_LIBCMIS)
6462 dnl ===================================================================
6463 dnl C++11
6464 dnl ===================================================================
6466 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6467 CXXFLAGS_CXX11=
6468 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6469     if test "$with_latest_c__" = yes; then
6470         CXXFLAGS_CXX11=-std:c++latest
6471     else
6472         CXXFLAGS_CXX11=-std:c++17
6473     fi
6474     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6475 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6476     my_flags='-std=c++17 -std=c++1z'
6477     if test "$with_latest_c__" = yes; then
6478         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6479     fi
6480     for flag in $my_flags; do
6481         if test "$COM" = MSC; then
6482             flag="-Xclang $flag"
6483         fi
6484         save_CXXFLAGS=$CXXFLAGS
6485         CXXFLAGS="$CXXFLAGS $flag -Werror"
6486         if test "$SYSTEM_LIBCMIS" = TRUE; then
6487             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6488         fi
6489         AC_LANG_PUSH([C++])
6490         dnl Clang 3.9 supports __float128 since
6491         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6492         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6493         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6494         dnl $flag is supported below, so check this first):
6495         my_float128hack=
6496         my_float128hack_impl=-D__float128=void
6497         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6498             #include <vector>
6499             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6500             // (__float128)
6501             ]])
6502         ],,[
6503             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6504             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6505             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6506             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6507             dnl place where __float128 is used is in a template specialization, -D__float128=void
6508             dnl will avoid the problem there while still causing a problem if somebody actually uses
6509             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6510             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6511             dnl "fixed" with this hack):
6512             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6513             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6514                 #include <vector>
6515                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6516                 // (__float128)
6517                 ]])
6518             ],[my_float128hack=$my_float128hack_impl])
6519         ])
6520         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6521             #include <algorithm>
6522             #include <functional>
6523             #include <vector>
6525             #if defined SYSTEM_LIBCMIS
6526             // See ucb/source/ucp/cmis/auth_provider.hxx:
6527             #if !defined __clang__
6528             #pragma GCC diagnostic push
6529             #pragma GCC diagnostic ignored "-Wdeprecated"
6530             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6531             #endif
6532             #include <libcmis/libcmis.hxx>
6533             #if !defined __clang__
6534             #pragma GCC diagnostic pop
6535             #endif
6536             #endif
6538             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6539                 std::sort(v.begin(), v.end(), fn);
6540             }
6541             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6542         AC_LANG_POP([C++])
6543         CXXFLAGS=$save_CXXFLAGS
6544         if test -n "$CXXFLAGS_CXX11"; then
6545             break
6546         fi
6547     done
6549 if test -n "$CXXFLAGS_CXX11"; then
6550     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6551 else
6552     AC_MSG_ERROR(no)
6554 AC_SUBST(CXXFLAGS_CXX11)
6556 if test "$GCC" = "yes"; then
6557     save_CXXFLAGS=$CXXFLAGS
6558     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6559     CHECK_L_ATOMIC
6560     CXXFLAGS=$save_CXXFLAGS
6561     AC_SUBST(ATOMIC_LIB)
6564 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6565 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6566 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6567 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6568 dnl again towards 4.7.2:
6569 if test $CPP_LIBRARY = GLIBCXX; then
6570     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6571     AC_LANG_PUSH([C++])
6572     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6573 #include <list>
6574 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6575     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6576     //   GCC 4.7.0: 20120322
6577     //   GCC 4.7.1: 20120614
6578     // and using a range check is not possible as the mapping between
6579     // __GLIBCXX__ values and GCC versions is not monotonic
6580 /* ok */
6581 #else
6582 abi broken
6583 #endif
6584         ]])], [AC_MSG_RESULT(no, ok)],
6585         [AC_MSG_ERROR(yes)])
6586     AC_LANG_POP([C++])
6589 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6590 save_CXXFLAGS=$CXXFLAGS
6591 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6592 AC_LANG_PUSH([C++])
6594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6595 #include <stddef.h>
6597 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6599 namespace
6601         struct b
6602         {
6603                 int i;
6604                 int j;
6605         };
6607 ]], [[
6608 struct a
6610         int i;
6611         int j;
6613 a thinga[]={{0,0}, {1,1}};
6614 b thingb[]={{0,0}, {1,1}};
6615 size_t i = sizeof(sal_n_array_size(thinga));
6616 size_t j = sizeof(sal_n_array_size(thingb));
6617 return !(i != 0 && j != 0);
6619     ], [ AC_MSG_RESULT(yes) ],
6620     [ AC_MSG_ERROR(no)])
6621 AC_LANG_POP([C++])
6622 CXXFLAGS=$save_CXXFLAGS
6624 dnl _Pragma support (may require C++11)
6625 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6626     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6627     AC_LANG_PUSH([C++])
6628     save_CXXFLAGS=$CXXFLAGS
6629     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6630     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6631             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6632         ])], [
6633             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6634             AC_MSG_RESULT([yes])
6635         ], [AC_MSG_RESULT([no])])
6636     AC_LANG_POP([C++])
6637     CXXFLAGS=$save_CXXFLAGS
6640 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6641 if test "$GCC" = yes; then
6642     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6643     AC_LANG_PUSH([C++])
6644     save_CXXFLAGS=$CXXFLAGS
6645     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6646     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6647     CXXFLAGS=$save_CXXFLAGS
6648     AC_LANG_POP([C++])
6649     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6650         AC_MSG_RESULT([yes])
6651     else
6652         AC_MSG_RESULT([no])
6653     fi
6655 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6657 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6658 AC_LANG_PUSH([C++])
6659 save_CXXFLAGS=$CXXFLAGS
6660 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6661 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6662         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6663         // supporting it:
6664         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6665         struct S {
6666         private:
6667             S(S const &);
6668         public:
6669             S();
6670             ~S();
6671         };
6672         S copy();
6673         void f() { S c(copy()); }
6674         #endif
6675     ])], [
6676         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6677         AC_MSG_RESULT([yes])
6678     ], [AC_MSG_RESULT([no])])
6679 CXXFLAGS=$save_CXXFLAGS
6680 AC_LANG_POP([C++])
6682 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6683 AC_LANG_PUSH([C++])
6684 save_CXXFLAGS=$CXXFLAGS
6685 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6686 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6687         #include <algorithm>
6688         #include <initializer_list>
6689         #include <vector>
6690         template<typename T> class S {
6691         private:
6692             std::vector<T> v_;
6693         public:
6694             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6695         };
6696         constinit S<int> s{3, 2, 1};
6697     ])], [
6698         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6699         AC_MSG_RESULT([yes])
6700     ], [AC_MSG_RESULT([no])])
6701 CXXFLAGS=$save_CXXFLAGS
6702 AC_LANG_POP([C++])
6704 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6705 AC_LANG_PUSH([C++])
6706 save_CXXFLAGS=$CXXFLAGS
6707 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6708 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6709         #include <span>
6710         #include <type_traits>
6711         // Don't check size_type directly, as it was called index_type before P1872R0:
6712         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6713     ])], [
6714         AC_DEFINE([HAVE_CPP_SPAN],[1])
6715         AC_MSG_RESULT([yes])
6716     ], [AC_MSG_RESULT([no])])
6717 CXXFLAGS=$save_CXXFLAGS
6718 AC_LANG_POP([C++])
6720 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6721 AC_LANG_PUSH([C++])
6722 save_CXXFLAGS=$CXXFLAGS
6723 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6724 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6725         struct S1 { S1(S1 &&); };
6726         struct S2: S1 {};
6727         S1 f(S2 s) { return s; }
6728     ])], [
6729         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6730         AC_MSG_RESULT([yes])
6731     ], [AC_MSG_RESULT([no])])
6732 CXXFLAGS=$save_CXXFLAGS
6733 AC_LANG_POP([C++])
6735 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6736 dnl uninitialized warning for code like
6738 dnl   OString f();
6739 dnl   boost::optional<OString> * g(bool b) {
6740 dnl       boost::optional<OString> o;
6741 dnl       if (b) o = f();
6742 dnl       return new boost::optional<OString>(o);
6743 dnl   }
6745 dnl (as is e.g. present, in a slightly more elaborate form, in
6746 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6747 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6748 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6749 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6750     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6751     AC_LANG_PUSH([C++])
6752     save_CXXFLAGS=$CXXFLAGS
6753     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6754     if test "$ENABLE_OPTIMIZED" = TRUE; then
6755         CXXFLAGS="$CXXFLAGS -O2"
6756     else
6757         CXXFLAGS="$CXXFLAGS -O0"
6758     fi
6759     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6760             #include <new>
6761             void f1(int);
6762             struct S1 {
6763                 ~S1() { f1(n); }
6764                 int n = 0;
6765             };
6766             struct S2 {
6767                 S2() {}
6768                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6769                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6770                 void set(S1 s) {
6771                     new (stg) S1(s);
6772                     init = true;
6773                 }
6774                 bool init = false;
6775                 char stg[sizeof (S1)];
6776             } ;
6777             S1 f2();
6778             S2 * f3(bool b) {
6779                 S2 o;
6780                 if (b) o.set(f2());
6781                 return new S2(o);
6782             }
6783         ]])], [AC_MSG_RESULT([no])], [
6784             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6785             AC_MSG_RESULT([yes])
6786         ])
6787     CXXFLAGS=$save_CXXFLAGS
6788     AC_LANG_POP([C++])
6790 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6792 dnl ===================================================================
6793 dnl CPU Intrinsics support - SSE, AVX
6794 dnl ===================================================================
6796 INTRINSICS_CXXFLAGS=""
6798 if test "$GCC" = "yes"; then
6799     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6800     AC_LANG_PUSH([C++])
6801     save_CXXFLAGS=$CXXFLAGS
6802     CXXFLAGS="$CXXFLAGS -msse2"
6803     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6804         #include <emmintrin.h>
6805         int main () {
6806             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6807             c = _mm_xor_si128 (a, b);
6808             return 0;
6809         }
6810         ])],
6811         [can_compile_sse2=yes],
6812         [can_compile_sse2=no])
6813     AC_LANG_POP([C++])
6814     CXXFLAGS=$save_CXXFLAGS
6815     AC_MSG_RESULT([${can_compile_sse2}])
6816     if test "${can_compile_sse2}" = "yes" ; then
6817         INTRINSICS_CXXFLAGS="-msse2"
6818     else
6819         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6820     fi
6822     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6823     AC_LANG_PUSH([C++])
6824     save_CXXFLAGS=$CXXFLAGS
6825     CXXFLAGS="$CXXFLAGS -mssse3"
6826     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6827         #include <tmmintrin.h>
6828         int main () {
6829             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6830             c = _mm_maddubs_epi16 (a, b);
6831             return 0;
6832         }
6833         ])],
6834         [can_compile_ssse3=yes],
6835         [can_compile_ssse3=no])
6836     AC_LANG_POP([C++])
6837     CXXFLAGS=$save_CXXFLAGS
6838     AC_MSG_RESULT([${can_compile_ssse3}])
6839     if test "${can_compile_ssse3}" = "yes" ; then
6840         INTRINSICS_CXXFLAGS="-mssse3"
6841     else
6842         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6843     fi
6845     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6846     AC_LANG_PUSH([C++])
6847     save_CXXFLAGS=$CXXFLAGS
6848     CXXFLAGS="$CXXFLAGS -mavx"
6849     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6850         #include <immintrin.h>
6851         int main () {
6852             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6853             c = _mm256_xor_ps(a, b);
6854             return 0;
6855         }
6856         ])],
6857         [can_compile_avx=yes],
6858         [can_compile_avx=no])
6859     AC_LANG_POP([C++])
6860     CXXFLAGS=$save_CXXFLAGS
6861     AC_MSG_RESULT([${can_compile_avx}])
6862     if test "${can_compile_avx}" = "yes" ; then
6863         INTRINSICS_CXXFLAGS="-mavx"
6864     else
6865         AC_MSG_WARN([cannot compile AVX intrinsics])
6866     fi
6868     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6869     AC_LANG_PUSH([C++])
6870     save_CXXFLAGS=$CXXFLAGS
6871     CXXFLAGS="$CXXFLAGS -mavx2"
6872     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6873         #include <immintrin.h>
6874         int main () {
6875             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6876             c = _mm256_maddubs_epi16(a, b);
6877             return 0;
6878         }
6879         ])],
6880         [can_compile_avx2=yes],
6881         [can_compile_avx2=no])
6882     AC_LANG_POP([C++])
6883     CXXFLAGS=$save_CXXFLAGS
6884     AC_MSG_RESULT([${can_compile_avx2}])
6885     if test "${can_compile_avx2}" = "yes" ; then
6886         INTRINSICS_CXXFLAGS="-mavx2"
6887     else
6888         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6889     fi
6892 AC_SUBST([INTRINSICS_CXXFLAGS])
6894 dnl ===================================================================
6895 dnl system stl sanity tests
6896 dnl ===================================================================
6897 if test "$_os" != "WINNT"; then
6899     AC_LANG_PUSH([C++])
6901     save_CPPFLAGS="$CPPFLAGS"
6902     if test -n "$MACOSX_SDK_PATH"; then
6903         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6904     fi
6906     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6907     # only.
6908     if test "$CPP_LIBRARY" = GLIBCXX; then
6909         dnl gcc#19664, gcc#22482, rhbz#162935
6910         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6911         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6912         AC_MSG_RESULT([$stlvisok])
6913         if test "$stlvisok" = "no"; then
6914             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6915         fi
6916     fi
6918     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6919     # when we don't make any dynamic libraries?
6920     if test "$DISABLE_DYNLOADING" = ""; then
6921         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6922         cat > conftestlib1.cc <<_ACEOF
6923 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6924 struct S2: S1<int> { virtual ~S2(); };
6925 S2::~S2() {}
6926 _ACEOF
6927         cat > conftestlib2.cc <<_ACEOF
6928 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6929 struct S2: S1<int> { virtual ~S2(); };
6930 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6931 _ACEOF
6932         gccvisinlineshiddenok=yes
6933         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6934             gccvisinlineshiddenok=no
6935         else
6936             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6937             dnl known to not work with -z defs (unsetting which makes the test
6938             dnl moot, though):
6939             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6940             if test "$COM_IS_CLANG" = TRUE; then
6941                 for i in $CXX $CXXFLAGS; do
6942                     case $i in
6943                     -fsanitize=*)
6944                         my_linkflagsnoundefs=
6945                         break
6946                         ;;
6947                     esac
6948                 done
6949             fi
6950             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6951                 gccvisinlineshiddenok=no
6952             fi
6953         fi
6955         rm -fr libconftest*
6956         AC_MSG_RESULT([$gccvisinlineshiddenok])
6957         if test "$gccvisinlineshiddenok" = "no"; then
6958             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6959         fi
6960     fi
6962    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6963     cat >visibility.cxx <<_ACEOF
6964 #pragma GCC visibility push(hidden)
6965 struct __attribute__ ((visibility ("default"))) TestStruct {
6966   static void Init();
6968 __attribute__ ((visibility ("default"))) void TestFunc() {
6969   TestStruct::Init();
6971 _ACEOF
6972     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6973         gccvisbroken=yes
6974     else
6975         case "$host_cpu" in
6976         i?86|x86_64)
6977             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6978                 gccvisbroken=no
6979             else
6980                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6981                     gccvisbroken=no
6982                 else
6983                     gccvisbroken=yes
6984                 fi
6985             fi
6986             ;;
6987         *)
6988             gccvisbroken=no
6989             ;;
6990         esac
6991     fi
6992     rm -f visibility.s visibility.cxx
6994     AC_MSG_RESULT([$gccvisbroken])
6995     if test "$gccvisbroken" = "yes"; then
6996         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6997     fi
6999     CPPFLAGS="$save_CPPFLAGS"
7001     AC_LANG_POP([C++])
7004 dnl ===================================================================
7005 dnl  Clang++ tests
7006 dnl ===================================================================
7008 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7009 if test "$GCC" = "yes"; then
7010     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7011     AC_LANG_PUSH([C++])
7012     save_CXXFLAGS=$CXXFLAGS
7013     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7014     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7015     CXXFLAGS=$save_CXXFLAGS
7016     AC_LANG_POP([C++])
7017     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7018         AC_MSG_RESULT([yes])
7019     else
7020         AC_MSG_RESULT([no])
7021     fi
7023 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7025 dnl ===================================================================
7026 dnl Compiler plugins
7027 dnl ===================================================================
7029 COMPILER_PLUGINS=
7030 # currently only Clang
7032 if test "$COM_IS_CLANG" != "TRUE"; then
7033     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7034         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7035         enable_compiler_plugins=no
7036     fi
7039 if test "$COM_IS_CLANG" = "TRUE"; then
7040     if test -n "$enable_compiler_plugins"; then
7041         compiler_plugins="$enable_compiler_plugins"
7042     elif test -n "$ENABLE_DBGUTIL"; then
7043         compiler_plugins=test
7044     else
7045         compiler_plugins=no
7046     fi
7047     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7048         if test "$CLANGVER" -lt 50002; then
7049             if test "$compiler_plugins" = yes; then
7050                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7051             else
7052                 compiler_plugins=no
7053             fi
7054         fi
7055     fi
7056     if test "$compiler_plugins" != "no"; then
7057         dnl The prefix where Clang resides, override to where Clang resides if
7058         dnl using a source build:
7059         if test -z "$CLANGDIR"; then
7060             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7061         fi
7062         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7063         if test -z "$COMPILER_PLUGINS_CXX"; then
7064             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7065         fi
7066         clangbindir=$CLANGDIR/bin
7067         if test "$build_os" = "cygwin"; then
7068             clangbindir=$(cygpath -u "$clangbindir")
7069         fi
7070         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7071         if test -n "$LLVM_CONFIG"; then
7072             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7073             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7074             if test -z "$CLANGLIBDIR"; then
7075                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7076             fi
7077             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7078             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7079             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7080             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7081                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7082             fi
7083             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7084             clangobjdir=$($LLVM_CONFIG --obj-root)
7085             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7086                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7087             fi
7088         fi
7089         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7090         AC_LANG_PUSH([C++])
7091         save_CXX=$CXX
7092         save_CXXCPP=$CXXCPP
7093         save_CPPFLAGS=$CPPFLAGS
7094         save_CXXFLAGS=$CXXFLAGS
7095         save_LDFLAGS=$LDFLAGS
7096         save_LIBS=$LIBS
7097         CXX=$COMPILER_PLUGINS_CXX
7098         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7099         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7100         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7101         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7102             [COMPILER_PLUGINS=TRUE],
7103             [
7104             if test "$compiler_plugins" = "yes"; then
7105                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7106             else
7107                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7108                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7109             fi
7110             ])
7111         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7112         dnl comment in compilerplugins/Makefile-clang.mk:
7113         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7114             LDFLAGS=""
7115             AC_MSG_CHECKING([for clang libraries to use])
7116             if test -z "$CLANGTOOLLIBS"; then
7117                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7118  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7119                 AC_LINK_IFELSE([
7120                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7121                         [[ clang::FullSourceLoc().dump(); ]])
7122                 ],[CLANGTOOLLIBS="$LIBS"],[])
7123             fi
7124             if test -z "$CLANGTOOLLIBS"; then
7125                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7126                 AC_LINK_IFELSE([
7127                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7128                         [[ clang::FullSourceLoc().dump(); ]])
7129                 ],[CLANGTOOLLIBS="$LIBS"],[])
7130             fi
7131             AC_MSG_RESULT([$CLANGTOOLLIBS])
7132             if test -z "$CLANGTOOLLIBS"; then
7133                 if test "$compiler_plugins" = "yes"; then
7134                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7135                 else
7136                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7137                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7138                 fi
7139                 COMPILER_PLUGINS=
7140             fi
7141             if test -n "$COMPILER_PLUGINS"; then
7142                 if test -z "$CLANGSYSINCLUDE"; then
7143                     if test -n "$LLVM_CONFIG"; then
7144                         # Path to the clang system headers (no idea if there's a better way to get it).
7145                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7146                     fi
7147                 fi
7148             fi
7149         fi
7150         CXX=$save_CXX
7151         CXXCPP=$save_CXXCPP
7152         CPPFLAGS=$save_CPPFLAGS
7153         CXXFLAGS=$save_CXXFLAGS
7154         LDFLAGS=$save_LDFLAGS
7155         LIBS="$save_LIBS"
7156         AC_LANG_POP([C++])
7157     fi
7158 else
7159     if test "$enable_compiler_plugins" = "yes"; then
7160         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7161     fi
7163 AC_SUBST(COMPILER_PLUGINS)
7164 AC_SUBST(COMPILER_PLUGINS_CXX)
7165 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7166 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7167 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7168 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7169 AC_SUBST(CLANGDIR)
7170 AC_SUBST(CLANGLIBDIR)
7171 AC_SUBST(CLANGTOOLLIBS)
7172 AC_SUBST(CLANGSYSINCLUDE)
7174 # Plugin to help linker.
7175 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7176 # This makes --enable-lto build with clang work.
7177 AC_SUBST(LD_PLUGIN)
7179 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7180 AC_SUBST(HAVE_POSIX_FALLOCATE)
7182 dnl ===================================================================
7183 dnl Custom build version
7184 dnl ===================================================================
7186 AC_MSG_CHECKING([whether to add custom build version])
7187 if test "$with_build_version" != ""; then
7188     BUILD_VER_STRING=$with_build_version
7189     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7190 else
7191     BUILD_VER_STRING=
7192     AC_MSG_RESULT([no])
7194 AC_SUBST(BUILD_VER_STRING)
7196 JITC_PROCESSOR_TYPE=""
7197 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7198     # IBMs JDK needs this...
7199     JITC_PROCESSOR_TYPE=6
7200     export JITC_PROCESSOR_TYPE
7202 AC_SUBST([JITC_PROCESSOR_TYPE])
7204 # Misc Windows Stuff
7205 AC_ARG_WITH(ucrt-dir,
7206     AS_HELP_STRING([--with-ucrt-dir],
7207         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7208         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7209         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7210             Windows6.1-KB2999226-x64.msu
7211             Windows6.1-KB2999226-x86.msu
7212             Windows8.1-KB2999226-x64.msu
7213             Windows8.1-KB2999226-x86.msu
7214             Windows8-RT-KB2999226-x64.msu
7215             Windows8-RT-KB2999226-x86.msu
7216         A zip archive including those files is available from Microsoft site:
7217         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7219 UCRT_REDISTDIR="$with_ucrt_dir"
7220 if test $_os = "WINNT"; then
7221     find_msvc_x64_dlls
7222     find_msms
7223     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7224     MSVC_DLLS="$msvcdlls"
7225     MSM_PATH=`win_short_path_for_make "$msmdir"`
7226     # MSVC 15.3 changed it to VC141
7227     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7228         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7229     else
7230         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7231     fi
7233     if test "$UCRT_REDISTDIR" = "no"; then
7234         dnl explicitly disabled
7235         UCRT_REDISTDIR=""
7236     else
7237         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7238                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7239                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7240                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7241                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7242                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7243             UCRT_REDISTDIR=""
7244             if test -n "$PKGFORMAT"; then
7245                for i in $PKGFORMAT; do
7246                    case "$i" in
7247                    msi)
7248                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7249                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7250                        ;;
7251                    esac
7252                done
7253             fi
7254         fi
7255     fi
7258 AC_SUBST(UCRT_REDISTDIR)
7259 AC_SUBST(MSVC_DLL_PATH)
7260 AC_SUBST(MSVC_DLLS)
7261 AC_SUBST(MSM_PATH)
7263 dnl ===================================================================
7264 dnl Checks for Java
7265 dnl ===================================================================
7266 if test "$ENABLE_JAVA" != ""; then
7268     # Windows-specific tests
7269     if test "$build_os" = "cygwin"; then
7270         if test "$BITNESS_OVERRIDE" = 64; then
7271             bitness=64
7272         else
7273             bitness=32
7274         fi
7276         if test -z "$with_jdk_home"; then
7277             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7278             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7279             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7280             if test -n "$regvalue"; then
7281                 ver=$regvalue
7282                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7283                 _jdk_home=$regvalue
7284             fi
7285             if test -z "$with_jdk_home"; then
7286                 for ver in 1.8; do
7287                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7288                     if test -n "$regvalue"; then
7289                         _jdk_home=$regvalue
7290                         break
7291                     fi
7292                 done
7293             fi
7294             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7295                 with_jdk_home="$_jdk_home"
7296                 howfound="found automatically"
7297             else
7298                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7299             fi
7300         else
7301             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7302             howfound="you passed"
7303         fi
7304     fi
7306     # 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.
7307     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7308     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7309         with_jdk_home=`/usr/libexec/java_home`
7310     fi
7312     JAVA_HOME=; export JAVA_HOME
7313     if test -z "$with_jdk_home"; then
7314         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7315     else
7316         _java_path="$with_jdk_home/bin/$with_java"
7317         dnl Check if there is a Java interpreter at all.
7318         if test -x "$_java_path"; then
7319             JAVAINTERPRETER=$_java_path
7320         else
7321             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7322         fi
7323     fi
7325     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7326     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7327     dnl loaded by java to run JunitTests:
7328     if test "$build_os" = "cygwin"; then
7329         shortjdkhome=`cygpath -d "$with_jdk_home"`
7330         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
7331             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7332             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7333         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
7334             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7335             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7336         fi
7338         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7339             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7340         fi
7341         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7342     elif test "$cross_compiling" != "yes"; then
7343         case $CPUNAME in
7344             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7345                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7346                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7347                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7348                 fi
7349                 ;;
7350             *) # assumption: everything else 32-bit
7351                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7352                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7353                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7354                 fi
7355                 ;;
7356         esac
7357     fi
7360 dnl ===================================================================
7361 dnl Checks for JDK.
7362 dnl ===================================================================
7364 # Note that JAVA_HOME as for now always means the *build* platform's
7365 # JAVA_HOME. Whether all the complexity here actually is needed any
7366 # more or not, no idea.
7368 if test "$ENABLE_JAVA" != ""; then
7369     _gij_longver=0
7370     AC_MSG_CHECKING([the installed JDK])
7371     if test -n "$JAVAINTERPRETER"; then
7372         dnl java -version sends output to stderr!
7373         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7374             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7375         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7376             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7377         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7378             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7379         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7380             JDK=ibm
7382             dnl IBM JDK specific tests
7383             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7384             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7386             if test "$_jdk_ver" -lt 10800; then
7387                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7388             fi
7390             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7392             if test "$with_jdk_home" = ""; then
7393                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7394 you must use the "--with-jdk-home" configure option explicitly])
7395             fi
7397             JAVA_HOME=$with_jdk_home
7398         else
7399             JDK=sun
7401             dnl Sun JDK specific tests
7402             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7403             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7405             if test "$_jdk_ver" -lt 10800; then
7406                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7407             fi
7408             if test "$_jdk_ver" -gt 10800; then
7409                 JAVA_CLASSPATH_NOT_SET=TRUE
7410             fi
7412             AC_MSG_RESULT([found (JDK $_jdk)])
7413             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7414             if test "$_os" = "WINNT"; then
7415                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7416             fi
7418             # set to limit VM usage for JunitTests
7419             JAVAIFLAGS=-Xmx64M
7420             # set to limit VM usage for javac
7421             JAVAFLAGS=-J-Xmx128M
7422         fi
7423     else
7424         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7425     fi
7426 else
7427     dnl Java disabled
7428     JAVA_HOME=
7429     export JAVA_HOME
7432 dnl ===================================================================
7433 dnl Checks for javac
7434 dnl ===================================================================
7435 if test "$ENABLE_JAVA" != ""; then
7436     javacompiler="javac"
7437     : ${JAVA_SOURCE_VER=8}
7438     : ${JAVA_TARGET_VER=8}
7439     if test -z "$with_jdk_home"; then
7440         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7441     else
7442         _javac_path="$with_jdk_home/bin/$javacompiler"
7443         dnl Check if there is a Java compiler at all.
7444         if test -x "$_javac_path"; then
7445             JAVACOMPILER=$_javac_path
7446         fi
7447     fi
7448     if test -z "$JAVACOMPILER"; then
7449         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7450     fi
7451     if test "$build_os" = "cygwin"; then
7452         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7453             JAVACOMPILER="${JAVACOMPILER}.exe"
7454         fi
7455         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7456     fi
7459 dnl ===================================================================
7460 dnl Checks for javadoc
7461 dnl ===================================================================
7462 if test "$ENABLE_JAVA" != ""; then
7463     if test -z "$with_jdk_home"; then
7464         AC_PATH_PROG(JAVADOC, javadoc)
7465     else
7466         _javadoc_path="$with_jdk_home/bin/javadoc"
7467         dnl Check if there is a javadoc at all.
7468         if test -x "$_javadoc_path"; then
7469             JAVADOC=$_javadoc_path
7470         else
7471             AC_PATH_PROG(JAVADOC, javadoc)
7472         fi
7473     fi
7474     if test -z "$JAVADOC"; then
7475         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7476     fi
7477     if test "$build_os" = "cygwin"; then
7478         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7479             JAVADOC="${JAVADOC}.exe"
7480         fi
7481         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7482     fi
7484     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7485     JAVADOCISGJDOC="yes"
7486     fi
7488 AC_SUBST(JAVADOCISGJDOC)
7490 if test "$ENABLE_JAVA" != ""; then
7491     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7492     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7493         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7494            # try to recover first by looking whether we have an alternative
7495            # system as in Debian or newer SuSEs where following /usr/bin/javac
7496            # over /etc/alternatives/javac leads to the right bindir where we
7497            # just need to strip a bit away to get a valid JAVA_HOME
7498            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7499         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7500             # maybe only one level of symlink (e.g. on Mac)
7501             JAVA_HOME=$(readlink $JAVACOMPILER)
7502             if test "$(dirname $JAVA_HOME)" = "."; then
7503                 # we've got no path to trim back
7504                 JAVA_HOME=""
7505             fi
7506         else
7507             # else warn
7508             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7509             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7510             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7511             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7512         fi
7513         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7514         if test "$JAVA_HOME" != "/usr"; then
7515             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7516                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7517                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7518                 dnl Tiger already returns a JDK path...
7519                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7520             else
7521                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7522                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7523                 dnl that checks which version to run
7524                 if test -f "$JAVA_HOME"; then
7525                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7526                 fi
7527             fi
7528         fi
7529     fi
7530     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7532     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7533     if test -z "$JAVA_HOME"; then
7534         if test "x$with_jdk_home" = "x"; then
7535             cat > findhome.java <<_ACEOF
7536 [import java.io.File;
7538 class findhome
7540     public static void main(String args[])
7541     {
7542         String jrelocation = System.getProperty("java.home");
7543         File jre = new File(jrelocation);
7544         System.out.println(jre.getParent());
7545     }
7547 _ACEOF
7548             AC_MSG_CHECKING([if javac works])
7549             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7550             AC_TRY_EVAL(javac_cmd)
7551             if test $? = 0 -a -f ./findhome.class; then
7552                 AC_MSG_RESULT([javac works])
7553             else
7554                 echo "configure: javac test failed" >&5
7555                 cat findhome.java >&5
7556                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7557             fi
7558             AC_MSG_CHECKING([if gij knows its java.home])
7559             JAVA_HOME=`$JAVAINTERPRETER findhome`
7560             if test $? = 0 -a "$JAVA_HOME" != ""; then
7561                 AC_MSG_RESULT([$JAVA_HOME])
7562             else
7563                 echo "configure: java test failed" >&5
7564                 cat findhome.java >&5
7565                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7566             fi
7567             # clean-up after ourselves
7568             rm -f ./findhome.java ./findhome.class
7569         else
7570             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7571         fi
7572     fi
7574     # now check if $JAVA_HOME is really valid
7575     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7576         case "${JAVA_HOME}" in
7577             /Library/Java/JavaVirtualMachines/*)
7578                 ;;
7579             *)
7580                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7581                 ;;
7582         esac
7583         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7584             JAVA_HOME_OK="NO"
7585         fi
7586     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7587         JAVA_HOME_OK="NO"
7588     fi
7589     if test "$JAVA_HOME_OK" = "NO"; then
7590         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7591         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7592         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7593         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7594         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7595         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7596     fi
7597     PathFormat "$JAVA_HOME"
7598     JAVA_HOME="$formatted_path"
7601 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7602     "$_os" != Darwin
7603 then
7604     AC_MSG_CHECKING([for JAWT lib])
7605     if test "$_os" = WINNT; then
7606         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7607         JAWTLIB=jawt.lib
7608     else
7609         case "$host_cpu" in
7610         arm*)
7611             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7612             JAVA_ARCH=$my_java_arch
7613             ;;
7614         i*86)
7615             my_java_arch=i386
7616             ;;
7617         m68k)
7618             my_java_arch=m68k
7619             ;;
7620         powerpc)
7621             my_java_arch=ppc
7622             ;;
7623         powerpc64)
7624             my_java_arch=ppc64
7625             ;;
7626         powerpc64le)
7627             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7628             JAVA_ARCH=$my_java_arch
7629             ;;
7630         sparc64)
7631             my_java_arch=sparcv9
7632             ;;
7633         x86_64)
7634             my_java_arch=amd64
7635             ;;
7636         *)
7637             my_java_arch=$host_cpu
7638             ;;
7639         esac
7640         # This is where JDK9 puts the library
7641         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7642             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7643         else
7644             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7645         fi
7646         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7647     fi
7648     AC_MSG_RESULT([$JAWTLIB])
7650 AC_SUBST(JAWTLIB)
7652 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7653     case "$host_os" in
7655     aix*)
7656         JAVAINC="-I$JAVA_HOME/include"
7657         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7658         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7659         ;;
7661     cygwin*)
7662         JAVAINC="-I$JAVA_HOME/include/win32"
7663         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7664         ;;
7666     darwin*)
7667         if test -d "$JAVA_HOME/include/darwin"; then
7668             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7669         else
7670             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7671         fi
7672         ;;
7674     dragonfly*)
7675         JAVAINC="-I$JAVA_HOME/include"
7676         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7677         ;;
7679     freebsd*)
7680         JAVAINC="-I$JAVA_HOME/include"
7681         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7682         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7683         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7684         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7685         ;;
7687     k*bsd*-gnu*)
7688         JAVAINC="-I$JAVA_HOME/include"
7689         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7690         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7691         ;;
7693     linux-gnu*)
7694         JAVAINC="-I$JAVA_HOME/include"
7695         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7696         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7697         ;;
7699     *netbsd*)
7700         JAVAINC="-I$JAVA_HOME/include"
7701         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7702         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7703        ;;
7705     openbsd*)
7706         JAVAINC="-I$JAVA_HOME/include"
7707         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7708         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7709         ;;
7711     solaris*)
7712         JAVAINC="-I$JAVA_HOME/include"
7713         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7714         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7715         ;;
7716     esac
7718 SOLARINC="$SOLARINC $JAVAINC"
7720 AC_SUBST(JAVACOMPILER)
7721 AC_SUBST(JAVADOC)
7722 AC_SUBST(JAVAINTERPRETER)
7723 AC_SUBST(JAVAIFLAGS)
7724 AC_SUBST(JAVAFLAGS)
7725 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7726 AC_SUBST(JAVA_HOME)
7727 AC_SUBST(JAVA_SOURCE_VER)
7728 AC_SUBST(JAVA_TARGET_VER)
7729 AC_SUBST(JDK)
7732 dnl ===================================================================
7733 dnl Export file validation
7734 dnl ===================================================================
7735 AC_MSG_CHECKING([whether to enable export file validation])
7736 if test "$with_export_validation" != "no"; then
7737     if test -z "$ENABLE_JAVA"; then
7738         if test "$with_export_validation" = "yes"; then
7739             AC_MSG_ERROR([requested, but Java is disabled])
7740         else
7741             AC_MSG_RESULT([no, as Java is disabled])
7742         fi
7743     elif ! test -d "${SRC_ROOT}/schema"; then
7744         if test "$with_export_validation" = "yes"; then
7745             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7746         else
7747             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7748         fi
7749     else
7750         AC_MSG_RESULT([yes])
7751         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7753         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7754         if test -z "$ODFVALIDATOR"; then
7755             # remember to download the ODF toolkit with validator later
7756             AC_MSG_NOTICE([no odfvalidator found, will download it])
7757             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7758             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7760             # and fetch name of odfvalidator jar name from download.lst
7761             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7762             AC_SUBST(ODFVALIDATOR_JAR)
7764             if test -z "$ODFVALIDATOR_JAR"; then
7765                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7766             fi
7767         fi
7768         if test "$build_os" = "cygwin"; then
7769             # In case of Cygwin it will be executed from Windows,
7770             # so we need to run bash and absolute path to validator
7771             # so instead of "odfvalidator" it will be
7772             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7773             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7774         else
7775             ODFVALIDATOR="sh $ODFVALIDATOR"
7776         fi
7777         AC_SUBST(ODFVALIDATOR)
7780         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7781         if test -z "$OFFICEOTRON"; then
7782             # remember to download the officeotron with validator later
7783             AC_MSG_NOTICE([no officeotron found, will download it])
7784             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7785             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7787             # and fetch name of officeotron jar name from download.lst
7788             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7789             AC_SUBST(OFFICEOTRON_JAR)
7791             if test -z "$OFFICEOTRON_JAR"; then
7792                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7793             fi
7794         else
7795             # check version of existing officeotron
7796             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7797             if test 0"$OFFICEOTRON_VER" -lt 704; then
7798                 AC_MSG_ERROR([officeotron too old])
7799             fi
7800         fi
7801         if test "$build_os" = "cygwin"; then
7802             # In case of Cygwin it will be executed from Windows,
7803             # so we need to run bash and absolute path to validator
7804             # so instead of "odfvalidator" it will be
7805             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7806             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7807         else
7808             OFFICEOTRON="sh $OFFICEOTRON"
7809         fi
7810     fi
7811     AC_SUBST(OFFICEOTRON)
7812 else
7813     AC_MSG_RESULT([no])
7816 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7817 if test "$with_bffvalidator" != "no"; then
7818     AC_DEFINE(HAVE_BFFVALIDATOR)
7820     if test "$with_export_validation" = "no"; then
7821         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7822     fi
7824     if test "$with_bffvalidator" = "yes"; then
7825         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7826     else
7827         BFFVALIDATOR="$with_bffvalidator"
7828     fi
7830     if test "$build_os" = "cygwin"; then
7831         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7832             AC_MSG_RESULT($BFFVALIDATOR)
7833         else
7834             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7835         fi
7836     elif test -n "$BFFVALIDATOR"; then
7837         # We are not in Cygwin but need to run Windows binary with wine
7838         AC_PATH_PROGS(WINE, wine)
7840         # so swap in a shell wrapper that converts paths transparently
7841         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7842         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7843         AC_SUBST(BFFVALIDATOR_EXE)
7844         AC_MSG_RESULT($BFFVALIDATOR)
7845     else
7846         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7847     fi
7848     AC_SUBST(BFFVALIDATOR)
7849 else
7850     AC_MSG_RESULT([no])
7853 dnl ===================================================================
7854 dnl Check for C preprocessor to use
7855 dnl ===================================================================
7856 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7857 if test -n "$with_idlc_cpp"; then
7858     AC_MSG_RESULT([$with_idlc_cpp])
7859     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7860 else
7861     AC_MSG_RESULT([ucpp])
7862     AC_MSG_CHECKING([which ucpp tp use])
7863     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7864         AC_MSG_RESULT([external])
7865         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7866     else
7867         AC_MSG_RESULT([internal])
7868         BUILD_TYPE="$BUILD_TYPE UCPP"
7869     fi
7871 AC_SUBST(SYSTEM_UCPP)
7873 dnl ===================================================================
7874 dnl Check for epm (not needed for Windows)
7875 dnl ===================================================================
7876 AC_MSG_CHECKING([whether to enable EPM for packing])
7877 if test "$enable_epm" = "yes"; then
7878     AC_MSG_RESULT([yes])
7879     if test "$_os" != "WINNT"; then
7880         if test $_os = Darwin; then
7881             EPM=internal
7882         elif test -n "$with_epm"; then
7883             EPM=$with_epm
7884         else
7885             AC_PATH_PROG(EPM, epm, no)
7886         fi
7887         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7888             AC_MSG_NOTICE([EPM will be built.])
7889             BUILD_TYPE="$BUILD_TYPE EPM"
7890             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7891         else
7892             # Gentoo has some epm which is something different...
7893             AC_MSG_CHECKING([whether the found epm is the right epm])
7894             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7895                 AC_MSG_RESULT([yes])
7896             else
7897                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7898             fi
7899             AC_MSG_CHECKING([epm version])
7900             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7901             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7902                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7903                 AC_MSG_RESULT([OK, >= 3.7])
7904             else
7905                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7906                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7907             fi
7908         fi
7909     fi
7911     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7912         AC_MSG_CHECKING([for rpm])
7913         for a in "$RPM" rpmbuild rpm; do
7914             $a --usage >/dev/null 2> /dev/null
7915             if test $? -eq 0; then
7916                 RPM=$a
7917                 break
7918             else
7919                 $a --version >/dev/null 2> /dev/null
7920                 if test $? -eq 0; then
7921                     RPM=$a
7922                     break
7923                 fi
7924             fi
7925         done
7926         if test -z "$RPM"; then
7927             AC_MSG_ERROR([not found])
7928         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7929             RPM_PATH=`which $RPM`
7930             AC_MSG_RESULT([$RPM_PATH])
7931             SCPDEFS="$SCPDEFS -DWITH_RPM"
7932         else
7933             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7934         fi
7935     fi
7936     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7937         AC_PATH_PROG(DPKG, dpkg, no)
7938         if test "$DPKG" = "no"; then
7939             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7940         fi
7941     fi
7942     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7943        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7944         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7945             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7946                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7947                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7948                     AC_MSG_RESULT([yes])
7949                 else
7950                     AC_MSG_RESULT([no])
7951                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7952                         _pt="rpm"
7953                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7954                         add_warning "the rpms will need to be installed with --nodeps"
7955                     else
7956                         _pt="pkg"
7957                     fi
7958                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7959                     add_warning "the ${_pt}s will not be relocatable"
7960                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7961                                  relocation will work, you need to patch your epm with the
7962                                  patch in epm/epm-3.7.patch or build with
7963                                  --with-epm=internal which will build a suitable epm])
7964                 fi
7965             fi
7966         fi
7967     fi
7968     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7969         AC_PATH_PROG(PKGMK, pkgmk, no)
7970         if test "$PKGMK" = "no"; then
7971             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7972         fi
7973     fi
7974     AC_SUBST(RPM)
7975     AC_SUBST(DPKG)
7976     AC_SUBST(PKGMK)
7977 else
7978     for i in $PKGFORMAT; do
7979         case "$i" in
7980         aix | bsd | deb | pkg | rpm | native | portable)
7981             AC_MSG_ERROR(
7982                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7983             ;;
7984         esac
7985     done
7986     AC_MSG_RESULT([no])
7987     EPM=NO
7989 AC_SUBST(EPM)
7991 ENABLE_LWP=
7992 if test "$enable_lotuswordpro" = "yes"; then
7993     ENABLE_LWP="TRUE"
7995 AC_SUBST(ENABLE_LWP)
7997 dnl ===================================================================
7998 dnl Check for building ODK
7999 dnl ===================================================================
8000 if test "$enable_odk" = no; then
8001     unset DOXYGEN
8002 else
8003     if test "$with_doxygen" = no; then
8004         AC_MSG_CHECKING([for doxygen])
8005         unset DOXYGEN
8006         AC_MSG_RESULT([no])
8007     else
8008         if test "$with_doxygen" = yes; then
8009             AC_PATH_PROG([DOXYGEN], [doxygen])
8010             if test -z "$DOXYGEN"; then
8011                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8012             fi
8013             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8014                 if ! dot -V 2>/dev/null; then
8015                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8016                 fi
8017             fi
8018         else
8019             AC_MSG_CHECKING([for doxygen])
8020             DOXYGEN=$with_doxygen
8021             AC_MSG_RESULT([$DOXYGEN])
8022         fi
8023         if test -n "$DOXYGEN"; then
8024             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8025             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8026             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8027                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8028             fi
8029         fi
8030     fi
8032 AC_SUBST([DOXYGEN])
8034 AC_MSG_CHECKING([whether to build the ODK])
8035 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8036     AC_MSG_RESULT([yes])
8038     if test "$with_java" != "no"; then
8039         AC_MSG_CHECKING([whether to build unowinreg.dll])
8040         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8041             # build on Win by default
8042             enable_build_unowinreg=yes
8043         fi
8044         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8045             AC_MSG_RESULT([no])
8046             BUILD_UNOWINREG=
8047         else
8048             AC_MSG_RESULT([yes])
8049             BUILD_UNOWINREG=TRUE
8050         fi
8051         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8052             if test -z "$with_mingw_cross_compiler"; then
8053                 dnl Guess...
8054                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8055             elif test -x "$with_mingw_cross_compiler"; then
8056                  MINGWCXX="$with_mingw_cross_compiler"
8057             else
8058                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8059             fi
8061             if test "$MINGWCXX" = "false"; then
8062                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8063             fi
8065             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8066             if test -x "$mingwstrip_test"; then
8067                 MINGWSTRIP="$mingwstrip_test"
8068             else
8069                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8070             fi
8072             if test "$MINGWSTRIP" = "false"; then
8073                 AC_MSG_ERROR(MinGW32 binutils not found.)
8074             fi
8075         fi
8076     fi
8077     BUILD_TYPE="$BUILD_TYPE ODK"
8078 else
8079     AC_MSG_RESULT([no])
8080     BUILD_UNOWINREG=
8082 AC_SUBST(BUILD_UNOWINREG)
8083 AC_SUBST(MINGWCXX)
8084 AC_SUBST(MINGWSTRIP)
8086 dnl ===================================================================
8087 dnl Check for system zlib
8088 dnl ===================================================================
8089 if test "$with_system_zlib" = "auto"; then
8090     case "$_os" in
8091     WINNT)
8092         with_system_zlib="$with_system_libs"
8093         ;;
8094     *)
8095         if test "$enable_fuzzers" != "yes"; then
8096             with_system_zlib=yes
8097         else
8098             with_system_zlib=no
8099         fi
8100         ;;
8101     esac
8104 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8105 dnl and has no pkg-config for it at least on some tinderboxes,
8106 dnl so leaving that out for now
8107 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8108 AC_MSG_CHECKING([which zlib to use])
8109 if test "$with_system_zlib" = "yes"; then
8110     AC_MSG_RESULT([external])
8111     SYSTEM_ZLIB=TRUE
8112     AC_CHECK_HEADER(zlib.h, [],
8113         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8114     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8115         [AC_MSG_ERROR(zlib not found or functional)], [])
8116 else
8117     AC_MSG_RESULT([internal])
8118     SYSTEM_ZLIB=
8119     BUILD_TYPE="$BUILD_TYPE ZLIB"
8120     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8121     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8123 AC_SUBST(ZLIB_CFLAGS)
8124 AC_SUBST(ZLIB_LIBS)
8125 AC_SUBST(SYSTEM_ZLIB)
8127 dnl ===================================================================
8128 dnl Check for system jpeg
8129 dnl ===================================================================
8130 AC_MSG_CHECKING([which libjpeg to use])
8131 if test "$with_system_jpeg" = "yes"; then
8132     AC_MSG_RESULT([external])
8133     SYSTEM_LIBJPEG=TRUE
8134     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8135         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8136     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8137         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8138 else
8139     SYSTEM_LIBJPEG=
8140     AC_MSG_RESULT([internal, libjpeg-turbo])
8141     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8142     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8143     if test "$COM" = "MSC"; then
8144         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8145     else
8146         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8147     fi
8149     case "$host_cpu" in
8150     x86_64 | amd64 | i*86 | x86 | ia32)
8151         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8152         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8153             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8154                 NASM="$LODE_HOME/opt/bin/nasm"
8155             elif test -x "/opt/lo/bin/nasm"; then
8156                 NASM="/opt/lo/bin/nasm"
8157             fi
8158         fi
8160         if test -n "$NASM"; then
8161             AC_MSG_CHECKING([for object file format of host system])
8162             case "$host_os" in
8163               cygwin* | mingw* | pw32* | interix*)
8164                 case "$host_cpu" in
8165                   x86_64)
8166                     objfmt='Win64-COFF'
8167                     ;;
8168                   *)
8169                     objfmt='Win32-COFF'
8170                     ;;
8171                 esac
8172               ;;
8173               msdosdjgpp* | go32*)
8174                 objfmt='COFF'
8175               ;;
8176               os2-emx*) # not tested
8177                 objfmt='MSOMF' # obj
8178               ;;
8179               linux*coff* | linux*oldld*)
8180                 objfmt='COFF' # ???
8181               ;;
8182               linux*aout*)
8183                 objfmt='a.out'
8184               ;;
8185               linux*)
8186                 case "$host_cpu" in
8187                   x86_64)
8188                     objfmt='ELF64'
8189                     ;;
8190                   *)
8191                     objfmt='ELF'
8192                     ;;
8193                 esac
8194               ;;
8195               kfreebsd* | freebsd* | netbsd* | openbsd*)
8196                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8197                   objfmt='BSD-a.out'
8198                 else
8199                   case "$host_cpu" in
8200                     x86_64 | amd64)
8201                       objfmt='ELF64'
8202                       ;;
8203                     *)
8204                       objfmt='ELF'
8205                       ;;
8206                   esac
8207                 fi
8208               ;;
8209               solaris* | sunos* | sysv* | sco*)
8210                 case "$host_cpu" in
8211                   x86_64)
8212                     objfmt='ELF64'
8213                     ;;
8214                   *)
8215                     objfmt='ELF'
8216                     ;;
8217                 esac
8218               ;;
8219               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8220                 case "$host_cpu" in
8221                   x86_64)
8222                     objfmt='Mach-O64'
8223                     ;;
8224                   *)
8225                     objfmt='Mach-O'
8226                     ;;
8227                 esac
8228               ;;
8229               *)
8230                 objfmt='ELF ?'
8231               ;;
8232             esac
8234             AC_MSG_RESULT([$objfmt])
8235             if test "$objfmt" = 'ELF ?'; then
8236               objfmt='ELF'
8237               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8238             fi
8240             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8241             case "$objfmt" in
8242               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8243               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8244               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8245               COFF)       NAFLAGS='-fcoff -DCOFF';;
8246               a.out)      NAFLAGS='-faout -DAOUT';;
8247               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8248               ELF)        NAFLAGS='-felf -DELF';;
8249               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8250               RDF)        NAFLAGS='-frdf -DRDF';;
8251               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8252               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8253             esac
8254             AC_MSG_RESULT([$NAFLAGS])
8256             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8257             cat > conftest.asm << EOF
8258             [%line __oline__ "configure"
8259                     section .text
8260                     global  _main,main
8261             _main:
8262             main:   xor     eax,eax
8263                     ret
8264             ]
8266             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8267             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8268               AC_MSG_RESULT(yes)
8269             else
8270               echo "configure: failed program was:" >&AC_FD_CC
8271               cat conftest.asm >&AC_FD_CC
8272               rm -rf conftest*
8273               AC_MSG_RESULT(no)
8274               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8275               NASM=""
8276             fi
8278         fi
8280         if test -z "$NASM"; then
8281 cat << _EOS
8282 ****************************************************************************
8283 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8284 To get one please:
8286 _EOS
8287             if test "$build_os" = "cygwin"; then
8288 cat << _EOS
8289 install a pre-compiled binary for Win32
8291 mkdir -p /opt/lo/bin
8292 cd /opt/lo/bin
8293 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8294 chmod +x nasm
8296 or get and install one from http://www.nasm.us/
8298 Then re-run autogen.sh
8300 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8301 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8303 _EOS
8304             else
8305 cat << _EOS
8306 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8308 _EOS
8309             fi
8310             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8311             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8312         fi
8313       ;;
8314     esac
8317 AC_SUBST(NASM)
8318 AC_SUBST(LIBJPEG_CFLAGS)
8319 AC_SUBST(LIBJPEG_LIBS)
8320 AC_SUBST(SYSTEM_LIBJPEG)
8322 dnl ===================================================================
8323 dnl Check for system clucene
8324 dnl ===================================================================
8325 dnl we should rather be using
8326 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8327 dnl but the contribs-lib check seems tricky
8328 AC_MSG_CHECKING([which clucene to use])
8329 if test "$with_system_clucene" = "yes"; then
8330     AC_MSG_RESULT([external])
8331     SYSTEM_CLUCENE=TRUE
8332     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8333     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8334     FilterLibs "${CLUCENE_LIBS}"
8335     CLUCENE_LIBS="${filteredlibs}"
8336     AC_LANG_PUSH([C++])
8337     save_CXXFLAGS=$CXXFLAGS
8338     save_CPPFLAGS=$CPPFLAGS
8339     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8340     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8341     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8342     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8343     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8344                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8345     CXXFLAGS=$save_CXXFLAGS
8346     CPPFLAGS=$save_CPPFLAGS
8347     AC_LANG_POP([C++])
8349     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8350 else
8351     AC_MSG_RESULT([internal])
8352     SYSTEM_CLUCENE=
8353     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8355 AC_SUBST(SYSTEM_CLUCENE)
8356 AC_SUBST(CLUCENE_CFLAGS)
8357 AC_SUBST(CLUCENE_LIBS)
8359 dnl ===================================================================
8360 dnl Check for system expat
8361 dnl ===================================================================
8362 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8364 dnl ===================================================================
8365 dnl Check for system xmlsec
8366 dnl ===================================================================
8367 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8369 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8370 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8371     ENABLE_EOT="TRUE"
8372     AC_DEFINE([ENABLE_EOT])
8373     AC_MSG_RESULT([yes])
8375     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8376 else
8377     ENABLE_EOT=
8378     AC_MSG_RESULT([no])
8380 AC_SUBST([ENABLE_EOT])
8382 dnl ===================================================================
8383 dnl Check for DLP libs
8384 dnl ===================================================================
8385 AS_IF([test "$COM" = "MSC"],
8386       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8387       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8389 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8391 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8393 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8395 AS_IF([test "$COM" = "MSC"],
8396       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8397       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8399 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8401 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8403 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8404 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8406 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8408 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8410 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8412 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8413 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8415 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8416 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8418 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8420 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8421 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8423 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8425 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8427 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8429 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8431 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8432 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8434 dnl ===================================================================
8435 dnl Check for system lcms2
8436 dnl ===================================================================
8437 if test "$with_system_lcms2" != "yes"; then
8438     SYSTEM_LCMS2=
8440 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8441 if test "$GCC" = "yes"; then
8442     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8444 if test "$COM" = "MSC"; then # override the above
8445     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8448 dnl ===================================================================
8449 dnl Check for system cppunit
8450 dnl ===================================================================
8451 if test "$_os" != "Android" ; then
8452     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8455 dnl ===================================================================
8456 dnl Check whether freetype is available
8457 dnl ===================================================================
8458 if test  "$test_freetype" = "yes"; then
8459     AC_MSG_CHECKING([whether freetype is available])
8460     # FreeType has 3 different kinds of versions
8461     # * release, like 2.4.10
8462     # * libtool, like 13.0.7 (this what pkg-config returns)
8463     # * soname
8464     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8465     #
8466     # 9.9.3 is 2.2.0
8467     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8468     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8469     FilterLibs "${FREETYPE_LIBS}"
8470     FREETYPE_LIBS="${filteredlibs}"
8471     SYSTEM_FREETYPE=TRUE
8472 else
8473     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8474     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8476 AC_SUBST(FREETYPE_CFLAGS)
8477 AC_SUBST(FREETYPE_LIBS)
8478 AC_SUBST([SYSTEM_FREETYPE])
8480 # ===================================================================
8481 # Check for system libxslt
8482 # to prevent incompatibilities between internal libxml2 and external libxslt,
8483 # or vice versa, use with_system_libxml here
8484 # ===================================================================
8485 if test "$with_system_libxml" = "auto"; then
8486     case "$_os" in
8487     WINNT|iOS|Android)
8488         with_system_libxml="$with_system_libs"
8489         ;;
8490     *)
8491         if test "$enable_fuzzers" != "yes"; then
8492             with_system_libxml=yes
8493         else
8494             with_system_libxml=no
8495         fi
8496         ;;
8497     esac
8500 AC_MSG_CHECKING([which libxslt to use])
8501 if test "$with_system_libxml" = "yes"; then
8502     AC_MSG_RESULT([external])
8503     SYSTEM_LIBXSLT=TRUE
8504     if test "$_os" = "Darwin"; then
8505         dnl make sure to use SDK path
8506         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8507         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8508         dnl omit -L/usr/lib
8509         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8510         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8511     else
8512         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8513         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8514         FilterLibs "${LIBXSLT_LIBS}"
8515         LIBXSLT_LIBS="${filteredlibs}"
8516         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8517         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8518         FilterLibs "${LIBEXSLT_LIBS}"
8519         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8520     fi
8522     dnl Check for xsltproc
8523     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8524     if test "$XSLTPROC" = "no"; then
8525         AC_MSG_ERROR([xsltproc is required])
8526     fi
8527 else
8528     AC_MSG_RESULT([internal])
8529     SYSTEM_LIBXSLT=
8530     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8532     if test "$cross_compiling" = "yes"; then
8533         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8534         if test "$XSLTPROC" = "no"; then
8535             AC_MSG_ERROR([xsltproc is required])
8536         fi
8537     fi
8539 AC_SUBST(SYSTEM_LIBXSLT)
8540 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8541     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8543 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8545 AC_SUBST(LIBEXSLT_CFLAGS)
8546 AC_SUBST(LIBEXSLT_LIBS)
8547 AC_SUBST(LIBXSLT_CFLAGS)
8548 AC_SUBST(LIBXSLT_LIBS)
8549 AC_SUBST(XSLTPROC)
8551 # ===================================================================
8552 # Check for system libxml
8553 # ===================================================================
8554 AC_MSG_CHECKING([which libxml to use])
8555 if test "$with_system_libxml" = "yes"; then
8556     AC_MSG_RESULT([external])
8557     SYSTEM_LIBXML=TRUE
8558     if test "$_os" = "Darwin"; then
8559         dnl make sure to use SDK path
8560         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8561         dnl omit -L/usr/lib
8562         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8563     elif test $_os = iOS; then
8564         dnl make sure to use SDK path
8565         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8566         LIBXML_CFLAGS="-I$usr/include/libxml2"
8567         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8568     else
8569         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8570         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8571         FilterLibs "${LIBXML_LIBS}"
8572         LIBXML_LIBS="${filteredlibs}"
8573     fi
8575     dnl Check for xmllint
8576     AC_PATH_PROG(XMLLINT, xmllint, no)
8577     if test "$XMLLINT" = "no"; then
8578         AC_MSG_ERROR([xmllint is required])
8579     fi
8580 else
8581     AC_MSG_RESULT([internal])
8582     SYSTEM_LIBXML=
8583     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8584     if test "$COM" = "MSC"; then
8585         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8586     fi
8587     if test "$COM" = "MSC"; then
8588         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8589     else
8590         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8591     fi
8592     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8594 AC_SUBST(SYSTEM_LIBXML)
8595 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8596     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8598 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8599 AC_SUBST(LIBXML_CFLAGS)
8600 AC_SUBST(LIBXML_LIBS)
8601 AC_SUBST(XMLLINT)
8603 # =====================================================================
8604 # Checking for a Python interpreter with version >= 2.7.
8605 # Build and runtime requires Python 3 compatible version (>= 2.7).
8606 # Optionally user can pass an option to configure, i. e.
8607 # ./configure PYTHON=/usr/bin/python
8608 # =====================================================================
8609 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8610     if test -n "$PYTHON"; then
8611         PYTHON_FOR_BUILD=$PYTHON
8612     else
8613         # This allows a lack of system python with no error, we use internal one in that case.
8614         AM_PATH_PYTHON([2.7],, [:])
8615         # Clean PYTHON_VERSION checked below if cross-compiling
8616         PYTHON_VERSION=""
8617         if test "$PYTHON" != ":"; then
8618             PYTHON_FOR_BUILD=$PYTHON
8619         fi
8620     fi
8622 AC_SUBST(PYTHON_FOR_BUILD)
8624 # Checks for Python to use for Pyuno
8625 AC_MSG_CHECKING([which Python to use for Pyuno])
8626 case "$enable_python" in
8627 no|disable)
8628     if test -z $PYTHON_FOR_BUILD; then
8629         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8630         # requirement from the choice whether to include Python stuff in the installer, but why
8631         # bother?
8632         AC_MSG_ERROR([Python is required at build time.])
8633     fi
8634     enable_python=no
8635     AC_MSG_RESULT([none])
8636     ;;
8637 ""|yes|auto)
8638     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8639         AC_MSG_RESULT([no, overridden by --disable-scripting])
8640         enable_python=no
8641     elif test $build_os = cygwin; then
8642         dnl When building on Windows we don't attempt to use any installed
8643         dnl "system"  Python.
8644         AC_MSG_RESULT([fully internal])
8645         enable_python=internal
8646     elif test "$cross_compiling" = yes; then
8647         AC_MSG_RESULT([system])
8648         enable_python=system
8649     else
8650         if test -z "$PYTHON_FOR_BUILD"; then
8651             AC_MSG_RESULT([fully internal])
8652         else
8653             AC_MSG_RESULT([internal])
8654         fi
8655         enable_python=internal
8656     fi
8657     ;;
8658 internal)
8659     AC_MSG_RESULT([internal])
8660     ;;
8661 fully-internal)
8662     AC_MSG_RESULT([fully internal])
8663     enable_python=internal
8664     ;;
8665 system)
8666     AC_MSG_RESULT([system])
8667     if test "$_os" = Darwin; then
8668         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])
8669     fi
8670     ;;
8672     AC_MSG_ERROR([Incorrect --enable-python option])
8673     ;;
8674 esac
8676 if test $enable_python != no; then
8677     BUILD_TYPE="$BUILD_TYPE PYUNO"
8680 if test $enable_python = system; then
8681     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8682         # Fallback: Accept these in the environment, or as set above
8683         # for MacOSX.
8684         :
8685     elif test "$cross_compiling" != yes; then
8686         # Unset variables set by the above AM_PATH_PYTHON so that
8687         # we actually do check anew.
8688         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
8689         # This causes an error if no python command is found
8690         AM_PATH_PYTHON([3.3])
8691         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8692         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8693         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8694         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8695         if test -z "$PKG_CONFIG"; then
8696             PYTHON_CFLAGS="-I$python_include"
8697             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8698         elif $PKG_CONFIG --exists python-$python_version-embed; then
8699             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8700             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8701         elif $PKG_CONFIG --exists python-$python_version; then
8702             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8703             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8704         else
8705             PYTHON_CFLAGS="-I$python_include"
8706             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8707         fi
8708         FilterLibs "${PYTHON_LIBS}"
8709         PYTHON_LIBS="${filteredlibs}"
8710     else
8711         dnl How to find out the cross-compilation Python installation path?
8712         AC_MSG_CHECKING([for python version])
8713         AS_IF([test -n "$PYTHON_VERSION"],
8714               [AC_MSG_RESULT([$PYTHON_VERSION])],
8715               [AC_MSG_RESULT([not found])
8716                AC_MSG_ERROR([no usable python found])])
8717         test -n "$PYTHON_CFLAGS" && break
8718     fi
8720     dnl Check if the headers really work
8721     save_CPPFLAGS="$CPPFLAGS"
8722     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8723     AC_CHECK_HEADER(Python.h)
8724     CPPFLAGS="$save_CPPFLAGS"
8726     # let the PYTHON_FOR_BUILD match the same python installation that
8727     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8728     # better for PythonTests.
8729     PYTHON_FOR_BUILD=$PYTHON
8732 if test "$with_lxml" != no; then
8733     if test -z "$PYTHON_FOR_BUILD"; then
8734         case $build_os in
8735             cygwin)
8736                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8737                 ;;
8738             *)
8739                 if test "$cross_compiling" != yes ; then
8740                     BUILD_TYPE="$BUILD_TYPE LXML"
8741                 fi
8742                 ;;
8743         esac
8744     else
8745         AC_MSG_CHECKING([for python lxml])
8746         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8747             AC_MSG_RESULT([yes])
8748         else
8749             case $build_os in
8750                 cygwin)
8751                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8752                     ;;
8753                 *)
8754                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8755                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8756                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8757                         else
8758                             BUILD_TYPE="$BUILD_TYPE LXML"
8759                             AC_MSG_RESULT([no, using internal lxml])
8760                         fi
8761                     else
8762                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8763                     fi
8764                     ;;
8765             esac
8766         fi
8767     fi
8770 dnl By now enable_python should be "system", "internal" or "no"
8771 case $enable_python in
8772 system)
8773     SYSTEM_PYTHON=TRUE
8775     if test "x$ac_cv_header_Python_h" != "xyes"; then
8776        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8777     fi
8779     AC_LANG_PUSH(C)
8780     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8781     AC_MSG_CHECKING([for correct python library version])
8782        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8783 #include <Python.h>
8785 int main(int argc, char **argv) {
8786    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8787        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8788    else return 1;
8790        ]])],[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])])
8791     CFLAGS=$save_CFLAGS
8792     AC_LANG_POP(C)
8794     dnl FIXME Check if the Python library can be linked with, too?
8795     ;;
8797 internal)
8798     SYSTEM_PYTHON=
8799     PYTHON_VERSION_MAJOR=3
8800     PYTHON_VERSION_MINOR=7
8801     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
8802     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8803         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8804     fi
8805     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8806     BUILD_TYPE="$BUILD_TYPE PYTHON"
8807     if test "$OS" = LINUX; then
8808         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8809     fi
8810     # Embedded Python dies without Home set
8811     if test "$HOME" = ""; then
8812         export HOME=""
8813     fi
8814     ;;
8816     DISABLE_PYTHON=TRUE
8817     SYSTEM_PYTHON=
8818     ;;
8820     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8821     ;;
8822 esac
8824 AC_SUBST(DISABLE_PYTHON)
8825 AC_SUBST(SYSTEM_PYTHON)
8826 AC_SUBST(PYTHON_CFLAGS)
8827 AC_SUBST(PYTHON_LIBS)
8828 AC_SUBST(PYTHON_VERSION)
8829 AC_SUBST(PYTHON_VERSION_MAJOR)
8830 AC_SUBST(PYTHON_VERSION_MINOR)
8832 ENABLE_MARIADBC=TRUE
8833 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8834     ENABLE_MARIADBC=
8836 MARIADBC_MAJOR=1
8837 MARIADBC_MINOR=0
8838 MARIADBC_MICRO=2
8839 if test "$ENABLE_MARIADBC" = "TRUE"; then
8840     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8843 AC_SUBST(ENABLE_MARIADBC)
8844 AC_SUBST(MARIADBC_MAJOR)
8845 AC_SUBST(MARIADBC_MINOR)
8846 AC_SUBST(MARIADBC_MICRO)
8848 if test "$ENABLE_MARIADBC" = "TRUE"; then
8849     dnl ===================================================================
8850     dnl Check for system MariaDB
8851     dnl ===================================================================
8852     AC_MSG_CHECKING([which MariaDB to use])
8853     if test "$with_system_mariadb" = "yes"; then
8854         AC_MSG_RESULT([external])
8855         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8856         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8857         if test -z "$MARIADBCONFIG"; then
8858             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8859             if test -z "$MARIADBCONFIG"; then
8860                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8861                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8862             fi
8863         fi
8864         AC_MSG_CHECKING([MariaDB version])
8865         MARIADB_VERSION=`$MARIADBCONFIG --version`
8866         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8867         if test "$MARIADB_MAJOR" -ge "5"; then
8868             AC_MSG_RESULT([OK])
8869         else
8870             AC_MSG_ERROR([too old, use 5.0.x or later])
8871         fi
8872         AC_MSG_CHECKING([for MariaDB Client library])
8873         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8874         if test "$COM_IS_CLANG" = TRUE; then
8875             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8876         fi
8877         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8878         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8879         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8880         dnl linux32:
8881         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8882             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8883             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8884                 | sed -e 's|/lib64/|/lib/|')
8885         fi
8886         FilterLibs "${MARIADB_LIBS}"
8887         MARIADB_LIBS="${filteredlibs}"
8888         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8889         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8890         if test "$enable_bundle_mariadb" = "yes"; then
8891             AC_MSG_RESULT([yes])
8892             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8893             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8895 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8897 /g' | grep -E '(mysqlclient|mariadb)')
8898             if test "$_os" = "Darwin"; then
8899                 LIBMARIADB=${LIBMARIADB}.dylib
8900             elif test "$_os" = "WINNT"; then
8901                 LIBMARIADB=${LIBMARIADB}.dll
8902             else
8903                 LIBMARIADB=${LIBMARIADB}.so
8904             fi
8905             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8906             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8907             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8908                 AC_MSG_RESULT([found.])
8909                 PathFormat "$LIBMARIADB_PATH"
8910                 LIBMARIADB_PATH="$formatted_path"
8911             else
8912                 AC_MSG_ERROR([not found.])
8913             fi
8914         else
8915             AC_MSG_RESULT([no])
8916             BUNDLE_MARIADB_CONNECTOR_C=
8917         fi
8918     else
8919         AC_MSG_RESULT([internal])
8920         SYSTEM_MARIADB_CONNECTOR_C=
8921         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8922         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8923         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8924     fi
8926     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8927     AC_SUBST(MARIADB_CFLAGS)
8928     AC_SUBST(MARIADB_LIBS)
8929     AC_SUBST(LIBMARIADB)
8930     AC_SUBST(LIBMARIADB_PATH)
8931     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8934 dnl ===================================================================
8935 dnl Check for system hsqldb
8936 dnl ===================================================================
8937 if test "$with_java" != "no"; then
8938     HSQLDB_USE_JDBC_4_1=
8939     AC_MSG_CHECKING([which hsqldb to use])
8940     if test "$with_system_hsqldb" = "yes"; then
8941         AC_MSG_RESULT([external])
8942         SYSTEM_HSQLDB=TRUE
8943         if test -z $HSQLDB_JAR; then
8944             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8945         fi
8946         if ! test -f $HSQLDB_JAR; then
8947                AC_MSG_ERROR(hsqldb.jar not found.)
8948         fi
8949         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8950         export HSQLDB_JAR
8951         if $PERL -e \
8952            'use Archive::Zip;
8953             my $file = "$ENV{'HSQLDB_JAR'}";
8954             my $zip = Archive::Zip->new( $file );
8955             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8956             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8957             {
8958                 push @l, split(/\n/, $mf);
8959                 foreach my $line (@l)
8960                 {
8961                     if ($line =~ m/Specification-Version:/)
8962                     {
8963                         ($t, $version) = split (/:/,$line);
8964                         $version =~ s/^\s//;
8965                         ($a, $b, $c, $d) = split (/\./,$version);
8966                         if ($c == "0" && $d > "8")
8967                         {
8968                             exit 0;
8969                         }
8970                         else
8971                         {
8972                             exit 1;
8973                         }
8974                     }
8975                 }
8976             }
8977             else
8978             {
8979                 exit 1;
8980             }'; then
8981             AC_MSG_RESULT([yes])
8982         else
8983             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8984         fi
8985     else
8986         AC_MSG_RESULT([internal])
8987         SYSTEM_HSQLDB=
8988         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8989         NEED_ANT=TRUE
8990         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8991         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8992         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8993             AC_MSG_RESULT([yes])
8994             HSQLDB_USE_JDBC_4_1=TRUE
8995         else
8996             AC_MSG_RESULT([no])
8997         fi
8998     fi
8999     AC_SUBST(SYSTEM_HSQLDB)
9000     AC_SUBST(HSQLDB_JAR)
9001     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9004 dnl ===================================================================
9005 dnl Check for PostgreSQL stuff
9006 dnl ===================================================================
9007 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9008 if test "x$enable_postgresql_sdbc" != "xno"; then
9009     AC_MSG_RESULT([yes])
9010     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9012     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9013         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9014     fi
9015     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9016         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9017     fi
9019     postgres_interface=""
9020     if test "$with_system_postgresql" = "yes"; then
9021         postgres_interface="external PostgreSQL"
9022         SYSTEM_POSTGRESQL=TRUE
9023         if test "$_os" = Darwin; then
9024             supp_path=''
9025             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9026                 pg_supp_path="$P_SEP$d$pg_supp_path"
9027             done
9028         fi
9029         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9030         if test -n "$PGCONFIG"; then
9031             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9032             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9033         else
9034             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9035               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9036               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9037             ],[
9038               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9039             ])
9040         fi
9041         FilterLibs "${POSTGRESQL_LIB}"
9042         POSTGRESQL_LIB="${filteredlibs}"
9043     else
9044         # if/when anything else than PostgreSQL uses Kerberos,
9045         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9046         WITH_KRB5=
9047         WITH_GSSAPI=
9048         case "$_os" in
9049         Darwin)
9050             # macOS has system MIT Kerberos 5 since 10.4
9051             if test "$with_krb5" != "no"; then
9052                 WITH_KRB5=TRUE
9053                 save_LIBS=$LIBS
9054                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9055                 # that the libraries where these functions are located on macOS will change, is it?
9056                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9057                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9058                 KRB5_LIBS=$LIBS
9059                 LIBS=$save_LIBS
9060                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9061                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9062                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9063                 LIBS=$save_LIBS
9064             fi
9065             if test "$with_gssapi" != "no"; then
9066                 WITH_GSSAPI=TRUE
9067                 save_LIBS=$LIBS
9068                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9069                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9070                 GSSAPI_LIBS=$LIBS
9071                 LIBS=$save_LIBS
9072             fi
9073             ;;
9074         WINNT)
9075             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9076                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9077             fi
9078             ;;
9079         Linux|GNU|*BSD|DragonFly)
9080             if test "$with_krb5" != "no"; then
9081                 WITH_KRB5=TRUE
9082                 save_LIBS=$LIBS
9083                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9084                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9085                 KRB5_LIBS=$LIBS
9086                 LIBS=$save_LIBS
9087                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9088                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9089                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9090                 LIBS=$save_LIBS
9091             fi
9092             if test "$with_gssapi" != "no"; then
9093                 WITH_GSSAPI=TRUE
9094                 save_LIBS=$LIBS
9095                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9096                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9097                 GSSAPI_LIBS=$LIBS
9098                 LIBS=$save_LIBS
9099             fi
9100             ;;
9101         *)
9102             if test "$with_krb5" = "yes"; then
9103                 WITH_KRB5=TRUE
9104                 save_LIBS=$LIBS
9105                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9106                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9107                 KRB5_LIBS=$LIBS
9108                 LIBS=$save_LIBS
9109                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9110                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9111                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9112                 LIBS=$save_LIBS
9113             fi
9114             if test "$with_gssapi" = "yes"; then
9115                 WITH_GSSAPI=TRUE
9116                 save_LIBS=$LIBS
9117                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9118                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9119                 LIBS=$save_LIBS
9120                 GSSAPI_LIBS=$LIBS
9121             fi
9122         esac
9124         if test -n "$with_libpq_path"; then
9125             SYSTEM_POSTGRESQL=TRUE
9126             postgres_interface="external libpq"
9127             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9128             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9129         else
9130             SYSTEM_POSTGRESQL=
9131             postgres_interface="internal"
9132             POSTGRESQL_LIB=""
9133             POSTGRESQL_INC="%OVERRIDE_ME%"
9134             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9135         fi
9136     fi
9138     AC_MSG_CHECKING([PostgreSQL C interface])
9139     AC_MSG_RESULT([$postgres_interface])
9141     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9142         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9143         save_CFLAGS=$CFLAGS
9144         save_CPPFLAGS=$CPPFLAGS
9145         save_LIBS=$LIBS
9146         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9147         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9148         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9149         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9150             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9151         CFLAGS=$save_CFLAGS
9152         CPPFLAGS=$save_CPPFLAGS
9153         LIBS=$save_LIBS
9154     fi
9155     BUILD_POSTGRESQL_SDBC=TRUE
9156 else
9157     AC_MSG_RESULT([no])
9159 AC_SUBST(WITH_KRB5)
9160 AC_SUBST(WITH_GSSAPI)
9161 AC_SUBST(GSSAPI_LIBS)
9162 AC_SUBST(KRB5_LIBS)
9163 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9164 AC_SUBST(SYSTEM_POSTGRESQL)
9165 AC_SUBST(POSTGRESQL_INC)
9166 AC_SUBST(POSTGRESQL_LIB)
9168 dnl ===================================================================
9169 dnl Check for Firebird stuff
9170 dnl ===================================================================
9171 ENABLE_FIREBIRD_SDBC=
9172 if test "$enable_firebird_sdbc" = "yes" ; then
9173     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9175     dnl ===================================================================
9176     dnl Check for system Firebird
9177     dnl ===================================================================
9178     AC_MSG_CHECKING([which Firebird to use])
9179     if test "$with_system_firebird" = "yes"; then
9180         AC_MSG_RESULT([external])
9181         SYSTEM_FIREBIRD=TRUE
9182         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9183         if test -z "$FIREBIRDCONFIG"; then
9184             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9185             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9186                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9187             ])
9188             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9189         else
9190             AC_MSG_NOTICE([fb_config found])
9191             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9192             AC_MSG_CHECKING([for Firebird Client library])
9193             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9194             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9195             FilterLibs "${FIREBIRD_LIBS}"
9196             FIREBIRD_LIBS="${filteredlibs}"
9197         fi
9198         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9199         AC_MSG_CHECKING([Firebird version])
9200         if test -n "${FIREBIRD_VERSION}"; then
9201             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9202             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9203             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9204                 AC_MSG_RESULT([OK])
9205             else
9206                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9207             fi
9208         else
9209             __save_CFLAGS="${CFLAGS}"
9210             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9211             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9212 #if defined(FB_API_VER) && FB_API_VER == 30
9213 int fb_api_is_30(void) { return 0; }
9214 #else
9215 #error "Wrong Firebird API version"
9216 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9217             CFLAGS="${__save_CFLAGS}"
9218         fi
9219         ENABLE_FIREBIRD_SDBC=TRUE
9220         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9221     elif test "$enable_database_connectivity" != yes; then
9222         AC_MSG_RESULT([none])
9223     elif test "$cross_compiling" = "yes"; then
9224         AC_MSG_RESULT([none])
9225     else
9226         dnl Embedded Firebird has version 3.0
9227         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9228         dnl We need libatomic_ops for any non X86/X64 system
9229         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9230             dnl ===================================================================
9231             dnl Check for system libatomic_ops
9232             dnl ===================================================================
9233             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9234             if test "$with_system_libatomic_ops" = "yes"; then
9235                 SYSTEM_LIBATOMIC_OPS=TRUE
9236                 AC_CHECK_HEADERS(atomic_ops.h, [],
9237                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9238             else
9239                 SYSTEM_LIBATOMIC_OPS=
9240                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9241                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9242                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9243             fi
9244         fi
9246         AC_MSG_RESULT([internal])
9247         SYSTEM_FIREBIRD=
9248         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9249         FIREBIRD_LIBS="-lfbclient"
9251         if test "$with_system_libtommath" = "yes"; then
9252             SYSTEM_LIBTOMMATH=TRUE
9253             dnl check for tommath presence
9254             save_LIBS=$LIBS
9255             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9256             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9257             LIBS=$save_LIBS
9258         else
9259             SYSTEM_LIBTOMMATH=
9260             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9261             LIBTOMMATH_LIBS="-ltommath"
9262             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9263         fi
9265         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9266         ENABLE_FIREBIRD_SDBC=TRUE
9267         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9268     fi
9270 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9271 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9272 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9273 AC_SUBST(LIBATOMIC_OPS_LIBS)
9274 AC_SUBST(SYSTEM_FIREBIRD)
9275 AC_SUBST(FIREBIRD_CFLAGS)
9276 AC_SUBST(FIREBIRD_LIBS)
9277 AC_SUBST([TOMMATH_CFLAGS])
9278 AC_SUBST([TOMMATH_LIBS])
9280 dnl ===================================================================
9281 dnl Check for system curl
9282 dnl ===================================================================
9283 AC_MSG_CHECKING([which libcurl to use])
9284 if test "$with_system_curl" = "auto"; then
9285     with_system_curl="$with_system_libs"
9288 if test "$with_system_curl" = "yes"; then
9289     AC_MSG_RESULT([external])
9290     SYSTEM_CURL=TRUE
9292     # First try PKGCONFIG and then fall back
9293     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9295     if test -n "$CURL_PKG_ERRORS"; then
9296         AC_PATH_PROG(CURLCONFIG, curl-config)
9297         if test -z "$CURLCONFIG"; then
9298             AC_MSG_ERROR([curl development files not found])
9299         fi
9300         CURL_LIBS=`$CURLCONFIG --libs`
9301         FilterLibs "${CURL_LIBS}"
9302         CURL_LIBS="${filteredlibs}"
9303         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9304         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9306         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9307         case $curl_version in
9308         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9309         dnl so they need to be doubled to end up in the configure script
9310         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9311             AC_MSG_RESULT([yes])
9312             ;;
9313         *)
9314             AC_MSG_ERROR([no, you have $curl_version])
9315             ;;
9316         esac
9317     fi
9319     ENABLE_CURL=TRUE
9320 elif test $_os = iOS; then
9321     # Let's see if we need curl, I think not?
9322     AC_MSG_RESULT([none])
9323     ENABLE_CURL=
9324 else
9325     AC_MSG_RESULT([internal])
9326     SYSTEM_CURL=
9327     BUILD_TYPE="$BUILD_TYPE CURL"
9328     ENABLE_CURL=TRUE
9330 AC_SUBST(SYSTEM_CURL)
9331 AC_SUBST(CURL_CFLAGS)
9332 AC_SUBST(CURL_LIBS)
9333 AC_SUBST(ENABLE_CURL)
9335 dnl ===================================================================
9336 dnl Check for system boost
9337 dnl ===================================================================
9338 AC_MSG_CHECKING([which boost to use])
9339 if test "$with_system_boost" = "yes"; then
9340     AC_MSG_RESULT([external])
9341     SYSTEM_BOOST=TRUE
9342     AX_BOOST_BASE(1.47)
9343     AX_BOOST_DATE_TIME
9344     AX_BOOST_FILESYSTEM
9345     AX_BOOST_IOSTREAMS
9346     AX_BOOST_LOCALE
9347     AC_LANG_PUSH([C++])
9348     save_CXXFLAGS=$CXXFLAGS
9349     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9350     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9351        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9352     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9353        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9354     CXXFLAGS=$save_CXXFLAGS
9355     AC_LANG_POP([C++])
9356     # this is in m4/ax_boost_base.m4
9357     FilterLibs "${BOOST_LDFLAGS}"
9358     BOOST_LDFLAGS="${filteredlibs}"
9359 else
9360     AC_MSG_RESULT([internal])
9361     BUILD_TYPE="$BUILD_TYPE BOOST"
9362     SYSTEM_BOOST=
9363     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9364         # use warning-suppressing wrapper headers
9365         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9366     else
9367         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9368     fi
9370 AC_SUBST(SYSTEM_BOOST)
9372 dnl ===================================================================
9373 dnl Check for system mdds
9374 dnl ===================================================================
9375 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9377 dnl ===================================================================
9378 dnl Check for system glm
9379 dnl ===================================================================
9380 AC_MSG_CHECKING([which glm to use])
9381 if test "$with_system_glm" = "yes"; then
9382     AC_MSG_RESULT([external])
9383     SYSTEM_GLM=TRUE
9384     AC_LANG_PUSH([C++])
9385     AC_CHECK_HEADER([glm/glm.hpp], [],
9386        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9387     AC_LANG_POP([C++])
9388 else
9389     AC_MSG_RESULT([internal])
9390     BUILD_TYPE="$BUILD_TYPE GLM"
9391     SYSTEM_GLM=
9392     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9394 AC_SUBST([GLM_CFLAGS])
9395 AC_SUBST([SYSTEM_GLM])
9397 dnl ===================================================================
9398 dnl Check for system odbc
9399 dnl ===================================================================
9400 AC_MSG_CHECKING([which odbc headers to use])
9401 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
9402     AC_MSG_RESULT([external])
9403     SYSTEM_ODBC_HEADERS=TRUE
9405     if test "$build_os" = "cygwin"; then
9406         save_CPPFLAGS=$CPPFLAGS
9407         find_winsdk
9408         PathFormat "$winsdktest"
9409         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"
9410         AC_CHECK_HEADER(sqlext.h, [],
9411             [AC_MSG_ERROR(odbc not found. install odbc)],
9412             [#include <windows.h>])
9413         CPPFLAGS=$save_CPPFLAGS
9414     else
9415         AC_CHECK_HEADER(sqlext.h, [],
9416             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9417     fi
9418 elif test "$enable_database_connectivity" != yes; then
9419     AC_MSG_RESULT([none])
9420 else
9421     AC_MSG_RESULT([internal])
9422     SYSTEM_ODBC_HEADERS=
9424 AC_SUBST(SYSTEM_ODBC_HEADERS)
9426 dnl ===================================================================
9427 dnl Enable LDAP support
9428 dnl ===================================================================
9430 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9431 AC_MSG_CHECKING([whether to enable LDAP support])
9432     if test "$enable_ldap" != "yes"; then
9433         AC_MSG_RESULT([no])
9434         ENABLE_LDAP=""
9435         enable_ldap=no
9436     else
9437         AC_MSG_RESULT([yes])
9438         ENABLE_LDAP="TRUE"
9439         AC_DEFINE(HAVE_FEATURE_LDAP)
9440     fi
9442 AC_SUBST(ENABLE_LDAP)
9444 dnl ===================================================================
9445 dnl Check for system openldap
9446 dnl ===================================================================
9448 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9449 AC_MSG_CHECKING([which openldap library to use])
9450 if test "$with_system_openldap" = "yes"; then
9451     AC_MSG_RESULT([external])
9452     SYSTEM_OPENLDAP=TRUE
9453     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9454     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9455     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9456 else
9457     AC_MSG_RESULT([internal])
9458     SYSTEM_OPENLDAP=
9459     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9462 AC_SUBST(SYSTEM_OPENLDAP)
9464 dnl ===================================================================
9465 dnl Check for system NSS
9466 dnl ===================================================================
9467 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9468     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9469     AC_DEFINE(HAVE_FEATURE_NSS)
9470     ENABLE_NSS="TRUE"
9471     AC_DEFINE(ENABLE_NSS)
9472 elif test $_os != iOS ; then
9473     with_tls=openssl
9475 AC_SUBST(ENABLE_NSS)
9477 dnl ===================================================================
9478 dnl Check for TLS/SSL and cryptographic implementation to use
9479 dnl ===================================================================
9480 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9481 if test -n "$with_tls"; then
9482     case $with_tls in
9483     openssl)
9484         AC_DEFINE(USE_TLS_OPENSSL)
9485         TLS=OPENSSL
9487         if test "$enable_openssl" != "yes"; then
9488             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9489         fi
9491         # warn that OpenSSL has been selected but not all TLS code has this option
9492         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9493         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9494         ;;
9495     nss)
9496         AC_DEFINE(USE_TLS_NSS)
9497         TLS=NSS
9498         ;;
9499     no)
9500         AC_MSG_WARN([Skipping TLS/SSL])
9501         ;;
9502     *)
9503         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9504 openssl - OpenSSL
9505 nss - Mozilla's Network Security Services (NSS)
9506     ])
9507         ;;
9508     esac
9509 else
9510     # default to using NSS, it results in smaller oox lib
9511     AC_DEFINE(USE_TLS_NSS)
9512     TLS=NSS
9514 AC_MSG_RESULT([$TLS])
9515 AC_SUBST(TLS)
9517 dnl ===================================================================
9518 dnl Check for system sane
9519 dnl ===================================================================
9520 AC_MSG_CHECKING([which sane header to use])
9521 if test "$with_system_sane" = "yes"; then
9522     AC_MSG_RESULT([external])
9523     AC_CHECK_HEADER(sane/sane.h, [],
9524       [AC_MSG_ERROR(sane not found. install sane)], [])
9525 else
9526     AC_MSG_RESULT([internal])
9527     BUILD_TYPE="$BUILD_TYPE SANE"
9530 dnl ===================================================================
9531 dnl Check for system icu
9532 dnl ===================================================================
9533 SYSTEM_GENBRK=
9534 SYSTEM_GENCCODE=
9535 SYSTEM_GENCMN=
9537 ICU_MAJOR=65
9538 ICU_MINOR=1
9539 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9540 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9541 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9542 AC_MSG_CHECKING([which icu to use])
9543 if test "$with_system_icu" = "yes"; then
9544     AC_MSG_RESULT([external])
9545     SYSTEM_ICU=TRUE
9546     AC_LANG_PUSH([C++])
9547     AC_MSG_CHECKING([for unicode/rbbi.h])
9548     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9549     AC_LANG_POP([C++])
9551     if test "$cross_compiling" != "yes"; then
9552         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9553         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9554         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9555         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9556     fi
9558     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9559         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9560         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9561         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9562         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9563         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9564             AC_MSG_RESULT([yes])
9565         else
9566             AC_MSG_RESULT([no])
9567             if test "$with_system_icu_for_build" != "force"; then
9568                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9569 You can use --with-system-icu-for-build=force to use it anyway.])
9570             fi
9571         fi
9572     fi
9574     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9575         # using the system icu tools can lead to version confusion, use the
9576         # ones from the build environment when cross-compiling
9577         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9578         if test -z "$SYSTEM_GENBRK"; then
9579             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9580         fi
9581         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9582         if test -z "$SYSTEM_GENCCODE"; then
9583             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9584         fi
9585         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9586         if test -z "$SYSTEM_GENCMN"; then
9587             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9588         fi
9589         if test "$ICU_MAJOR" -ge "49"; then
9590             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9591             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9592             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9593         else
9594             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9595             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9596             ICU_RECLASSIFIED_HEBREW_LETTER=
9597         fi
9598     fi
9600     if test "$cross_compiling" = "yes"; then
9601         if test "$ICU_MAJOR" -ge "50"; then
9602             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9603             ICU_MINOR=""
9604         fi
9605     fi
9606 else
9607     AC_MSG_RESULT([internal])
9608     SYSTEM_ICU=
9609     BUILD_TYPE="$BUILD_TYPE ICU"
9610     # surprisingly set these only for "internal" (to be used by various other
9611     # external libs): the system icu-config is quite unhelpful and spits out
9612     # dozens of weird flags and also default path -I/usr/include
9613     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9614     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9616 if test "$ICU_MAJOR" -ge "59"; then
9617     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9618     # with -std=c++11 but not all external libraries can be built with that,
9619     # for those use a bit-compatible typedef uint16_t UChar; see
9620     # icu/source/common/unicode/umachine.h
9621     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9622 else
9623     ICU_UCHAR_TYPE=""
9625 AC_SUBST(SYSTEM_ICU)
9626 AC_SUBST(SYSTEM_GENBRK)
9627 AC_SUBST(SYSTEM_GENCCODE)
9628 AC_SUBST(SYSTEM_GENCMN)
9629 AC_SUBST(ICU_MAJOR)
9630 AC_SUBST(ICU_MINOR)
9631 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9632 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9633 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9634 AC_SUBST(ICU_CFLAGS)
9635 AC_SUBST(ICU_LIBS)
9636 AC_SUBST(ICU_UCHAR_TYPE)
9638 dnl ==================================================================
9639 dnl Breakpad
9640 dnl ==================================================================
9641 DEFAULT_CRASHDUMP_VALUE="true"
9642 AC_MSG_CHECKING([whether to enable breakpad])
9643 if test "$enable_breakpad" != yes; then
9644     AC_MSG_RESULT([no])
9645 else
9646     AC_MSG_RESULT([yes])
9647     ENABLE_BREAKPAD="TRUE"
9648     AC_DEFINE(ENABLE_BREAKPAD)
9649     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9650     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9652     AC_MSG_CHECKING([for disable crash dump])
9653     if test "$enable_crashdump" = no; then
9654         DEFAULT_CRASHDUMP_VALUE="false"
9655         AC_MSG_RESULT([yes])
9656     else
9657        AC_MSG_RESULT([no])
9658     fi
9660     AC_MSG_CHECKING([for crashreport config])
9661     if test "$with_symbol_config" = "no"; then
9662         BREAKPAD_SYMBOL_CONFIG="invalid"
9663         AC_MSG_RESULT([no])
9664     else
9665         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9666         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9667         AC_MSG_RESULT([yes])
9668     fi
9669     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9671 AC_SUBST(ENABLE_BREAKPAD)
9672 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9674 dnl ==================================================================
9675 dnl libfuzzer
9676 dnl ==================================================================
9677 AC_MSG_CHECKING([whether to enable fuzzers])
9678 if test "$enable_fuzzers" != yes; then
9679     AC_MSG_RESULT([no])
9680 else
9681     AC_MSG_RESULT([yes])
9682     ENABLE_FUZZERS="TRUE"
9683     AC_DEFINE([ENABLE_FUZZERS],1)
9684     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9686 AC_SUBST(ENABLE_FUZZERS)
9688 dnl ===================================================================
9689 dnl Orcus
9690 dnl ===================================================================
9691 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9692 if test "$with_system_orcus" != "yes"; then
9693     if test "$SYSTEM_BOOST" = "TRUE"; then
9694         # ===========================================================
9695         # Determine if we are going to need to link with Boost.System
9696         # ===========================================================
9697         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9698         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9699         dnl in documentation has no effect.
9700         AC_MSG_CHECKING([if we need to link with Boost.System])
9701         AC_LANG_PUSH([C++])
9702         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9703                 @%:@include <boost/version.hpp>
9704             ]],[[
9705                 #if BOOST_VERSION >= 105000
9706                 #   error yes, we need to link with Boost.System
9707                 #endif
9708             ]])],[
9709                 AC_MSG_RESULT([no])
9710             ],[
9711                 AC_MSG_RESULT([yes])
9712                 AX_BOOST_SYSTEM
9713         ])
9714         AC_LANG_POP([C++])
9715     fi
9717 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9718 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9719 AC_SUBST([BOOST_SYSTEM_LIB])
9720 AC_SUBST(SYSTEM_LIBORCUS)
9722 dnl ===================================================================
9723 dnl HarfBuzz
9724 dnl ===================================================================
9725 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9726                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9727                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9729 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9730                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9731                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9733 if test "$COM" = "MSC"; then # override the above
9734     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9735     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9738 if test "$with_system_harfbuzz" = "yes"; then
9739     if test "$with_system_graphite" = "no"; then
9740         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9741     fi
9742     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9743     _save_libs="$LIBS"
9744     _save_cflags="$CFLAGS"
9745     LIBS="$LIBS $HARFBUZZ_LIBS"
9746     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9747     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9748     LIBS="$_save_libs"
9749     CFLAGS="$_save_cflags"
9750 else
9751     if test "$with_system_graphite" = "yes"; then
9752         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9753     fi
9756 AC_MSG_CHECKING([whether to use X11])
9757 dnl ***************************************
9758 dnl testing for X libraries and includes...
9759 dnl ***************************************
9760 if test "$USING_X11" = TRUE; then
9761     AC_DEFINE(HAVE_FEATURE_X11)
9763 AC_MSG_RESULT([$USING_X11])
9765 if test "$USING_X11" = TRUE; then
9766     AC_PATH_X
9767     AC_PATH_XTRA
9768     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9770     if test -z "$x_includes"; then
9771         x_includes="default_x_includes"
9772     fi
9773     if test -z "$x_libraries"; then
9774         x_libraries="default_x_libraries"
9775     fi
9776     CFLAGS="$CFLAGS $X_CFLAGS"
9777     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9778     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9779 else
9780     x_includes="no_x_includes"
9781     x_libraries="no_x_libraries"
9784 if test "$USING_X11" = TRUE; then
9785     dnl ===================================================================
9786     dnl Check for extension headers
9787     dnl ===================================================================
9788     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9789      [#include <X11/extensions/shape.h>])
9791     # vcl needs ICE and SM
9792     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9793     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9794         [AC_MSG_ERROR(ICE library not found)])
9795     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9796     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9797         [AC_MSG_ERROR(SM library not found)])
9800 dnl ===================================================================
9801 dnl Check for system Xrender
9802 dnl ===================================================================
9803 AC_MSG_CHECKING([whether to use Xrender])
9804 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9805     AC_MSG_RESULT([yes])
9806     PKG_CHECK_MODULES(XRENDER, xrender)
9807     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9808     FilterLibs "${XRENDER_LIBS}"
9809     XRENDER_LIBS="${filteredlibs}"
9810     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9811       [AC_MSG_ERROR(libXrender not found or functional)], [])
9812     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9813       [AC_MSG_ERROR(Xrender not found. install X)], [])
9814 else
9815     AC_MSG_RESULT([no])
9817 AC_SUBST(XRENDER_CFLAGS)
9818 AC_SUBST(XRENDER_LIBS)
9820 dnl ===================================================================
9821 dnl Check for XRandr
9822 dnl ===================================================================
9823 AC_MSG_CHECKING([whether to enable RandR support])
9824 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9825     AC_MSG_RESULT([yes])
9826     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9827     if test "$ENABLE_RANDR" != "TRUE"; then
9828         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9829                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9830         XRANDR_CFLAGS=" "
9831         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9832           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9833         XRANDR_LIBS="-lXrandr "
9834         ENABLE_RANDR="TRUE"
9835     fi
9836     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9837     FilterLibs "${XRANDR_LIBS}"
9838     XRANDR_LIBS="${filteredlibs}"
9839 else
9840     ENABLE_RANDR=""
9841     AC_MSG_RESULT([no])
9843 AC_SUBST(XRANDR_CFLAGS)
9844 AC_SUBST(XRANDR_LIBS)
9845 AC_SUBST(ENABLE_RANDR)
9847 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9848     WITH_WEBDAV="serf"
9850 if test $_os = iOS -o $_os = Android; then
9851     WITH_WEBDAV="no"
9853 AC_MSG_CHECKING([for webdav library])
9854 case "$WITH_WEBDAV" in
9855 serf)
9856     AC_MSG_RESULT([serf])
9857     # Check for system apr-util
9858     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9859                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9860                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9861     if test "$COM" = "MSC"; then
9862         APR_LIB_DIR="LibR"
9863         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9864         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9865     fi
9867     # Check for system serf
9868     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9869                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9870     if test "$COM" = "MSC"; then
9871         SERF_LIB_DIR="Release"
9872         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9873         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9874     fi
9875     ;;
9876 neon)
9877     AC_MSG_RESULT([neon])
9878     # Check for system neon
9879     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9880     if test "$with_system_neon" = "yes"; then
9881         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9882     else
9883         NEON_VERSION=0295
9884     fi
9885     AC_SUBST(NEON_VERSION)
9886     ;;
9888     AC_MSG_RESULT([none, disabled])
9889     WITH_WEBDAV=""
9890     ;;
9891 esac
9892 AC_SUBST(WITH_WEBDAV)
9894 dnl ===================================================================
9895 dnl Check for disabling cve_tests
9896 dnl ===================================================================
9897 AC_MSG_CHECKING([whether to execute CVE tests])
9898 # If not explicitly enabled or disabled, default
9899 if test -z "$enable_cve_tests"; then
9900     case "$OS" in
9901     WNT)
9902         # Default cves off for Windows with its wild and wonderful
9903         # variety of AV software kicking in and panicking
9904         enable_cve_tests=no
9905         ;;
9906     *)
9907         # otherwise yes
9908         enable_cve_tests=yes
9909         ;;
9910     esac
9912 if test "$enable_cve_tests" = "no"; then
9913     AC_MSG_RESULT([no])
9914     DISABLE_CVE_TESTS=TRUE
9915     AC_SUBST(DISABLE_CVE_TESTS)
9916 else
9917     AC_MSG_RESULT([yes])
9920 dnl ===================================================================
9921 dnl Check for enabling chart XShape tests
9922 dnl ===================================================================
9923 AC_MSG_CHECKING([whether to execute chart XShape tests])
9924 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9925     AC_MSG_RESULT([yes])
9926     ENABLE_CHART_TESTS=TRUE
9927     AC_SUBST(ENABLE_CHART_TESTS)
9928 else
9929     AC_MSG_RESULT([no])
9932 dnl ===================================================================
9933 dnl Check for system openssl
9934 dnl ===================================================================
9935 DISABLE_OPENSSL=
9936 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9937 if test "$enable_openssl" = "yes"; then
9938     AC_MSG_RESULT([no])
9939     if test "$_os" = Darwin ; then
9940         # OpenSSL is deprecated when building for 10.7 or later.
9941         #
9942         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9943         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9945         with_system_openssl=no
9946         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9947     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9948             && test "$with_system_openssl" != "no"; then
9949         with_system_openssl=yes
9950         SYSTEM_OPENSSL=TRUE
9951         OPENSSL_CFLAGS=
9952         OPENSSL_LIBS="-lssl -lcrypto"
9953     else
9954         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9955     fi
9956     if test "$with_system_openssl" = "yes"; then
9957         AC_MSG_CHECKING([whether openssl supports SHA512])
9958         AC_LANG_PUSH([C])
9959         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9960             SHA512_CTX context;
9961 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9962         AC_LANG_POP(C)
9963     fi
9964 else
9965     AC_MSG_RESULT([yes])
9966     DISABLE_OPENSSL=TRUE
9968     # warn that although OpenSSL is disabled, system libraries may depend on it
9969     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9970     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9973 AC_SUBST([DISABLE_OPENSSL])
9975 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9976     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9977         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9978         enable_cipher_openssl_backend=no
9979     else
9980         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9981     fi
9983 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9984 ENABLE_CIPHER_OPENSSL_BACKEND=
9985 if test "$enable_cipher_openssl_backend" = yes; then
9986     AC_MSG_RESULT([yes])
9987     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9988 else
9989     AC_MSG_RESULT([no])
9991 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9993 dnl ===================================================================
9994 dnl Check for building gnutls
9995 dnl ===================================================================
9996 AC_MSG_CHECKING([whether to use gnutls])
9997 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9998     AC_MSG_RESULT([yes])
9999     AM_PATH_LIBGCRYPT()
10000     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10001         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10002                       available in the system to use as replacement.]]))
10003     FilterLibs "${LIBGCRYPT_LIBS}"
10004     LIBGCRYPT_LIBS="${filteredlibs}"
10005 else
10006     AC_MSG_RESULT([no])
10009 AC_SUBST([LIBGCRYPT_CFLAGS])
10010 AC_SUBST([LIBGCRYPT_LIBS])
10012 dnl ===================================================================
10013 dnl Check for system redland
10014 dnl ===================================================================
10015 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10016 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10017 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10018 if test "$with_system_redland" = "yes"; then
10019     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10020             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10021 else
10022     RAPTOR_MAJOR="0"
10023     RASQAL_MAJOR="3"
10024     REDLAND_MAJOR="0"
10026 AC_SUBST(RAPTOR_MAJOR)
10027 AC_SUBST(RASQAL_MAJOR)
10028 AC_SUBST(REDLAND_MAJOR)
10030 dnl ===================================================================
10031 dnl Check for system hunspell
10032 dnl ===================================================================
10033 AC_MSG_CHECKING([which libhunspell to use])
10034 if test "$with_system_hunspell" = "yes"; then
10035     AC_MSG_RESULT([external])
10036     SYSTEM_HUNSPELL=TRUE
10037     AC_LANG_PUSH([C++])
10038     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10039     if test "$HUNSPELL_PC" != "TRUE"; then
10040         AC_CHECK_HEADER(hunspell.hxx, [],
10041             [
10042             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10043             [AC_MSG_ERROR(hunspell headers not found.)], [])
10044             ], [])
10045         AC_CHECK_LIB([hunspell], [main], [:],
10046            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10047         HUNSPELL_LIBS=-lhunspell
10048     fi
10049     AC_LANG_POP([C++])
10050     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10051     FilterLibs "${HUNSPELL_LIBS}"
10052     HUNSPELL_LIBS="${filteredlibs}"
10053 else
10054     AC_MSG_RESULT([internal])
10055     SYSTEM_HUNSPELL=
10056     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10057     if test "$COM" = "MSC"; then
10058         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10059     else
10060         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10061     fi
10062     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10064 AC_SUBST(SYSTEM_HUNSPELL)
10065 AC_SUBST(HUNSPELL_CFLAGS)
10066 AC_SUBST(HUNSPELL_LIBS)
10068 dnl ===================================================================
10069 dnl Check for system qrcodegen
10070 dnl ===================================================================
10071 AC_MSG_CHECKING([whether to use libqrcodegen])
10072 if test "$enable_qrcodegen" = "no"; then
10073     AC_MSG_RESULT([no])
10074     ENABLE_QRCODEGEN=
10075     SYSTEM_QRCODEGEN=
10076 else
10077     AC_MSG_RESULT([yes])
10078     ENABLE_QRCODEGEN=TRUE
10079     AC_MSG_CHECKING([which libqrcodegen to use])
10080     if test "$with_system_qrcodegen" = "yes"; then
10081         AC_MSG_RESULT([external])
10082         SYSTEM_QRCODEGEN=TRUE
10083         AC_LANG_PUSH([C++])
10084         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10085             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10086         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10087             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10088         QRCODEGEN_LIBS=-lqrcodegencpp
10089         AC_LANG_POP([C++])
10090         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10091         FilterLibs "${QRCODEGEN_LIBS}"
10092         QRCODEGEN_LIBS="${filteredlibs}"
10093     else
10094         AC_MSG_RESULT([internal])
10095         SYSTEM_QRCODEGEN=
10096         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10097     fi
10098     if test "$ENABLE_QRCODEGEN" = TRUE; then
10099         AC_DEFINE(ENABLE_QRCODEGEN)
10100     fi
10102 AC_SUBST(SYSTEM_QRCODEGEN)
10103 AC_SUBST(ENABLE_QRCODEGEN)
10104 AC_SUBST(QRCODEGEN_CFLAGS)
10105 AC_SUBST(QRCODEGEN_LIBS)
10107 dnl ===================================================================
10108 dnl Checking for altlinuxhyph
10109 dnl ===================================================================
10110 AC_MSG_CHECKING([which altlinuxhyph to use])
10111 if test "$with_system_altlinuxhyph" = "yes"; then
10112     AC_MSG_RESULT([external])
10113     SYSTEM_HYPH=TRUE
10114     AC_CHECK_HEADER(hyphen.h, [],
10115        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10116     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10117        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10118        [#include <hyphen.h>])
10119     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10120         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10121     if test -z "$HYPHEN_LIB"; then
10122         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10123            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10124     fi
10125     if test -z "$HYPHEN_LIB"; then
10126         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10127            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10128     fi
10129 else
10130     AC_MSG_RESULT([internal])
10131     SYSTEM_HYPH=
10132     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10133     if test "$COM" = "MSC"; then
10134         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10135     else
10136         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10137     fi
10139 AC_SUBST(SYSTEM_HYPH)
10140 AC_SUBST(HYPHEN_LIB)
10142 dnl ===================================================================
10143 dnl Checking for mythes
10144 dnl ===================================================================
10145 AC_MSG_CHECKING([which mythes to use])
10146 if test "$with_system_mythes" = "yes"; then
10147     AC_MSG_RESULT([external])
10148     SYSTEM_MYTHES=TRUE
10149     AC_LANG_PUSH([C++])
10150     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10151     if test "$MYTHES_PKGCONFIG" = "no"; then
10152         AC_CHECK_HEADER(mythes.hxx, [],
10153             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10154         AC_CHECK_LIB([mythes-1.2], [main], [:],
10155             [ MYTHES_FOUND=no], [])
10156     if test "$MYTHES_FOUND" = "no"; then
10157         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10158                 [ MYTHES_FOUND=no], [])
10159     fi
10160     if test "$MYTHES_FOUND" = "no"; then
10161         AC_MSG_ERROR([mythes library not found!.])
10162     fi
10163     fi
10164     AC_LANG_POP([C++])
10165     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10166     FilterLibs "${MYTHES_LIBS}"
10167     MYTHES_LIBS="${filteredlibs}"
10168 else
10169     AC_MSG_RESULT([internal])
10170     SYSTEM_MYTHES=
10171     BUILD_TYPE="$BUILD_TYPE MYTHES"
10172     if test "$COM" = "MSC"; then
10173         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10174     else
10175         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10176     fi
10178 AC_SUBST(SYSTEM_MYTHES)
10179 AC_SUBST(MYTHES_CFLAGS)
10180 AC_SUBST(MYTHES_LIBS)
10182 dnl ===================================================================
10183 dnl How should we build the linear programming solver ?
10184 dnl ===================================================================
10186 ENABLE_COINMP=
10187 AC_MSG_CHECKING([whether to build with CoinMP])
10188 if test "$enable_coinmp" != "no"; then
10189     ENABLE_COINMP=TRUE
10190     AC_MSG_RESULT([yes])
10191     if test "$with_system_coinmp" = "yes"; then
10192         SYSTEM_COINMP=TRUE
10193         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10194         FilterLibs "${COINMP_LIBS}"
10195         COINMP_LIBS="${filteredlibs}"
10196     else
10197         BUILD_TYPE="$BUILD_TYPE COINMP"
10198     fi
10199 else
10200     AC_MSG_RESULT([no])
10202 AC_SUBST(ENABLE_COINMP)
10203 AC_SUBST(SYSTEM_COINMP)
10204 AC_SUBST(COINMP_CFLAGS)
10205 AC_SUBST(COINMP_LIBS)
10207 ENABLE_LPSOLVE=
10208 AC_MSG_CHECKING([whether to build with lpsolve])
10209 if test "$enable_lpsolve" != "no"; then
10210     ENABLE_LPSOLVE=TRUE
10211     AC_MSG_RESULT([yes])
10212 else
10213     AC_MSG_RESULT([no])
10215 AC_SUBST(ENABLE_LPSOLVE)
10217 if test "$ENABLE_LPSOLVE" = TRUE; then
10218     AC_MSG_CHECKING([which lpsolve to use])
10219     if test "$with_system_lpsolve" = "yes"; then
10220         AC_MSG_RESULT([external])
10221         SYSTEM_LPSOLVE=TRUE
10222         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10223            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10224         save_LIBS=$LIBS
10225         # some systems need this. Like Ubuntu...
10226         AC_CHECK_LIB(m, floor)
10227         AC_CHECK_LIB(dl, dlopen)
10228         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10229             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10230         LIBS=$save_LIBS
10231     else
10232         AC_MSG_RESULT([internal])
10233         SYSTEM_LPSOLVE=
10234         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10235     fi
10237 AC_SUBST(SYSTEM_LPSOLVE)
10239 dnl ===================================================================
10240 dnl Checking for libexttextcat
10241 dnl ===================================================================
10242 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10243 if test "$with_system_libexttextcat" = "yes"; then
10244     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10246 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10248 dnl ===================================================================
10249 dnl Checking for libnumbertext
10250 dnl ===================================================================
10251 AC_MSG_CHECKING([whether to use libnumbertext])
10252 if test "$enable_libnumbertext" = "no"; then
10253     AC_MSG_RESULT([no])
10254     ENABLE_LIBNUMBERTEXT=
10255     SYSTEM_LIBNUMBERTEXT=
10256 else
10257     AC_MSG_RESULT([yes])
10258     ENABLE_LIBNUMBERTEXT=TRUE
10259     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10260     if test "$with_system_libnumbertext" = "yes"; then
10261         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10262         SYSTEM_LIBNUMBERTEXT=YES
10263     else
10264         SYSTEM_LIBNUMBERTEXT=
10265         AC_LANG_PUSH([C++])
10266         save_CPPFLAGS=$CPPFLAGS
10267         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10268         AC_CHECK_HEADERS([codecvt regex])
10269         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10270                 [ ENABLE_LIBNUMBERTEXT=''
10271                   LIBNUMBERTEXT_CFLAGS=''
10272                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10273                                Enable libnumbertext fallback (missing number to number name conversion).])
10274                 ])
10275         CPPFLAGS=$save_CPPFLAGS
10276         AC_LANG_POP([C++])
10277     fi
10278     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10279         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10280     fi
10282 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10283 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10284 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10285 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10287 dnl ***************************************
10288 dnl testing libc version for Linux...
10289 dnl ***************************************
10290 if test "$_os" = "Linux"; then
10291     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10292     exec 6>/dev/null # no output
10293     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10294     exec 6>&1 # output on again
10295     if test "$HAVE_LIBC"; then
10296         AC_MSG_RESULT([yes])
10297     else
10298         AC_MSG_ERROR([no, upgrade libc])
10299     fi
10302 dnl =========================================
10303 dnl Check for uuidgen
10304 dnl =========================================
10305 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10306     # presence is already tested above in the WINDOWS_SDK_HOME check
10307     UUIDGEN=uuidgen.exe
10308     AC_SUBST(UUIDGEN)
10309 else
10310     AC_PATH_PROG([UUIDGEN], [uuidgen])
10311     if test -z "$UUIDGEN"; then
10312         AC_MSG_WARN([uuid is needed for building installation sets])
10313     fi
10316 dnl ***************************************
10317 dnl Checking for bison and flex
10318 dnl ***************************************
10319 AC_PATH_PROG(BISON, bison)
10320 if test -z "$BISON"; then
10321     AC_MSG_ERROR([no bison found in \$PATH, install it])
10322 else
10323     AC_MSG_CHECKING([the bison version])
10324     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10325     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10326     # Accept newer than 2.0
10327     if test "$_bison_longver" -lt 2000; then
10328         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10329     fi
10332 AC_PATH_PROG(FLEX, flex)
10333 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10334     FLEX=`cygpath -m $FLEX`
10336 if test -z "$FLEX"; then
10337     AC_MSG_ERROR([no flex found in \$PATH, install it])
10338 else
10339     AC_MSG_CHECKING([the flex version])
10340     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10341     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10342         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10343     fi
10345 AC_SUBST([FLEX])
10346 dnl ***************************************
10347 dnl Checking for patch
10348 dnl ***************************************
10349 AC_PATH_PROG(PATCH, patch)
10350 if test -z "$PATCH"; then
10351     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10354 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10355 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10356     if test -z "$with_gnu_patch"; then
10357         GNUPATCH=$PATCH
10358     else
10359         if test -x "$with_gnu_patch"; then
10360             GNUPATCH=$with_gnu_patch
10361         else
10362             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10363         fi
10364     fi
10366     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10367     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10368         AC_MSG_RESULT([yes])
10369     else
10370         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10371     fi
10372 else
10373     GNUPATCH=$PATCH
10376 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10377     GNUPATCH=`cygpath -m $GNUPATCH`
10380 dnl We also need to check for --with-gnu-cp
10382 if test -z "$with_gnu_cp"; then
10383     # check the place where the good stuff is hidden on Solaris...
10384     if test -x /usr/gnu/bin/cp; then
10385         GNUCP=/usr/gnu/bin/cp
10386     else
10387         AC_PATH_PROGS(GNUCP, gnucp cp)
10388     fi
10389     if test -z $GNUCP; then
10390         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10391     fi
10392 else
10393     if test -x "$with_gnu_cp"; then
10394         GNUCP=$with_gnu_cp
10395     else
10396         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10397     fi
10400 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10401     GNUCP=`cygpath -m $GNUCP`
10404 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10405 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10406     AC_MSG_RESULT([yes])
10407 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10408     AC_MSG_RESULT([yes])
10409 else
10410     case "$build_os" in
10411     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10412         x_GNUCP=[\#]
10413         GNUCP=''
10414         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10415         ;;
10416     *)
10417         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10418         ;;
10419     esac
10422 AC_SUBST(GNUPATCH)
10423 AC_SUBST(GNUCP)
10424 AC_SUBST(x_GNUCP)
10426 dnl ***************************************
10427 dnl testing assembler path
10428 dnl ***************************************
10429 ML_EXE=""
10430 if test "$_os" = "WINNT"; then
10431     if test "$BITNESS_OVERRIDE" = ""; then
10432         assembler=ml.exe
10433     else
10434         assembler=ml64.exe
10435     fi
10437     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10438     if test -f "$CL_PATH/$assembler"; then
10439         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10440         AC_MSG_RESULT([$ML_EXE])
10441     else
10442         AC_MSG_ERROR([not found])
10443     fi
10446 AC_SUBST(ML_EXE)
10448 dnl ===================================================================
10449 dnl We need zip and unzip
10450 dnl ===================================================================
10451 AC_PATH_PROG(ZIP, zip)
10452 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10453 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10454     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],,)
10457 AC_PATH_PROG(UNZIP, unzip)
10458 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10460 dnl ===================================================================
10461 dnl Zip must be a specific type for different build types.
10462 dnl ===================================================================
10463 if test $build_os = cygwin; then
10464     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10465         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10466     fi
10469 dnl ===================================================================
10470 dnl We need touch with -h option support.
10471 dnl ===================================================================
10472 AC_PATH_PROG(TOUCH, touch)
10473 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10474 touch warn
10475 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10476     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],,)
10479 dnl ===================================================================
10480 dnl Check for system epoxy
10481 dnl ===================================================================
10482 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10484 dnl ===================================================================
10485 dnl Set vcl option: coordinate device in double or sal_Int32
10486 dnl ===================================================================
10488 dnl disabled for now, we don't want subtle differences between OSs
10489 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10490 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10491 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10492 dnl     AC_MSG_RESULT([double])
10493 dnl else
10494 dnl     AC_MSG_RESULT([sal_Int32])
10495 dnl fi
10497 dnl ===================================================================
10498 dnl Test which vclplugs have to be built.
10499 dnl ===================================================================
10500 R=""
10501 if test "$USING_X11" != TRUE; then
10502     enable_gtk3=no
10504 GTK3_CFLAGS=""
10505 GTK3_LIBS=""
10506 ENABLE_GTK3=""
10507 if test "x$enable_gtk3" = "xyes"; then
10508     if test "$with_system_cairo" = no; then
10509         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10510     fi
10511     : ${with_system_cairo:=yes}
10512     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="")
10513     if test "x$ENABLE_GTK3" = "xTRUE"; then
10514         AC_DEFINE(ENABLE_GTK3)
10515         R="gtk3"
10516     else
10517         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10518     fi
10519     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10520     FilterLibs "${GTK3_LIBS}"
10521     GTK3_LIBS="${filteredlibs}"
10523     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10524     if test "$with_system_epoxy" != "yes"; then
10525         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10526         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10527                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10528     fi
10530 AC_SUBST(GTK3_LIBS)
10531 AC_SUBST(GTK3_CFLAGS)
10532 AC_SUBST(ENABLE_GTK3)
10534 if test "$enable_introspection" = yes; then
10535     if test "$ENABLE_GTK3" = TRUE; then
10536         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10537     else
10538         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10539     fi
10542 ENABLE_QT5=""
10543 if test "x$enable_qt5" = "xyes"; then
10544     ENABLE_QT5="TRUE"
10545     AC_DEFINE(ENABLE_QT5)
10546     R="$R qt5"
10548 AC_SUBST(ENABLE_QT5)
10550 ENABLE_KF5=""
10551 if test "x$enable_kf5" = "xyes"; then
10552     ENABLE_KF5="TRUE"
10553     AC_DEFINE(ENABLE_KF5)
10554     R="$R kf5"
10556 AC_SUBST(ENABLE_KF5)
10558 ENABLE_GTK3_KDE5=""
10559 if test "x$enable_gtk3_kde5" = "xyes"; then
10560     ENABLE_GTK3_KDE5="TRUE"
10561     AC_DEFINE(ENABLE_GTK3_KDE5)
10562     R="$R gtk3_kde5"
10564 AC_SUBST(ENABLE_GTK3_KDE5)
10566 if test "$_os" = "WINNT"; then
10567     R="$R win"
10568 elif test "$_os" = "Darwin"; then
10569     R="$R osx"
10570 elif test "$_os" = "iOS"; then
10571     R="ios (builtin)"
10574 build_vcl_plugins="$R"
10575 if test -z "$build_vcl_plugins"; then
10576     build_vcl_plugins="none"
10578 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10580 dnl ===================================================================
10581 dnl check for dbus support
10582 dnl ===================================================================
10583 ENABLE_DBUS=""
10584 DBUS_CFLAGS=""
10585 DBUS_LIBS=""
10586 DBUS_GLIB_CFLAGS=""
10587 DBUS_GLIB_LIBS=""
10588 DBUS_HAVE_GLIB=""
10590 if test "$enable_dbus" = "no"; then
10591     test_dbus=no
10594 AC_MSG_CHECKING([whether to enable DBUS support])
10595 if test "$test_dbus" = "yes"; then
10596     ENABLE_DBUS="TRUE"
10597     AC_MSG_RESULT([yes])
10598     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10599     AC_DEFINE(ENABLE_DBUS)
10600     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10601     FilterLibs "${DBUS_LIBS}"
10602     DBUS_LIBS="${filteredlibs}"
10604     # Glib is needed for BluetoothServer
10605     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10606     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10607         [
10608             DBUS_HAVE_GLIB="TRUE"
10609             AC_DEFINE(DBUS_HAVE_GLIB,1)
10610         ],
10611         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10612     )
10613 else
10614     AC_MSG_RESULT([no])
10617 AC_SUBST(ENABLE_DBUS)
10618 AC_SUBST(DBUS_CFLAGS)
10619 AC_SUBST(DBUS_LIBS)
10620 AC_SUBST(DBUS_GLIB_CFLAGS)
10621 AC_SUBST(DBUS_GLIB_LIBS)
10622 AC_SUBST(DBUS_HAVE_GLIB)
10624 AC_MSG_CHECKING([whether to enable Impress remote control])
10625 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10626     AC_MSG_RESULT([yes])
10627     ENABLE_SDREMOTE=TRUE
10628     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10630     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10631         # The Bluetooth code doesn't compile with macOS SDK 10.15
10632         enable_sdremote_bluetooth=no
10633     fi
10634     # If not explicitly enabled or disabled, default
10635     if test -z "$enable_sdremote_bluetooth"; then
10636         case "$OS" in
10637         LINUX|MACOSX|WNT)
10638             # Default to yes for these
10639             enable_sdremote_bluetooth=yes
10640             ;;
10641         *)
10642             # otherwise no
10643             enable_sdremote_bluetooth=no
10644             ;;
10645         esac
10646     fi
10647     # $enable_sdremote_bluetooth is guaranteed non-empty now
10649     if test "$enable_sdremote_bluetooth" != "no"; then
10650         if test "$OS" = "LINUX"; then
10651             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10652                 AC_MSG_RESULT([yes])
10653                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10654                 dnl ===================================================================
10655                 dnl Check for system bluez
10656                 dnl ===================================================================
10657                 AC_MSG_CHECKING([which Bluetooth header to use])
10658                 if test "$with_system_bluez" = "yes"; then
10659                     AC_MSG_RESULT([external])
10660                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10661                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10662                     SYSTEM_BLUEZ=TRUE
10663                 else
10664                     AC_MSG_RESULT([internal])
10665                     SYSTEM_BLUEZ=
10666                 fi
10667             else
10668                 AC_MSG_RESULT([no, dbus disabled])
10669                 ENABLE_SDREMOTE_BLUETOOTH=
10670                 SYSTEM_BLUEZ=
10671             fi
10672         else
10673             AC_MSG_RESULT([yes])
10674             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10675             SYSTEM_BLUEZ=
10676         fi
10677     else
10678         AC_MSG_RESULT([no])
10679         ENABLE_SDREMOTE_BLUETOOTH=
10680         SYSTEM_BLUEZ=
10681     fi
10682 else
10683     ENABLE_SDREMOTE=
10684     SYSTEM_BLUEZ=
10685     AC_MSG_RESULT([no])
10687 AC_SUBST(ENABLE_SDREMOTE)
10688 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10689 AC_SUBST(SYSTEM_BLUEZ)
10691 dnl ===================================================================
10692 dnl Check whether to enable GIO support
10693 dnl ===================================================================
10694 if test "$ENABLE_GTK3" = "TRUE"; then
10695     AC_MSG_CHECKING([whether to enable GIO support])
10696     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10697         dnl Need at least 2.26 for the dbus support.
10698         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10699                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10700         if test "$ENABLE_GIO" = "TRUE"; then
10701             AC_DEFINE(ENABLE_GIO)
10702             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10703             FilterLibs "${GIO_LIBS}"
10704             GIO_LIBS="${filteredlibs}"
10705         fi
10706     else
10707         AC_MSG_RESULT([no])
10708     fi
10710 AC_SUBST(ENABLE_GIO)
10711 AC_SUBST(GIO_CFLAGS)
10712 AC_SUBST(GIO_LIBS)
10715 dnl ===================================================================
10717 SPLIT_APP_MODULES=""
10718 if test "$enable_split_app_modules" = "yes"; then
10719     SPLIT_APP_MODULES="TRUE"
10721 AC_SUBST(SPLIT_APP_MODULES)
10723 SPLIT_OPT_FEATURES=""
10724 if test "$enable_split_opt_features" = "yes"; then
10725     SPLIT_OPT_FEATURES="TRUE"
10727 AC_SUBST(SPLIT_OPT_FEATURES)
10729 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10730     if test "$enable_cairo_canvas" = yes; then
10731         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10732     fi
10733     enable_cairo_canvas=no
10734 elif test -z "$enable_cairo_canvas"; then
10735     enable_cairo_canvas=yes
10738 ENABLE_CAIRO_CANVAS=""
10739 if test "$enable_cairo_canvas" = "yes"; then
10740     test_cairo=yes
10741     ENABLE_CAIRO_CANVAS="TRUE"
10742     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10744 AC_SUBST(ENABLE_CAIRO_CANVAS)
10746 dnl ===================================================================
10747 dnl Check whether the GStreamer libraries are available.
10748 dnl ===================================================================
10750 ENABLE_GSTREAMER_1_0=""
10752 if test "$build_gstreamer_1_0" = "yes"; then
10754     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10755     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10756         ENABLE_GSTREAMER_1_0="TRUE"
10757         AC_MSG_RESULT([yes])
10758         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10759         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10760         FilterLibs "${GSTREAMER_1_0_LIBS}"
10761         GSTREAMER_1_0_LIBS="${filteredlibs}"
10762         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10763     else
10764         AC_MSG_RESULT([no])
10765     fi
10767 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10768 AC_SUBST(GSTREAMER_1_0_LIBS)
10769 AC_SUBST(ENABLE_GSTREAMER_1_0)
10771 dnl ===================================================================
10772 dnl Check whether to build the VLC avmedia backend
10773 dnl ===================================================================
10775 ENABLE_VLC=""
10777 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10778 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10779     ENABLE_VLC="TRUE"
10780     AC_MSG_RESULT([yes])
10781 else
10782     AC_MSG_RESULT([no])
10784 AC_SUBST(ENABLE_VLC)
10786 ENABLE_OPENGL_TRANSITIONS=
10787 ENABLE_OPENGL_CANVAS=
10788 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10789    : # disable
10790 elif test "$_os" = "Darwin"; then
10791     # We use frameworks on macOS, no need for detail checks
10792     ENABLE_OPENGL_TRANSITIONS=TRUE
10793     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10794     ENABLE_OPENGL_CANVAS=TRUE
10795 elif test $_os = WINNT; then
10796     ENABLE_OPENGL_TRANSITIONS=TRUE
10797     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10798     ENABLE_OPENGL_CANVAS=TRUE
10799 else
10800     if test "$USING_X11" = TRUE; then
10801         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10802         ENABLE_OPENGL_TRANSITIONS=TRUE
10803         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10804         ENABLE_OPENGL_CANVAS=TRUE
10805     fi
10808 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10809 AC_SUBST(ENABLE_OPENGL_CANVAS)
10811 dnl =================================================
10812 dnl Check whether to build with OpenCL support.
10813 dnl =================================================
10815 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10816     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10817     # platform (optional at run-time, used through clew).
10818     BUILD_TYPE="$BUILD_TYPE OPENCL"
10819     AC_DEFINE(HAVE_FEATURE_OPENCL)
10822 dnl =================================================
10823 dnl Check whether to build with dconf support.
10824 dnl =================================================
10826 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10827     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10828         if test "$enable_dconf" = yes; then
10829             AC_MSG_ERROR([dconf not found])
10830         else
10831             enable_dconf=no
10832         fi])
10834 AC_MSG_CHECKING([whether to enable dconf])
10835 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10836     DCONF_CFLAGS=
10837     DCONF_LIBS=
10838     ENABLE_DCONF=
10839     AC_MSG_RESULT([no])
10840 else
10841     ENABLE_DCONF=TRUE
10842     AC_DEFINE(ENABLE_DCONF)
10843     AC_MSG_RESULT([yes])
10845 AC_SUBST([DCONF_CFLAGS])
10846 AC_SUBST([DCONF_LIBS])
10847 AC_SUBST([ENABLE_DCONF])
10849 # pdf import?
10850 AC_MSG_CHECKING([whether to build the PDF import feature])
10851 ENABLE_PDFIMPORT=
10852 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10853     AC_MSG_RESULT([yes])
10854     ENABLE_PDFIMPORT=TRUE
10855     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10856 else
10857     AC_MSG_RESULT([no])
10860 # Pdfium?
10861 AC_MSG_CHECKING([whether to build PDFium])
10862 ENABLE_PDFIUM=
10863 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10864     AC_MSG_RESULT([yes])
10865     ENABLE_PDFIUM=TRUE
10866     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10867     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10868 else
10869     AC_MSG_RESULT([no])
10871 AC_SUBST(ENABLE_PDFIUM)
10873 dnl ===================================================================
10874 dnl Check for poppler
10875 dnl ===================================================================
10876 ENABLE_POPPLER=
10877 AC_MSG_CHECKING([whether to build Poppler])
10878 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10879     AC_MSG_RESULT([yes])
10880     ENABLE_POPPLER=TRUE
10881     AC_DEFINE(HAVE_FEATURE_POPPLER)
10882 else
10883     AC_MSG_RESULT([no])
10885 AC_SUBST(ENABLE_POPPLER)
10887 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10888     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10891 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10892     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10895 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10896     dnl ===================================================================
10897     dnl Check for system poppler
10898     dnl ===================================================================
10899     AC_MSG_CHECKING([which PDF import poppler to use])
10900     if test "$with_system_poppler" = "yes"; then
10901         AC_MSG_RESULT([external])
10902         SYSTEM_POPPLER=TRUE
10903         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10904         AC_LANG_PUSH([C++])
10905         save_CXXFLAGS=$CXXFLAGS
10906         save_CPPFLAGS=$CPPFLAGS
10907         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10908         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10909         AC_CHECK_HEADER([cpp/poppler-version.h],
10910             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10911             [])
10912         CXXFLAGS=$save_CXXFLAGS
10913         CPPFLAGS=$save_CPPFLAGS
10914         AC_LANG_POP([C++])
10915         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10917         FilterLibs "${POPPLER_LIBS}"
10918         POPPLER_LIBS="${filteredlibs}"
10919     else
10920         AC_MSG_RESULT([internal])
10921         SYSTEM_POPPLER=
10922         BUILD_TYPE="$BUILD_TYPE POPPLER"
10923         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10924     fi
10925     AC_DEFINE([ENABLE_PDFIMPORT],1)
10927 AC_SUBST(ENABLE_PDFIMPORT)
10928 AC_SUBST(SYSTEM_POPPLER)
10929 AC_SUBST(POPPLER_CFLAGS)
10930 AC_SUBST(POPPLER_LIBS)
10932 SYSTEM_GPGMEPP=
10934 if test "$build_for_ios" = "YES"; then
10935     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10936     AC_MSG_RESULT([yes])
10937 elif test "$enable_mpl_subset" = "yes"; then
10938     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10939     AC_MSG_RESULT([yes])
10940 elif test "$enable_fuzzers" = "yes"; then
10941     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10942     AC_MSG_RESULT([yes])
10943 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10944     dnl ===================================================================
10945     dnl Check for system gpgme
10946     dnl ===================================================================
10947     AC_MSG_CHECKING([which gpgmepp to use])
10948     if test "$with_system_gpgmepp" = "yes"; then
10949         AC_MSG_RESULT([external])
10950         SYSTEM_GPGMEPP=TRUE
10952         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10953         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10954             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10955         # progress_callback is the only func with plain C linkage
10956         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10957         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10958             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10959         AC_CHECK_HEADER(gpgme.h, [],
10960             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10961     else
10962         AC_MSG_RESULT([internal])
10963         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10964         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10966         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10967         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10968         if test "$_os" != "WINNT"; then
10969             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10970             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10971         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10972             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10973         fi
10974     fi
10975     ENABLE_GPGMEPP=TRUE
10976     AC_DEFINE([HAVE_FEATURE_GPGME])
10977     AC_PATH_PROG(GPG, gpg)
10978     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10979     # so let's exclude that manually for the moment
10980     if test -n "$GPG" -a "$_os" != "WINNT"; then
10981         # make sure we not only have a working gpgme, but a full working
10982         # gpg installation to run OpenPGP signature verification
10983         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10984     fi
10985     if test "$_os" = "Linux"; then
10986       uid=`id -u`
10987       AC_MSG_CHECKING([for /run/user/$uid])
10988       if test -d /run/user/$uid; then
10989         AC_MSG_RESULT([yes])
10990         AC_PATH_PROG(GPGCONF, gpgconf)
10992         # Older versions of gpgconf are not working as expected, since
10993         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10994         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10995         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10996         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10997         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10998         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10999         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11000           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11001           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11002           if $GPGCONF --dump-options > /dev/null ; then
11003             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11004               AC_MSG_RESULT([yes])
11005               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11006               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11007             else
11008               AC_MSG_RESULT([no])
11009             fi
11010           else
11011             AC_MSG_RESULT([no. missing or broken gpgconf?])
11012           fi
11013         else
11014           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11015         fi
11016       else
11017         AC_MSG_RESULT([no])
11018      fi
11019    fi
11021 AC_SUBST(ENABLE_GPGMEPP)
11022 AC_SUBST(SYSTEM_GPGMEPP)
11023 AC_SUBST(GPG_ERROR_CFLAGS)
11024 AC_SUBST(GPG_ERROR_LIBS)
11025 AC_SUBST(LIBASSUAN_CFLAGS)
11026 AC_SUBST(LIBASSUAN_LIBS)
11027 AC_SUBST(GPGMEPP_CFLAGS)
11028 AC_SUBST(GPGMEPP_LIBS)
11030 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11031 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11032     AC_MSG_RESULT([yes])
11033     ENABLE_MEDIAWIKI=TRUE
11034     BUILD_TYPE="$BUILD_TYPE XSLTML"
11035     if test  "x$with_java" = "xno"; then
11036         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11037     fi
11038 else
11039     AC_MSG_RESULT([no])
11040     ENABLE_MEDIAWIKI=
11041     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11043 AC_SUBST(ENABLE_MEDIAWIKI)
11045 AC_MSG_CHECKING([whether to build the Report Builder])
11046 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11047     AC_MSG_RESULT([yes])
11048     ENABLE_REPORTBUILDER=TRUE
11049     AC_MSG_CHECKING([which jfreereport libs to use])
11050     if test "$with_system_jfreereport" = "yes"; then
11051         SYSTEM_JFREEREPORT=TRUE
11052         AC_MSG_RESULT([external])
11053         if test -z $SAC_JAR; then
11054             SAC_JAR=/usr/share/java/sac.jar
11055         fi
11056         if ! test -f $SAC_JAR; then
11057              AC_MSG_ERROR(sac.jar not found.)
11058         fi
11060         if test -z $LIBXML_JAR; then
11061             if test -f /usr/share/java/libxml-1.0.0.jar; then
11062                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11063             elif test -f /usr/share/java/libxml.jar; then
11064                 LIBXML_JAR=/usr/share/java/libxml.jar
11065             else
11066                 AC_MSG_ERROR(libxml.jar replacement not found.)
11067             fi
11068         elif ! test -f $LIBXML_JAR; then
11069             AC_MSG_ERROR(libxml.jar not found.)
11070         fi
11072         if test -z $FLUTE_JAR; then
11073             if test -f/usr/share/java/flute-1.3.0.jar; then
11074                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11075             elif test -f /usr/share/java/flute.jar; then
11076                 FLUTE_JAR=/usr/share/java/flute.jar
11077             else
11078                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11079             fi
11080         elif ! test -f $FLUTE_JAR; then
11081             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11082         fi
11084         if test -z $JFREEREPORT_JAR; then
11085             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11086                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11087             elif test -f /usr/share/java/flow-engine.jar; then
11088                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11089             else
11090                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11091             fi
11092         elif ! test -f  $JFREEREPORT_JAR; then
11093                 AC_MSG_ERROR(jfreereport.jar not found.)
11094         fi
11096         if test -z $LIBLAYOUT_JAR; then
11097             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11098                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11099             elif test -f /usr/share/java/liblayout.jar; then
11100                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11101             else
11102                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11103             fi
11104         elif ! test -f $LIBLAYOUT_JAR; then
11105                 AC_MSG_ERROR(liblayout.jar not found.)
11106         fi
11108         if test -z $LIBLOADER_JAR; then
11109             if test -f /usr/share/java/libloader-1.0.0.jar; then
11110                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11111             elif test -f /usr/share/java/libloader.jar; then
11112                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11113             else
11114                 AC_MSG_ERROR(libloader.jar replacement not found.)
11115             fi
11116         elif ! test -f  $LIBLOADER_JAR; then
11117             AC_MSG_ERROR(libloader.jar not found.)
11118         fi
11120         if test -z $LIBFORMULA_JAR; then
11121             if test -f /usr/share/java/libformula-0.2.0.jar; then
11122                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11123             elif test -f /usr/share/java/libformula.jar; then
11124                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11125             else
11126                 AC_MSG_ERROR(libformula.jar replacement not found.)
11127             fi
11128         elif ! test -f $LIBFORMULA_JAR; then
11129                 AC_MSG_ERROR(libformula.jar not found.)
11130         fi
11132         if test -z $LIBREPOSITORY_JAR; then
11133             if test -f /usr/share/java/librepository-1.0.0.jar; then
11134                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11135             elif test -f /usr/share/java/librepository.jar; then
11136                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11137             else
11138                 AC_MSG_ERROR(librepository.jar replacement not found.)
11139             fi
11140         elif ! test -f $LIBREPOSITORY_JAR; then
11141             AC_MSG_ERROR(librepository.jar not found.)
11142         fi
11144         if test -z $LIBFONTS_JAR; then
11145             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11146                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11147             elif test -f /usr/share/java/libfonts.jar; then
11148                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11149             else
11150                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11151             fi
11152         elif ! test -f $LIBFONTS_JAR; then
11153                 AC_MSG_ERROR(libfonts.jar not found.)
11154         fi
11156         if test -z $LIBSERIALIZER_JAR; then
11157             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11158                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11159             elif test -f /usr/share/java/libserializer.jar; then
11160                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11161             else
11162                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11163             fi
11164         elif ! test -f $LIBSERIALIZER_JAR; then
11165                 AC_MSG_ERROR(libserializer.jar not found.)
11166         fi
11168         if test -z $LIBBASE_JAR; then
11169             if test -f /usr/share/java/libbase-1.0.0.jar; then
11170                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11171             elif test -f /usr/share/java/libbase.jar; then
11172                 LIBBASE_JAR=/usr/share/java/libbase.jar
11173             else
11174                 AC_MSG_ERROR(libbase.jar replacement not found.)
11175             fi
11176         elif ! test -f $LIBBASE_JAR; then
11177             AC_MSG_ERROR(libbase.jar not found.)
11178         fi
11180     else
11181         AC_MSG_RESULT([internal])
11182         SYSTEM_JFREEREPORT=
11183         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11184         NEED_ANT=TRUE
11185     fi
11186 else
11187     AC_MSG_RESULT([no])
11188     ENABLE_REPORTBUILDER=
11189     SYSTEM_JFREEREPORT=
11191 AC_SUBST(ENABLE_REPORTBUILDER)
11192 AC_SUBST(SYSTEM_JFREEREPORT)
11193 AC_SUBST(SAC_JAR)
11194 AC_SUBST(LIBXML_JAR)
11195 AC_SUBST(FLUTE_JAR)
11196 AC_SUBST(JFREEREPORT_JAR)
11197 AC_SUBST(LIBBASE_JAR)
11198 AC_SUBST(LIBLAYOUT_JAR)
11199 AC_SUBST(LIBLOADER_JAR)
11200 AC_SUBST(LIBFORMULA_JAR)
11201 AC_SUBST(LIBREPOSITORY_JAR)
11202 AC_SUBST(LIBFONTS_JAR)
11203 AC_SUBST(LIBSERIALIZER_JAR)
11205 # this has to be here because both the Wiki Publisher and the SRB use
11206 # commons-logging
11207 COMMONS_LOGGING_VERSION=1.2
11208 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11209     AC_MSG_CHECKING([which Apache commons-* libs to use])
11210     if test "$with_system_apache_commons" = "yes"; then
11211         SYSTEM_APACHE_COMMONS=TRUE
11212         AC_MSG_RESULT([external])
11213         if test -z $COMMONS_LOGGING_JAR; then
11214             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11215                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11216            elif test -f /usr/share/java/commons-logging.jar; then
11217                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11218             else
11219                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11220             fi
11221         elif ! test -f $COMMONS_LOGGING_JAR; then
11222             AC_MSG_ERROR(commons-logging.jar not found.)
11223         fi
11224     else
11225         AC_MSG_RESULT([internal])
11226         SYSTEM_APACHE_COMMONS=
11227         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11228         NEED_ANT=TRUE
11229     fi
11231 AC_SUBST(SYSTEM_APACHE_COMMONS)
11232 AC_SUBST(COMMONS_LOGGING_JAR)
11233 AC_SUBST(COMMONS_LOGGING_VERSION)
11235 # scripting provider for BeanShell?
11236 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11237 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11238     AC_MSG_RESULT([yes])
11239     ENABLE_SCRIPTING_BEANSHELL=TRUE
11241     dnl ===================================================================
11242     dnl Check for system beanshell
11243     dnl ===================================================================
11244     AC_MSG_CHECKING([which beanshell to use])
11245     if test "$with_system_beanshell" = "yes"; then
11246         AC_MSG_RESULT([external])
11247         SYSTEM_BSH=TRUE
11248         if test -z $BSH_JAR; then
11249             BSH_JAR=/usr/share/java/bsh.jar
11250         fi
11251         if ! test -f $BSH_JAR; then
11252             AC_MSG_ERROR(bsh.jar not found.)
11253         fi
11254     else
11255         AC_MSG_RESULT([internal])
11256         SYSTEM_BSH=
11257         BUILD_TYPE="$BUILD_TYPE BSH"
11258     fi
11259 else
11260     AC_MSG_RESULT([no])
11261     ENABLE_SCRIPTING_BEANSHELL=
11262     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11264 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11265 AC_SUBST(SYSTEM_BSH)
11266 AC_SUBST(BSH_JAR)
11268 # scripting provider for JavaScript?
11269 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11270 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11271     AC_MSG_RESULT([yes])
11272     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11274     dnl ===================================================================
11275     dnl Check for system rhino
11276     dnl ===================================================================
11277     AC_MSG_CHECKING([which rhino to use])
11278     if test "$with_system_rhino" = "yes"; then
11279         AC_MSG_RESULT([external])
11280         SYSTEM_RHINO=TRUE
11281         if test -z $RHINO_JAR; then
11282             RHINO_JAR=/usr/share/java/js.jar
11283         fi
11284         if ! test -f $RHINO_JAR; then
11285             AC_MSG_ERROR(js.jar not found.)
11286         fi
11287     else
11288         AC_MSG_RESULT([internal])
11289         SYSTEM_RHINO=
11290         BUILD_TYPE="$BUILD_TYPE RHINO"
11291         NEED_ANT=TRUE
11292     fi
11293 else
11294     AC_MSG_RESULT([no])
11295     ENABLE_SCRIPTING_JAVASCRIPT=
11296     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11298 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11299 AC_SUBST(SYSTEM_RHINO)
11300 AC_SUBST(RHINO_JAR)
11302 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11303 # paths should be added to library search path. So lets put all 64-bit
11304 # platforms there.
11305 supports_multilib=
11306 case "$host_cpu" in
11307 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11308     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11309         supports_multilib="yes"
11310     fi
11311     ;;
11313     ;;
11314 esac
11316 dnl ===================================================================
11317 dnl QT5 Integration
11318 dnl ===================================================================
11320 QT5_CFLAGS=""
11321 QT5_LIBS=""
11322 QMAKE5="qmake"
11323 MOC5="moc"
11324 QT5_GOBJECT_CFLAGS=""
11325 QT5_GOBJECT_LIBS=""
11326 QT5_HAVE_GOBJECT=""
11327 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11328         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11329         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11330 then
11331     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11332     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11334     if test -n "$supports_multilib"; then
11335         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11336     fi
11338     qt5_test_include="QtWidgets/qapplication.h"
11339     qt5_test_library="libQt5Widgets.so"
11341     dnl Check for qmake5
11342     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11343     if test "$QMAKE5" = "no"; then
11344         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11345     else
11346         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11347         if test -z "$qmake5_test_ver"; then
11348             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11349         fi
11350         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11351         qt5_minimal_minor="6"
11352         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11353             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11354         else
11355             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11356         fi
11357     fi
11359     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11360     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11362     AC_MSG_CHECKING([for Qt5 headers])
11363     qt5_incdir="no"
11364     for inc_dir in $qt5_incdirs; do
11365         if test -r "$inc_dir/$qt5_test_include"; then
11366             qt5_incdir="$inc_dir"
11367             break
11368         fi
11369     done
11370     AC_MSG_RESULT([$qt5_incdir])
11371     if test "x$qt5_incdir" = "xno"; then
11372         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11373     fi
11375     AC_MSG_CHECKING([for Qt5 libraries])
11376     qt5_libdir="no"
11377     for lib_dir in $qt5_libdirs; do
11378         if test -r "$lib_dir/$qt5_test_library"; then
11379             qt5_libdir="$lib_dir"
11380             break
11381         fi
11382     done
11383     AC_MSG_RESULT([$qt5_libdir])
11384     if test "x$qt5_libdir" = "xno"; then
11385         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11386     fi
11388     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11389     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11390     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11392     if test "$USING_X11" = TRUE; then
11393         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11394         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11395             QT5_HAVE_XCB_ICCCM=1
11396             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11397         ],[
11398             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
11399             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11400         ])
11401         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11402         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11403         QT5_USING_X11=1
11404         AC_DEFINE(QT5_USING_X11)
11405     fi
11407     dnl Check for Meta Object Compiler
11409     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11410     if test "$MOC5" = "no"; then
11411         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11412 the root of your Qt installation by exporting QT5DIR before running "configure".])
11413     fi
11415     if test "$build_gstreamer_1_0" = "yes"; then
11416         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11417                 QT5_HAVE_GOBJECT=1
11418                 AC_DEFINE(QT5_HAVE_GOBJECT)
11419             ],
11420             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11421         )
11422     fi
11424 AC_SUBST(QT5_CFLAGS)
11425 AC_SUBST(QT5_LIBS)
11426 AC_SUBST(MOC5)
11427 AC_SUBST(QT5_GOBJECT_CFLAGS)
11428 AC_SUBST(QT5_GOBJECT_LIBS)
11429 AC_SUBST(QT5_HAVE_GOBJECT)
11431 dnl ===================================================================
11432 dnl KF5 Integration
11433 dnl ===================================================================
11435 KF5_CFLAGS=""
11436 KF5_LIBS=""
11437 KF5_CONFIG="kf5-config"
11438 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11439         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11440 then
11441     if test "$OS" = "HAIKU"; then
11442         haiku_arch="`echo $RTL_ARCH | tr X x`"
11443         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11444         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11445     fi
11447     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11448     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11449     if test -n "$supports_multilib"; then
11450         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11451     fi
11453     kf5_test_include="KF5/kcoreaddons_version.h"
11454     kf5_test_library="libKF5CoreAddons.so"
11455     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11457     dnl kf5 KDE4 support compatibility installed
11458     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11459     if test "$KF5_CONFIG" != "no"; then
11460         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11461         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11462     fi
11464     dnl Check for KF5 headers
11465     AC_MSG_CHECKING([for KF5 headers])
11466     kf5_incdir="no"
11467     for kf5_check in $kf5_incdirs; do
11468         if test -r "$kf5_check/$kf5_test_include"; then
11469             kf5_incdir="$kf5_check/KF5"
11470             break
11471         fi
11472     done
11473     AC_MSG_RESULT([$kf5_incdir])
11474     if test "x$kf5_incdir" = "xno"; then
11475         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11476     fi
11478     dnl Check for KF5 libraries
11479     AC_MSG_CHECKING([for KF5 libraries])
11480     kf5_libdir="no"
11481     for kf5_check in $kf5_libdirs; do
11482         if test -r "$kf5_check/$kf5_test_library"; then
11483             kf5_libdir="$kf5_check"
11484             break
11485         fi
11486     done
11488     AC_MSG_RESULT([$kf5_libdir])
11489     if test "x$kf5_libdir" = "xno"; then
11490         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11491     fi
11493     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"
11494     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11495     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11497     if test "$USING_X11" = TRUE; then
11498         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11499     fi
11501     AC_LANG_PUSH([C++])
11502     save_CXXFLAGS=$CXXFLAGS
11503     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11504     AC_MSG_CHECKING([whether KDE is >= 5.0])
11505        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11506 #include <kcoreaddons_version.h>
11508 int main(int argc, char **argv) {
11509        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11510        else return 1;
11512        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11513     CXXFLAGS=$save_CXXFLAGS
11514     AC_LANG_POP([C++])
11516 AC_SUBST(KF5_CFLAGS)
11517 AC_SUBST(KF5_LIBS)
11519 dnl ===================================================================
11520 dnl Test whether to include Evolution 2 support
11521 dnl ===================================================================
11522 AC_MSG_CHECKING([whether to enable evolution 2 support])
11523 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11524     AC_MSG_RESULT([yes])
11525     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11526     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11527     FilterLibs "${GOBJECT_LIBS}"
11528     GOBJECT_LIBS="${filteredlibs}"
11529     ENABLE_EVOAB2="TRUE"
11530 else
11531     ENABLE_EVOAB2=""
11532     AC_MSG_RESULT([no])
11534 AC_SUBST(ENABLE_EVOAB2)
11535 AC_SUBST(GOBJECT_CFLAGS)
11536 AC_SUBST(GOBJECT_LIBS)
11538 dnl ===================================================================
11539 dnl Test which themes to include
11540 dnl ===================================================================
11541 AC_MSG_CHECKING([which themes to include])
11542 # if none given use default subset of available themes
11543 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11544     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg cib colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg tango"
11547 WITH_THEMES=""
11548 if test "x$with_theme" != "xno"; then
11549     for theme in $with_theme; do
11550         case $theme in
11551         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|tango|cib) real_theme="$theme" ;;
11552         default) real_theme=colibre ;;
11553         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11554         esac
11555         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11556     done
11558 AC_MSG_RESULT([$WITH_THEMES])
11559 AC_SUBST([WITH_THEMES])
11560 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11561 for theme in $with_theme; do
11562     case $theme in
11563     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11564     *) ;;
11565     esac
11566 done
11568 dnl ===================================================================
11569 dnl Test whether to integrate helppacks into the product's installer
11570 dnl ===================================================================
11571 AC_MSG_CHECKING([for helppack integration])
11572 if test "$with_helppack_integration" = "no"; then
11573     AC_MSG_RESULT([no integration])
11574 else
11575     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11576     AC_MSG_RESULT([integration])
11579 ###############################################################################
11580 # Extensions checking
11581 ###############################################################################
11582 AC_MSG_CHECKING([for extensions integration])
11583 if test "x$enable_extension_integration" != "xno"; then
11584     WITH_EXTENSION_INTEGRATION=TRUE
11585     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11586     AC_MSG_RESULT([yes, use integration])
11587 else
11588     WITH_EXTENSION_INTEGRATION=
11589     AC_MSG_RESULT([no, do not integrate])
11591 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11593 dnl Should any extra extensions be included?
11594 dnl There are standalone tests for each of these below.
11595 WITH_EXTRA_EXTENSIONS=
11596 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11598 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11599 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11600 if test "x$with_java" != "xno"; then
11601     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11602     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11605 AC_MSG_CHECKING([whether to build opens___.ttf])
11606 if test "$enable_build_opensymbol" = "yes"; then
11607     AC_MSG_RESULT([yes])
11608     AC_PATH_PROG(FONTFORGE, fontforge)
11609     if test -z "$FONTFORGE"; then
11610         AC_MSG_ERROR([fontforge not installed])
11611     fi
11612 else
11613     AC_MSG_RESULT([no])
11614     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11615     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11617 AC_SUBST(OPENSYMBOL_TTF)
11618 AC_SUBST(FONTFORGE)
11620 dnl ===================================================================
11621 dnl Test whether to include fonts
11622 dnl ===================================================================
11623 AC_MSG_CHECKING([whether to include third-party fonts])
11624 if test "$with_fonts" != "no"; then
11625     AC_MSG_RESULT([yes])
11626     WITH_FONTS=TRUE
11627     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11628     AC_DEFINE(HAVE_MORE_FONTS)
11629 else
11630     AC_MSG_RESULT([no])
11631     WITH_FONTS=
11632     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11634 AC_SUBST(WITH_FONTS)
11637 dnl ===================================================================
11638 dnl Test whether to enable online update service
11639 dnl ===================================================================
11640 AC_MSG_CHECKING([whether to enable online update])
11641 ENABLE_ONLINE_UPDATE=
11642 ENABLE_ONLINE_UPDATE_MAR=
11643 UPDATE_CONFIG=
11644 if test "$enable_online_update" = ""; then
11645     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11646         AC_MSG_RESULT([yes])
11647         ENABLE_ONLINE_UPDATE="TRUE"
11648     else
11649         AC_MSG_RESULT([no])
11650     fi
11651 else
11652     if test "$enable_online_update" = "mar"; then
11653         AC_MSG_RESULT([yes - MAR-based online update])
11654         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11655         if test "$with_update_config" = ""; then
11656             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11657         fi
11658         UPDATE_CONFIG="$with_update_config"
11659         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11660     elif test "$enable_online_update" = "yes"; then
11661         AC_MSG_RESULT([yes])
11662         ENABLE_ONLINE_UPDATE="TRUE"
11663     else
11664         AC_MSG_RESULT([no])
11665     fi
11667 AC_SUBST(ENABLE_ONLINE_UPDATE)
11668 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11669 AC_SUBST(UPDATE_CONFIG)
11671 dnl ===================================================================
11672 dnl Test whether we need bzip2
11673 dnl ===================================================================
11674 SYSTEM_BZIP2=
11675 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11676     AC_MSG_CHECKING([whether to use system bzip2])
11677     if test "$with_system_bzip2" = yes; then
11678         SYSTEM_BZIP2=TRUE
11679         AC_MSG_RESULT([yes])
11680         PKG_CHECK_MODULES(BZIP2, bzip2)
11681         FilterLibs "${BZIP2_LIBS}"
11682         BZIP2_LIBS="${filteredlibs}"
11683     else
11684         AC_MSG_RESULT([no])
11685         BUILD_TYPE="$BUILD_TYPE BZIP2"
11686     fi
11688 AC_SUBST(SYSTEM_BZIP2)
11689 AC_SUBST(BZIP2_CFLAGS)
11690 AC_SUBST(BZIP2_LIBS)
11692 dnl ===================================================================
11693 dnl Test whether to enable extension update
11694 dnl ===================================================================
11695 AC_MSG_CHECKING([whether to enable extension update])
11696 ENABLE_EXTENSION_UPDATE=
11697 if test "x$enable_extension_update" = "xno"; then
11698     AC_MSG_RESULT([no])
11699 else
11700     AC_MSG_RESULT([yes])
11701     ENABLE_EXTENSION_UPDATE="TRUE"
11702     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11703     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11705 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11708 dnl ===================================================================
11709 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11710 dnl ===================================================================
11711 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11712 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11713     AC_MSG_RESULT([no])
11714     ENABLE_SILENT_MSI=
11715 else
11716     AC_MSG_RESULT([yes])
11717     ENABLE_SILENT_MSI=TRUE
11718     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11720 AC_SUBST(ENABLE_SILENT_MSI)
11722 AC_MSG_CHECKING([whether and how to use Xinerama])
11723 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11724     if test "$x_libraries" = "default_x_libraries"; then
11725         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11726         if test "x$XINERAMALIB" = x; then
11727            XINERAMALIB="/usr/lib"
11728         fi
11729     else
11730         XINERAMALIB="$x_libraries"
11731     fi
11732     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11733         # we have both versions, let the user decide but use the dynamic one
11734         # per default
11735         USE_XINERAMA=TRUE
11736         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11737             XINERAMA_LINK=dynamic
11738         else
11739             XINERAMA_LINK=static
11740         fi
11741     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11742         # we have only the dynamic version
11743         USE_XINERAMA=TRUE
11744         XINERAMA_LINK=dynamic
11745     elif test -e "$XINERAMALIB/libXinerama.a"; then
11746         # static version
11747         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11748             USE_XINERAMA=TRUE
11749             XINERAMA_LINK=static
11750         else
11751             USE_XINERAMA=
11752             XINERAMA_LINK=none
11753         fi
11754     else
11755         # no Xinerama
11756         USE_XINERAMA=
11757         XINERAMA_LINK=none
11758     fi
11759     if test "$USE_XINERAMA" = "TRUE"; then
11760         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11761         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11762             [AC_MSG_ERROR(Xinerama header not found.)], [])
11763         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11764         if test "x$XEXTLIB" = x; then
11765            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11766         fi
11767         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11768         if test "$_os" = "FreeBSD"; then
11769             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11770         fi
11771         if test "$_os" = "Linux"; then
11772             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11773         fi
11774         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11775             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11776     else
11777         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11778     fi
11779 else
11780     USE_XINERAMA=
11781     XINERAMA_LINK=none
11782     AC_MSG_RESULT([no])
11784 AC_SUBST(USE_XINERAMA)
11785 AC_SUBST(XINERAMA_LINK)
11787 dnl ===================================================================
11788 dnl Test whether to build cairo or rely on the system version
11789 dnl ===================================================================
11791 if test "$USING_X11" = TRUE; then
11792     # Used in vcl/Library_vclplug_gen.mk
11793     test_cairo=yes
11796 if test "$test_cairo" = "yes"; then
11797     AC_MSG_CHECKING([whether to use the system cairo])
11799     : ${with_system_cairo:=$with_system_libs}
11800     if test "$with_system_cairo" = "yes"; then
11801         SYSTEM_CAIRO=TRUE
11802         AC_MSG_RESULT([yes])
11804         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11805         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11806         FilterLibs "${CAIRO_LIBS}"
11807         CAIRO_LIBS="${filteredlibs}"
11809         if test "$test_xrender" = "yes"; then
11810             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11811             AC_LANG_PUSH([C])
11812             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11813 #ifdef PictStandardA8
11814 #else
11815       return fail;
11816 #endif
11817 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11819             AC_LANG_POP([C])
11820         fi
11821     else
11822         SYSTEM_CAIRO=
11823         AC_MSG_RESULT([no])
11825         BUILD_TYPE="$BUILD_TYPE CAIRO"
11826     fi
11829 AC_SUBST(SYSTEM_CAIRO)
11830 AC_SUBST(CAIRO_CFLAGS)
11831 AC_SUBST(CAIRO_LIBS)
11833 dnl ===================================================================
11834 dnl Test whether to use avahi
11835 dnl ===================================================================
11836 if test "$_os" = "WINNT"; then
11837     # Windows uses bundled mDNSResponder
11838     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11839 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11840     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11841                       [ENABLE_AVAHI="TRUE"])
11842     AC_DEFINE(HAVE_FEATURE_AVAHI)
11843     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11844     FilterLibs "${AVAHI_LIBS}"
11845     AVAHI_LIBS="${filteredlibs}"
11848 AC_SUBST(ENABLE_AVAHI)
11849 AC_SUBST(AVAHI_CFLAGS)
11850 AC_SUBST(AVAHI_LIBS)
11852 dnl ===================================================================
11853 dnl Test whether to use liblangtag
11854 dnl ===================================================================
11855 SYSTEM_LIBLANGTAG=
11856 AC_MSG_CHECKING([whether to use system liblangtag])
11857 if test "$with_system_liblangtag" = yes; then
11858     SYSTEM_LIBLANGTAG=TRUE
11859     AC_MSG_RESULT([yes])
11860     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11861     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11862     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11863     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11864     FilterLibs "${LIBLANGTAG_LIBS}"
11865     LIBLANGTAG_LIBS="${filteredlibs}"
11866 else
11867     SYSTEM_LIBLANGTAG=
11868     AC_MSG_RESULT([no])
11869     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11870     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11871     if test "$COM" = "MSC"; then
11872         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11873     else
11874         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11875     fi
11877 AC_SUBST(SYSTEM_LIBLANGTAG)
11878 AC_SUBST(LIBLANGTAG_CFLAGS)
11879 AC_SUBST(LIBLANGTAG_LIBS)
11881 dnl ===================================================================
11882 dnl Test whether to build libpng or rely on the system version
11883 dnl ===================================================================
11885 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11887 dnl ===================================================================
11888 dnl Check for runtime JVM search path
11889 dnl ===================================================================
11890 if test "$ENABLE_JAVA" != ""; then
11891     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11892     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11893         AC_MSG_RESULT([yes])
11894         if ! test -d "$with_jvm_path"; then
11895             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11896         fi
11897         if ! test -d "$with_jvm_path"jvm; then
11898             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11899         fi
11900         JVM_ONE_PATH_CHECK="$with_jvm_path"
11901         AC_SUBST(JVM_ONE_PATH_CHECK)
11902     else
11903         AC_MSG_RESULT([no])
11904     fi
11907 dnl ===================================================================
11908 dnl Test for the presence of Ant and that it works
11909 dnl ===================================================================
11911 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11912     ANT_HOME=; export ANT_HOME
11913     WITH_ANT_HOME=; export WITH_ANT_HOME
11914     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11915         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11916             if test "$_os" = "WINNT"; then
11917                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11918             else
11919                 with_ant_home="$LODE_HOME/opt/ant"
11920             fi
11921         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11922             with_ant_home="$LODE_HOME/opt/ant"
11923         fi
11924     fi
11925     if test -z "$with_ant_home"; then
11926         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11927     else
11928         if test "$_os" = "WINNT"; then
11929             # AC_PATH_PROGS needs unix path
11930             with_ant_home=`cygpath -u "$with_ant_home"`
11931         fi
11932         AbsolutePath "$with_ant_home"
11933         with_ant_home=$absolute_path
11934         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11935         WITH_ANT_HOME=$with_ant_home
11936         ANT_HOME=$with_ant_home
11937     fi
11939     if test -z "$ANT"; then
11940         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11941     else
11942         # resolve relative or absolute symlink
11943         while test -h "$ANT"; do
11944             a_cwd=`pwd`
11945             a_basename=`basename "$ANT"`
11946             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11947             cd "`dirname "$ANT"`"
11948             cd "`dirname "$a_script"`"
11949             ANT="`pwd`"/"`basename "$a_script"`"
11950             cd "$a_cwd"
11951         done
11953         AC_MSG_CHECKING([if $ANT works])
11954         mkdir -p conftest.dir
11955         a_cwd=$(pwd)
11956         cd conftest.dir
11957         cat > conftest.java << EOF
11958         public class conftest {
11959             int testmethod(int a, int b) {
11960                     return a + b;
11961             }
11962         }
11965         cat > conftest.xml << EOF
11966         <project name="conftest" default="conftest">
11967         <target name="conftest">
11968             <javac srcdir="." includes="conftest.java">
11969             </javac>
11970         </target>
11971         </project>
11974         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11975         if test $? = 0 -a -f ./conftest.class; then
11976             AC_MSG_RESULT([Ant works])
11977             if test -z "$WITH_ANT_HOME"; then
11978                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11979                 if test -z "$ANT_HOME"; then
11980                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11981                 fi
11982             else
11983                 ANT_HOME="$WITH_ANT_HOME"
11984             fi
11985         else
11986             echo "configure: Ant test failed" >&5
11987             cat conftest.java >&5
11988             cat conftest.xml >&5
11989             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11990         fi
11991         cd "$a_cwd"
11992         rm -fr conftest.dir
11993     fi
11994     if test -z "$ANT_HOME"; then
11995         ANT_HOME="NO_ANT_HOME"
11996     else
11997         PathFormat "$ANT_HOME"
11998         ANT_HOME="$formatted_path"
11999         PathFormat "$ANT"
12000         ANT="$formatted_path"
12001     fi
12002     AC_SUBST(ANT_HOME)
12003     AC_SUBST(ANT)
12005     dnl Checking for ant.jar
12006     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12007         AC_MSG_CHECKING([Ant lib directory])
12008         if test -f $ANT_HOME/lib/ant.jar; then
12009             ANT_LIB="$ANT_HOME/lib"
12010         else
12011             if test -f $ANT_HOME/ant.jar; then
12012                 ANT_LIB="$ANT_HOME"
12013             else
12014                 if test -f /usr/share/java/ant.jar; then
12015                     ANT_LIB=/usr/share/java
12016                 else
12017                     if test -f /usr/share/ant-core/lib/ant.jar; then
12018                         ANT_LIB=/usr/share/ant-core/lib
12019                     else
12020                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12021                             ANT_LIB="$ANT_HOME/lib/ant"
12022                         else
12023                             if test -f /usr/share/lib/ant/ant.jar; then
12024                                 ANT_LIB=/usr/share/lib/ant
12025                             else
12026                                 AC_MSG_ERROR([Ant libraries not found!])
12027                             fi
12028                         fi
12029                     fi
12030                 fi
12031             fi
12032         fi
12033         PathFormat "$ANT_LIB"
12034         ANT_LIB="$formatted_path"
12035         AC_MSG_RESULT([Ant lib directory found.])
12036     fi
12037     AC_SUBST(ANT_LIB)
12039     ant_minver=1.6.0
12040     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12042     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12043     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12044     ant_version_major=`echo $ant_version | cut -d. -f1`
12045     ant_version_minor=`echo $ant_version | cut -d. -f2`
12046     echo "configure: ant_version $ant_version " >&5
12047     echo "configure: ant_version_major $ant_version_major " >&5
12048     echo "configure: ant_version_minor $ant_version_minor " >&5
12049     if test "$ant_version_major" -ge "2"; then
12050         AC_MSG_RESULT([yes, $ant_version])
12051     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12052         AC_MSG_RESULT([yes, $ant_version])
12053     else
12054         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12055     fi
12057     rm -f conftest* core core.* *.core
12060 OOO_JUNIT_JAR=
12061 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12062     AC_MSG_CHECKING([for JUnit 4])
12063     if test "$with_junit" = "yes"; then
12064         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12065             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12066         elif test -e /usr/share/java/junit4.jar; then
12067             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12068         else
12069            if test -e /usr/share/lib/java/junit.jar; then
12070               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12071            else
12072               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12073            fi
12074         fi
12075     else
12076         OOO_JUNIT_JAR=$with_junit
12077     fi
12078     if test "$_os" = "WINNT"; then
12079         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12080     fi
12081     printf 'import org.junit.Before;' > conftest.java
12082     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12083         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12084     else
12085         AC_MSG_ERROR(
12086 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12087  specify its pathname via --with-junit=..., or disable it via --without-junit])
12088     fi
12089     rm -f conftest.class conftest.java
12090     if test $OOO_JUNIT_JAR != ""; then
12091     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12092     fi
12094 AC_SUBST(OOO_JUNIT_JAR)
12096 HAMCREST_JAR=
12097 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12098     AC_MSG_CHECKING([for included Hamcrest])
12099     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12100     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12101         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12102     else
12103         AC_MSG_RESULT([Not included])
12104         AC_MSG_CHECKING([for standalone hamcrest jar.])
12105         if test "$with_hamcrest" = "yes"; then
12106             if test -e /usr/share/lib/java/hamcrest.jar; then
12107                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12108             elif test -e /usr/share/java/hamcrest/core.jar; then
12109                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12110             else
12111                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12112             fi
12113         else
12114             HAMCREST_JAR=$with_hamcrest
12115         fi
12116         if test "$_os" = "WINNT"; then
12117             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12118         fi
12119         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12120             AC_MSG_RESULT([$HAMCREST_JAR])
12121         else
12122             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),
12123                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12124         fi
12125     fi
12126     rm -f conftest.class conftest.java
12128 AC_SUBST(HAMCREST_JAR)
12131 AC_SUBST(SCPDEFS)
12134 # check for wget and curl
12136 WGET=
12137 CURL=
12139 if test "$enable_fetch_external" != "no"; then
12141 CURL=`which curl 2>/dev/null`
12143 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12144     # wget new enough?
12145     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12146     if test $? -eq 0; then
12147         WGET=$i
12148         break
12149     fi
12150 done
12152 if test -z "$WGET" -a -z "$CURL"; then
12153     AC_MSG_ERROR([neither wget nor curl found!])
12158 AC_SUBST(WGET)
12159 AC_SUBST(CURL)
12162 # check for sha256sum
12164 SHA256SUM=
12166 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12167     eval "$i -a 256 --version" > /dev/null 2>&1
12168     ret=$?
12169     if test $ret -eq 0; then
12170         SHA256SUM="$i -a 256"
12171         break
12172     fi
12173 done
12175 if test -z "$SHA256SUM"; then
12176     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12177         eval "$i --version" > /dev/null 2>&1
12178         ret=$?
12179         if test $ret -eq 0; then
12180             SHA256SUM=$i
12181             break
12182         fi
12183     done
12186 if test -z "$SHA256SUM"; then
12187     AC_MSG_ERROR([no sha256sum found!])
12190 AC_SUBST(SHA256SUM)
12192 dnl ===================================================================
12193 dnl Dealing with l10n options
12194 dnl ===================================================================
12195 AC_MSG_CHECKING([which languages to be built])
12196 # get list of all languages
12197 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12198 # the sed command does the following:
12199 #   + if a line ends with a backslash, append the next line to it
12200 #   + adds " on the beginning of the value (after =)
12201 #   + adds " at the end of the value
12202 #   + removes en-US; we want to put it on the beginning
12203 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12204 [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)]
12205 ALL_LANGS="en-US $completelangiso"
12206 # check the configured localizations
12207 WITH_LANG="$with_lang"
12209 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12210 # (Norwegian is "nb" and "nn".)
12211 if test "$WITH_LANG" = "no"; then
12212     WITH_LANG=
12215 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12216     AC_MSG_RESULT([en-US])
12217 else
12218     AC_MSG_RESULT([$WITH_LANG])
12219     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12220     if test -z "$MSGFMT"; then
12221         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12222             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12223         elif test -x "/opt/lo/bin/msgfmt"; then
12224             MSGFMT="/opt/lo/bin/msgfmt"
12225         else
12226             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12227             if test -z "$MSGFMT"; then
12228                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12229             fi
12230         fi
12231     fi
12232     if test -z "$MSGUNIQ"; then
12233         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12234             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12235         elif test -x "/opt/lo/bin/msguniq"; then
12236             MSGUNIQ="/opt/lo/bin/msguniq"
12237         else
12238             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12239             if test -z "$MSGUNIQ"; then
12240                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12241             fi
12242         fi
12243     fi
12245 AC_SUBST(MSGFMT)
12246 AC_SUBST(MSGUNIQ)
12247 # check that the list is valid
12248 for lang in $WITH_LANG; do
12249     test "$lang" = "ALL" && continue
12250     # need to check for the exact string, so add space before and after the list of all languages
12251     for vl in $ALL_LANGS; do
12252         if test "$vl" = "$lang"; then
12253            break
12254         fi
12255     done
12256     if test "$vl" != "$lang"; then
12257         # if you're reading this - you prolly quoted your languages remove the quotes ...
12258         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12259     fi
12260 done
12261 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12262     echo $WITH_LANG | grep -q en-US
12263     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12265 # list with substituted ALL
12266 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12267 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12268 test "$WITH_LANG" = "en-US" && WITH_LANG=
12269 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12270     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12271     ALL_LANGS=`echo $ALL_LANGS qtz`
12273 AC_SUBST(ALL_LANGS)
12274 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12275 AC_SUBST(WITH_LANG)
12276 AC_SUBST(WITH_LANG_LIST)
12277 AC_SUBST(GIT_NEEDED_SUBMODULES)
12279 WITH_POOR_HELP_LOCALIZATIONS=
12280 if test -d "$SRC_ROOT/translations/source"; then
12281     for l in `ls -1 $SRC_ROOT/translations/source`; do
12282         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12283             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12284         fi
12285     done
12287 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12289 if test -n "$with_locales"; then
12290     WITH_LOCALES="$with_locales"
12292     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12293     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12294     # config_host/config_locales.h.in
12295     for locale in $WITH_LOCALES; do
12296         lang=${locale%_*}
12298         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12300         case $lang in
12301         hi|mr*ne)
12302             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12303             ;;
12304         bg|ru)
12305             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12306             ;;
12307         esac
12308     done
12309 else
12310     AC_DEFINE(WITH_LOCALE_ALL)
12312 AC_SUBST(WITH_LOCALES)
12314 dnl git submodule update --reference
12315 dnl ===================================================================
12316 if test -n "${GIT_REFERENCE_SRC}"; then
12317     for repo in ${GIT_NEEDED_SUBMODULES}; do
12318         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12319             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12320         fi
12321     done
12323 AC_SUBST(GIT_REFERENCE_SRC)
12325 dnl git submodules linked dirs
12326 dnl ===================================================================
12327 if test -n "${GIT_LINK_SRC}"; then
12328     for repo in ${GIT_NEEDED_SUBMODULES}; do
12329         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12330             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12331         fi
12332     done
12334 AC_SUBST(GIT_LINK_SRC)
12336 dnl branding
12337 dnl ===================================================================
12338 AC_MSG_CHECKING([for alternative branding images directory])
12339 # initialize mapped arrays
12340 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12341 brand_files="$BRAND_INTRO_IMAGES about.svg"
12343 if test -z "$with_branding" -o "$with_branding" = "no"; then
12344     AC_MSG_RESULT([none])
12345     DEFAULT_BRAND_IMAGES="$brand_files"
12346 else
12347     if ! test -d $with_branding ; then
12348         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12349     else
12350         AC_MSG_RESULT([$with_branding])
12351         CUSTOM_BRAND_DIR="$with_branding"
12352         for lfile in $brand_files
12353         do
12354             if ! test -f $with_branding/$lfile ; then
12355                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12356                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12357             else
12358                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12359             fi
12360         done
12361         check_for_progress="yes"
12362     fi
12364 AC_SUBST([BRAND_INTRO_IMAGES])
12365 AC_SUBST([CUSTOM_BRAND_DIR])
12366 AC_SUBST([CUSTOM_BRAND_IMAGES])
12367 AC_SUBST([DEFAULT_BRAND_IMAGES])
12370 AC_MSG_CHECKING([for 'intro' progress settings])
12371 PROGRESSBARCOLOR=
12372 PROGRESSSIZE=
12373 PROGRESSPOSITION=
12374 PROGRESSFRAMECOLOR=
12375 PROGRESSTEXTCOLOR=
12376 PROGRESSTEXTBASELINE=
12378 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12379     source "$with_branding/progress.conf"
12380     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12381 else
12382     AC_MSG_RESULT([none])
12385 AC_SUBST(PROGRESSBARCOLOR)
12386 AC_SUBST(PROGRESSSIZE)
12387 AC_SUBST(PROGRESSPOSITION)
12388 AC_SUBST(PROGRESSFRAMECOLOR)
12389 AC_SUBST(PROGRESSTEXTCOLOR)
12390 AC_SUBST(PROGRESSTEXTBASELINE)
12393 AC_MSG_CHECKING([for extra build ID])
12394 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12395     EXTRA_BUILDID="$with_extra_buildid"
12397 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12398 if test -n "$EXTRA_BUILDID" ; then
12399     AC_MSG_RESULT([$EXTRA_BUILDID])
12400 else
12401     AC_MSG_RESULT([not set])
12403 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12405 OOO_VENDOR=
12406 AC_MSG_CHECKING([for vendor])
12407 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12408     OOO_VENDOR="$USERNAME"
12410     if test -z "$OOO_VENDOR"; then
12411         OOO_VENDOR="$USER"
12412     fi
12414     if test -z "$OOO_VENDOR"; then
12415         OOO_VENDOR="`id -u -n`"
12416     fi
12418     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12419 else
12420     OOO_VENDOR="$with_vendor"
12421     AC_MSG_RESULT([$OOO_VENDOR])
12423 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12424 AC_SUBST(OOO_VENDOR)
12426 if test "$_os" = "Android" ; then
12427     ANDROID_PACKAGE_NAME=
12428     AC_MSG_CHECKING([for Android package name])
12429     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12430         if test -n "$ENABLE_DEBUG"; then
12431             # Default to the package name that makes ndk-gdb happy.
12432             ANDROID_PACKAGE_NAME="org.libreoffice"
12433         else
12434             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12435         fi
12437         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12438     else
12439         ANDROID_PACKAGE_NAME="$with_android_package_name"
12440         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12441     fi
12442     AC_SUBST(ANDROID_PACKAGE_NAME)
12445 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12446 if test "$with_compat_oowrappers" = "yes"; then
12447     WITH_COMPAT_OOWRAPPERS=TRUE
12448     AC_MSG_RESULT(yes)
12449 else
12450     WITH_COMPAT_OOWRAPPERS=
12451     AC_MSG_RESULT(no)
12453 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12455 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12456 AC_MSG_CHECKING([for install dirname])
12457 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12458     INSTALLDIRNAME="$with_install_dirname"
12460 AC_MSG_RESULT([$INSTALLDIRNAME])
12461 AC_SUBST(INSTALLDIRNAME)
12463 AC_MSG_CHECKING([for prefix])
12464 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12465 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12466 PREFIXDIR="$prefix"
12467 AC_MSG_RESULT([$PREFIXDIR])
12468 AC_SUBST(PREFIXDIR)
12470 LIBDIR=[$(eval echo $(eval echo $libdir))]
12471 AC_SUBST(LIBDIR)
12473 DATADIR=[$(eval echo $(eval echo $datadir))]
12474 AC_SUBST(DATADIR)
12476 MANDIR=[$(eval echo $(eval echo $mandir))]
12477 AC_SUBST(MANDIR)
12479 DOCDIR=[$(eval echo $(eval echo $docdir))]
12480 AC_SUBST(DOCDIR)
12482 BINDIR=[$(eval echo $(eval echo $bindir))]
12483 AC_SUBST(BINDIR)
12485 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12486 AC_SUBST(INSTALLDIR)
12488 TESTINSTALLDIR="${BUILDDIR}/test-install"
12489 AC_SUBST(TESTINSTALLDIR)
12492 # ===================================================================
12493 # OAuth2 id and secrets
12494 # ===================================================================
12496 AC_MSG_CHECKING([for Google Drive client id and secret])
12497 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12498     AC_MSG_RESULT([not set])
12499     GDRIVE_CLIENT_ID="\"\""
12500     GDRIVE_CLIENT_SECRET="\"\""
12501 else
12502     AC_MSG_RESULT([set])
12503     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12504     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12506 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12507 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12509 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12510 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12511     AC_MSG_RESULT([not set])
12512     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12513     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12514 else
12515     AC_MSG_RESULT([set])
12516     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12517     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12519 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12520 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12522 AC_MSG_CHECKING([for OneDrive client id and secret])
12523 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12524     AC_MSG_RESULT([not set])
12525     ONEDRIVE_CLIENT_ID="\"\""
12526     ONEDRIVE_CLIENT_SECRET="\"\""
12527 else
12528     AC_MSG_RESULT([set])
12529     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12530     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12532 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12533 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12536 dnl ===================================================================
12537 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12538 dnl --enable-dependency-tracking configure option
12539 dnl ===================================================================
12540 AC_MSG_CHECKING([whether to enable dependency tracking])
12541 if test "$enable_dependency_tracking" = "no"; then
12542     nodep=TRUE
12543     AC_MSG_RESULT([no])
12544 else
12545     AC_MSG_RESULT([yes])
12547 AC_SUBST(nodep)
12549 dnl ===================================================================
12550 dnl Number of CPUs to use during the build
12551 dnl ===================================================================
12552 AC_MSG_CHECKING([for number of processors to use])
12553 # plain --with-parallelism is just the default
12554 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12555     if test "$with_parallelism" = "no"; then
12556         PARALLELISM=0
12557     else
12558         PARALLELISM=$with_parallelism
12559     fi
12560 else
12561     if test "$enable_icecream" = "yes"; then
12562         PARALLELISM="40"
12563     else
12564         case `uname -s` in
12566         Darwin|FreeBSD|NetBSD|OpenBSD)
12567             PARALLELISM=`sysctl -n hw.ncpu`
12568             ;;
12570         Linux)
12571             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12572         ;;
12573         # what else than above does profit here *and* has /proc?
12574         *)
12575             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12576             ;;
12577         esac
12579         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12580         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12581     fi
12584 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12585     if test -z "$with_parallelism"; then
12586             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12587             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12588             PARALLELISM="1"
12589     else
12590         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."
12591     fi
12594 if test $PARALLELISM -eq 0; then
12595     AC_MSG_RESULT([explicit make -j option needed])
12596 else
12597     AC_MSG_RESULT([$PARALLELISM])
12599 AC_SUBST(PARALLELISM)
12601 IWYU_PATH="$with_iwyu"
12602 AC_SUBST(IWYU_PATH)
12603 if test ! -z "$IWYU_PATH"; then
12604     if test ! -f "$IWYU_PATH"; then
12605         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12606     fi
12610 # Set up ILIB for MSVC build
12612 ILIB1=
12613 if test "$build_os" = "cygwin"; then
12614     ILIB="."
12615     if test -n "$JAVA_HOME"; then
12616         ILIB="$ILIB;$JAVA_HOME/lib"
12617     fi
12618     ILIB1=-link
12619     if test "$BITNESS_OVERRIDE" = 64; then
12620         ILIB="$ILIB;$COMPATH/lib/x64"
12621         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12622         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12623         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12624         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12625             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12626             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12627         fi
12628         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12629         ucrtlibpath_formatted=$formatted_path
12630         ILIB="$ILIB;$ucrtlibpath_formatted"
12631         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12632     else
12633         ILIB="$ILIB;$COMPATH/lib/x86"
12634         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12635         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12636         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12637         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12638             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12639             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12640         fi
12641         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12642         ucrtlibpath_formatted=$formatted_path
12643         ILIB="$ILIB;$ucrtlibpath_formatted"
12644         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12645     fi
12646     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12647         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12648     else
12649         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12650     fi
12652     AC_SUBST(ILIB)
12655 # ===================================================================
12656 # Creating bigger shared library to link against
12657 # ===================================================================
12658 AC_MSG_CHECKING([whether to create huge library])
12659 MERGELIBS=
12661 if test $_os = iOS -o $_os = Android; then
12662     # Never any point in mergelibs for these as we build just static
12663     # libraries anyway...
12664     enable_mergelibs=no
12667 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12668     if test $_os != Linux -a $_os != WINNT; then
12669         add_warning "--enable-mergelibs is not tested for this platform"
12670     fi
12671     MERGELIBS="TRUE"
12672     AC_MSG_RESULT([yes])
12673 else
12674     AC_MSG_RESULT([no])
12676 AC_SUBST([MERGELIBS])
12678 dnl ===================================================================
12679 dnl icerun is a wrapper that stops us spawning tens of processes
12680 dnl locally - for tools that can't be executed on the compile cluster
12681 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12682 dnl ===================================================================
12683 AC_MSG_CHECKING([whether to use icerun wrapper])
12684 ICECREAM_RUN=
12685 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12686     ICECREAM_RUN=icerun
12687     AC_MSG_RESULT([yes])
12688 else
12689     AC_MSG_RESULT([no])
12691 AC_SUBST(ICECREAM_RUN)
12693 dnl ===================================================================
12694 dnl Setup the ICECC_VERSION for the build the same way it was set for
12695 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12696 dnl ===================================================================
12697 x_ICECC_VERSION=[\#]
12698 if test -n "$ICECC_VERSION" ; then
12699     x_ICECC_VERSION=
12701 AC_SUBST(x_ICECC_VERSION)
12702 AC_SUBST(ICECC_VERSION)
12704 dnl ===================================================================
12706 AC_MSG_CHECKING([MPL subset])
12707 MPL_SUBSET=
12709 if test "$enable_mpl_subset" = "yes"; then
12710     warn_report=false
12711     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12712         warn_report=true
12713     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12714         warn_report=true
12715     fi
12716     if test "$warn_report" = "true"; then
12717         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12718     fi
12719     if test "x$enable_postgresql_sdbc" != "xno"; then
12720         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12721     fi
12722     if test "$enable_lotuswordpro" = "yes"; then
12723         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12724     fi
12725     if test "$WITH_WEBDAV" = "neon"; then
12726         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12727     fi
12728     if test -n "$ENABLE_POPPLER"; then
12729         if test "x$SYSTEM_POPPLER" = "x"; then
12730             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12731         fi
12732     fi
12733     # cf. m4/libo_check_extension.m4
12734     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12735         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12736     fi
12737     for theme in $WITH_THEMES; do
12738         case $theme in
12739         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12740             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12741         *) : ;;
12742         esac
12743     done
12745     ENABLE_OPENGL_TRANSITIONS=
12747     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12748         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12749     fi
12751     MPL_SUBSET="TRUE"
12752     AC_DEFINE(MPL_HAVE_SUBSET)
12753     AC_MSG_RESULT([only])
12754 else
12755     AC_MSG_RESULT([no restrictions])
12757 AC_SUBST(MPL_SUBSET)
12759 dnl ===================================================================
12761 AC_MSG_CHECKING([formula logger])
12762 ENABLE_FORMULA_LOGGER=
12764 if test "x$enable_formula_logger" = "xyes"; then
12765     AC_MSG_RESULT([yes])
12766     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12767     ENABLE_FORMULA_LOGGER=TRUE
12768 elif test -n "$ENABLE_DBGUTIL" ; then
12769     AC_MSG_RESULT([yes])
12770     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12771     ENABLE_FORMULA_LOGGER=TRUE
12772 else
12773     AC_MSG_RESULT([no])
12776 AC_SUBST(ENABLE_FORMULA_LOGGER)
12778 dnl ===================================================================
12779 dnl Setting up the environment.
12780 dnl ===================================================================
12781 AC_MSG_NOTICE([setting up the build environment variables...])
12783 AC_SUBST(COMPATH)
12785 if test "$build_os" = "cygwin"; then
12786     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12787         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12788         ATL_INCLUDE="$COMPATH/atlmfc/include"
12789     elif test -d "$COMPATH/atlmfc/lib"; then
12790         ATL_LIB="$COMPATH/atlmfc/lib"
12791         ATL_INCLUDE="$COMPATH/atlmfc/include"
12792     else
12793         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12794         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12795     fi
12796     if test "$BITNESS_OVERRIDE" = 64; then
12797         ATL_LIB="$ATL_LIB/x64"
12798     else
12799         ATL_LIB="$ATL_LIB/x86"
12800     fi
12801     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12802     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12804     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12805     PathFormat "/usr/bin/find.exe"
12806     FIND="$formatted_path"
12807     PathFormat "/usr/bin/sort.exe"
12808     SORT="$formatted_path"
12809     PathFormat "/usr/bin/grep.exe"
12810     WIN_GREP="$formatted_path"
12811     PathFormat "/usr/bin/ls.exe"
12812     WIN_LS="$formatted_path"
12813     PathFormat "/usr/bin/touch.exe"
12814     WIN_TOUCH="$formatted_path"
12815 else
12816     FIND=find
12817     SORT=sort
12820 AC_SUBST(ATL_INCLUDE)
12821 AC_SUBST(ATL_LIB)
12822 AC_SUBST(FIND)
12823 AC_SUBST(SORT)
12824 AC_SUBST(WIN_GREP)
12825 AC_SUBST(WIN_LS)
12826 AC_SUBST(WIN_TOUCH)
12828 AC_SUBST(BUILD_TYPE)
12830 AC_SUBST(SOLARINC)
12832 PathFormat "$PERL"
12833 PERL="$formatted_path"
12834 AC_SUBST(PERL)
12836 if test -n "$TMPDIR"; then
12837     TEMP_DIRECTORY="$TMPDIR"
12838 else
12839     TEMP_DIRECTORY="/tmp"
12841 if test "$build_os" = "cygwin"; then
12842     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12844 AC_SUBST(TEMP_DIRECTORY)
12846 # setup the PATH for the environment
12847 if test -n "$LO_PATH_FOR_BUILD"; then
12848     LO_PATH="$LO_PATH_FOR_BUILD"
12849 else
12850     LO_PATH="$PATH"
12852     case "$host_os" in
12854     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12855         if test "$ENABLE_JAVA" != ""; then
12856             pathmunge "$JAVA_HOME/bin" "after"
12857         fi
12858         ;;
12860     cygwin*)
12861         # Win32 make needs native paths
12862         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12863             LO_PATH=`cygpath -p -m "$PATH"`
12864         fi
12865         if test "$BITNESS_OVERRIDE" = 64; then
12866             # needed for msi packaging
12867             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12868         fi
12869         # .NET 4.6 and higher don't have bin directory
12870         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12871             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12872         fi
12873         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12874         pathmunge "$CSC_PATH" "before"
12875         pathmunge "$MIDL_PATH" "before"
12876         pathmunge "$AL_PATH" "before"
12877         pathmunge "$MSPDB_PATH" "before"
12878         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12879             pathmunge "$CL_PATH" "before"
12880         fi
12881         if test -n "$MSBUILD_PATH" ; then
12882             pathmunge "$MSBUILD_PATH" "before"
12883         fi
12884         if test "$BITNESS_OVERRIDE" = 64; then
12885             pathmunge "$COMPATH/bin/amd64" "before"
12886             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12887         else
12888             pathmunge "$COMPATH/bin" "before"
12889             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12890         fi
12891         if test "$ENABLE_JAVA" != ""; then
12892             if test -d "$JAVA_HOME/jre/bin/client"; then
12893                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12894             fi
12895             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12896                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12897             fi
12898             pathmunge "$JAVA_HOME/bin" "before"
12899         fi
12900         ;;
12902     solaris*)
12903         pathmunge "/usr/css/bin" "before"
12904         if test "$ENABLE_JAVA" != ""; then
12905             pathmunge "$JAVA_HOME/bin" "after"
12906         fi
12907         ;;
12908     esac
12911 AC_SUBST(LO_PATH)
12913 libo_FUZZ_SUMMARY
12915 # Generate a configuration sha256 we can use for deps
12916 if test -f config_host.mk; then
12917     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12919 if test -f config_host_lang.mk; then
12920     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12923 CFLAGS=$my_original_CFLAGS
12924 CXXFLAGS=$my_original_CXXFLAGS
12925 CPPFLAGS=$my_original_CPPFLAGS
12927 AC_CONFIG_FILES([config_host.mk
12928                  config_host_lang.mk
12929                  Makefile
12930                  bin/bffvalidator.sh
12931                  bin/odfvalidator.sh
12932                  bin/officeotron.sh
12933                  instsetoo_native/util/openoffice.lst
12934                  sysui/desktop/macosx/Info.plist])
12935 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12936 AC_CONFIG_HEADERS([config_host/config_clang.h])
12937 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12938 AC_CONFIG_HEADERS([config_host/config_eot.h])
12939 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12940 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12941 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12942 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12943 AC_CONFIG_HEADERS([config_host/config_features.h])
12944 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12945 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12946 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12947 AC_CONFIG_HEADERS([config_host/config_folders.h])
12948 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12949 AC_CONFIG_HEADERS([config_host/config_gio.h])
12950 AC_CONFIG_HEADERS([config_host/config_global.h])
12951 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12952 AC_CONFIG_HEADERS([config_host/config_java.h])
12953 AC_CONFIG_HEADERS([config_host/config_langs.h])
12954 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12955 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12956 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12957 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12958 AC_CONFIG_HEADERS([config_host/config_locales.h])
12959 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12960 AC_CONFIG_HEADERS([config_host/config_oox.h])
12961 AC_CONFIG_HEADERS([config_host/config_options.h])
12962 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12963 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
12964 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12965 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12966 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12967 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12968 AC_CONFIG_HEADERS([config_host/config_version.h])
12969 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12970 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12971 AC_CONFIG_HEADERS([config_host/config_python.h])
12972 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12973 AC_OUTPUT
12975 if test "$CROSS_COMPILING" = TRUE; then
12976     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12979 # touch the config timestamp file
12980 if test ! -f config_host.mk.stamp; then
12981     echo > config_host.mk.stamp
12982 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12983     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12984 else
12985     echo > config_host.mk.stamp
12988 # touch the config lang timestamp file
12989 if test ! -f config_host_lang.mk.stamp; then
12990     echo > config_host_lang.mk.stamp
12991 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12992     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12993 else
12994     echo > config_host_lang.mk.stamp
12998 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12999         -a "$build_os" = "cygwin"; then
13001 cat << _EOS
13002 ****************************************************************************
13003 WARNING:
13004 Your make version is known to be horribly slow, and hard to debug
13005 problems with. To get a reasonably functional make please do:
13007 to install a pre-compiled binary make for Win32
13009  mkdir -p /opt/lo/bin
13010  cd /opt/lo/bin
13011  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13012  cp make-4.2.1-msvc.exe make
13013  chmod +x make
13015 to install from source:
13016 place yourself in a working directory of you choice.
13018  git clone git://git.savannah.gnu.org/make.git
13020  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13021  set PATH=%PATH%;C:\Cygwin\bin
13022  [or Cygwin64, if that is what you have]
13023  cd path-to-make-repo-you-cloned-above
13024  build_w32.bat --without-guile
13026 should result in a WinRel/gnumake.exe.
13027 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13029 Then re-run autogen.sh
13031 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13032 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13034 _EOS
13035 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13036     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13041 cat << _EOF
13042 ****************************************************************************
13044 To build, run:
13045 $GNUMAKE
13047 To view some help, run:
13048 $GNUMAKE help
13050 _EOF
13052 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13053     cat << _EOF
13054 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13055 _EOF
13057     if test $_os = Darwin; then
13058         echo open instdir/$PRODUCTNAME.app
13059     else
13060         echo instdir/program/soffice
13061     fi
13062     cat << _EOF
13064 If you want to run the smoketest, run:
13065 $GNUMAKE check
13067 _EOF
13070 if test -f warn; then
13071     cat warn
13072     rm warn
13075 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: