Notify the client when we close the sidebar
[LibreOffice.git] / configure.ac
blobb3f5390428fee212c4cbd598cc5bf1f87100abdc
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
337 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
338     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
341 # need sed in os checks...
342 AC_PATH_PROGS(SED, sed)
343 if test -z "$SED"; then
344     AC_MSG_ERROR([install sed to run this script])
347 # Set the ENABLE_LTO variable
348 # ===================================================================
349 AC_MSG_CHECKING([whether to use link-time optimization])
350 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
351     ENABLE_LTO="TRUE"
352     AC_MSG_RESULT([yes])
353     AC_DEFINE(STATIC_LINKING)
354 else
355     ENABLE_LTO=""
356     AC_MSG_RESULT([no])
358 AC_SUBST(ENABLE_LTO)
360 AC_ARG_ENABLE(fuzz-options,
361     AS_HELP_STRING([--enable-fuzz-options],
362         [Randomly enable or disable each of those configurable options
363          that are supposed to be freely selectable without interdependencies,
364          or where bad interaction from interdependencies is automatically avoided.])
367 dnl ===================================================================
368 dnl When building for Android, --with-android-ndk,
369 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
370 dnl mandatory
371 dnl ===================================================================
373 AC_ARG_WITH(android-ndk,
374     AS_HELP_STRING([--with-android-ndk],
375         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
378 AC_ARG_WITH(android-ndk-toolchain-version,
379     AS_HELP_STRING([--with-android-ndk-toolchain-version],
380         [Specify which toolchain version to use, of those present in the
381         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
382         with_android_ndk_toolchain_version=clang5.0)
384 AC_ARG_WITH(android-sdk,
385     AS_HELP_STRING([--with-android-sdk],
386         [Specify location of the Android SDK. Mandatory when building for Android.]),
389 ANDROID_NDK_HOME=
390 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
391     with_android_ndk="$SRC_ROOT/external/android-ndk"
393 if test -n "$with_android_ndk"; then
394     ANDROID_NDK_HOME=$with_android_ndk
396     # Set up a lot of pre-canned defaults
398     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
399         if test ! -f $ANDROID_NDK_HOME/source.properties; then
400             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
401         fi
402         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
403     else
404         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
405     fi
406     if test -z "$ANDROID_NDK_VERSION";  then
407         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
408     fi
409     case $ANDROID_NDK_VERSION in
410     r9*|r10*)
411         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
412         ;;
413     11.1.*|12.1.*|13.1.*|14.1.*)
414         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
415         ;;
416     16.*)
417         ;;
418     *)
419         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
420         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
421         ;;
422     esac
424     ANDROID_API_LEVEL=14
425     android_cpu=$host_cpu
426     ANDROID_ARCH=$android_cpu
427     if test $host_cpu = arm; then
428         android_platform_prefix=$android_cpu-linux-androideabi
429         android_gnu_prefix=$android_platform_prefix
430         LLVM_TRIPLE=armv7-none-linux-androideabi
431         ANDROID_APP_ABI=armeabi-v7a
432         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
433     elif test $host_cpu = aarch64; then
434         android_platform_prefix=$android_cpu-linux-android
435         android_gnu_prefix=$android_platform_prefix
436         LLVM_TRIPLE=aarch64-none-linux-android
437         # minimum android version that supports aarch64
438         ANDROID_API_LEVEL=21
439         ANDROID_APP_ABI=arm64-v8a
440         ANDROID_ARCH=arm64
441     elif test $host_cpu = mips; then
442         android_platform_prefix=mipsel-linux-android
443         android_gnu_prefix=$android_platform_prefix
444         LLVM_TRIPLE=mipsel-none-linux-android
445         ANDROID_APP_ABI=mips
446     else
447         # host_cpu is something like "i386" or "i686" I guess, NDK uses
448         # "x86" in some contexts
449         android_cpu=x86
450         android_platform_prefix=$android_cpu
451         android_gnu_prefix=i686-linux-android
452         LLVM_TRIPLE=i686-none-linux-android
453         ANDROID_APP_ABI=x86
454         ANDROID_ARCH=$android_cpu
455         ANDROIDCFLAGS="-march=atom"
456     fi
458     case "$with_android_ndk_toolchain_version" in
459     clang5.0)
460         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
461         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
462         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
463         ;;
464     *)
465         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
466     esac
468     if test ! -d $ANDROID_BINUTILS_DIR; then
469         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
470     elif test ! -d $ANDROID_COMPILER_DIR; then
471         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
472     fi
474     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
475     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
476     # manage to link the (app-specific) single huge .so that is built for the app in
477     # android/source/ if there is debug information in a significant part of the object files.
478     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
479     # all objects have been built with debug information.)
480     case $build_os in
481     linux-gnu*)
482         ndk_build_os=linux
483         ;;
484     darwin*)
485         ndk_build_os=darwin
486         ;;
487     *)
488         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
489         ;;
490     esac
491     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
492     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
493     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
495     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
496     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
497     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
498     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
499     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
500     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
502     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
503     # android is using different sysroots for compilation and linking, but as
504     # there is no full separation in configure and elsewhere, use isystem for
505     # compilation stuff and sysroot for linking
506     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
507     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
508     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
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 -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
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     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     test_gtk=yes
592     build_gstreamer_1_0=yes
593     test_freetype=yes
594     _os=SunOS
596     dnl ===========================================================
597     dnl Check whether we're using Solaris 10 - SPARC or Intel.
598     dnl ===========================================================
599     AC_MSG_CHECKING([the Solaris operating system release])
600     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
601     if test "$_os_release" -lt "10"; then
602         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
603     else
604         AC_MSG_RESULT([ok ($_os_release)])
605     fi
607     dnl Check whether we're using a SPARC or i386 processor
608     AC_MSG_CHECKING([the processor type])
609     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
610         AC_MSG_RESULT([ok ($host_cpu)])
611     else
612         AC_MSG_ERROR([only SPARC and i386 processors are supported])
613     fi
614     ;;
616 linux-gnu*|k*bsd*-gnu*)
617     test_gtk=yes
618     build_gstreamer_1_0=yes
619     test_kf5=yes
620     test_gtk3_kde5=yes
621     test_gdb_index=yes
622     test_split_debug=yes
623     if test "$enable_fuzzers" != yes; then
624         test_freetype=yes
625         test_fontconfig=yes
626     else
627         test_freetype=no
628         test_fontconfig=no
629         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
630     fi
631     _os=Linux
632     ;;
634 gnu)
635     test_randr=no
636     test_xrender=no
637     _os=GNU
638      ;;
640 cygwin*|interix*)
642     # When building on Windows normally with MSVC under Cygwin,
643     # configure thinks that the host platform (the platform the
644     # built code will run on) is Cygwin, even if it obviously is
645     # Windows, which in Autoconf terminology is called
646     # "mingw32". (Which is misleading as MinGW is the name of the
647     # tool-chain, not an operating system.)
649     # Somewhat confusing, yes. But this configure script doesn't
650     # look at $host etc that much, it mostly uses its own $_os
651     # variable, set here in this case statement.
653     test_cups=no
654     test_dbus=no
655     test_randr=no
656     test_xrender=no
657     test_freetype=no
658     test_fontconfig=no
659     _os=WINNT
661     DLLPOST=".dll"
662     LINKFLAGSNOUNDEFS=
663     ;;
665 darwin*) # macOS or iOS
666     test_gtk=yes
667     test_randr=no
668     test_xrender=no
669     test_freetype=no
670     test_fontconfig=no
671     test_dbus=no
672     if test -n "$LODE_HOME" ; then
673         mac_sanitize_path
674         AC_MSG_NOTICE([sanitized the PATH to $PATH])
675     fi
676     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
677         build_for_ios=YES
678         _os=iOS
679         test_gtk=no
680         test_cups=no
681         enable_mpl_subset=yes
682         enable_lotuswordpro=no
683         enable_coinmp=no
684         enable_lpsolve=no
685         enable_postgresql_sdbc=no
686         enable_extension_integration=no
687         enable_report_builder=no
688         with_ppds=no
689         if test "$enable_ios_simulator" = "yes"; then
690             host=x86_64-apple-darwin
691         fi
692     else
693         _os=Darwin
694         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
695         INSTROOTCONTENTSUFFIX=/Contents
696         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
697     fi
698     # See comment above the case "$host_os"
699     LINKFLAGSSHL="-dynamiclib -single_module"
701     # -fPIC is default
702     PICSWITCH=""
704     DLLPOST=".dylib"
706     # -undefined error is the default
707     LINKFLAGSNOUNDEFS=""
710 freebsd*)
711     test_gtk=yes
712     build_gstreamer_1_0=yes
713     test_kf5=yes
714     test_gtk3_kde5=yes
715     test_freetype=yes
716     AC_MSG_CHECKING([the FreeBSD operating system release])
717     if test -n "$with_os_version"; then
718         OSVERSION="$with_os_version"
719     else
720         OSVERSION=`/sbin/sysctl -n kern.osreldate`
721     fi
722     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
723     AC_MSG_CHECKING([which thread library to use])
724     if test "$OSVERSION" -lt "500016"; then
725         PTHREAD_CFLAGS="-D_THREAD_SAFE"
726         PTHREAD_LIBS="-pthread"
727     elif test "$OSVERSION" -lt "502102"; then
728         PTHREAD_CFLAGS="-D_THREAD_SAFE"
729         PTHREAD_LIBS="-lc_r"
730     else
731         PTHREAD_CFLAGS=""
732         PTHREAD_LIBS="-pthread"
733     fi
734     AC_MSG_RESULT([$PTHREAD_LIBS])
735     _os=FreeBSD
736     ;;
738 *netbsd*)
739     test_gtk=yes
740     build_gstreamer_1_0=yes
741     test_kf5=yes
742     test_gtk3_kde5=yes
743     test_freetype=yes
744     PTHREAD_LIBS="-pthread -lpthread"
745     _os=NetBSD
746     ;;
748 aix*)
749     test_randr=no
750     test_freetype=yes
751     PTHREAD_LIBS=-pthread
752     _os=AIX
753     ;;
755 openbsd*)
756     test_gtk=yes
757     test_freetype=yes
758     PTHREAD_CFLAGS="-D_THREAD_SAFE"
759     PTHREAD_LIBS="-pthread"
760     _os=OpenBSD
761     ;;
763 dragonfly*)
764     test_gtk=yes
765     build_gstreamer_1_0=yes
766     test_kf5=yes
767     test_gtk3_kde5=yes
768     test_freetype=yes
769     PTHREAD_LIBS="-pthread"
770     _os=DragonFly
771     ;;
773 linux-android*)
774     build_gstreamer_1_0=no
775     enable_lotuswordpro=no
776     enable_mpl_subset=yes
777     enable_coinmp=yes
778     enable_lpsolve=no
779     enable_report_builder=no
780     enable_odk=no
781     enable_postgresql_sdbc=no
782     enable_python=no
783     test_cups=no
784     test_dbus=no
785     test_fontconfig=no
786     test_freetype=no
787     test_gtk=no
788     test_kf5=no
789     test_qt5=no
790     test_gtk3_kde5=no
791     test_randr=no
792     test_xrender=no
793     _os=Android
795     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
796     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
797     ;;
799 haiku*)
800     test_cups=no
801     test_dbus=no
802     test_randr=no
803     test_xrender=no
804     test_freetype=yes
805     enable_odk=no
806     enable_gstreamer_1_0=no
807     enable_vlc=no
808     enable_coinmp=no
809     enable_pdfium=no
810     enable_sdremote=no
811     enable_postgresql_sdbc=no
812     enable_firebird_sdbc=no
813     _os=Haiku
814     ;;
817     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
818     ;;
819 esac
821 if test "$_os" = "Android" ; then
822     # Verify that the NDK and SDK options are proper
823     if test -z "$with_android_ndk"; then
824         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
825     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
826         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
827     fi
829     if test -z "$ANDROID_SDK_HOME"; then
830         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
831     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
832         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
833     fi
835     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
836     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
837         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
838                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
839                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
840         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
841         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
842         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
843     fi
844     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
845         AC_MSG_WARN([android support repository not found - install with
846                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
847                      to allow the build to download the specified version of the android support libraries])
848         add_warning "android support repository not found - install with"
849         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
850         add_warning "to allow the build to download the specified version of the android support libraries"
851     fi
854 if test "$_os" = "AIX"; then
855     AC_PATH_PROG(GAWK, gawk)
856     if test -z "$GAWK"; then
857         AC_MSG_ERROR([gawk not found in \$PATH])
858     fi
861 AC_SUBST(SDKDIRNAME)
863 AC_SUBST(PTHREAD_CFLAGS)
864 AC_SUBST(PTHREAD_LIBS)
866 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
867 # By default use the ones specified by our build system,
868 # but explicit override is possible.
869 AC_MSG_CHECKING(for explicit AFLAGS)
870 if test -n "$AFLAGS"; then
871     AC_MSG_RESULT([$AFLAGS])
872     x_AFLAGS=
873 else
874     AC_MSG_RESULT(no)
875     x_AFLAGS=[\#]
877 AC_MSG_CHECKING(for explicit CFLAGS)
878 if test -n "$CFLAGS"; then
879     AC_MSG_RESULT([$CFLAGS])
880     x_CFLAGS=
881 else
882     AC_MSG_RESULT(no)
883     x_CFLAGS=[\#]
885 AC_MSG_CHECKING(for explicit CXXFLAGS)
886 if test -n "$CXXFLAGS"; then
887     AC_MSG_RESULT([$CXXFLAGS])
888     x_CXXFLAGS=
889 else
890     AC_MSG_RESULT(no)
891     x_CXXFLAGS=[\#]
893 AC_MSG_CHECKING(for explicit OBJCFLAGS)
894 if test -n "$OBJCFLAGS"; then
895     AC_MSG_RESULT([$OBJCFLAGS])
896     x_OBJCFLAGS=
897 else
898     AC_MSG_RESULT(no)
899     x_OBJCFLAGS=[\#]
901 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
902 if test -n "$OBJCXXFLAGS"; then
903     AC_MSG_RESULT([$OBJCXXFLAGS])
904     x_OBJCXXFLAGS=
905 else
906     AC_MSG_RESULT(no)
907     x_OBJCXXFLAGS=[\#]
909 AC_MSG_CHECKING(for explicit LDFLAGS)
910 if test -n "$LDFLAGS"; then
911     AC_MSG_RESULT([$LDFLAGS])
912     x_LDFLAGS=
913 else
914     AC_MSG_RESULT(no)
915     x_LDFLAGS=[\#]
917 AC_SUBST(AFLAGS)
918 AC_SUBST(CFLAGS)
919 AC_SUBST(CXXFLAGS)
920 AC_SUBST(OBJCFLAGS)
921 AC_SUBST(OBJCXXFLAGS)
922 AC_SUBST(LDFLAGS)
923 AC_SUBST(x_AFLAGS)
924 AC_SUBST(x_CFLAGS)
925 AC_SUBST(x_CXXFLAGS)
926 AC_SUBST(x_OBJCFLAGS)
927 AC_SUBST(x_OBJCXXFLAGS)
928 AC_SUBST(x_LDFLAGS)
930 dnl These are potentially set for MSVC, in the code checking for UCRT below:
931 my_original_CFLAGS=$CFLAGS
932 my_original_CXXFLAGS=$CXXFLAGS
933 my_original_CPPFLAGS=$CPPFLAGS
935 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
936 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
937 dnl AC_PROG_CC internally.
938 if test "$_os" != "WINNT"; then
939     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
940     save_CFLAGS=$CFLAGS
941     AC_PROG_CC
942     CFLAGS=$save_CFLAGS
943     if test -z "$CC_BASE"; then
944         CC_BASE=`first_arg_basename "$CC"`
945     fi
948 if test "$_os" != "WINNT"; then
949     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
950 else
951     ENDIANNESS=little
953 AC_SUBST(ENDIANNESS)
955 if test $_os != "WINNT"; then
956     save_LIBS="$LIBS"
957     AC_SEARCH_LIBS([dlsym], [dl],
958         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
959         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
960     LIBS="$save_LIBS"
962 AC_SUBST(DLOPEN_LIBS)
964 AC_ARG_ENABLE(ios-simulator,
965     AS_HELP_STRING([--enable-ios-simulator],
966         [build i386 or x86_64 for ios simulator])
969 AC_ARG_ENABLE(ios-libreofficelight-app,
970     AS_HELP_STRING([--enable-ios-libreofficelight-app],
971         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
972          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
973          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
976 ENABLE_IOS_LIBREOFFICELIGHT_APP=
977 if test "$enable_ios_libreofficelight_app" = yes; then
978     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
980 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
982 ###############################################################################
983 # Extensions switches --enable/--disable
984 ###############################################################################
985 # By default these should be enabled unless having extra dependencies.
986 # If there is extra dependency over configure options then the enable should
987 # be automagic based on whether the requiring feature is enabled or not.
988 # All this options change anything only with --enable-extension-integration.
990 # The name of this option and its help string makes it sound as if
991 # extensions are built anyway, just not integrated in the installer,
992 # if you use --disable-extension-integration. Is that really the
993 # case?
995 libo_FUZZ_ARG_ENABLE(extension-integration,
996     AS_HELP_STRING([--disable-extension-integration],
997         [Disable integration of the built extensions in the installer of the
998          product. Use this switch to disable the integration.])
1001 AC_ARG_ENABLE(avmedia,
1002     AS_HELP_STRING([--disable-avmedia],
1003         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1006 AC_ARG_ENABLE(database-connectivity,
1007     AS_HELP_STRING([--disable-database-connectivity],
1008         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1011 # This doesn't mean not building (or "integrating") extensions
1012 # (although it probably should; i.e. it should imply
1013 # --disable-extension-integration I guess), it means not supporting
1014 # any extension mechanism at all
1015 libo_FUZZ_ARG_ENABLE(extensions,
1016     AS_HELP_STRING([--disable-extensions],
1017         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1020 AC_ARG_ENABLE(scripting,
1021     AS_HELP_STRING([--disable-scripting],
1022         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1025 # This is mainly for Android and iOS, but could potentially be used in some
1026 # special case otherwise, too, so factored out as a separate setting
1028 AC_ARG_ENABLE(dynamic-loading,
1029     AS_HELP_STRING([--disable-dynamic-loading],
1030         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1033 libo_FUZZ_ARG_ENABLE(report-builder,
1034     AS_HELP_STRING([--disable-report-builder],
1035         [Disable the Report Builder.])
1038 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1039     AS_HELP_STRING([--enable-ext-wiki-publisher],
1040         [Enable the Wiki Publisher extension.])
1043 libo_FUZZ_ARG_ENABLE(lpsolve,
1044     AS_HELP_STRING([--disable-lpsolve],
1045         [Disable compilation of the lp solve solver ])
1047 libo_FUZZ_ARG_ENABLE(coinmp,
1048     AS_HELP_STRING([--disable-coinmp],
1049         [Disable compilation of the CoinMP solver ])
1052 libo_FUZZ_ARG_ENABLE(pdfimport,
1053     AS_HELP_STRING([--disable-pdfimport],
1054         [Disable building the PDF import feature.])
1057 libo_FUZZ_ARG_ENABLE(pdfium,
1058     AS_HELP_STRING([--disable-pdfium],
1059         [Disable building PDFium.])
1062 ###############################################################################
1064 dnl ---------- *** ----------
1066 libo_FUZZ_ARG_ENABLE(mergelibs,
1067     AS_HELP_STRING([--enable-mergelibs],
1068         [Merge several of the smaller libraries into one big, "merged", one.])
1071 libo_FUZZ_ARG_ENABLE(breakpad,
1072     AS_HELP_STRING([--enable-breakpad],
1073         [Enables breakpad for crash reporting.])
1076 AC_ARG_ENABLE(fetch-external,
1077     AS_HELP_STRING([--disable-fetch-external],
1078         [Disables fetching external tarballs from web sources.])
1081 AC_ARG_ENABLE(fuzzers,
1082     AS_HELP_STRING([--enable-fuzzers],
1083         [Enables building libfuzzer targets for fuzz testing.])
1086 libo_FUZZ_ARG_ENABLE(pch,
1087     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1088         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1089          Using 'system' will include only external headers, 'base' will add also headers
1090          from base modules, 'normal' will also add all headers except from the module built,
1091          'full' will use all suitable headers even from a module itself.])
1094 libo_FUZZ_ARG_ENABLE(epm,
1095     AS_HELP_STRING([--enable-epm],
1096         [LibreOffice includes self-packaging code, that requires epm, however epm is
1097          useless for large scale package building.])
1100 libo_FUZZ_ARG_ENABLE(odk,
1101     AS_HELP_STRING([--disable-odk],
1102         [LibreOffice includes an ODK, office development kit which some packagers may
1103          wish to build without.])
1106 AC_ARG_ENABLE(mpl-subset,
1107     AS_HELP_STRING([--enable-mpl-subset],
1108         [Don't compile any pieces which are not MPL or more liberally licensed])
1111 libo_FUZZ_ARG_ENABLE(evolution2,
1112     AS_HELP_STRING([--enable-evolution2],
1113         [Allows the built-in evolution 2 addressbook connectivity build to be
1114          enabled.])
1117 AC_ARG_ENABLE(avahi,
1118     AS_HELP_STRING([--enable-avahi],
1119         [Determines whether to use Avahi to advertise Impress to remote controls.])
1122 libo_FUZZ_ARG_ENABLE(werror,
1123     AS_HELP_STRING([--enable-werror],
1124         [Turn warnings to errors. (Has no effect in modules where the treating
1125          of warnings as errors is disabled explicitly.)]),
1128 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1129     AS_HELP_STRING([--enable-assert-always-abort],
1130         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1133 libo_FUZZ_ARG_ENABLE(dbgutil,
1134     AS_HELP_STRING([--enable-dbgutil],
1135         [Provide debugging support from --enable-debug and include additional debugging
1136          utilities such as object counting or more expensive checks.
1137          This is the recommended option for developers.
1138          Note that this makes the build ABI incompatible, it is not possible to mix object
1139          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1141 libo_FUZZ_ARG_ENABLE(debug,
1142     AS_HELP_STRING([--enable-debug],
1143         [Include debugging information, disable compiler optimization and inlining plus
1144          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1146 libo_FUZZ_ARG_ENABLE(split-debug,
1147     AS_HELP_STRING([--disable-split-debug],
1148         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1149          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1151 libo_FUZZ_ARG_ENABLE(gdb-index,
1152     AS_HELP_STRING([--disable-gdb-index],
1153         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1154          The feature requires the gold or lld linker.]))
1156 libo_FUZZ_ARG_ENABLE(sal-log,
1157     AS_HELP_STRING([--enable-sal-log],
1158         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1160 libo_FUZZ_ARG_ENABLE(symbols,
1161     AS_HELP_STRING([--enable-symbols],
1162         [Generate debug information.
1163          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1164          otherwise. It is possible to explicitly specify gbuild build targets
1165          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1166          everything in the directory; there is no ordering, more specific overrides
1167          more general, and disabling takes precedence).
1168          Example: --enable-symbols="all -sw/ -Library_sc".]))
1170 libo_FUZZ_ARG_ENABLE(optimized,
1171     AS_HELP_STRING([--disable-optimized],
1172         [Whether to compile with optimization flags.
1173          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1174          otherwise.]))
1176 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1177     AS_HELP_STRING([--disable-runtime-optimizations],
1178         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1179          JVM JIT) that are known to interact badly with certain dynamic analysis
1180          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1181          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1182          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1184 AC_ARG_WITH(valgrind,
1185     AS_HELP_STRING([--with-valgrind],
1186         [Make availability of Valgrind headers a hard requirement.]))
1188 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1189     AS_HELP_STRING([--enable-compiler-plugins],
1190         [Enable compiler plugins that will perform additional checks during
1191          building. Enabled automatically by --enable-dbgutil.
1192          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1193 COMPILER_PLUGINS_DEBUG=
1194 if test "$enable_compiler_plugins" = debug; then
1195     enable_compiler_plugins=yes
1196     COMPILER_PLUGINS_DEBUG=TRUE
1199 libo_FUZZ_ARG_ENABLE(ooenv,
1200     AS_HELP_STRING([--disable-ooenv],
1201         [Disable ooenv for the instdir installation.]))
1203 libo_FUZZ_ARG_ENABLE(libnumbertext,
1204     AS_HELP_STRING([--disable-libnumbertext],
1205         [Disable use of numbertext external library.]))
1207 AC_ARG_ENABLE(lto,
1208     AS_HELP_STRING([--enable-lto],
1209         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1210          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1211          linker. For MSVC, this option is broken at the moment. This is experimental work
1212          in progress that shouldn't be used unless you are working on it.)]))
1214 AC_ARG_ENABLE(python,
1215     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1216         [Enables or disables Python support at run-time.
1217          Also specifies what Python to use. 'auto' is the default.
1218          'fully-internal' even forces the internal version for uses of Python
1219          during the build.]))
1221 libo_FUZZ_ARG_ENABLE(gtk,
1222     AS_HELP_STRING([--disable-gtk],
1223         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1224 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1226 libo_FUZZ_ARG_ENABLE(gtk3,
1227     AS_HELP_STRING([--disable-gtk3],
1228         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1229 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1231 AC_ARG_ENABLE(split-app-modules,
1232     AS_HELP_STRING([--enable-split-app-modules],
1233         [Split file lists for app modules, e.g. base, calc.
1234          Has effect only with make distro-pack-install]),
1237 AC_ARG_ENABLE(split-opt-features,
1238     AS_HELP_STRING([--enable-split-opt-features],
1239         [Split file lists for some optional features, e.g. pyuno, testtool.
1240          Has effect only with make distro-pack-install]),
1243 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1244     AS_HELP_STRING([--disable-cairo-canvas],
1245         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1248 libo_FUZZ_ARG_ENABLE(dbus,
1249     AS_HELP_STRING([--disable-dbus],
1250         [Determines whether to enable features that depend on dbus.
1251          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1252 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1254 libo_FUZZ_ARG_ENABLE(sdremote,
1255     AS_HELP_STRING([--disable-sdremote],
1256         [Determines whether to enable Impress remote control (i.e. the server component).]),
1257 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1259 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1260     AS_HELP_STRING([--disable-sdremote-bluetooth],
1261         [Determines whether to build sdremote with bluetooth support.
1262          Requires dbus on Linux.]))
1264 libo_FUZZ_ARG_ENABLE(gio,
1265     AS_HELP_STRING([--disable-gio],
1266         [Determines whether to use the GIO support.]),
1267 ,test "${enable_gio+set}" = set || enable_gio=yes)
1269 AC_ARG_ENABLE(qt5,
1270     AS_HELP_STRING([--enable-qt5],
1271         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1272          available.]),
1275 AC_ARG_ENABLE(kf5,
1276     AS_HELP_STRING([--enable-kf5],
1277         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1278          KF5 are available.]),
1281 AC_ARG_ENABLE(kde5,
1282     AS_HELP_STRING([--enable-kde5],
1283         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1286 AC_ARG_ENABLE(gtk3_kde5,
1287     AS_HELP_STRING([--enable-gtk3-kde5],
1288         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1289          platforms where Gtk3, Qt5 and Plasma is available.]),
1292 AC_ARG_ENABLE(gui,
1293     AS_HELP_STRING([--disable-gui],
1294         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1295          command-line option. Not related to LibreOffice Online functionality. Don't use
1296          unless you are certain you need to. Nobody will help you if you insist on trying
1297          this and run into problems.]),
1298 ,enable_gui=yes)
1300 libo_FUZZ_ARG_ENABLE(randr,
1301     AS_HELP_STRING([--disable-randr],
1302         [Disable RandR support in the vcl project.]),
1303 ,test "${enable_randr+set}" = set || enable_randr=yes)
1305 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1306     AS_HELP_STRING([--disable-gstreamer-1-0],
1307         [Disable building with the gstreamer 1.0 avmedia backend.]),
1308 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1310 libo_FUZZ_ARG_ENABLE(vlc,
1311     AS_HELP_STRING([--enable-vlc],
1312         [Enable building with the (experimental) VLC avmedia backend.]),
1313 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1315 libo_FUZZ_ARG_ENABLE(neon,
1316     AS_HELP_STRING([--disable-neon],
1317         [Disable neon and the compilation of webdav binding.]),
1320 libo_FUZZ_ARG_ENABLE([eot],
1321     [AS_HELP_STRING([--enable-eot],
1322         [Enable support for Embedded OpenType fonts.])],
1323 ,test "${enable_eot+set}" = set || enable_eot=no)
1325 libo_FUZZ_ARG_ENABLE(cve-tests,
1326     AS_HELP_STRING([--disable-cve-tests],
1327         [Prevent CVE tests to be executed]),
1330 libo_FUZZ_ARG_ENABLE(chart-tests,
1331     AS_HELP_STRING([--enable-chart-tests],
1332         [Executes chart XShape tests. In a perfect world these tests would be
1333          stable and everyone could run them, in reality it is best to run them
1334          only on a few machines that are known to work and maintained by people
1335          who can judge if a test failure is a regression or not.]),
1338 AC_ARG_ENABLE(build-unowinreg,
1339     AS_HELP_STRING([--enable-build-unowinreg],
1340         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1341          compiler is needed on Linux.]),
1344 AC_ARG_ENABLE(build-opensymbol,
1345     AS_HELP_STRING([--enable-build-opensymbol],
1346         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1347          fontforge installed.]),
1350 AC_ARG_ENABLE(dependency-tracking,
1351     AS_HELP_STRING([--enable-dependency-tracking],
1352         [Do not reject slow dependency extractors.])[
1353   --disable-dependency-tracking
1354                           Disables generation of dependency information.
1355                           Speed up one-time builds.],
1358 AC_ARG_ENABLE(icecream,
1359     AS_HELP_STRING([--enable-icecream],
1360         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1361          It defaults to /opt/icecream for the location of the icecream gcc/g++
1362          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1365 AC_ARG_ENABLE(ld,
1366     AS_HELP_STRING([--enable-ld=<linker>],
1367         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1368          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1371 libo_FUZZ_ARG_ENABLE(cups,
1372     AS_HELP_STRING([--disable-cups],
1373         [Do not build cups support.])
1376 AC_ARG_ENABLE(ccache,
1377     AS_HELP_STRING([--disable-ccache],
1378         [Do not try to use ccache automatically.
1379          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1380          CC/CXX are not yet set, and --enable-icecream is not given, we
1381          attempt to use ccache. --disable-ccache disables ccache completely.
1382          Additionally ccache's depend mode is enabled if possible,
1383          use --enable-ccache=nodepend to enable ccache without depend mode.
1387 AC_ARG_ENABLE(64-bit,
1388     AS_HELP_STRING([--enable-64-bit],
1389         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1390          At the moment meaningful only for Windows.]), ,)
1392 libo_FUZZ_ARG_ENABLE(online-update,
1393     AS_HELP_STRING([--enable-online-update],
1394         [Enable the online update service that will check for new versions of
1395          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1396          If the value is "mar", the experimental Mozilla-like update will be
1397          enabled instead of the traditional update mechanism.]),
1400 AC_ARG_WITH(update-config,
1401     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1402                    [Path to the update config ini file]))
1404 libo_FUZZ_ARG_ENABLE(extension-update,
1405     AS_HELP_STRING([--disable-extension-update],
1406         [Disable possibility to update installed extensions.]),
1409 libo_FUZZ_ARG_ENABLE(release-build,
1410     AS_HELP_STRING([--enable-release-build],
1411         [Enable release build. Note that the "release build" choice is orthogonal to
1412          whether symbols are present, debug info is generated, or optimization
1413          is done.
1414          See http://wiki.documentfoundation.org/Development/DevBuild]),
1417 AC_ARG_ENABLE(windows-build-signing,
1418     AS_HELP_STRING([--enable-windows-build-signing],
1419         [Enable signing of windows binaries (*.exe, *.dll)]),
1422 AC_ARG_ENABLE(silent-msi,
1423     AS_HELP_STRING([--enable-silent-msi],
1424         [Enable MSI with LIMITUI=1 (silent install).]),
1427 AC_ARG_ENABLE(macosx-code-signing,
1428     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1429         [Sign executables, dylibs, frameworks and the app bundle. If you
1430          don't provide an identity the first suitable certificate
1431          in your keychain is used.]),
1434 AC_ARG_ENABLE(macosx-package-signing,
1435     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1436         [Create a .pkg suitable for uploading to the Mac App Store and sign
1437          it. If you don't provide an identity the first suitable certificate
1438          in your keychain is used.]),
1441 AC_ARG_ENABLE(macosx-sandbox,
1442     AS_HELP_STRING([--enable-macosx-sandbox],
1443         [Make the app bundle run in a sandbox. Requires code signing.
1444          Is required by apps distributed in the Mac App Store, and implies
1445          adherence to App Store rules.]),
1448 AC_ARG_WITH(macosx-bundle-identifier,
1449     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1450         [Define the macOS bundle identifier. Default is the somewhat weird
1451          org.libreoffice.script ("script", huh?).]),
1452 ,with_macosx_bundle_identifier=org.libreoffice.script)
1454 AC_ARG_WITH(product-name,
1455     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1456         [Define the product name. Default is AC_PACKAGE_NAME.]),
1457 ,with_product_name=$PRODUCTNAME)
1459 AC_ARG_WITH(package-version,
1460     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1461         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1464 libo_FUZZ_ARG_ENABLE(readonly-installset,
1465     AS_HELP_STRING([--enable-readonly-installset],
1466         [Prevents any attempts by LibreOffice to write into its installation. That means
1467          at least that no "system-wide" extensions can be added. Partly experimental work in
1468          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1471 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1472     AS_HELP_STRING([--disable-postgresql-sdbc],
1473         [Disable the build of the PostgreSQL-SDBC driver.])
1476 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1477     AS_HELP_STRING([--disable-lotuswordpro],
1478         [Disable the build of the Lotus Word Pro filter.]),
1479 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1481 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1482     AS_HELP_STRING([--disable-firebird-sdbc],
1483         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1484 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1486 AC_ARG_ENABLE(bogus-pkg-config,
1487     AS_HELP_STRING([--enable-bogus-pkg-config],
1488         [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.]),
1491 AC_ARG_ENABLE(openssl,
1492     AS_HELP_STRING([--disable-openssl],
1493         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1494          components will either use GNUTLS or NSS. Work in progress,
1495          use only if you are hacking on it.]),
1496 ,enable_openssl=yes)
1498 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1499     AS_HELP_STRING([--enable-cipher-openssl-backend],
1500         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1501          Requires --enable-openssl.]))
1503 AC_ARG_ENABLE(library-bin-tar,
1504     AS_HELP_STRING([--enable-library-bin-tar],
1505         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1506         Some libraries can save their build result in a tarball
1507         stored in TARFILE_LOCATION. That binary tarball is
1508         uniquely identified by the source tarball,
1509         the content of the config_host.mk file and the content
1510         of the top-level directory in core for that library
1511         If this option is enabled, then if such a tarfile exist, it will be untarred
1512         instead of the source tarfile, and the build step will be skipped for that
1513         library.
1514         If a proper tarfile does not exist, then the normal source-based
1515         build is done for that library and a proper binary tarfile is created
1516         for the next time.]),
1519 AC_ARG_ENABLE(dconf,
1520     AS_HELP_STRING([--disable-dconf],
1521         [Disable the dconf configuration backend (enabled by default where
1522          available).]))
1524 libo_FUZZ_ARG_ENABLE(formula-logger,
1525     AS_HELP_STRING(
1526         [--enable-formula-logger],
1527         [Enable formula logger for logging formula calculation flow in Calc.]
1528     )
1531 AC_ARG_ENABLE(ldap,
1532     AS_HELP_STRING([--disable-ldap],
1533         [Disable LDAP support.]),
1534 ,enable_ldap=yes)
1536 dnl ===================================================================
1537 dnl Optional Packages (--with/without-)
1538 dnl ===================================================================
1540 AC_ARG_WITH(gcc-home,
1541     AS_HELP_STRING([--with-gcc-home],
1542         [Specify the location of gcc/g++ manually. This can be used in conjunction
1543          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1544          non-default path.]),
1547 AC_ARG_WITH(gnu-patch,
1548     AS_HELP_STRING([--with-gnu-patch],
1549         [Specify location of GNU patch on Solaris or FreeBSD.]),
1552 AC_ARG_WITH(build-platform-configure-options,
1553     AS_HELP_STRING([--with-build-platform-configure-options],
1554         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1557 AC_ARG_WITH(gnu-cp,
1558     AS_HELP_STRING([--with-gnu-cp],
1559         [Specify location of GNU cp on Solaris or FreeBSD.]),
1562 AC_ARG_WITH(external-tar,
1563     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1564         [Specify an absolute path of where to find (and store) tarfiles.]),
1565     TARFILE_LOCATION=$withval ,
1568 AC_ARG_WITH(referenced-git,
1569     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1570         [Specify another checkout directory to reference. This makes use of
1571                  git submodule update --reference, and saves a lot of diskspace
1572                  when having multiple trees side-by-side.]),
1573     GIT_REFERENCE_SRC=$withval ,
1576 AC_ARG_WITH(linked-git,
1577     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1578         [Specify a directory where the repositories of submodules are located.
1579          This uses a method similar to git-new-workdir to get submodules.]),
1580     GIT_LINK_SRC=$withval ,
1583 AC_ARG_WITH(galleries,
1584     AS_HELP_STRING([--with-galleries],
1585         [Specify how galleries should be built. It is possible either to
1586          build these internally from source ("build"),
1587          or to disable them ("no")]),
1590 AC_ARG_WITH(theme,
1591     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1592         [Choose which themes to include. By default those themes with an '*' are included.
1593          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1594          *elementary_svg, *karasa_jaga, *sifr, *sif_svg, *sifr_dark, *tango.]),
1597 libo_FUZZ_ARG_WITH(helppack-integration,
1598     AS_HELP_STRING([--without-helppack-integration],
1599         [It will not integrate the helppacks to the installer
1600          of the product. Please use this switch to use the online help
1601          or separate help packages.]),
1604 libo_FUZZ_ARG_WITH(fonts,
1605     AS_HELP_STRING([--without-fonts],
1606         [LibreOffice includes some third-party fonts to provide a reliable basis for
1607          help content, templates, samples, etc. When these fonts are already
1608          known to be available on the system then you should use this option.]),
1611 AC_ARG_WITH(epm,
1612     AS_HELP_STRING([--with-epm],
1613         [Decides which epm to use. Default is to use the one from the system if
1614          one is built. When either this is not there or you say =internal epm
1615          will be built.]),
1618 AC_ARG_WITH(package-format,
1619     AS_HELP_STRING([--with-package-format],
1620         [Specify package format(s) for LibreOffice installation sets. The
1621          implicit --without-package-format leads to no installation sets being
1622          generated. Possible values: aix, archive, bsd, deb, dmg,
1623          installed, msi, pkg, and rpm.
1624          Example: --with-package-format='deb rpm']),
1627 AC_ARG_WITH(tls,
1628     AS_HELP_STRING([--with-tls],
1629         [Decides which TLS/SSL and cryptographic implementations to use for
1630          LibreOffice's code. Notice that this doesn't apply for depending
1631          libraries like "neon", for example. Default is to use OpenSSL
1632          although NSS is also possible. Notice that selecting NSS restricts
1633          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1634          restrict by now the usage of NSS in LO's code. Possible values:
1635          openssl, nss. Example: --with-tls="nss"]),
1638 AC_ARG_WITH(system-libs,
1639     AS_HELP_STRING([--with-system-libs],
1640         [Use libraries already on system -- enables all --with-system-* flags.]),
1643 AC_ARG_WITH(system-bzip2,
1644     AS_HELP_STRING([--with-system-bzip2],
1645         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1646     [with_system_bzip2="$with_system_libs"])
1648 AC_ARG_WITH(system-headers,
1649     AS_HELP_STRING([--with-system-headers],
1650         [Use headers already on system -- enables all --with-system-* flags for
1651          external packages whose headers are the only entities used i.e.
1652          boost/odbc/sane-header(s).]),,
1653     [with_system_headers="$with_system_libs"])
1655 AC_ARG_WITH(system-jars,
1656     AS_HELP_STRING([--without-system-jars],
1657         [When building with --with-system-libs, also the needed jars are expected
1658          on the system. Use this to disable that]),,
1659     [with_system_jars="$with_system_libs"])
1661 AC_ARG_WITH(system-cairo,
1662     AS_HELP_STRING([--with-system-cairo],
1663         [Use cairo libraries already on system.  Happens automatically for
1664          (implicit) --enable-gtk and for --enable-gtk3.]))
1666 AC_ARG_WITH(system-epoxy,
1667     AS_HELP_STRING([--with-system-epoxy],
1668         [Use epoxy libraries already on system.  Happens automatically for
1669          --enable-gtk3.]),,
1670        [with_system_epoxy="$with_system_libs"])
1672 AC_ARG_WITH(myspell-dicts,
1673     AS_HELP_STRING([--with-myspell-dicts],
1674         [Adds myspell dictionaries to the LibreOffice installation set]),
1677 AC_ARG_WITH(system-dicts,
1678     AS_HELP_STRING([--without-system-dicts],
1679         [Do not use dictionaries from system paths.]),
1682 AC_ARG_WITH(external-dict-dir,
1683     AS_HELP_STRING([--with-external-dict-dir],
1684         [Specify external dictionary dir.]),
1687 AC_ARG_WITH(external-hyph-dir,
1688     AS_HELP_STRING([--with-external-hyph-dir],
1689         [Specify external hyphenation pattern dir.]),
1692 AC_ARG_WITH(external-thes-dir,
1693     AS_HELP_STRING([--with-external-thes-dir],
1694         [Specify external thesaurus dir.]),
1697 AC_ARG_WITH(system-zlib,
1698     AS_HELP_STRING([--with-system-zlib],
1699         [Use zlib already on system.]),,
1700     [with_system_zlib=auto])
1702 AC_ARG_WITH(system-jpeg,
1703     AS_HELP_STRING([--with-system-jpeg],
1704         [Use jpeg already on system.]),,
1705     [with_system_jpeg="$with_system_libs"])
1707 AC_ARG_WITH(system-clucene,
1708     AS_HELP_STRING([--with-system-clucene],
1709         [Use clucene already on system.]),,
1710     [with_system_clucene="$with_system_libs"])
1712 AC_ARG_WITH(system-expat,
1713     AS_HELP_STRING([--with-system-expat],
1714         [Use expat already on system.]),,
1715     [with_system_expat="$with_system_libs"])
1717 AC_ARG_WITH(system-libxml,
1718     AS_HELP_STRING([--with-system-libxml],
1719         [Use libxml/libxslt already on system.]),,
1720     [with_system_libxml=auto])
1722 AC_ARG_WITH(system-icu,
1723     AS_HELP_STRING([--with-system-icu],
1724         [Use icu already on system.]),,
1725     [with_system_icu="$with_system_libs"])
1727 AC_ARG_WITH(system-ucpp,
1728     AS_HELP_STRING([--with-system-ucpp],
1729         [Use ucpp already on system.]),,
1730     [])
1732 AC_ARG_WITH(system-openldap,
1733     AS_HELP_STRING([--with-system-openldap],
1734         [Use the OpenLDAP LDAP SDK already on system.]),,
1735     [with_system_openldap="$with_system_libs"])
1737 libo_FUZZ_ARG_ENABLE(poppler,
1738     AS_HELP_STRING([--disable-poppler],
1739         [Disable building Poppler.])
1742 AC_ARG_WITH(system-poppler,
1743     AS_HELP_STRING([--with-system-poppler],
1744         [Use system poppler (only needed for PDF import).]),,
1745     [with_system_poppler="$with_system_libs"])
1747 AC_ARG_WITH(system-gpgmepp,
1748     AS_HELP_STRING([--with-system-gpgmepp],
1749         [Use gpgmepp already on system]),,
1750     [with_system_gpgmepp="$with_system_libs"])
1752 AC_ARG_WITH(system-apache-commons,
1753     AS_HELP_STRING([--with-system-apache-commons],
1754         [Use Apache commons libraries already on system.]),,
1755     [with_system_apache_commons="$with_system_jars"])
1757 AC_ARG_WITH(system-mariadb,
1758     AS_HELP_STRING([--with-system-mariadb],
1759         [Use MariaDB/MySQL libraries already on system.]),,
1760     [with_system_mariadb="$with_system_libs"])
1762 AC_ARG_ENABLE(bundle-mariadb,
1763     AS_HELP_STRING([--enable-bundle-mariadb],
1764         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1767 AC_ARG_WITH(system-postgresql,
1768     AS_HELP_STRING([--with-system-postgresql],
1769         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1770          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1771     [with_system_postgresql="$with_system_libs"])
1773 AC_ARG_WITH(libpq-path,
1774     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1775         [Use this PostgreSQL C interface (libpq) installation for building
1776          the PostgreSQL-SDBC extension.]),
1779 AC_ARG_WITH(system-firebird,
1780     AS_HELP_STRING([--with-system-firebird],
1781         [Use Firebird libraries already on system, for building the Firebird-SDBC
1782          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1783     [with_system_firebird="$with_system_libs"])
1785 AC_ARG_WITH(system-libtommath,
1786             AS_HELP_STRING([--with-system-libtommath],
1787                            [Use libtommath already on system]),,
1788             [with_system_libtommath="$with_system_libs"])
1790 AC_ARG_WITH(system-hsqldb,
1791     AS_HELP_STRING([--with-system-hsqldb],
1792         [Use hsqldb already on system.]))
1794 AC_ARG_WITH(hsqldb-jar,
1795     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     HSQLDB_JAR=$withval)
1799 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1800     AS_HELP_STRING([--disable-scripting-beanshell],
1801         [Disable support for scripts in BeanShell.]),
1805 AC_ARG_WITH(system-beanshell,
1806     AS_HELP_STRING([--with-system-beanshell],
1807         [Use beanshell already on system.]),,
1808     [with_system_beanshell="$with_system_jars"])
1810 AC_ARG_WITH(beanshell-jar,
1811     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1812         [Specify path to jarfile manually.]),
1813     BSH_JAR=$withval)
1815 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1816     AS_HELP_STRING([--disable-scripting-javascript],
1817         [Disable support for scripts in JavaScript.]),
1821 AC_ARG_WITH(system-rhino,
1822     AS_HELP_STRING([--with-system-rhino],
1823         [Use rhino already on system.]),,)
1824 #    [with_system_rhino="$with_system_jars"])
1825 # Above is not used as we have different debug interface
1826 # patched into internal rhino. This code needs to be fixed
1827 # before we can enable it by default.
1829 AC_ARG_WITH(rhino-jar,
1830     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     RHINO_JAR=$withval)
1834 AC_ARG_WITH(commons-logging-jar,
1835     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     COMMONS_LOGGING_JAR=$withval)
1839 AC_ARG_WITH(system-jfreereport,
1840     AS_HELP_STRING([--with-system-jfreereport],
1841         [Use JFreeReport already on system.]),,
1842     [with_system_jfreereport="$with_system_jars"])
1844 AC_ARG_WITH(sac-jar,
1845     AS_HELP_STRING([--with-sac-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     SAC_JAR=$withval)
1849 AC_ARG_WITH(libxml-jar,
1850     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1851         [Specify path to jarfile manually.]),
1852     LIBXML_JAR=$withval)
1854 AC_ARG_WITH(flute-jar,
1855     AS_HELP_STRING([--with-flute-jar=JARFILE],
1856         [Specify path to jarfile manually.]),
1857     FLUTE_JAR=$withval)
1859 AC_ARG_WITH(jfreereport-jar,
1860     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1861         [Specify path to jarfile manually.]),
1862     JFREEREPORT_JAR=$withval)
1864 AC_ARG_WITH(liblayout-jar,
1865     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     LIBLAYOUT_JAR=$withval)
1869 AC_ARG_WITH(libloader-jar,
1870     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1871         [Specify path to jarfile manually.]),
1872     LIBLOADER_JAR=$withval)
1874 AC_ARG_WITH(libformula-jar,
1875     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1876         [Specify path to jarfile manually.]),
1877     LIBFORMULA_JAR=$withval)
1879 AC_ARG_WITH(librepository-jar,
1880     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1881         [Specify path to jarfile manually.]),
1882     LIBREPOSITORY_JAR=$withval)
1884 AC_ARG_WITH(libfonts-jar,
1885     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1886         [Specify path to jarfile manually.]),
1887     LIBFONTS_JAR=$withval)
1889 AC_ARG_WITH(libserializer-jar,
1890     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1891         [Specify path to jarfile manually.]),
1892     LIBSERIALIZER_JAR=$withval)
1894 AC_ARG_WITH(libbase-jar,
1895     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1896         [Specify path to jarfile manually.]),
1897     LIBBASE_JAR=$withval)
1899 AC_ARG_WITH(system-odbc,
1900     AS_HELP_STRING([--with-system-odbc],
1901         [Use the odbc headers already on system.]),,
1902     [with_system_odbc="auto"])
1904 AC_ARG_WITH(system-sane,
1905     AS_HELP_STRING([--with-system-sane],
1906         [Use sane.h already on system.]),,
1907     [with_system_sane="$with_system_headers"])
1909 AC_ARG_WITH(system-bluez,
1910     AS_HELP_STRING([--with-system-bluez],
1911         [Use bluetooth.h already on system.]),,
1912     [with_system_bluez="$with_system_headers"])
1914 AC_ARG_WITH(system-curl,
1915     AS_HELP_STRING([--with-system-curl],
1916         [Use curl already on system.]),,
1917     [with_system_curl=auto])
1919 AC_ARG_WITH(system-boost,
1920     AS_HELP_STRING([--with-system-boost],
1921         [Use boost already on system.]),,
1922     [with_system_boost="$with_system_headers"])
1924 AC_ARG_WITH(system-glm,
1925     AS_HELP_STRING([--with-system-glm],
1926         [Use glm already on system.]),,
1927     [with_system_glm="$with_system_headers"])
1929 AC_ARG_WITH(system-hunspell,
1930     AS_HELP_STRING([--with-system-hunspell],
1931         [Use libhunspell already on system.]),,
1932     [with_system_hunspell="$with_system_libs"])
1934 AC_ARG_WITH(system-qrcodegen,
1935     AS_HELP_STRING([--with-system-qrcodegen],
1936         [Use libqrcodegen already on system.]),,
1937     [with_system_qrcodegen="$with_system_libs"])
1939 AC_ARG_WITH(system-mythes,
1940     AS_HELP_STRING([--with-system-mythes],
1941         [Use mythes already on system.]),,
1942     [with_system_mythes="$with_system_libs"])
1944 AC_ARG_WITH(system-altlinuxhyph,
1945     AS_HELP_STRING([--with-system-altlinuxhyph],
1946         [Use ALTLinuxhyph already on system.]),,
1947     [with_system_altlinuxhyph="$with_system_libs"])
1949 AC_ARG_WITH(system-lpsolve,
1950     AS_HELP_STRING([--with-system-lpsolve],
1951         [Use lpsolve already on system.]),,
1952     [with_system_lpsolve="$with_system_libs"])
1954 AC_ARG_WITH(system-coinmp,
1955     AS_HELP_STRING([--with-system-coinmp],
1956         [Use CoinMP already on system.]),,
1957     [with_system_coinmp="$with_system_libs"])
1959 AC_ARG_WITH(system-liblangtag,
1960     AS_HELP_STRING([--with-system-liblangtag],
1961         [Use liblangtag library already on system.]),,
1962     [with_system_liblangtag="$with_system_libs"])
1964 AC_ARG_WITH(webdav,
1965     AS_HELP_STRING([--with-webdav],
1966         [Specify which library to use for webdav implementation.
1967          Possible values: "neon", "serf", "no". The default value is "neon".
1968          Example: --with-webdav="serf"]),
1969     WITH_WEBDAV=$withval,
1970     WITH_WEBDAV="neon")
1972 AC_ARG_WITH(linker-hash-style,
1973     AS_HELP_STRING([--with-linker-hash-style],
1974         [Use linker with --hash-style=<style> when linking shared objects.
1975          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1976          if supported on the build system, and "sysv" otherwise.]))
1978 AC_ARG_WITH(jdk-home,
1979     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1980         [If you have installed JDK 8 or later on your system please supply the
1981          path here. Note that this is not the location of the java command but the
1982          location of the entire distribution.]),
1985 AC_ARG_WITH(help,
1986     AS_HELP_STRING([--with-help],
1987         [Enable the build of help. There is a special parameter "common" that
1988          can be used to bundle only the common part, .e.g help-specific icons.
1989          This is useful when you build the helpcontent separately.])
1990     [
1991                           Usage:     --with-help    build the old local help
1992                                  --without-help     no local help (default)
1993                                  --with-help=html   build the new HTML local help
1994                                  --with-help=online build the new HTML online help
1995     ],
1998 libo_FUZZ_ARG_WITH(java,
1999     AS_HELP_STRING([--with-java=<java command>],
2000         [Specify the name of the Java interpreter command. Typically "java"
2001          which is the default.
2003          To build without support for Java components, applets, accessibility
2004          or the XML filters written in Java, use --without-java or --with-java=no.]),
2005     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2006     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2009 AC_ARG_WITH(jvm-path,
2010     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2011         [Use a specific JVM search path at runtime.
2012          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2015 AC_ARG_WITH(ant-home,
2016     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2017         [If you have installed Apache Ant on your system, please supply the path here.
2018          Note that this is not the location of the Ant binary but the location
2019          of the entire distribution.]),
2022 AC_ARG_WITH(symbol-config,
2023     AS_HELP_STRING([--with-symbol-config],
2024         [Configuration for the crashreport symbol upload]),
2025         [],
2026         [with_symbol_config=no])
2028 AC_ARG_WITH(export-validation,
2029     AS_HELP_STRING([--without-export-validation],
2030         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2031 ,with_export_validation=auto)
2033 AC_ARG_WITH(bffvalidator,
2034     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2035         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2036          Requires installed Microsoft Office Binary File Format Validator.
2037          Note: export-validation (--with-export-validation) is required to be turned on.
2038          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2039 ,with_bffvalidator=no)
2041 libo_FUZZ_ARG_WITH(junit,
2042     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2043         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2044          --without-junit disables those tests. Not relevant in the --without-java case.]),
2045 ,with_junit=yes)
2047 AC_ARG_WITH(hamcrest,
2048     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2049         [Specifies the hamcrest jar file to use for JUnit-based tests.
2050          --without-junit disables those tests. Not relevant in the --without-java case.]),
2051 ,with_hamcrest=yes)
2053 AC_ARG_WITH(perl-home,
2054     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2055         [If you have installed Perl 5 Distribution, on your system, please
2056          supply the path here. Note that this is not the location of the Perl
2057          binary but the location of the entire distribution.]),
2060 libo_FUZZ_ARG_WITH(doxygen,
2061     AS_HELP_STRING(
2062         [--with-doxygen=<absolute path to doxygen executable>],
2063         [Specifies the doxygen executable to use when generating ODK C/C++
2064          documentation. --without-doxygen disables generation of ODK C/C++
2065          documentation. Not relevant in the --disable-odk case.]),
2066 ,with_doxygen=yes)
2068 AC_ARG_WITH(visual-studio,
2069     AS_HELP_STRING([--with-visual-studio=<2017>],
2070         [Specify which Visual Studio version to use in case several are
2071          installed. Currently only 2017 is supported.]),
2074 AC_ARG_WITH(windows-sdk,
2075     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2076         [Specify which Windows SDK, or "Windows Kit", version to use
2077          in case the one that came with the selected Visual Studio
2078          is not what you want for some reason. Note that not all compiler/SDK
2079          combinations are supported. The intent is that this option should not
2080          be needed.]),
2083 AC_ARG_WITH(lang,
2084     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2085         [Use this option to build LibreOffice with additional UI language support.
2086          English (US) is always included by default.
2087          Separate multiple languages with space.
2088          For all languages, use --with-lang=ALL.]),
2091 AC_ARG_WITH(locales,
2092     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2093         [Use this option to limit the locale information built in.
2094          Separate multiple locales with space.
2095          Very experimental and might well break stuff.
2096          Just a desperate measure to shrink code and data size.
2097          By default all the locales available is included.
2098          This option is completely unrelated to --with-lang.])
2099     [
2100                           Affects also our character encoding conversion
2101                           tables for encodings mainly targeted for a
2102                           particular locale, like EUC-CN and EUC-TW for
2103                           zh, ISO-2022-JP for ja.
2105                           Affects also our add-on break iterator data for
2106                           some languages.
2108                           For the default, all locales, don't use this switch at all.
2109                           Specifying just the language part of a locale means all matching
2110                           locales will be included.
2111     ],
2114 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2115 libo_FUZZ_ARG_WITH(krb5,
2116     AS_HELP_STRING([--with-krb5],
2117         [Enable MIT Kerberos 5 support in modules that support it.
2118          By default automatically enabled on platforms
2119          where a good system Kerberos 5 is available.]),
2122 libo_FUZZ_ARG_WITH(gssapi,
2123     AS_HELP_STRING([--with-gssapi],
2124         [Enable GSSAPI support in modules that support it.
2125          By default automatically enabled on platforms
2126          where a good system GSSAPI is available.]),
2129 AC_ARG_WITH(iwyu,
2130     AS_HELP_STRING([--with-iwyu],
2131         [Use given IWYU binary path to check unneeded includes instead of building.
2132          Use only if you are hacking on it.]),
2135 libo_FUZZ_ARG_WITH(lxml,
2136     AS_HELP_STRING([--without-lxml],
2137         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2138          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2139          report widget classes and ids.]),
2142 dnl ===================================================================
2143 dnl Branding
2144 dnl ===================================================================
2146 AC_ARG_WITH(branding,
2147     AS_HELP_STRING([--with-branding=/path/to/images],
2148         [Use given path to retrieve branding images set.])
2149     [
2150                           Search for intro.png about.svg and flat_logo.svg.
2151                           If any is missing, default ones will be used instead.
2153                           Search also progress.conf for progress
2154                           settings on intro screen :
2156                           PROGRESSBARCOLOR="255,255,255" Set color of
2157                           progress bar. Comma separated RGB decimal values.
2158                           PROGRESSSIZE="407,6" Set size of progress bar.
2159                           Comma separated decimal values (width, height).
2160                           PROGRESSPOSITION="61,317" Set position of progress
2161                           bar from left,top. Comma separated decimal values.
2162                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2163                           bar frame. Comma separated RGB decimal values.
2164                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2165                           bar text. Comma separated RGB decimal values.
2166                           PROGRESSTEXTBASELINE="287" Set vertical position of
2167                           progress bar text from top. Decimal value.
2169                           Default values will be used if not found.
2170     ],
2174 AC_ARG_WITH(extra-buildid,
2175     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2176         [Show addition build identification in about dialog.]),
2180 AC_ARG_WITH(vendor,
2181     AS_HELP_STRING([--with-vendor="John the Builder"],
2182         [Set vendor of the build.]),
2185 AC_ARG_WITH(android-package-name,
2186     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2187         [Set Android package name of the build.]),
2190 AC_ARG_WITH(compat-oowrappers,
2191     AS_HELP_STRING([--with-compat-oowrappers],
2192         [Install oo* wrappers in parallel with
2193          lo* ones to keep backward compatibility.
2194          Has effect only with make distro-pack-install]),
2197 AC_ARG_WITH(os-version,
2198     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2199         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2202 AC_ARG_WITH(mingw-cross-compiler,
2203     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2204         [Specify the MinGW cross-compiler to use.
2205          When building on the ODK on Unix and building unowinreg.dll,
2206          specify the MinGW C++ cross-compiler.]),
2209 AC_ARG_WITH(idlc-cpp,
2210     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2211         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2214 AC_ARG_WITH(build-version,
2215     AS_HELP_STRING([--with-build-version="Built by Jim"],
2216         [Allows the builder to add a custom version tag that will appear in the
2217          Help/About box for QA purposes.]),
2218 with_build_version=$withval,
2221 AC_ARG_WITH(parallelism,
2222     AS_HELP_STRING([--with-parallelism],
2223         [Number of jobs to run simultaneously during build. Parallel builds can
2224         save a lot of time on multi-cpu machines. Defaults to the number of
2225         CPUs on the machine, unless you configure --enable-icecream - then to
2226         40.]),
2229 AC_ARG_WITH(all-tarballs,
2230     AS_HELP_STRING([--with-all-tarballs],
2231         [Download all external tarballs unconditionally]))
2233 AC_ARG_WITH(gdrive-client-id,
2234     AS_HELP_STRING([--with-gdrive-client-id],
2235         [Provides the client id of the application for OAuth2 authentication
2236         on Google Drive. If either this or --with-gdrive-client-secret is
2237         empty, the feature will be disabled]),
2240 AC_ARG_WITH(gdrive-client-secret,
2241     AS_HELP_STRING([--with-gdrive-client-secret],
2242         [Provides the client secret of the application for OAuth2
2243         authentication on Google Drive. If either this or
2244         --with-gdrive-client-id is empty, the feature will be disabled]),
2247 AC_ARG_WITH(alfresco-cloud-client-id,
2248     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2249         [Provides the client id of the application for OAuth2 authentication
2250         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2251         empty, the feature will be disabled]),
2254 AC_ARG_WITH(alfresco-cloud-client-secret,
2255     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2256         [Provides the client secret of the application for OAuth2
2257         authentication on Alfresco Cloud. If either this or
2258         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2261 AC_ARG_WITH(onedrive-client-id,
2262     AS_HELP_STRING([--with-onedrive-client-id],
2263         [Provides the client id of the application for OAuth2 authentication
2264         on OneDrive. If either this or --with-onedrive-client-secret is
2265         empty, the feature will be disabled]),
2268 AC_ARG_WITH(onedrive-client-secret,
2269     AS_HELP_STRING([--with-onedrive-client-secret],
2270         [Provides the client secret of the application for OAuth2
2271         authentication on OneDrive. If either this or
2272         --with-onedrive-client-id is empty, the feature will be disabled]),
2274 dnl ===================================================================
2275 dnl Do we want to use pre-build binary tarball for recompile
2276 dnl ===================================================================
2278 if test "$enable_library_bin_tar" = "yes" ; then
2279     USE_LIBRARY_BIN_TAR=TRUE
2280 else
2281     USE_LIBRARY_BIN_TAR=
2283 AC_SUBST(USE_LIBRARY_BIN_TAR)
2285 dnl ===================================================================
2286 dnl Test whether build target is Release Build
2287 dnl ===================================================================
2288 AC_MSG_CHECKING([whether build target is Release Build])
2289 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2290     AC_MSG_RESULT([no])
2291     ENABLE_RELEASE_BUILD=
2292 else
2293     AC_MSG_RESULT([yes])
2294     ENABLE_RELEASE_BUILD=TRUE
2296 AC_SUBST(ENABLE_RELEASE_BUILD)
2298 dnl ===================================================================
2299 dnl Test whether to sign Windows Build
2300 dnl ===================================================================
2301 AC_MSG_CHECKING([whether to sign windows build])
2302 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2303     AC_MSG_RESULT([yes])
2304     WINDOWS_BUILD_SIGNING="TRUE"
2305 else
2306     AC_MSG_RESULT([no])
2307     WINDOWS_BUILD_SIGNING="FALSE"
2309 AC_SUBST(WINDOWS_BUILD_SIGNING)
2311 dnl ===================================================================
2312 dnl MacOSX build and runtime environment options
2313 dnl ===================================================================
2315 AC_ARG_WITH(macosx-sdk,
2316     AS_HELP_STRING([--with-macosx-sdk=<version>],
2317         [Prefer a specific SDK for building.])
2318     [
2319                           If the requested SDK is not available, a search for the oldest one will be done.
2320                           With current Xcode versions, only the latest SDK is included, so this option is
2321                           not terribly useful. It works fine to build with a new SDK and run the result
2322                           on an older OS.
2324                           e. g.: --with-macosx-sdk=10.10
2326                           there are 3 options to control the MacOSX build:
2327                           --with-macosx-sdk (referred as 'sdk' below)
2328                           --with-macosx-version-min-required (referred as 'min' below)
2329                           --with-macosx-version-max-allowed (referred as 'max' below)
2331                           the connection between these value and the default they take is as follow:
2332                           ( ? means not specified on the command line, s means the SDK version found,
2333                           constraint: 8 <= x <= y <= z)
2335                           ==========================================
2336                            command line      || config result
2337                           ==========================================
2338                           min  | max  | sdk  || min   | max  | sdk  |
2339                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2340                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2341                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2342                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2343                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2344                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2345                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2346                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2349                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2350                           for a detailed technical explanation of these variables
2352                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2353     ],
2356 AC_ARG_WITH(macosx-version-min-required,
2357     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2358         [set the minimum OS version needed to run the built LibreOffice])
2359     [
2360                           e. g.: --with-macos-version-min-required=10.10
2361                           see --with-macosx-sdk for more info
2362     ],
2365 AC_ARG_WITH(macosx-version-max-allowed,
2366     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2367         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2368     [
2369                           e. g.: --with-macos-version-max-allowed=10.10
2370                           see --with-macosx-sdk for more info
2371     ],
2375 dnl ===================================================================
2376 dnl options for stuff used during cross-compilation build
2377 dnl Not quite superseded by --with-build-platform-configure-options.
2378 dnl TODO: check, if the "force" option is still needed anywhere.
2379 dnl ===================================================================
2381 AC_ARG_WITH(system-icu-for-build,
2382     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2383         [Use icu already on system for build tools (cross-compilation only).]))
2386 dnl ===================================================================
2387 dnl Check for incompatible options set by fuzzing, and reset those
2388 dnl automatically to working combinations
2389 dnl ===================================================================
2391 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2392         "$enable_dbus" != "$enable_avahi"; then
2393     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2394     enable_avahi=$enable_dbus
2397 add_lopath_after ()
2399     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2400         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2401     fi
2404 add_lopath_before ()
2406     local IFS=${P_SEP}
2407     local path_cleanup
2408     local dir
2409     for dir in $LO_PATH ; do
2410         if test "$dir" != "$1" ; then
2411             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2412         fi
2413     done
2414     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2417 dnl ===================================================================
2418 dnl check for required programs (grep, awk, sed, bash)
2419 dnl ===================================================================
2421 pathmunge ()
2423     if test -n "$1"; then
2424         if test "$build_os" = "cygwin"; then
2425             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2426                 PathFormat "$1"
2427                 new_path=`cygpath -sm "$formatted_path"`
2428             else
2429                 PathFormat "$1"
2430                 new_path=`cygpath -u "$formatted_path"`
2431             fi
2432         else
2433             new_path="$1"
2434         fi
2435         if test "$2" = "after"; then
2436             add_lopath_after "$new_path"
2437         else
2438             add_lopath_before "$new_path"
2439         fi
2440         unset new_path
2441     fi
2444 AC_PROG_AWK
2445 AC_PATH_PROG( AWK, $AWK)
2446 if test -z "$AWK"; then
2447     AC_MSG_ERROR([install awk to run this script])
2450 AC_PATH_PROG(BASH, bash)
2451 if test -z "$BASH"; then
2452     AC_MSG_ERROR([bash not found in \$PATH])
2454 AC_SUBST(BASH)
2456 AC_MSG_CHECKING([for GNU or BSD tar])
2457 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2458     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2459     if test $? -eq 0;  then
2460         GNUTAR=$a
2461         break
2462     fi
2463 done
2464 AC_MSG_RESULT($GNUTAR)
2465 if test -z "$GNUTAR"; then
2466     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2468 AC_SUBST(GNUTAR)
2470 AC_MSG_CHECKING([for tar's option to strip components])
2471 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2472 if test $? -eq 0; then
2473     STRIP_COMPONENTS="--strip-components"
2474 else
2475     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2476     if test $? -eq 0; then
2477         STRIP_COMPONENTS="--strip-path"
2478     else
2479         STRIP_COMPONENTS="unsupported"
2480     fi
2482 AC_MSG_RESULT($STRIP_COMPONENTS)
2483 if test x$STRIP_COMPONENTS = xunsupported; then
2484     AC_MSG_ERROR([you need a tar that is able to strip components.])
2486 AC_SUBST(STRIP_COMPONENTS)
2488 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2489 dnl desktop OSes from "mobile" ones.
2491 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2492 dnl In other words, that when building for an OS that is not a
2493 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2495 dnl Note the direction of the implication; there is no assumption that
2496 dnl cross-compiling would imply a non-desktop OS.
2498 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2499     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2500     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2501     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2504 # Whether to build "avmedia" functionality or not.
2506 if test -z "$enable_avmedia"; then
2507     enable_avmedia=yes
2510 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2511 if test "$enable_avmedia" = yes; then
2512     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2513 else
2514     USE_AVMEDIA_DUMMY='TRUE'
2516 AC_SUBST(USE_AVMEDIA_DUMMY)
2518 # Decide whether to build database connectivity stuff (including
2519 # Base) or not. We probably don't want to on non-desktop OSes.
2520 if test -z "$enable_database_connectivity"; then
2521     # --disable-database-connectivity is unfinished work in progress
2522     # and the iOS test app doesn't link if we actually try to use it.
2523     # if test $_os != iOS -a $_os != Android; then
2524     if test $_os != iOS; then
2525         enable_database_connectivity=yes
2526     fi
2529 if test "$enable_database_connectivity" = yes; then
2530     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2531     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2534 if test -z "$enable_extensions"; then
2535     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2536     if test $_os != iOS -a $_os != Android; then
2537         enable_extensions=yes
2538     fi
2541 if test "$enable_extensions" = yes; then
2542     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2543     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2546 if test -z "$enable_scripting"; then
2547     # Disable scripting for iOS unless specifically overridden
2548     # with --enable-scripting.
2549     if test $_os != iOS; then
2550         enable_scripting=yes
2551     fi
2554 DISABLE_SCRIPTING=''
2555 if test "$enable_scripting" = yes; then
2556     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2557     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2558 else
2559     DISABLE_SCRIPTING='TRUE'
2560     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2563 if test $_os = iOS -o $_os = Android; then
2564     # Disable dynamic_loading always for iOS and Android
2565     enable_dynamic_loading=no
2566 elif test -z "$enable_dynamic_loading"; then
2567     # Otherwise enable it unless specifically disabled
2568     enable_dynamic_loading=yes
2571 DISABLE_DYNLOADING=''
2572 if test "$enable_dynamic_loading" = yes; then
2573     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2574 else
2575     DISABLE_DYNLOADING='TRUE'
2577 AC_SUBST(DISABLE_DYNLOADING)
2579 # remember SYSBASE value
2580 AC_SUBST(SYSBASE)
2582 dnl ===================================================================
2583 dnl  Sort out various gallery compilation options
2584 dnl ===================================================================
2585 AC_MSG_CHECKING([how to build and package galleries])
2586 if test -n "${with_galleries}"; then
2587     if test "$with_galleries" = "build"; then
2588         WITH_GALLERY_BUILD=TRUE
2589         AC_MSG_RESULT([build from source images internally])
2590     elif test "$with_galleries" = "no"; then
2591         WITH_GALLERY_BUILD=
2592         AC_MSG_RESULT([disable non-internal gallery build])
2593     else
2594         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2595     fi
2596 else
2597     if test $_os != iOS -a $_os != Android; then
2598         WITH_GALLERY_BUILD=TRUE
2599         AC_MSG_RESULT([internal src images for desktop])
2600     else
2601         WITH_GALLERY_BUILD=
2602         AC_MSG_RESULT([disable src image build])
2603     fi
2605 AC_SUBST(WITH_GALLERY_BUILD)
2607 dnl ===================================================================
2608 dnl  Checks if ccache is available
2609 dnl ===================================================================
2610 CCACHE_DEPEND_MODE=
2611 if test "$_os" = "WINNT"; then
2612     # on windows/VC build do not use ccache
2613     CCACHE=""
2614 elif test "$enable_ccache" = "no"; then
2615     CCACHE=""
2616 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2617     case "%$CC%$CXX%" in
2618     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2619     # assume that's good then
2620     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2621         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2622         CCACHE_DEPEND_MODE=1
2623         ;;
2624     *)
2625         AC_PATH_PROG([CCACHE],[ccache],[not found])
2626         if test "$CCACHE" = "not found"; then
2627             CCACHE=""
2628         else
2629             CCACHE_DEPEND_MODE=1
2630             # Need to check for ccache version: otherwise prevents
2631             # caching of the results (like "-x objective-c++" for Mac)
2632             if test $_os = Darwin -o $_os = iOS; then
2633                 # Check ccache version
2634                 AC_MSG_CHECKING([whether version of ccache is suitable])
2635                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2636                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2637                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2638                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2639                 else
2640                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2641                     CCACHE=""
2642                     CCACHE_DEPEND_MODE=
2643                 fi
2644             fi
2645         fi
2646         ;;
2647     esac
2648 else
2649     CCACHE=""
2651 if test "$enable_ccache" = "nodepend"; then
2652     CCACHE_DEPEND_MODE=""
2654 AC_SUBST(CCACHE_DEPEND_MODE)
2656 if test "$CCACHE" != ""; then
2657     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2658     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2659     if test "$ccache_size" = ""; then
2660         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2661         if test "$ccache_size" = ""; then
2662             ccache_size=0
2663         fi
2664         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2665         if test $ccache_size -lt 1024; then
2666             CCACHE=""
2667             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2668             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2669         else
2670             # warn that ccache may be too small for debug build
2671             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2672             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2673         fi
2674     else
2675         if test $ccache_size -lt 5; then
2676             #warn that ccache may be too small for debug build
2677             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2678             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2679         fi
2680     fi
2683 dnl ===================================================================
2684 dnl  Checks for C compiler,
2685 dnl  The check for the C++ compiler is later on.
2686 dnl ===================================================================
2687 if test "$_os" != "WINNT"; then
2688     GCC_HOME_SET="true"
2689     AC_MSG_CHECKING([gcc home])
2690     if test -z "$with_gcc_home"; then
2691         if test "$enable_icecream" = "yes"; then
2692             if test -d "/usr/lib/icecc/bin"; then
2693                 GCC_HOME="/usr/lib/icecc/"
2694             elif test -d "/usr/libexec/icecc/bin"; then
2695                 GCC_HOME="/usr/libexec/icecc/"
2696             elif test -d "/opt/icecream/bin"; then
2697                 GCC_HOME="/opt/icecream/"
2698             else
2699                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2701             fi
2702         else
2703             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2704             GCC_HOME_SET="false"
2705         fi
2706     else
2707         GCC_HOME="$with_gcc_home"
2708     fi
2709     AC_MSG_RESULT($GCC_HOME)
2710     AC_SUBST(GCC_HOME)
2712     if test "$GCC_HOME_SET" = "true"; then
2713         if test -z "$CC"; then
2714             CC="$GCC_HOME/bin/gcc"
2715             CC_BASE="gcc"
2716         fi
2717         if test -z "$CXX"; then
2718             CXX="$GCC_HOME/bin/g++"
2719             CXX_BASE="g++"
2720         fi
2721     fi
2724 COMPATH=`dirname "$CC"`
2725 if test "$COMPATH" = "."; then
2726     AC_PATH_PROGS(COMPATH, $CC)
2727     dnl double square bracket to get single because of M4 quote...
2728     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2730 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2732 dnl ===================================================================
2733 dnl Java support
2734 dnl ===================================================================
2735 AC_MSG_CHECKING([whether to build with Java support])
2736 if test "$with_java" != "no"; then
2737     if test "$DISABLE_SCRIPTING" = TRUE; then
2738         AC_MSG_RESULT([no, overridden by --disable-scripting])
2739         ENABLE_JAVA=""
2740         with_java=no
2741     else
2742         AC_MSG_RESULT([yes])
2743         ENABLE_JAVA="TRUE"
2744         AC_DEFINE(HAVE_FEATURE_JAVA)
2745     fi
2746 else
2747     AC_MSG_RESULT([no])
2748     ENABLE_JAVA=""
2751 AC_SUBST(ENABLE_JAVA)
2753 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2755 dnl ENABLE_JAVA="" indicate no Java support at all
2757 dnl ===================================================================
2758 dnl Check macOS SDK and compiler
2759 dnl ===================================================================
2761 if test $_os = Darwin -o $_os = iOS; then
2763     # If no --with-macosx-sdk option is given, look for one
2765     # The intent is that for "most" Mac-based developers, a suitable
2766     # SDK will be found automatically without any configure options.
2768     # For developers with a current Xcode, the lowest-numbered SDK
2769     # higher than or equal to the minimum required should be found.
2771     AC_MSG_CHECKING([what macOS SDK to use])
2772     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2773         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2774         if test -d "$MACOSX_SDK_PATH"; then
2775             with_macosx_sdk="${_macosx_sdk}"
2776             break
2777         else
2778             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2779             if test -d "$MACOSX_SDK_PATH"; then
2780                 with_macosx_sdk="${_macosx_sdk}"
2781                 break
2782             fi
2783         fi
2784     done
2785     if test ! -d "$MACOSX_SDK_PATH"; then
2786         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2787     fi
2789     if test $_os = iOS; then
2790         if test "$enable_ios_simulator" = "yes"; then
2791             useos=iphonesimulator
2792         else
2793             useos=iphoneos
2794         fi
2795         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2796     fi
2797     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2800     case $with_macosx_sdk in
2801     10.12)
2802         MACOSX_SDK_VERSION=101200
2803         ;;
2804     10.13)
2805         MACOSX_SDK_VERSION=101300
2806         ;;
2807     10.14)
2808         MACOSX_SDK_VERSION=101400
2809         ;;
2810     10.15)
2811         MACOSX_SDK_VERSION=101500
2812         ;;
2813     *)
2814         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2815         ;;
2816     esac
2818     if test "$with_macosx_version_min_required" = "" ; then
2819         with_macosx_version_min_required="10.10";
2820     fi
2822     if test "$with_macosx_version_max_allowed" = "" ; then
2823         with_macosx_version_max_allowed="$with_macosx_sdk"
2824     fi
2826     # export this so that "xcrun" invocations later return matching values
2827     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2828     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2829     export DEVELOPER_DIR
2830     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2831     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2833     AC_MSG_CHECKING([whether Xcode is new enough])
2834     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2835     my_xcode_ver2=${my_xcode_ver1#Xcode }
2836     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2837     if test "$my_xcode_ver3" -ge 903; then
2838         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2839     else
2840         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2841     fi
2843     case "$with_macosx_version_min_required" in
2844     10.10)
2845         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2846         ;;
2847     10.11)
2848         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2849         ;;
2850     10.12)
2851         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2852         ;;
2853     10.13)
2854         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2855         ;;
2856     10.14)
2857         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2858         ;;
2859     10.15)
2860         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2861         ;;
2862     *)
2863         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2864         ;;
2865     esac
2866     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2868     LIBTOOL=/usr/bin/libtool
2869     INSTALL_NAME_TOOL=install_name_tool
2870     if test -z "$save_CC"; then
2871         stdlib=-stdlib=libc++
2872         if test "$ENABLE_LTO" = TRUE; then
2873             lto=-flto
2874         fi
2876         AC_MSG_CHECKING([what C compiler to use])
2877         CC="`xcrun -find clang`"
2878         CC_BASE=`first_arg_basename "$CC"`
2879         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2880         AC_MSG_RESULT([$CC])
2882         AC_MSG_CHECKING([what C++ compiler to use])
2883         CXX="`xcrun -find clang++`"
2884         CXX_BASE=`first_arg_basename "$CXX"`
2885         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2886         AC_MSG_RESULT([$CXX])
2888         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2889         AR=`xcrun -find ar`
2890         NM=`xcrun -find nm`
2891         STRIP=`xcrun -find strip`
2892         LIBTOOL=`xcrun -find libtool`
2893         RANLIB=`xcrun -find ranlib`
2894     fi
2896     case "$with_macosx_version_max_allowed" in
2897     10.10)
2898         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2899         ;;
2900     10.11)
2901         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2902         ;;
2903     10.12)
2904         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2905         ;;
2906     10.13)
2907         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2908         ;;
2909     10.14)
2910         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2911         ;;
2912     10.15)
2913         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2914         ;;
2915     *)
2916         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2917         ;;
2918     esac
2920     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2921     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2922         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])
2923     else
2924         AC_MSG_RESULT([ok])
2925     fi
2927     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2928     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2929         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2930     else
2931         AC_MSG_RESULT([ok])
2932     fi
2933     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2934     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2936     AC_MSG_CHECKING([whether to do code signing])
2938     if test "$enable_macosx_code_signing" = yes; then
2939         # By default use the first suitable certificate (?).
2941         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2942         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2943         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2944         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2945         # "Developer ID Application" one.
2947         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2948         if test -n "$identity"; then
2949             MACOSX_CODESIGNING_IDENTITY=$identity
2950             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2951             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2952         else
2953             AC_MSG_ERROR([cannot determine identity to use])
2954         fi
2955     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2956         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2957         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2958         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2959     else
2960         AC_MSG_RESULT([no])
2961     fi
2963     AC_MSG_CHECKING([whether to create a Mac App Store package])
2965     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2966         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2967     elif test "$enable_macosx_package_signing" = yes; then
2968         # By default use the first suitable certificate.
2969         # It should be a "3rd Party Mac Developer Installer" one
2971         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2972         if test -n "$identity"; then
2973             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2974             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2975             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2976         else
2977             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2978         fi
2979     elif test -n "$enable_macosx_package_signing"; then
2980         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2981         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2982         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2983     else
2984         AC_MSG_RESULT([no])
2985     fi
2987     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2988         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2989     fi
2991     AC_MSG_CHECKING([whether to sandbox the application])
2993     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2994         AC_MSG_ERROR([macOS sandboxing requires code signing])
2995     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2996         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2997     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2998         ENABLE_MACOSX_SANDBOX=TRUE
2999         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3000         AC_MSG_RESULT([yes])
3001     else
3002         AC_MSG_RESULT([no])
3003     fi
3005     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3006     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3007     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3009 AC_SUBST(MACOSX_SDK_PATH)
3010 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3011 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3012 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3013 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3014 AC_SUBST(INSTALL_NAME_TOOL)
3015 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3016 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3017 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3018 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3019 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3021 dnl ===================================================================
3022 dnl Check iOS SDK and compiler
3023 dnl ===================================================================
3025 if test $_os = iOS; then
3026     AC_MSG_CHECKING([what iOS SDK to use])
3027     current_sdk_ver=12.4
3028     older_sdk_vers="13.0 12.2 12.1 12.0 11.4"
3029     if test "$enable_ios_simulator" = "yes"; then
3030         platform=iPhoneSimulator
3031         versionmin=-mios-simulator-version-min=11.0
3032     else
3033         platform=iPhoneOS
3034         versionmin=-miphoneos-version-min=11.0
3035     fi
3036     xcode_developer=`xcode-select -print-path`
3038     for sdkver in $current_sdk_ver $older_sdk_vers; do
3039         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3040         if test -d $t; then
3041             sysroot=$t
3042             break
3043         fi
3044     done
3046     if test -z "$sysroot"; then
3047         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3048     fi
3050     AC_MSG_RESULT($sysroot)
3052     # LTO is not really recommended for iOS builds,
3053     # the link time will be astronomical
3054     if test "$ENABLE_LTO" = TRUE; then
3055         lto=-flto
3056     fi
3058     stdlib="-stdlib=libc++"
3060     AC_MSG_CHECKING([what C compiler to use])
3061     CC="`xcrun -find clang`"
3062     CC_BASE=`first_arg_basename "$CC"`
3063     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3064     AC_MSG_RESULT([$CC])
3066     AC_MSG_CHECKING([what C++ compiler to use])
3067     CXX="`xcrun -find clang++`"
3068     CXX_BASE=`first_arg_basename "$CXX"`
3069     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3070     AC_MSG_RESULT([$CXX])
3072     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3073     AR=`xcrun -find ar`
3074     NM=`xcrun -find nm`
3075     STRIP=`xcrun -find strip`
3076     LIBTOOL=`xcrun -find libtool`
3077     RANLIB=`xcrun -find ranlib`
3080 AC_MSG_CHECKING([whether to treat the installation as read-only])
3082 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3083         "$enable_extensions" != yes; then
3084     enable_readonly_installset=yes
3086 if test "$enable_readonly_installset" = yes; then
3087     AC_MSG_RESULT([yes])
3088     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3089 else
3090     AC_MSG_RESULT([no])
3093 dnl ===================================================================
3094 dnl Structure of install set
3095 dnl ===================================================================
3097 if test $_os = Darwin; then
3098     LIBO_BIN_FOLDER=MacOS
3099     LIBO_ETC_FOLDER=Resources
3100     LIBO_LIBEXEC_FOLDER=MacOS
3101     LIBO_LIB_FOLDER=Frameworks
3102     LIBO_LIB_PYUNO_FOLDER=Resources
3103     LIBO_SHARE_FOLDER=Resources
3104     LIBO_SHARE_HELP_FOLDER=Resources/help
3105     LIBO_SHARE_JAVA_FOLDER=Resources/java
3106     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3107     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3108     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3109     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3110     LIBO_URE_BIN_FOLDER=MacOS
3111     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3112     LIBO_URE_LIB_FOLDER=Frameworks
3113     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3114     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3115 elif test $_os = WINNT; then
3116     LIBO_BIN_FOLDER=program
3117     LIBO_ETC_FOLDER=program
3118     LIBO_LIBEXEC_FOLDER=program
3119     LIBO_LIB_FOLDER=program
3120     LIBO_LIB_PYUNO_FOLDER=program
3121     LIBO_SHARE_FOLDER=share
3122     LIBO_SHARE_HELP_FOLDER=help
3123     LIBO_SHARE_JAVA_FOLDER=program/classes
3124     LIBO_SHARE_PRESETS_FOLDER=presets
3125     LIBO_SHARE_READMES_FOLDER=readmes
3126     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3127     LIBO_SHARE_SHELL_FOLDER=program/shell
3128     LIBO_URE_BIN_FOLDER=program
3129     LIBO_URE_ETC_FOLDER=program
3130     LIBO_URE_LIB_FOLDER=program
3131     LIBO_URE_MISC_FOLDER=program
3132     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3133 else
3134     LIBO_BIN_FOLDER=program
3135     LIBO_ETC_FOLDER=program
3136     LIBO_LIBEXEC_FOLDER=program
3137     LIBO_LIB_FOLDER=program
3138     LIBO_LIB_PYUNO_FOLDER=program
3139     LIBO_SHARE_FOLDER=share
3140     LIBO_SHARE_HELP_FOLDER=help
3141     LIBO_SHARE_JAVA_FOLDER=program/classes
3142     LIBO_SHARE_PRESETS_FOLDER=presets
3143     LIBO_SHARE_READMES_FOLDER=readmes
3144     if test "$enable_fuzzers" != yes; then
3145         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3146     else
3147         LIBO_SHARE_RESOURCE_FOLDER=resource
3148     fi
3149     LIBO_SHARE_SHELL_FOLDER=program/shell
3150     LIBO_URE_BIN_FOLDER=program
3151     LIBO_URE_ETC_FOLDER=program
3152     LIBO_URE_LIB_FOLDER=program
3153     LIBO_URE_MISC_FOLDER=program
3154     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3156 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3157 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3158 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3159 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3160 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3161 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3173 # Not all of them needed in config_host.mk, add more if need arises
3174 AC_SUBST(LIBO_BIN_FOLDER)
3175 AC_SUBST(LIBO_ETC_FOLDER)
3176 AC_SUBST(LIBO_LIB_FOLDER)
3177 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3178 AC_SUBST(LIBO_SHARE_FOLDER)
3179 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3180 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3181 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3182 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3183 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3184 AC_SUBST(LIBO_URE_BIN_FOLDER)
3185 AC_SUBST(LIBO_URE_ETC_FOLDER)
3186 AC_SUBST(LIBO_URE_LIB_FOLDER)
3187 AC_SUBST(LIBO_URE_MISC_FOLDER)
3188 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3190 dnl ===================================================================
3191 dnl Windows specific tests and stuff
3192 dnl ===================================================================
3194 reg_get_value()
3196     # Return value: $regvalue
3197     unset regvalue
3199     local _regentry="/proc/registry${1}/${2}"
3200     if test -f "$_regentry"; then
3201         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3202         # Registry keys read via /proc/registry* are always \0 terminated!
3203         local _regvalue=$(tr -d '\0' < "$_regentry")
3204         if test $? -eq 0; then
3205             regvalue=$_regvalue
3206         fi
3207     fi
3210 # Get a value from the 32-bit side of the Registry
3211 reg_get_value_32()
3213     reg_get_value "32" "$1"
3216 # Get a value from the 64-bit side of the Registry
3217 reg_get_value_64()
3219     reg_get_value "64" "$1"
3222 if test "$_os" = "WINNT"; then
3223     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3224     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3225         AC_MSG_RESULT([no])
3226         WINDOWS_SDK_ARCH="x86"
3227     else
3228         AC_MSG_RESULT([yes])
3229         WINDOWS_SDK_ARCH="x64"
3230         BITNESS_OVERRIDE=64
3231     fi
3233 if test "$_os" = "iOS"; then
3234     cross_compiling="yes"
3237 if test "$cross_compiling" = "yes"; then
3238     export CROSS_COMPILING=TRUE
3239 else
3240     CROSS_COMPILING=
3241     BUILD_TYPE="$BUILD_TYPE NATIVE"
3243 AC_SUBST(CROSS_COMPILING)
3245 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3246 # NOTE: must _not_ be used for bundled external libraries!
3247 ISYSTEM=
3248 if test "$GCC" = "yes"; then
3249     AC_MSG_CHECKING( for -isystem )
3250     save_CFLAGS=$CFLAGS
3251     CFLAGS="$CFLAGS -Werror"
3252     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3253     CFLAGS=$save_CFLAGS
3254     if test -n "$ISYSTEM"; then
3255         AC_MSG_RESULT(yes)
3256     else
3257         AC_MSG_RESULT(no)
3258     fi
3260 if test -z "$ISYSTEM"; then
3261     # fall back to using -I
3262     ISYSTEM=-I
3264 AC_SUBST(ISYSTEM)
3266 dnl ===================================================================
3267 dnl  Check which Visual Studio compiler is used
3268 dnl ===================================================================
3270 map_vs_year_to_version()
3272     # Return value: $vsversion
3274     unset vsversion
3276     case $1 in
3277     2017)
3278         vsversion=15;;
3279     2019)
3280         vsversion=16;;
3281     *)
3282         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3283     esac
3286 vs_versions_to_check()
3288     # Args: $1 (optional) : versions to check, in the order of preference
3289     # Return value: $vsversions
3291     unset vsversions
3293     if test -n "$1"; then
3294         map_vs_year_to_version "$1"
3295         vsversions=$vsversion
3296     else
3297         # We accept only 2017
3298         vsversions="15"
3299     fi
3302 win_get_env_from_vsvars32bat()
3304     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3305     # Also seems to be located in another directory under the same name: vsvars32.bat
3306     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3307     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3308     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3309     chmod +x $WRAPPERBATCHFILEPATH
3310     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3311     rm -f $WRAPPERBATCHFILEPATH
3312     printf '%s' "$_win_get_env_from_vsvars32bat"
3315 find_ucrt()
3317     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3318     if test -n "$regvalue"; then
3319         PathFormat "$regvalue"
3320         UCRTSDKDIR=$formatted_path
3321         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3322         UCRTVERSION=$regvalue
3323         # Rest if not exist
3324         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3325           UCRTSDKDIR=
3326         fi
3327     fi
3328     if test -z "$UCRTSDKDIR"; then
3329         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3330         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3331         if test -f "$ide_env_file"; then
3332             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3333             UCRTSDKDIR=$formatted_path
3334             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3335             dnl Hack needed at least by tml:
3336             if test "$UCRTVERSION" = 10.0.15063.0 \
3337                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3338                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3339             then
3340                 UCRTVERSION=10.0.14393.0
3341             fi
3342         else
3343           AC_MSG_ERROR([No UCRT found])
3344         fi
3345     fi
3348 find_msvc()
3350     # Find Visual C++ 2017/2019
3351     # Args: $1 (optional) : The VS version year
3352     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3354     unset vctest vcnum vcnumwithdot vcbuildnumber
3356     vs_versions_to_check "$1"
3357     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3358     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3359     PathFormat "$vswhere"
3360     vswhere=$formatted_path
3361     for ver in $vsversions; do
3362         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3363         if test -n "$vswhereoutput"; then
3364             PathFormat "$vswhereoutput"
3365             vctest=$formatted_path
3366             break
3367         fi
3368     done
3370     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3371     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3372     # should be removed when upgrading baseline.
3373     if ! test -n "$vctest"; then
3374         for ver in $vsversions; do
3375             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3376             if test -n "$regvalue"; then
3377                 vctest=$regvalue
3378                 break
3379             fi
3380             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3381             if test -n "$regvalue"; then
3382                 AC_MSG_RESULT([found: $regvalue])
3383                 PathFormat "$regvalue"
3384                 vctest=$formatted_path
3385                 break
3386             fi
3387         done
3388     fi
3390     if test -n "$vctest"; then
3391         vcnumwithdot="$ver.0"
3392         case "$vcnumwithdot" in
3393         15.0)
3394             vcyear=2017
3395             vcnum=150
3396             ;;
3397         16.0)
3398             vcyear=2019
3399             vcnum=160
3400             ;;
3401         esac
3402         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3404     fi
3407 SOLARINC=
3408 MSBUILD_PATH=
3409 DEVENV=
3410 if test "$_os" = "WINNT"; then
3411     AC_MSG_CHECKING([Visual C++])
3412     find_msvc "$with_visual_studio"
3413     if test -z "$vctest"; then
3414         if test -n "$with_visual_studio"; then
3415             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3416         else
3417             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3418         fi
3419     fi
3421     if test "$BITNESS_OVERRIDE" = ""; then
3422         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3423             VC_PRODUCT_DIR=$vctest/VC
3424         else
3425             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3426         fi
3427     else
3428         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3429             VC_PRODUCT_DIR=$vctest/VC
3430         else
3431             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3432         fi
3433     fi
3434     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3436     AC_MSG_CHECKING([for short pathname of VC product directory])
3437     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3438     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3440     UCRTSDKDIR=
3441     UCRTVERSION=
3443     AC_MSG_CHECKING([for UCRT location])
3444     find_ucrt
3445     # find_ucrt errors out if it doesn't find it
3446     AC_MSG_RESULT([found])
3447     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3448     ucrtincpath_formatted=$formatted_path
3449     # SOLARINC is used for external modules and must be set too.
3450     # And no, it's not sufficient to set SOLARINC only, as configure
3451     # itself doesn't honour it.
3452     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3453     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3454     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3455     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3457     AC_SUBST(UCRTSDKDIR)
3458     AC_SUBST(UCRTVERSION)
3460     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3461     # Find the proper version of MSBuild.exe to use based on the VS version
3462     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3463     if test -n "$regvalue" ; then
3464         AC_MSG_RESULT([found: $regvalue])
3465         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3466     else
3467         if test "$vcnumwithdot" = "16.0"; then
3468             if test "$BITNESS_OVERRIDE" = ""; then
3469                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3470             else
3471                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3472             fi
3473         else
3474             if test "$BITNESS_OVERRIDE" = ""; then
3475                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3476             else
3477                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3478             fi
3479         fi
3480         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3481         AC_MSG_RESULT([$regvalue])
3482     fi
3484     # Find the version of devenv.exe
3485     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3486     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3487     if test ! -e "$DEVENV"; then
3488         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3489     fi
3491     dnl ===========================================================
3492     dnl  Check for the corresponding mspdb*.dll
3493     dnl ===========================================================
3495     VC_HOST_DIR=
3496     MSPDB_PATH=
3497     CL_PATH=
3499     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3500         VC_HOST_DIR="HostX64"
3501         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3502     else
3503         VC_HOST_DIR="HostX86"
3504         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3505     fi
3507     if test "$BITNESS_OVERRIDE" = ""; then
3508         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3509     else
3510         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3511     fi
3513     # MSVC 15.0 has libraries from 14.0?
3514     mspdbnum="140"
3516     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3517         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3518     fi
3520     dnl The path needs to be added before cl is called
3521     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3522     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3524     AC_MSG_CHECKING([cl.exe])
3526     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3527     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3528     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3529     # is not enough?
3531     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3532     dnl needed when building CLR code:
3533     if test -z "$MSVC_CXX"; then
3534         if test -f "$CL_PATH/cl.exe"; then
3535             MSVC_CXX="$CL_PATH/cl.exe"
3536         fi
3538         # This gives us a posix path with 8.3 filename restrictions
3539         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3540         CXX_BASE=`first_arg_basename "$MSVC_CXX"`
3541     fi
3543     if test -z "$CC"; then
3544         CC=$MSVC_CXX
3545         CC_BASE=`first_arg_basename "$CC"`
3546     fi
3547     if test "$BITNESS_OVERRIDE" = ""; then
3548         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3549         MSVC_CXX="$MSVC_CXX -arch:SSE"
3550     fi
3552     if test -n "$CC"; then
3553         # Remove /cl.exe from CC case insensitive
3554         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3555         if test "$BITNESS_OVERRIDE" = ""; then
3556            COMPATH="$VC_PRODUCT_DIR"
3557         else
3558             if test -n "$VC_PRODUCT_DIR"; then
3559                 COMPATH=$VC_PRODUCT_DIR
3560             fi
3561         fi
3562         if test "$BITNESS_OVERRIDE" = ""; then
3563             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3564             CC="$CC -arch:SSE"
3565         fi
3567         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3569         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3571         PathFormat "$COMPATH"
3572         COMPATH=`win_short_path_for_make "$formatted_path"`
3574         VCVER=$vcnum
3575         MSVSVER=$vcyear
3577         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3578         # are always "better", we list them in reverse chronological order.
3580         case "$vcnum" in
3581         150|160)
3582             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3583             ;;
3584         esac
3586         # The expectation is that --with-windows-sdk should not need to be used
3587         if test -n "$with_windows_sdk"; then
3588             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3589             *" "$with_windows_sdk" "*)
3590                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3591                 ;;
3592             *)
3593                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3594                 ;;
3595             esac
3596         fi
3598         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3599         ac_objext=obj
3600         ac_exeext=exe
3602     else
3603         AC_MSG_ERROR([Visual C++ not found after all, huh])
3604     fi
3606     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3607     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3608         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3609         // between Visual Studio versions and _MSC_VER:
3610         #if _MSC_VER < 1914
3611         #error
3612         #endif
3613     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3615     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3616     # version of the Explorer extension (and maybe other small
3617     # bits, too) needed when installing a 32-bit LibreOffice on a
3618     # 64-bit OS. The 64-bit Explorer extension is a feature that
3619     # has been present since long in OOo. Don't confuse it with
3620     # building LibreOffice itself as 64-bit code.
3622     BUILD_X64=
3623     CXX_X64_BINARY=
3625     if test "$BITNESS_OVERRIDE" = ""; then
3626         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3627         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3628              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3629             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3630                 BUILD_X64=TRUE
3631                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3632             fi
3633         fi
3634         if test "$BUILD_X64" = TRUE; then
3635             AC_MSG_RESULT([found])
3636         else
3637             AC_MSG_RESULT([not found])
3638             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3639         fi
3640     else
3641         CXX_X64_BINARY=$MSVC_CXX
3642     fi
3643     AC_SUBST(BUILD_X64)
3645     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3646     AC_SUBST(CXX_X64_BINARY)
3648     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3649     # needed to support TWAIN scan on both 32- and 64-bit systems
3651     BUILD_X86=
3653     if test "$BITNESS_OVERRIDE" = "64"; then
3654         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3655         if test -n "$CXX_X86_BINARY"; then
3656             BUILD_X86=TRUE
3657             AC_MSG_RESULT([preset])
3658         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3659             BUILD_X86=TRUE
3660             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3661             CXX_X86_BINARY+=" /arch:SSE"
3662             AC_MSG_RESULT([found])
3663         else
3664             CXX_X86_BINARY=
3665             AC_MSG_RESULT([not found])
3666             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3667         fi
3668     else
3669         BUILD_X86=TRUE
3670         CXX_X86_BINARY=$MSVC_CXX
3671     fi
3672     AC_SUBST(BUILD_X86)
3673     AC_SUBST(CXX_X86_BINARY)
3675 AC_SUBST(VCVER)
3676 AC_SUBST(DEVENV)
3677 AC_SUBST(MSVC_CXX)
3680 # unowinreg.dll
3682 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3683 AC_SUBST(UNOWINREG_DLL)
3685 COM_IS_CLANG=
3686 AC_MSG_CHECKING([whether the compiler is actually Clang])
3687 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3688     #ifndef __clang__
3689     you lose
3690     #endif
3691     int foo=42;
3692     ]])],
3693     [AC_MSG_RESULT([yes])
3694      COM_IS_CLANG=TRUE],
3695     [AC_MSG_RESULT([no])])
3696 AC_SUBST(COM_IS_CLANG)
3698 CC_PLAIN=$CC
3699 CLANGVER=
3700 if test "$COM_IS_CLANG" = TRUE; then
3701     AC_MSG_CHECKING([whether Clang is new enough])
3702     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3703         #if !defined __apple_build_version__
3704         #error
3705         #endif
3706         ]])],
3707         [my_apple_clang=yes],[my_apple_clang=])
3708     if test "$my_apple_clang" = yes; then
3709         AC_MSG_RESULT([assumed yes (Apple Clang)])
3710     else
3711         if test "$_os" = WINNT; then
3712             dnl In which case, assume clang-cl:
3713             my_args="/EP /TC"
3714             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3715             dnl clang-cl:
3716             CC_PLAIN=
3717             for i in $CC; do
3718                 case $i in
3719                 -FIIntrin.h)
3720                     ;;
3721                 *)
3722                     CC_PLAIN="$CC_PLAIN $i"
3723                     ;;
3724                 esac
3725             done
3726         else
3727             my_args="-E -P"
3728         fi
3729         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3730         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3731         CLANGVER=`echo $clang_version \
3732             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3733         if test "$CLANGVER" -ge 50002; then
3734             AC_MSG_RESULT([yes ($clang_version)])
3735         else
3736             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3737         fi
3738         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3739         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3740     fi
3743 SHOWINCLUDES_PREFIX=
3744 if test "$_os" = WINNT; then
3745     dnl We need to guess the prefix of the -showIncludes output, it can be
3746     dnl localized
3747     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3748     echo "#include <stdlib.h>" > conftest.c
3749     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3750         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3751     rm -f conftest.c conftest.obj
3752     if test -z "$SHOWINCLUDES_PREFIX"; then
3753         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3754     else
3755         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3756     fi
3758 AC_SUBST(SHOWINCLUDES_PREFIX)
3761 # prefix C with ccache if needed
3763 if test "$CCACHE" != ""; then
3764     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3766     AC_LANG_PUSH([C])
3767     save_CFLAGS=$CFLAGS
3768     CFLAGS="$CFLAGS --ccache-skip -O2"
3769     dnl an empty program will do, we're checking the compiler flags
3770     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3771                       [use_ccache=yes], [use_ccache=no])
3772     if test $use_ccache = yes; then
3773         AC_MSG_RESULT([yes])
3774     else
3775         CC="$CCACHE $CC"
3776         CC_BASE="ccache $CC_BASE"
3777         AC_MSG_RESULT([no])
3778     fi
3779     CFLAGS=$save_CFLAGS
3780     AC_LANG_POP([C])
3783 # ===================================================================
3784 # check various GCC options that Clang does not support now but maybe
3785 # will somewhen in the future, check them even for GCC, so that the
3786 # flags are set
3787 # ===================================================================
3789 HAVE_GCC_GGDB2=
3790 if test "$GCC" = "yes"; then
3791     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3792     save_CFLAGS=$CFLAGS
3793     CFLAGS="$CFLAGS -Werror -ggdb2"
3794     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3795     CFLAGS=$save_CFLAGS
3796     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3797         AC_MSG_RESULT([yes])
3798     else
3799         AC_MSG_RESULT([no])
3800     fi
3802     if test "$host_cpu" = "m68k"; then
3803         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3804         save_CFLAGS=$CFLAGS
3805         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3806         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3807         CFLAGS=$save_CFLAGS
3808         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3809             AC_MSG_RESULT([yes])
3810         else
3811             AC_MSG_ERROR([no])
3812         fi
3813     fi
3815 AC_SUBST(HAVE_GCC_GGDB2)
3817 dnl ===================================================================
3818 dnl  Test the gcc version
3819 dnl ===================================================================
3820 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3821     AC_MSG_CHECKING([the GCC version])
3822     _gcc_version=`$CC -dumpversion`
3823     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3824         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3825     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3827     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3829     if test "$gcc_full_version" -lt 70000; then
3830         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3831     fi
3832 else
3833     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3834     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3835     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3836     # (which reports itself as GCC 4.2.1).
3837     GCC_VERSION=
3839 AC_SUBST(GCC_VERSION)
3841 dnl Set the ENABLE_DBGUTIL variable
3842 dnl ===================================================================
3843 AC_MSG_CHECKING([whether to build with additional debug utilities])
3844 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3845     ENABLE_DBGUTIL="TRUE"
3846     # this is an extra var so it can have different default on different MSVC
3847     # versions (in case there are version specific problems with it)
3848     MSVC_USE_DEBUG_RUNTIME="TRUE"
3850     AC_MSG_RESULT([yes])
3851     # cppunit and graphite expose STL in public headers
3852     if test "$with_system_cppunit" = "yes"; then
3853         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3854     else
3855         with_system_cppunit=no
3856     fi
3857     if test "$with_system_graphite" = "yes"; then
3858         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3859     else
3860         with_system_graphite=no
3861     fi
3862     if test "$with_system_orcus" = "yes"; then
3863         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3864     else
3865         with_system_orcus=no
3866     fi
3867     if test "$with_system_libcmis" = "yes"; then
3868         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3869     else
3870         with_system_libcmis=no
3871     fi
3872     if test "$with_system_hunspell" = "yes"; then
3873         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3874     else
3875         with_system_hunspell=no
3876     fi
3877     if test "$with_system_gpgmepp" = "yes"; then
3878         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3879     else
3880         with_system_gpgmepp=no
3881     fi
3882     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3883     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3884     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3885     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3886     # of those two is using the system variant:
3887     if test "$with_system_libnumbertext" = "yes"; then
3888         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3889     else
3890         with_system_libnumbertext=no
3891     fi
3892     if test "$with_system_libwps" = "yes"; then
3893         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3894     else
3895         with_system_libwps=no
3896     fi
3897 else
3898     ENABLE_DBGUTIL=""
3899     MSVC_USE_DEBUG_RUNTIME=""
3900     AC_MSG_RESULT([no])
3902 AC_SUBST(ENABLE_DBGUTIL)
3903 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3905 dnl Set the ENABLE_DEBUG variable.
3906 dnl ===================================================================
3907 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3908     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3910 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3911     if test -z "$libo_fuzzed_enable_debug"; then
3912         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3913     else
3914         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3915         enable_debug=yes
3916     fi
3919 AC_MSG_CHECKING([whether to do a debug build])
3920 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3921     ENABLE_DEBUG="TRUE"
3922     if test -n "$ENABLE_DBGUTIL" ; then
3923         AC_MSG_RESULT([yes (dbgutil)])
3924     else
3925         AC_MSG_RESULT([yes])
3926     fi
3927 else
3928     ENABLE_DEBUG=""
3929     AC_MSG_RESULT([no])
3931 AC_SUBST(ENABLE_DEBUG)
3933 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3934 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3935 dnl Clang 9 is known fixed since
3936 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3937 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3938 if test "$COM_IS_CLANG" = TRUE -a "$_os" = Linux; then
3939     if test "$CLANGVER" -lt 90000; then
3940         for i in $CC; do
3941             case $i in
3942             -fsanitize=*)
3943                 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3944                 break
3945                 ;;
3946             esac
3947         done
3948     fi
3950 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3951     AC_MSG_RESULT([yes])
3952 else
3953     AC_MSG_RESULT([no])
3955 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3957 dnl ===================================================================
3958 dnl Select the linker to use (gold/lld/ld.bfd).
3959 dnl This is done only after compiler checks (need to know if Clang is
3960 dnl used, for different defaults) and after checking if a debug build
3961 dnl is wanted (non-debug builds get the default linker if not explicitly
3962 dnl specified otherwise).
3963 dnl All checks for linker features/options should come after this.
3964 dnl ===================================================================
3965 check_use_ld()
3967     use_ld=$1
3968     use_ld_fail_if_error=$2
3969     use_ld_ok=
3970     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3971     use_ld_ldflags_save="$LDFLAGS"
3972     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3973     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3974 #include <stdio.h>
3975         ],[
3976 printf ("hello world\n");
3977         ])], USE_LD=$use_ld, [])
3978     if test -n "$USE_LD"; then
3979         AC_MSG_RESULT( yes )
3980         use_ld_ok=yes
3981         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3982         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3983         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3984             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3985             use_ld_ldflags_save_2="$LDFLAGS"
3986             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3987             use_ld_has_cpp_typeinfo=
3988             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3989 #include <stdio.h>
3990                 ],[
3991 printf ("hello world\n");
3992                 ])], use_ld_has_cpp_typeinfo=yes, [])
3993             LDFLAGS="$use_ld_ldflags_save_2"
3994             if test -n "$use_ld_has_cpp_typeinfo"; then
3995                 AC_MSG_RESULT( yes )
3996             else
3997                 if test -n "$use_ld_fail_if_error"; then
3998                     AC_MSG_ERROR( no )
3999                 else
4000                     AC_MSG_RESULT( no )
4001                 fi
4002                 use_ld_ok=
4003             fi
4004         fi
4005     else
4006         if test -n "$use_ld_fail_if_error"; then
4007             AC_MSG_ERROR( no )
4008         else
4009             AC_MSG_RESULT( no )
4010         fi
4011     fi
4012     if test -n "$use_ld_ok"; then
4013         dnl keep the value of LDFLAGS
4014         return 0
4015     fi
4016     LDFLAGS="$use_ld_ldflags_save"
4017     return 1
4019 USE_LD=
4020 if test "$enable_ld" != "no"; then
4021     if test "$GCC" = "yes"; then
4022         if test -n "$enable_ld"; then
4023             check_use_ld "$enable_ld" fail_if_error
4024         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4025             dnl non-debug builds default to the default linker
4026             true
4027         elif test -n "$COM_IS_CLANG"; then
4028             check_use_ld lld
4029             if test $? -ne 0; then
4030                 check_use_ld gold
4031             fi
4032         else
4033             # For gcc first try gold, new versions also support lld.
4034             check_use_ld gold
4035             if test $? -ne 0; then
4036                 check_use_ld lld
4037             fi
4038         fi
4039         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4040         rm conftest.out
4041         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4042         if test -z "$ld_used"; then
4043             ld_used="unknown"
4044         fi
4045         AC_MSG_CHECKING([for linker that is used])
4046         AC_MSG_RESULT([$ld_used])
4047         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4048             if echo "$ld_used" | grep -q "^GNU ld"; then
4049                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4050                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4051             fi
4052         fi
4053     else
4054         if test "$enable_ld" = "yes"; then
4055             AC_MSG_ERROR([--enable-ld not supported])
4056         fi
4057     fi
4059 AC_SUBST(USE_LD)
4061 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4062 if test "$GCC" = "yes"; then
4063     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4064     bsymbolic_functions_ldflags_save=$LDFLAGS
4065     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4066     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4067 #include <stdio.h>
4068         ],[
4069 printf ("hello world\n");
4070         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4071     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4072         AC_MSG_RESULT( found )
4073     else
4074         AC_MSG_RESULT( not found )
4075     fi
4076     LDFLAGS=$bsymbolic_functions_ldflags_save
4078 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4081 HAVE_GSPLIT_DWARF=
4082 if test "$enable_split_debug" != no; then
4083     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4084     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4085         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4086         save_CFLAGS=$CFLAGS
4087         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4088         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4089         CFLAGS=$save_CFLAGS
4090         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4091             AC_MSG_RESULT([yes])
4092         else
4093             if test "$enable_split_debug" = yes; then
4094                 AC_MSG_ERROR([no])
4095             else
4096                 AC_MSG_RESULT([no])
4097             fi
4098         fi
4099     fi
4100     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4101         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4102         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4103     fi
4105 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4107 ENABLE_GDB_INDEX=
4108 if test "$enable_gdb_index" != "no"; then
4109     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4110     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4111         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4112         save_CFLAGS=$CFLAGS
4113         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4114         have_ggnu_pubnames=
4115         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4116         if test "$have_ggnu_pubnames" != "TRUE"; then
4117             if test "$enable_gdb_index" = "yes"; then
4118                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4119             else
4120                 AC_MSG_RESULT( no )
4121             fi
4122         else
4123             AC_MSG_RESULT( yes )
4124             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4125             ldflags_save=$LDFLAGS
4126             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4127             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4128 #include <stdio.h>
4129                 ],[
4130 printf ("hello world\n");
4131                 ])], ENABLE_GDB_INDEX=TRUE, [])
4132             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4133                 AC_MSG_RESULT( yes )
4134             else
4135                 if test "$enable_gdb_index" = "yes"; then
4136                     AC_MSG_ERROR( no )
4137                 else
4138                     AC_MSG_RESULT( no )
4139                 fi
4140             fi
4141             LDFLAGS=$ldflags_save
4142         fi
4143         CFLAGS=$save_CFLAGS
4144         fi
4145     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4146         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4147         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4148     fi
4150 AC_SUBST(ENABLE_GDB_INDEX)
4152 if test "$enable_sal_log" = yes; then
4153     ENABLE_SAL_LOG=TRUE
4155 AC_SUBST(ENABLE_SAL_LOG)
4157 dnl Check for enable symbols option
4158 dnl ===================================================================
4159 AC_MSG_CHECKING([whether to generate debug information])
4160 if test -z "$enable_symbols"; then
4161     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4162         enable_symbols=yes
4163     else
4164         enable_symbols=no
4165     fi
4167 if test "$enable_symbols" = yes; then
4168     ENABLE_SYMBOLS_FOR=all
4169     AC_MSG_RESULT([yes])
4170 elif test "$enable_symbols" = no; then
4171     ENABLE_SYMBOLS_FOR=
4172     AC_MSG_RESULT([no])
4173 else
4174     # Selective debuginfo.
4175     ENABLE_SYMBOLS_FOR="$enable_symbols"
4176     AC_MSG_RESULT([for "$enable_symbols"])
4178 AC_SUBST(ENABLE_SYMBOLS_FOR)
4180 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4181     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4182     AC_MSG_CHECKING([whether enough memory is available for linking])
4183     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4184     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4185     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4186         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4187     else
4188         AC_MSG_RESULT([yes])
4189     fi
4192 AC_MSG_CHECKING([whether to compile with optimization flags])
4193 if test -z "$enable_optimized"; then
4194     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4195         enable_optimized=no
4196     else
4197         enable_optimized=yes
4198     fi
4200 if test "$enable_optimized" != no; then
4201     ENABLE_OPTIMIZED=TRUE
4202     AC_MSG_RESULT([yes])
4203 else
4204     ENABLE_OPTIMIZED=
4205     AC_MSG_RESULT([no])
4207 AC_SUBST(ENABLE_OPTIMIZED)
4210 # determine CPUNAME, OS, ...
4211 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4213 case "$host_os" in
4215 aix*)
4216     COM=GCC
4217     CPUNAME=POWERPC
4218     USING_X11=TRUE
4219     OS=AIX
4220     RTL_OS=AIX
4221     RTL_ARCH=PowerPC
4222     PLATFORMID=aix_powerpc
4223     P_SEP=:
4224     ;;
4226 cygwin*)
4227     COM=MSC
4228     USING_X11=
4229     OS=WNT
4230     RTL_OS=Windows
4231     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4232         P_SEP=";"
4233     else
4234         P_SEP=:
4235     fi
4236     case "$host_cpu" in
4237     i*86|x86_64)
4238         if test "$BITNESS_OVERRIDE" = 64; then
4239             CPUNAME=X86_64
4240             RTL_ARCH=X86_64
4241             PLATFORMID=windows_x86_64
4242             WINDOWS_X64=1
4243             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4244         else
4245             CPUNAME=INTEL
4246             RTL_ARCH=x86
4247             PLATFORMID=windows_x86
4248         fi
4249         ;;
4250     *)
4251         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4252         ;;
4253     esac
4254     SCPDEFS="$SCPDEFS -D_MSC_VER"
4255     ;;
4257 darwin*)
4258     COM=GCC
4259     USING_X11=
4260     OS=MACOSX
4261     RTL_OS=MacOSX
4262     P_SEP=:
4264     case "$host_cpu" in
4265     arm)
4266         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4267         ;;
4268     arm64)
4269         OS=iOS
4270         if test "$enable_ios_simulator" = "yes"; then
4271             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4272         else
4273             CPUNAME=ARM64
4274             RTL_ARCH=ARM_EABI
4275             PLATFORMID=ios_arm64
4276         fi
4277         ;;
4278     i*86)
4279         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4280         ;;
4281     x86_64)
4282         if test "$enable_ios_simulator" = "yes"; then
4283             OS=iOS
4284         fi
4285         CPUNAME=X86_64
4286         RTL_ARCH=X86_64
4287         PLATFORMID=macosx_x86_64
4288         ;;
4289     *)
4290         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4291         ;;
4292     esac
4293     ;;
4295 dragonfly*)
4296     COM=GCC
4297     USING_X11=TRUE
4298     OS=DRAGONFLY
4299     RTL_OS=DragonFly
4300     P_SEP=:
4302     case "$host_cpu" in
4303     i*86)
4304         CPUNAME=INTEL
4305         RTL_ARCH=x86
4306         PLATFORMID=dragonfly_x86
4307         ;;
4308     x86_64)
4309         CPUNAME=X86_64
4310         RTL_ARCH=X86_64
4311         PLATFORMID=dragonfly_x86_64
4312         ;;
4313     *)
4314         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4315         ;;
4316     esac
4317     ;;
4319 freebsd*)
4320     COM=GCC
4321     USING_X11=TRUE
4322     RTL_OS=FreeBSD
4323     OS=FREEBSD
4324     P_SEP=:
4326     case "$host_cpu" in
4327     i*86)
4328         CPUNAME=INTEL
4329         RTL_ARCH=x86
4330         PLATFORMID=freebsd_x86
4331         ;;
4332     x86_64|amd64)
4333         CPUNAME=X86_64
4334         RTL_ARCH=X86_64
4335         PLATFORMID=freebsd_x86_64
4336         ;;
4337     *)
4338         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4339         ;;
4340     esac
4341     ;;
4343 haiku*)
4344     COM=GCC
4345     USING_X11=
4346     GUIBASE=haiku
4347     RTL_OS=Haiku
4348     OS=HAIKU
4349     P_SEP=:
4351     case "$host_cpu" in
4352     i*86)
4353         CPUNAME=INTEL
4354         RTL_ARCH=x86
4355         PLATFORMID=haiku_x86
4356         ;;
4357     x86_64|amd64)
4358         CPUNAME=X86_64
4359         RTL_ARCH=X86_64
4360         PLATFORMID=haiku_x86_64
4361         ;;
4362     *)
4363         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4364         ;;
4365     esac
4366     ;;
4368 kfreebsd*)
4369     COM=GCC
4370     USING_X11=TRUE
4371     OS=LINUX
4372     RTL_OS=kFreeBSD
4373     P_SEP=:
4375     case "$host_cpu" in
4377     i*86)
4378         CPUNAME=INTEL
4379         RTL_ARCH=x86
4380         PLATFORMID=kfreebsd_x86
4381         ;;
4382     x86_64)
4383         CPUNAME=X86_64
4384         RTL_ARCH=X86_64
4385         PLATFORMID=kfreebsd_x86_64
4386         ;;
4387     *)
4388         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4389         ;;
4390     esac
4391     ;;
4393 linux-gnu*)
4394     COM=GCC
4395     USING_X11=TRUE
4396     OS=LINUX
4397     RTL_OS=Linux
4398     P_SEP=:
4400     case "$host_cpu" in
4402     aarch64)
4403         CPUNAME=AARCH64
4404         PLATFORMID=linux_aarch64
4405         RTL_ARCH=AARCH64
4406         ;;
4407     alpha)
4408         CPUNAME=AXP
4409         RTL_ARCH=ALPHA
4410         PLATFORMID=linux_alpha
4411         ;;
4412     arm*)
4413         CPUNAME=ARM
4414         EPM_FLAGS="-a arm"
4415         RTL_ARCH=ARM_EABI
4416         PLATFORMID=linux_arm_eabi
4417         case "$host_cpu" in
4418         arm*-linux)
4419             RTL_ARCH=ARM_OABI
4420             PLATFORMID=linux_arm_oabi
4421             ;;
4422         esac
4423         ;;
4424     hppa)
4425         CPUNAME=HPPA
4426         RTL_ARCH=HPPA
4427         EPM_FLAGS="-a hppa"
4428         PLATFORMID=linux_hppa
4429         ;;
4430     i*86)
4431         CPUNAME=INTEL
4432         RTL_ARCH=x86
4433         PLATFORMID=linux_x86
4434         ;;
4435     ia64)
4436         CPUNAME=IA64
4437         RTL_ARCH=IA64
4438         PLATFORMID=linux_ia64
4439         ;;
4440     mips)
4441         CPUNAME=GODSON
4442         RTL_ARCH=MIPS_EB
4443         EPM_FLAGS="-a mips"
4444         PLATFORMID=linux_mips_eb
4445         ;;
4446     mips64)
4447         CPUNAME=GODSON64
4448         RTL_ARCH=MIPS64_EB
4449         EPM_FLAGS="-a mips64"
4450         PLATFORMID=linux_mips64_eb
4451         ;;
4452     mips64el)
4453         CPUNAME=GODSON64
4454         RTL_ARCH=MIPS64_EL
4455         EPM_FLAGS="-a mips64el"
4456         PLATFORMID=linux_mips64_el
4457         ;;
4458     mipsel)
4459         CPUNAME=GODSON
4460         RTL_ARCH=MIPS_EL
4461         EPM_FLAGS="-a mipsel"
4462         PLATFORMID=linux_mips_el
4463         ;;
4464     m68k)
4465         CPUNAME=M68K
4466         RTL_ARCH=M68K
4467         PLATFORMID=linux_m68k
4468         ;;
4469     powerpc)
4470         CPUNAME=POWERPC
4471         RTL_ARCH=PowerPC
4472         PLATFORMID=linux_powerpc
4473         ;;
4474     powerpc64)
4475         CPUNAME=POWERPC64
4476         RTL_ARCH=PowerPC_64
4477         PLATFORMID=linux_powerpc64
4478         ;;
4479     powerpc64le)
4480         CPUNAME=POWERPC64
4481         RTL_ARCH=PowerPC_64_LE
4482         PLATFORMID=linux_powerpc64_le
4483         ;;
4484     sparc)
4485         CPUNAME=SPARC
4486         RTL_ARCH=SPARC
4487         PLATFORMID=linux_sparc
4488         ;;
4489     sparc64)
4490         CPUNAME=SPARC64
4491         RTL_ARCH=SPARC64
4492         PLATFORMID=linux_sparc64
4493         ;;
4494     s390)
4495         CPUNAME=S390
4496         RTL_ARCH=S390
4497         PLATFORMID=linux_s390
4498         ;;
4499     s390x)
4500         CPUNAME=S390X
4501         RTL_ARCH=S390x
4502         PLATFORMID=linux_s390x
4503         ;;
4504     x86_64)
4505         CPUNAME=X86_64
4506         RTL_ARCH=X86_64
4507         PLATFORMID=linux_x86_64
4508         ;;
4509     *)
4510         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4511         ;;
4512     esac
4513     ;;
4515 linux-android*)
4516     COM=GCC
4517     USING_X11=
4518     OS=ANDROID
4519     RTL_OS=Android
4520     P_SEP=:
4522     case "$host_cpu" in
4524     arm|armel)
4525         CPUNAME=ARM
4526         RTL_ARCH=ARM_EABI
4527         PLATFORMID=android_arm_eabi
4528         ;;
4529     aarch64)
4530         CPUNAME=AARCH64
4531         RTL_ARCH=AARCH64
4532         PLATFORMID=android_aarch64
4533         ;;
4534     mips|mipsel)
4535         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4536         RTL_ARCH=MIPS_EL
4537         PLATFORMID=android_mips_el
4538         ;;
4539     i*86)
4540         CPUNAME=INTEL
4541         RTL_ARCH=x86
4542         PLATFORMID=android_x86
4543         ;;
4544     *)
4545         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4546         ;;
4547     esac
4548     ;;
4550 *netbsd*)
4551     COM=GCC
4552     USING_X11=TRUE
4553     OS=NETBSD
4554     RTL_OS=NetBSD
4555     P_SEP=:
4557     case "$host_cpu" in
4558     i*86)
4559         CPUNAME=INTEL
4560         RTL_ARCH=x86
4561         PLATFORMID=netbsd_x86
4562         ;;
4563     powerpc)
4564         CPUNAME=POWERPC
4565         RTL_ARCH=PowerPC
4566         PLATFORMID=netbsd_powerpc
4567         ;;
4568     sparc)
4569         CPUNAME=SPARC
4570         RTL_ARCH=SPARC
4571         PLATFORMID=netbsd_sparc
4572         ;;
4573     x86_64)
4574         CPUNAME=X86_64
4575         RTL_ARCH=X86_64
4576         PLATFORMID=netbsd_x86_64
4577         ;;
4578     *)
4579         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4580         ;;
4581     esac
4582     ;;
4584 openbsd*)
4585     COM=GCC
4586     USING_X11=TRUE
4587     OS=OPENBSD
4588     RTL_OS=OpenBSD
4589     P_SEP=:
4591     case "$host_cpu" in
4592     i*86)
4593         CPUNAME=INTEL
4594         RTL_ARCH=x86
4595         PLATFORMID=openbsd_x86
4596         ;;
4597     x86_64)
4598         CPUNAME=X86_64
4599         RTL_ARCH=X86_64
4600         PLATFORMID=openbsd_x86_64
4601         ;;
4602     *)
4603         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4604         ;;
4605     esac
4606     SOLARINC="$SOLARINC -I/usr/local/include"
4607     ;;
4609 solaris*)
4610     COM=GCC
4611     USING_X11=TRUE
4612     OS=SOLARIS
4613     RTL_OS=Solaris
4614     P_SEP=:
4616     case "$host_cpu" in
4617     i*86)
4618         CPUNAME=INTEL
4619         RTL_ARCH=x86
4620         PLATFORMID=solaris_x86
4621         ;;
4622     sparc)
4623         CPUNAME=SPARC
4624         RTL_ARCH=SPARC
4625         PLATFORMID=solaris_sparc
4626         ;;
4627     sparc64)
4628         CPUNAME=SPARC64
4629         RTL_ARCH=SPARC64
4630         PLATFORMID=solaris_sparc64
4631         ;;
4632     *)
4633         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4634         ;;
4635     esac
4636     SOLARINC="$SOLARINC -I/usr/local/include"
4637     ;;
4640     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4641     ;;
4642 esac
4644 if test "$with_x" = "no"; then
4645     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4648 DISABLE_GUI=""
4649 if test "$enable_gui" = "no"; then
4650     if test "$USING_X11" != TRUE; then
4651         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4652     fi
4653     USING_X11=
4654     DISABLE_GUI=TRUE
4655     AC_DEFINE(HAVE_FEATURE_UI,0)
4656     test_cairo=yes
4658 AC_SUBST(DISABLE_GUI)
4660 WORKDIR="${BUILDDIR}/workdir"
4661 INSTDIR="${BUILDDIR}/instdir"
4662 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4663 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4664 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4665 AC_SUBST(COM)
4666 AC_SUBST(CPUNAME)
4667 AC_SUBST(RTL_OS)
4668 AC_SUBST(RTL_ARCH)
4669 AC_SUBST(EPM_FLAGS)
4670 AC_SUBST(USING_X11)
4671 AC_SUBST([INSTDIR])
4672 AC_SUBST([INSTROOT])
4673 AC_SUBST([INSTROOTBASE])
4674 AC_SUBST(OS)
4675 AC_SUBST(P_SEP)
4676 AC_SUBST(WORKDIR)
4677 AC_SUBST(PLATFORMID)
4678 AC_SUBST(WINDOWS_X64)
4679 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4681 dnl ===================================================================
4682 dnl Test which package format to use
4683 dnl ===================================================================
4684 AC_MSG_CHECKING([which package format to use])
4685 if test -n "$with_package_format" -a "$with_package_format" != no; then
4686     for i in $with_package_format; do
4687         case "$i" in
4688         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4689             ;;
4690         *)
4691             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4692 aix - AIX software distribution
4693 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4694 deb - Debian software distribution
4695 pkg - Solaris software distribution
4696 rpm - RedHat software distribution
4698 LibreOffice additionally supports:
4699 archive - .tar.gz or .zip
4700 dmg - macOS .dmg
4701 installed - installation tree
4702 msi - Windows .msi
4703         ])
4704             ;;
4705         esac
4706     done
4707     # fakeroot is needed to ensure correct file ownerships/permissions
4708     # inside deb packages and tar archives created on Linux and Solaris.
4709     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4710         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4711         if test "$FAKEROOT" = "no"; then
4712             AC_MSG_ERROR(
4713                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4714         fi
4715     fi
4716     PKGFORMAT="$with_package_format"
4717     AC_MSG_RESULT([$PKGFORMAT])
4718 else
4719     PKGFORMAT=
4720     AC_MSG_RESULT([none])
4722 AC_SUBST(PKGFORMAT)
4724 dnl ===================================================================
4725 dnl Set up a different compiler to produce tools to run on the build
4726 dnl machine when doing cross-compilation
4727 dnl ===================================================================
4729 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4730 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4731 if test "$cross_compiling" = "yes"; then
4732     AC_MSG_CHECKING([for BUILD platform configuration])
4733     echo
4734     rm -rf CONF-FOR-BUILD config_build.mk
4735     mkdir CONF-FOR-BUILD
4736     # Here must be listed all files needed when running the configure script. In particular, also
4737     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4738     # keep them in the same order as there.
4739     (cd $SRC_ROOT && tar cf - \
4740         config.guess \
4741         bin/get_config_variables \
4742         solenv/bin/getcompver.awk \
4743         solenv/inc/langlist.mk \
4744         download.lst \
4745         config_host.mk.in \
4746         config_host_lang.mk.in \
4747         Makefile.in \
4748         bin/bffvalidator.sh.in \
4749         bin/odfvalidator.sh.in \
4750         bin/officeotron.sh.in \
4751         instsetoo_native/util/openoffice.lst.in \
4752         config_host/*.in \
4753         sysui/desktop/macosx/Info.plist.in) \
4754     | (cd CONF-FOR-BUILD && tar xf -)
4755     cp configure CONF-FOR-BUILD
4756     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4757     (
4758     unset COM USING_X11 OS CPUNAME
4759     unset CC CXX SYSBASE CFLAGS
4760     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4761     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4762     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4763     if test -n "$CC_FOR_BUILD"; then
4764         export CC="$CC_FOR_BUILD"
4765         CC_BASE=`first_arg_basename "$CC"`
4766     fi
4767     if test -n "$CXX_FOR_BUILD"; then
4768         export CXX="$CXX_FOR_BUILD"
4769         CXX_BASE=`first_arg_basename "$CXX"`
4770     fi
4771     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4772     cd CONF-FOR-BUILD
4773     sub_conf_opts=""
4774     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4775     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4776     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4777     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4778     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4779     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4780     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4781     # Don't bother having configure look for stuff not needed for the build platform anyway
4782     ./configure \
4783         --disable-cups \
4784         --disable-gstreamer-1-0 \
4785         --disable-gtk \
4786         --disable-gtk3 \
4787         --disable-pdfimport \
4788         --disable-postgresql-sdbc \
4789         --with-parallelism="$with_parallelism" \
4790         --without-doxygen \
4791         --without-java \
4792         $sub_conf_opts \
4793         --srcdir=$srcdir \
4794         2>&1 | sed -e 's/^/    /'
4795     test -f ./config_host.mk 2>/dev/null || exit
4796     cp config_host.mk ../config_build.mk
4797     cp config_host_lang.mk ../config_build_lang.mk
4798     mv config.log ../config.Build.log
4799     mkdir -p ../config_build
4800     mv config_host/*.h ../config_build
4801     . ./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
4803     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
4804         VV='$'$V
4805         VV=`eval "echo $VV"`
4806         if test -n "$VV"; then
4807             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4808             echo "$line" >>build-config
4809         fi
4810     done
4812     for V in INSTDIR INSTROOT WORKDIR; do
4813         VV='$'$V
4814         VV=`eval "echo $VV"`
4815         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4816         if test -n "$VV"; then
4817             line="${V}_FOR_BUILD='$VV'"
4818             echo "$line" >>build-config
4819         fi
4820     done
4822     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4823     echo "$line" >>build-config
4825     )
4826     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4827     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])
4828     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4829              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4831     eval `cat CONF-FOR-BUILD/build-config`
4833     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4835     rm -rf CONF-FOR-BUILD
4836 else
4837     OS_FOR_BUILD="$OS"
4838     CC_FOR_BUILD="$CC"
4839     CXX_FOR_BUILD="$CXX"
4840     INSTDIR_FOR_BUILD="$INSTDIR"
4841     INSTROOT_FOR_BUILD="$INSTROOT"
4842     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4843     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4844     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4845     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4846     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4847     WORKDIR_FOR_BUILD="$WORKDIR"
4849 AC_SUBST(OS_FOR_BUILD)
4850 AC_SUBST(INSTDIR_FOR_BUILD)
4851 AC_SUBST(INSTROOT_FOR_BUILD)
4852 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4853 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4854 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4855 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4856 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4857 AC_SUBST(WORKDIR_FOR_BUILD)
4859 dnl ===================================================================
4860 dnl Check for syslog header
4861 dnl ===================================================================
4862 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4864 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4865 dnl ===================================================================
4866 AC_MSG_CHECKING([whether to turn warnings to errors])
4867 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4868     ENABLE_WERROR="TRUE"
4869     AC_MSG_RESULT([yes])
4870 else
4871     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4872         ENABLE_WERROR="TRUE"
4873         AC_MSG_RESULT([yes])
4874     else
4875         AC_MSG_RESULT([no])
4876     fi
4878 AC_SUBST(ENABLE_WERROR)
4880 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4881 dnl ===================================================================
4882 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4883 if test -z "$enable_assert_always_abort"; then
4884    if test "$ENABLE_DEBUG" = TRUE; then
4885        enable_assert_always_abort=yes
4886    else
4887        enable_assert_always_abort=no
4888    fi
4890 if test "$enable_assert_always_abort" = "yes"; then
4891     ASSERT_ALWAYS_ABORT="TRUE"
4892     AC_MSG_RESULT([yes])
4893 else
4894     ASSERT_ALWAYS_ABORT="FALSE"
4895     AC_MSG_RESULT([no])
4897 AC_SUBST(ASSERT_ALWAYS_ABORT)
4899 # Determine whether to use ooenv for the instdir installation
4900 # ===================================================================
4901 if test $_os != "WINNT" -a $_os != "Darwin"; then
4902     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4903     if test "$enable_ooenv" = "no"; then
4904         AC_MSG_RESULT([no])
4905     else
4906         ENABLE_OOENV="TRUE"
4907         AC_MSG_RESULT([yes])
4908     fi
4910 AC_SUBST(ENABLE_OOENV)
4912 if test "$USING_X11" != TRUE; then
4913     # be sure to do not mess with unneeded stuff
4914     test_randr=no
4915     test_xrender=no
4916     test_cups=no
4917     test_dbus=no
4918     test_gtk=no
4919     build_gstreamer_1_0=no
4920     test_kf5=no
4921     test_qt5=no
4922     test_gtk3_kde5=no
4923     enable_cairo_canvas=no
4926 if test "$OS" = "HAIKU"; then
4927     enable_cairo_canvas=yes
4928     test_kf5=yes
4931 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4932     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!])
4933     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!"
4934     test_kf5=yes
4937 if test "$test_kf5" = "yes"; then
4938     test_qt5=yes
4941 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4942     if test "$enable_qt5" = "no"; then
4943         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4944     else
4945         enable_qt5=yes
4946     fi
4949 dnl ===================================================================
4950 dnl check for cups support
4951 dnl ===================================================================
4952 ENABLE_CUPS=""
4954 if test "$enable_cups" = "no"; then
4955     test_cups=no
4958 AC_MSG_CHECKING([whether to enable CUPS support])
4959 if test "$test_cups" = "yes"; then
4960     ENABLE_CUPS="TRUE"
4961     AC_MSG_RESULT([yes])
4963     AC_MSG_CHECKING([whether cups support is present])
4964     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4965     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4966     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4967         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4968     fi
4970 else
4971     AC_MSG_RESULT([no])
4974 AC_SUBST(ENABLE_CUPS)
4976 # fontconfig checks
4977 if test "$test_fontconfig" = "yes"; then
4978     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4979     SYSTEM_FONTCONFIG=TRUE
4980     FilterLibs "${FONTCONFIG_LIBS}"
4981     FONTCONFIG_LIBS="${filteredlibs}"
4983 AC_SUBST(FONTCONFIG_CFLAGS)
4984 AC_SUBST(FONTCONFIG_LIBS)
4985 AC_SUBST([SYSTEM_FONTCONFIG])
4987 dnl whether to find & fetch external tarballs?
4988 dnl ===================================================================
4989 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4990    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4991        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4992    else
4993        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4994    fi
4996 if test -z "$TARFILE_LOCATION"; then
4997     if test -d "$SRC_ROOT/src" ; then
4998         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4999         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5000     fi
5001     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5002 else
5003     AbsolutePath "$TARFILE_LOCATION"
5004     PathFormat "${absolute_path}"
5005     TARFILE_LOCATION="${formatted_path}"
5007 AC_SUBST(TARFILE_LOCATION)
5009 AC_MSG_CHECKING([whether we want to fetch tarballs])
5010 if test "$enable_fetch_external" != "no"; then
5011     if test "$with_all_tarballs" = "yes"; then
5012         AC_MSG_RESULT([yes, all of them])
5013         DO_FETCH_TARBALLS="ALL"
5014     else
5015         AC_MSG_RESULT([yes, if we use them])
5016         DO_FETCH_TARBALLS="TRUE"
5017     fi
5018 else
5019     AC_MSG_RESULT([no])
5020     DO_FETCH_TARBALLS=
5022 AC_SUBST(DO_FETCH_TARBALLS)
5024 AC_MSG_CHECKING([whether to build help])
5025 if test -n "$with_help" -a "$with_help" != "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_help" in
5029     "html")
5030         ENABLE_HTMLHELP=TRUE
5031         SCPDEFS="$SCPDEFS -DWITH_HELP"
5032         AC_MSG_RESULT([HTML])
5033         ;;
5034     "online")
5035         ENABLE_HTMLHELP=TRUE
5036         HELP_ONLINE=TRUE
5037         AC_MSG_RESULT([HTML])
5038         ;;
5039     yes)
5040         SCPDEFS="$SCPDEFS -DWITH_HELP"
5041         AC_MSG_RESULT([yes])
5042         ;;
5043     *)
5044         AC_MSG_ERROR([Unknown --with-help=$with_help])
5045         ;;
5046     esac
5047 else
5048     AC_MSG_RESULT([no])
5050 AC_SUBST([ENABLE_HTMLHELP])
5051 AC_SUBST([HELP_ONLINE])
5053 dnl Test whether to include MySpell dictionaries
5054 dnl ===================================================================
5055 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5056 if test "$with_myspell_dicts" = "yes"; then
5057     AC_MSG_RESULT([yes])
5058     WITH_MYSPELL_DICTS=TRUE
5059     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5060     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5061 else
5062     AC_MSG_RESULT([no])
5063     WITH_MYSPELL_DICTS=
5065 AC_SUBST(WITH_MYSPELL_DICTS)
5067 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5068 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5069     if test "$with_system_dicts" = yes; then
5070         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5071     fi
5072     with_system_dicts=no
5075 AC_MSG_CHECKING([whether to use dicts from external paths])
5076 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5077     AC_MSG_RESULT([yes])
5078     SYSTEM_DICTS=TRUE
5079     AC_MSG_CHECKING([for spelling dictionary directory])
5080     if test -n "$with_external_dict_dir"; then
5081         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5082     else
5083         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5084         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5085             DICT_SYSTEM_DIR=file:///usr/share/myspell
5086         fi
5087     fi
5088     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5089     AC_MSG_CHECKING([for hyphenation patterns directory])
5090     if test -n "$with_external_hyph_dir"; then
5091         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5092     else
5093         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5094     fi
5095     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5096     AC_MSG_CHECKING([for thesaurus directory])
5097     if test -n "$with_external_thes_dir"; then
5098         THES_SYSTEM_DIR=file://$with_external_thes_dir
5099     else
5100         THES_SYSTEM_DIR=file:///usr/share/mythes
5101     fi
5102     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5103 else
5104     AC_MSG_RESULT([no])
5105     SYSTEM_DICTS=
5107 AC_SUBST(SYSTEM_DICTS)
5108 AC_SUBST(DICT_SYSTEM_DIR)
5109 AC_SUBST(HYPH_SYSTEM_DIR)
5110 AC_SUBST(THES_SYSTEM_DIR)
5112 dnl ===================================================================
5113 dnl Precompiled headers.
5114 ENABLE_PCH=""
5115 AC_MSG_CHECKING([whether to enable pch feature])
5116 if test -z "$enable_pch"; then
5117     if test "$_os" = "WINNT"; then
5118         # Enabled by default on Windows.
5119         enable_pch=yes
5120     else
5121         enable_pch=no
5122     fi
5124 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5125     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5127 if test "$enable_pch" = "system"; then
5128     ENABLE_PCH="1"
5129     AC_MSG_RESULT([yes (system headers)])
5130 elif test "$enable_pch" = "base"; then
5131     ENABLE_PCH="2"
5132     AC_MSG_RESULT([yes (system and base headers)])
5133 elif test "$enable_pch" = "normal"; then
5134     ENABLE_PCH="3"
5135     AC_MSG_RESULT([yes (normal)])
5136 elif test "$enable_pch" = "full"; then
5137     ENABLE_PCH="4"
5138     AC_MSG_RESULT([yes (full)])
5139 elif test "$enable_pch" = "yes"; then
5140     # Pick a suitable default.
5141     if test "$GCC" = "yes"; then
5142         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5143         # while making the PCHs larger and rebuilds more likely.
5144         ENABLE_PCH="2"
5145         AC_MSG_RESULT([yes (system and base headers)])
5146     else
5147         # With MSVC the highest level makes a significant difference,
5148         # and it was the default when there used to be no PCH levels.
5149         ENABLE_PCH="4"
5150         AC_MSG_RESULT([yes (full)])
5151     fi
5152 elif test "$enable_pch" = "no"; then
5153     AC_MSG_RESULT([no])
5154 else
5155     AC_MSG_ERROR([Unknown value for --enable-pch])
5157 AC_SUBST(ENABLE_PCH)
5158 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5159 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5160     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5161     if test "$CCACHE_BIN" != "not found"; then
5162         AC_MSG_CHECKING([ccache version])
5163         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5164         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5165         AC_MSG_RESULT([$CCACHE_VERSION])
5166         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5167         if test "$CCACHE_NUMVER" -gt "030701"; then
5168             AC_MSG_RESULT([yes])
5169         else
5170             AC_MSG_RESULT([no (not newer than 3.7.1)])
5171             CCACHE_DEPEND_MODE=
5172         fi
5173     fi
5176 TAB=`printf '\t'`
5178 AC_MSG_CHECKING([the GNU Make version])
5179 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5180 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5181 if test "$_make_longver" -ge "038200"; then
5182     AC_MSG_RESULT([$GNUMAKE $_make_version])
5184 elif test "$_make_longver" -ge "038100"; then
5185     if test "$build_os" = "cygwin"; then
5186         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5187     fi
5188     AC_MSG_RESULT([$GNUMAKE $_make_version])
5190     dnl ===================================================================
5191     dnl Search all the common names for sha1sum
5192     dnl ===================================================================
5193     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5194     if test -z "$SHA1SUM"; then
5195         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5196     elif test "$SHA1SUM" = "openssl"; then
5197         SHA1SUM="openssl sha1"
5198     fi
5199     AC_MSG_CHECKING([for GNU Make bug 20033])
5200     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5201     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5202 A := \$(wildcard *.a)
5204 .PHONY: all
5205 all: \$(A:.a=.b)
5206 <TAB>@echo survived bug20033.
5208 .PHONY: setup
5209 setup:
5210 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5212 define d1
5213 @echo lala \$(1)
5214 @sleep 1
5215 endef
5217 define d2
5218 @echo tyty \$(1)
5219 @sleep 1
5220 endef
5222 %.b : %.a
5223 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5224 <TAB>\$(call d1,\$(CHECKSUM)),\
5225 <TAB>\$(call d2,\$(CHECKSUM)))
5227     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5228         no_parallelism_make="YES"
5229         AC_MSG_RESULT([yes, disable parallelism])
5230     else
5231         AC_MSG_RESULT([no, keep parallelism enabled])
5232     fi
5233     rm -rf $TESTGMAKEBUG20033
5234 else
5235     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5238 # find if gnumake support file function
5239 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5240 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5241 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5242     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5244 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5245 \$(file >test.txt,Success )
5247 .PHONY: all
5248 all:
5249 <TAB>@cat test.txt
5252 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5253 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5254     HAVE_GNUMAKE_FILE_FUNC=TRUE
5255     AC_MSG_RESULT([yes])
5256 else
5257     AC_MSG_RESULT([no])
5259 rm -rf $TESTGMAKEFILEFUNC
5260 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5261 AC_SUBST(GNUMAKE_WIN_NATIVE)
5263 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5264 STALE_MAKE=
5265 if test "$_make_ver_check" = ""; then
5266    STALE_MAKE=TRUE
5269 HAVE_LD_HASH_STYLE=FALSE
5270 WITH_LINKER_HASH_STYLE=
5271 AC_MSG_CHECKING([for --hash-style gcc linker support])
5272 if test "$GCC" = "yes"; then
5273     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5274         hash_styles="gnu sysv"
5275     elif test "$with_linker_hash_style" = "no"; then
5276         hash_styles=
5277     else
5278         hash_styles="$with_linker_hash_style"
5279     fi
5281     for hash_style in $hash_styles; do
5282         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5283         hash_style_ldflags_save=$LDFLAGS
5284         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5286         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5287             [
5288 #include <stdio.h>
5289             ],[
5290 printf ("");
5291             ])],
5292             [
5293                   HAVE_LD_HASH_STYLE=TRUE
5294                   WITH_LINKER_HASH_STYLE=$hash_style
5295             ],
5296             [HAVE_LD_HASH_STYLE=FALSE],
5297             [HAVE_LD_HASH_STYLE=FALSE])
5298         LDFLAGS=$hash_style_ldflags_save
5299     done
5301     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5302         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5303     else
5304         AC_MSG_RESULT( no )
5305     fi
5306     LDFLAGS=$hash_style_ldflags_save
5307 else
5308     AC_MSG_RESULT( no )
5310 AC_SUBST(HAVE_LD_HASH_STYLE)
5311 AC_SUBST(WITH_LINKER_HASH_STYLE)
5313 dnl ===================================================================
5314 dnl Check whether there's a Perl version available.
5315 dnl ===================================================================
5316 if test -z "$with_perl_home"; then
5317     AC_PATH_PROG(PERL, perl)
5318 else
5319     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5320     _perl_path="$with_perl_home/bin/perl"
5321     if test -x "$_perl_path"; then
5322         PERL=$_perl_path
5323     else
5324         AC_MSG_ERROR([$_perl_path not found])
5325     fi
5328 dnl ===================================================================
5329 dnl Testing for Perl version 5 or greater.
5330 dnl $] is the Perl version variable, it is returned as an integer
5331 dnl ===================================================================
5332 if test "$PERL"; then
5333     AC_MSG_CHECKING([the Perl version])
5334     ${PERL} -e "exit($]);"
5335     _perl_version=$?
5336     if test "$_perl_version" -lt 5; then
5337         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5338     fi
5339     AC_MSG_RESULT([Perl $_perl_version])
5340 else
5341     AC_MSG_ERROR([Perl not found, install Perl 5])
5344 dnl ===================================================================
5345 dnl Testing for required Perl modules
5346 dnl ===================================================================
5348 AC_MSG_CHECKING([for required Perl modules])
5349 perl_use_string="use Cwd ; use Digest::MD5"
5350 if test "$_os" = "WINNT"; then
5351     if test -n "$PKGFORMAT"; then
5352         for i in $PKGFORMAT; do
5353             case "$i" in
5354             msi)
5355                 # for getting fonts versions to use in MSI
5356                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5357                 ;;
5358             esac
5359         done
5360     fi
5362 if test "$with_system_hsqldb" = "yes"; then
5363     perl_use_string="$perl_use_string ; use Archive::Zip"
5365 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5366     AC_MSG_RESULT([all modules found])
5367 else
5368     AC_MSG_RESULT([failed to find some modules])
5369     # Find out which modules are missing.
5370     for i in $perl_use_string; do
5371         if test "$i" != "use" -a "$i" != ";"; then
5372             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5373                 missing_perl_modules="$missing_perl_modules $i"
5374             fi
5375         fi
5376     done
5377     AC_MSG_ERROR([
5378     The missing Perl modules are: $missing_perl_modules
5379     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5382 dnl ===================================================================
5383 dnl Check for pkg-config
5384 dnl ===================================================================
5385 if test "$_os" != "WINNT"; then
5386     PKG_PROG_PKG_CONFIG
5389 if test "$_os" != "WINNT"; then
5391     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5392     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5393     # explicitly. Or put /path/to/compiler in PATH yourself.
5395     # Use wrappers for LTO
5396     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5397         AC_CHECK_TOOL(AR,gcc-ar)
5398         AC_CHECK_TOOL(NM,gcc-nm)
5399         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5400     else
5401         AC_CHECK_TOOL(AR,ar)
5402         AC_CHECK_TOOL(NM,nm)
5403         AC_CHECK_TOOL(RANLIB,ranlib)
5404     fi
5405     AC_CHECK_TOOL(OBJDUMP,objdump)
5406     AC_CHECK_TOOL(READELF,readelf)
5407     AC_CHECK_TOOL(STRIP,strip)
5408     if test "$_os" = "WINNT"; then
5409         AC_CHECK_TOOL(DLLTOOL,dlltool)
5410         AC_CHECK_TOOL(WINDRES,windres)
5411     fi
5413 AC_SUBST(AR)
5414 AC_SUBST(DLLTOOL)
5415 AC_SUBST(NM)
5416 AC_SUBST(OBJDUMP)
5417 AC_SUBST(PKG_CONFIG)
5418 AC_SUBST(RANLIB)
5419 AC_SUBST(READELF)
5420 AC_SUBST(STRIP)
5421 AC_SUBST(WINDRES)
5423 dnl ===================================================================
5424 dnl pkg-config checks on macOS
5425 dnl ===================================================================
5427 if test $_os = Darwin; then
5428     AC_MSG_CHECKING([for bogus pkg-config])
5429     if test -n "$PKG_CONFIG"; then
5430         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5431             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5432         else
5433             if test "$enable_bogus_pkg_config" = "yes"; then
5434                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5435             else
5436                 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.])
5437             fi
5438         fi
5439     else
5440         AC_MSG_RESULT([no, good])
5441     fi
5444 find_csc()
5446     # Return value: $csctest
5448     unset csctest
5450     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5451     if test -n "$regvalue"; then
5452         csctest=$regvalue
5453         return
5454     fi
5457 find_al()
5459     # Return value: $altest
5461     unset altest
5463     # We need this check to detect 4.6.1 or above.
5464     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5465         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5466         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5467             altest=$regvalue
5468             return
5469         fi
5470     done
5472     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5473         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5474         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5475             altest=$regvalue
5476             return
5477         fi
5478     done
5483 find_dotnetsdk46()
5485     unset frametest
5487     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5488         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5489         if test -n "$regvalue"; then
5490             frametest=$regvalue
5491             return
5492         fi
5493     done
5496 find_winsdk_version()
5498     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5499     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5501     unset winsdktest winsdkbinsubdir winsdklibsubdir
5503     case "$1" in
5504     8.0|8.0A)
5505         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5506         if test -n "$regvalue"; then
5507             winsdktest=$regvalue
5508             winsdklibsubdir=win8
5509             return
5510         fi
5511         ;;
5512     8.1|8.1A)
5513         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5514         if test -n "$regvalue"; then
5515             winsdktest=$regvalue
5516             winsdklibsubdir=winv6.3
5517             return
5518         fi
5519         ;;
5520     10.0)
5521         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5522         if test -n "$regvalue"; then
5523             winsdktest=$regvalue
5524             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5525             if test -n "$regvalue"; then
5526                 winsdkbinsubdir="$regvalue".0
5527                 winsdklibsubdir=$winsdkbinsubdir
5528                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5529                 # test exist the SDK path
5530                 if test -d "$tmppath"; then
5531                    # when path is convertible to a short path then path is okay
5532                    cygpath -d "$tmppath" >/dev/null 2>&1
5533                    if test $? -ne 0; then
5534                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5535                    fi
5536                 else
5537                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5538                 fi
5539             fi
5540             return
5541         fi
5542         ;;
5543     esac
5546 find_winsdk()
5548     # Return value: From find_winsdk_version
5550     unset winsdktest
5552     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5553         find_winsdk_version $ver
5554         if test -n "$winsdktest"; then
5555             return
5556         fi
5557     done
5560 find_msms()
5562     AC_MSG_CHECKING([for MSVC merge modules directory])
5563     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5564     case "$VCVER" in
5565         150|160)
5566         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5567         ;;
5568     esac
5569     for f in $my_msm_files; do
5570         echo "$as_me:$LINENO: searching for $f" >&5
5571     done
5573     msmdir=
5574     for ver in 14.0 15.0; do
5575         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5576         if test -n "$regvalue"; then
5577             for f in ${my_msm_files}; do
5578                 if test -e "$regvalue/${f}"; then
5579                     msmdir=$regvalue
5580                     break
5581                 fi
5582             done
5583         fi
5584     done
5585     dnl Is the following fallback really necessary, or was it added in response
5586     dnl to never having started Visual Studio on a given machine, so the
5587     dnl registry keys checked above had presumably not yet been created?
5588     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5589     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5590     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5591     dnl expanding to "C:\Program Files\Common Files"), which would need
5592     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5593     dnl obtain its value from cygwin:
5594     if test -z "$msmdir"; then
5595         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5596         for f in ${my_msm_files}; do
5597             if test -e "$my_msm_dir/${f}"; then
5598                 msmdir=$my_msm_dir
5599             fi
5600         done
5601     fi
5603     dnl Starting from MSVC 15.0, merge modules are located in different directory
5604     case "$VCVER" in
5605     150|160)
5606         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5607             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5608             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5609             for f in ${my_msm_files}; do
5610                 if test -e "$my_msm_dir/${f}"; then
5611                     msmdir=$my_msm_dir
5612                     break
5613                 fi
5614             done
5615         done
5616         ;;
5617     esac
5619     if test -n "$msmdir"; then
5620         msmdir=`cygpath -m "$msmdir"`
5621         AC_MSG_RESULT([$msmdir])
5622     else
5623         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5624             AC_MSG_FAILURE([not found])
5625         else
5626             AC_MSG_WARN([not found (check config.log)])
5627             add_warning "MSM none of ${my_msm_files} found"
5628         fi
5629     fi
5632 find_msvc_x64_dlls()
5634     AC_MSG_CHECKING([for MSVC x64 DLL path])
5635     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5636     case "$VCVER" in
5637     150|160)
5638         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5639             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5640             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5641                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5642                 break
5643             fi
5644             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5645             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5646                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5647                 break
5648             fi
5649             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5650             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5651                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5652                 break
5653             fi
5654         done
5655         ;;
5656     esac
5657     AC_MSG_RESULT([$msvcdllpath])
5658     AC_MSG_CHECKING([for MSVC x64 DLLs])
5659     msvcdlls="msvcp140.dll vcruntime140.dll"
5660     for dll in $msvcdlls; do
5661         if ! test -f "$msvcdllpath/$dll"; then
5662             AC_MSG_FAILURE([missing $dll])
5663         fi
5664     done
5665     AC_MSG_RESULT([found all ($msvcdlls)])
5668 dnl =========================================
5669 dnl Check for the Windows  SDK.
5670 dnl =========================================
5671 if test "$_os" = "WINNT"; then
5672     AC_MSG_CHECKING([for Windows SDK])
5673     if test "$build_os" = "cygwin"; then
5674         find_winsdk
5675         WINDOWS_SDK_HOME=$winsdktest
5677         # normalize if found
5678         if test -n "$WINDOWS_SDK_HOME"; then
5679             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5680             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5681         fi
5683         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5684     fi
5686     if test -n "$WINDOWS_SDK_HOME"; then
5687         # Remove a possible trailing backslash
5688         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5690         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5691              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5692              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5693             have_windows_sdk_headers=yes
5694         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5695              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5696              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5697             have_windows_sdk_headers=yes
5698         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5699              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5700              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5701             have_windows_sdk_headers=yes
5702         else
5703             have_windows_sdk_headers=no
5704         fi
5706         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5707             have_windows_sdk_libs=yes
5708         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5709             have_windows_sdk_libs=yes
5710         else
5711             have_windows_sdk_libs=no
5712         fi
5714         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5715             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5716 the  Windows SDK are installed.])
5717         fi
5718     fi
5720     if test -z "$WINDOWS_SDK_HOME"; then
5721         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5722     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5723         WINDOWS_SDK_VERSION=80
5724         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5725     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5726         WINDOWS_SDK_VERSION=81
5727         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5728     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5729         WINDOWS_SDK_VERSION=10
5730         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5731     else
5732         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5733     fi
5734     PathFormat "$WINDOWS_SDK_HOME"
5735     WINDOWS_SDK_HOME="$formatted_path"
5736     if test "$build_os" = "cygwin"; then
5737         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5738         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5739             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5740         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5741             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5742         fi
5743     fi
5745     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5746     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5747     dnl but not in v8.0), so allow this to be overridden with a
5748     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5749     dnl and configuration error if no WiLangId.vbs is found would arguably be
5750     dnl better, but I do not know under which conditions exactly it is needed by
5751     dnl msiglobal.pm:
5752     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5753         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5754         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5755             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5756         fi
5757         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5758             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5759         fi
5760         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5761             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5762         fi
5763     fi
5764     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5765         if test -n "$with_package_format" -a "$with_package_format" != no; then
5766             for i in "$with_package_format"; do
5767                 if test "$i" = "msi"; then
5768                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5769                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5770                     fi
5771                 fi
5772             done
5773         fi
5774     fi
5776 AC_SUBST(WINDOWS_SDK_HOME)
5777 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5778 AC_SUBST(WINDOWS_SDK_VERSION)
5779 AC_SUBST(WINDOWS_SDK_WILANGID)
5781 if test "$build_os" = "cygwin"; then
5782     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5783     dnl dir, it also determines that dir's path w/o an arch segment if any,
5784     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5785     AC_MSG_CHECKING([for midl.exe])
5787     find_winsdk
5788     if test -n "$winsdkbinsubdir" \
5789         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5790     then
5791         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5792         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5793     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5794         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5795         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5796     elif test -f "$winsdktest/Bin/midl.exe"; then
5797         MIDL_PATH=$winsdktest/Bin
5798         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5799     fi
5800     if test ! -f "$MIDL_PATH/midl.exe"; then
5801         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5802     else
5803         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5804     fi
5806     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5807     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5809     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5810          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5811          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5812          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5813     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5814          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5815          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5816          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5817     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5818          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5819          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5820          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5821     else
5822         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5823     fi
5825     dnl Check csc.exe
5826     AC_MSG_CHECKING([for csc.exe])
5827     find_csc
5828     if test -f "$csctest/csc.exe"; then
5829         CSC_PATH="$csctest"
5830     fi
5831     if test ! -f "$CSC_PATH/csc.exe"; then
5832         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5833     else
5834         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5835     fi
5837     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5839     dnl Check al.exe
5840     AC_MSG_CHECKING([for al.exe])
5841     find_winsdk
5842     if test -n "$winsdkbinsubdir" \
5843         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5844     then
5845         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5846     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5847         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5848     elif test -f "$winsdktest/Bin/al.exe"; then
5849         AL_PATH="$winsdktest/Bin"
5850     fi
5852     if test -z "$AL_PATH"; then
5853         find_al
5854         if test -f "$altest/bin/al.exe"; then
5855             AL_PATH="$altest/bin"
5856         elif test -f "$altest/al.exe"; then
5857             AL_PATH="$altest"
5858         fi
5859     fi
5860     if test ! -f "$AL_PATH/al.exe"; then
5861         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5862     else
5863         AC_MSG_RESULT([$AL_PATH/al.exe])
5864     fi
5866     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5868     dnl Check mscoree.lib / .NET Framework dir
5869     AC_MSG_CHECKING(.NET Framework)
5870     find_dotnetsdk46
5871     PathFormat "$frametest"
5872     frametest="$formatted_path"
5873     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5874         DOTNET_FRAMEWORK_HOME="$frametest"
5875     else
5876         find_winsdk
5877         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5878             DOTNET_FRAMEWORK_HOME="$winsdktest"
5879         fi
5880     fi
5881     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
5882         AC_MSG_ERROR([mscoree.lib not found])
5883     fi
5884     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5886     PathFormat "$MIDL_PATH"
5887     MIDL_PATH="$formatted_path"
5889     PathFormat "$AL_PATH"
5890     AL_PATH="$formatted_path"
5892     PathFormat "$DOTNET_FRAMEWORK_HOME"
5893     DOTNET_FRAMEWORK_HOME="$formatted_path"
5895     PathFormat "$CSC_PATH"
5896     CSC_PATH="$formatted_path"
5899 dnl ===================================================================
5900 dnl Check if stdc headers are available excluding MSVC.
5901 dnl ===================================================================
5902 if test "$_os" != "WINNT"; then
5903     AC_HEADER_STDC
5906 dnl ===================================================================
5907 dnl Testing for C++ compiler and version...
5908 dnl ===================================================================
5910 if test "$_os" != "WINNT"; then
5911     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5912     save_CXXFLAGS=$CXXFLAGS
5913     AC_PROG_CXX
5914     CXXFLAGS=$save_CXXFLAGS
5915     if test -z "$CXX_BASE"; then
5916         CXX_BASE=`first_arg_basename "$CXX"`
5917     fi
5918 else
5919     if test -n "$CC" -a -z "$CXX"; then
5920         CXX="$CC"
5921         CXX_BASE="$CC_BASE"
5922     fi
5925 dnl check for GNU C++ compiler version
5926 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5927     AC_MSG_CHECKING([the GNU C++ compiler version])
5929     _gpp_version=`$CXX -dumpversion`
5930     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5932     if test "$_gpp_majmin" -lt "700"; then
5933         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5934     else
5935         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5936     fi
5938     dnl see https://code.google.com/p/android/issues/detail?id=41770
5939         glibcxx_threads=no
5940         AC_LANG_PUSH([C++])
5941         AC_REQUIRE_CPP
5942         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5943         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5944             #include <bits/c++config.h>]],[[
5945             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5946             && !defined(_GLIBCXX__PTHREADS) \
5947             && !defined(_GLIBCXX_HAS_GTHREADS)
5948             choke me
5949             #endif
5950         ]])],[AC_MSG_RESULT([yes])
5951         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5952         AC_LANG_POP([C++])
5953         if test $glibcxx_threads = yes; then
5954             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5955         fi
5957 AC_SUBST(BOOST_CXXFLAGS)
5960 # prefx CXX with ccache if needed
5962 if test "$CCACHE" != ""; then
5963     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5964     AC_LANG_PUSH([C++])
5965     save_CXXFLAGS=$CXXFLAGS
5966     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5967     dnl an empty program will do, we're checking the compiler flags
5968     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5969                       [use_ccache=yes], [use_ccache=no])
5970     if test $use_ccache = yes; then
5971         AC_MSG_RESULT([yes])
5972     else
5973         CXX="$CCACHE $CXX"
5974         CXX_BASE="ccache $CXX_BASE"
5975         AC_MSG_RESULT([no])
5976     fi
5977     CXXFLAGS=$save_CXXFLAGS
5978     AC_LANG_POP([C++])
5981 dnl ===================================================================
5982 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5983 dnl ===================================================================
5985 if test "$_os" != "WINNT"; then
5986     AC_PROG_CXXCPP
5988     dnl Check whether there's a C pre-processor.
5989     AC_PROG_CPP
5993 dnl ===================================================================
5994 dnl Find integral type sizes and alignments
5995 dnl ===================================================================
5997 if test "$_os" != "WINNT"; then
5999 if test "$_os" == "iOS"; then
6000     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6001     ac_cv_sizeof_long=8
6002     ac_cv_sizeof_short=2
6003     ac_cv_sizeof_int=4
6004     ac_cv_sizeof_long_long=8
6005     ac_cv_sizeof_double=8
6006     ac_cv_sizeof_voidp=8
6007 else
6008     AC_CHECK_SIZEOF(long)
6009     AC_CHECK_SIZEOF(short)
6010     AC_CHECK_SIZEOF(int)
6011     AC_CHECK_SIZEOF(long long)
6012     AC_CHECK_SIZEOF(double)
6013     AC_CHECK_SIZEOF(void*)
6016     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6017     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6018     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6019     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6020     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6022     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6023     m4_pattern_allow([AC_CHECK_ALIGNOF])
6024     m4_ifdef([AC_CHECK_ALIGNOF],
6025         [
6026             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6027             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6028             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6029             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6030         ],
6031         [
6032             case "$_os-$host_cpu" in
6033             Linux-i686)
6034                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6035                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6036                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6037                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6038                 ;;
6039             Linux-x86_64)
6040                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6041                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6042                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6043                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6044                 ;;
6045             *)
6046                 if test -z "$ac_cv_alignof_short" -o \
6047                         -z "$ac_cv_alignof_int" -o \
6048                         -z "$ac_cv_alignof_long" -o \
6049                         -z "$ac_cv_alignof_double"; then
6050                    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.])
6051                 fi
6052                 ;;
6053             esac
6054         ])
6056     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6057     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6058     if test $ac_cv_sizeof_long -eq 8; then
6059         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6060     elif test $ac_cv_sizeof_double -eq 8; then
6061         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6062     else
6063         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6064     fi
6066     dnl Check for large file support
6067     AC_SYS_LARGEFILE
6068     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6069         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6070     fi
6071     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6072         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6073     fi
6074 else
6075     # Hardcode for MSVC
6076     SAL_TYPES_SIZEOFSHORT=2
6077     SAL_TYPES_SIZEOFINT=4
6078     SAL_TYPES_SIZEOFLONG=4
6079     SAL_TYPES_SIZEOFLONGLONG=8
6080     if test "$BITNESS_OVERRIDE" = ""; then
6081         SAL_TYPES_SIZEOFPOINTER=4
6082     else
6083         SAL_TYPES_SIZEOFPOINTER=8
6084     fi
6085     SAL_TYPES_ALIGNMENT2=2
6086     SAL_TYPES_ALIGNMENT4=4
6087     SAL_TYPES_ALIGNMENT8=8
6088     LFS_CFLAGS=''
6090 AC_SUBST(LFS_CFLAGS)
6092 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6093 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6094 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6095 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6096 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6097 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6098 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6099 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6101 dnl ===================================================================
6102 dnl Check whether to enable runtime optimizations
6103 dnl ===================================================================
6104 ENABLE_RUNTIME_OPTIMIZATIONS=
6105 AC_MSG_CHECKING([whether to enable runtime optimizations])
6106 if test -z "$enable_runtime_optimizations"; then
6107     for i in $CC; do
6108         case $i in
6109         -fsanitize=*)
6110             enable_runtime_optimizations=no
6111             break
6112             ;;
6113         esac
6114     done
6116 if test "$enable_runtime_optimizations" != no; then
6117     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6118     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6119     AC_MSG_RESULT([yes])
6120 else
6121     AC_MSG_RESULT([no])
6123 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6125 dnl ===================================================================
6126 dnl Check if valgrind headers are available
6127 dnl ===================================================================
6128 ENABLE_VALGRIND=
6129 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6130     prev_cppflags=$CPPFLAGS
6131     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6132     # or where does it come from?
6133     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6134     AC_CHECK_HEADER([valgrind/valgrind.h],
6135         [ENABLE_VALGRIND=TRUE])
6136     CPPFLAGS=$prev_cppflags
6138 AC_SUBST([ENABLE_VALGRIND])
6139 if test -z "$ENABLE_VALGRIND"; then
6140     if test "$with_valgrind" = yes; then
6141         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6142     fi
6143     VALGRIND_CFLAGS=
6145 AC_SUBST([VALGRIND_CFLAGS])
6148 dnl ===================================================================
6149 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6150 dnl ===================================================================
6152 # We need at least the sys/sdt.h include header.
6153 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6154 if test "$SDT_H_FOUND" = "TRUE"; then
6155     # Found sys/sdt.h header, now make sure the c++ compiler works.
6156     # Old g++ versions had problems with probes in constructors/destructors.
6157     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6158     AC_LANG_PUSH([C++])
6159     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6160     #include <sys/sdt.h>
6161     class ProbeClass
6162     {
6163     private:
6164       int& ref;
6165       const char *name;
6167     public:
6168       ProbeClass(int& v, const char *n) : ref(v), name(n)
6169       {
6170         DTRACE_PROBE2(_test_, cons, name, ref);
6171       }
6173       void method(int min)
6174       {
6175         DTRACE_PROBE3(_test_, meth, name, ref, min);
6176         ref -= min;
6177       }
6179       ~ProbeClass()
6180       {
6181         DTRACE_PROBE2(_test_, dest, name, ref);
6182       }
6183     };
6184     ]],[[
6185     int i = 64;
6186     DTRACE_PROBE1(_test_, call, i);
6187     ProbeClass inst = ProbeClass(i, "call");
6188     inst.method(24);
6189     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6190           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6191     AC_LANG_POP([C++])
6193 AC_CONFIG_HEADERS([config_host/config_probes.h])
6195 dnl ===================================================================
6196 dnl GCC features
6197 dnl ===================================================================
6198 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6199     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6200     save_CFLAGS=$CFLAGS
6201     CFLAGS="$CFLAGS -Werror -mno-avx"
6202     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6203     CFLAGS=$save_CFLAGS
6204     if test "$HAVE_GCC_AVX" = "TRUE"; then
6205         AC_MSG_RESULT([yes])
6206     else
6207         AC_MSG_RESULT([no])
6208     fi
6210     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-protector-strong])
6211     save_CFLAGS=$CFLAGS
6212     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6213     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6214     CFLAGS=$save_CFLAGS
6215     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6216         AC_MSG_RESULT([yes])
6217     else
6218         AC_MSG_RESULT([no])
6219     fi
6221     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6222     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6223     int v = 0;
6224     if (__sync_add_and_fetch(&v, 1) != 1 ||
6225         __sync_sub_and_fetch(&v, 1) != 0)
6226         return 1;
6227     __sync_synchronize();
6228     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6229         v != 1)
6230         return 1;
6231     return 0;
6232 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6233     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6234         AC_MSG_RESULT([yes])
6235         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6236     else
6237         AC_MSG_RESULT([no])
6238     fi
6240     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6241     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6242     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6243         AC_MSG_RESULT([yes])
6244         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6245     else
6246         AC_MSG_RESULT([no])
6247     fi
6249     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6250     save_CFLAGS=$CFLAGS
6251     CFLAGS="$CFLAGS -Werror"
6252     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6253             __attribute__((deprecated("test"))) void f();
6254         ])], [
6255             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6256             AC_MSG_RESULT([yes])
6257         ], [AC_MSG_RESULT([no])])
6258     CFLAGS=$save_CFLAGS
6260     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6261     AC_LANG_PUSH([C++])
6262     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6263             #include <cstddef>
6264             #include <cxxabi.h>
6265             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6266         ])], [
6267             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6268             AC_MSG_RESULT([yes])
6269         ], [AC_MSG_RESULT([no])])
6270     AC_LANG_POP([C++])
6272     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6273     AC_LANG_PUSH([C++])
6274     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6275             #include <cstddef>
6276             #include <cxxabi.h>
6277             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6278         ])], [
6279             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6280             AC_MSG_RESULT([yes])
6281         ], [AC_MSG_RESULT([no])])
6282     AC_LANG_POP([C++])
6284     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6285     AC_LANG_PUSH([C++])
6286     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6287             #include <cxxabi.h>
6288             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6289         ])], [
6290             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6291             AC_MSG_RESULT([yes])
6292         ], [AC_MSG_RESULT([no])])
6293     AC_LANG_POP([C++])
6295     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6296     AC_LANG_PUSH([C++])
6297     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6298             #include <cstddef>
6299             #include <cxxabi.h>
6300             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6301         ])], [
6302             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6303             AC_MSG_RESULT([yes])
6304         ], [AC_MSG_RESULT([no])])
6305     AC_LANG_POP([C++])
6307     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6308     AC_LANG_PUSH([C++])
6309     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6310             #include <cstddef>
6311             #include <cxxabi.h>
6312             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6313         ])], [
6314             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6315             AC_MSG_RESULT([yes])
6316         ], [AC_MSG_RESULT([no])])
6317     AC_LANG_POP([C++])
6319     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6320     AC_LANG_PUSH([C++])
6321     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6322             #include <cxxabi.h>
6323             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6324         ])], [
6325             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6326             AC_MSG_RESULT([yes])
6327         ], [AC_MSG_RESULT([no])])
6328     AC_LANG_POP([C++])
6330     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6331     AC_LANG_PUSH([C++])
6332     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6333             #include <cxxabi.h>
6334             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6335         ])], [
6336             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6337             AC_MSG_RESULT([yes])
6338         ], [AC_MSG_RESULT([no])])
6339     AC_LANG_POP([C++])
6341     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6342     AC_LANG_PUSH([C++])
6343     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6344             #include <cxxabi.h>
6345             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6346         ])], [
6347             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6348             AC_MSG_RESULT([yes])
6349         ], [AC_MSG_RESULT([no])])
6350     AC_LANG_POP([C++])
6352     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6353     AC_LANG_PUSH([C++])
6354     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6355             #include <cstddef>
6356             #include <cxxabi.h>
6357             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6358         ])], [
6359             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6360             AC_MSG_RESULT([yes])
6361         ], [AC_MSG_RESULT([no])])
6362     AC_LANG_POP([C++])
6364     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6365     AC_LANG_PUSH([C++])
6366     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6367             #include <cstddef>
6368             #include <cxxabi.h>
6369             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6370         ])], [
6371             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6372             AC_MSG_RESULT([yes])
6373         ], [AC_MSG_RESULT([no])])
6374     AC_LANG_POP([C++])
6376     dnl Available in GCC 4.9 and at least since Clang 3.4:
6377     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6378     AC_LANG_PUSH([C++])
6379     save_CXXFLAGS=$CXXFLAGS
6380     CXXFLAGS="$CXXFLAGS -Werror"
6381     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6382             struct __attribute__((warn_unused)) dummy {};
6383         ])], [
6384             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6385             AC_MSG_RESULT([yes])
6386         ], [AC_MSG_RESULT([no])])
6387     CXXFLAGS=$save_CXXFLAGS
6388 AC_LANG_POP([C++])
6391 AC_SUBST(HAVE_GCC_AVX)
6392 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6393 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6394 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6396 dnl ===================================================================
6397 dnl Identify the C++ library
6398 dnl ===================================================================
6400 AC_MSG_CHECKING([what the C++ library is])
6401 AC_LANG_PUSH([C++])
6402 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6403 #include <utility>
6404 #ifndef __GLIBCXX__
6405 foo bar
6406 #endif
6407 ]])],
6408     [CPP_LIBRARY=GLIBCXX
6409      cpp_library_name="GNU libstdc++"
6410     ],
6411     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6412 #include <utility>
6413 #ifndef _LIBCPP_VERSION
6414 foo bar
6415 #endif
6416 ]])],
6417     [CPP_LIBRARY=LIBCPP
6418      cpp_library_name="LLVM libc++"
6419      AC_DEFINE([HAVE_LIBCXX])
6420     ],
6421     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6422 #include <utility>
6423 #ifndef _MSC_VER
6424 foo bar
6425 #endif
6426 ]])],
6427     [CPP_LIBRARY=MSVCRT
6428      cpp_library_name="Microsoft"
6429     ],
6430     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6431 AC_MSG_RESULT([$cpp_library_name])
6432 AC_LANG_POP([C++])
6434 dnl ===================================================================
6435 dnl Check for gperf
6436 dnl ===================================================================
6437 AC_PATH_PROG(GPERF, gperf)
6438 if test -z "$GPERF"; then
6439     AC_MSG_ERROR([gperf not found but needed. Install it.])
6441 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6442     GPERF=`cygpath -m $GPERF`
6444 AC_MSG_CHECKING([whether gperf is new enough])
6445 my_gperf_ver1=$($GPERF --version | head -n 1)
6446 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6447 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6448 if test "$my_gperf_ver3" -ge 301; then
6449     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6450 else
6451     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6453 AC_SUBST(GPERF)
6455 dnl ===================================================================
6456 dnl Check for system libcmis
6457 dnl ===================================================================
6458 # libcmis requires curl and we can't build curl for iOS
6459 if test $_os != iOS; then
6460     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6461     ENABLE_LIBCMIS=TRUE
6462 else
6463     ENABLE_LIBCMIS=
6465 AC_SUBST(ENABLE_LIBCMIS)
6467 dnl ===================================================================
6468 dnl C++11
6469 dnl ===================================================================
6471 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6472 CXXFLAGS_CXX11=
6473 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6474     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6475 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6476     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6477     for flag in $my_flags; do
6478         if test "$COM" = MSC; then
6479             flag="-Xclang $flag"
6480         fi
6481         save_CXXFLAGS=$CXXFLAGS
6482         CXXFLAGS="$CXXFLAGS $flag -Werror"
6483         if test "$SYSTEM_LIBCMIS" = TRUE; then
6484             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6485         fi
6486         AC_LANG_PUSH([C++])
6487         dnl Clang 3.9 supports __float128 since
6488         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6489         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6490         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6491         dnl $flag is supported below, so check this first):
6492         my_float128hack=
6493         my_float128hack_impl=-D__float128=void
6494         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6495             #include <vector>
6496             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6497             // (__float128)
6498             ]])
6499         ],,[
6500             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6501             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6502             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6503             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6504             dnl place where __float128 is used is in a template specialization, -D__float128=void
6505             dnl will avoid the problem there while still causing a problem if somebody actually uses
6506             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6507             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6508             dnl "fixed" with this hack):
6509             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6510             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6511                 #include <vector>
6512                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6513                 // (__float128)
6514                 ]])
6515             ],[my_float128hack=$my_float128hack_impl])
6516         ])
6517         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6518             #include <algorithm>
6519             #include <cmath>
6520             #include <functional>
6521             #include <vector>
6523             #if defined SYSTEM_LIBCMIS
6524             // See ucb/source/ucp/cmis/auth_provider.hxx:
6525             #if !defined __clang__
6526             #pragma GCC diagnostic push
6527             #pragma GCC diagnostic ignored "-Wdeprecated"
6528             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6529             #endif
6530             #include <libcmis/libcmis.hxx>
6531             #if !defined __clang__
6532             #pragma GCC diagnostic pop
6533             #endif
6534             #endif
6536             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6537                 std::sort(v.begin(), v.end(), fn);
6538             }
6540             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6541             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6542             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6543             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6544             // needed by sc/source/core/tool/math.cxx):
6545             int g() { return math_errhandling; }
6546             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6547         AC_LANG_POP([C++])
6548         CXXFLAGS=$save_CXXFLAGS
6549         if test -n "$CXXFLAGS_CXX11"; then
6550             break
6551         fi
6552     done
6554 if test -n "$CXXFLAGS_CXX11"; then
6555     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6556 else
6557     AC_MSG_ERROR(no)
6559 AC_SUBST(CXXFLAGS_CXX11)
6561 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6562 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6563 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6564 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6565 dnl again towards 4.7.2:
6566 if test $CPP_LIBRARY = GLIBCXX; then
6567     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6568     AC_LANG_PUSH([C++])
6569     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6570 #include <list>
6571 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6572     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6573     //   GCC 4.7.0: 20120322
6574     //   GCC 4.7.1: 20120614
6575     // and using a range check is not possible as the mapping between
6576     // __GLIBCXX__ values and GCC versions is not monotonic
6577 /* ok */
6578 #else
6579 abi broken
6580 #endif
6581         ]])], [AC_MSG_RESULT(no, ok)],
6582         [AC_MSG_ERROR(yes)])
6583     AC_LANG_POP([C++])
6586 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6587 save_CXXFLAGS=$CXXFLAGS
6588 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6589 AC_LANG_PUSH([C++])
6591 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6592 #include <stddef.h>
6594 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6596 namespace
6598         struct b
6599         {
6600                 int i;
6601                 int j;
6602         };
6604 ]], [[
6605 struct a
6607         int i;
6608         int j;
6610 a thinga[]={{0,0}, {1,1}};
6611 b thingb[]={{0,0}, {1,1}};
6612 size_t i = sizeof(sal_n_array_size(thinga));
6613 size_t j = sizeof(sal_n_array_size(thingb));
6614 return !(i != 0 && j != 0);
6616     ], [ AC_MSG_RESULT(yes) ],
6617     [ AC_MSG_ERROR(no)])
6618 AC_LANG_POP([C++])
6619 CXXFLAGS=$save_CXXFLAGS
6621 dnl _Pragma support (may require C++11)
6622 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6623     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6624     AC_LANG_PUSH([C++])
6625     save_CXXFLAGS=$CXXFLAGS
6626     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6627     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6628             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6629         ])], [
6630             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6631             AC_MSG_RESULT([yes])
6632         ], [AC_MSG_RESULT([no])])
6633     AC_LANG_POP([C++])
6634     CXXFLAGS=$save_CXXFLAGS
6637 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6638 if test "$GCC" = yes; then
6639     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6640     AC_LANG_PUSH([C++])
6641     save_CXXFLAGS=$CXXFLAGS
6642     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6643     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6644     CXXFLAGS=$save_CXXFLAGS
6645     AC_LANG_POP([C++])
6646     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6647         AC_MSG_RESULT([yes])
6648     else
6649         AC_MSG_RESULT([no])
6650     fi
6652 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6654 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6655 AC_LANG_PUSH([C++])
6656 save_CXXFLAGS=$CXXFLAGS
6657 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6658 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6659         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6660         // supporting it:
6661         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6662         struct S {
6663         private:
6664             S(S const &);
6665         public:
6666             S();
6667             ~S();
6668         };
6669         S copy();
6670         void f() { S c(copy()); }
6671         #endif
6672     ])], [
6673         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6674         AC_MSG_RESULT([yes])
6675     ], [AC_MSG_RESULT([no])])
6676 CXXFLAGS=$save_CXXFLAGS
6677 AC_LANG_POP([C++])
6679 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6680 AC_LANG_PUSH([C++])
6681 save_CXXFLAGS=$CXXFLAGS
6682 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6683 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6684         struct S1 { S1(S1 &&); };
6685         struct S2: S1 {};
6686         S1 f(S2 s) { return s; }
6687     ])], [
6688         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6689         AC_MSG_RESULT([yes])
6690     ], [AC_MSG_RESULT([no])])
6691 CXXFLAGS=$save_CXXFLAGS
6692 AC_LANG_POP([C++])
6694 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6695 dnl uninitialized warning for code like
6697 dnl   OString f();
6698 dnl   boost::optional<OString> * g(bool b) {
6699 dnl       boost::optional<OString> o;
6700 dnl       if (b) o = f();
6701 dnl       return new boost::optional<OString>(o);
6702 dnl   }
6704 dnl (as is e.g. present, in a slightly more elaborate form, in
6705 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6706 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6707 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6708 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6709     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6710     AC_LANG_PUSH([C++])
6711     save_CXXFLAGS=$CXXFLAGS
6712     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6713     if test "$ENABLE_OPTIMIZED" = TRUE; then
6714         CXXFLAGS="$CXXFLAGS -O2"
6715     else
6716         CXXFLAGS="$CXXFLAGS -O0"
6717     fi
6718     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6719             #include <new>
6720             void f1(int);
6721             struct S1 {
6722                 ~S1() { f1(n); }
6723                 int n = 0;
6724             };
6725             struct S2 {
6726                 S2() {}
6727                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6728                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6729                 void set(S1 s) {
6730                     new (stg) S1(s);
6731                     init = true;
6732                 }
6733                 bool init = false;
6734                 char stg[sizeof (S1)];
6735             } ;
6736             S1 f2();
6737             S2 * f3(bool b) {
6738                 S2 o;
6739                 if (b) o.set(f2());
6740                 return new S2(o);
6741             }
6742         ]])], [AC_MSG_RESULT([no])], [
6743             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6744             AC_MSG_RESULT([yes])
6745         ])
6746     CXXFLAGS=$save_CXXFLAGS
6747     AC_LANG_POP([C++])
6749 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6751 dnl ===================================================================
6752 dnl CPU Intrinsics support - SSE, AVX
6753 dnl ===================================================================
6755 INTRINSICS_CXXFLAGS=""
6757 if test "$GCC" = "yes"; then
6758     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6759     AC_LANG_PUSH([C++])
6760     save_CXXFLAGS=$CXXFLAGS
6761     CXXFLAGS="$CXXFLAGS -msse2"
6762     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6763         #include <emmintrin.h>
6764         int main () {
6765             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6766             c = _mm_xor_si128 (a, b);
6767             return 0;
6768         }
6769         ])],
6770         [can_compile_sse2=yes],
6771         [can_compile_sse2=no])
6772     AC_LANG_POP([C++])
6773     CXXFLAGS=$save_CXXFLAGS
6774     AC_MSG_RESULT([${can_compile_sse2}])
6775     if test "${can_compile_sse2}" = "yes" ; then
6776         INTRINSICS_CXXFLAGS="-msse2"
6777     else
6778         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6779     fi
6781     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6782     AC_LANG_PUSH([C++])
6783     save_CXXFLAGS=$CXXFLAGS
6784     CXXFLAGS="$CXXFLAGS -mssse3"
6785     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6786         #include <tmmintrin.h>
6787         int main () {
6788             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6789             c = _mm_maddubs_epi16 (a, b);
6790             return 0;
6791         }
6792         ])],
6793         [can_compile_ssse3=yes],
6794         [can_compile_ssse3=no])
6795     AC_LANG_POP([C++])
6796     CXXFLAGS=$save_CXXFLAGS
6797     AC_MSG_RESULT([${can_compile_ssse3}])
6798     if test "${can_compile_ssse3}" = "yes" ; then
6799         INTRINSICS_CXXFLAGS="-mssse3"
6800     else
6801         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6802     fi
6804     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6805     AC_LANG_PUSH([C++])
6806     save_CXXFLAGS=$CXXFLAGS
6807     CXXFLAGS="$CXXFLAGS -mavx"
6808     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6809         #include <immintrin.h>
6810         int main () {
6811             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6812             c = _mm256_xor_ps(a, b);
6813             return 0;
6814         }
6815         ])],
6816         [can_compile_avx=yes],
6817         [can_compile_avx=no])
6818     AC_LANG_POP([C++])
6819     CXXFLAGS=$save_CXXFLAGS
6820     AC_MSG_RESULT([${can_compile_avx}])
6821     if test "${can_compile_avx}" = "yes" ; then
6822         INTRINSICS_CXXFLAGS="-mavx"
6823     else
6824         AC_MSG_WARN([cannot compile AVX intrinsics])
6825     fi
6827     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6828     AC_LANG_PUSH([C++])
6829     save_CXXFLAGS=$CXXFLAGS
6830     CXXFLAGS="$CXXFLAGS -mavx2"
6831     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6832         #include <immintrin.h>
6833         int main () {
6834             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6835             c = _mm256_maddubs_epi16(a, b);
6836             return 0;
6837         }
6838         ])],
6839         [can_compile_avx2=yes],
6840         [can_compile_avx2=no])
6841     AC_LANG_POP([C++])
6842     CXXFLAGS=$save_CXXFLAGS
6843     AC_MSG_RESULT([${can_compile_avx2}])
6844     if test "${can_compile_avx2}" = "yes" ; then
6845         INTRINSICS_CXXFLAGS="-mavx2"
6846     else
6847         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6848     fi
6851 AC_SUBST([INTRINSICS_CXXFLAGS])
6853 dnl ===================================================================
6854 dnl system stl sanity tests
6855 dnl ===================================================================
6856 if test "$_os" != "WINNT"; then
6858     AC_LANG_PUSH([C++])
6860     save_CPPFLAGS="$CPPFLAGS"
6861     if test -n "$MACOSX_SDK_PATH"; then
6862         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6863     fi
6865     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6866     # only.
6867     if test "$CPP_LIBRARY" = GLIBCXX; then
6868         dnl gcc#19664, gcc#22482, rhbz#162935
6869         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6870         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6871         AC_MSG_RESULT([$stlvisok])
6872         if test "$stlvisok" = "no"; then
6873             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6874         fi
6875     fi
6877     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6878     # when we don't make any dynamic libraries?
6879     if test "$DISABLE_DYNLOADING" = ""; then
6880         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6881         cat > conftestlib1.cc <<_ACEOF
6882 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6883 struct S2: S1<int> { virtual ~S2(); };
6884 S2::~S2() {}
6885 _ACEOF
6886         cat > conftestlib2.cc <<_ACEOF
6887 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6888 struct S2: S1<int> { virtual ~S2(); };
6889 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6890 _ACEOF
6891         gccvisinlineshiddenok=yes
6892         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6893             gccvisinlineshiddenok=no
6894         else
6895             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6896             dnl known to not work with -z defs (unsetting which makes the test
6897             dnl moot, though):
6898             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6899             if test "$COM_IS_CLANG" = TRUE; then
6900                 for i in $CXX $CXXFLAGS; do
6901                     case $i in
6902                     -fsanitize=*)
6903                         my_linkflagsnoundefs=
6904                         break
6905                         ;;
6906                     esac
6907                 done
6908             fi
6909             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6910                 gccvisinlineshiddenok=no
6911             fi
6912         fi
6914         rm -fr libconftest*
6915         AC_MSG_RESULT([$gccvisinlineshiddenok])
6916         if test "$gccvisinlineshiddenok" = "no"; then
6917             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6918         fi
6919     fi
6921    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6922     cat >visibility.cxx <<_ACEOF
6923 #pragma GCC visibility push(hidden)
6924 struct __attribute__ ((visibility ("default"))) TestStruct {
6925   static void Init();
6927 __attribute__ ((visibility ("default"))) void TestFunc() {
6928   TestStruct::Init();
6930 _ACEOF
6931     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6932         gccvisbroken=yes
6933     else
6934         case "$host_cpu" in
6935         i?86|x86_64)
6936             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6937                 gccvisbroken=no
6938             else
6939                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6940                     gccvisbroken=no
6941                 else
6942                     gccvisbroken=yes
6943                 fi
6944             fi
6945             ;;
6946         *)
6947             gccvisbroken=no
6948             ;;
6949         esac
6950     fi
6951     rm -f visibility.s visibility.cxx
6953     AC_MSG_RESULT([$gccvisbroken])
6954     if test "$gccvisbroken" = "yes"; then
6955         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6956     fi
6958     CPPFLAGS="$save_CPPFLAGS"
6960     AC_LANG_POP([C++])
6963 dnl ===================================================================
6964 dnl  Clang++ tests
6965 dnl ===================================================================
6967 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6968 if test "$GCC" = "yes"; then
6969     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6970     AC_LANG_PUSH([C++])
6971     save_CXXFLAGS=$CXXFLAGS
6972     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6973     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6974     CXXFLAGS=$save_CXXFLAGS
6975     AC_LANG_POP([C++])
6976     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6977         AC_MSG_RESULT([yes])
6978     else
6979         AC_MSG_RESULT([no])
6980     fi
6982 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6984 dnl ===================================================================
6985 dnl Compiler plugins
6986 dnl ===================================================================
6988 COMPILER_PLUGINS=
6989 # currently only Clang
6991 if test "$COM_IS_CLANG" != "TRUE"; then
6992     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6993         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6994         enable_compiler_plugins=no
6995     fi
6998 if test "$COM_IS_CLANG" = "TRUE"; then
6999     if test -n "$enable_compiler_plugins"; then
7000         compiler_plugins="$enable_compiler_plugins"
7001     elif test -n "$ENABLE_DBGUTIL"; then
7002         compiler_plugins=test
7003     else
7004         compiler_plugins=no
7005     fi
7006     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7007         if test "$CLANGVER" -lt 50002; then
7008             if test "$compiler_plugins" = yes; then
7009                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7010             else
7011                 compiler_plugins=no
7012             fi
7013         fi
7014     fi
7015     if test "$compiler_plugins" != "no"; then
7016         dnl The prefix where Clang resides, override to where Clang resides if
7017         dnl using a source build:
7018         if test -z "$CLANGDIR"; then
7019             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7020         fi
7021         AC_LANG_PUSH([C++])
7022         save_CPPFLAGS=$CPPFLAGS
7023         save_CXX=$CXX
7024         save_CXXCPP=$CXXCPP
7025         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
7026         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
7027         CXX=$COMPILER_PLUGINS_CXX
7028         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7029         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
7030         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
7031             [COMPILER_PLUGINS=TRUE],
7032             [
7033             if test "$compiler_plugins" = "yes"; then
7034                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7035             else
7036                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7037                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7038             fi
7039             ])
7040         CXX=$save_CXX
7041         CXXCPP=$save_CXXCPP
7042         CPPFLAGS=$save_CPPFLAGS
7043         AC_LANG_POP([C++])
7044     fi
7045 else
7046     if test "$enable_compiler_plugins" = "yes"; then
7047         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7048     fi
7050 AC_SUBST(COMPILER_PLUGINS)
7051 AC_SUBST(COMPILER_PLUGINS_CXX)
7052 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7053 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7054 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7055 AC_SUBST(CLANGDIR)
7056 AC_SUBST(CLANGLIBDIR)
7058 # Plugin to help linker.
7059 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7060 # This makes --enable-lto build with clang work.
7061 AC_SUBST(LD_PLUGIN)
7063 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7064 AC_SUBST(HAVE_POSIX_FALLOCATE)
7066 dnl ===================================================================
7067 dnl Custom build version
7068 dnl ===================================================================
7070 AC_MSG_CHECKING([whether to add custom build version])
7071 if test "$with_build_version" != ""; then
7072     BUILD_VER_STRING=$with_build_version
7073     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7074 else
7075     BUILD_VER_STRING=
7076     AC_MSG_RESULT([no])
7078 AC_SUBST(BUILD_VER_STRING)
7080 JITC_PROCESSOR_TYPE=""
7081 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7082     # IBMs JDK needs this...
7083     JITC_PROCESSOR_TYPE=6
7084     export JITC_PROCESSOR_TYPE
7086 AC_SUBST([JITC_PROCESSOR_TYPE])
7088 # Misc Windows Stuff
7089 AC_ARG_WITH(ucrt-dir,
7090     AS_HELP_STRING([--with-ucrt-dir],
7091         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7092         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7093         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7094             Windows6.1-KB2999226-x64.msu
7095             Windows6.1-KB2999226-x86.msu
7096             Windows8.1-KB2999226-x64.msu
7097             Windows8.1-KB2999226-x86.msu
7098             Windows8-RT-KB2999226-x64.msu
7099             Windows8-RT-KB2999226-x86.msu
7100         A zip archive including those files is available from Microsoft site:
7101         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7103 UCRT_REDISTDIR="$with_ucrt_dir"
7104 if test $_os = "WINNT"; then
7105     find_msvc_x64_dlls
7106     find_msms
7107     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7108     MSVC_DLLS="$msvcdlls"
7109     MSM_PATH=`win_short_path_for_make "$msmdir"`
7110     # MSVC 15.3 changed it to VC141
7111     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7112         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7113     else
7114         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7115     fi
7117     if test "$UCRT_REDISTDIR" = "no"; then
7118         dnl explicitly disabled
7119         UCRT_REDISTDIR=""
7120     else
7121         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7122                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7123                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7124                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7125                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7126                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7127             UCRT_REDISTDIR=""
7128             if test -n "$PKGFORMAT"; then
7129                for i in $PKGFORMAT; do
7130                    case "$i" in
7131                    msi)
7132                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7133                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7134                        ;;
7135                    esac
7136                done
7137             fi
7138         fi
7139     fi
7142 AC_SUBST(UCRT_REDISTDIR)
7143 AC_SUBST(MSVC_DLL_PATH)
7144 AC_SUBST(MSVC_DLLS)
7145 AC_SUBST(MSM_PATH)
7147 dnl ===================================================================
7148 dnl Checks for Java
7149 dnl ===================================================================
7150 if test "$ENABLE_JAVA" != ""; then
7152     # Windows-specific tests
7153     if test "$build_os" = "cygwin"; then
7154         if test "$BITNESS_OVERRIDE" = 64; then
7155             bitness=64
7156         else
7157             bitness=32
7158         fi
7160         if test -z "$with_jdk_home"; then
7161             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7162             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7163             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7164             if test -n "$regvalue"; then
7165                 ver=$regvalue
7166                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7167                 _jdk_home=$regvalue
7168             fi
7169             if test -z "$with_jdk_home"; then
7170                 for ver in 1.8; do
7171                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7172                     if test -n "$regvalue"; then
7173                         _jdk_home=$regvalue
7174                         break
7175                     fi
7176                 done
7177             fi
7178             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7179                 with_jdk_home="$_jdk_home"
7180                 howfound="found automatically"
7181             else
7182                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7183             fi
7184         else
7185             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7186             howfound="you passed"
7187         fi
7188     fi
7190     # 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.
7191     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7192     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7193         with_jdk_home=`/usr/libexec/java_home`
7194     fi
7196     JAVA_HOME=; export JAVA_HOME
7197     if test -z "$with_jdk_home"; then
7198         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7199     else
7200         _java_path="$with_jdk_home/bin/$with_java"
7201         dnl Check if there is a Java interpreter at all.
7202         if test -x "$_java_path"; then
7203             JAVAINTERPRETER=$_java_path
7204         else
7205             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7206         fi
7207     fi
7209     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7210     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7211     dnl loaded by java to run JunitTests:
7212     if test "$build_os" = "cygwin"; then
7213         shortjdkhome=`cygpath -d "$with_jdk_home"`
7214         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
7215             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7216             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7217         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
7218             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7219             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7220         fi
7222         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7223             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7224         fi
7225         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7226     elif test "$cross_compiling" != "yes"; then
7227         case $CPUNAME in
7228             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7229                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7230                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7231                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7232                 fi
7233                 ;;
7234             *) # assumption: everything else 32-bit
7235                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7236                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7237                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7238                 fi
7239                 ;;
7240         esac
7241     fi
7244 dnl ===================================================================
7245 dnl Checks for JDK.
7246 dnl ===================================================================
7248 # Note that JAVA_HOME as for now always means the *build* platform's
7249 # JAVA_HOME. Whether all the complexity here actually is needed any
7250 # more or not, no idea.
7252 if test "$ENABLE_JAVA" != ""; then
7253     _gij_longver=0
7254     AC_MSG_CHECKING([the installed JDK])
7255     if test -n "$JAVAINTERPRETER"; then
7256         dnl java -version sends output to stderr!
7257         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7258             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7259         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7260             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7261         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7262             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7263         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7264             JDK=ibm
7266             dnl IBM JDK specific tests
7267             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7268             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7270             if test "$_jdk_ver" -lt 10800; then
7271                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7272             fi
7274             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7276             if test "$with_jdk_home" = ""; then
7277                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7278 you must use the "--with-jdk-home" configure option explicitly])
7279             fi
7281             JAVA_HOME=$with_jdk_home
7282         else
7283             JDK=sun
7285             dnl Sun JDK specific tests
7286             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7287             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7289             if test "$_jdk_ver" -lt 10800; then
7290                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7291             fi
7292             if test "$_jdk_ver" -gt 10800; then
7293                 JAVA_CLASSPATH_NOT_SET=TRUE
7294             fi
7296             AC_MSG_RESULT([found (JDK $_jdk)])
7297             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7298             if test "$_os" = "WINNT"; then
7299                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7300             fi
7302             # set to limit VM usage for JunitTests
7303             JAVAIFLAGS=-Xmx64M
7304             # set to limit VM usage for javac
7305             JAVAFLAGS=-J-Xmx128M
7306         fi
7307     else
7308         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7309     fi
7310 else
7311     dnl Java disabled
7312     JAVA_HOME=
7313     export JAVA_HOME
7316 dnl ===================================================================
7317 dnl Checks for javac
7318 dnl ===================================================================
7319 if test "$ENABLE_JAVA" != ""; then
7320     javacompiler="javac"
7321     : ${JAVA_SOURCE_VER=8}
7322     : ${JAVA_TARGET_VER=8}
7323     if test -z "$with_jdk_home"; then
7324         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7325     else
7326         _javac_path="$with_jdk_home/bin/$javacompiler"
7327         dnl Check if there is a Java compiler at all.
7328         if test -x "$_javac_path"; then
7329             JAVACOMPILER=$_javac_path
7330         fi
7331     fi
7332     if test -z "$JAVACOMPILER"; then
7333         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7334     fi
7335     if test "$build_os" = "cygwin"; then
7336         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7337             JAVACOMPILER="${JAVACOMPILER}.exe"
7338         fi
7339         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7340     fi
7343 dnl ===================================================================
7344 dnl Checks for javadoc
7345 dnl ===================================================================
7346 if test "$ENABLE_JAVA" != ""; then
7347     if test -z "$with_jdk_home"; then
7348         AC_PATH_PROG(JAVADOC, javadoc)
7349     else
7350         _javadoc_path="$with_jdk_home/bin/javadoc"
7351         dnl Check if there is a javadoc at all.
7352         if test -x "$_javadoc_path"; then
7353             JAVADOC=$_javadoc_path
7354         else
7355             AC_PATH_PROG(JAVADOC, javadoc)
7356         fi
7357     fi
7358     if test -z "$JAVADOC"; then
7359         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7360     fi
7361     if test "$build_os" = "cygwin"; then
7362         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7363             JAVADOC="${JAVADOC}.exe"
7364         fi
7365         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7366     fi
7368     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7369     JAVADOCISGJDOC="yes"
7370     fi
7372 AC_SUBST(JAVADOCISGJDOC)
7374 if test "$ENABLE_JAVA" != ""; then
7375     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7376     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7377         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7378            # try to recover first by looking whether we have an alternative
7379            # system as in Debian or newer SuSEs where following /usr/bin/javac
7380            # over /etc/alternatives/javac leads to the right bindir where we
7381            # just need to strip a bit away to get a valid JAVA_HOME
7382            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7383         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7384             # maybe only one level of symlink (e.g. on Mac)
7385             JAVA_HOME=$(readlink $JAVACOMPILER)
7386             if test "$(dirname $JAVA_HOME)" = "."; then
7387                 # we've got no path to trim back
7388                 JAVA_HOME=""
7389             fi
7390         else
7391             # else warn
7392             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7393             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7394             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7395             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7396         fi
7397         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7398         if test "$JAVA_HOME" != "/usr"; then
7399             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7400                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7401                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7402                 dnl Tiger already returns a JDK path..
7403                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7404             else
7405                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7406                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7407                 dnl that checks which version to run
7408                 if test -f "$JAVA_HOME"; then
7409                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7410                 fi
7411             fi
7412         fi
7413     fi
7414     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7416     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7417     if test -z "$JAVA_HOME"; then
7418         if test "x$with_jdk_home" = "x"; then
7419             cat > findhome.java <<_ACEOF
7420 [import java.io.File;
7422 class findhome
7424     public static void main(String args[])
7425     {
7426         String jrelocation = System.getProperty("java.home");
7427         File jre = new File(jrelocation);
7428         System.out.println(jre.getParent());
7429     }
7431 _ACEOF
7432             AC_MSG_CHECKING([if javac works])
7433             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7434             AC_TRY_EVAL(javac_cmd)
7435             if test $? = 0 -a -f ./findhome.class; then
7436                 AC_MSG_RESULT([javac works])
7437             else
7438                 echo "configure: javac test failed" >&5
7439                 cat findhome.java >&5
7440                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7441             fi
7442             AC_MSG_CHECKING([if gij knows its java.home])
7443             JAVA_HOME=`$JAVAINTERPRETER findhome`
7444             if test $? = 0 -a "$JAVA_HOME" != ""; then
7445                 AC_MSG_RESULT([$JAVA_HOME])
7446             else
7447                 echo "configure: java test failed" >&5
7448                 cat findhome.java >&5
7449                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7450             fi
7451             # clean-up after ourselves
7452             rm -f ./findhome.java ./findhome.class
7453         else
7454             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7455         fi
7456     fi
7458     # now check if $JAVA_HOME is really valid
7459     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7460         case "${JAVA_HOME}" in
7461             /Library/Java/JavaVirtualMachines/*)
7462                 ;;
7463             *)
7464                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7465                 ;;
7466         esac
7467         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7468             JAVA_HOME_OK="NO"
7469         fi
7470     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7471         JAVA_HOME_OK="NO"
7472     fi
7473     if test "$JAVA_HOME_OK" = "NO"; then
7474         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7475         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7476         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7477         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7478         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7479         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7480     fi
7481     PathFormat "$JAVA_HOME"
7482     JAVA_HOME="$formatted_path"
7485 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7486     "$_os" != Darwin
7487 then
7488     AC_MSG_CHECKING([for JAWT lib])
7489     if test "$_os" = WINNT; then
7490         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7491         JAWTLIB=jawt.lib
7492     else
7493         case "$host_cpu" in
7494         arm*)
7495             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7496             JAVA_ARCH=$my_java_arch
7497             ;;
7498         i*86)
7499             my_java_arch=i386
7500             ;;
7501         m68k)
7502             my_java_arch=m68k
7503             ;;
7504         powerpc)
7505             my_java_arch=ppc
7506             ;;
7507         powerpc64)
7508             my_java_arch=ppc64
7509             ;;
7510         powerpc64le)
7511             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7512             JAVA_ARCH=$my_java_arch
7513             ;;
7514         sparc64)
7515             my_java_arch=sparcv9
7516             ;;
7517         x86_64)
7518             my_java_arch=amd64
7519             ;;
7520         *)
7521             my_java_arch=$host_cpu
7522             ;;
7523         esac
7524         # This is where JDK9 puts the library
7525         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7526             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7527         else
7528             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7529         fi
7530         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7531     fi
7532     AC_MSG_RESULT([$JAWTLIB])
7534 AC_SUBST(JAWTLIB)
7536 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7537     case "$host_os" in
7539     aix*)
7540         JAVAINC="-I$JAVA_HOME/include"
7541         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7542         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7543         ;;
7545     cygwin*)
7546         JAVAINC="-I$JAVA_HOME/include/win32"
7547         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7548         ;;
7550     darwin*)
7551         if test -d "$JAVA_HOME/include/darwin"; then
7552             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7553         else
7554             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7555         fi
7556         ;;
7558     dragonfly*)
7559         JAVAINC="-I$JAVA_HOME/include"
7560         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7561         ;;
7563     freebsd*)
7564         JAVAINC="-I$JAVA_HOME/include"
7565         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7566         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7567         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7568         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7569         ;;
7571     k*bsd*-gnu*)
7572         JAVAINC="-I$JAVA_HOME/include"
7573         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7574         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7575         ;;
7577     linux-gnu*)
7578         JAVAINC="-I$JAVA_HOME/include"
7579         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7580         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7581         ;;
7583     *netbsd*)
7584         JAVAINC="-I$JAVA_HOME/include"
7585         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7586         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7587        ;;
7589     openbsd*)
7590         JAVAINC="-I$JAVA_HOME/include"
7591         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7592         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7593         ;;
7595     solaris*)
7596         JAVAINC="-I$JAVA_HOME/include"
7597         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7598         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7599         ;;
7600     esac
7602 SOLARINC="$SOLARINC $JAVAINC"
7604 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7605     url_check_unknown=0
7606     java_base="testurlcheck"
7607     java_src="${java_base}.java"
7608     java_cls="${java_base}.class"
7609     cat > "${java_src}" <<_ACEOF
7610 [import jdk.internal.loader.URLClassPath;
7611 import java.lang.reflect.Field;
7612 import java.net.URL;
7614 class ${java_base}
7616     public static void main(String args[])
7617     {
7618         try {
7619             URLClassPath cp = new URLClassPath(new URL[0], null);
7620             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7621             field.setAccessible(true);
7622             System.out.println(field.get(cp).toString());
7623         } catch(Exception e) {
7624             System.out.println("unknown");
7625         }
7626     }
7628 _ACEOF
7629     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7630     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7631     AC_TRY_EVAL(java_cmd)
7632     if test $? = 0 -a -f "./${java_cls}"; then
7633         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7634         if test $? = 0; then
7635             case "${java_res}" in
7636             true) AC_MSG_RESULT([yes]) ;;
7637             false)
7638                 rm -f "./${java_src}" "./${java_cls}"
7639                 AC_MSG_ERROR([no - Java unit tests will break!])
7640                 ;;
7641             *) url_check_unknown=1 ;;
7642             esac
7643         else
7644             url_check_unknown=1
7645         fi
7646     else
7647         url_check_unknown=1
7648     fi
7649     if test $url_check_unknown -eq 1; then
7650         AC_MSG_RESULT([unknown - assuming yes])
7651         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7652     fi
7653     rm -f "./${java_src}" "./${java_cls}"
7656 AC_SUBST(JAVACOMPILER)
7657 AC_SUBST(JAVADOC)
7658 AC_SUBST(JAVAINTERPRETER)
7659 AC_SUBST(JAVAIFLAGS)
7660 AC_SUBST(JAVAFLAGS)
7661 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7662 AC_SUBST(JAVA_HOME)
7663 AC_SUBST(JAVA_SOURCE_VER)
7664 AC_SUBST(JAVA_TARGET_VER)
7665 AC_SUBST(JDK)
7668 dnl ===================================================================
7669 dnl Export file validation
7670 dnl ===================================================================
7671 AC_MSG_CHECKING([whether to enable export file validation])
7672 if test "$with_export_validation" != "no"; then
7673     if test -z "$ENABLE_JAVA"; then
7674         if test "$with_export_validation" = "yes"; then
7675             AC_MSG_ERROR([requested, but Java is disabled])
7676         else
7677             AC_MSG_RESULT([no, as Java is disabled])
7678         fi
7679     elif test "$_jdk_ver" -lt 10800; then
7680         if test "$with_export_validation" = "yes"; then
7681             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7682         else
7683             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7684         fi
7685     else
7686         AC_MSG_RESULT([yes])
7687         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7689         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7690         if test -z "$ODFVALIDATOR"; then
7691             # remember to download the ODF toolkit with validator later
7692             AC_MSG_NOTICE([no odfvalidator found, will download it])
7693             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7694             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7696             # and fetch name of odfvalidator jar name from download.lst
7697             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7698             AC_SUBST(ODFVALIDATOR_JAR)
7700             if test -z "$ODFVALIDATOR_JAR"; then
7701                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7702             fi
7703         fi
7704         if test "$build_os" = "cygwin"; then
7705             # In case of Cygwin it will be executed from Windows,
7706             # so we need to run bash and absolute path to validator
7707             # so instead of "odfvalidator" it will be
7708             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7709             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7710         else
7711             ODFVALIDATOR="sh $ODFVALIDATOR"
7712         fi
7713         AC_SUBST(ODFVALIDATOR)
7716         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7717         if test -z "$OFFICEOTRON"; then
7718             # remember to download the officeotron with validator later
7719             AC_MSG_NOTICE([no officeotron found, will download it])
7720             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7721             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7723             # and fetch name of officeotron jar name from download.lst
7724             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7725             AC_SUBST(OFFICEOTRON_JAR)
7727             if test -z "$OFFICEOTRON_JAR"; then
7728                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7729             fi
7730         else
7731             # check version of existing officeotron
7732             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7733             if test 0"$OFFICEOTRON_VER" -lt 704; then
7734                 AC_MSG_ERROR([officeotron too old])
7735             fi
7736         fi
7737         if test "$build_os" = "cygwin"; then
7738             # In case of Cygwin it will be executed from Windows,
7739             # so we need to run bash and absolute path to validator
7740             # so instead of "odfvalidator" it will be
7741             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7742             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7743         else
7744             OFFICEOTRON="sh $OFFICEOTRON"
7745         fi
7746     fi
7747     AC_SUBST(OFFICEOTRON)
7748 else
7749     AC_MSG_RESULT([no])
7752 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7753 if test "$with_bffvalidator" != "no"; then
7754     AC_DEFINE(HAVE_BFFVALIDATOR)
7756     if test "$with_export_validation" = "no"; then
7757         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7758     fi
7760     if test "$with_bffvalidator" = "yes"; then
7761         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7762     else
7763         BFFVALIDATOR="$with_bffvalidator"
7764     fi
7766     if test "$build_os" = "cygwin"; then
7767         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7768             AC_MSG_RESULT($BFFVALIDATOR)
7769         else
7770             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7771         fi
7772     elif test -n "$BFFVALIDATOR"; then
7773         # We are not in Cygwin but need to run Windows binary with wine
7774         AC_PATH_PROGS(WINE, wine)
7776         # so swap in a shell wrapper that converts paths transparently
7777         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7778         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7779         AC_SUBST(BFFVALIDATOR_EXE)
7780         AC_MSG_RESULT($BFFVALIDATOR)
7781     else
7782         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7783     fi
7784     AC_SUBST(BFFVALIDATOR)
7785 else
7786     AC_MSG_RESULT([no])
7789 dnl ===================================================================
7790 dnl Check for C preprocessor to use
7791 dnl ===================================================================
7792 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7793 if test -n "$with_idlc_cpp"; then
7794     AC_MSG_RESULT([$with_idlc_cpp])
7795     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7796 else
7797     AC_MSG_RESULT([ucpp])
7798     AC_MSG_CHECKING([which ucpp tp use])
7799     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7800         AC_MSG_RESULT([external])
7801         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7802     else
7803         AC_MSG_RESULT([internal])
7804         BUILD_TYPE="$BUILD_TYPE UCPP"
7805     fi
7807 AC_SUBST(SYSTEM_UCPP)
7809 dnl ===================================================================
7810 dnl Check for epm (not needed for Windows)
7811 dnl ===================================================================
7812 AC_MSG_CHECKING([whether to enable EPM for packing])
7813 if test "$enable_epm" = "yes"; then
7814     AC_MSG_RESULT([yes])
7815     if test "$_os" != "WINNT"; then
7816         if test $_os = Darwin; then
7817             EPM=internal
7818         elif test -n "$with_epm"; then
7819             EPM=$with_epm
7820         else
7821             AC_PATH_PROG(EPM, epm, no)
7822         fi
7823         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7824             AC_MSG_NOTICE([EPM will be built.])
7825             BUILD_TYPE="$BUILD_TYPE EPM"
7826             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7827         else
7828             # Gentoo has some epm which is something different...
7829             AC_MSG_CHECKING([whether the found epm is the right epm])
7830             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7831                 AC_MSG_RESULT([yes])
7832             else
7833                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7834             fi
7835             AC_MSG_CHECKING([epm version])
7836             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7837             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7838                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7839                 AC_MSG_RESULT([OK, >= 3.7])
7840             else
7841                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7842                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7843             fi
7844         fi
7845     fi
7847     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7848         AC_MSG_CHECKING([for rpm])
7849         for a in "$RPM" rpmbuild rpm; do
7850             $a --usage >/dev/null 2> /dev/null
7851             if test $? -eq 0; then
7852                 RPM=$a
7853                 break
7854             else
7855                 $a --version >/dev/null 2> /dev/null
7856                 if test $? -eq 0; then
7857                     RPM=$a
7858                     break
7859                 fi
7860             fi
7861         done
7862         if test -z "$RPM"; then
7863             AC_MSG_ERROR([not found])
7864         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7865             RPM_PATH=`which $RPM`
7866             AC_MSG_RESULT([$RPM_PATH])
7867             SCPDEFS="$SCPDEFS -DWITH_RPM"
7868         else
7869             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7870         fi
7871     fi
7872     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7873         AC_PATH_PROG(DPKG, dpkg, no)
7874         if test "$DPKG" = "no"; then
7875             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7876         fi
7877     fi
7878     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7879        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7880         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7881             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7882                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7883                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7884                     AC_MSG_RESULT([yes])
7885                 else
7886                     AC_MSG_RESULT([no])
7887                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7888                         _pt="rpm"
7889                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7890                         add_warning "the rpms will need to be installed with --nodeps"
7891                     else
7892                         _pt="pkg"
7893                     fi
7894                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7895                     add_warning "the ${_pt}s will not be relocatable"
7896                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7897                                  relocation will work, you need to patch your epm with the
7898                                  patch in epm/epm-3.7.patch or build with
7899                                  --with-epm=internal which will build a suitable epm])
7900                 fi
7901             fi
7902         fi
7903     fi
7904     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7905         AC_PATH_PROG(PKGMK, pkgmk, no)
7906         if test "$PKGMK" = "no"; then
7907             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7908         fi
7909     fi
7910     AC_SUBST(RPM)
7911     AC_SUBST(DPKG)
7912     AC_SUBST(PKGMK)
7913 else
7914     for i in $PKGFORMAT; do
7915         case "$i" in
7916         aix | bsd | deb | pkg | rpm | native | portable)
7917             AC_MSG_ERROR(
7918                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7919             ;;
7920         esac
7921     done
7922     AC_MSG_RESULT([no])
7923     EPM=NO
7925 AC_SUBST(EPM)
7927 ENABLE_LWP=
7928 if test "$enable_lotuswordpro" = "yes"; then
7929     ENABLE_LWP="TRUE"
7931 AC_SUBST(ENABLE_LWP)
7933 dnl ===================================================================
7934 dnl Check for building ODK
7935 dnl ===================================================================
7936 if test "$enable_odk" = no; then
7937     unset DOXYGEN
7938 else
7939     if test "$with_doxygen" = no; then
7940         AC_MSG_CHECKING([for doxygen])
7941         unset DOXYGEN
7942         AC_MSG_RESULT([no])
7943     else
7944         if test "$with_doxygen" = yes; then
7945             AC_PATH_PROG([DOXYGEN], [doxygen])
7946             if test -z "$DOXYGEN"; then
7947                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7948             fi
7949             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7950                 if ! dot -V 2>/dev/null; then
7951                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7952                 fi
7953             fi
7954         else
7955             AC_MSG_CHECKING([for doxygen])
7956             DOXYGEN=$with_doxygen
7957             AC_MSG_RESULT([$DOXYGEN])
7958         fi
7959         if test -n "$DOXYGEN"; then
7960             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7961             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7962             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7963                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7964             fi
7965         fi
7966     fi
7968 AC_SUBST([DOXYGEN])
7970 AC_MSG_CHECKING([whether to build the ODK])
7971 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7972     AC_MSG_RESULT([yes])
7974     if test "$with_java" != "no"; then
7975         AC_MSG_CHECKING([whether to build unowinreg.dll])
7976         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7977             # build on Win by default
7978             enable_build_unowinreg=yes
7979         fi
7980         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7981             AC_MSG_RESULT([no])
7982             BUILD_UNOWINREG=
7983         else
7984             AC_MSG_RESULT([yes])
7985             BUILD_UNOWINREG=TRUE
7986         fi
7987         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7988             if test -z "$with_mingw_cross_compiler"; then
7989                 dnl Guess...
7990                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7991             elif test -x "$with_mingw_cross_compiler"; then
7992                  MINGWCXX="$with_mingw_cross_compiler"
7993             else
7994                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7995             fi
7997             if test "$MINGWCXX" = "false"; then
7998                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7999             fi
8001             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8002             if test -x "$mingwstrip_test"; then
8003                 MINGWSTRIP="$mingwstrip_test"
8004             else
8005                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8006             fi
8008             if test "$MINGWSTRIP" = "false"; then
8009                 AC_MSG_ERROR(MinGW32 binutils not found.)
8010             fi
8011         fi
8012     fi
8013     BUILD_TYPE="$BUILD_TYPE ODK"
8014 else
8015     AC_MSG_RESULT([no])
8016     BUILD_UNOWINREG=
8018 AC_SUBST(BUILD_UNOWINREG)
8019 AC_SUBST(MINGWCXX)
8020 AC_SUBST(MINGWSTRIP)
8022 dnl ===================================================================
8023 dnl Check for system zlib
8024 dnl ===================================================================
8025 if test "$with_system_zlib" = "auto"; then
8026     case "$_os" in
8027     WINNT)
8028         with_system_zlib="$with_system_libs"
8029         ;;
8030     *)
8031         if test "$enable_fuzzers" != "yes"; then
8032             with_system_zlib=yes
8033         else
8034             with_system_zlib=no
8035         fi
8036         ;;
8037     esac
8040 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8041 dnl and has no pkg-config for it at least on some tinderboxes,
8042 dnl so leaving that out for now
8043 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8044 AC_MSG_CHECKING([which zlib to use])
8045 if test "$with_system_zlib" = "yes"; then
8046     AC_MSG_RESULT([external])
8047     SYSTEM_ZLIB=TRUE
8048     AC_CHECK_HEADER(zlib.h, [],
8049         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8050     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8051         [AC_MSG_ERROR(zlib not found or functional)], [])
8052 else
8053     AC_MSG_RESULT([internal])
8054     SYSTEM_ZLIB=
8055     BUILD_TYPE="$BUILD_TYPE ZLIB"
8056     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8057     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8059 AC_SUBST(ZLIB_CFLAGS)
8060 AC_SUBST(ZLIB_LIBS)
8061 AC_SUBST(SYSTEM_ZLIB)
8063 dnl ===================================================================
8064 dnl Check for system jpeg
8065 dnl ===================================================================
8066 AC_MSG_CHECKING([which libjpeg to use])
8067 if test "$with_system_jpeg" = "yes"; then
8068     AC_MSG_RESULT([external])
8069     SYSTEM_LIBJPEG=TRUE
8070     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8071         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8072     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8073         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8074 else
8075     SYSTEM_LIBJPEG=
8076     AC_MSG_RESULT([internal, libjpeg-turbo])
8077     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8078     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8079     if test "$COM" = "MSC"; then
8080         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8081     else
8082         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8083     fi
8085     case "$host_cpu" in
8086     x86_64 | amd64 | i*86 | x86 | ia32)
8087         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8088         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8089             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8090                 NASM="$LODE_HOME/opt/bin/nasm"
8091             elif test -x "/opt/lo/bin/nasm"; then
8092                 NASM="/opt/lo/bin/nasm"
8093             fi
8094         fi
8096         if test -n "$NASM"; then
8097             AC_MSG_CHECKING([for object file format of host system])
8098             case "$host_os" in
8099               cygwin* | mingw* | pw32* | interix*)
8100                 case "$host_cpu" in
8101                   x86_64)
8102                     objfmt='Win64-COFF'
8103                     ;;
8104                   *)
8105                     objfmt='Win32-COFF'
8106                     ;;
8107                 esac
8108               ;;
8109               msdosdjgpp* | go32*)
8110                 objfmt='COFF'
8111               ;;
8112               os2-emx*) # not tested
8113                 objfmt='MSOMF' # obj
8114               ;;
8115               linux*coff* | linux*oldld*)
8116                 objfmt='COFF' # ???
8117               ;;
8118               linux*aout*)
8119                 objfmt='a.out'
8120               ;;
8121               linux*)
8122                 case "$host_cpu" in
8123                   x86_64)
8124                     objfmt='ELF64'
8125                     ;;
8126                   *)
8127                     objfmt='ELF'
8128                     ;;
8129                 esac
8130               ;;
8131               kfreebsd* | freebsd* | netbsd* | openbsd*)
8132                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8133                   objfmt='BSD-a.out'
8134                 else
8135                   case "$host_cpu" in
8136                     x86_64 | amd64)
8137                       objfmt='ELF64'
8138                       ;;
8139                     *)
8140                       objfmt='ELF'
8141                       ;;
8142                   esac
8143                 fi
8144               ;;
8145               solaris* | sunos* | sysv* | sco*)
8146                 case "$host_cpu" in
8147                   x86_64)
8148                     objfmt='ELF64'
8149                     ;;
8150                   *)
8151                     objfmt='ELF'
8152                     ;;
8153                 esac
8154               ;;
8155               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8156                 case "$host_cpu" in
8157                   x86_64)
8158                     objfmt='Mach-O64'
8159                     ;;
8160                   *)
8161                     objfmt='Mach-O'
8162                     ;;
8163                 esac
8164               ;;
8165               *)
8166                 objfmt='ELF ?'
8167               ;;
8168             esac
8170             AC_MSG_RESULT([$objfmt])
8171             if test "$objfmt" = 'ELF ?'; then
8172               objfmt='ELF'
8173               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8174             fi
8176             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8177             case "$objfmt" in
8178               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8179               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8180               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8181               COFF)       NAFLAGS='-fcoff -DCOFF';;
8182               a.out)      NAFLAGS='-faout -DAOUT';;
8183               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8184               ELF)        NAFLAGS='-felf -DELF';;
8185               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8186               RDF)        NAFLAGS='-frdf -DRDF';;
8187               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8188               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8189             esac
8190             AC_MSG_RESULT([$NAFLAGS])
8192             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8193             cat > conftest.asm << EOF
8194             [%line __oline__ "configure"
8195                     section .text
8196                     global  _main,main
8197             _main:
8198             main:   xor     eax,eax
8199                     ret
8200             ]
8202             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8203             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8204               AC_MSG_RESULT(yes)
8205             else
8206               echo "configure: failed program was:" >&AC_FD_CC
8207               cat conftest.asm >&AC_FD_CC
8208               rm -rf conftest*
8209               AC_MSG_RESULT(no)
8210               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8211               NASM=""
8212             fi
8214         fi
8216         if test -z "$NASM"; then
8217 cat << _EOS
8218 ****************************************************************************
8219 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8220 To get one please:
8222 _EOS
8223             if test "$build_os" = "cygwin"; then
8224 cat << _EOS
8225 install a pre-compiled binary for Win32
8227 mkdir -p /opt/lo/bin
8228 cd /opt/lo/bin
8229 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8230 chmod +x nasm
8232 or get and install one from http://www.nasm.us/
8234 Then re-run autogen.sh
8236 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8237 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8239 _EOS
8240             else
8241 cat << _EOS
8242 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8244 _EOS
8245             fi
8246             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8247             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8248         fi
8249       ;;
8250     esac
8253 AC_SUBST(NASM)
8254 AC_SUBST(LIBJPEG_CFLAGS)
8255 AC_SUBST(LIBJPEG_LIBS)
8256 AC_SUBST(SYSTEM_LIBJPEG)
8258 dnl ===================================================================
8259 dnl Check for system clucene
8260 dnl ===================================================================
8261 dnl we should rather be using
8262 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8263 dnl but the contribs-lib check seems tricky
8264 AC_MSG_CHECKING([which clucene to use])
8265 if test "$with_system_clucene" = "yes"; then
8266     AC_MSG_RESULT([external])
8267     SYSTEM_CLUCENE=TRUE
8268     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8269     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8270     FilterLibs "${CLUCENE_LIBS}"
8271     CLUCENE_LIBS="${filteredlibs}"
8272     AC_LANG_PUSH([C++])
8273     save_CXXFLAGS=$CXXFLAGS
8274     save_CPPFLAGS=$CPPFLAGS
8275     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8276     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8277     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8278     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8279     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8280                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8281     CXXFLAGS=$save_CXXFLAGS
8282     CPPFLAGS=$save_CPPFLAGS
8283     AC_LANG_POP([C++])
8285     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8286 else
8287     AC_MSG_RESULT([internal])
8288     SYSTEM_CLUCENE=
8289     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8291 AC_SUBST(SYSTEM_CLUCENE)
8292 AC_SUBST(CLUCENE_CFLAGS)
8293 AC_SUBST(CLUCENE_LIBS)
8295 dnl ===================================================================
8296 dnl Check for system expat
8297 dnl ===================================================================
8298 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8300 dnl ===================================================================
8301 dnl Check for system xmlsec
8302 dnl ===================================================================
8303 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8305 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8306 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8307     ENABLE_EOT="TRUE"
8308     AC_DEFINE([ENABLE_EOT])
8309     AC_MSG_RESULT([yes])
8311     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8312 else
8313     ENABLE_EOT=
8314     AC_MSG_RESULT([no])
8316 AC_SUBST([ENABLE_EOT])
8318 dnl ===================================================================
8319 dnl Check for DLP libs
8320 dnl ===================================================================
8321 AS_IF([test "$COM" = "MSC"],
8322       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8323       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8325 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8327 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8329 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8331 AS_IF([test "$COM" = "MSC"],
8332       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8333       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8335 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8337 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8339 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8340 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8342 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8344 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8346 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8348 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8349 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8351 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8352 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8354 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8356 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8357 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8359 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8361 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8363 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8365 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8367 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8368 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8370 dnl ===================================================================
8371 dnl Check for system lcms2
8372 dnl ===================================================================
8373 if test "$with_system_lcms2" != "yes"; then
8374     SYSTEM_LCMS2=
8376 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8377 if test "$GCC" = "yes"; then
8378     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8380 if test "$COM" = "MSC"; then # override the above
8381     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8384 dnl ===================================================================
8385 dnl Check for system cppunit
8386 dnl ===================================================================
8387 if test "$_os" != "Android" ; then
8388     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8391 dnl ===================================================================
8392 dnl Check whether freetype is available
8393 dnl ===================================================================
8394 if test  "$test_freetype" = "yes"; then
8395     AC_MSG_CHECKING([whether freetype is available])
8396     # FreeType has 3 different kinds of versions
8397     # * release, like 2.4.10
8398     # * libtool, like 13.0.7 (this what pkg-config returns)
8399     # * soname
8400     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8401     #
8402     # 9.9.3 is 2.2.0
8403     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8404     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8405     FilterLibs "${FREETYPE_LIBS}"
8406     FREETYPE_LIBS="${filteredlibs}"
8407     SYSTEM_FREETYPE=TRUE
8408 else
8409     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8410     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8412 AC_SUBST(FREETYPE_CFLAGS)
8413 AC_SUBST(FREETYPE_LIBS)
8414 AC_SUBST([SYSTEM_FREETYPE])
8416 # ===================================================================
8417 # Check for system libxslt
8418 # to prevent incompatibilities between internal libxml2 and external libxslt,
8419 # or vice versa, use with_system_libxml here
8420 # ===================================================================
8421 if test "$with_system_libxml" = "auto"; then
8422     case "$_os" in
8423     WINNT|iOS|Android)
8424         with_system_libxml="$with_system_libs"
8425         ;;
8426     *)
8427         if test "$enable_fuzzers" != "yes"; then
8428             with_system_libxml=yes
8429         else
8430             with_system_libxml=no
8431         fi
8432         ;;
8433     esac
8436 AC_MSG_CHECKING([which libxslt to use])
8437 if test "$with_system_libxml" = "yes"; then
8438     AC_MSG_RESULT([external])
8439     SYSTEM_LIBXSLT=TRUE
8440     if test "$_os" = "Darwin"; then
8441         dnl make sure to use SDK path
8442         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8443         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8444         dnl omit -L/usr/lib
8445         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8446         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8447     else
8448         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8449         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8450         FilterLibs "${LIBXSLT_LIBS}"
8451         LIBXSLT_LIBS="${filteredlibs}"
8452         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8453         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8454         FilterLibs "${LIBEXSLT_LIBS}"
8455         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8456     fi
8458     dnl Check for xsltproc
8459     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8460     if test "$XSLTPROC" = "no"; then
8461         AC_MSG_ERROR([xsltproc is required])
8462     fi
8463 else
8464     AC_MSG_RESULT([internal])
8465     SYSTEM_LIBXSLT=
8466     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8468     if test "$cross_compiling" = "yes"; then
8469         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8470         if test "$XSLTPROC" = "no"; then
8471             AC_MSG_ERROR([xsltproc is required])
8472         fi
8473     fi
8475 AC_SUBST(SYSTEM_LIBXSLT)
8476 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8477     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8479 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8481 AC_SUBST(LIBEXSLT_CFLAGS)
8482 AC_SUBST(LIBEXSLT_LIBS)
8483 AC_SUBST(LIBXSLT_CFLAGS)
8484 AC_SUBST(LIBXSLT_LIBS)
8485 AC_SUBST(XSLTPROC)
8487 # ===================================================================
8488 # Check for system libxml
8489 # ===================================================================
8490 AC_MSG_CHECKING([which libxml to use])
8491 if test "$with_system_libxml" = "yes"; then
8492     AC_MSG_RESULT([external])
8493     SYSTEM_LIBXML=TRUE
8494     if test "$_os" = "Darwin"; then
8495         dnl make sure to use SDK path
8496         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8497         dnl omit -L/usr/lib
8498         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8499     elif test $_os = iOS; then
8500         dnl make sure to use SDK path
8501         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8502         LIBXML_CFLAGS="-I$usr/include/libxml2"
8503         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8504     else
8505         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8506         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8507         FilterLibs "${LIBXML_LIBS}"
8508         LIBXML_LIBS="${filteredlibs}"
8509     fi
8511     dnl Check for xmllint
8512     AC_PATH_PROG(XMLLINT, xmllint, no)
8513     if test "$XMLLINT" = "no"; then
8514         AC_MSG_ERROR([xmllint is required])
8515     fi
8516 else
8517     AC_MSG_RESULT([internal])
8518     SYSTEM_LIBXML=
8519     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8520     if test "$COM" = "MSC"; then
8521         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8522     fi
8523     if test "$COM" = "MSC"; then
8524         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8525     else
8526         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8527     fi
8528     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8530 AC_SUBST(SYSTEM_LIBXML)
8531 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8532     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8534 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8535 AC_SUBST(LIBXML_CFLAGS)
8536 AC_SUBST(LIBXML_LIBS)
8537 AC_SUBST(XMLLINT)
8539 # =====================================================================
8540 # Checking for a Python interpreter with version >= 2.7.
8541 # Build and runtime requires Python 3 compatible version (>= 2.7).
8542 # Optionally user can pass an option to configure, i. e.
8543 # ./configure PYTHON=/usr/bin/python
8544 # =====================================================================
8545 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8546     if test -n "$PYTHON"; then
8547         PYTHON_FOR_BUILD=$PYTHON
8548     else
8549         # This allows a lack of system python with no error, we use internal one in that case.
8550         AM_PATH_PYTHON([2.7],, [:])
8551         # Clean PYTHON_VERSION checked below if cross-compiling
8552         PYTHON_VERSION=""
8553         if test "$PYTHON" != ":"; then
8554             PYTHON_FOR_BUILD=$PYTHON
8555         fi
8556     fi
8558 AC_SUBST(PYTHON_FOR_BUILD)
8560 # Checks for Python to use for Pyuno
8561 AC_MSG_CHECKING([which Python to use for Pyuno])
8562 case "$enable_python" in
8563 no|disable)
8564     if test -z $PYTHON_FOR_BUILD; then
8565         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8566         # requirement from the choice whether to include Python stuff in the installer, but why
8567         # bother?
8568         AC_MSG_ERROR([Python is required at build time.])
8569     fi
8570     enable_python=no
8571     AC_MSG_RESULT([none])
8572     ;;
8573 ""|yes|auto)
8574     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8575         AC_MSG_RESULT([no, overridden by --disable-scripting])
8576         enable_python=no
8577     elif test $build_os = cygwin; then
8578         dnl When building on Windows we don't attempt to use any installed
8579         dnl "system"  Python.
8580         AC_MSG_RESULT([fully internal])
8581         enable_python=internal
8582     elif test "$cross_compiling" = yes; then
8583         AC_MSG_RESULT([system])
8584         enable_python=system
8585     else
8586         # Unset variables set by the above AM_PATH_PYTHON so that
8587         # we actually do check anew.
8588         AC_MSG_RESULT([])
8589         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
8590         AM_PATH_PYTHON([3.3],, [:])
8591         AC_MSG_CHECKING([which Python to use for Pyuno])
8592         if test "$PYTHON" = ":"; then
8593             if test -z "$PYTHON_FOR_BUILD"; then
8594                 AC_MSG_RESULT([fully internal])
8595             else
8596                 AC_MSG_RESULT([internal])
8597             fi
8598             enable_python=internal
8599         else
8600             AC_MSG_RESULT([system])
8601             enable_python=system
8602         fi
8603     fi
8604     ;;
8605 internal)
8606     AC_MSG_RESULT([internal])
8607     ;;
8608 fully-internal)
8609     AC_MSG_RESULT([fully internal])
8610     enable_python=internal
8611     ;;
8612 system)
8613     AC_MSG_RESULT([system])
8614     if test "$_os" = Darwin; then
8615         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])
8616     fi
8617     ;;
8619     AC_MSG_ERROR([Incorrect --enable-python option])
8620     ;;
8621 esac
8623 if test $enable_python != no; then
8624     BUILD_TYPE="$BUILD_TYPE PYUNO"
8627 if test $enable_python = system; then
8628     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8629         # Fallback: Accept these in the environment, or as set above
8630         # for MacOSX.
8631         :
8632     elif test "$cross_compiling" != yes; then
8633         # Unset variables set by the above AM_PATH_PYTHON so that
8634         # we actually do check anew.
8635         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
8636         # This causes an error if no python command is found
8637         AM_PATH_PYTHON([3.3])
8638         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8639         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8640         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8641         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8642         if test -z "$PKG_CONFIG"; then
8643             PYTHON_CFLAGS="-I$python_include"
8644             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8645         elif $PKG_CONFIG --exists python-$python_version-embed; then
8646             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8647             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8648         elif $PKG_CONFIG --exists python-$python_version; then
8649             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8650             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8651         else
8652             PYTHON_CFLAGS="-I$python_include"
8653             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8654         fi
8655         FilterLibs "${PYTHON_LIBS}"
8656         PYTHON_LIBS="${filteredlibs}"
8657     else
8658         dnl How to find out the cross-compilation Python installation path?
8659         AC_MSG_CHECKING([for python version])
8660         AS_IF([test -n "$PYTHON_VERSION"],
8661               [AC_MSG_RESULT([$PYTHON_VERSION])],
8662               [AC_MSG_RESULT([not found])
8663                AC_MSG_ERROR([no usable python found])])
8664         test -n "$PYTHON_CFLAGS" && break
8665     fi
8667     dnl Check if the headers really work
8668     save_CPPFLAGS="$CPPFLAGS"
8669     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8670     AC_CHECK_HEADER(Python.h)
8671     CPPFLAGS="$save_CPPFLAGS"
8673     # let the PYTHON_FOR_BUILD match the same python installation that
8674     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8675     # better for PythonTests.
8676     PYTHON_FOR_BUILD=$PYTHON
8679 if test "$with_lxml" != no; then
8680     if test -z "$PYTHON_FOR_BUILD"; then
8681         case $build_os in
8682             cygwin)
8683                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8684                 ;;
8685             *)
8686                 if test "$cross_compiling" != yes ; then
8687                     BUILD_TYPE="$BUILD_TYPE LXML"
8688                 fi
8689                 ;;
8690         esac
8691     else
8692         AC_MSG_CHECKING([for python lxml])
8693         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8694             AC_MSG_RESULT([yes])
8695         else
8696             case $build_os in
8697                 cygwin)
8698                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8699                     ;;
8700                 *)
8701                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8702                         BUILD_TYPE="$BUILD_TYPE LXML"
8703                         AC_MSG_RESULT([no, using internal lxml])
8704                     else
8705                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8706                     fi
8707                     ;;
8708             esac
8709         fi
8710     fi
8713 dnl By now enable_python should be "system", "internal" or "no"
8714 case $enable_python in
8715 system)
8716     SYSTEM_PYTHON=TRUE
8718     if test "x$ac_cv_header_Python_h" != "xyes"; then
8719        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8720     fi
8722     AC_LANG_PUSH(C)
8723     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8724     AC_MSG_CHECKING([for correct python library version])
8725        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8726 #include <Python.h>
8728 int main(int argc, char **argv) {
8729    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8730        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8731    else return 1;
8733        ]])],[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])])
8734     CFLAGS=$save_CFLAGS
8735     AC_LANG_POP(C)
8737     dnl FIXME Check if the Python library can be linked with, too?
8738     ;;
8740 internal)
8741     SYSTEM_PYTHON=
8742     PYTHON_VERSION_MAJOR=3
8743     PYTHON_VERSION_MINOR=5
8744     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8745     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8746         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8747     fi
8748     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8749     BUILD_TYPE="$BUILD_TYPE PYTHON"
8750     # Embedded Python dies without Home set
8751     if test "$HOME" = ""; then
8752         export HOME=""
8753     fi
8754     ;;
8756     DISABLE_PYTHON=TRUE
8757     SYSTEM_PYTHON=
8758     ;;
8760     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8761     ;;
8762 esac
8764 AC_SUBST(DISABLE_PYTHON)
8765 AC_SUBST(SYSTEM_PYTHON)
8766 AC_SUBST(PYTHON_CFLAGS)
8767 AC_SUBST(PYTHON_LIBS)
8768 AC_SUBST(PYTHON_VERSION)
8769 AC_SUBST(PYTHON_VERSION_MAJOR)
8770 AC_SUBST(PYTHON_VERSION_MINOR)
8772 ENABLE_MARIADBC=TRUE
8773 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8774     ENABLE_MARIADBC=
8776 MARIADBC_MAJOR=1
8777 MARIADBC_MINOR=0
8778 MARIADBC_MICRO=2
8779 if test "$ENABLE_MARIADBC" = "TRUE"; then
8780     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8783 AC_SUBST(ENABLE_MARIADBC)
8784 AC_SUBST(MARIADBC_MAJOR)
8785 AC_SUBST(MARIADBC_MINOR)
8786 AC_SUBST(MARIADBC_MICRO)
8788 if test "$ENABLE_MARIADBC" = "TRUE"; then
8789     dnl ===================================================================
8790     dnl Check for system MariaDB
8791     dnl ===================================================================
8792     AC_MSG_CHECKING([which MariaDB to use])
8793     if test "$with_system_mariadb" = "yes"; then
8794         AC_MSG_RESULT([external])
8795         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8796         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8797         if test -z "$MARIADBCONFIG"; then
8798             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8799             if test -z "$MARIADBCONFIG"; then
8800                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8801                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8802             fi
8803         fi
8804         AC_MSG_CHECKING([MariaDB version])
8805         MARIADB_VERSION=`$MARIADBCONFIG --version`
8806         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8807         if test "$MARIADB_MAJOR" -ge "5"; then
8808             AC_MSG_RESULT([OK])
8809         else
8810             AC_MSG_ERROR([too old, use 5.0.x or later])
8811         fi
8812         AC_MSG_CHECKING([for MariaDB Client library])
8813         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8814         if test "$COM_IS_CLANG" = TRUE; then
8815             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8816         fi
8817         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8818         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8819         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8820         dnl linux32:
8821         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8822             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8823             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8824                 | sed -e 's|/lib64/|/lib/|')
8825         fi
8826         FilterLibs "${MARIADB_LIBS}"
8827         MARIADB_LIBS="${filteredlibs}"
8828         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8829         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8830         if test "$enable_bundle_mariadb" = "yes"; then
8831             AC_MSG_RESULT([yes])
8832             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8833             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8835 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8837 /g' | grep -E '(mysqlclient|mariadb)')
8838             if test "$_os" = "Darwin"; then
8839                 LIBMARIADB=${LIBMARIADB}.dylib
8840             elif test "$_os" = "WINNT"; then
8841                 LIBMARIADB=${LIBMARIADB}.dll
8842             else
8843                 LIBMARIADB=${LIBMARIADB}.so
8844             fi
8845             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8846             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8847             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8848                 AC_MSG_RESULT([found.])
8849                 PathFormat "$LIBMARIADB_PATH"
8850                 LIBMARIADB_PATH="$formatted_path"
8851             else
8852                 AC_MSG_ERROR([not found.])
8853             fi
8854         else
8855             AC_MSG_RESULT([no])
8856             BUNDLE_MARIADB_CONNECTOR_C=
8857         fi
8858     else
8859         AC_MSG_RESULT([internal])
8860         SYSTEM_MARIADB_CONNECTOR_C=
8861         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8862         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8863         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8864     fi
8866     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8867     AC_SUBST(MARIADB_CFLAGS)
8868     AC_SUBST(MARIADB_LIBS)
8869     AC_SUBST(LIBMARIADB)
8870     AC_SUBST(LIBMARIADB_PATH)
8871     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8874 dnl ===================================================================
8875 dnl Check for system hsqldb
8876 dnl ===================================================================
8877 if test "$with_java" != "no"; then
8878     HSQLDB_USE_JDBC_4_1=
8879     AC_MSG_CHECKING([which hsqldb to use])
8880     if test "$with_system_hsqldb" = "yes"; then
8881         AC_MSG_RESULT([external])
8882         SYSTEM_HSQLDB=TRUE
8883         if test -z $HSQLDB_JAR; then
8884             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8885         fi
8886         if ! test -f $HSQLDB_JAR; then
8887                AC_MSG_ERROR(hsqldb.jar not found.)
8888         fi
8889         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8890         export HSQLDB_JAR
8891         if $PERL -e \
8892            'use Archive::Zip;
8893             my $file = "$ENV{'HSQLDB_JAR'}";
8894             my $zip = Archive::Zip->new( $file );
8895             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8896             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8897             {
8898                 push @l, split(/\n/, $mf);
8899                 foreach my $line (@l)
8900                 {
8901                     if ($line =~ m/Specification-Version:/)
8902                     {
8903                         ($t, $version) = split (/:/,$line);
8904                         $version =~ s/^\s//;
8905                         ($a, $b, $c, $d) = split (/\./,$version);
8906                         if ($c == "0" && $d > "8")
8907                         {
8908                             exit 0;
8909                         }
8910                         else
8911                         {
8912                             exit 1;
8913                         }
8914                     }
8915                 }
8916             }
8917             else
8918             {
8919                 exit 1;
8920             }'; then
8921             AC_MSG_RESULT([yes])
8922         else
8923             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8924         fi
8925     else
8926         AC_MSG_RESULT([internal])
8927         SYSTEM_HSQLDB=
8928         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8929         NEED_ANT=TRUE
8930         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8931         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8932         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8933             AC_MSG_RESULT([yes])
8934             HSQLDB_USE_JDBC_4_1=TRUE
8935         else
8936             AC_MSG_RESULT([no])
8937         fi
8938     fi
8939     AC_SUBST(SYSTEM_HSQLDB)
8940     AC_SUBST(HSQLDB_JAR)
8941     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8944 dnl ===================================================================
8945 dnl Check for PostgreSQL stuff
8946 dnl ===================================================================
8947 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8948 if test "x$enable_postgresql_sdbc" != "xno"; then
8949     AC_MSG_RESULT([yes])
8950     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8952     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8953         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8954     fi
8955     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8956         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8957     fi
8959     postgres_interface=""
8960     if test "$with_system_postgresql" = "yes"; then
8961         postgres_interface="external PostgreSQL"
8962         SYSTEM_POSTGRESQL=TRUE
8963         if test "$_os" = Darwin; then
8964             supp_path=''
8965             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8966                 pg_supp_path="$P_SEP$d$pg_supp_path"
8967             done
8968         fi
8969         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8970         if test -n "$PGCONFIG"; then
8971             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8972             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8973         else
8974             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8975               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8976               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8977             ],[
8978               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8979             ])
8980         fi
8981         FilterLibs "${POSTGRESQL_LIB}"
8982         POSTGRESQL_LIB="${filteredlibs}"
8983     else
8984         # if/when anything else than PostgreSQL uses Kerberos,
8985         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8986         WITH_KRB5=
8987         WITH_GSSAPI=
8988         case "$_os" in
8989         Darwin)
8990             # macOS has system MIT Kerberos 5 since 10.4
8991             if test "$with_krb5" != "no"; then
8992                 WITH_KRB5=TRUE
8993                 save_LIBS=$LIBS
8994                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8995                 # that the libraries where these functions are located on macOS will change, is it?
8996                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8997                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8998                 KRB5_LIBS=$LIBS
8999                 LIBS=$save_LIBS
9000                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9001                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9002                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9003                 LIBS=$save_LIBS
9004             fi
9005             if test "$with_gssapi" != "no"; then
9006                 WITH_GSSAPI=TRUE
9007                 save_LIBS=$LIBS
9008                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9009                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9010                 GSSAPI_LIBS=$LIBS
9011                 LIBS=$save_LIBS
9012             fi
9013             ;;
9014         WINNT)
9015             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9016                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9017             fi
9018             ;;
9019         Linux|GNU|*BSD|DragonFly)
9020             if test "$with_krb5" != "no"; then
9021                 WITH_KRB5=TRUE
9022                 save_LIBS=$LIBS
9023                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9024                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9025                 KRB5_LIBS=$LIBS
9026                 LIBS=$save_LIBS
9027                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9028                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9029                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9030                 LIBS=$save_LIBS
9031             fi
9032             if test "$with_gssapi" != "no"; then
9033                 WITH_GSSAPI=TRUE
9034                 save_LIBS=$LIBS
9035                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9036                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9037                 GSSAPI_LIBS=$LIBS
9038                 LIBS=$save_LIBS
9039             fi
9040             ;;
9041         *)
9042             if test "$with_krb5" = "yes"; then
9043                 WITH_KRB5=TRUE
9044                 save_LIBS=$LIBS
9045                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9046                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9047                 KRB5_LIBS=$LIBS
9048                 LIBS=$save_LIBS
9049                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9050                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9051                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9052                 LIBS=$save_LIBS
9053             fi
9054             if test "$with_gssapi" = "yes"; then
9055                 WITH_GSSAPI=TRUE
9056                 save_LIBS=$LIBS
9057                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9058                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9059                 LIBS=$save_LIBS
9060                 GSSAPI_LIBS=$LIBS
9061             fi
9062         esac
9064         if test -n "$with_libpq_path"; then
9065             SYSTEM_POSTGRESQL=TRUE
9066             postgres_interface="external libpq"
9067             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9068             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9069         else
9070             SYSTEM_POSTGRESQL=
9071             postgres_interface="internal"
9072             POSTGRESQL_LIB=""
9073             POSTGRESQL_INC="%OVERRIDE_ME%"
9074             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9075         fi
9076     fi
9078     AC_MSG_CHECKING([PostgreSQL C interface])
9079     AC_MSG_RESULT([$postgres_interface])
9081     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9082         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9083         save_CFLAGS=$CFLAGS
9084         save_CPPFLAGS=$CPPFLAGS
9085         save_LIBS=$LIBS
9086         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9087         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9088         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9089         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9090             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9091         CFLAGS=$save_CFLAGS
9092         CPPFLAGS=$save_CPPFLAGS
9093         LIBS=$save_LIBS
9094     fi
9095     BUILD_POSTGRESQL_SDBC=TRUE
9096 else
9097     AC_MSG_RESULT([no])
9099 AC_SUBST(WITH_KRB5)
9100 AC_SUBST(WITH_GSSAPI)
9101 AC_SUBST(GSSAPI_LIBS)
9102 AC_SUBST(KRB5_LIBS)
9103 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9104 AC_SUBST(SYSTEM_POSTGRESQL)
9105 AC_SUBST(POSTGRESQL_INC)
9106 AC_SUBST(POSTGRESQL_LIB)
9108 dnl ===================================================================
9109 dnl Check for Firebird stuff
9110 dnl ===================================================================
9111 ENABLE_FIREBIRD_SDBC=
9112 if test "$enable_firebird_sdbc" = "yes" ; then
9113     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9115     dnl ===================================================================
9116     dnl Check for system Firebird
9117     dnl ===================================================================
9118     AC_MSG_CHECKING([which Firebird to use])
9119     if test "$with_system_firebird" = "yes"; then
9120         AC_MSG_RESULT([external])
9121         SYSTEM_FIREBIRD=TRUE
9122         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9123         if test -z "$FIREBIRDCONFIG"; then
9124             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9125             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9126                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9127             ])
9128             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9129         else
9130             AC_MSG_NOTICE([fb_config found])
9131             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9132             AC_MSG_CHECKING([for Firebird Client library])
9133             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9134             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9135             FilterLibs "${FIREBIRD_LIBS}"
9136             FIREBIRD_LIBS="${filteredlibs}"
9137         fi
9138         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9139         AC_MSG_CHECKING([Firebird version])
9140         if test -n "${FIREBIRD_VERSION}"; then
9141             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9142             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9143             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9144                 AC_MSG_RESULT([OK])
9145             else
9146                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9147             fi
9148         else
9149             __save_CFLAGS="${CFLAGS}"
9150             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9151             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9152 #if defined(FB_API_VER) && FB_API_VER == 30
9153 int fb_api_is_30(void) { return 0; }
9154 #else
9155 #error "Wrong Firebird API version"
9156 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9157             CFLAGS="${__save_CFLAGS}"
9158         fi
9159         ENABLE_FIREBIRD_SDBC=TRUE
9160         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9161     elif test "$enable_database_connectivity" != yes; then
9162         AC_MSG_RESULT([none])
9163     elif test "$cross_compiling" = "yes"; then
9164         AC_MSG_RESULT([none])
9165     else
9166         dnl Embedded Firebird has version 3.0
9167         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9168         dnl We need libatomic_ops for any non X86/X64 system
9169         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9170             dnl ===================================================================
9171             dnl Check for system libatomic_ops
9172             dnl ===================================================================
9173             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9174             if test "$with_system_libatomic_ops" = "yes"; then
9175                 SYSTEM_LIBATOMIC_OPS=TRUE
9176                 AC_CHECK_HEADERS(atomic_ops.h, [],
9177                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9178             else
9179                 SYSTEM_LIBATOMIC_OPS=
9180                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9181                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9182                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9183             fi
9184         fi
9186         AC_MSG_RESULT([internal])
9187         SYSTEM_FIREBIRD=
9188         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9189         FIREBIRD_LIBS="-lfbclient"
9191         if test "$with_system_libtommath" = "yes"; then
9192             SYSTEM_LIBTOMMATH=TRUE
9193             dnl check for tommath presence
9194             save_LIBS=$LIBS
9195             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9196             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9197             LIBS=$save_LIBS
9198         else
9199             SYSTEM_LIBTOMMATH=
9200             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9201             LIBTOMMATH_LIBS="-ltommath"
9202             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9203         fi
9205         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9206         ENABLE_FIREBIRD_SDBC=TRUE
9207         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9208     fi
9210 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9211 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9212 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9213 AC_SUBST(LIBATOMIC_OPS_LIBS)
9214 AC_SUBST(SYSTEM_FIREBIRD)
9215 AC_SUBST(FIREBIRD_CFLAGS)
9216 AC_SUBST(FIREBIRD_LIBS)
9217 AC_SUBST([TOMMATH_CFLAGS])
9218 AC_SUBST([TOMMATH_LIBS])
9220 dnl ===================================================================
9221 dnl Check for system curl
9222 dnl ===================================================================
9223 AC_MSG_CHECKING([which libcurl to use])
9224 if test "$with_system_curl" = "auto"; then
9225     with_system_curl="$with_system_libs"
9228 if test "$with_system_curl" = "yes"; then
9229     AC_MSG_RESULT([external])
9230     SYSTEM_CURL=TRUE
9232     # First try PKGCONFIG and then fall back
9233     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9235     if test -n "$CURL_PKG_ERRORS"; then
9236         AC_PATH_PROG(CURLCONFIG, curl-config)
9237         if test -z "$CURLCONFIG"; then
9238             AC_MSG_ERROR([curl development files not found])
9239         fi
9240         CURL_LIBS=`$CURLCONFIG --libs`
9241         FilterLibs "${CURL_LIBS}"
9242         CURL_LIBS="${filteredlibs}"
9243         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9244         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9246         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9247         case $curl_version in
9248         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9249         dnl so they need to be doubled to end up in the configure script
9250         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9251             AC_MSG_RESULT([yes])
9252             ;;
9253         *)
9254             AC_MSG_ERROR([no, you have $curl_version])
9255             ;;
9256         esac
9257     fi
9259     ENABLE_CURL=TRUE
9260 elif test $_os = iOS; then
9261     # Let's see if we need curl, I think not?
9262     AC_MSG_RESULT([none])
9263     ENABLE_CURL=
9264 else
9265     AC_MSG_RESULT([internal])
9266     SYSTEM_CURL=
9267     BUILD_TYPE="$BUILD_TYPE CURL"
9268     ENABLE_CURL=TRUE
9270 AC_SUBST(SYSTEM_CURL)
9271 AC_SUBST(CURL_CFLAGS)
9272 AC_SUBST(CURL_LIBS)
9273 AC_SUBST(ENABLE_CURL)
9275 dnl ===================================================================
9276 dnl Check for system boost
9277 dnl ===================================================================
9278 AC_MSG_CHECKING([which boost to use])
9279 if test "$with_system_boost" = "yes"; then
9280     AC_MSG_RESULT([external])
9281     SYSTEM_BOOST=TRUE
9282     AX_BOOST_BASE(1.47)
9283     AX_BOOST_DATE_TIME
9284     AX_BOOST_FILESYSTEM
9285     AX_BOOST_IOSTREAMS
9286     AX_BOOST_LOCALE
9287     AC_LANG_PUSH([C++])
9288     save_CXXFLAGS=$CXXFLAGS
9289     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9290     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9291        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9292     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9293        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9294     CXXFLAGS=$save_CXXFLAGS
9295     AC_LANG_POP([C++])
9296     # this is in m4/ax_boost_base.m4
9297     FilterLibs "${BOOST_LDFLAGS}"
9298     BOOST_LDFLAGS="${filteredlibs}"
9299 else
9300     AC_MSG_RESULT([internal])
9301     BUILD_TYPE="$BUILD_TYPE BOOST"
9302     SYSTEM_BOOST=
9303     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9304         # use warning-suppressing wrapper headers
9305         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9306     else
9307         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9308     fi
9310 AC_SUBST(SYSTEM_BOOST)
9312 dnl ===================================================================
9313 dnl Check for system mdds
9314 dnl ===================================================================
9315 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9317 dnl ===================================================================
9318 dnl Check for system glm
9319 dnl ===================================================================
9320 AC_MSG_CHECKING([which glm to use])
9321 if test "$with_system_glm" = "yes"; then
9322     AC_MSG_RESULT([external])
9323     SYSTEM_GLM=TRUE
9324     AC_LANG_PUSH([C++])
9325     AC_CHECK_HEADER([glm/glm.hpp], [],
9326        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9327     AC_LANG_POP([C++])
9328 else
9329     AC_MSG_RESULT([internal])
9330     BUILD_TYPE="$BUILD_TYPE GLM"
9331     SYSTEM_GLM=
9332     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9334 AC_SUBST([GLM_CFLAGS])
9335 AC_SUBST([SYSTEM_GLM])
9337 dnl ===================================================================
9338 dnl Check for system odbc
9339 dnl ===================================================================
9340 AC_MSG_CHECKING([which odbc headers to use])
9341 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
9342     AC_MSG_RESULT([external])
9343     SYSTEM_ODBC_HEADERS=TRUE
9345     if test "$build_os" = "cygwin"; then
9346         save_CPPFLAGS=$CPPFLAGS
9347         find_winsdk
9348         PathFormat "$winsdktest"
9349         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"
9350         AC_CHECK_HEADER(sqlext.h, [],
9351             [AC_MSG_ERROR(odbc not found. install odbc)],
9352             [#include <windows.h>])
9353         CPPFLAGS=$save_CPPFLAGS
9354     else
9355         AC_CHECK_HEADER(sqlext.h, [],
9356             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9357     fi
9358 elif test "$enable_database_connectivity" != yes; then
9359     AC_MSG_RESULT([none])
9360 else
9361     AC_MSG_RESULT([internal])
9362     SYSTEM_ODBC_HEADERS=
9364 AC_SUBST(SYSTEM_ODBC_HEADERS)
9366 dnl ===================================================================
9367 dnl Enable LDAP support
9368 dnl ===================================================================
9370 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9371 AC_MSG_CHECKING([whether to enable LDAP support])
9372     if test "$enable_ldap" != "yes"; then
9373         AC_MSG_RESULT([no])
9374         ENABLE_LDAP=""
9375         enable_ldap=no
9376     else
9377         AC_MSG_RESULT([yes])
9378         ENABLE_LDAP="TRUE"
9379         AC_DEFINE(HAVE_FEATURE_LDAP)
9380     fi
9382 AC_SUBST(ENABLE_LDAP)
9384 dnl ===================================================================
9385 dnl Check for system openldap
9386 dnl ===================================================================
9388 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9389 AC_MSG_CHECKING([which openldap library to use])
9390 if test "$with_system_openldap" = "yes"; then
9391     AC_MSG_RESULT([external])
9392     SYSTEM_OPENLDAP=TRUE
9393     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9394     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9395     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9396 else
9397     AC_MSG_RESULT([internal])
9398     SYSTEM_OPENLDAP=
9399     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9402 AC_SUBST(SYSTEM_OPENLDAP)
9404 dnl ===================================================================
9405 dnl Check for system NSS
9406 dnl ===================================================================
9407 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9408     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9409     AC_DEFINE(HAVE_FEATURE_NSS)
9410     ENABLE_NSS="TRUE"
9411     AC_DEFINE(ENABLE_NSS)
9412 elif test $_os != iOS ; then
9413     with_tls=openssl
9415 AC_SUBST(ENABLE_NSS)
9417 dnl ===================================================================
9418 dnl Check for TLS/SSL and cryptographic implementation to use
9419 dnl ===================================================================
9420 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9421 if test -n "$with_tls"; then
9422     case $with_tls in
9423     openssl)
9424         AC_DEFINE(USE_TLS_OPENSSL)
9425         TLS=OPENSSL
9427         if test "$enable_openssl" != "yes"; then
9428             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9429         fi
9431         # warn that OpenSSL has been selected but not all TLS code has this option
9432         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9433         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9434         ;;
9435     nss)
9436         AC_DEFINE(USE_TLS_NSS)
9437         TLS=NSS
9438         ;;
9439     no)
9440         AC_MSG_WARN([Skipping TLS/SSL])
9441         ;;
9442     *)
9443         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9444 openssl - OpenSSL
9445 nss - Mozilla's Network Security Services (NSS)
9446     ])
9447         ;;
9448     esac
9449 else
9450     # default to using NSS, it results in smaller oox lib
9451     AC_DEFINE(USE_TLS_NSS)
9452     TLS=NSS
9454 AC_MSG_RESULT([$TLS])
9455 AC_SUBST(TLS)
9457 dnl ===================================================================
9458 dnl Check for system sane
9459 dnl ===================================================================
9460 AC_MSG_CHECKING([which sane header to use])
9461 if test "$with_system_sane" = "yes"; then
9462     AC_MSG_RESULT([external])
9463     AC_CHECK_HEADER(sane/sane.h, [],
9464       [AC_MSG_ERROR(sane not found. install sane)], [])
9465 else
9466     AC_MSG_RESULT([internal])
9467     BUILD_TYPE="$BUILD_TYPE SANE"
9470 dnl ===================================================================
9471 dnl Check for system icu
9472 dnl ===================================================================
9473 SYSTEM_GENBRK=
9474 SYSTEM_GENCCODE=
9475 SYSTEM_GENCMN=
9477 ICU_MAJOR=63
9478 ICU_MINOR=1
9479 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9480 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9481 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9482 AC_MSG_CHECKING([which icu to use])
9483 if test "$with_system_icu" = "yes"; then
9484     AC_MSG_RESULT([external])
9485     SYSTEM_ICU=TRUE
9486     AC_LANG_PUSH([C++])
9487     AC_MSG_CHECKING([for unicode/rbbi.h])
9488     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9489     AC_LANG_POP([C++])
9491     if test "$cross_compiling" != "yes"; then
9492         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9493         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9494         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9495         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9496     fi
9498     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9499         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9500         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9501         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9502         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9503         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9504             AC_MSG_RESULT([yes])
9505         else
9506             AC_MSG_RESULT([no])
9507             if test "$with_system_icu_for_build" != "force"; then
9508                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9509 You can use --with-system-icu-for-build=force to use it anyway.])
9510             fi
9511         fi
9512     fi
9514     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9515         # using the system icu tools can lead to version confusion, use the
9516         # ones from the build environment when cross-compiling
9517         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9518         if test -z "$SYSTEM_GENBRK"; then
9519             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9520         fi
9521         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9522         if test -z "$SYSTEM_GENCCODE"; then
9523             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9524         fi
9525         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9526         if test -z "$SYSTEM_GENCMN"; then
9527             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9528         fi
9529         if test "$ICU_MAJOR" -ge "49"; then
9530             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9531             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9532             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9533         else
9534             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9535             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9536             ICU_RECLASSIFIED_HEBREW_LETTER=
9537         fi
9538     fi
9540     if test "$cross_compiling" = "yes"; then
9541         if test "$ICU_MAJOR" -ge "50"; then
9542             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9543             ICU_MINOR=""
9544         fi
9545     fi
9546 else
9547     AC_MSG_RESULT([internal])
9548     SYSTEM_ICU=
9549     BUILD_TYPE="$BUILD_TYPE ICU"
9550     # surprisingly set these only for "internal" (to be used by various other
9551     # external libs): the system icu-config is quite unhelpful and spits out
9552     # dozens of weird flags and also default path -I/usr/include
9553     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9554     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9556 if test "$ICU_MAJOR" -ge "59"; then
9557     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9558     # with -std=c++11 but not all external libraries can be built with that,
9559     # for those use a bit-compatible typedef uint16_t UChar; see
9560     # icu/source/common/unicode/umachine.h
9561     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9562 else
9563     ICU_UCHAR_TYPE=""
9565 AC_SUBST(SYSTEM_ICU)
9566 AC_SUBST(SYSTEM_GENBRK)
9567 AC_SUBST(SYSTEM_GENCCODE)
9568 AC_SUBST(SYSTEM_GENCMN)
9569 AC_SUBST(ICU_MAJOR)
9570 AC_SUBST(ICU_MINOR)
9571 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9572 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9573 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9574 AC_SUBST(ICU_CFLAGS)
9575 AC_SUBST(ICU_LIBS)
9576 AC_SUBST(ICU_UCHAR_TYPE)
9578 dnl ==================================================================
9579 dnl Breakpad
9580 dnl ==================================================================
9581 AC_MSG_CHECKING([whether to enable breakpad])
9582 if test "$enable_breakpad" != yes; then
9583     AC_MSG_RESULT([no])
9584 else
9585     AC_MSG_RESULT([yes])
9586     ENABLE_BREAKPAD="TRUE"
9587     AC_DEFINE(ENABLE_BREAKPAD)
9588     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9589     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9591     AC_MSG_CHECKING([for crashreport config])
9592     if test "$with_symbol_config" = "no"; then
9593         BREAKPAD_SYMBOL_CONFIG="invalid"
9594         AC_MSG_RESULT([no])
9595     else
9596         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9597         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9598         AC_MSG_RESULT([yes])
9599     fi
9600     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9602 AC_SUBST(ENABLE_BREAKPAD)
9604 dnl ==================================================================
9605 dnl libfuzzer
9606 dnl ==================================================================
9607 AC_MSG_CHECKING([whether to enable fuzzers])
9608 if test "$enable_fuzzers" != yes; then
9609     AC_MSG_RESULT([no])
9610 else
9611     AC_MSG_RESULT([yes])
9612     ENABLE_FUZZERS="TRUE"
9613     AC_DEFINE([ENABLE_FUZZERS],1)
9614     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9616 AC_SUBST(ENABLE_FUZZERS)
9618 dnl ===================================================================
9619 dnl Orcus
9620 dnl ===================================================================
9621 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9622 if test "$with_system_orcus" != "yes"; then
9623     if test "$SYSTEM_BOOST" = "TRUE"; then
9624         # ===========================================================
9625         # Determine if we are going to need to link with Boost.System
9626         # ===========================================================
9627         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9628         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9629         dnl in documentation has no effect.
9630         AC_MSG_CHECKING([if we need to link with Boost.System])
9631         AC_LANG_PUSH([C++])
9632         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9633                 @%:@include <boost/version.hpp>
9634             ]],[[
9635                 #if BOOST_VERSION >= 105000
9636                 #   error yes, we need to link with Boost.System
9637                 #endif
9638             ]])],[
9639                 AC_MSG_RESULT([no])
9640             ],[
9641                 AC_MSG_RESULT([yes])
9642                 AX_BOOST_SYSTEM
9643         ])
9644         AC_LANG_POP([C++])
9645     fi
9647 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9648 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9649 AC_SUBST([BOOST_SYSTEM_LIB])
9650 AC_SUBST(SYSTEM_LIBORCUS)
9652 dnl ===================================================================
9653 dnl HarfBuzz
9654 dnl ===================================================================
9655 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9656                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9657                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9659 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9660                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9661                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9663 if test "$COM" = "MSC"; then # override the above
9664     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9665     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9668 if test "$with_system_harfbuzz" = "yes"; then
9669     if test "$with_system_graphite" = "no"; then
9670         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9671     fi
9672     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9673     _save_libs="$LIBS"
9674     _save_cflags="$CFLAGS"
9675     LIBS="$LIBS $HARFBUZZ_LIBS"
9676     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9677     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9678     LIBS="$_save_libs"
9679     CFLAGS="$_save_cflags"
9680 else
9681     if test "$with_system_graphite" = "yes"; then
9682         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9683     fi
9686 AC_MSG_CHECKING([whether to use X11])
9687 dnl ***************************************
9688 dnl testing for X libraries and includes...
9689 dnl ***************************************
9690 if test "$USING_X11" = TRUE; then
9691     AC_DEFINE(HAVE_FEATURE_X11)
9693 AC_MSG_RESULT([$USING_X11])
9695 if test "$USING_X11" = TRUE; then
9696     AC_PATH_X
9697     AC_PATH_XTRA
9698     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9700     if test -z "$x_includes"; then
9701         x_includes="default_x_includes"
9702     fi
9703     if test -z "$x_libraries"; then
9704         x_libraries="default_x_libraries"
9705     fi
9706     CFLAGS="$CFLAGS $X_CFLAGS"
9707     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9708     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9709 else
9710     x_includes="no_x_includes"
9711     x_libraries="no_x_libraries"
9714 if test "$USING_X11" = TRUE; then
9715     dnl ===================================================================
9716     dnl Check for extension headers
9717     dnl ===================================================================
9718     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9719      [#include <X11/extensions/shape.h>])
9721     # vcl needs ICE and SM
9722     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9723     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9724         [AC_MSG_ERROR(ICE library not found)])
9725     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9726     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9727         [AC_MSG_ERROR(SM library not found)])
9730 dnl ===================================================================
9731 dnl Check for system Xrender
9732 dnl ===================================================================
9733 AC_MSG_CHECKING([whether to use Xrender])
9734 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9735     AC_MSG_RESULT([yes])
9736     PKG_CHECK_MODULES(XRENDER, xrender)
9737     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9738     FilterLibs "${XRENDER_LIBS}"
9739     XRENDER_LIBS="${filteredlibs}"
9740     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9741       [AC_MSG_ERROR(libXrender not found or functional)], [])
9742     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9743       [AC_MSG_ERROR(Xrender not found. install X)], [])
9744 else
9745     AC_MSG_RESULT([no])
9747 AC_SUBST(XRENDER_CFLAGS)
9748 AC_SUBST(XRENDER_LIBS)
9750 dnl ===================================================================
9751 dnl Check for XRandr
9752 dnl ===================================================================
9753 AC_MSG_CHECKING([whether to enable RandR support])
9754 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9755     AC_MSG_RESULT([yes])
9756     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9757     if test "$ENABLE_RANDR" != "TRUE"; then
9758         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9759                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9760         XRANDR_CFLAGS=" "
9761         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9762           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9763         XRANDR_LIBS="-lXrandr "
9764         ENABLE_RANDR="TRUE"
9765     fi
9766     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9767     FilterLibs "${XRANDR_LIBS}"
9768     XRANDR_LIBS="${filteredlibs}"
9769 else
9770     ENABLE_RANDR=""
9771     AC_MSG_RESULT([no])
9773 AC_SUBST(XRANDR_CFLAGS)
9774 AC_SUBST(XRANDR_LIBS)
9775 AC_SUBST(ENABLE_RANDR)
9777 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9778     WITH_WEBDAV="serf"
9780 if test $_os = iOS -o $_os = Android; then
9781     WITH_WEBDAV="no"
9783 AC_MSG_CHECKING([for webdav library])
9784 case "$WITH_WEBDAV" in
9785 serf)
9786     AC_MSG_RESULT([serf])
9787     # Check for system apr-util
9788     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9789                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9790                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9791     if test "$COM" = "MSC"; then
9792         APR_LIB_DIR="LibR"
9793         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9794         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9795     fi
9797     # Check for system serf
9798     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9799                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9800     if test "$COM" = "MSC"; then
9801         SERF_LIB_DIR="Release"
9802         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9803         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9804     fi
9805     ;;
9806 neon)
9807     AC_MSG_RESULT([neon])
9808     # Check for system neon
9809     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9810     if test "$with_system_neon" = "yes"; then
9811         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9812     else
9813         NEON_VERSION=0295
9814     fi
9815     AC_SUBST(NEON_VERSION)
9816     ;;
9818     AC_MSG_RESULT([none, disabled])
9819     WITH_WEBDAV=""
9820     ;;
9821 esac
9822 AC_SUBST(WITH_WEBDAV)
9824 dnl ===================================================================
9825 dnl Check for disabling cve_tests
9826 dnl ===================================================================
9827 AC_MSG_CHECKING([whether to execute CVE tests])
9828 # If not explicitly enabled or disabled, default
9829 if test -z "$enable_cve_tests"; then
9830     case "$OS" in
9831     WNT)
9832         # Default cves off for Windows with its wild and wonderful
9833         # variety of AV software kicking in and panicking
9834         enable_cve_tests=no
9835         ;;
9836     *)
9837         # otherwise yes
9838         enable_cve_tests=yes
9839         ;;
9840     esac
9842 if test "$enable_cve_tests" = "no"; then
9843     AC_MSG_RESULT([no])
9844     DISABLE_CVE_TESTS=TRUE
9845     AC_SUBST(DISABLE_CVE_TESTS)
9846 else
9847     AC_MSG_RESULT([yes])
9850 dnl ===================================================================
9851 dnl Check for enabling chart XShape tests
9852 dnl ===================================================================
9853 AC_MSG_CHECKING([whether to execute chart XShape tests])
9854 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9855     AC_MSG_RESULT([yes])
9856     ENABLE_CHART_TESTS=TRUE
9857     AC_SUBST(ENABLE_CHART_TESTS)
9858 else
9859     AC_MSG_RESULT([no])
9862 dnl ===================================================================
9863 dnl Check for system openssl
9864 dnl ===================================================================
9865 DISABLE_OPENSSL=
9866 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9867 if test "$enable_openssl" = "yes"; then
9868     AC_MSG_RESULT([no])
9869     if test "$_os" = Darwin ; then
9870         # OpenSSL is deprecated when building for 10.7 or later.
9871         #
9872         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9873         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9875         with_system_openssl=no
9876         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9877     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9878             && test "$with_system_openssl" != "no"; then
9879         with_system_openssl=yes
9880         SYSTEM_OPENSSL=TRUE
9881         OPENSSL_CFLAGS=
9882         OPENSSL_LIBS="-lssl -lcrypto"
9883     else
9884         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9885     fi
9886     if test "$with_system_openssl" = "yes"; then
9887         AC_MSG_CHECKING([whether openssl supports SHA512])
9888         AC_LANG_PUSH([C])
9889         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9890             SHA512_CTX context;
9891 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9892         AC_LANG_POP(C)
9893     fi
9894 else
9895     AC_MSG_RESULT([yes])
9896     DISABLE_OPENSSL=TRUE
9898     # warn that although OpenSSL is disabled, system libraries may depend on it
9899     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9900     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9903 AC_SUBST([DISABLE_OPENSSL])
9905 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9906     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9907         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9908         enable_cipher_openssl_backend=no
9909     else
9910         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9911     fi
9913 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9914 ENABLE_CIPHER_OPENSSL_BACKEND=
9915 if test "$enable_cipher_openssl_backend" = yes; then
9916     AC_MSG_RESULT([yes])
9917     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9918 else
9919     AC_MSG_RESULT([no])
9921 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9923 dnl ===================================================================
9924 dnl Check for building gnutls
9925 dnl ===================================================================
9926 AC_MSG_CHECKING([whether to use gnutls])
9927 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9928     AC_MSG_RESULT([yes])
9929     AM_PATH_LIBGCRYPT()
9930     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9931         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9932                       available in the system to use as replacement.]]))
9933     FilterLibs "${LIBGCRYPT_LIBS}"
9934     LIBGCRYPT_LIBS="${filteredlibs}"
9935 else
9936     AC_MSG_RESULT([no])
9939 AC_SUBST([LIBGCRYPT_CFLAGS])
9940 AC_SUBST([LIBGCRYPT_LIBS])
9942 dnl ===================================================================
9943 dnl Check for system redland
9944 dnl ===================================================================
9945 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9946 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9947 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9948 if test "$with_system_redland" = "yes"; then
9949     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9950             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9951 else
9952     RAPTOR_MAJOR="0"
9953     RASQAL_MAJOR="3"
9954     REDLAND_MAJOR="0"
9956 AC_SUBST(RAPTOR_MAJOR)
9957 AC_SUBST(RASQAL_MAJOR)
9958 AC_SUBST(REDLAND_MAJOR)
9960 dnl ===================================================================
9961 dnl Check for system hunspell
9962 dnl ===================================================================
9963 AC_MSG_CHECKING([which libhunspell to use])
9964 if test "$with_system_hunspell" = "yes"; then
9965     AC_MSG_RESULT([external])
9966     SYSTEM_HUNSPELL=TRUE
9967     AC_LANG_PUSH([C++])
9968     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9969     if test "$HUNSPELL_PC" != "TRUE"; then
9970         AC_CHECK_HEADER(hunspell.hxx, [],
9971             [
9972             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9973             [AC_MSG_ERROR(hunspell headers not found.)], [])
9974             ], [])
9975         AC_CHECK_LIB([hunspell], [main], [:],
9976            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9977         HUNSPELL_LIBS=-lhunspell
9978     fi
9979     AC_LANG_POP([C++])
9980     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9981     FilterLibs "${HUNSPELL_LIBS}"
9982     HUNSPELL_LIBS="${filteredlibs}"
9983 else
9984     AC_MSG_RESULT([internal])
9985     SYSTEM_HUNSPELL=
9986     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9987     if test "$COM" = "MSC"; then
9988         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9989     else
9990         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9991     fi
9992     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9994 AC_SUBST(SYSTEM_HUNSPELL)
9995 AC_SUBST(HUNSPELL_CFLAGS)
9996 AC_SUBST(HUNSPELL_LIBS)
9998 dnl ===================================================================
9999 dnl Check for system qrcodegen
10000 dnl ===================================================================
10001 AC_MSG_CHECKING([which libqrcodegen to use])
10002 if test "$with_system_qrcodegen" = "yes"; then
10003     AC_MSG_RESULT([external])
10004     SYSTEM_QRCODEGEN=TRUE
10005     AC_LANG_PUSH([C++])
10006     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10007         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10008     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10009         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10010     QRCODEGEN_LIBS=-lqrcodegencpp
10011     AC_LANG_POP([C++])
10012     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10013     FilterLibs "${QRCODEGEN_LIBS}"
10014     QRCODEGEN_LIBS="${filteredlibs}"
10015 else
10016     AC_MSG_RESULT([internal])
10017     SYSTEM_QRCODEGEN=
10018     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10020 AC_SUBST(SYSTEM_QRCODEGEN)
10021 AC_SUBST(QRCODEGEN_CFLAGS)
10022 AC_SUBST(QRCODEGEN_LIBS)
10024 dnl ===================================================================
10025 dnl Checking for altlinuxhyph
10026 dnl ===================================================================
10027 AC_MSG_CHECKING([which altlinuxhyph to use])
10028 if test "$with_system_altlinuxhyph" = "yes"; then
10029     AC_MSG_RESULT([external])
10030     SYSTEM_HYPH=TRUE
10031     AC_CHECK_HEADER(hyphen.h, [],
10032        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10033     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10034        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10035        [#include <hyphen.h>])
10036     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10037         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10038     if test -z "$HYPHEN_LIB"; then
10039         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10040            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10041     fi
10042     if test -z "$HYPHEN_LIB"; then
10043         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10044            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10045     fi
10046 else
10047     AC_MSG_RESULT([internal])
10048     SYSTEM_HYPH=
10049     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10050     if test "$COM" = "MSC"; then
10051         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10052     else
10053         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10054     fi
10056 AC_SUBST(SYSTEM_HYPH)
10057 AC_SUBST(HYPHEN_LIB)
10059 dnl ===================================================================
10060 dnl Checking for mythes
10061 dnl ===================================================================
10062 AC_MSG_CHECKING([which mythes to use])
10063 if test "$with_system_mythes" = "yes"; then
10064     AC_MSG_RESULT([external])
10065     SYSTEM_MYTHES=TRUE
10066     AC_LANG_PUSH([C++])
10067     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10068     if test "$MYTHES_PKGCONFIG" = "no"; then
10069         AC_CHECK_HEADER(mythes.hxx, [],
10070             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10071         AC_CHECK_LIB([mythes-1.2], [main], [:],
10072             [ MYTHES_FOUND=no], [])
10073     if test "$MYTHES_FOUND" = "no"; then
10074         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10075                 [ MYTHES_FOUND=no], [])
10076     fi
10077     if test "$MYTHES_FOUND" = "no"; then
10078         AC_MSG_ERROR([mythes library not found!.])
10079     fi
10080     fi
10081     AC_LANG_POP([C++])
10082     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10083     FilterLibs "${MYTHES_LIBS}"
10084     MYTHES_LIBS="${filteredlibs}"
10085 else
10086     AC_MSG_RESULT([internal])
10087     SYSTEM_MYTHES=
10088     BUILD_TYPE="$BUILD_TYPE MYTHES"
10089     if test "$COM" = "MSC"; then
10090         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10091     else
10092         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10093     fi
10095 AC_SUBST(SYSTEM_MYTHES)
10096 AC_SUBST(MYTHES_CFLAGS)
10097 AC_SUBST(MYTHES_LIBS)
10099 dnl ===================================================================
10100 dnl How should we build the linear programming solver ?
10101 dnl ===================================================================
10103 ENABLE_COINMP=
10104 AC_MSG_CHECKING([whether to build with CoinMP])
10105 if test "$enable_coinmp" != "no"; then
10106     ENABLE_COINMP=TRUE
10107     AC_MSG_RESULT([yes])
10108     if test "$with_system_coinmp" = "yes"; then
10109         SYSTEM_COINMP=TRUE
10110         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10111         FilterLibs "${COINMP_LIBS}"
10112         COINMP_LIBS="${filteredlibs}"
10113     else
10114         BUILD_TYPE="$BUILD_TYPE COINMP"
10115     fi
10116 else
10117     AC_MSG_RESULT([no])
10119 AC_SUBST(ENABLE_COINMP)
10120 AC_SUBST(SYSTEM_COINMP)
10121 AC_SUBST(COINMP_CFLAGS)
10122 AC_SUBST(COINMP_LIBS)
10124 ENABLE_LPSOLVE=
10125 AC_MSG_CHECKING([whether to build with lpsolve])
10126 if test "$enable_lpsolve" != "no"; then
10127     ENABLE_LPSOLVE=TRUE
10128     AC_MSG_RESULT([yes])
10129 else
10130     AC_MSG_RESULT([no])
10132 AC_SUBST(ENABLE_LPSOLVE)
10134 if test "$ENABLE_LPSOLVE" = TRUE; then
10135     AC_MSG_CHECKING([which lpsolve to use])
10136     if test "$with_system_lpsolve" = "yes"; then
10137         AC_MSG_RESULT([external])
10138         SYSTEM_LPSOLVE=TRUE
10139         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10140            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10141         save_LIBS=$LIBS
10142         # some systems need this. Like Ubuntu....
10143         AC_CHECK_LIB(m, floor)
10144         AC_CHECK_LIB(dl, dlopen)
10145         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10146             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10147         LIBS=$save_LIBS
10148     else
10149         AC_MSG_RESULT([internal])
10150         SYSTEM_LPSOLVE=
10151         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10152     fi
10154 AC_SUBST(SYSTEM_LPSOLVE)
10156 dnl ===================================================================
10157 dnl Checking for libexttextcat
10158 dnl ===================================================================
10159 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10160 if test "$with_system_libexttextcat" = "yes"; then
10161     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10163 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10165 dnl ===================================================================
10166 dnl Checking for libnumbertext
10167 dnl ===================================================================
10168 AC_MSG_CHECKING([whether to use libnumbertext])
10169 if test "$enable_libnumbertext" = "no"; then
10170     AC_MSG_RESULT([no])
10171     ENABLE_LIBNUMBERTEXT=
10172     SYSTEM_LIBNUMBERTEXT=
10173 else
10174     AC_MSG_RESULT([yes])
10175     ENABLE_LIBNUMBERTEXT=TRUE
10176     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10177     if test "$with_system_libnumbertext" = "yes"; then
10178         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10179         SYSTEM_LIBNUMBERTEXT=YES
10180     else
10181         SYSTEM_LIBNUMBERTEXT=
10182         AC_LANG_PUSH([C++])
10183         save_CPPFLAGS=$CPPFLAGS
10184         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10185         AC_CHECK_HEADERS([codecvt regex])
10186         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10187                 [ ENABLE_LIBNUMBERTEXT=''
10188                   LIBNUMBERTEXT_CFLAGS=''
10189                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10190                                Enable libnumbertext fallback (missing number to number name conversion).])
10191                 ])
10192         CPPFLAGS=$save_CPPFLAGS
10193         AC_LANG_POP([C++])
10194     fi
10195     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10196         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10197     fi
10199 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10200 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10201 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10202 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10204 dnl ***************************************
10205 dnl testing libc version for Linux...
10206 dnl ***************************************
10207 if test "$_os" = "Linux"; then
10208     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10209     exec 6>/dev/null # no output
10210     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10211     exec 6>&1 # output on again
10212     if test "$HAVE_LIBC"; then
10213         AC_MSG_RESULT([yes])
10214     else
10215         AC_MSG_ERROR([no, upgrade libc])
10216     fi
10219 dnl =========================================
10220 dnl Check for uuidgen
10221 dnl =========================================
10222 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10223     # presence is already tested above in the WINDOWS_SDK_HOME check
10224     UUIDGEN=uuidgen.exe
10225     AC_SUBST(UUIDGEN)
10226 else
10227     AC_PATH_PROG([UUIDGEN], [uuidgen])
10228     if test -z "$UUIDGEN"; then
10229         AC_MSG_WARN([uuid is needed for building installation sets])
10230     fi
10233 dnl ***************************************
10234 dnl Checking for bison and flex
10235 dnl ***************************************
10236 AC_PATH_PROG(BISON, bison)
10237 if test -z "$BISON"; then
10238     AC_MSG_ERROR([no bison found in \$PATH, install it])
10239 else
10240     AC_MSG_CHECKING([the bison version])
10241     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10242     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10243     # Accept newer than 2.0
10244     if test "$_bison_longver" -lt 2000; then
10245         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10246     fi
10249 AC_PATH_PROG(FLEX, flex)
10250 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10251     FLEX=`cygpath -m $FLEX`
10253 if test -z "$FLEX"; then
10254     AC_MSG_ERROR([no flex found in \$PATH, install it])
10255 else
10256     AC_MSG_CHECKING([the flex version])
10257     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10258     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10259         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10260     fi
10262 AC_SUBST([FLEX])
10263 dnl ***************************************
10264 dnl Checking for patch
10265 dnl ***************************************
10266 AC_PATH_PROG(PATCH, patch)
10267 if test -z "$PATCH"; then
10268     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10271 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10272 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10273     if test -z "$with_gnu_patch"; then
10274         GNUPATCH=$PATCH
10275     else
10276         if test -x "$with_gnu_patch"; then
10277             GNUPATCH=$with_gnu_patch
10278         else
10279             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10280         fi
10281     fi
10283     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10284     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10285         AC_MSG_RESULT([yes])
10286     else
10287         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10288     fi
10289 else
10290     GNUPATCH=$PATCH
10293 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10294     GNUPATCH=`cygpath -m $GNUPATCH`
10297 dnl We also need to check for --with-gnu-cp
10299 if test -z "$with_gnu_cp"; then
10300     # check the place where the good stuff is hidden on Solaris...
10301     if test -x /usr/gnu/bin/cp; then
10302         GNUCP=/usr/gnu/bin/cp
10303     else
10304         AC_PATH_PROGS(GNUCP, gnucp cp)
10305     fi
10306     if test -z $GNUCP; then
10307         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10308     fi
10309 else
10310     if test -x "$with_gnu_cp"; then
10311         GNUCP=$with_gnu_cp
10312     else
10313         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10314     fi
10317 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10318     GNUCP=`cygpath -m $GNUCP`
10321 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10322 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10323     AC_MSG_RESULT([yes])
10324 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10325     AC_MSG_RESULT([yes])
10326 else
10327     case "$build_os" in
10328     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10329         x_GNUCP=[\#]
10330         GNUCP=''
10331         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10332         ;;
10333     *)
10334         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10335         ;;
10336     esac
10339 AC_SUBST(GNUPATCH)
10340 AC_SUBST(GNUCP)
10341 AC_SUBST(x_GNUCP)
10343 dnl ***************************************
10344 dnl testing assembler path
10345 dnl ***************************************
10346 ML_EXE=""
10347 if test "$_os" = "WINNT"; then
10348     if test "$BITNESS_OVERRIDE" = ""; then
10349         assembler=ml.exe
10350     else
10351         assembler=ml64.exe
10352     fi
10354     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10355     if test -f "$CL_PATH/$assembler"; then
10356         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10357         AC_MSG_RESULT([$ML_EXE])
10358     else
10359         AC_MSG_ERROR([not found])
10360     fi
10363 AC_SUBST(ML_EXE)
10365 dnl ===================================================================
10366 dnl We need zip and unzip
10367 dnl ===================================================================
10368 AC_PATH_PROG(ZIP, zip)
10369 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10370 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10371     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],,)
10374 AC_PATH_PROG(UNZIP, unzip)
10375 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10377 dnl ===================================================================
10378 dnl Zip must be a specific type for different build types.
10379 dnl ===================================================================
10380 if test $build_os = cygwin; then
10381     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10382         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10383     fi
10386 dnl ===================================================================
10387 dnl We need touch with -h option support.
10388 dnl ===================================================================
10389 AC_PATH_PROG(TOUCH, touch)
10390 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10391 touch warn
10392 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10393     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],,)
10396 dnl ===================================================================
10397 dnl Check for system epoxy
10398 dnl ===================================================================
10399 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10401 dnl ===================================================================
10402 dnl Set vcl option: coordinate device in double or sal_Int32
10403 dnl ===================================================================
10405 dnl disabled for now, we don't want subtle differences between OSs
10406 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10407 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10408 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10409 dnl     AC_MSG_RESULT([double])
10410 dnl else
10411 dnl     AC_MSG_RESULT([sal_Int32])
10412 dnl fi
10414 dnl ===================================================================
10415 dnl Test which vclplugs have to be built.
10416 dnl ===================================================================
10417 R=""
10418 if test "$USING_X11" != TRUE; then
10419     enable_gtk=no
10420     enable_gtk3=no
10422 GTK3_CFLAGS=""
10423 GTK3_LIBS=""
10424 ENABLE_GTK3=""
10425 if test "x$enable_gtk3" = "xyes"; then
10426     if test "$with_system_cairo" = no; then
10427         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10428     fi
10429     : ${with_system_cairo:=yes}
10430     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="")
10431     if test "x$ENABLE_GTK3" = "xTRUE"; then
10432         AC_DEFINE(ENABLE_GTK3)
10433         R="gtk3"
10434         GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10435     else
10436         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10437     fi
10438     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10439     FilterLibs "${GTK3_LIBS}"
10440     GTK3_LIBS="${filteredlibs}"
10442     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10443     if test "$with_system_epoxy" != "yes"; then
10444         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10445         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10446                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10447     fi
10449 AC_SUBST(GTK3_LIBS)
10450 AC_SUBST(GTK3_CFLAGS)
10451 AC_SUBST(ENABLE_GTK3)
10453 ENABLE_GTK=""
10454 if test "x$enable_gtk" = "xyes"; then
10455     if test "$with_system_cairo" = no; then
10456         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10457     fi
10458     : ${with_system_cairo:=yes}
10459     ENABLE_GTK="TRUE"
10460     AC_DEFINE(ENABLE_GTK)
10461     R="gtk $R"
10463 AC_SUBST(ENABLE_GTK)
10465 ENABLE_QT5=""
10466 if test "x$enable_qt5" = "xyes"; then
10467     ENABLE_QT5="TRUE"
10468     AC_DEFINE(ENABLE_QT5)
10469     R="$R qt5"
10471 AC_SUBST(ENABLE_QT5)
10473 ENABLE_KF5=""
10474 if test "x$enable_kf5" = "xyes"; then
10475     ENABLE_KF5="TRUE"
10476     AC_DEFINE(ENABLE_KF5)
10477     R="$R kf5"
10479 AC_SUBST(ENABLE_KF5)
10481 ENABLE_GTK3_KDE5=""
10482 if test "x$enable_gtk3_kde5" = "xyes"; then
10483     ENABLE_GTK3_KDE5="TRUE"
10484     AC_DEFINE(ENABLE_GTK3_KDE5)
10485     R="$R gtk3_kde5"
10487 AC_SUBST(ENABLE_GTK3_KDE5)
10489 if test "$_os" = "WINNT"; then
10490     R="$R win"
10491 elif test "$_os" = "Darwin"; then
10492     R="$R osx"
10493 elif test "$_os" = "iOS"; then
10494     R="ios (builtin)"
10497 build_vcl_plugins="$R"
10498 if test -z "$build_vcl_plugins"; then
10499     build_vcl_plugins="none"
10501 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10503 dnl ===================================================================
10504 dnl check for dbus support
10505 dnl ===================================================================
10506 ENABLE_DBUS=""
10507 DBUS_CFLAGS=""
10508 DBUS_LIBS=""
10509 DBUS_GLIB_CFLAGS=""
10510 DBUS_GLIB_LIBS=""
10511 DBUS_HAVE_GLIB=""
10513 if test "$enable_dbus" = "no"; then
10514     test_dbus=no
10517 AC_MSG_CHECKING([whether to enable DBUS support])
10518 if test "$test_dbus" = "yes"; then
10519     ENABLE_DBUS="TRUE"
10520     AC_MSG_RESULT([yes])
10521     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10522     AC_DEFINE(ENABLE_DBUS)
10523     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10524     FilterLibs "${DBUS_LIBS}"
10525     DBUS_LIBS="${filteredlibs}"
10527     # Glib is needed for BluetoothServer
10528     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10529     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10530         [
10531             DBUS_HAVE_GLIB="TRUE"
10532             AC_DEFINE(DBUS_HAVE_GLIB,1)
10533         ],
10534         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10535     )
10536 else
10537     AC_MSG_RESULT([no])
10540 AC_SUBST(ENABLE_DBUS)
10541 AC_SUBST(DBUS_CFLAGS)
10542 AC_SUBST(DBUS_LIBS)
10543 AC_SUBST(DBUS_GLIB_CFLAGS)
10544 AC_SUBST(DBUS_GLIB_LIBS)
10545 AC_SUBST(DBUS_HAVE_GLIB)
10547 AC_MSG_CHECKING([whether to enable Impress remote control])
10548 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10549     AC_MSG_RESULT([yes])
10550     ENABLE_SDREMOTE=TRUE
10551     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10553     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10554         # The Bluetooth code doesn't compile with macOS SDK 10.15
10555         enable_sdremote_bluetooth=no
10556     fi
10557     # If not explicitly enabled or disabled, default
10558     if test -z "$enable_sdremote_bluetooth"; then
10559         case "$OS" in
10560         LINUX|MACOSX|WNT)
10561             # Default to yes for these
10562             enable_sdremote_bluetooth=yes
10563             ;;
10564         *)
10565             # otherwise no
10566             enable_sdremote_bluetooth=no
10567             ;;
10568         esac
10569     fi
10570     # $enable_sdremote_bluetooth is guaranteed non-empty now
10572     if test "$enable_sdremote_bluetooth" != "no"; then
10573         if test "$OS" = "LINUX"; then
10574             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10575                 AC_MSG_RESULT([yes])
10576                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10577                 dnl ===================================================================
10578                 dnl Check for system bluez
10579                 dnl ===================================================================
10580                 AC_MSG_CHECKING([which Bluetooth header to use])
10581                 if test "$with_system_bluez" = "yes"; then
10582                     AC_MSG_RESULT([external])
10583                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10584                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10585                     SYSTEM_BLUEZ=TRUE
10586                 else
10587                     AC_MSG_RESULT([internal])
10588                     SYSTEM_BLUEZ=
10589                 fi
10590             else
10591                 AC_MSG_RESULT([no, dbus disabled])
10592                 ENABLE_SDREMOTE_BLUETOOTH=
10593                 SYSTEM_BLUEZ=
10594             fi
10595         else
10596             AC_MSG_RESULT([yes])
10597             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10598             SYSTEM_BLUEZ=
10599         fi
10600     else
10601         AC_MSG_RESULT([no])
10602         ENABLE_SDREMOTE_BLUETOOTH=
10603         SYSTEM_BLUEZ=
10604     fi
10605 else
10606     ENABLE_SDREMOTE=
10607     SYSTEM_BLUEZ=
10608     AC_MSG_RESULT([no])
10610 AC_SUBST(ENABLE_SDREMOTE)
10611 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10612 AC_SUBST(SYSTEM_BLUEZ)
10614 dnl ===================================================================
10615 dnl Check whether the gtk 2.0 libraries are available.
10616 dnl ===================================================================
10618 GTK_CFLAGS=""
10619 GTK_LIBS=""
10620 if test  "$test_gtk" = "yes"; then
10622     if test "$ENABLE_GTK" = "TRUE"; then
10623         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10624         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10625         FilterLibs "${GTK_LIBS}"
10626         GTK_LIBS="${filteredlibs}"
10627         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10628         BUILD_TYPE="$BUILD_TYPE GTK"
10629         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10630         FilterLibs "${GTHREAD_LIBS}"
10631         GTHREAD_LIBS="${filteredlibs}"
10633         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10634         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10635                           [ENABLE_GTK_PRINT="TRUE"],
10636                           [ENABLE_GTK_PRINT=""])
10637         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10638         FilterLibs "${GTK_PRINT_LIBS}"
10639         GTK_PRINT_LIBS="${filteredlibs}"
10640     fi
10642     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10643         AC_MSG_CHECKING([whether to enable GIO support])
10644         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10645             dnl Need at least 2.26 for the dbus support.
10646             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10647                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10648             if test "$ENABLE_GIO" = "TRUE"; then
10649                 AC_DEFINE(ENABLE_GIO)
10650                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10651                 FilterLibs "${GIO_LIBS}"
10652                 GIO_LIBS="${filteredlibs}"
10653             fi
10654         else
10655             AC_MSG_RESULT([no])
10656         fi
10657     fi
10659 AC_SUBST(ENABLE_GIO)
10660 AC_SUBST(GIO_CFLAGS)
10661 AC_SUBST(GIO_LIBS)
10662 AC_SUBST(GTK_CFLAGS)
10663 AC_SUBST(GTK_LIBS)
10664 AC_SUBST(GTHREAD_CFLAGS)
10665 AC_SUBST(GTHREAD_LIBS)
10666 AC_SUBST([ENABLE_GTK_PRINT])
10667 AC_SUBST([GTK_PRINT_CFLAGS])
10668 AC_SUBST([GTK_PRINT_LIBS])
10671 dnl ===================================================================
10673 SPLIT_APP_MODULES=""
10674 if test "$enable_split_app_modules" = "yes"; then
10675     SPLIT_APP_MODULES="TRUE"
10677 AC_SUBST(SPLIT_APP_MODULES)
10679 SPLIT_OPT_FEATURES=""
10680 if test "$enable_split_opt_features" = "yes"; then
10681     SPLIT_OPT_FEATURES="TRUE"
10683 AC_SUBST(SPLIT_OPT_FEATURES)
10685 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10686     if test "$enable_cairo_canvas" = yes; then
10687         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10688     fi
10689     enable_cairo_canvas=no
10690 elif test -z "$enable_cairo_canvas"; then
10691     enable_cairo_canvas=yes
10694 ENABLE_CAIRO_CANVAS=""
10695 if test "$enable_cairo_canvas" = "yes"; then
10696     test_cairo=yes
10697     ENABLE_CAIRO_CANVAS="TRUE"
10698     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10700 AC_SUBST(ENABLE_CAIRO_CANVAS)
10702 dnl ===================================================================
10703 dnl Check whether the GStreamer libraries are available.
10704 dnl ===================================================================
10706 ENABLE_GSTREAMER_1_0=""
10708 if test "$build_gstreamer_1_0" = "yes"; then
10710     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10711     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10712         ENABLE_GSTREAMER_1_0="TRUE"
10713         AC_MSG_RESULT([yes])
10714         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10715         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10716         FilterLibs "${GSTREAMER_1_0_LIBS}"
10717         GSTREAMER_1_0_LIBS="${filteredlibs}"
10718         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10719     else
10720         AC_MSG_RESULT([no])
10721     fi
10723 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10724 AC_SUBST(GSTREAMER_1_0_LIBS)
10725 AC_SUBST(ENABLE_GSTREAMER_1_0)
10727 dnl ===================================================================
10728 dnl Check whether to build the VLC avmedia backend
10729 dnl ===================================================================
10731 ENABLE_VLC=""
10733 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10734 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10735     ENABLE_VLC="TRUE"
10736     AC_MSG_RESULT([yes])
10737 else
10738     AC_MSG_RESULT([no])
10740 AC_SUBST(ENABLE_VLC)
10742 ENABLE_OPENGL_TRANSITIONS=
10743 ENABLE_OPENGL_CANVAS=
10744 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10745    : # disable
10746 elif test "$_os" = "Darwin"; then
10747     # We use frameworks on macOS, no need for detail checks
10748     ENABLE_OPENGL_TRANSITIONS=TRUE
10749     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10750     ENABLE_OPENGL_CANVAS=TRUE
10751 elif test $_os = WINNT; then
10752     ENABLE_OPENGL_TRANSITIONS=TRUE
10753     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10754     ENABLE_OPENGL_CANVAS=TRUE
10755 else
10756     if test "$USING_X11" = TRUE; then
10757         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10758         ENABLE_OPENGL_TRANSITIONS=TRUE
10759         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10760         ENABLE_OPENGL_CANVAS=TRUE
10761     fi
10764 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10765 AC_SUBST(ENABLE_OPENGL_CANVAS)
10767 dnl =================================================
10768 dnl Check whether to build with OpenCL support.
10769 dnl =================================================
10771 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10772     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10773     # platform (optional at run-time, used through clew).
10774     BUILD_TYPE="$BUILD_TYPE OPENCL"
10775     AC_DEFINE(HAVE_FEATURE_OPENCL)
10778 dnl =================================================
10779 dnl Check whether to build with dconf support.
10780 dnl =================================================
10782 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10783     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10784         if test "$enable_dconf" = yes; then
10785             AC_MSG_ERROR([dconf not found])
10786         else
10787             enable_dconf=no
10788         fi])
10790 AC_MSG_CHECKING([whether to enable dconf])
10791 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10792     DCONF_CFLAGS=
10793     DCONF_LIBS=
10794     ENABLE_DCONF=
10795     AC_MSG_RESULT([no])
10796 else
10797     ENABLE_DCONF=TRUE
10798     AC_DEFINE(ENABLE_DCONF)
10799     AC_MSG_RESULT([yes])
10801 AC_SUBST([DCONF_CFLAGS])
10802 AC_SUBST([DCONF_LIBS])
10803 AC_SUBST([ENABLE_DCONF])
10805 # pdf import?
10806 AC_MSG_CHECKING([whether to build the PDF import feature])
10807 ENABLE_PDFIMPORT=
10808 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10809     AC_MSG_RESULT([yes])
10810     ENABLE_PDFIMPORT=TRUE
10811     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10812 else
10813     AC_MSG_RESULT([no])
10816 # Pdfium?
10817 AC_MSG_CHECKING([whether to build PDFium])
10818 ENABLE_PDFIUM=
10819 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10820     AC_MSG_RESULT([yes])
10821     ENABLE_PDFIUM=TRUE
10822     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10823     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10824 else
10825     AC_MSG_RESULT([no])
10827 AC_SUBST(ENABLE_PDFIUM)
10829 dnl ===================================================================
10830 dnl Check for poppler
10831 dnl ===================================================================
10832 ENABLE_POPPLER=
10833 AC_MSG_CHECKING([whether to build Poppler])
10834 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10835     AC_MSG_RESULT([yes])
10836     ENABLE_POPPLER=TRUE
10837     AC_DEFINE(HAVE_FEATURE_POPPLER)
10838 else
10839     AC_MSG_RESULT([no])
10841 AC_SUBST(ENABLE_POPPLER)
10843 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10844     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10847 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10848     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10851 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10852     dnl ===================================================================
10853     dnl Check for system poppler
10854     dnl ===================================================================
10855     AC_MSG_CHECKING([which PDF import poppler to use])
10856     if test "$with_system_poppler" = "yes"; then
10857         AC_MSG_RESULT([external])
10858         SYSTEM_POPPLER=TRUE
10859         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10860         AC_LANG_PUSH([C++])
10861         save_CXXFLAGS=$CXXFLAGS
10862         save_CPPFLAGS=$CPPFLAGS
10863         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10864         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10865         AC_CHECK_HEADER([cpp/poppler-version.h],
10866             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10867             [])
10868         CXXFLAGS=$save_CXXFLAGS
10869         CPPFLAGS=$save_CPPFLAGS
10870         AC_LANG_POP([C++])
10871         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10873         FilterLibs "${POPPLER_LIBS}"
10874         POPPLER_LIBS="${filteredlibs}"
10875     else
10876         AC_MSG_RESULT([internal])
10877         SYSTEM_POPPLER=
10878         BUILD_TYPE="$BUILD_TYPE POPPLER"
10879         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10880     fi
10881     AC_DEFINE([ENABLE_PDFIMPORT],1)
10883 AC_SUBST(ENABLE_PDFIMPORT)
10884 AC_SUBST(SYSTEM_POPPLER)
10885 AC_SUBST(POPPLER_CFLAGS)
10886 AC_SUBST(POPPLER_LIBS)
10888 SYSTEM_GPGMEPP=
10890 if test "$build_for_ios" = "YES"; then
10891     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10892     AC_MSG_RESULT([yes])
10893 elif test "$enable_mpl_subset" = "yes"; then
10894     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10895     AC_MSG_RESULT([yes])
10896 elif test "$enable_fuzzers" = "yes"; then
10897     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10898     AC_MSG_RESULT([yes])
10899 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10900     dnl ===================================================================
10901     dnl Check for system gpgme
10902     dnl ===================================================================
10903     AC_MSG_CHECKING([which gpgmepp to use])
10904     if test "$with_system_gpgmepp" = "yes"; then
10905         AC_MSG_RESULT([external])
10906         SYSTEM_GPGMEPP=TRUE
10908         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10909         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10910             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10911         # progress_callback is the only func with plain C linkage
10912         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10913         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10914             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10915         AC_CHECK_HEADER(gpgme.h, [],
10916             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10917     else
10918         AC_MSG_RESULT([internal])
10919         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10920         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10922         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10923         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10924         if test "$_os" != "WINNT"; then
10925             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10926             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10927         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10928             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10929         fi
10930     fi
10931     ENABLE_GPGMEPP=TRUE
10932     AC_DEFINE([HAVE_FEATURE_GPGME])
10933     AC_PATH_PROG(GPG, gpg)
10934     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10935     # so let's exclude that manually for the moment
10936     if test -n "$GPG" -a "$_os" != "WINNT"; then
10937         # make sure we not only have a working gpgme, but a full working
10938         # gpg installation to run OpenPGP signature verification
10939         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10940     fi
10941     if test "$_os" = "Linux"; then
10942       uid=`id -u`
10943       AC_MSG_CHECKING([for /run/user/$uid])
10944       if test -d /run/user/$uid; then
10945         AC_MSG_RESULT([yes])
10946         AC_PATH_PROG(GPGCONF, gpgconf)
10948         # Older versions of gpgconf are not working as expected, since
10949         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10950         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10951         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10952         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10953         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10954         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10955         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10956           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10957           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10958           if $GPGCONF --dump-options > /dev/null ; then
10959             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10960               AC_MSG_RESULT([yes])
10961               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10962               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10963             else
10964               AC_MSG_RESULT([no])
10965             fi
10966           else
10967             AC_MSG_RESULT([no. missing or broken gpgconf?])
10968           fi
10969         else
10970           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10971         fi
10972       else
10973         AC_MSG_RESULT([no])
10974      fi
10975    fi
10977 AC_SUBST(ENABLE_GPGMEPP)
10978 AC_SUBST(SYSTEM_GPGMEPP)
10979 AC_SUBST(GPG_ERROR_CFLAGS)
10980 AC_SUBST(GPG_ERROR_LIBS)
10981 AC_SUBST(LIBASSUAN_CFLAGS)
10982 AC_SUBST(LIBASSUAN_LIBS)
10983 AC_SUBST(GPGMEPP_CFLAGS)
10984 AC_SUBST(GPGMEPP_LIBS)
10986 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10987 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10988     AC_MSG_RESULT([yes])
10989     ENABLE_MEDIAWIKI=TRUE
10990     BUILD_TYPE="$BUILD_TYPE XSLTML"
10991     if test  "x$with_java" = "xno"; then
10992         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10993     fi
10994 else
10995     AC_MSG_RESULT([no])
10996     ENABLE_MEDIAWIKI=
10997     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10999 AC_SUBST(ENABLE_MEDIAWIKI)
11001 AC_MSG_CHECKING([whether to build the Report Builder])
11002 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11003     AC_MSG_RESULT([yes])
11004     ENABLE_REPORTBUILDER=TRUE
11005     AC_MSG_CHECKING([which jfreereport libs to use])
11006     if test "$with_system_jfreereport" = "yes"; then
11007         SYSTEM_JFREEREPORT=TRUE
11008         AC_MSG_RESULT([external])
11009         if test -z $SAC_JAR; then
11010             SAC_JAR=/usr/share/java/sac.jar
11011         fi
11012         if ! test -f $SAC_JAR; then
11013              AC_MSG_ERROR(sac.jar not found.)
11014         fi
11016         if test -z $LIBXML_JAR; then
11017             if test -f /usr/share/java/libxml-1.0.0.jar; then
11018                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11019             elif test -f /usr/share/java/libxml.jar; then
11020                 LIBXML_JAR=/usr/share/java/libxml.jar
11021             else
11022                 AC_MSG_ERROR(libxml.jar replacement not found.)
11023             fi
11024         elif ! test -f $LIBXML_JAR; then
11025             AC_MSG_ERROR(libxml.jar not found.)
11026         fi
11028         if test -z $FLUTE_JAR; then
11029             if test -f/usr/share/java/flute-1.3.0.jar; then
11030                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11031             elif test -f /usr/share/java/flute.jar; then
11032                 FLUTE_JAR=/usr/share/java/flute.jar
11033             else
11034                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11035             fi
11036         elif ! test -f $FLUTE_JAR; then
11037             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11038         fi
11040         if test -z $JFREEREPORT_JAR; then
11041             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11042                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11043             elif test -f /usr/share/java/flow-engine.jar; then
11044                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11045             else
11046                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11047             fi
11048         elif ! test -f  $JFREEREPORT_JAR; then
11049                 AC_MSG_ERROR(jfreereport.jar not found.)
11050         fi
11052         if test -z $LIBLAYOUT_JAR; then
11053             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11054                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11055             elif test -f /usr/share/java/liblayout.jar; then
11056                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11057             else
11058                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11059             fi
11060         elif ! test -f $LIBLAYOUT_JAR; then
11061                 AC_MSG_ERROR(liblayout.jar not found.)
11062         fi
11064         if test -z $LIBLOADER_JAR; then
11065             if test -f /usr/share/java/libloader-1.0.0.jar; then
11066                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11067             elif test -f /usr/share/java/libloader.jar; then
11068                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11069             else
11070                 AC_MSG_ERROR(libloader.jar replacement not found.)
11071             fi
11072         elif ! test -f  $LIBLOADER_JAR; then
11073             AC_MSG_ERROR(libloader.jar not found.)
11074         fi
11076         if test -z $LIBFORMULA_JAR; then
11077             if test -f /usr/share/java/libformula-0.2.0.jar; then
11078                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11079             elif test -f /usr/share/java/libformula.jar; then
11080                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11081             else
11082                 AC_MSG_ERROR(libformula.jar replacement not found.)
11083             fi
11084         elif ! test -f $LIBFORMULA_JAR; then
11085                 AC_MSG_ERROR(libformula.jar not found.)
11086         fi
11088         if test -z $LIBREPOSITORY_JAR; then
11089             if test -f /usr/share/java/librepository-1.0.0.jar; then
11090                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11091             elif test -f /usr/share/java/librepository.jar; then
11092                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11093             else
11094                 AC_MSG_ERROR(librepository.jar replacement not found.)
11095             fi
11096         elif ! test -f $LIBREPOSITORY_JAR; then
11097             AC_MSG_ERROR(librepository.jar not found.)
11098         fi
11100         if test -z $LIBFONTS_JAR; then
11101             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11102                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11103             elif test -f /usr/share/java/libfonts.jar; then
11104                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11105             else
11106                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11107             fi
11108         elif ! test -f $LIBFONTS_JAR; then
11109                 AC_MSG_ERROR(libfonts.jar not found.)
11110         fi
11112         if test -z $LIBSERIALIZER_JAR; then
11113             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11114                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11115             elif test -f /usr/share/java/libserializer.jar; then
11116                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11117             else
11118                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11119             fi
11120         elif ! test -f $LIBSERIALIZER_JAR; then
11121                 AC_MSG_ERROR(libserializer.jar not found.)
11122         fi
11124         if test -z $LIBBASE_JAR; then
11125             if test -f /usr/share/java/libbase-1.0.0.jar; then
11126                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11127             elif test -f /usr/share/java/libbase.jar; then
11128                 LIBBASE_JAR=/usr/share/java/libbase.jar
11129             else
11130                 AC_MSG_ERROR(libbase.jar replacement not found.)
11131             fi
11132         elif ! test -f $LIBBASE_JAR; then
11133             AC_MSG_ERROR(libbase.jar not found.)
11134         fi
11136     else
11137         AC_MSG_RESULT([internal])
11138         SYSTEM_JFREEREPORT=
11139         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11140         NEED_ANT=TRUE
11141     fi
11142 else
11143     AC_MSG_RESULT([no])
11144     ENABLE_REPORTBUILDER=
11145     SYSTEM_JFREEREPORT=
11147 AC_SUBST(ENABLE_REPORTBUILDER)
11148 AC_SUBST(SYSTEM_JFREEREPORT)
11149 AC_SUBST(SAC_JAR)
11150 AC_SUBST(LIBXML_JAR)
11151 AC_SUBST(FLUTE_JAR)
11152 AC_SUBST(JFREEREPORT_JAR)
11153 AC_SUBST(LIBBASE_JAR)
11154 AC_SUBST(LIBLAYOUT_JAR)
11155 AC_SUBST(LIBLOADER_JAR)
11156 AC_SUBST(LIBFORMULA_JAR)
11157 AC_SUBST(LIBREPOSITORY_JAR)
11158 AC_SUBST(LIBFONTS_JAR)
11159 AC_SUBST(LIBSERIALIZER_JAR)
11161 # this has to be here because both the Wiki Publisher and the SRB use
11162 # commons-logging
11163 COMMONS_LOGGING_VERSION=1.2
11164 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11165     AC_MSG_CHECKING([which Apache commons-* libs to use])
11166     if test "$with_system_apache_commons" = "yes"; then
11167         SYSTEM_APACHE_COMMONS=TRUE
11168         AC_MSG_RESULT([external])
11169         if test -z $COMMONS_LOGGING_JAR; then
11170             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11171                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11172            elif test -f /usr/share/java/commons-logging.jar; then
11173                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11174             else
11175                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11176             fi
11177         elif ! test -f $COMMONS_LOGGING_JAR; then
11178             AC_MSG_ERROR(commons-logging.jar not found.)
11179         fi
11180     else
11181         AC_MSG_RESULT([internal])
11182         SYSTEM_APACHE_COMMONS=
11183         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11184         NEED_ANT=TRUE
11185     fi
11187 AC_SUBST(SYSTEM_APACHE_COMMONS)
11188 AC_SUBST(COMMONS_LOGGING_JAR)
11189 AC_SUBST(COMMONS_LOGGING_VERSION)
11191 # scripting provider for BeanShell?
11192 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11193 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11194     AC_MSG_RESULT([yes])
11195     ENABLE_SCRIPTING_BEANSHELL=TRUE
11197     dnl ===================================================================
11198     dnl Check for system beanshell
11199     dnl ===================================================================
11200     AC_MSG_CHECKING([which beanshell to use])
11201     if test "$with_system_beanshell" = "yes"; then
11202         AC_MSG_RESULT([external])
11203         SYSTEM_BSH=TRUE
11204         if test -z $BSH_JAR; then
11205             BSH_JAR=/usr/share/java/bsh.jar
11206         fi
11207         if ! test -f $BSH_JAR; then
11208             AC_MSG_ERROR(bsh.jar not found.)
11209         fi
11210     else
11211         AC_MSG_RESULT([internal])
11212         SYSTEM_BSH=
11213         BUILD_TYPE="$BUILD_TYPE BSH"
11214     fi
11215 else
11216     AC_MSG_RESULT([no])
11217     ENABLE_SCRIPTING_BEANSHELL=
11218     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11220 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11221 AC_SUBST(SYSTEM_BSH)
11222 AC_SUBST(BSH_JAR)
11224 # scripting provider for JavaScript?
11225 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11226 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11227     AC_MSG_RESULT([yes])
11228     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11230     dnl ===================================================================
11231     dnl Check for system rhino
11232     dnl ===================================================================
11233     AC_MSG_CHECKING([which rhino to use])
11234     if test "$with_system_rhino" = "yes"; then
11235         AC_MSG_RESULT([external])
11236         SYSTEM_RHINO=TRUE
11237         if test -z $RHINO_JAR; then
11238             RHINO_JAR=/usr/share/java/js.jar
11239         fi
11240         if ! test -f $RHINO_JAR; then
11241             AC_MSG_ERROR(js.jar not found.)
11242         fi
11243     else
11244         AC_MSG_RESULT([internal])
11245         SYSTEM_RHINO=
11246         BUILD_TYPE="$BUILD_TYPE RHINO"
11247         NEED_ANT=TRUE
11248     fi
11249 else
11250     AC_MSG_RESULT([no])
11251     ENABLE_SCRIPTING_JAVASCRIPT=
11252     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11254 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11255 AC_SUBST(SYSTEM_RHINO)
11256 AC_SUBST(RHINO_JAR)
11258 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11259 # paths should be added to library search path. So lets put all 64-bit
11260 # platforms there.
11261 supports_multilib=
11262 case "$host_cpu" in
11263 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11264     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11265         supports_multilib="yes"
11266     fi
11267     ;;
11269     ;;
11270 esac
11272 dnl ===================================================================
11273 dnl QT5 Integration
11274 dnl ===================================================================
11276 QT5_CFLAGS=""
11277 QT5_LIBS=""
11278 QMAKE5="qmake"
11279 MOC5="moc"
11280 QT5_GOBJECT_CFLAGS=""
11281 QT5_GOBJECT_LIBS=""
11282 QT5_HAVE_GOBJECT=""
11283 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11284         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11285         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11286 then
11287     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11288     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11290     if test -n "$supports_multilib"; then
11291         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11292     fi
11294     qt5_test_include="QtWidgets/qapplication.h"
11295     qt5_test_library="libQt5Widgets.so"
11297     dnl Check for qmake5
11298     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11299     if test "$QMAKE5" = "no"; then
11300         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11301     else
11302         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11303         if test -z "$qmake5_test_ver"; then
11304             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11305         fi
11306         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11307         qt5_minimal_minor="6"
11308         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11309             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11310         else
11311             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11312         fi
11313     fi
11315     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11316     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11318     AC_MSG_CHECKING([for Qt5 headers])
11319     qt5_incdir="no"
11320     for inc_dir in $qt5_incdirs; do
11321         if test -r "$inc_dir/$qt5_test_include"; then
11322             qt5_incdir="$inc_dir"
11323             break
11324         fi
11325     done
11326     AC_MSG_RESULT([$qt5_incdir])
11327     if test "x$qt5_incdir" = "xno"; then
11328         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11329     fi
11331     AC_MSG_CHECKING([for Qt5 libraries])
11332     qt5_libdir="no"
11333     for lib_dir in $qt5_libdirs; do
11334         if test -r "$lib_dir/$qt5_test_library"; then
11335             qt5_libdir="$lib_dir"
11336             break
11337         fi
11338     done
11339     AC_MSG_RESULT([$qt5_libdir])
11340     if test "x$qt5_libdir" = "xno"; then
11341         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11342     fi
11344     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11345     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11346     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11348     if test "$USING_X11" = TRUE; then
11349         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11350         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11351         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11352         QT5_USING_X11=1
11353         AC_DEFINE(QT5_USING_X11)
11354     fi
11356     dnl Check for Meta Object Compiler
11358     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11359     if test "$MOC5" = "no"; then
11360         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11361 the root of your Qt installation by exporting QT5DIR before running "configure".])
11362     fi
11364     if test "$build_gstreamer_1_0" = "yes"; then
11365         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11366                 QT5_HAVE_GOBJECT=1
11367                 AC_DEFINE(QT5_HAVE_GOBJECT)
11368             ],
11369             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11370         )
11371     fi
11373 AC_SUBST(QT5_CFLAGS)
11374 AC_SUBST(QT5_LIBS)
11375 AC_SUBST(MOC5)
11376 AC_SUBST(QT5_GOBJECT_CFLAGS)
11377 AC_SUBST(QT5_GOBJECT_LIBS)
11378 AC_SUBST(QT5_HAVE_GOBJECT)
11380 dnl ===================================================================
11381 dnl KF5 Integration
11382 dnl ===================================================================
11384 KF5_CFLAGS=""
11385 KF5_LIBS=""
11386 KF5_CONFIG="kf5-config"
11387 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11388         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11389 then
11390     if test "$OS" = "HAIKU"; then
11391         haiku_arch="`echo $RTL_ARCH | tr X x`"
11392         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11393         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11394     fi
11396     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11397     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11398     if test -n "$supports_multilib"; then
11399         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11400     fi
11402     kf5_test_include="KF5/kcoreaddons_version.h"
11403     kf5_test_library="libKF5CoreAddons.so"
11404     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11406     dnl kf5 KDE4 support compatibility installed
11407     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11408     if test "$KF5_CONFIG" != "no"; then
11409         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11410         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11411     fi
11413     dnl Check for KF5 headers
11414     AC_MSG_CHECKING([for KF5 headers])
11415     kf5_incdir="no"
11416     for kf5_check in $kf5_incdirs; do
11417         if test -r "$kf5_check/$kf5_test_include"; then
11418             kf5_incdir="$kf5_check/KF5"
11419             break
11420         fi
11421     done
11422     AC_MSG_RESULT([$kf5_incdir])
11423     if test "x$kf5_incdir" = "xno"; then
11424         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11425     fi
11427     dnl Check for KF5 libraries
11428     AC_MSG_CHECKING([for KF5 libraries])
11429     kf5_libdir="no"
11430     for kf5_check in $kf5_libdirs; do
11431         if test -r "$kf5_check/$kf5_test_library"; then
11432             kf5_libdir="$kf5_check"
11433             break
11434         fi
11435     done
11437     AC_MSG_RESULT([$kf5_libdir])
11438     if test "x$kf5_libdir" = "xno"; then
11439         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11440     fi
11442     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"
11443     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11444     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11446     if test "$USING_X11" = TRUE; then
11447         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11448     fi
11450     AC_LANG_PUSH([C++])
11451     save_CXXFLAGS=$CXXFLAGS
11452     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11453     AC_MSG_CHECKING([whether KDE is >= 5.0])
11454        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11455 #include <kcoreaddons_version.h>
11457 int main(int argc, char **argv) {
11458        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11459        else return 1;
11461        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11462     CXXFLAGS=$save_CXXFLAGS
11463     AC_LANG_POP([C++])
11465 AC_SUBST(KF5_CFLAGS)
11466 AC_SUBST(KF5_LIBS)
11468 dnl ===================================================================
11469 dnl Test whether to include Evolution 2 support
11470 dnl ===================================================================
11471 AC_MSG_CHECKING([whether to enable evolution 2 support])
11472 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11473     AC_MSG_RESULT([yes])
11474     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11475     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11476     FilterLibs "${GOBJECT_LIBS}"
11477     GOBJECT_LIBS="${filteredlibs}"
11478     ENABLE_EVOAB2="TRUE"
11479 else
11480     ENABLE_EVOAB2=""
11481     AC_MSG_RESULT([no])
11483 AC_SUBST(ENABLE_EVOAB2)
11484 AC_SUBST(GOBJECT_CFLAGS)
11485 AC_SUBST(GOBJECT_LIBS)
11487 dnl ===================================================================
11488 dnl Test which themes to include
11489 dnl ===================================================================
11490 AC_MSG_CHECKING([which themes to include])
11491 # if none given use default subset of available themes
11492 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11493     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_svg sifr_dark tango"
11496 WITH_THEMES=""
11497 if test "x$with_theme" != "xno"; then
11498     for theme in $with_theme; do
11499         case $theme in
11500         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11501         default) real_theme=colibre ;;
11502         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11503         esac
11504         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11505     done
11507 AC_MSG_RESULT([$WITH_THEMES])
11508 AC_SUBST([WITH_THEMES])
11509 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11510 for theme in $with_theme; do
11511     case $theme in
11512     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11513     *) ;;
11514     esac
11515 done
11517 dnl ===================================================================
11518 dnl Test whether to integrate helppacks into the product's installer
11519 dnl ===================================================================
11520 AC_MSG_CHECKING([for helppack integration])
11521 if test "$with_helppack_integration" = "no"; then
11522     AC_MSG_RESULT([no integration])
11523 else
11524     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11525     AC_MSG_RESULT([integration])
11528 ###############################################################################
11529 # Extensions checking
11530 ###############################################################################
11531 AC_MSG_CHECKING([for extensions integration])
11532 if test "x$enable_extension_integration" != "xno"; then
11533     WITH_EXTENSION_INTEGRATION=TRUE
11534     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11535     AC_MSG_RESULT([yes, use integration])
11536 else
11537     WITH_EXTENSION_INTEGRATION=
11538     AC_MSG_RESULT([no, do not integrate])
11540 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11542 dnl Should any extra extensions be included?
11543 dnl There are standalone tests for each of these below.
11544 WITH_EXTRA_EXTENSIONS=
11545 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11547 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11548 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11549 if test "x$with_java" != "xno"; then
11550     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11551     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11554 AC_MSG_CHECKING([whether to build opens___.ttf])
11555 if test "$enable_build_opensymbol" = "yes"; then
11556     AC_MSG_RESULT([yes])
11557     AC_PATH_PROG(FONTFORGE, fontforge)
11558     if test -z "$FONTFORGE"; then
11559         AC_MSG_ERROR([fontforge not installed])
11560     fi
11561 else
11562     AC_MSG_RESULT([no])
11563     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11564     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11566 AC_SUBST(OPENSYMBOL_TTF)
11567 AC_SUBST(FONTFORGE)
11569 dnl ===================================================================
11570 dnl Test whether to include fonts
11571 dnl ===================================================================
11572 AC_MSG_CHECKING([whether to include third-party fonts])
11573 if test "$with_fonts" != "no"; then
11574     AC_MSG_RESULT([yes])
11575     WITH_FONTS=TRUE
11576     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11577     AC_DEFINE(HAVE_MORE_FONTS)
11578 else
11579     AC_MSG_RESULT([no])
11580     WITH_FONTS=
11581     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11583 AC_SUBST(WITH_FONTS)
11586 dnl ===================================================================
11587 dnl Test whether to enable online update service
11588 dnl ===================================================================
11589 AC_MSG_CHECKING([whether to enable online update])
11590 ENABLE_ONLINE_UPDATE=
11591 ENABLE_ONLINE_UPDATE_MAR=
11592 UPDATE_CONFIG=
11593 if test "$enable_online_update" = ""; then
11594     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11595         AC_MSG_RESULT([yes])
11596         ENABLE_ONLINE_UPDATE="TRUE"
11597     else
11598         AC_MSG_RESULT([no])
11599     fi
11600 else
11601     if test "$enable_online_update" = "mar"; then
11602         AC_MSG_RESULT([yes - MAR-based online update])
11603         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11604         if test "$with_update_config" = ""; then
11605             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11606         fi
11607         UPDATE_CONFIG="$with_update_config"
11608         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11609     elif test "$enable_online_update" = "yes"; then
11610         AC_MSG_RESULT([yes])
11611         ENABLE_ONLINE_UPDATE="TRUE"
11612     else
11613         AC_MSG_RESULT([no])
11614     fi
11616 AC_SUBST(ENABLE_ONLINE_UPDATE)
11617 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11618 AC_SUBST(UPDATE_CONFIG)
11620 dnl ===================================================================
11621 dnl Test whether we need bzip2
11622 dnl ===================================================================
11623 SYSTEM_BZIP2=
11624 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11625     AC_MSG_CHECKING([whether to use system bzip2])
11626     if test "$with_system_bzip2" = yes; then
11627         SYSTEM_BZIP2=TRUE
11628         AC_MSG_RESULT([yes])
11629         PKG_CHECK_MODULES(BZIP2, bzip2)
11630         FilterLibs "${BZIP2_LIBS}"
11631         BZIP2_LIBS="${filteredlibs}"
11632     else
11633         AC_MSG_RESULT([no])
11634         BUILD_TYPE="$BUILD_TYPE BZIP2"
11635     fi
11637 AC_SUBST(SYSTEM_BZIP2)
11638 AC_SUBST(BZIP2_CFLAGS)
11639 AC_SUBST(BZIP2_LIBS)
11641 dnl ===================================================================
11642 dnl Test whether to enable extension update
11643 dnl ===================================================================
11644 AC_MSG_CHECKING([whether to enable extension update])
11645 ENABLE_EXTENSION_UPDATE=
11646 if test "x$enable_extension_update" = "xno"; then
11647     AC_MSG_RESULT([no])
11648 else
11649     AC_MSG_RESULT([yes])
11650     ENABLE_EXTENSION_UPDATE="TRUE"
11651     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11652     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11654 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11657 dnl ===================================================================
11658 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11659 dnl ===================================================================
11660 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11661 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11662     AC_MSG_RESULT([no])
11663     ENABLE_SILENT_MSI=
11664 else
11665     AC_MSG_RESULT([yes])
11666     ENABLE_SILENT_MSI=TRUE
11667     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11669 AC_SUBST(ENABLE_SILENT_MSI)
11671 AC_MSG_CHECKING([whether and how to use Xinerama])
11672 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11673     if test "$x_libraries" = "default_x_libraries"; then
11674         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11675         if test "x$XINERAMALIB" = x; then
11676            XINERAMALIB="/usr/lib"
11677         fi
11678     else
11679         XINERAMALIB="$x_libraries"
11680     fi
11681     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11682         # we have both versions, let the user decide but use the dynamic one
11683         # per default
11684         USE_XINERAMA=TRUE
11685         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11686             XINERAMA_LINK=dynamic
11687         else
11688             XINERAMA_LINK=static
11689         fi
11690     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11691         # we have only the dynamic version
11692         USE_XINERAMA=TRUE
11693         XINERAMA_LINK=dynamic
11694     elif test -e "$XINERAMALIB/libXinerama.a"; then
11695         # static version
11696         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11697             USE_XINERAMA=TRUE
11698             XINERAMA_LINK=static
11699         else
11700             USE_XINERAMA=
11701             XINERAMA_LINK=none
11702         fi
11703     else
11704         # no Xinerama
11705         USE_XINERAMA=
11706         XINERAMA_LINK=none
11707     fi
11708     if test "$USE_XINERAMA" = "TRUE"; then
11709         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11710         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11711             [AC_MSG_ERROR(Xinerama header not found.)], [])
11712         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11713         if test "x$XEXTLIB" = x; then
11714            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11715         fi
11716         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11717         if test "$_os" = "FreeBSD"; then
11718             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11719         fi
11720         if test "$_os" = "Linux"; then
11721             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11722         fi
11723         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11724             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11725     else
11726         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11727     fi
11728 else
11729     USE_XINERAMA=
11730     XINERAMA_LINK=none
11731     AC_MSG_RESULT([no])
11733 AC_SUBST(USE_XINERAMA)
11734 AC_SUBST(XINERAMA_LINK)
11736 dnl ===================================================================
11737 dnl Test whether to build cairo or rely on the system version
11738 dnl ===================================================================
11740 if test "$USING_X11" = TRUE; then
11741     # Used in vcl/Library_vclplug_gen.mk
11742     test_cairo=yes
11745 if test "$test_cairo" = "yes"; then
11746     AC_MSG_CHECKING([whether to use the system cairo])
11748     : ${with_system_cairo:=$with_system_libs}
11749     if test "$with_system_cairo" = "yes"; then
11750         SYSTEM_CAIRO=TRUE
11751         AC_MSG_RESULT([yes])
11753         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11754         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11755         FilterLibs "${CAIRO_LIBS}"
11756         CAIRO_LIBS="${filteredlibs}"
11758         if test "$test_xrender" = "yes"; then
11759             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11760             AC_LANG_PUSH([C])
11761             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11762 #ifdef PictStandardA8
11763 #else
11764       return fail;
11765 #endif
11766 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11768             AC_LANG_POP([C])
11769         fi
11770     else
11771         SYSTEM_CAIRO=
11772         AC_MSG_RESULT([no])
11774         BUILD_TYPE="$BUILD_TYPE CAIRO"
11775     fi
11778 AC_SUBST(SYSTEM_CAIRO)
11779 AC_SUBST(CAIRO_CFLAGS)
11780 AC_SUBST(CAIRO_LIBS)
11782 dnl ===================================================================
11783 dnl Test whether to use avahi
11784 dnl ===================================================================
11785 if test "$_os" = "WINNT"; then
11786     # Windows uses bundled mDNSResponder
11787     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11788 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11789     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11790                       [ENABLE_AVAHI="TRUE"])
11791     AC_DEFINE(HAVE_FEATURE_AVAHI)
11792     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11793     FilterLibs "${AVAHI_LIBS}"
11794     AVAHI_LIBS="${filteredlibs}"
11797 AC_SUBST(ENABLE_AVAHI)
11798 AC_SUBST(AVAHI_CFLAGS)
11799 AC_SUBST(AVAHI_LIBS)
11801 dnl ===================================================================
11802 dnl Test whether to use liblangtag
11803 dnl ===================================================================
11804 SYSTEM_LIBLANGTAG=
11805 AC_MSG_CHECKING([whether to use system liblangtag])
11806 if test "$with_system_liblangtag" = yes; then
11807     SYSTEM_LIBLANGTAG=TRUE
11808     AC_MSG_RESULT([yes])
11809     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11810     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11811     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11812     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11813     FilterLibs "${LIBLANGTAG_LIBS}"
11814     LIBLANGTAG_LIBS="${filteredlibs}"
11815 else
11816     SYSTEM_LIBLANGTAG=
11817     AC_MSG_RESULT([no])
11818     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11819     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11820     if test "$COM" = "MSC"; then
11821         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11822     else
11823         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11824     fi
11826 AC_SUBST(SYSTEM_LIBLANGTAG)
11827 AC_SUBST(LIBLANGTAG_CFLAGS)
11828 AC_SUBST(LIBLANGTAG_LIBS)
11830 dnl ===================================================================
11831 dnl Test whether to build libpng or rely on the system version
11832 dnl ===================================================================
11834 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11836 dnl ===================================================================
11837 dnl Check for runtime JVM search path
11838 dnl ===================================================================
11839 if test "$ENABLE_JAVA" != ""; then
11840     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11841     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11842         AC_MSG_RESULT([yes])
11843         if ! test -d "$with_jvm_path"; then
11844             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11845         fi
11846         if ! test -d "$with_jvm_path"jvm; then
11847             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11848         fi
11849         JVM_ONE_PATH_CHECK="$with_jvm_path"
11850         AC_SUBST(JVM_ONE_PATH_CHECK)
11851     else
11852         AC_MSG_RESULT([no])
11853     fi
11856 dnl ===================================================================
11857 dnl Test for the presence of Ant and that it works
11858 dnl ===================================================================
11860 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11861     ANT_HOME=; export ANT_HOME
11862     WITH_ANT_HOME=; export WITH_ANT_HOME
11863     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11864         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11865             if test "$_os" = "WINNT"; then
11866                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11867             else
11868                 with_ant_home="$LODE_HOME/opt/ant"
11869             fi
11870         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11871             with_ant_home="$LODE_HOME/opt/ant"
11872         fi
11873     fi
11874     if test -z "$with_ant_home"; then
11875         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11876     else
11877         if test "$_os" = "WINNT"; then
11878             # AC_PATH_PROGS needs unix path
11879             with_ant_home=`cygpath -u "$with_ant_home"`
11880         fi
11881         AbsolutePath "$with_ant_home"
11882         with_ant_home=$absolute_path
11883         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11884         WITH_ANT_HOME=$with_ant_home
11885         ANT_HOME=$with_ant_home
11886     fi
11888     if test -z "$ANT"; then
11889         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11890     else
11891         # resolve relative or absolute symlink
11892         while test -h "$ANT"; do
11893             a_cwd=`pwd`
11894             a_basename=`basename "$ANT"`
11895             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11896             cd "`dirname "$ANT"`"
11897             cd "`dirname "$a_script"`"
11898             ANT="`pwd`"/"`basename "$a_script"`"
11899             cd "$a_cwd"
11900         done
11902         AC_MSG_CHECKING([if $ANT works])
11903         mkdir -p conftest.dir
11904         a_cwd=$(pwd)
11905         cd conftest.dir
11906         cat > conftest.java << EOF
11907         public class conftest {
11908             int testmethod(int a, int b) {
11909                     return a + b;
11910             }
11911         }
11914         cat > conftest.xml << EOF
11915         <project name="conftest" default="conftest">
11916         <target name="conftest">
11917             <javac srcdir="." includes="conftest.java">
11918             </javac>
11919         </target>
11920         </project>
11923         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11924         if test $? = 0 -a -f ./conftest.class; then
11925             AC_MSG_RESULT([Ant works])
11926             if test -z "$WITH_ANT_HOME"; then
11927                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11928                 if test -z "$ANT_HOME"; then
11929                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11930                 fi
11931             else
11932                 ANT_HOME="$WITH_ANT_HOME"
11933             fi
11934         else
11935             echo "configure: Ant test failed" >&5
11936             cat conftest.java >&5
11937             cat conftest.xml >&5
11938             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11939         fi
11940         cd "$a_cwd"
11941         rm -fr conftest.dir
11942     fi
11943     if test -z "$ANT_HOME"; then
11944         ANT_HOME="NO_ANT_HOME"
11945     else
11946         PathFormat "$ANT_HOME"
11947         ANT_HOME="$formatted_path"
11948         PathFormat "$ANT"
11949         ANT="$formatted_path"
11950     fi
11951     AC_SUBST(ANT_HOME)
11952     AC_SUBST(ANT)
11954     dnl Checking for ant.jar
11955     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11956         AC_MSG_CHECKING([Ant lib directory])
11957         if test -f $ANT_HOME/lib/ant.jar; then
11958             ANT_LIB="$ANT_HOME/lib"
11959         else
11960             if test -f $ANT_HOME/ant.jar; then
11961                 ANT_LIB="$ANT_HOME"
11962             else
11963                 if test -f /usr/share/java/ant.jar; then
11964                     ANT_LIB=/usr/share/java
11965                 else
11966                     if test -f /usr/share/ant-core/lib/ant.jar; then
11967                         ANT_LIB=/usr/share/ant-core/lib
11968                     else
11969                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11970                             ANT_LIB="$ANT_HOME/lib/ant"
11971                         else
11972                             if test -f /usr/share/lib/ant/ant.jar; then
11973                                 ANT_LIB=/usr/share/lib/ant
11974                             else
11975                                 AC_MSG_ERROR([Ant libraries not found!])
11976                             fi
11977                         fi
11978                     fi
11979                 fi
11980             fi
11981         fi
11982         PathFormat "$ANT_LIB"
11983         ANT_LIB="$formatted_path"
11984         AC_MSG_RESULT([Ant lib directory found.])
11985     fi
11986     AC_SUBST(ANT_LIB)
11988     ant_minver=1.6.0
11989     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11991     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11992     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11993     ant_version_major=`echo $ant_version | cut -d. -f1`
11994     ant_version_minor=`echo $ant_version | cut -d. -f2`
11995     echo "configure: ant_version $ant_version " >&5
11996     echo "configure: ant_version_major $ant_version_major " >&5
11997     echo "configure: ant_version_minor $ant_version_minor " >&5
11998     if test "$ant_version_major" -ge "2"; then
11999         AC_MSG_RESULT([yes, $ant_version])
12000     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12001         AC_MSG_RESULT([yes, $ant_version])
12002     else
12003         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12004     fi
12006     rm -f conftest* core core.* *.core
12009 OOO_JUNIT_JAR=
12010 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12011     AC_MSG_CHECKING([for JUnit 4])
12012     if test "$with_junit" = "yes"; then
12013         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12014             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12015         elif test -e /usr/share/java/junit4.jar; then
12016             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12017         else
12018            if test -e /usr/share/lib/java/junit.jar; then
12019               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12020            else
12021               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12022            fi
12023         fi
12024     else
12025         OOO_JUNIT_JAR=$with_junit
12026     fi
12027     if test "$_os" = "WINNT"; then
12028         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12029     fi
12030     printf 'import org.junit.Before;' > conftest.java
12031     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12032         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12033     else
12034         AC_MSG_ERROR(
12035 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12036  specify its pathname via --with-junit=..., or disable it via --without-junit])
12037     fi
12038     rm -f conftest.class conftest.java
12039     if test $OOO_JUNIT_JAR != ""; then
12040     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12041     fi
12043 AC_SUBST(OOO_JUNIT_JAR)
12045 HAMCREST_JAR=
12046 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12047     AC_MSG_CHECKING([for included Hamcrest])
12048     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12049     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12050         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12051     else
12052         AC_MSG_RESULT([Not included])
12053         AC_MSG_CHECKING([for standalone hamcrest jar.])
12054         if test "$with_hamcrest" = "yes"; then
12055             if test -e /usr/share/lib/java/hamcrest.jar; then
12056                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12057             elif test -e /usr/share/java/hamcrest/core.jar; then
12058                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12059             else
12060                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12061             fi
12062         else
12063             HAMCREST_JAR=$with_hamcrest
12064         fi
12065         if test "$_os" = "WINNT"; then
12066             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12067         fi
12068         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12069             AC_MSG_RESULT([$HAMCREST_JAR])
12070         else
12071             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),
12072                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12073         fi
12074     fi
12075     rm -f conftest.class conftest.java
12077 AC_SUBST(HAMCREST_JAR)
12080 AC_SUBST(SCPDEFS)
12083 # check for wget and curl
12085 WGET=
12086 CURL=
12088 if test "$enable_fetch_external" != "no"; then
12090 CURL=`which curl 2>/dev/null`
12092 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12093     # wget new enough?
12094     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12095     if test $? -eq 0; then
12096         WGET=$i
12097         break
12098     fi
12099 done
12101 if test -z "$WGET" -a -z "$CURL"; then
12102     AC_MSG_ERROR([neither wget nor curl found!])
12107 AC_SUBST(WGET)
12108 AC_SUBST(CURL)
12111 # check for sha256sum
12113 SHA256SUM=
12115 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12116     eval "$i -a 256 --version" > /dev/null 2>&1
12117     ret=$?
12118     if test $ret -eq 0; then
12119         SHA256SUM="$i -a 256"
12120         break
12121     fi
12122 done
12124 if test -z "$SHA256SUM"; then
12125     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12126         eval "$i --version" > /dev/null 2>&1
12127         ret=$?
12128         if test $ret -eq 0; then
12129             SHA256SUM=$i
12130             break
12131         fi
12132     done
12135 if test -z "$SHA256SUM"; then
12136     AC_MSG_ERROR([no sha256sum found!])
12139 AC_SUBST(SHA256SUM)
12141 dnl ===================================================================
12142 dnl Dealing with l10n options
12143 dnl ===================================================================
12144 AC_MSG_CHECKING([which languages to be built])
12145 # get list of all languages
12146 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12147 # the sed command does the following:
12148 #   + if a line ends with a backslash, append the next line to it
12149 #   + adds " on the beginning of the value (after =)
12150 #   + adds " at the end of the value
12151 #   + removes en-US; we want to put it on the beginning
12152 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12153 [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)]
12154 ALL_LANGS="en-US $completelangiso"
12155 # check the configured localizations
12156 WITH_LANG="$with_lang"
12158 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12159 # (Norwegian is "nb" and "nn".)
12160 if test "$WITH_LANG" = "no"; then
12161     WITH_LANG=
12164 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12165     AC_MSG_RESULT([en-US])
12166 else
12167     AC_MSG_RESULT([$WITH_LANG])
12168     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12169     if test -z "$MSGFMT"; then
12170         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12171             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12172         elif test -x "/opt/lo/bin/msgfmt"; then
12173             MSGFMT="/opt/lo/bin/msgfmt"
12174         else
12175             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12176             if test -z "$MSGFMT"; then
12177                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12178             fi
12179         fi
12180     fi
12181     if test -z "$MSGUNIQ"; then
12182         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12183             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12184         elif test -x "/opt/lo/bin/msguniq"; then
12185             MSGUNIQ="/opt/lo/bin/msguniq"
12186         else
12187             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12188             if test -z "$MSGUNIQ"; then
12189                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12190             fi
12191         fi
12192     fi
12194 AC_SUBST(MSGFMT)
12195 AC_SUBST(MSGUNIQ)
12196 # check that the list is valid
12197 for lang in $WITH_LANG; do
12198     test "$lang" = "ALL" && continue
12199     # need to check for the exact string, so add space before and after the list of all languages
12200     for vl in $ALL_LANGS; do
12201         if test "$vl" = "$lang"; then
12202            break
12203         fi
12204     done
12205     if test "$vl" != "$lang"; then
12206         # if you're reading this - you prolly quoted your languages remove the quotes ...
12207         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12208     fi
12209 done
12210 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12211     echo $WITH_LANG | grep -q en-US
12212     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12214 # list with substituted ALL
12215 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12216 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12217 test "$WITH_LANG" = "en-US" && WITH_LANG=
12218 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12219     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12220     ALL_LANGS=`echo $ALL_LANGS qtz`
12222 AC_SUBST(ALL_LANGS)
12223 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12224 AC_SUBST(WITH_LANG)
12225 AC_SUBST(WITH_LANG_LIST)
12226 AC_SUBST(GIT_NEEDED_SUBMODULES)
12228 WITH_POOR_HELP_LOCALIZATIONS=
12229 if test -d "$SRC_ROOT/translations/source"; then
12230     for l in `ls -1 $SRC_ROOT/translations/source`; do
12231         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12232             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12233         fi
12234     done
12236 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12238 if test -n "$with_locales"; then
12239     WITH_LOCALES="$with_locales"
12241     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12242     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12243     # config_host/config_locales.h.in
12244     for locale in $WITH_LOCALES; do
12245         lang=${locale%_*}
12247         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12249         case $lang in
12250         hi|mr*ne)
12251             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12252             ;;
12253         bg|ru)
12254             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12255             ;;
12256         esac
12257     done
12258 else
12259     AC_DEFINE(WITH_LOCALE_ALL)
12261 AC_SUBST(WITH_LOCALES)
12263 dnl git submodule update --reference
12264 dnl ===================================================================
12265 if test -n "${GIT_REFERENCE_SRC}"; then
12266     for repo in ${GIT_NEEDED_SUBMODULES}; do
12267         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12268             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12269         fi
12270     done
12272 AC_SUBST(GIT_REFERENCE_SRC)
12274 dnl git submodules linked dirs
12275 dnl ===================================================================
12276 if test -n "${GIT_LINK_SRC}"; then
12277     for repo in ${GIT_NEEDED_SUBMODULES}; do
12278         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12279             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12280         fi
12281     done
12283 AC_SUBST(GIT_LINK_SRC)
12285 dnl branding
12286 dnl ===================================================================
12287 AC_MSG_CHECKING([for alternative branding images directory])
12288 # initialize mapped arrays
12289 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12290 brand_files="$BRAND_INTRO_IMAGES about.svg"
12292 if test -z "$with_branding" -o "$with_branding" = "no"; then
12293     AC_MSG_RESULT([none])
12294     DEFAULT_BRAND_IMAGES="$brand_files"
12295 else
12296     if ! test -d $with_branding ; then
12297         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12298     else
12299         AC_MSG_RESULT([$with_branding])
12300         CUSTOM_BRAND_DIR="$with_branding"
12301         for lfile in $brand_files
12302         do
12303             if ! test -f $with_branding/$lfile ; then
12304                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12305                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12306             else
12307                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12308             fi
12309         done
12310         check_for_progress="yes"
12311     fi
12313 AC_SUBST([BRAND_INTRO_IMAGES])
12314 AC_SUBST([CUSTOM_BRAND_DIR])
12315 AC_SUBST([CUSTOM_BRAND_IMAGES])
12316 AC_SUBST([DEFAULT_BRAND_IMAGES])
12319 AC_MSG_CHECKING([for 'intro' progress settings])
12320 PROGRESSBARCOLOR=
12321 PROGRESSSIZE=
12322 PROGRESSPOSITION=
12323 PROGRESSFRAMECOLOR=
12324 PROGRESSTEXTCOLOR=
12325 PROGRESSTEXTBASELINE=
12327 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12328     source "$with_branding/progress.conf"
12329     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12330 else
12331     AC_MSG_RESULT([none])
12334 AC_SUBST(PROGRESSBARCOLOR)
12335 AC_SUBST(PROGRESSSIZE)
12336 AC_SUBST(PROGRESSPOSITION)
12337 AC_SUBST(PROGRESSFRAMECOLOR)
12338 AC_SUBST(PROGRESSTEXTCOLOR)
12339 AC_SUBST(PROGRESSTEXTBASELINE)
12342 AC_MSG_CHECKING([for extra build ID])
12343 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12344     EXTRA_BUILDID="$with_extra_buildid"
12346 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12347 if test -n "$EXTRA_BUILDID" ; then
12348     AC_MSG_RESULT([$EXTRA_BUILDID])
12349 else
12350     AC_MSG_RESULT([not set])
12352 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12354 OOO_VENDOR=
12355 AC_MSG_CHECKING([for vendor])
12356 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12357     OOO_VENDOR="$USERNAME"
12359     if test -z "$OOO_VENDOR"; then
12360         OOO_VENDOR="$USER"
12361     fi
12363     if test -z "$OOO_VENDOR"; then
12364         OOO_VENDOR="`id -u -n`"
12365     fi
12367     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12368 else
12369     OOO_VENDOR="$with_vendor"
12370     AC_MSG_RESULT([$OOO_VENDOR])
12372 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12373 AC_SUBST(OOO_VENDOR)
12375 if test "$_os" = "Android" ; then
12376     ANDROID_PACKAGE_NAME=
12377     AC_MSG_CHECKING([for Android package name])
12378     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12379         if test -n "$ENABLE_DEBUG"; then
12380             # Default to the package name that makes ndk-gdb happy.
12381             ANDROID_PACKAGE_NAME="org.libreoffice"
12382         else
12383             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12384         fi
12386         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12387     else
12388         ANDROID_PACKAGE_NAME="$with_android_package_name"
12389         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12390     fi
12391     AC_SUBST(ANDROID_PACKAGE_NAME)
12394 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12395 if test "$with_compat_oowrappers" = "yes"; then
12396     WITH_COMPAT_OOWRAPPERS=TRUE
12397     AC_MSG_RESULT(yes)
12398 else
12399     WITH_COMPAT_OOWRAPPERS=
12400     AC_MSG_RESULT(no)
12402 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12404 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12405 AC_MSG_CHECKING([for install dirname])
12406 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12407     INSTALLDIRNAME="$with_install_dirname"
12409 AC_MSG_RESULT([$INSTALLDIRNAME])
12410 AC_SUBST(INSTALLDIRNAME)
12412 AC_MSG_CHECKING([for prefix])
12413 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12414 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12415 PREFIXDIR="$prefix"
12416 AC_MSG_RESULT([$PREFIXDIR])
12417 AC_SUBST(PREFIXDIR)
12419 LIBDIR=[$(eval echo $(eval echo $libdir))]
12420 AC_SUBST(LIBDIR)
12422 DATADIR=[$(eval echo $(eval echo $datadir))]
12423 AC_SUBST(DATADIR)
12425 MANDIR=[$(eval echo $(eval echo $mandir))]
12426 AC_SUBST(MANDIR)
12428 DOCDIR=[$(eval echo $(eval echo $docdir))]
12429 AC_SUBST(DOCDIR)
12431 BINDIR=[$(eval echo $(eval echo $bindir))]
12432 AC_SUBST(BINDIR)
12434 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12435 AC_SUBST(INSTALLDIR)
12437 TESTINSTALLDIR="${BUILDDIR}/test-install"
12438 AC_SUBST(TESTINSTALLDIR)
12441 # ===================================================================
12442 # OAuth2 id and secrets
12443 # ===================================================================
12445 AC_MSG_CHECKING([for Google Drive client id and secret])
12446 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12447     AC_MSG_RESULT([not set])
12448     GDRIVE_CLIENT_ID="\"\""
12449     GDRIVE_CLIENT_SECRET="\"\""
12450 else
12451     AC_MSG_RESULT([set])
12452     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12453     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12455 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12456 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12458 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12459 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12460     AC_MSG_RESULT([not set])
12461     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12462     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12463 else
12464     AC_MSG_RESULT([set])
12465     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12466     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12468 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12469 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12471 AC_MSG_CHECKING([for OneDrive client id and secret])
12472 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12473     AC_MSG_RESULT([not set])
12474     ONEDRIVE_CLIENT_ID="\"\""
12475     ONEDRIVE_CLIENT_SECRET="\"\""
12476 else
12477     AC_MSG_RESULT([set])
12478     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12479     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12481 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12482 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12485 dnl ===================================================================
12486 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12487 dnl --enable-dependency-tracking configure option
12488 dnl ===================================================================
12489 AC_MSG_CHECKING([whether to enable dependency tracking])
12490 if test "$enable_dependency_tracking" = "no"; then
12491     nodep=TRUE
12492     AC_MSG_RESULT([no])
12493 else
12494     AC_MSG_RESULT([yes])
12496 AC_SUBST(nodep)
12498 dnl ===================================================================
12499 dnl Number of CPUs to use during the build
12500 dnl ===================================================================
12501 AC_MSG_CHECKING([for number of processors to use])
12502 # plain --with-parallelism is just the default
12503 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12504     if test "$with_parallelism" = "no"; then
12505         PARALLELISM=0
12506     else
12507         PARALLELISM=$with_parallelism
12508     fi
12509 else
12510     if test "$enable_icecream" = "yes"; then
12511         PARALLELISM="40"
12512     else
12513         case `uname -s` in
12515         Darwin|FreeBSD|NetBSD|OpenBSD)
12516             PARALLELISM=`sysctl -n hw.ncpu`
12517             ;;
12519         Linux)
12520             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12521         ;;
12522         # what else than above does profit here *and* has /proc?
12523         *)
12524             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12525             ;;
12526         esac
12528         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12529         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12530     fi
12533 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12534     if test -z "$with_parallelism"; then
12535             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12536             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12537             PARALLELISM="1"
12538     else
12539         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."
12540     fi
12543 if test $PARALLELISM -eq 0; then
12544     AC_MSG_RESULT([explicit make -j option needed])
12545 else
12546     AC_MSG_RESULT([$PARALLELISM])
12548 AC_SUBST(PARALLELISM)
12550 IWYU_PATH="$with_iwyu"
12551 AC_SUBST(IWYU_PATH)
12552 if test ! -z "$IWYU_PATH"; then
12553     if test ! -f "$IWYU_PATH"; then
12554         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12555     fi
12559 # Set up ILIB for MSVC build
12561 ILIB1=
12562 if test "$build_os" = "cygwin"; then
12563     ILIB="."
12564     if test -n "$JAVA_HOME"; then
12565         ILIB="$ILIB;$JAVA_HOME/lib"
12566     fi
12567     ILIB1=-link
12568     if test "$BITNESS_OVERRIDE" = 64; then
12569         ILIB="$ILIB;$COMPATH/lib/x64"
12570         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12571         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12572         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12573         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12574             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12575             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12576         fi
12577         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12578         ucrtlibpath_formatted=$formatted_path
12579         ILIB="$ILIB;$ucrtlibpath_formatted"
12580         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12581     else
12582         ILIB="$ILIB;$COMPATH/lib/x86"
12583         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12584         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12585         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12586         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12587             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12588             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12589         fi
12590         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12591         ucrtlibpath_formatted=$formatted_path
12592         ILIB="$ILIB;$ucrtlibpath_formatted"
12593         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12594     fi
12595     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12596         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12597     else
12598         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12599     fi
12601     AC_SUBST(ILIB)
12604 # ===================================================================
12605 # Creating bigger shared library to link against
12606 # ===================================================================
12607 AC_MSG_CHECKING([whether to create huge library])
12608 MERGELIBS=
12610 if test $_os = iOS -o $_os = Android; then
12611     # Never any point in mergelibs for these as we build just static
12612     # libraries anyway...
12613     enable_mergelibs=no
12616 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12617     if test $_os != Linux -a $_os != WINNT; then
12618         add_warning "--enable-mergelibs is not tested for this platform"
12619     fi
12620     MERGELIBS="TRUE"
12621     AC_MSG_RESULT([yes])
12622 else
12623     AC_MSG_RESULT([no])
12625 AC_SUBST([MERGELIBS])
12627 dnl ===================================================================
12628 dnl icerun is a wrapper that stops us spawning tens of processes
12629 dnl locally - for tools that can't be executed on the compile cluster
12630 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12631 dnl ===================================================================
12632 AC_MSG_CHECKING([whether to use icerun wrapper])
12633 ICECREAM_RUN=
12634 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12635     ICECREAM_RUN=icerun
12636     AC_MSG_RESULT([yes])
12637 else
12638     AC_MSG_RESULT([no])
12640 AC_SUBST(ICECREAM_RUN)
12642 dnl ===================================================================
12643 dnl Setup the ICECC_VERSION for the build the same way it was set for
12644 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12645 dnl ===================================================================
12646 x_ICECC_VERSION=[\#]
12647 if test -n "$ICECC_VERSION" ; then
12648     x_ICECC_VERSION=
12650 AC_SUBST(x_ICECC_VERSION)
12651 AC_SUBST(ICECC_VERSION)
12653 dnl ===================================================================
12655 AC_MSG_CHECKING([MPL subset])
12656 MPL_SUBSET=
12658 if test "$enable_mpl_subset" = "yes"; then
12659     warn_report=false
12660     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12661         warn_report=true
12662     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12663         warn_report=true
12664     fi
12665     if test "$warn_report" = "true"; then
12666         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12667     fi
12668     if test "x$enable_postgresql_sdbc" != "xno"; then
12669         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12670     fi
12671     if test "$enable_lotuswordpro" = "yes"; then
12672         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12673     fi
12674     if test "$WITH_WEBDAV" = "neon"; then
12675         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12676     fi
12677     if test -n "$ENABLE_POPPLER"; then
12678         if test "x$SYSTEM_POPPLER" = "x"; then
12679             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12680         fi
12681     fi
12682     # cf. m4/libo_check_extension.m4
12683     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12684         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12685     fi
12686     for theme in $WITH_THEMES; do
12687         case $theme in
12688         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12689             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12690         *) : ;;
12691         esac
12692     done
12694     ENABLE_OPENGL_TRANSITIONS=
12696     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12697         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12698     fi
12700     MPL_SUBSET="TRUE"
12701     AC_DEFINE(MPL_HAVE_SUBSET)
12702     AC_MSG_RESULT([only])
12703 else
12704     AC_MSG_RESULT([no restrictions])
12706 AC_SUBST(MPL_SUBSET)
12708 dnl ===================================================================
12710 AC_MSG_CHECKING([formula logger])
12711 ENABLE_FORMULA_LOGGER=
12713 if test "x$enable_formula_logger" = "xyes"; then
12714     AC_MSG_RESULT([yes])
12715     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12716     ENABLE_FORMULA_LOGGER=TRUE
12717 elif test -n "$ENABLE_DBGUTIL" ; then
12718     AC_MSG_RESULT([yes])
12719     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12720     ENABLE_FORMULA_LOGGER=TRUE
12721 else
12722     AC_MSG_RESULT([no])
12725 AC_SUBST(ENABLE_FORMULA_LOGGER)
12727 dnl ===================================================================
12728 dnl Setting up the environment.
12729 dnl ===================================================================
12730 AC_MSG_NOTICE([setting up the build environment variables...])
12732 AC_SUBST(COMPATH)
12734 if test "$build_os" = "cygwin"; then
12735     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12736         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12737         ATL_INCLUDE="$COMPATH/atlmfc/include"
12738     elif test -d "$COMPATH/atlmfc/lib"; then
12739         ATL_LIB="$COMPATH/atlmfc/lib"
12740         ATL_INCLUDE="$COMPATH/atlmfc/include"
12741     else
12742         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12743         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12744     fi
12745     if test "$BITNESS_OVERRIDE" = 64; then
12746         ATL_LIB="$ATL_LIB/x64"
12747     else
12748         ATL_LIB="$ATL_LIB/x86"
12749     fi
12750     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12751     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12753     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12754     PathFormat "/usr/bin/find.exe"
12755     FIND="$formatted_path"
12756     PathFormat "/usr/bin/sort.exe"
12757     SORT="$formatted_path"
12758     PathFormat "/usr/bin/grep.exe"
12759     WIN_GREP="$formatted_path"
12760     PathFormat "/usr/bin/ls.exe"
12761     WIN_LS="$formatted_path"
12762     PathFormat "/usr/bin/touch.exe"
12763     WIN_TOUCH="$formatted_path"
12764 else
12765     FIND=find
12766     SORT=sort
12769 AC_SUBST(ATL_INCLUDE)
12770 AC_SUBST(ATL_LIB)
12771 AC_SUBST(FIND)
12772 AC_SUBST(SORT)
12773 AC_SUBST(WIN_GREP)
12774 AC_SUBST(WIN_LS)
12775 AC_SUBST(WIN_TOUCH)
12777 AC_SUBST(BUILD_TYPE)
12779 AC_SUBST(SOLARINC)
12781 PathFormat "$PERL"
12782 PERL="$formatted_path"
12783 AC_SUBST(PERL)
12785 if test -n "$TMPDIR"; then
12786     TEMP_DIRECTORY="$TMPDIR"
12787 else
12788     TEMP_DIRECTORY="/tmp"
12790 if test "$build_os" = "cygwin"; then
12791     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12793 AC_SUBST(TEMP_DIRECTORY)
12795 # setup the PATH for the environment
12796 if test -n "$LO_PATH_FOR_BUILD"; then
12797     LO_PATH="$LO_PATH_FOR_BUILD"
12798 else
12799     LO_PATH="$PATH"
12801     case "$host_os" in
12803     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12804         if test "$ENABLE_JAVA" != ""; then
12805             pathmunge "$JAVA_HOME/bin" "after"
12806         fi
12807         ;;
12809     cygwin*)
12810         # Win32 make needs native paths
12811         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12812             LO_PATH=`cygpath -p -m "$PATH"`
12813         fi
12814         if test "$BITNESS_OVERRIDE" = 64; then
12815             # needed for msi packaging
12816             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12817         fi
12818         # .NET 4.6 and higher don't have bin directory
12819         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12820             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12821         fi
12822         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12823         pathmunge "$CSC_PATH" "before"
12824         pathmunge "$MIDL_PATH" "before"
12825         pathmunge "$AL_PATH" "before"
12826         pathmunge "$MSPDB_PATH" "before"
12827         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12828             pathmunge "$CL_PATH" "before"
12829         fi
12830         if test -n "$MSBUILD_PATH" ; then
12831             pathmunge "$MSBUILD_PATH" "before"
12832         fi
12833         if test "$BITNESS_OVERRIDE" = 64; then
12834             pathmunge "$COMPATH/bin/amd64" "before"
12835             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12836         else
12837             pathmunge "$COMPATH/bin" "before"
12838             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12839         fi
12840         if test "$ENABLE_JAVA" != ""; then
12841             if test -d "$JAVA_HOME/jre/bin/client"; then
12842                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12843             fi
12844             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12845                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12846             fi
12847             pathmunge "$JAVA_HOME/bin" "before"
12848         fi
12849         ;;
12851     solaris*)
12852         pathmunge "/usr/css/bin" "before"
12853         if test "$ENABLE_JAVA" != ""; then
12854             pathmunge "$JAVA_HOME/bin" "after"
12855         fi
12856         ;;
12857     esac
12860 AC_SUBST(LO_PATH)
12862 libo_FUZZ_SUMMARY
12864 # Generate a configuration sha256 we can use for deps
12865 if test -f config_host.mk; then
12866     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12868 if test -f config_host_lang.mk; then
12869     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12872 CFLAGS=$my_original_CFLAGS
12873 CXXFLAGS=$my_original_CXXFLAGS
12874 CPPFLAGS=$my_original_CPPFLAGS
12876 AC_CONFIG_FILES([config_host.mk
12877                  config_host_lang.mk
12878                  Makefile
12879                  bin/bffvalidator.sh
12880                  bin/odfvalidator.sh
12881                  bin/officeotron.sh
12882                  instsetoo_native/util/openoffice.lst
12883                  sysui/desktop/macosx/Info.plist])
12884 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12885 AC_CONFIG_HEADERS([config_host/config_clang.h])
12886 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12887 AC_CONFIG_HEADERS([config_host/config_eot.h])
12888 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12889 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12890 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12891 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12892 AC_CONFIG_HEADERS([config_host/config_features.h])
12893 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12894 AC_CONFIG_HEADERS([config_host/config_folders.h])
12895 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12896 AC_CONFIG_HEADERS([config_host/config_gio.h])
12897 AC_CONFIG_HEADERS([config_host/config_global.h])
12898 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12899 AC_CONFIG_HEADERS([config_host/config_java.h])
12900 AC_CONFIG_HEADERS([config_host/config_langs.h])
12901 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12902 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12903 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12904 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12905 AC_CONFIG_HEADERS([config_host/config_locales.h])
12906 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12907 AC_CONFIG_HEADERS([config_host/config_oox.h])
12908 AC_CONFIG_HEADERS([config_host/config_options.h])
12909 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12910 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12911 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12912 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12913 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12914 AC_CONFIG_HEADERS([config_host/config_version.h])
12915 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12916 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12917 AC_CONFIG_HEADERS([config_host/config_python.h])
12918 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12919 AC_OUTPUT
12921 if test "$CROSS_COMPILING" = TRUE; then
12922     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12925 # touch the config timestamp file
12926 if test ! -f config_host.mk.stamp; then
12927     echo > config_host.mk.stamp
12928 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12929     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12930 else
12931     echo > config_host.mk.stamp
12934 # touch the config lang timestamp file
12935 if test ! -f config_host_lang.mk.stamp; then
12936     echo > config_host_lang.mk.stamp
12937 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12938     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12939 else
12940     echo > config_host_lang.mk.stamp
12944 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12945         -a "$build_os" = "cygwin"; then
12947 cat << _EOS
12948 ****************************************************************************
12949 WARNING:
12950 Your make version is known to be horribly slow, and hard to debug
12951 problems with. To get a reasonably functional make please do:
12953 to install a pre-compiled binary make for Win32
12955  mkdir -p /opt/lo/bin
12956  cd /opt/lo/bin
12957  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12958  cp make-4.2.1-msvc.exe make
12959  chmod +x make
12961 to install from source:
12962 place yourself in a working directory of you choice.
12964  git clone git://git.savannah.gnu.org/make.git
12966  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12967  set PATH=%PATH%;C:\Cygwin\bin
12968  [or Cygwin64, if that is what you have]
12969  cd path-to-make-repo-you-cloned-above
12970  build_w32.bat --without-guile
12972 should result in a WinRel/gnumake.exe.
12973 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12975 Then re-run autogen.sh
12977 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12978 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12980 _EOS
12981 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12982     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12987 cat << _EOF
12988 ****************************************************************************
12990 To build, run:
12991 $GNUMAKE
12993 To view some help, run:
12994 $GNUMAKE help
12996 _EOF
12998 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12999     cat << _EOF
13000 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13001 _EOF
13003     if test $_os = Darwin; then
13004         echo open instdir/$PRODUCTNAME.app
13005     else
13006         echo instdir/program/soffice
13007     fi
13008     cat << _EOF
13010 If you want to run the smoketest, run:
13011 $GNUMAKE check
13013 _EOF
13016 if test -f warn; then
13017     cat warn
13018     rm warn
13021 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: