tdf#125506: use rObjectToDevice if needed
[LibreOffice.git] / configure.ac
blob8748ae4ed9161eab87c616a196f50eded5caa560
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 BUILD_TYPE="LibO"
29 SCPDEFS=""
30 GIT_NEEDED_SUBMODULES=""
31 LO_PATH= # used by path_munge to construct a PATH variable
33 FilterLibs()
35     filteredlibs=
36     for f in $1; do
37         case "$f" in
38             # let's start with Fedora's paths for now
39             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
40                 # ignore it: on UNIXoids it is searched by default anyway
41                 # but if it's given explicitly then it may override other paths
42                 # (on macOS it would be an error to use it instead of SDK)
43                 ;;
44             *)
45                 filteredlibs="$filteredlibs $f"
46                 ;;
47         esac
48     done
51 PathFormat()
53     formatted_path="$1"
54     if test "$build_os" = "cygwin"; then
55         pf_conv_to_dos=
56         # spaces,parentheses,brackets,braces are problematic in pathname
57         # so are backslashes
58         case "$formatted_path" in
59             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
60                 pf_conv_to_dos="yes"
61             ;;
62         esac
63         if test "$pf_conv_to_dos" = "yes"; then
64             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
65                 formatted_path=`cygpath -sm "$formatted_path"`
66             else
67                 formatted_path=`cygpath -d "$formatted_path"`
68             fi
69             if test $? -ne 0;  then
70                 AC_MSG_ERROR([path conversion failed for "$1".])
71             fi
72         fi
73         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
74         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
75         if test "$fp_count_slash$fp_count_colon" != "00"; then
76             if test "$fp_count_colon" = "0"; then
77                 new_formatted_path=`realpath "$formatted_path"`
78                 if test $? -ne 0;  then
79                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
80                 else
81                     formatted_path="$new_formatted_path"
82                 fi
83             fi
84             formatted_path=`cygpath -m "$formatted_path"`
85             if test $? -ne 0;  then
86                 AC_MSG_ERROR([path conversion failed for "$1".])
87             fi
88         fi
89         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
90         if test "$fp_count_space" != "0"; then
91             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
92         fi
93     fi
96 AbsolutePath()
98     # There appears to be no simple and portable method to get an absolute and
99     # canonical path, so we try creating the directory if does not exist and
100     # utilizing the shell and pwd.
101     rel="$1"
102     absolute_path=""
103     test ! -e "$rel" && mkdir -p "$rel"
104     if test -d "$rel" ; then
105         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
106         absolute_path="$(pwd)"
107         cd - > /dev/null
108     else
109         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
110     fi
113 rm -f warn
114 have_WARNINGS="no"
115 add_warning()
117     if test "$have_WARNINGS" = "no"; then
118         echo "*************************************" > warn
119         have_WARNINGS="yes"
120         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
121             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
122             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
123         else
124             COLORWARN="* WARNING :"
125         fi
126     fi
127     echo "$COLORWARN $@" >> warn
130 dnl Some Mac User have the bad habit of letting a lot of crap
131 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
132 dnl that confuse the build.
133 dnl For the ones that use LODE, let's be nice and protect them
134 dnl from themselves
136 mac_sanitize_path()
138     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
139 dnl a common but nevertheless necessary thing that may be in a fancy
140 dnl path location is git, so make sure we have it
141     mac_git_path=`which git 2>/dev/null`
142     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
143         mac_path="$mac_path:`dirname $mac_git_path`"
144     fi
145 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
146 dnl path location is gpg, so make sure we find it
147     mac_gpg_path=`which gpg 2>/dev/null`
148     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
149         mac_path="$mac_path:`dirname $mac_gpg_path`"
150     fi
151     PATH="$mac_path"
152     unset mac_path
153     unset mac_git_path
154     unset mac_gpg_path
157 echo "********************************************************************"
158 echo "*"
159 echo "*   Running ${PACKAGE_NAME} build configuration."
160 echo "*"
161 echo "********************************************************************"
162 echo ""
164 dnl ===================================================================
165 dnl checks build and host OSes
166 dnl do this before argument processing to allow for platform dependent defaults
167 dnl ===================================================================
168 AC_CANONICAL_HOST
170 AC_MSG_CHECKING([for product name])
171 PRODUCTNAME="AC_PACKAGE_NAME"
172 if test -n "$with_product_name" -a "$with_product_name" != no; then
173     PRODUCTNAME="$with_product_name"
175 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
176     PRODUCTNAME="${PRODUCTNAME}Dev"
178 AC_MSG_RESULT([$PRODUCTNAME])
179 AC_SUBST(PRODUCTNAME)
180 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
181 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
183 dnl ===================================================================
184 dnl Our version is defined by the AC_INIT() at the top of this script.
185 dnl ===================================================================
187 AC_MSG_CHECKING([for package version])
188 if test -n "$with_package_version" -a "$with_package_version" != no; then
189     PACKAGE_VERSION="$with_package_version"
191 AC_MSG_RESULT([$PACKAGE_VERSION])
193 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
195 LIBO_VERSION_MAJOR=$1
196 LIBO_VERSION_MINOR=$2
197 LIBO_VERSION_MICRO=$3
198 LIBO_VERSION_PATCH=$4
200 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
201 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
202 # no way to encode that into an integer in general.
203 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
205 LIBO_VERSION_SUFFIX=$5
206 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
207 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
208 # they get undoubled before actually passed to sed.
209 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
210 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
211 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
212 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
214 AC_SUBST(LIBO_VERSION_MAJOR)
215 AC_SUBST(LIBO_VERSION_MINOR)
216 AC_SUBST(LIBO_VERSION_MICRO)
217 AC_SUBST(LIBO_VERSION_PATCH)
218 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
219 AC_SUBST(LIBO_VERSION_SUFFIX)
220 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
222 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
223 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
224 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
225 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
227 LIBO_THIS_YEAR=`date +%Y`
228 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
230 dnl ===================================================================
231 dnl Product version
232 dnl ===================================================================
233 AC_MSG_CHECKING([for product version])
234 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
235 AC_MSG_RESULT([$PRODUCTVERSION])
236 AC_SUBST(PRODUCTVERSION)
238 AC_PROG_EGREP
239 # AC_PROG_EGREP doesn't set GREP on all systems as well
240 AC_PATH_PROG(GREP, grep)
242 BUILDDIR=`pwd`
243 cd $srcdir
244 SRC_ROOT=`pwd`
245 cd $BUILDDIR
246 x_Cygwin=[\#]
248 dnl ======================================
249 dnl Required GObject introspection version
250 dnl ======================================
251 INTROSPECTION_REQUIRED_VERSION=1.32.0
253 dnl ===================================================================
254 dnl Search all the common names for GNU Make
255 dnl ===================================================================
256 AC_MSG_CHECKING([for GNU Make])
258 # try to use our own make if it is available and GNUMAKE was not already defined
259 if test -z "$GNUMAKE"; then
260     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
261         GNUMAKE="$LODE_HOME/opt/bin/make"
262     elif test -x "/opt/lo/bin/make"; then
263         GNUMAKE="/opt/lo/bin/make"
264     fi
267 GNUMAKE_WIN_NATIVE=
268 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
269     if test -n "$a"; then
270         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
271         if test $? -eq 0;  then
272             if test "$build_os" = "cygwin"; then
273                 if test -n "$($a -v | grep 'Built for Windows')" ; then
274                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
275                     GNUMAKE_WIN_NATIVE="TRUE"
276                 else
277                     GNUMAKE=`which $a`
278                 fi
279             else
280                 GNUMAKE=`which $a`
281             fi
282             break
283         fi
284     fi
285 done
286 AC_MSG_RESULT($GNUMAKE)
287 if test -z "$GNUMAKE"; then
288     AC_MSG_ERROR([not found. install GNU Make.])
289 else
290     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
291         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
292     fi
295 win_short_path_for_make()
297     local_short_path="$1"
298     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
299         cygpath -sm "$local_short_path"
300     else
301         cygpath -u "$(cygpath -d "$local_short_path")"
302     fi
306 if test "$build_os" = "cygwin"; then
307     PathFormat "$SRC_ROOT"
308     SRC_ROOT="$formatted_path"
309     PathFormat "$BUILDDIR"
310     BUILDDIR="$formatted_path"
311     x_Cygwin=
312     AC_MSG_CHECKING(for explicit COMSPEC)
313     if test -z "$COMSPEC"; then
314         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
315     else
316         AC_MSG_RESULT([found: $COMSPEC])
317     fi
320 AC_SUBST(SRC_ROOT)
321 AC_SUBST(BUILDDIR)
322 AC_SUBST(x_Cygwin)
323 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
324 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
326 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
327     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
330 # need sed in os checks...
331 AC_PATH_PROGS(SED, sed)
332 if test -z "$SED"; then
333     AC_MSG_ERROR([install sed to run this script])
336 # Set the ENABLE_LTO variable
337 # ===================================================================
338 AC_MSG_CHECKING([whether to use link-time optimization])
339 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
340     ENABLE_LTO="TRUE"
341     AC_MSG_RESULT([yes])
342     AC_DEFINE(STATIC_LINKING)
343 else
344     ENABLE_LTO=""
345     AC_MSG_RESULT([no])
347 AC_SUBST(ENABLE_LTO)
349 AC_ARG_ENABLE(fuzz-options,
350     AS_HELP_STRING([--enable-fuzz-options],
351         [Randomly enable or disable each of those configurable options
352          that are supposed to be freely selectable without interdependencies,
353          or where bad interaction from interdependencies is automatically avoided.])
356 dnl ===================================================================
357 dnl When building for Android, --with-android-ndk,
358 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
359 dnl mandatory
360 dnl ===================================================================
362 AC_ARG_WITH(android-ndk,
363     AS_HELP_STRING([--with-android-ndk],
364         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
367 AC_ARG_WITH(android-ndk-toolchain-version,
368     AS_HELP_STRING([--with-android-ndk-toolchain-version],
369         [Specify which toolchain version to use, of those present in the
370         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
371         with_android_ndk_toolchain_version=clang5.0)
373 AC_ARG_WITH(android-sdk,
374     AS_HELP_STRING([--with-android-sdk],
375         [Specify location of the Android SDK. Mandatory when building for Android.]),
378 ANDROID_NDK_HOME=
379 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
380     with_android_ndk="$SRC_ROOT/external/android-ndk"
382 if test -n "$with_android_ndk"; then
383     ANDROID_NDK_HOME=$with_android_ndk
385     # Set up a lot of pre-canned defaults
387     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
388         if test ! -f $ANDROID_NDK_HOME/source.properties; then
389             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
390         fi
391         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
392     else
393         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
394     fi
395     if test -z "$ANDROID_NDK_VERSION";  then
396         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
397     fi
398     case $ANDROID_NDK_VERSION in
399     r9*|r10*)
400         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
401         ;;
402     11.1.*|12.1.*|13.1.*|14.1.*)
403         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
404         ;;
405     16.*)
406         ;;
407     *)
408         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
409         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
410         ;;
411     esac
413     ANDROID_API_LEVEL=14
414     android_cpu=$host_cpu
415     ANDROID_ARCH=$android_cpu
416     if test $host_cpu = arm; then
417         android_platform_prefix=$android_cpu-linux-androideabi
418         android_gnu_prefix=$android_platform_prefix
419         LLVM_TRIPLE=armv7-none-linux-androideabi
420         ANDROID_APP_ABI=armeabi-v7a
421         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
422     elif test $host_cpu = aarch64; then
423         android_platform_prefix=$android_cpu-linux-android
424         android_gnu_prefix=$android_platform_prefix
425         LLVM_TRIPLE=aarch64-none-linux-android
426         # minimum android version that supports aarch64
427         ANDROID_API_LEVEL=21
428         ANDROID_APP_ABI=arm64-v8a
429         ANDROID_ARCH=arm64
430     elif test $host_cpu = mips; then
431         android_platform_prefix=mipsel-linux-android
432         android_gnu_prefix=$android_platform_prefix
433         LLVM_TRIPLE=mipsel-none-linux-android
434         ANDROID_APP_ABI=mips
435     else
436         # host_cpu is something like "i386" or "i686" I guess, NDK uses
437         # "x86" in some contexts
438         android_cpu=x86
439         android_platform_prefix=$android_cpu
440         android_gnu_prefix=i686-linux-android
441         LLVM_TRIPLE=i686-none-linux-android
442         ANDROID_APP_ABI=x86
443         ANDROID_ARCH=$android_cpu
444         ANDROIDCFLAGS="-march=atom"
445     fi
447     case "$with_android_ndk_toolchain_version" in
448     clang5.0)
449         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
450         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
451         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
452         ;;
453     *)
454         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
455     esac
457     if test ! -d $ANDROID_BINUTILS_DIR; then
458         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
459     elif test ! -d $ANDROID_COMPILER_DIR; then
460         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
461     fi
463     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
464     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
465     # manage to link the (app-specific) single huge .so that is built for the app in
466     # android/source/ if there is debug information in a significant part of the object files.
467     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
468     # all objects have been built with debug information.)
469     case $build_os in
470     linux-gnu*)
471         ndk_build_os=linux
472         ;;
473     darwin*)
474         ndk_build_os=darwin
475         ;;
476     *)
477         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
478         ;;
479     esac
480     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
481     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
482     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
484     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
485     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
486     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
487     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
488     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
489     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
492     # android is using different sysroots for compilation and linking, but as
493     # there is no full separation in configure and elsewhere, use isystem for
494     # compilation stuff and sysroot for linking
495     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
497     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
498     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
499     if test "$ENABLE_LTO" = TRUE; then
500         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
501         # $CC and $CXX when building external libraries
502         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
503     fi
505     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"
507     if test -z "$CC"; then
508         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
509     fi
510     if test -z "$CXX"; then
511         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
512     fi
514     # remember to download the ownCloud Android library later
515     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
517 AC_SUBST(ANDROID_NDK_HOME)
518 AC_SUBST(ANDROID_APP_ABI)
519 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
521 dnl ===================================================================
522 dnl --with-android-sdk
523 dnl ===================================================================
524 ANDROID_SDK_HOME=
525 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
526     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
528 if test -n "$with_android_sdk"; then
529     ANDROID_SDK_HOME=$with_android_sdk
530     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
532 AC_SUBST(ANDROID_SDK_HOME)
534 libo_FUZZ_ARG_ENABLE([android-editing],
535     AS_HELP_STRING([--enable-android-editing],
536         [Enable the experimental editing feature on Android.])
538 ENABLE_ANDROID_EDITING=
539 if test "$enable_android_editing" = yes; then
540     ENABLE_ANDROID_EDITING=TRUE
542 AC_SUBST([ENABLE_ANDROID_EDITING])
544 dnl ===================================================================
545 dnl The following is a list of supported systems.
546 dnl Sequential to keep the logic very simple
547 dnl These values may be checked and reset later.
548 dnl ===================================================================
549 #defaults unless the os test overrides this:
550 test_randr=yes
551 test_xrender=yes
552 test_cups=yes
553 test_dbus=yes
554 test_fontconfig=yes
555 test_cairo=no
556 test_gdb_index=no
557 test_split_debug=no
559 # Default values, as such probably valid just for Linux, set
560 # differently below just for Mac OSX, but at least better than
561 # hardcoding these as we used to do. Much of this is duplicated also
562 # in solenv for old build system and for gbuild, ideally we should
563 # perhaps define stuff like this only here in configure.ac?
565 LINKFLAGSSHL="-shared"
566 PICSWITCH="-fpic"
567 DLLPOST=".so"
569 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
571 INSTROOTBASESUFFIX=
572 INSTROOTCONTENTSUFFIX=
573 SDKDIRNAME=sdk
575 case "$host_os" in
577 solaris*)
578     test_gtk=yes
579     build_gstreamer_1_0=yes
580     build_gstreamer_0_10=yes
581     test_freetype=yes
582     _os=SunOS
584     dnl ===========================================================
585     dnl Check whether we're using Solaris 10 - SPARC or Intel.
586     dnl ===========================================================
587     AC_MSG_CHECKING([the Solaris operating system release])
588     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
589     if test "$_os_release" -lt "10"; then
590         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
591     else
592         AC_MSG_RESULT([ok ($_os_release)])
593     fi
595     dnl Check whether we're using a SPARC or i386 processor
596     AC_MSG_CHECKING([the processor type])
597     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
598         AC_MSG_RESULT([ok ($host_cpu)])
599     else
600         AC_MSG_ERROR([only SPARC and i386 processors are supported])
601     fi
602     ;;
604 linux-gnu*|k*bsd*-gnu*)
605     test_gtk=yes
606     build_gstreamer_1_0=yes
607     build_gstreamer_0_10=yes
608     test_kde5=yes
609     test_gtk3_kde5=yes
610     test_gdb_index=yes
611     test_split_debug=yes
612     if test "$enable_fuzzers" != yes; then
613         test_freetype=yes
614         test_fontconfig=yes
615     else
616         test_freetype=no
617         test_fontconfig=no
618         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
619     fi
620     _os=Linux
621     ;;
623 gnu)
624     test_randr=no
625     test_xrender=no
626     _os=GNU
627      ;;
629 cygwin*|interix*)
631     # When building on Windows normally with MSVC under Cygwin,
632     # configure thinks that the host platform (the platform the
633     # built code will run on) is Cygwin, even if it obviously is
634     # Windows, which in Autoconf terminology is called
635     # "mingw32". (Which is misleading as MinGW is the name of the
636     # tool-chain, not an operating system.)
638     # Somewhat confusing, yes. But this configure script doesn't
639     # look at $host etc that much, it mostly uses its own $_os
640     # variable, set here in this case statement.
642     test_cups=no
643     test_dbus=no
644     test_randr=no
645     test_xrender=no
646     test_freetype=no
647     test_fontconfig=no
648     _os=WINNT
650     DLLPOST=".dll"
651     LINKFLAGSNOUNDEFS=
652     ;;
654 darwin*) # macOS or iOS
655     test_gtk=yes
656     test_randr=no
657     test_xrender=no
658     test_freetype=no
659     test_fontconfig=no
660     test_dbus=no
661     if test -n "$LODE_HOME" ; then
662         mac_sanitize_path
663         AC_MSG_NOTICE([sanitized the PATH to $PATH])
664     fi
665     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
666         build_for_ios=YES
667         _os=iOS
668         test_gtk=no
669         test_cups=no
670         enable_mpl_subset=yes
671         enable_lotuswordpro=no
672         enable_coinmp=no
673         enable_lpsolve=no
674         enable_postgresql_sdbc=no
675         enable_extension_integration=no
676         enable_report_builder=no
677         with_ppds=no
678         if test "$enable_ios_simulator" = "yes"; then
679             host=x86_64-apple-darwin
680         fi
681     else
682         _os=Darwin
683         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
684         INSTROOTCONTENTSUFFIX=/Contents
685         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
686     fi
687     # See comment above the case "$host_os"
688     LINKFLAGSSHL="-dynamiclib -single_module"
690     # -fPIC is default
691     PICSWITCH=""
693     DLLPOST=".dylib"
695     # -undefined error is the default
696     LINKFLAGSNOUNDEFS=""
699 freebsd*)
700     test_gtk=yes
701     build_gstreamer_1_0=yes
702     build_gstreamer_0_10=yes
703     test_kde5=yes
704     test_gtk3_kde5=yes
705     test_freetype=yes
706     AC_MSG_CHECKING([the FreeBSD operating system release])
707     if test -n "$with_os_version"; then
708         OSVERSION="$with_os_version"
709     else
710         OSVERSION=`/sbin/sysctl -n kern.osreldate`
711     fi
712     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
713     AC_MSG_CHECKING([which thread library to use])
714     if test "$OSVERSION" -lt "500016"; then
715         PTHREAD_CFLAGS="-D_THREAD_SAFE"
716         PTHREAD_LIBS="-pthread"
717     elif test "$OSVERSION" -lt "502102"; then
718         PTHREAD_CFLAGS="-D_THREAD_SAFE"
719         PTHREAD_LIBS="-lc_r"
720     else
721         PTHREAD_CFLAGS=""
722         PTHREAD_LIBS="-pthread"
723     fi
724     AC_MSG_RESULT([$PTHREAD_LIBS])
725     _os=FreeBSD
726     ;;
728 *netbsd*)
729     test_gtk=yes
730     build_gstreamer_1_0=yes
731     build_gstreamer_0_10=yes
732     test_kde5=yes
733     test_gtk3_kde5=yes
734     test_freetype=yes
735     PTHREAD_LIBS="-pthread -lpthread"
736     _os=NetBSD
737     ;;
739 aix*)
740     test_randr=no
741     test_freetype=yes
742     PTHREAD_LIBS=-pthread
743     _os=AIX
744     ;;
746 openbsd*)
747     test_gtk=yes
748     test_freetype=yes
749     PTHREAD_CFLAGS="-D_THREAD_SAFE"
750     PTHREAD_LIBS="-pthread"
751     _os=OpenBSD
752     ;;
754 dragonfly*)
755     test_gtk=yes
756     build_gstreamer_1_0=yes
757     build_gstreamer_0_10=yes
758     test_kde5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     build_gstreamer_0_10=no
768     enable_lotuswordpro=no
769     enable_mpl_subset=yes
770     enable_coinmp=yes
771     enable_lpsolve=no
772     enable_report_builder=no
773     enable_odk=no
774     enable_postgresql_sdbc=no
775     enable_python=no
776     with_theme="tango"
777     test_cups=no
778     test_dbus=no
779     test_fontconfig=no
780     test_freetype=no
781     test_gtk=no
782     test_kde5=no
783     test_gtk3_kde5=no
784     test_randr=no
785     test_xrender=no
786     _os=Android
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
790     ;;
792 haiku*)
793     test_cups=no
794     test_dbus=no
795     test_randr=no
796     test_xrender=no
797     test_freetype=yes
798     enable_odk=no
799     enable_gstreamer_0_10=no
800     enable_gstreamer_1_0=no
801     enable_vlc=no
802     enable_coinmp=no
803     enable_pdfium=no
804     enable_sdremote=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test "$_os" != "WINNT"; then
940 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942 ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 AC_ARG_ENABLE(fetch-external,
1068     AS_HELP_STRING([--disable-fetch-external],
1069         [Disables fetching external tarballs from web sources.])
1072 AC_ARG_ENABLE(fuzzers,
1073     AS_HELP_STRING([--enable-fuzzers],
1074         [Enables building libfuzzer targets for fuzz testing.])
1077 libo_FUZZ_ARG_ENABLE(pch,
1078     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1079         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1080          Using 'system' will include only external headers, 'base' will add also headers
1081          from base modules, 'normal' will also add all headers except from the module built,
1082          'full' will use all suitable headers even from a module itself.])
1085 libo_FUZZ_ARG_ENABLE(epm,
1086     AS_HELP_STRING([--enable-epm],
1087         [LibreOffice includes self-packaging code, that requires epm, however epm is
1088          useless for large scale package building.])
1091 libo_FUZZ_ARG_ENABLE(odk,
1092     AS_HELP_STRING([--disable-odk],
1093         [LibreOffice includes an ODK, office development kit which some packagers may
1094          wish to build without.])
1097 AC_ARG_ENABLE(mpl-subset,
1098     AS_HELP_STRING([--enable-mpl-subset],
1099         [Don't compile any pieces which are not MPL or more liberally licensed])
1102 libo_FUZZ_ARG_ENABLE(evolution2,
1103     AS_HELP_STRING([--enable-evolution2],
1104         [Allows the built-in evolution 2 addressbook connectivity build to be
1105          enabled.])
1108 AC_ARG_ENABLE(avahi,
1109     AS_HELP_STRING([--enable-avahi],
1110         [Determines whether to use Avahi to advertise Impress to remote controls.])
1113 libo_FUZZ_ARG_ENABLE(werror,
1114     AS_HELP_STRING([--enable-werror],
1115         [Turn warnings to errors. (Has no effect in modules where the treating
1116          of warnings as errors is disabled explicitly.)]),
1119 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1120     AS_HELP_STRING([--enable-assert-always-abort],
1121         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1124 libo_FUZZ_ARG_ENABLE(dbgutil,
1125     AS_HELP_STRING([--enable-dbgutil],
1126         [Provide debugging support from --enable-debug and include additional debugging
1127          utilities such as object counting or more expensive checks.
1128          This is the recommended option for developers.
1129          Note that this makes the build ABI incompatible, it is not possible to mix object
1130          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1132 libo_FUZZ_ARG_ENABLE(debug,
1133     AS_HELP_STRING([--enable-debug],
1134         [Include debugging information, disable compiler optimization and inlining plus
1135          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1137 libo_FUZZ_ARG_ENABLE(split-debug,
1138     AS_HELP_STRING([--disable-split-debug],
1139         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1140          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1142 libo_FUZZ_ARG_ENABLE(gdb-index,
1143     AS_HELP_STRING([--disable-gdb-index],
1144         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1145          The feature requires the gold or lld linker.]))
1147 libo_FUZZ_ARG_ENABLE(sal-log,
1148     AS_HELP_STRING([--enable-sal-log],
1149         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1151 libo_FUZZ_ARG_ENABLE(symbols,
1152     AS_HELP_STRING([--enable-symbols],
1153         [Generate debug information.
1154          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1155          otherwise. It is possible to explicitly specify gbuild build targets
1156          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1157          everything in the directory; there is no ordering, more specific overrides
1158          more general, and disabling takes precedence).
1159          Example: --enable-symbols="all -sw/ -Library_sc".]))
1161 libo_FUZZ_ARG_ENABLE(optimized,
1162     AS_HELP_STRING([--disable-optimized],
1163         [Whether to compile with optimization flags.
1164          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1165          otherwise.]))
1167 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1168     AS_HELP_STRING([--disable-runtime-optimizations],
1169         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1170          JVM JIT) that are known to interact badly with certain dynamic analysis
1171          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1172          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1173          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1175 AC_ARG_WITH(valgrind,
1176     AS_HELP_STRING([--with-valgrind],
1177         [Make availability of Valgrind headers a hard requirement.]))
1179 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1180     AS_HELP_STRING([--enable-compiler-plugins],
1181         [Enable compiler plugins that will perform additional checks during
1182          building. Enabled automatically by --enable-dbgutil.
1183          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1184 COMPILER_PLUGINS_DEBUG=
1185 if test "$enable_compiler_plugins" = debug; then
1186     enable_compiler_plugins=yes
1187     COMPILER_PLUGINS_DEBUG=TRUE
1190 libo_FUZZ_ARG_ENABLE(ooenv,
1191     AS_HELP_STRING([--disable-ooenv],
1192         [Disable ooenv for the instdir installation.]))
1194 libo_FUZZ_ARG_ENABLE(libnumbertext,
1195     AS_HELP_STRING([--disable-libnumbertext],
1196         [Disable use of numbertext external library.]))
1198 AC_ARG_ENABLE(lto,
1199     AS_HELP_STRING([--enable-lto],
1200         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1201          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1202          linker. For MSVC, this option is broken at the moment. This is experimental work
1203          in progress that shouldn't be used unless you are working on it.)]))
1205 AC_ARG_ENABLE(python,
1206     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1207         [Enables or disables Python support at run-time.
1208          Also specifies what Python to use. 'auto' is the default.
1209          'fully-internal' even forces the internal version for uses of Python
1210          during the build.]))
1212 libo_FUZZ_ARG_ENABLE(gtk,
1213     AS_HELP_STRING([--disable-gtk],
1214         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1215 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(split-app-modules,
1223     AS_HELP_STRING([--enable-split-app-modules],
1224         [Split file lists for app modules, e.g. base, calc.
1225          Has effect only with make distro-pack-install]),
1228 AC_ARG_ENABLE(split-opt-features,
1229     AS_HELP_STRING([--enable-split-opt-features],
1230         [Split file lists for some optional features, e.g. pyuno, testtool.
1231          Has effect only with make distro-pack-install]),
1234 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1235     AS_HELP_STRING([--disable-cairo-canvas],
1236         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1239 libo_FUZZ_ARG_ENABLE(dbus,
1240     AS_HELP_STRING([--disable-dbus],
1241         [Determines whether to enable features that depend on dbus.
1242          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1243 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1245 libo_FUZZ_ARG_ENABLE(sdremote,
1246     AS_HELP_STRING([--disable-sdremote],
1247         [Determines whether to enable Impress remote control (i.e. the server component).]),
1248 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1251     AS_HELP_STRING([--disable-sdremote-bluetooth],
1252         [Determines whether to build sdremote with bluetooth support.
1253          Requires dbus on Linux.]))
1255 libo_FUZZ_ARG_ENABLE(gio,
1256     AS_HELP_STRING([--disable-gio],
1257         [Determines whether to use the GIO support.]),
1258 ,test "${enable_gio+set}" = set || enable_gio=yes)
1260 AC_ARG_ENABLE(qt5,
1261     AS_HELP_STRING([--enable-qt5],
1262         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1263          available.]),
1266 AC_ARG_ENABLE(kde5,
1267     AS_HELP_STRING([--enable-kde5],
1268         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1269          KF5 are available.]),
1272 AC_ARG_ENABLE(gtk3_kde5,
1273     AS_HELP_STRING([--enable-gtk3-kde5],
1274         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1275          platforms where Gtk3, Qt5 and Plasma is available.]),
1278 libo_FUZZ_ARG_ENABLE(gui,
1279     AS_HELP_STRING([--disable-gui],
1280         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1281          command-line option. Not related to LibreOffice Online functionality. Don't use
1282          unless you are certain you need to. Nobody will help you if you insist on trying
1283          this and run into problems.]),
1284 ,test "${enable_gui+set}" = set || enable_gui=yes)
1286 libo_FUZZ_ARG_ENABLE(randr,
1287     AS_HELP_STRING([--disable-randr],
1288         [Disable RandR support in the vcl project.]),
1289 ,test "${enable_randr+set}" = set || enable_randr=yes)
1291 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1292     AS_HELP_STRING([--disable-gstreamer-1-0],
1293         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1294 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1296 AC_ARG_ENABLE(gstreamer-0-10,
1297     AS_HELP_STRING([--enable-gstreamer-0-10],
1298         [Enable building with the gstreamer 0.10 avmedia backend.]),
1299 ,enable_gstreamer_0_10=no)
1301 libo_FUZZ_ARG_ENABLE(vlc,
1302     AS_HELP_STRING([--enable-vlc],
1303         [Enable building with the (experimental) VLC avmedia backend.]),
1304 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1306 libo_FUZZ_ARG_ENABLE(neon,
1307     AS_HELP_STRING([--disable-neon],
1308         [Disable neon and the compilation of webdav binding.]),
1311 libo_FUZZ_ARG_ENABLE([eot],
1312     [AS_HELP_STRING([--enable-eot],
1313         [Enable support for Embedded OpenType fonts.])],
1314 ,test "${enable_eot+set}" = set || enable_eot=no)
1316 libo_FUZZ_ARG_ENABLE(cve-tests,
1317     AS_HELP_STRING([--disable-cve-tests],
1318         [Prevent CVE tests to be executed]),
1321 libo_FUZZ_ARG_ENABLE(chart-tests,
1322     AS_HELP_STRING([--enable-chart-tests],
1323         [Executes chart XShape tests. In a perfect world these tests would be
1324          stable and everyone could run them, in reality it is best to run them
1325          only on a few machines that are known to work and maintained by people
1326          who can judge if a test failure is a regression or not.]),
1329 AC_ARG_ENABLE(build-unowinreg,
1330     AS_HELP_STRING([--enable-build-unowinreg],
1331         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1332          compiler is needed on Linux.]),
1335 AC_ARG_ENABLE(build-opensymbol,
1336     AS_HELP_STRING([--enable-build-opensymbol],
1337         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1338          fontforge installed.]),
1341 AC_ARG_ENABLE(dependency-tracking,
1342     AS_HELP_STRING([--enable-dependency-tracking],
1343         [Do not reject slow dependency extractors.])[
1344   --disable-dependency-tracking
1345                           Disables generation of dependency information.
1346                           Speed up one-time builds.],
1349 AC_ARG_ENABLE(icecream,
1350     AS_HELP_STRING([--enable-icecream],
1351         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1352          It defaults to /opt/icecream for the location of the icecream gcc/g++
1353          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1356 AC_ARG_ENABLE(ld,
1357     AS_HELP_STRING([--enable-ld=<linker>],
1358         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1359          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1362 libo_FUZZ_ARG_ENABLE(cups,
1363     AS_HELP_STRING([--disable-cups],
1364         [Do not build cups support.])
1367 AC_ARG_ENABLE(ccache,
1368     AS_HELP_STRING([--disable-ccache],
1369         [Do not try to use ccache automatically.
1370          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1371          CC/CXX are not yet set, and --enable-icecream is not given, we
1372          attempt to use ccache. --disable-ccache disables ccache completely.
1373          Additionally ccache's depend mode is enabled if possible,
1374          use --enable-ccache=nodepend to enable ccache without depend mode.
1378 AC_ARG_ENABLE(64-bit,
1379     AS_HELP_STRING([--enable-64-bit],
1380         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1381          At the moment meaningful only for Windows.]), ,)
1383 libo_FUZZ_ARG_ENABLE(online-update,
1384     AS_HELP_STRING([--enable-online-update],
1385         [Enable the online update service that will check for new versions of
1386          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1387          If the value is "mar", the experimental Mozilla-like update will be
1388          enabled instead of the traditional update mechanism.]),
1391 AC_ARG_WITH(update-config,
1392     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1393                    [Path to the update config ini file]))
1395 libo_FUZZ_ARG_ENABLE(extension-update,
1396     AS_HELP_STRING([--disable-extension-update],
1397         [Disable possibility to update installed extensions.]),
1400 libo_FUZZ_ARG_ENABLE(release-build,
1401     AS_HELP_STRING([--enable-release-build],
1402         [Enable release build. Note that the "release build" choice is orthogonal to
1403          whether symbols are present, debug info is generated, or optimization
1404          is done.
1405          See http://wiki.documentfoundation.org/Development/DevBuild]),
1408 AC_ARG_ENABLE(windows-build-signing,
1409     AS_HELP_STRING([--enable-windows-build-signing],
1410         [Enable signing of windows binaries (*.exe, *.dll)]),
1413 AC_ARG_ENABLE(silent-msi,
1414     AS_HELP_STRING([--enable-silent-msi],
1415         [Enable MSI with LIMITUI=1 (silent install).]),
1418 AC_ARG_ENABLE(macosx-code-signing,
1419     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1420         [Sign executables, dylibs, frameworks and the app bundle. If you
1421          don't provide an identity the first suitable certificate
1422          in your keychain is used.]),
1425 AC_ARG_ENABLE(macosx-package-signing,
1426     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1427         [Create a .pkg suitable for uploading to the Mac App Store and sign
1428          it. If you don't provide an identity the first suitable certificate
1429          in your keychain is used.]),
1432 AC_ARG_ENABLE(macosx-sandbox,
1433     AS_HELP_STRING([--enable-macosx-sandbox],
1434         [Make the app bundle run in a sandbox. Requires code signing.
1435          Is required by apps distributed in the Mac App Store, and implies
1436          adherence to App Store rules.]),
1439 AC_ARG_WITH(macosx-bundle-identifier,
1440     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1441         [Define the macOS bundle identifier. Default is the somewhat weird
1442          org.libreoffice.script ("script", huh?).]),
1443 ,with_macosx_bundle_identifier=org.libreoffice.script)
1445 AC_ARG_WITH(product-name,
1446     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1447         [Define the product name. Default is AC_PACKAGE_NAME.]),
1448 ,with_product_name=$PRODUCTNAME)
1450 AC_ARG_WITH(package-version,
1451     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1452         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1455 libo_FUZZ_ARG_ENABLE(readonly-installset,
1456     AS_HELP_STRING([--enable-readonly-installset],
1457         [Prevents any attempts by LibreOffice to write into its installation. That means
1458          at least that no "system-wide" extensions can be added. Partly experimental work in
1459          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1462 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1463     AS_HELP_STRING([--disable-postgresql-sdbc],
1464         [Disable the build of the PostgreSQL-SDBC driver.])
1467 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1468     AS_HELP_STRING([--disable-lotuswordpro],
1469         [Disable the build of the Lotus Word Pro filter.]),
1470 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1472 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1473     AS_HELP_STRING([--disable-firebird-sdbc],
1474         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1475 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1477 AC_ARG_ENABLE(bogus-pkg-config,
1478     AS_HELP_STRING([--enable-bogus-pkg-config],
1479         [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.]),
1482 AC_ARG_ENABLE(openssl,
1483     AS_HELP_STRING([--disable-openssl],
1484         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1485          components will either use GNUTLS or NSS. Work in progress,
1486          use only if you are hacking on it.]),
1487 ,enable_openssl=yes)
1489 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1490     AS_HELP_STRING([--enable-cipher-openssl-backend],
1491         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1492          Requires --enable-openssl.]))
1494 AC_ARG_ENABLE(library-bin-tar,
1495     AS_HELP_STRING([--enable-library-bin-tar],
1496         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1497         Some libraries can save their build result in a tarball
1498         stored in TARFILE_LOCATION. That binary tarball is
1499         uniquely identified by the source tarball,
1500         the content of the config_host.mk file and the content
1501         of the top-level directory in core for that library
1502         If this option is enabled, then if such a tarfile exist, it will be untarred
1503         instead of the source tarfile, and the build step will be skipped for that
1504         library.
1505         If a proper tarfile does not exist, then the normal source-based
1506         build is done for that library and a proper binary tarfile is created
1507         for the next time.]),
1510 AC_ARG_ENABLE(dconf,
1511     AS_HELP_STRING([--disable-dconf],
1512         [Disable the dconf configuration backend (enabled by default where
1513          available).]))
1515 libo_FUZZ_ARG_ENABLE(formula-logger,
1516     AS_HELP_STRING(
1517         [--enable-formula-logger],
1518         [Enable formula logger for logging formula calculation flow in Calc.]
1519     )
1522 AC_ARG_ENABLE(ldap,
1523     AS_HELP_STRING([--disable-ldap],
1524         [Disable LDAP support.]),
1525 ,enable_ldap=yes)
1527 dnl ===================================================================
1528 dnl Optional Packages (--with/without-)
1529 dnl ===================================================================
1531 AC_ARG_WITH(gcc-home,
1532     AS_HELP_STRING([--with-gcc-home],
1533         [Specify the location of gcc/g++ manually. This can be used in conjunction
1534          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1535          non-default path.]),
1538 AC_ARG_WITH(gnu-patch,
1539     AS_HELP_STRING([--with-gnu-patch],
1540         [Specify location of GNU patch on Solaris or FreeBSD.]),
1543 AC_ARG_WITH(build-platform-configure-options,
1544     AS_HELP_STRING([--with-build-platform-configure-options],
1545         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1548 AC_ARG_WITH(gnu-cp,
1549     AS_HELP_STRING([--with-gnu-cp],
1550         [Specify location of GNU cp on Solaris or FreeBSD.]),
1553 AC_ARG_WITH(external-tar,
1554     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1555         [Specify an absolute path of where to find (and store) tarfiles.]),
1556     TARFILE_LOCATION=$withval ,
1559 AC_ARG_WITH(referenced-git,
1560     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1561         [Specify another checkout directory to reference. This makes use of
1562                  git submodule update --reference, and saves a lot of diskspace
1563                  when having multiple trees side-by-side.]),
1564     GIT_REFERENCE_SRC=$withval ,
1567 AC_ARG_WITH(linked-git,
1568     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1569         [Specify a directory where the repositories of submodules are located.
1570          This uses a method similar to git-new-workdir to get submodules.]),
1571     GIT_LINK_SRC=$withval ,
1574 AC_ARG_WITH(galleries,
1575     AS_HELP_STRING([--with-galleries],
1576         [Specify how galleries should be built. It is possible either to
1577          build these internally from source ("build"),
1578          or to disable them ("no")]),
1581 AC_ARG_WITH(theme,
1582     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1583         [Choose which themes to include. By default those themes with an '*' are included.
1584          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1585          *elementary_svg, *karasa_jaga, *sifr, *sif_svg, *sifr_dark, *tango.]),
1588 libo_FUZZ_ARG_WITH(helppack-integration,
1589     AS_HELP_STRING([--without-helppack-integration],
1590         [It will not integrate the helppacks to the installer
1591          of the product. Please use this switch to use the online help
1592          or separate help packages.]),
1595 libo_FUZZ_ARG_WITH(fonts,
1596     AS_HELP_STRING([--without-fonts],
1597         [LibreOffice includes some third-party fonts to provide a reliable basis for
1598          help content, templates, samples, etc. When these fonts are already
1599          known to be available on the system then you should use this option.]),
1602 AC_ARG_WITH(epm,
1603     AS_HELP_STRING([--with-epm],
1604         [Decides which epm to use. Default is to use the one from the system if
1605          one is built. When either this is not there or you say =internal epm
1606          will be built.]),
1609 AC_ARG_WITH(package-format,
1610     AS_HELP_STRING([--with-package-format],
1611         [Specify package format(s) for LibreOffice installation sets. The
1612          implicit --without-package-format leads to no installation sets being
1613          generated. Possible values: aix, archive, bsd, deb, dmg,
1614          installed, msi, pkg, and rpm.
1615          Example: --with-package-format='deb rpm']),
1618 AC_ARG_WITH(tls,
1619     AS_HELP_STRING([--with-tls],
1620         [Decides which TLS/SSL and cryptographic implementations to use for
1621          LibreOffice's code. Notice that this doesn't apply for depending
1622          libraries like "neon", for example. Default is to use OpenSSL
1623          although NSS is also possible. Notice that selecting NSS restricts
1624          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1625          restrict by now the usage of NSS in LO's code. Possible values:
1626          openssl, nss. Example: --with-tls="nss"]),
1629 AC_ARG_WITH(system-libs,
1630     AS_HELP_STRING([--with-system-libs],
1631         [Use libraries already on system -- enables all --with-system-* flags.]),
1634 AC_ARG_WITH(system-bzip2,
1635     AS_HELP_STRING([--with-system-bzip2],
1636         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1637     [with_system_bzip2="$with_system_libs"])
1639 AC_ARG_WITH(system-headers,
1640     AS_HELP_STRING([--with-system-headers],
1641         [Use headers already on system -- enables all --with-system-* flags for
1642          external packages whose headers are the only entities used i.e.
1643          boost/odbc/sane-header(s).]),,
1644     [with_system_headers="$with_system_libs"])
1646 AC_ARG_WITH(system-jars,
1647     AS_HELP_STRING([--without-system-jars],
1648         [When building with --with-system-libs, also the needed jars are expected
1649          on the system. Use this to disable that]),,
1650     [with_system_jars="$with_system_libs"])
1652 AC_ARG_WITH(system-cairo,
1653     AS_HELP_STRING([--with-system-cairo],
1654         [Use cairo libraries already on system.  Happens automatically for
1655          (implicit) --enable-gtk and for --enable-gtk3.]))
1657 AC_ARG_WITH(system-epoxy,
1658     AS_HELP_STRING([--with-system-epoxy],
1659         [Use epoxy libraries already on system.  Happens automatically for
1660          --enable-gtk3.]),,
1661        [with_system_epoxy="$with_system_libs"])
1663 AC_ARG_WITH(myspell-dicts,
1664     AS_HELP_STRING([--with-myspell-dicts],
1665         [Adds myspell dictionaries to the LibreOffice installation set]),
1668 AC_ARG_WITH(system-dicts,
1669     AS_HELP_STRING([--without-system-dicts],
1670         [Do not use dictionaries from system paths.]),
1673 AC_ARG_WITH(external-dict-dir,
1674     AS_HELP_STRING([--with-external-dict-dir],
1675         [Specify external dictionary dir.]),
1678 AC_ARG_WITH(external-hyph-dir,
1679     AS_HELP_STRING([--with-external-hyph-dir],
1680         [Specify external hyphenation pattern dir.]),
1683 AC_ARG_WITH(external-thes-dir,
1684     AS_HELP_STRING([--with-external-thes-dir],
1685         [Specify external thesaurus dir.]),
1688 AC_ARG_WITH(system-zlib,
1689     AS_HELP_STRING([--with-system-zlib],
1690         [Use zlib already on system.]),,
1691     [with_system_zlib=auto])
1693 AC_ARG_WITH(system-jpeg,
1694     AS_HELP_STRING([--with-system-jpeg],
1695         [Use jpeg already on system.]),,
1696     [with_system_jpeg="$with_system_libs"])
1698 AC_ARG_WITH(system-clucene,
1699     AS_HELP_STRING([--with-system-clucene],
1700         [Use clucene already on system.]),,
1701     [with_system_clucene="$with_system_libs"])
1703 AC_ARG_WITH(system-expat,
1704     AS_HELP_STRING([--with-system-expat],
1705         [Use expat already on system.]),,
1706     [with_system_expat="$with_system_libs"])
1708 AC_ARG_WITH(system-libxml,
1709     AS_HELP_STRING([--with-system-libxml],
1710         [Use libxml/libxslt already on system.]),,
1711     [with_system_libxml=auto])
1713 AC_ARG_WITH(system-icu,
1714     AS_HELP_STRING([--with-system-icu],
1715         [Use icu already on system.]),,
1716     [with_system_icu="$with_system_libs"])
1718 AC_ARG_WITH(system-ucpp,
1719     AS_HELP_STRING([--with-system-ucpp],
1720         [Use ucpp already on system.]),,
1721     [])
1723 AC_ARG_WITH(system-openldap,
1724     AS_HELP_STRING([--with-system-openldap],
1725         [Use the OpenLDAP LDAP SDK already on system.]),,
1726     [with_system_openldap="$with_system_libs"])
1728 libo_FUZZ_ARG_ENABLE(poppler,
1729     AS_HELP_STRING([--disable-poppler],
1730         [Disable building Poppler.])
1733 AC_ARG_WITH(system-poppler,
1734     AS_HELP_STRING([--with-system-poppler],
1735         [Use system poppler (only needed for PDF import).]),,
1736     [with_system_poppler="$with_system_libs"])
1738 AC_ARG_WITH(system-gpgmepp,
1739     AS_HELP_STRING([--with-system-gpgmepp],
1740         [Use gpgmepp already on system]),,
1741     [with_system_gpgmepp="$with_system_libs"])
1743 AC_ARG_WITH(system-apache-commons,
1744     AS_HELP_STRING([--with-system-apache-commons],
1745         [Use Apache commons libraries already on system.]),,
1746     [with_system_apache_commons="$with_system_jars"])
1748 AC_ARG_WITH(system-mariadb,
1749     AS_HELP_STRING([--with-system-mariadb],
1750         [Use MariaDB/MySQL libraries already on system.]),,
1751     [with_system_mariadb="$with_system_libs"])
1753 AC_ARG_ENABLE(bundle-mariadb,
1754     AS_HELP_STRING([--enable-bundle-mariadb],
1755         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1758 AC_ARG_WITH(system-postgresql,
1759     AS_HELP_STRING([--with-system-postgresql],
1760         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1761          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1762     [with_system_postgresql="$with_system_libs"])
1764 AC_ARG_WITH(libpq-path,
1765     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1766         [Use this PostgreSQL C interface (libpq) installation for building
1767          the PostgreSQL-SDBC extension.]),
1770 AC_ARG_WITH(system-firebird,
1771     AS_HELP_STRING([--with-system-firebird],
1772         [Use Firebird libraries already on system, for building the Firebird-SDBC
1773          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1774     [with_system_firebird="$with_system_libs"])
1776 AC_ARG_WITH(system-libtommath,
1777             AS_HELP_STRING([--with-system-libtommath],
1778                            [Use libtommath already on system]),,
1779             [with_system_libtommath="$with_system_libs"])
1781 AC_ARG_WITH(system-hsqldb,
1782     AS_HELP_STRING([--with-system-hsqldb],
1783         [Use hsqldb already on system.]))
1785 AC_ARG_WITH(hsqldb-jar,
1786     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1787         [Specify path to jarfile manually.]),
1788     HSQLDB_JAR=$withval)
1790 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1791     AS_HELP_STRING([--disable-scripting-beanshell],
1792         [Disable support for scripts in BeanShell.]),
1796 AC_ARG_WITH(system-beanshell,
1797     AS_HELP_STRING([--with-system-beanshell],
1798         [Use beanshell already on system.]),,
1799     [with_system_beanshell="$with_system_jars"])
1801 AC_ARG_WITH(beanshell-jar,
1802     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     BSH_JAR=$withval)
1806 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1807     AS_HELP_STRING([--disable-scripting-javascript],
1808         [Disable support for scripts in JavaScript.]),
1812 AC_ARG_WITH(system-rhino,
1813     AS_HELP_STRING([--with-system-rhino],
1814         [Use rhino already on system.]),,)
1815 #    [with_system_rhino="$with_system_jars"])
1816 # Above is not used as we have different debug interface
1817 # patched into internal rhino. This code needs to be fixed
1818 # before we can enable it by default.
1820 AC_ARG_WITH(rhino-jar,
1821     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1822         [Specify path to jarfile manually.]),
1823     RHINO_JAR=$withval)
1825 AC_ARG_WITH(commons-logging-jar,
1826     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     COMMONS_LOGGING_JAR=$withval)
1830 AC_ARG_WITH(system-jfreereport,
1831     AS_HELP_STRING([--with-system-jfreereport],
1832         [Use JFreeReport already on system.]),,
1833     [with_system_jfreereport="$with_system_jars"])
1835 AC_ARG_WITH(sac-jar,
1836     AS_HELP_STRING([--with-sac-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     SAC_JAR=$withval)
1840 AC_ARG_WITH(libxml-jar,
1841     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     LIBXML_JAR=$withval)
1845 AC_ARG_WITH(flute-jar,
1846     AS_HELP_STRING([--with-flute-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     FLUTE_JAR=$withval)
1850 AC_ARG_WITH(jfreereport-jar,
1851     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     JFREEREPORT_JAR=$withval)
1855 AC_ARG_WITH(liblayout-jar,
1856     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBLAYOUT_JAR=$withval)
1860 AC_ARG_WITH(libloader-jar,
1861     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBLOADER_JAR=$withval)
1865 AC_ARG_WITH(libformula-jar,
1866     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBFORMULA_JAR=$withval)
1870 AC_ARG_WITH(librepository-jar,
1871     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBREPOSITORY_JAR=$withval)
1875 AC_ARG_WITH(libfonts-jar,
1876     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBFONTS_JAR=$withval)
1880 AC_ARG_WITH(libserializer-jar,
1881     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     LIBSERIALIZER_JAR=$withval)
1885 AC_ARG_WITH(libbase-jar,
1886     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1887         [Specify path to jarfile manually.]),
1888     LIBBASE_JAR=$withval)
1890 AC_ARG_WITH(system-odbc,
1891     AS_HELP_STRING([--with-system-odbc],
1892         [Use the odbc headers already on system.]),,
1893     [with_system_odbc="auto"])
1895 AC_ARG_WITH(system-sane,
1896     AS_HELP_STRING([--with-system-sane],
1897         [Use sane.h already on system.]),,
1898     [with_system_sane="$with_system_headers"])
1900 AC_ARG_WITH(system-bluez,
1901     AS_HELP_STRING([--with-system-bluez],
1902         [Use bluetooth.h already on system.]),,
1903     [with_system_bluez="$with_system_headers"])
1905 AC_ARG_WITH(system-curl,
1906     AS_HELP_STRING([--with-system-curl],
1907         [Use curl already on system.]),,
1908     [with_system_curl=auto])
1910 AC_ARG_WITH(system-boost,
1911     AS_HELP_STRING([--with-system-boost],
1912         [Use boost already on system.]),,
1913     [with_system_boost="$with_system_headers"])
1915 AC_ARG_WITH(system-glm,
1916     AS_HELP_STRING([--with-system-glm],
1917         [Use glm already on system.]),,
1918     [with_system_glm="$with_system_headers"])
1920 AC_ARG_WITH(system-hunspell,
1921     AS_HELP_STRING([--with-system-hunspell],
1922         [Use libhunspell already on system.]),,
1923     [with_system_hunspell="$with_system_libs"])
1925 AC_ARG_WITH(system-mythes,
1926     AS_HELP_STRING([--with-system-mythes],
1927         [Use mythes already on system.]),,
1928     [with_system_mythes="$with_system_libs"])
1930 AC_ARG_WITH(system-altlinuxhyph,
1931     AS_HELP_STRING([--with-system-altlinuxhyph],
1932         [Use ALTLinuxhyph already on system.]),,
1933     [with_system_altlinuxhyph="$with_system_libs"])
1935 AC_ARG_WITH(system-lpsolve,
1936     AS_HELP_STRING([--with-system-lpsolve],
1937         [Use lpsolve already on system.]),,
1938     [with_system_lpsolve="$with_system_libs"])
1940 AC_ARG_WITH(system-coinmp,
1941     AS_HELP_STRING([--with-system-coinmp],
1942         [Use CoinMP already on system.]),,
1943     [with_system_coinmp="$with_system_libs"])
1945 AC_ARG_WITH(system-liblangtag,
1946     AS_HELP_STRING([--with-system-liblangtag],
1947         [Use liblangtag library already on system.]),,
1948     [with_system_liblangtag="$with_system_libs"])
1950 AC_ARG_WITH(webdav,
1951     AS_HELP_STRING([--with-webdav],
1952         [Specify which library to use for webdav implementation.
1953          Possible values: "neon", "serf", "no". The default value is "neon".
1954          Example: --with-webdav="serf"]),
1955     WITH_WEBDAV=$withval,
1956     WITH_WEBDAV="neon")
1958 AC_ARG_WITH(linker-hash-style,
1959     AS_HELP_STRING([--with-linker-hash-style],
1960         [Use linker with --hash-style=<style> when linking shared objects.
1961          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1962          if supported on the build system, and "sysv" otherwise.]))
1964 AC_ARG_WITH(jdk-home,
1965     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1966         [If you have installed JDK 1.6 or later on your system please supply the
1967          path here. Note that this is not the location of the java command but the
1968          location of the entire distribution.]),
1971 AC_ARG_WITH(help,
1972     AS_HELP_STRING([--with-help],
1973         [Enable the build of help. There is a special parameter "common" that
1974          can be used to bundle only the common part, .e.g help-specific icons.
1975          This is useful when you build the helpcontent separately.])
1976     [
1977                           Usage:     --with-help    build the old local help
1978                                  --without-help     no local help (default)
1979                                  --with-help=html   build the new HTML local help
1980                                  --with-help=online build the new HTML online help
1981     ],
1984 libo_FUZZ_ARG_WITH(java,
1985     AS_HELP_STRING([--with-java=<java command>],
1986         [Specify the name of the Java interpreter command. Typically "java"
1987          which is the default.
1989          To build without support for Java components, applets, accessibility
1990          or the XML filters written in Java, use --without-java or --with-java=no.]),
1991     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1992     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1995 AC_ARG_WITH(jvm-path,
1996     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1997         [Use a specific JVM search path at runtime.
1998          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2001 AC_ARG_WITH(ant-home,
2002     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2003         [If you have installed Apache Ant on your system, please supply the path here.
2004          Note that this is not the location of the Ant binary but the location
2005          of the entire distribution.]),
2008 AC_ARG_WITH(symbol-config,
2009     AS_HELP_STRING([--with-symbol-config],
2010         [Configuration for the crashreport symbol upload]),
2011         [],
2012         [with_symbol_config=no])
2014 AC_ARG_WITH(export-validation,
2015     AS_HELP_STRING([--without-export-validation],
2016         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2017 ,with_export_validation=auto)
2019 AC_ARG_WITH(bffvalidator,
2020     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2021         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2022          Requires installed Microsoft Office Binary File Format Validator.
2023          Note: export-validation (--with-export-validation) is required to be turned on.
2024          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2025 ,with_bffvalidator=no)
2027 libo_FUZZ_ARG_WITH(junit,
2028     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2029         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2030          --without-junit disables those tests. Not relevant in the --without-java case.]),
2031 ,with_junit=yes)
2033 AC_ARG_WITH(hamcrest,
2034     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2035         [Specifies the hamcrest jar file to use for JUnit-based tests.
2036          --without-junit disables those tests. Not relevant in the --without-java case.]),
2037 ,with_hamcrest=yes)
2039 AC_ARG_WITH(perl-home,
2040     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2041         [If you have installed Perl 5 Distribution, on your system, please
2042          supply the path here. Note that this is not the location of the Perl
2043          binary but the location of the entire distribution.]),
2046 libo_FUZZ_ARG_WITH(doxygen,
2047     AS_HELP_STRING(
2048         [--with-doxygen=<absolute path to doxygen executable>],
2049         [Specifies the doxygen executable to use when generating ODK C/C++
2050          documentation. --without-doxygen disables generation of ODK C/C++
2051          documentation. Not relevant in the --disable-odk case.]),
2052 ,with_doxygen=yes)
2054 AC_ARG_WITH(visual-studio,
2055     AS_HELP_STRING([--with-visual-studio=<2017>],
2056         [Specify which Visual Studio version to use in case several are
2057          installed. Currently only 2017 is supported.]),
2060 AC_ARG_WITH(windows-sdk,
2061     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2062         [Specify which Windows SDK, or "Windows Kit", version to use
2063          in case the one that came with the selected Visual Studio
2064          is not what you want for some reason. Note that not all compiler/SDK
2065          combinations are supported. The intent is that this option should not
2066          be needed.]),
2069 AC_ARG_WITH(lang,
2070     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2071         [Use this option to build LibreOffice with additional UI language support.
2072          English (US) is always included by default.
2073          Separate multiple languages with space.
2074          For all languages, use --with-lang=ALL.]),
2077 AC_ARG_WITH(locales,
2078     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2079         [Use this option to limit the locale information built in.
2080          Separate multiple locales with space.
2081          Very experimental and might well break stuff.
2082          Just a desperate measure to shrink code and data size.
2083          By default all the locales available is included.
2084          This option is completely unrelated to --with-lang.])
2085     [
2086                           Affects also our character encoding conversion
2087                           tables for encodings mainly targeted for a
2088                           particular locale, like EUC-CN and EUC-TW for
2089                           zh, ISO-2022-JP for ja.
2091                           Affects also our add-on break iterator data for
2092                           some languages.
2094                           For the default, all locales, don't use this switch at all.
2095                           Specifying just the language part of a locale means all matching
2096                           locales will be included.
2097     ],
2100 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2101 libo_FUZZ_ARG_WITH(krb5,
2102     AS_HELP_STRING([--with-krb5],
2103         [Enable MIT Kerberos 5 support in modules that support it.
2104          By default automatically enabled on platforms
2105          where a good system Kerberos 5 is available.]),
2108 libo_FUZZ_ARG_WITH(gssapi,
2109     AS_HELP_STRING([--with-gssapi],
2110         [Enable GSSAPI support in modules that support it.
2111          By default automatically enabled on platforms
2112          where a good system GSSAPI is available.]),
2115 AC_ARG_WITH(iwyu,
2116     AS_HELP_STRING([--with-iwyu],
2117         [Use given IWYU binary path to check unneeded includes instead of building.
2118          Use only if you are hacking on it.]),
2121 libo_FUZZ_ARG_WITH(lxml,
2122     AS_HELP_STRING([--without-lxml],
2123         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2124          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2125          report widget classes and ids.]),
2128 dnl ===================================================================
2129 dnl Branding
2130 dnl ===================================================================
2132 AC_ARG_WITH(branding,
2133     AS_HELP_STRING([--with-branding=/path/to/images],
2134         [Use given path to retrieve branding images set.])
2135     [
2136                           Search for intro.png about.svg and flat_logo.svg.
2137                           If any is missing, default ones will be used instead.
2139                           Search also progress.conf for progress
2140                           settings on intro screen :
2142                           PROGRESSBARCOLOR="255,255,255" Set color of
2143                           progress bar. Comma separated RGB decimal values.
2144                           PROGRESSSIZE="407,6" Set size of progress bar.
2145                           Comma separated decimal values (width, height).
2146                           PROGRESSPOSITION="61,317" Set position of progress
2147                           bar from left,top. Comma separated decimal values.
2148                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2149                           bar frame. Comma separated RGB decimal values.
2150                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2151                           bar text. Comma separated RGB decimal values.
2152                           PROGRESSTEXTBASELINE="287" Set vertical position of
2153                           progress bar text from top. Decimal value.
2155                           Default values will be used if not found.
2156     ],
2160 AC_ARG_WITH(extra-buildid,
2161     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2162         [Show addition build identification in about dialog.]),
2166 AC_ARG_WITH(vendor,
2167     AS_HELP_STRING([--with-vendor="John the Builder"],
2168         [Set vendor of the build.]),
2171 AC_ARG_WITH(android-package-name,
2172     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2173         [Set Android package name of the build.]),
2176 AC_ARG_WITH(compat-oowrappers,
2177     AS_HELP_STRING([--with-compat-oowrappers],
2178         [Install oo* wrappers in parallel with
2179          lo* ones to keep backward compatibility.
2180          Has effect only with make distro-pack-install]),
2183 AC_ARG_WITH(os-version,
2184     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2185         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2188 AC_ARG_WITH(mingw-cross-compiler,
2189     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2190         [Specify the MinGW cross-compiler to use.
2191          When building on the ODK on Unix and building unowinreg.dll,
2192          specify the MinGW C++ cross-compiler.]),
2195 AC_ARG_WITH(idlc-cpp,
2196     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2197         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2200 AC_ARG_WITH(build-version,
2201     AS_HELP_STRING([--with-build-version="Built by Jim"],
2202         [Allows the builder to add a custom version tag that will appear in the
2203          Help/About box for QA purposes.]),
2204 with_build_version=$withval,
2207 AC_ARG_WITH(parallelism,
2208     AS_HELP_STRING([--with-parallelism],
2209         [Number of jobs to run simultaneously during build. Parallel builds can
2210         save a lot of time on multi-cpu machines. Defaults to the number of
2211         CPUs on the machine, unless you configure --enable-icecream - then to
2212         10.]),
2215 AC_ARG_WITH(all-tarballs,
2216     AS_HELP_STRING([--with-all-tarballs],
2217         [Download all external tarballs unconditionally]))
2219 AC_ARG_WITH(gdrive-client-id,
2220     AS_HELP_STRING([--with-gdrive-client-id],
2221         [Provides the client id of the application for OAuth2 authentication
2222         on Google Drive. If either this or --with-gdrive-client-secret is
2223         empty, the feature will be disabled]),
2226 AC_ARG_WITH(gdrive-client-secret,
2227     AS_HELP_STRING([--with-gdrive-client-secret],
2228         [Provides the client secret of the application for OAuth2
2229         authentication on Google Drive. If either this or
2230         --with-gdrive-client-id is empty, the feature will be disabled]),
2233 AC_ARG_WITH(alfresco-cloud-client-id,
2234     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2235         [Provides the client id of the application for OAuth2 authentication
2236         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2237         empty, the feature will be disabled]),
2240 AC_ARG_WITH(alfresco-cloud-client-secret,
2241     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2242         [Provides the client secret of the application for OAuth2
2243         authentication on Alfresco Cloud. If either this or
2244         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2247 AC_ARG_WITH(onedrive-client-id,
2248     AS_HELP_STRING([--with-onedrive-client-id],
2249         [Provides the client id of the application for OAuth2 authentication
2250         on OneDrive. If either this or --with-onedrive-client-secret is
2251         empty, the feature will be disabled]),
2254 AC_ARG_WITH(onedrive-client-secret,
2255     AS_HELP_STRING([--with-onedrive-client-secret],
2256         [Provides the client secret of the application for OAuth2
2257         authentication on OneDrive. If either this or
2258         --with-onedrive-client-id is empty, the feature will be disabled]),
2260 dnl ===================================================================
2261 dnl Do we want to use pre-build binary tarball for recompile
2262 dnl ===================================================================
2264 if test "$enable_library_bin_tar" = "yes" ; then
2265     USE_LIBRARY_BIN_TAR=TRUE
2266 else
2267     USE_LIBRARY_BIN_TAR=
2269 AC_SUBST(USE_LIBRARY_BIN_TAR)
2271 dnl ===================================================================
2272 dnl Test whether build target is Release Build
2273 dnl ===================================================================
2274 AC_MSG_CHECKING([whether build target is Release Build])
2275 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2276     AC_MSG_RESULT([no])
2277     ENABLE_RELEASE_BUILD=
2278 else
2279     AC_MSG_RESULT([yes])
2280     ENABLE_RELEASE_BUILD=TRUE
2282 AC_SUBST(ENABLE_RELEASE_BUILD)
2284 dnl ===================================================================
2285 dnl Test whether to sign Windows Build
2286 dnl ===================================================================
2287 AC_MSG_CHECKING([whether to sign windows build])
2288 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2289     AC_MSG_RESULT([yes])
2290     WINDOWS_BUILD_SIGNING="TRUE"
2291 else
2292     AC_MSG_RESULT([no])
2293     WINDOWS_BUILD_SIGNING="FALSE"
2295 AC_SUBST(WINDOWS_BUILD_SIGNING)
2297 dnl ===================================================================
2298 dnl MacOSX build and runtime environment options
2299 dnl ===================================================================
2301 AC_ARG_WITH(macosx-sdk,
2302     AS_HELP_STRING([--with-macosx-sdk=<version>],
2303         [Prefer a specific SDK for building.])
2304     [
2305                           If the requested SDK is not available, a search for the oldest one will be done.
2306                           With current Xcode versions, only the latest SDK is included, so this option is
2307                           not terribly useful. It works fine to build with a new SDK and run the result
2308                           on an older OS.
2310                           e. g.: --with-macosx-sdk=10.10
2312                           there are 3 options to control the MacOSX build:
2313                           --with-macosx-sdk (referred as 'sdk' below)
2314                           --with-macosx-version-min-required (referred as 'min' below)
2315                           --with-macosx-version-max-allowed (referred as 'max' below)
2317                           the connection between these value and the default they take is as follow:
2318                           ( ? means not specified on the command line, s means the SDK version found,
2319                           constraint: 8 <= x <= y <= z)
2321                           ==========================================
2322                            command line      || config result
2323                           ==========================================
2324                           min  | max  | sdk  || min   | max  | sdk  |
2325                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2326                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2327                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2328                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2329                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2330                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2331                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2332                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2335                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2336                           for a detailed technical explanation of these variables
2338                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2339     ],
2342 AC_ARG_WITH(macosx-version-min-required,
2343     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2344         [set the minimum OS version needed to run the built LibreOffice])
2345     [
2346                           e. g.: --with-macos-version-min-required=10.10
2347                           see --with-macosx-sdk for more info
2348     ],
2351 AC_ARG_WITH(macosx-version-max-allowed,
2352     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2353         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2354     [
2355                           e. g.: --with-macos-version-max-allowed=10.10
2356                           see --with-macosx-sdk for more info
2357     ],
2361 dnl ===================================================================
2362 dnl options for stuff used during cross-compilation build
2363 dnl Not quite superseded by --with-build-platform-configure-options.
2364 dnl TODO: check, if the "force" option is still needed anywhere.
2365 dnl ===================================================================
2367 AC_ARG_WITH(system-icu-for-build,
2368     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2369         [Use icu already on system for build tools (cross-compilation only).]))
2372 dnl ===================================================================
2373 dnl Check for incompatible options set by fuzzing, and reset those
2374 dnl automatically to working combinations
2375 dnl ===================================================================
2377 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2378         "$enable_dbus" != "$enable_avahi"; then
2379     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2380     enable_avahi=$enable_dbus
2383 dnl ===================================================================
2384 dnl check for required programs (grep, awk, sed, bash)
2385 dnl ===================================================================
2387 pathmunge ()
2389     if test -n "$1"; then
2390         if test "$build_os" = "cygwin"; then
2391             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2392                 PathFormat "$1"
2393                 new_path=`cygpath -sm "$formatted_path"`
2394             else
2395                 PathFormat "$1"
2396                 new_path=`cygpath -u "$formatted_path"`
2397             fi
2398         else
2399             new_path="$1"
2400         fi
2401         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2402             if test "$2" = "after"; then
2403                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2404             else
2405                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2406             fi
2407         fi
2408         unset new_path
2409     fi
2412 AC_PROG_AWK
2413 AC_PATH_PROG( AWK, $AWK)
2414 if test -z "$AWK"; then
2415     AC_MSG_ERROR([install awk to run this script])
2418 AC_PATH_PROG(BASH, bash)
2419 if test -z "$BASH"; then
2420     AC_MSG_ERROR([bash not found in \$PATH])
2422 AC_SUBST(BASH)
2424 AC_MSG_CHECKING([for GNU or BSD tar])
2425 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2426     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2427     if test $? -eq 0;  then
2428         GNUTAR=$a
2429         break
2430     fi
2431 done
2432 AC_MSG_RESULT($GNUTAR)
2433 if test -z "$GNUTAR"; then
2434     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2436 AC_SUBST(GNUTAR)
2438 AC_MSG_CHECKING([for tar's option to strip components])
2439 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2440 if test $? -eq 0; then
2441     STRIP_COMPONENTS="--strip-components"
2442 else
2443     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2444     if test $? -eq 0; then
2445         STRIP_COMPONENTS="--strip-path"
2446     else
2447         STRIP_COMPONENTS="unsupported"
2448     fi
2450 AC_MSG_RESULT($STRIP_COMPONENTS)
2451 if test x$STRIP_COMPONENTS = xunsupported; then
2452     AC_MSG_ERROR([you need a tar that is able to strip components.])
2454 AC_SUBST(STRIP_COMPONENTS)
2456 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2457 dnl desktop OSes from "mobile" ones.
2459 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2460 dnl In other words, that when building for an OS that is not a
2461 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2463 dnl Note the direction of the implication; there is no assumption that
2464 dnl cross-compiling would imply a non-desktop OS.
2466 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2467     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2468     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2469     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2472 # Whether to build "avmedia" functionality or not.
2474 if test -z "$enable_avmedia"; then
2475     enable_avmedia=yes
2478 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2479 if test "$enable_avmedia" = yes; then
2480     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2481 else
2482     USE_AVMEDIA_DUMMY='TRUE'
2484 AC_SUBST(USE_AVMEDIA_DUMMY)
2486 # Decide whether to build database connectivity stuff (including
2487 # Base) or not. We probably don't want to on non-desktop OSes.
2488 if test -z "$enable_database_connectivity"; then
2489     # --disable-database-connectivity is unfinished work in progress
2490     # and the iOS test app doesn't link if we actually try to use it.
2491     # if test $_os != iOS -a $_os != Android; then
2492     if test $_os != iOS; then
2493         enable_database_connectivity=yes
2494     fi
2497 if test "$enable_database_connectivity" = yes; then
2498     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2499     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2502 if test -z "$enable_extensions"; then
2503     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2504     if test $_os != iOS -a $_os != Android; then
2505         enable_extensions=yes
2506     fi
2509 if test "$enable_extensions" = yes; then
2510     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2511     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2514 if test -z "$enable_scripting"; then
2515     # Disable scripting for iOS unless specifically overridden
2516     # with --enable-scripting.
2517     if test $_os != iOS; then
2518         enable_scripting=yes
2519     fi
2522 DISABLE_SCRIPTING=''
2523 if test "$enable_scripting" = yes; then
2524     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2525     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2526 else
2527     DISABLE_SCRIPTING='TRUE'
2528     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2531 if test $_os = iOS -o $_os = Android; then
2532     # Disable dynamic_loading always for iOS and Android
2533     enable_dynamic_loading=no
2534 elif test -z "$enable_dynamic_loading"; then
2535     # Otherwise enable it unless specifically disabled
2536     enable_dynamic_loading=yes
2539 DISABLE_DYNLOADING=''
2540 if test "$enable_dynamic_loading" = yes; then
2541     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2542 else
2543     DISABLE_DYNLOADING='TRUE'
2545 AC_SUBST(DISABLE_DYNLOADING)
2547 # remember SYSBASE value
2548 AC_SUBST(SYSBASE)
2550 dnl ===================================================================
2551 dnl  Sort out various gallery compilation options
2552 dnl ===================================================================
2553 AC_MSG_CHECKING([how to build and package galleries])
2554 if test -n "${with_galleries}"; then
2555     if test "$with_galleries" = "build"; then
2556         WITH_GALLERY_BUILD=TRUE
2557         AC_MSG_RESULT([build from source images internally])
2558     elif test "$with_galleries" = "no"; then
2559         WITH_GALLERY_BUILD=
2560         AC_MSG_RESULT([disable non-internal gallery build])
2561     else
2562         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2563     fi
2564 else
2565     if test $_os != iOS -a $_os != Android; then
2566         WITH_GALLERY_BUILD=TRUE
2567         AC_MSG_RESULT([internal src images for desktop])
2568     else
2569         WITH_GALLERY_BUILD=
2570         AC_MSG_RESULT([disable src image build])
2571     fi
2573 AC_SUBST(WITH_GALLERY_BUILD)
2575 dnl ===================================================================
2576 dnl  Checks if ccache is available
2577 dnl ===================================================================
2578 CCACHE_DEPEND_MODE=
2579 if test "$_os" = "WINNT"; then
2580     # on windows/VC build do not use ccache
2581     CCACHE=""
2582 elif test "$enable_ccache" = "no"; then
2583     CCACHE=""
2584 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2585     case "%$CC%$CXX%" in
2586     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2587     # assume that's good then
2588     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2589         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2590         CCACHE_DEPEND_MODE=1
2591         ;;
2592     *)
2593         AC_PATH_PROG([CCACHE],[ccache],[not found])
2594         if test "$CCACHE" = "not found"; then
2595             CCACHE=""
2596         else
2597             CCACHE_DEPEND_MODE=1
2598             # Need to check for ccache version: otherwise prevents
2599             # caching of the results (like "-x objective-c++" for Mac)
2600             if test $_os = Darwin -o $_os = iOS; then
2601                 # Check ccache version
2602                 AC_MSG_CHECKING([whether version of ccache is suitable])
2603                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2604                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2605                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2606                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2607                 else
2608                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2609                     CCACHE=""
2610                     CCACHE_DEPEND_MODE=
2611                 fi
2612             fi
2613         fi
2614         ;;
2615     esac
2616 else
2617     CCACHE=""
2619 if test "$enable_ccache" = "nodepend"; then
2620     CCACHE_DEPEND_MODE=""
2622 AC_SUBST(CCACHE_DEPEND_MODE)
2624 if test "$CCACHE" != ""; then
2625     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2626     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2627     if test "$ccache_size" = ""; then
2628         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2629         if test "$ccache_size" = ""; then
2630             ccache_size=0
2631         fi
2632         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2633         if test $ccache_size -lt 1024; then
2634             CCACHE=""
2635             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2636             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2637         else
2638             # warn that ccache may be too small for debug build
2639             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2640             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2641         fi
2642     else
2643         if test $ccache_size -lt 5; then
2644             #warn that ccache may be too small for debug build
2645             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2646             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2647         fi
2648     fi
2651 dnl ===================================================================
2652 dnl  Checks for C compiler,
2653 dnl  The check for the C++ compiler is later on.
2654 dnl ===================================================================
2655 if test "$_os" != "WINNT"; then
2656     GCC_HOME_SET="true"
2657     AC_MSG_CHECKING([gcc home])
2658     if test -z "$with_gcc_home"; then
2659         if test "$enable_icecream" = "yes"; then
2660             if test -d "/usr/lib/icecc/bin"; then
2661                 GCC_HOME="/usr/lib/icecc/"
2662             elif test -d "/usr/libexec/icecc/bin"; then
2663                 GCC_HOME="/usr/libexec/icecc/"
2664             elif test -d "/opt/icecream/bin"; then
2665                 GCC_HOME="/opt/icecream/"
2666             else
2667                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2669             fi
2670         else
2671             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2672             GCC_HOME_SET="false"
2673         fi
2674     else
2675         GCC_HOME="$with_gcc_home"
2676     fi
2677     AC_MSG_RESULT($GCC_HOME)
2678     AC_SUBST(GCC_HOME)
2680     if test "$GCC_HOME_SET" = "true"; then
2681         if test -z "$CC"; then
2682             CC="$GCC_HOME/bin/gcc"
2683         fi
2684         if test -z "$CXX"; then
2685             CXX="$GCC_HOME/bin/g++"
2686         fi
2687     fi
2690 COMPATH=`dirname "$CC"`
2691 if test "$COMPATH" = "."; then
2692     AC_PATH_PROGS(COMPATH, $CC)
2693     dnl double square bracket to get single because of M4 quote...
2694     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2696 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2698 dnl ===================================================================
2699 dnl Java support
2700 dnl ===================================================================
2701 AC_MSG_CHECKING([whether to build with Java support])
2702 if test "$with_java" != "no"; then
2703     if test "$DISABLE_SCRIPTING" = TRUE; then
2704         AC_MSG_RESULT([no, overridden by --disable-scripting])
2705         ENABLE_JAVA=""
2706         with_java=no
2707     else
2708         AC_MSG_RESULT([yes])
2709         ENABLE_JAVA="TRUE"
2710         AC_DEFINE(HAVE_FEATURE_JAVA)
2711     fi
2712 else
2713     AC_MSG_RESULT([no])
2714     ENABLE_JAVA=""
2717 AC_SUBST(ENABLE_JAVA)
2719 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2721 dnl ENABLE_JAVA="" indicate no Java support at all
2723 dnl ===================================================================
2724 dnl Check macOS SDK and compiler
2725 dnl ===================================================================
2727 if test $_os = Darwin -o $_os = iOS; then
2729     # If no --with-macosx-sdk option is given, look for one
2731     # The intent is that for "most" Mac-based developers, a suitable
2732     # SDK will be found automatically without any configure options.
2734     # For developers with a current Xcode, the lowest-numbered SDK
2735     # higher than or equal to the minimum required should be found.
2737     AC_MSG_CHECKING([what macOS SDK to use])
2738     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2739         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2740         if test -d "$MACOSX_SDK_PATH"; then
2741             with_macosx_sdk="${_macosx_sdk}"
2742             break
2743         else
2744             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2745             if test -d "$MACOSX_SDK_PATH"; then
2746                 with_macosx_sdk="${_macosx_sdk}"
2747                 break
2748             fi
2749         fi
2750     done
2751     if test ! -d "$MACOSX_SDK_PATH"; then
2752         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2753     fi
2755     if test $_os = iOS; then
2756         if test "$enable_ios_simulator" = "yes"; then
2757             useos=iphonesimulator
2758         else
2759             useos=iphoneos
2760         fi
2761         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2762     fi
2763     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2766     case $with_macosx_sdk in
2767     10.12)
2768         MACOSX_SDK_VERSION=101200
2769         ;;
2770     10.13)
2771         MACOSX_SDK_VERSION=101300
2772         ;;
2773     10.14)
2774         MACOSX_SDK_VERSION=101400
2775         ;;
2776     *)
2777         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2778         ;;
2779     esac
2781     if test "$with_macosx_version_min_required" = "" ; then
2782         with_macosx_version_min_required="10.10";
2783     fi
2785     if test "$with_macosx_version_max_allowed" = "" ; then
2786         with_macosx_version_max_allowed="$with_macosx_sdk"
2787     fi
2789     # export this so that "xcrun" invocations later return matching values
2790     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2791     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2792     export DEVELOPER_DIR
2793     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2794     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2796     AC_MSG_CHECKING([whether Xcode is new enough])
2797     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2798     my_xcode_ver2=${my_xcode_ver1#Xcode }
2799     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2800     if test "$my_xcode_ver3" -ge 903; then
2801         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2802     else
2803         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2804     fi
2806     case "$with_macosx_version_min_required" in
2807     10.10)
2808         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2809         ;;
2810     10.11)
2811         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2812         ;;
2813     10.12)
2814         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2815         ;;
2816     10.13)
2817         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2818         ;;
2819     10.14)
2820         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2821         ;;
2822     *)
2823         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--14])
2824         ;;
2825     esac
2826     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2828     LIBTOOL=/usr/bin/libtool
2829     INSTALL_NAME_TOOL=install_name_tool
2830     if test -z "$save_CC"; then
2831         AC_MSG_CHECKING([what compiler to use])
2832         stdlib=-stdlib=libc++
2833         if test "$ENABLE_LTO" = TRUE; then
2834             lto=-flto
2835         fi
2836         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2837         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2838         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2839         AR=`xcrun -find ar`
2840         NM=`xcrun -find nm`
2841         STRIP=`xcrun -find strip`
2842         LIBTOOL=`xcrun -find libtool`
2843         RANLIB=`xcrun -find ranlib`
2844         AC_MSG_RESULT([$CC and $CXX])
2845     fi
2847     case "$with_macosx_version_max_allowed" in
2848     10.10)
2849         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2850         ;;
2851     10.11)
2852         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2853         ;;
2854     10.12)
2855         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2856         ;;
2857     10.13)
2858         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2859         ;;
2860     10.14)
2861         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2862         ;;
2863     *)
2864         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--14])
2865         ;;
2866     esac
2868     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2869     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2870         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])
2871     else
2872         AC_MSG_RESULT([ok])
2873     fi
2875     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2876     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2877         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2878     else
2879         AC_MSG_RESULT([ok])
2880     fi
2881     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2882     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2884     AC_MSG_CHECKING([whether to do code signing])
2886     if test "$enable_macosx_code_signing" = yes; then
2887         # By default use the first suitable certificate (?).
2889         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2890         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2891         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2892         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2893         # "Developer ID Application" one.
2895         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2896         if test -n "$identity"; then
2897             MACOSX_CODESIGNING_IDENTITY=$identity
2898             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2899             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2900         else
2901             AC_MSG_ERROR([cannot determine identity to use])
2902         fi
2903     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2904         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2905         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2906         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2907     else
2908         AC_MSG_RESULT([no])
2909     fi
2911     AC_MSG_CHECKING([whether to create a Mac App Store package])
2913     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2914         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2915     elif test "$enable_macosx_package_signing" = yes; then
2916         # By default use the first suitable certificate.
2917         # It should be a "3rd Party Mac Developer Installer" one
2919         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2920         if test -n "$identity"; then
2921             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2922             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2923             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2924         else
2925             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2926         fi
2927     elif test -n "$enable_macosx_package_signing"; then
2928         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2929         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2930         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2931     else
2932         AC_MSG_RESULT([no])
2933     fi
2935     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2936         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2937     fi
2939     AC_MSG_CHECKING([whether to sandbox the application])
2941     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2942         AC_MSG_ERROR([macOS sandboxing requires code signing])
2943     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2944         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2945     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2946         ENABLE_MACOSX_SANDBOX=TRUE
2947         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2948         AC_MSG_RESULT([yes])
2949     else
2950         AC_MSG_RESULT([no])
2951     fi
2953     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2954     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2955     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2957 AC_SUBST(MACOSX_SDK_PATH)
2958 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2959 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2960 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2961 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2962 AC_SUBST(INSTALL_NAME_TOOL)
2963 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
2964 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2965 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2966 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2967 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2969 dnl ===================================================================
2970 dnl Check iOS SDK and compiler
2971 dnl ===================================================================
2973 if test $_os = iOS; then
2974     AC_MSG_CHECKING([what iOS SDK to use])
2975     current_sdk_ver=12.2
2976     older_sdk_vers="12.1 12.0 11.4"
2977     if test "$enable_ios_simulator" = "yes"; then
2978         platform=iPhoneSimulator
2979         versionmin=-mios-simulator-version-min=11.0
2980     else
2981         platform=iPhoneOS
2982         versionmin=-miphoneos-version-min=11.0
2983     fi
2984     xcode_developer=`xcode-select -print-path`
2986     for sdkver in $current_sdk_ver $older_sdk_vers; do
2987         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2988         if test -d $t; then
2989             sysroot=$t
2990             break
2991         fi
2992     done
2994     if test -z "$sysroot"; then
2995         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2996     fi
2998     AC_MSG_RESULT($sysroot)
3000     # LTO is not really recommended for iOS builds,
3001     # the link time will be astronomical
3002     if test "$ENABLE_LTO" = TRUE; then
3003         lto=-flto
3004     fi
3006     stdlib="-stdlib=libc++"
3008     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3009     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3011     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3012     AR=`xcrun -find ar`
3013     NM=`xcrun -find nm`
3014     STRIP=`xcrun -find strip`
3015     LIBTOOL=`xcrun -find libtool`
3016     RANLIB=`xcrun -find ranlib`
3019 AC_MSG_CHECKING([whether to treat the installation as read-only])
3021 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3022         "$enable_extensions" != yes; then
3023     enable_readonly_installset=yes
3025 if test "$enable_readonly_installset" = yes; then
3026     AC_MSG_RESULT([yes])
3027     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3028 else
3029     AC_MSG_RESULT([no])
3032 dnl ===================================================================
3033 dnl Structure of install set
3034 dnl ===================================================================
3036 if test $_os = Darwin; then
3037     LIBO_BIN_FOLDER=MacOS
3038     LIBO_ETC_FOLDER=Resources
3039     LIBO_LIBEXEC_FOLDER=MacOS
3040     LIBO_LIB_FOLDER=Frameworks
3041     LIBO_LIB_PYUNO_FOLDER=Resources
3042     LIBO_SHARE_FOLDER=Resources
3043     LIBO_SHARE_HELP_FOLDER=Resources/help
3044     LIBO_SHARE_JAVA_FOLDER=Resources/java
3045     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3046     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3047     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3048     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3049     LIBO_URE_BIN_FOLDER=MacOS
3050     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3051     LIBO_URE_LIB_FOLDER=Frameworks
3052     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3053     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3054 elif test $_os = WINNT; then
3055     LIBO_BIN_FOLDER=program
3056     LIBO_ETC_FOLDER=program
3057     LIBO_LIBEXEC_FOLDER=program
3058     LIBO_LIB_FOLDER=program
3059     LIBO_LIB_PYUNO_FOLDER=program
3060     LIBO_SHARE_FOLDER=share
3061     LIBO_SHARE_HELP_FOLDER=help
3062     LIBO_SHARE_JAVA_FOLDER=program/classes
3063     LIBO_SHARE_PRESETS_FOLDER=presets
3064     LIBO_SHARE_READMES_FOLDER=readmes
3065     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3066     LIBO_SHARE_SHELL_FOLDER=program/shell
3067     LIBO_URE_BIN_FOLDER=program
3068     LIBO_URE_ETC_FOLDER=program
3069     LIBO_URE_LIB_FOLDER=program
3070     LIBO_URE_MISC_FOLDER=program
3071     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3072 else
3073     LIBO_BIN_FOLDER=program
3074     LIBO_ETC_FOLDER=program
3075     LIBO_LIBEXEC_FOLDER=program
3076     LIBO_LIB_FOLDER=program
3077     LIBO_LIB_PYUNO_FOLDER=program
3078     LIBO_SHARE_FOLDER=share
3079     LIBO_SHARE_HELP_FOLDER=help
3080     LIBO_SHARE_JAVA_FOLDER=program/classes
3081     LIBO_SHARE_PRESETS_FOLDER=presets
3082     LIBO_SHARE_READMES_FOLDER=readmes
3083     if test "$enable_fuzzers" != yes; then
3084         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3085     else
3086         LIBO_SHARE_RESOURCE_FOLDER=resource
3087     fi
3088     LIBO_SHARE_SHELL_FOLDER=program/shell
3089     LIBO_URE_BIN_FOLDER=program
3090     LIBO_URE_ETC_FOLDER=program
3091     LIBO_URE_LIB_FOLDER=program
3092     LIBO_URE_MISC_FOLDER=program
3093     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3095 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3096 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3097 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3098 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3099 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3100 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3101 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3102 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3103 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3104 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3105 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3106 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3107 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3108 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3109 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3110 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3112 # Not all of them needed in config_host.mk, add more if need arises
3113 AC_SUBST(LIBO_BIN_FOLDER)
3114 AC_SUBST(LIBO_ETC_FOLDER)
3115 AC_SUBST(LIBO_LIB_FOLDER)
3116 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3117 AC_SUBST(LIBO_SHARE_FOLDER)
3118 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3119 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3120 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3121 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3122 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3123 AC_SUBST(LIBO_URE_BIN_FOLDER)
3124 AC_SUBST(LIBO_URE_ETC_FOLDER)
3125 AC_SUBST(LIBO_URE_LIB_FOLDER)
3126 AC_SUBST(LIBO_URE_MISC_FOLDER)
3127 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3129 dnl ===================================================================
3130 dnl Windows specific tests and stuff
3131 dnl ===================================================================
3133 reg_get_value()
3135     # Return value: $regvalue
3136     unset regvalue
3138     local _regentry="/proc/registry${1}/${2}"
3139     if test -f "$_regentry"; then
3140         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3141         # Registry keys read via /proc/registry* are always \0 terminated!
3142         local _regvalue=$(tr -d '\0' < "$_regentry")
3143         if test $? -eq 0; then
3144             regvalue=$_regvalue
3145         fi
3146     fi
3149 # Get a value from the 32-bit side of the Registry
3150 reg_get_value_32()
3152     reg_get_value "32" "$1"
3155 # Get a value from the 64-bit side of the Registry
3156 reg_get_value_64()
3158     reg_get_value "64" "$1"
3161 if test "$_os" = "WINNT"; then
3162     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3163     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3164         AC_MSG_RESULT([no])
3165         WINDOWS_SDK_ARCH="x86"
3166     else
3167         AC_MSG_RESULT([yes])
3168         WINDOWS_SDK_ARCH="x64"
3169         BITNESS_OVERRIDE=64
3170     fi
3172 if test "$_os" = "iOS"; then
3173     cross_compiling="yes"
3176 if test "$cross_compiling" = "yes"; then
3177     export CROSS_COMPILING=TRUE
3178 else
3179     CROSS_COMPILING=
3180     BUILD_TYPE="$BUILD_TYPE NATIVE"
3182 AC_SUBST(CROSS_COMPILING)
3184 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3185 # NOTE: must _not_ be used for bundled external libraries!
3186 ISYSTEM=
3187 if test "$GCC" = "yes"; then
3188     AC_MSG_CHECKING( for -isystem )
3189     save_CFLAGS=$CFLAGS
3190     CFLAGS="$CFLAGS -Werror"
3191     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3192     CFLAGS=$save_CFLAGS
3193     if test -n "$ISYSTEM"; then
3194         AC_MSG_RESULT(yes)
3195     else
3196         AC_MSG_RESULT(no)
3197     fi
3199 if test -z "$ISYSTEM"; then
3200     # fall back to using -I
3201     ISYSTEM=-I
3203 AC_SUBST(ISYSTEM)
3205 dnl ===================================================================
3206 dnl  Check which Visual Studio compiler is used
3207 dnl ===================================================================
3209 map_vs_year_to_version()
3211     # Return value: $vsversion
3213     unset vsversion
3215     case $1 in
3216     2017)
3217         vsversion=15;;
3218     2019)
3219         vsversion=16;;
3220     *)
3221         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3222     esac
3225 vs_versions_to_check()
3227     # Args: $1 (optional) : versions to check, in the order of preference
3228     # Return value: $vsversions
3230     unset vsversions
3232     if test -n "$1"; then
3233         map_vs_year_to_version "$1"
3234         vsversions=$vsversion
3235     else
3236         # We accept only 2017
3237         vsversions="15"
3238     fi
3241 win_get_env_from_vsvars32bat()
3243     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3244     # Also seems to be located in another directory under the same name: vsvars32.bat
3245     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3246     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3247     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3248     chmod +x $WRAPPERBATCHFILEPATH
3249     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3250     rm -f $WRAPPERBATCHFILEPATH
3251     printf '%s' "$_win_get_env_from_vsvars32bat"
3254 find_ucrt()
3256     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3257     if test -n "$regvalue"; then
3258         PathFormat "$regvalue"
3259         UCRTSDKDIR=$formatted_path
3260         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3261         UCRTVERSION=$regvalue
3262         # Rest if not exist
3263         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3264           UCRTSDKDIR=
3265         fi
3266     fi
3267     if test -z "$UCRTSDKDIR"; then
3268         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3269         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3270         if test -f "$ide_env_file"; then
3271             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3272             UCRTSDKDIR=$formatted_path
3273             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3274             dnl Hack needed at least by tml:
3275             if test "$UCRTVERSION" = 10.0.15063.0 \
3276                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3277                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3278             then
3279                 UCRTVERSION=10.0.14393.0
3280             fi
3281         else
3282           AC_MSG_ERROR([No UCRT found])
3283         fi
3284     fi
3287 find_msvc()
3289     # Find Visual C++ 2017/2019
3290     # Args: $1 (optional) : The VS version year
3291     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3293     unset vctest vcnum vcnumwithdot vcbuildnumber
3295     vs_versions_to_check "$1"
3296     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3297     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3298     PathFormat "$vswhere"
3299     vswhere=$formatted_path
3300     for ver in $vsversions; do
3301         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3302         if test -n "$vswhereoutput"; then
3303             PathFormat "$vswhereoutput"
3304             vctest=$formatted_path
3305             break
3306         fi
3307     done
3309     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3310     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3311     # should be removed when upgrading baseline.
3312     if ! test -n "$vctest"; then
3313         for ver in $vsversions; do
3314             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3315             if test -n "$regvalue"; then
3316                 vctest=$regvalue
3317                 break
3318             fi
3319             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3320             if test -n "$regvalue"; then
3321                 AC_MSG_RESULT([found: $regvalue])
3322                 PathFormat "$regvalue"
3323                 vctest=$formatted_path
3324                 break
3325             fi
3326         done
3327     fi
3329     if test -n "$vctest"; then
3330         vcnumwithdot="$ver.0"
3331         case "$vcnumwithdot" in
3332         15.0)
3333             vcyear=2017
3334             vcnum=150
3335             ;;
3336         16.0)
3337             vcyear=2019
3338             vcnum=160
3339             ;;
3340         esac
3341         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3343     fi
3346 SOLARINC=
3347 MSBUILD_PATH=
3348 DEVENV=
3349 if test "$_os" = "WINNT"; then
3350     AC_MSG_CHECKING([Visual C++])
3351     find_msvc "$with_visual_studio"
3352     if test -z "$vctest"; then
3353         if test -n "$with_visual_studio"; then
3354             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3355         else
3356             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3357         fi
3358     fi
3360     if test "$BITNESS_OVERRIDE" = ""; then
3361         if test -f "$vctest/bin/cl.exe"; then
3362             VC_PRODUCT_DIR=$vctest
3363         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3364             VC_PRODUCT_DIR=$vctest/VC
3365         else
3366             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3367         fi
3368     else
3369         if test -f "$vctest/bin/amd64/cl.exe"; then
3370             VC_PRODUCT_DIR=$vctest
3371         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3372             VC_PRODUCT_DIR=$vctest/VC
3373         else
3374             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3375         fi
3376     fi
3378     AC_MSG_CHECKING([for short pathname of VC product directory])
3379     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3380     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3382     UCRTSDKDIR=
3383     UCRTVERSION=
3385     AC_MSG_CHECKING([for UCRT location])
3386     find_ucrt
3387     # find_ucrt errors out if it doesn't find it
3388     AC_MSG_RESULT([found])
3389     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3390     ucrtincpath_formatted=$formatted_path
3391     # SOLARINC is used for external modules and must be set too.
3392     # And no, it's not sufficient to set SOLARINC only, as configure
3393     # itself doesn't honour it.
3394     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3395     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3396     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3397     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3399     AC_SUBST(UCRTSDKDIR)
3400     AC_SUBST(UCRTVERSION)
3402     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3403     # Find the proper version of MSBuild.exe to use based on the VS version
3404     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3405     if test -n "$regvalue" ; then
3406         AC_MSG_RESULT([found: $regvalue])
3407         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3408     else
3409         if test "$vcnumwithdot" = "16.0"; then
3410             if test "$BITNESS_OVERRIDE" = ""; then
3411                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3412             else
3413                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3414             fi
3415         else
3416             if test "$BITNESS_OVERRIDE" = ""; then
3417                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3418             else
3419                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3420             fi
3421         fi
3422         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3423         AC_MSG_RESULT([$regvalue])
3424     fi
3426     # Find the version of devenv.exe
3427     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3428     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3429     if test ! -e "$DEVENV"; then
3430         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3431     fi
3433     dnl ===========================================================
3434     dnl  Check for the corresponding mspdb*.dll
3435     dnl ===========================================================
3437     MSPDB_PATH=
3438     CL_DIR=
3439     CL_LIB=
3441     if test "$BITNESS_OVERRIDE" = ""; then
3442         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3443         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3444     else
3445         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3446         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3447     fi
3449     # MSVC 15.0 has libraries from 14.0?
3450     mspdbnum="140"
3452     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3453         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3454     fi
3456     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3457     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3459     dnl The path needs to be added before cl is called
3460     PATH="$MSPDB_PATH:$PATH"
3462     AC_MSG_CHECKING([cl.exe])
3464     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3465     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3466     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3467     # is not enough?
3469     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3470     dnl needed when building CLR code:
3471     if test -z "$MSVC_CXX"; then
3472         if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3473             MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3474         fi
3476         # This gives us a posix path with 8.3 filename restrictions
3477         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3478     fi
3480     if test -z "$CC"; then
3481         CC=$MSVC_CXX
3482     fi
3483     if test "$BITNESS_OVERRIDE" = ""; then
3484         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3485         MSVC_CXX="$MSVC_CXX -arch:SSE"
3486     fi
3488     if test -n "$CC"; then
3489         # Remove /cl.exe from CC case insensitive
3490         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3491         if test "$BITNESS_OVERRIDE" = ""; then
3492            COMPATH="$VC_PRODUCT_DIR"
3493         else
3494             if test -n "$VC_PRODUCT_DIR"; then
3495                 COMPATH=$VC_PRODUCT_DIR
3496             fi
3497         fi
3498         if test "$BITNESS_OVERRIDE" = ""; then
3499             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3500             CC="$CC -arch:SSE"
3501         fi
3503         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3505         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3507         PathFormat "$COMPATH"
3508         COMPATH="$formatted_path"
3510         VCVER=$vcnum
3511         MSVSVER=$vcyear
3513         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3514         # are always "better", we list them in reverse chronological order.
3516         case "$vcnum" in
3517         150|160)
3518             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3519             ;;
3520         esac
3522         # The expectation is that --with-windows-sdk should not need to be used
3523         if test -n "$with_windows_sdk"; then
3524             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3525             *" "$with_windows_sdk" "*)
3526                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3527                 ;;
3528             *)
3529                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3530                 ;;
3531             esac
3532         fi
3534         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3535         ac_objext=obj
3536         ac_exeext=exe
3538     else
3539         AC_MSG_ERROR([Visual C++ not found after all, huh])
3540     fi
3542     AC_MSG_CHECKING([$CC is at least Visual Studio 2017 version 15.7])
3543     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3544         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3545         // between Visual Studio versions and _MSC_VER:
3546         #if _MSC_VER < 1914
3547         #error
3548         #endif
3549     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3551     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3552     # version of the Explorer extension (and maybe other small
3553     # bits, too) needed when installing a 32-bit LibreOffice on a
3554     # 64-bit OS. The 64-bit Explorer extension is a feature that
3555     # has been present since long in OOo. Don't confuse it with
3556     # building LibreOffice itself as 64-bit code.
3558     BUILD_X64=
3559     CXX_X64_BINARY=
3561     if test "$BITNESS_OVERRIDE" = ""; then
3562         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3563         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3564             # Prefer native x64 compiler to cross-compiler, in case we are running
3565             # the build on a 64-bit OS.
3566             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3567                 BUILD_X64=TRUE
3568                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3569             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3570                 BUILD_X64=TRUE
3571                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3572             fi
3573         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3574              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3575             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3576             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3577                 BUILD_X64=TRUE
3578                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3579             fi
3580         fi
3581         if test "$BUILD_X64" = TRUE; then
3582             AC_MSG_RESULT([found])
3583         else
3584             AC_MSG_RESULT([not found])
3585             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3586         fi
3587     fi
3588     AC_SUBST(BUILD_X64)
3590     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3591     AC_SUBST(CXX_X64_BINARY)
3593     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3594     # needed to support TWAIN scan on both 32- and 64-bit systems
3596     BUILD_X86=
3598     if test "$BITNESS_OVERRIDE" = "64"; then
3599         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3600         if test -n "$CXX_X86_BINARY"; then
3601             BUILD_X86=TRUE
3602             AC_MSG_RESULT([preset])
3603         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3604             BUILD_X86=TRUE
3605             CXX_X86_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe -arch:SSE"
3606             AC_MSG_RESULT([found])
3607         else
3608             CXX_X86_BINARY=
3609             AC_MSG_RESULT([not found])
3610             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3611         fi
3612     else
3613         BUILD_X86=TRUE
3614         CXX_X86_BINARY=$MSVC_CXX
3615     fi
3616     AC_SUBST(BUILD_X86)
3617     AC_SUBST(CXX_X86_BINARY)
3619 AC_SUBST(VCVER)
3620 AC_SUBST(DEVENV)
3621 PathFormat "$MSPDB_PATH"
3622 MSPDB_PATH="$formatted_path"
3623 AC_SUBST(MSVC_CXX)
3626 # unowinreg.dll
3628 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3629 AC_SUBST(UNOWINREG_DLL)
3631 COM_IS_CLANG=
3632 AC_MSG_CHECKING([whether the compiler is actually Clang])
3633 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3634     #ifndef __clang__
3635     you lose
3636     #endif
3637     int foo=42;
3638     ]])],
3639     [AC_MSG_RESULT([yes])
3640      COM_IS_CLANG=TRUE],
3641     [AC_MSG_RESULT([no])])
3642 AC_SUBST(COM_IS_CLANG)
3644 CC_PLAIN=$CC
3645 CLANGVER=
3646 if test "$COM_IS_CLANG" = TRUE; then
3647     AC_MSG_CHECKING([whether Clang is new enough])
3648     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3649         #if !defined __apple_build_version__
3650         #error
3651         #endif
3652         ]])],
3653         [my_apple_clang=yes],[my_apple_clang=])
3654     if test "$my_apple_clang" = yes; then
3655         AC_MSG_RESULT([assumed yes (Apple Clang)])
3656     else
3657         if test "$_os" = WINNT; then
3658             dnl In which case, assume clang-cl:
3659             my_args="/EP /TC"
3660             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3661             dnl clang-cl:
3662             CC_PLAIN=
3663             for i in $CC; do
3664                 case $i in
3665                 -FIIntrin.h)
3666                     ;;
3667                 *)
3668                     CC_PLAIN="$CC_PLAIN $i"
3669                     ;;
3670                 esac
3671             done
3672         else
3673             my_args="-E -P"
3674         fi
3675         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3676         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3677         CLANGVER=`echo $clang_version \
3678             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3679         if test "$CLANGVER" -ge 50002; then
3680             AC_MSG_RESULT([yes ($clang_version)])
3681         else
3682             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3683         fi
3684         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3685         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3686     fi
3689 SHOWINCLUDES_PREFIX=
3690 if test "$_os" = WINNT; then
3691     dnl We need to guess the prefix of the -showIncludes output, it can be
3692     dnl localized
3693     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3694     echo "#include <stdlib.h>" > conftest.c
3695     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3696         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3697     rm -f conftest.c conftest.obj
3698     if test -z "$SHOWINCLUDES_PREFIX"; then
3699         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3700     else
3701         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3702     fi
3704 AC_SUBST(SHOWINCLUDES_PREFIX)
3707 # prefix C with ccache if needed
3709 if test "$CCACHE" != ""; then
3710     AC_MSG_CHECKING([whether $CC is already ccached])
3712     AC_LANG_PUSH([C])
3713     save_CFLAGS=$CFLAGS
3714     CFLAGS="$CFLAGS --ccache-skip -O2"
3715     dnl an empty program will do, we're checking the compiler flags
3716     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3717                       [use_ccache=yes], [use_ccache=no])
3718     if test $use_ccache = yes; then
3719         AC_MSG_RESULT([yes])
3720     else
3721         CC="$CCACHE $CC"
3722         AC_MSG_RESULT([no])
3723     fi
3724     CFLAGS=$save_CFLAGS
3725     AC_LANG_POP([C])
3728 # ===================================================================
3729 # check various GCC options that Clang does not support now but maybe
3730 # will somewhen in the future, check them even for GCC, so that the
3731 # flags are set
3732 # ===================================================================
3734 HAVE_GCC_GGDB2=
3735 if test "$GCC" = "yes"; then
3736     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3737     save_CFLAGS=$CFLAGS
3738     CFLAGS="$CFLAGS -Werror -ggdb2"
3739     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3740     CFLAGS=$save_CFLAGS
3741     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3742         AC_MSG_RESULT([yes])
3743     else
3744         AC_MSG_RESULT([no])
3745     fi
3747     if test "$host_cpu" = "m68k"; then
3748         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3749         save_CFLAGS=$CFLAGS
3750         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3751         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3752         CFLAGS=$save_CFLAGS
3753         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3754             AC_MSG_RESULT([yes])
3755         else
3756             AC_MSG_ERROR([no])
3757         fi
3758     fi
3760 AC_SUBST(HAVE_GCC_GGDB2)
3762 dnl ===================================================================
3763 dnl  Test the gcc version
3764 dnl ===================================================================
3765 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3766     AC_MSG_CHECKING([the GCC version])
3767     _gcc_version=`$CC -dumpversion`
3768     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3769         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3770     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3772     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3774     if test "$gcc_full_version" -lt 70000; then
3775         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3776     fi
3777 else
3778     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3779     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3780     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3781     # (which reports itself as GCC 4.2.1).
3782     GCC_VERSION=
3784 AC_SUBST(GCC_VERSION)
3786 dnl Set the ENABLE_DBGUTIL variable
3787 dnl ===================================================================
3788 AC_MSG_CHECKING([whether to build with additional debug utilities])
3789 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3790     ENABLE_DBGUTIL="TRUE"
3791     # this is an extra var so it can have different default on different MSVC
3792     # versions (in case there are version specific problems with it)
3793     MSVC_USE_DEBUG_RUNTIME="TRUE"
3795     AC_MSG_RESULT([yes])
3796     # cppunit and graphite expose STL in public headers
3797     if test "$with_system_cppunit" = "yes"; then
3798         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3799     else
3800         with_system_cppunit=no
3801     fi
3802     if test "$with_system_graphite" = "yes"; then
3803         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3804     else
3805         with_system_graphite=no
3806     fi
3807     if test "$with_system_orcus" = "yes"; then
3808         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3809     else
3810         with_system_orcus=no
3811     fi
3812     if test "$with_system_libcmis" = "yes"; then
3813         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3814     else
3815         with_system_libcmis=no
3816     fi
3817     if test "$with_system_hunspell" = "yes"; then
3818         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3819     else
3820         with_system_hunspell=no
3821     fi
3822     if test "$with_system_gpgmepp" = "yes"; then
3823         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3824     else
3825         with_system_gpgmepp=no
3826     fi
3827     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3828     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3829     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3830     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3831     # of those two is using the system variant:
3832     if test "$with_system_libnumbertext" = "yes"; then
3833         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3834     else
3835         with_system_libnumbertext=no
3836     fi
3837     if test "$with_system_libwps" = "yes"; then
3838         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3839     else
3840         with_system_libwps=no
3841     fi
3842 else
3843     ENABLE_DBGUTIL=""
3844     MSVC_USE_DEBUG_RUNTIME=""
3845     AC_MSG_RESULT([no])
3847 AC_SUBST(ENABLE_DBGUTIL)
3848 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3850 dnl Set the ENABLE_DEBUG variable.
3851 dnl ===================================================================
3852 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3853     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3855 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3856     if test -z "$libo_fuzzed_enable_debug"; then
3857         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3858     else
3859         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3860         enable_debug=yes
3861     fi
3864 AC_MSG_CHECKING([whether to do a debug build])
3865 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3866     ENABLE_DEBUG="TRUE"
3867     if test -n "$ENABLE_DBGUTIL" ; then
3868         AC_MSG_RESULT([yes (dbgutil)])
3869     else
3870         AC_MSG_RESULT([yes])
3871     fi
3872 else
3873     ENABLE_DEBUG=""
3874     AC_MSG_RESULT([no])
3876 AC_SUBST(ENABLE_DEBUG)
3878 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3879 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3880 dnl Clang 9 is known fixed since
3881 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3882 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3883 if test "$COM_IS_CLANG" = TRUE && test "$CLANGVER" -lt 90000 && test "$_os" = Linux; then
3884     for i in $CC; do
3885         case $i in
3886         -fsanitize=*)
3887             NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3888             break
3889             ;;
3890         esac
3891     done
3893 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3894     AC_MSG_RESULT([yes])
3895 else
3896     AC_MSG_RESULT([no])
3898 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3900 dnl ===================================================================
3901 dnl Select the linker to use (gold/lld/ld.bfd).
3902 dnl This is done only after compiler checks (need to know if Clang is
3903 dnl used, for different defaults) and after checking if a debug build
3904 dnl is wanted (non-debug builds get the default linker if not explicitly
3905 dnl specified otherwise).
3906 dnl All checks for linker features/options should come after this.
3907 dnl ===================================================================
3908 check_use_ld()
3910     use_ld=$1
3911     use_ld_fail_if_error=$2
3912     use_ld_ok=
3913     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3914     use_ld_ldflags_save="$LDFLAGS"
3915     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3916     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3917 #include <stdio.h>
3918         ],[
3919 printf ("hello world\n");
3920         ])], USE_LD=$use_ld, [])
3921     if test -n "$USE_LD"; then
3922         AC_MSG_RESULT( yes )
3923         use_ld_ok=yes
3924         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3925         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3926         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3927             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3928             use_ld_ldflags_save_2="$LDFLAGS"
3929             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3930             use_ld_has_cpp_typeinfo=
3931             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3932 #include <stdio.h>
3933                 ],[
3934 printf ("hello world\n");
3935                 ])], use_ld_has_cpp_typeinfo=yes, [])
3936             LDFLAGS="$use_ld_ldflags_save_2"
3937             if test -n "$use_ld_has_cpp_typeinfo"; then
3938                 AC_MSG_RESULT( yes )
3939             else
3940                 if test -n "$use_ld_fail_if_error"; then
3941                     AC_MSG_ERROR( no )
3942                 else
3943                     AC_MSG_RESULT( no )
3944                 fi
3945                 use_ld_ok=
3946             fi
3947         fi
3948     else
3949         if test -n "$use_ld_fail_if_error"; then
3950             AC_MSG_ERROR( no )
3951         else
3952             AC_MSG_RESULT( no )
3953         fi
3954     fi
3955     if test -n "$use_ld_ok"; then
3956         dnl keep the value of LDFLAGS
3957         return 0
3958     fi
3959     LDFLAGS="$use_ld_ldflags_save"
3960     return 1
3962 USE_LD=
3963 if test "$enable_ld" != "no"; then
3964     if test "$GCC" = "yes"; then
3965         if test -n "$enable_ld"; then
3966             check_use_ld "$enable_ld" fail_if_error
3967         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3968             dnl non-debug builds default to the default linker
3969             true
3970         elif test -n "$COM_IS_CLANG"; then
3971             check_use_ld lld
3972             if test $? -ne 0; then
3973                 check_use_ld gold
3974             fi
3975         else
3976             check_use_ld gold
3977         fi
3978         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3979         rm conftest.out
3980         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3981         if test -z "$ld_used"; then
3982             ld_used="unknown"
3983         fi
3984         AC_MSG_CHECKING([for linker that is used])
3985         AC_MSG_RESULT([$ld_used])
3986         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3987             if echo "$ld_used" | grep -q "^GNU ld"; then
3988                 if test -n "$COM_IS_CLANG"; then
3989                     AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
3990                     add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
3991                 else
3992                     AC_MSG_WARN([The default GNU linker is slow, consider using the GNU gold linker.])
3993                     add_warning "The default GNU linker is slow, consider using the GNU gold linker."
3994                 fi
3995             fi
3996         fi
3997     else
3998         if test "$enable_ld" = "yes"; then
3999             AC_MSG_ERROR([--enable-ld not supported])
4000         fi
4001     fi
4003 AC_SUBST(USE_LD)
4005 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4006 if test "$GCC" = "yes"; then
4007     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4008     bsymbolic_functions_ldflags_save=$LDFLAGS
4009     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4010     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4011 #include <stdio.h>
4012         ],[
4013 printf ("hello world\n");
4014         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4015     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4016         AC_MSG_RESULT( found )
4017     else
4018         AC_MSG_RESULT( not found )
4019     fi
4020     LDFLAGS=$bsymbolic_functions_ldflags_save
4022 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4025 HAVE_GSPLIT_DWARF=
4026 if test "$enable_split_debug" != no; then
4027     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4028     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4029         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
4030         save_CFLAGS=$CFLAGS
4031         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4032         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4033         CFLAGS=$save_CFLAGS
4034         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4035             AC_MSG_RESULT([yes])
4036         else
4037             if test "$enable_split_debug" = yes; then
4038                 AC_MSG_ERROR([no])
4039             else
4040                 AC_MSG_RESULT([no])
4041             fi
4042         fi
4043     fi
4044     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4045         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4046         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4047     fi
4049 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4051 ENABLE_GDB_INDEX=
4052 if test "$enable_gdb_index" != "no"; then
4053     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4054     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4055         AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
4056         save_CFLAGS=$CFLAGS
4057         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4058         have_ggnu_pubnames=
4059         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4060         if test "$have_ggnu_pubnames" != "TRUE"; then
4061             if test "$enable_gdb_index" = "yes"; then
4062                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4063             else
4064                 AC_MSG_RESULT( no )
4065             fi
4066         else
4067             AC_MSG_RESULT( yes )
4068             AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
4069             ldflags_save=$LDFLAGS
4070             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4071             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4072 #include <stdio.h>
4073                 ],[
4074 printf ("hello world\n");
4075                 ])], ENABLE_GDB_INDEX=TRUE, [])
4076             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4077                 AC_MSG_RESULT( yes )
4078             else
4079                 if test "$enable_gdb_index" = "yes"; then
4080                     AC_MSG_ERROR( no )
4081                 else
4082                     AC_MSG_RESULT( no )
4083                 fi
4084             fi
4085             LDFLAGS=$ldflags_save
4086         fi
4087         CFLAGS=$save_CFLAGS
4088         fi
4089     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4090         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4091         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4092     fi
4094 AC_SUBST(ENABLE_GDB_INDEX)
4096 if test "$enable_sal_log" = yes; then
4097     ENABLE_SAL_LOG=TRUE
4099 AC_SUBST(ENABLE_SAL_LOG)
4101 dnl Check for enable symbols option
4102 dnl ===================================================================
4103 AC_MSG_CHECKING([whether to generate debug information])
4104 if test -z "$enable_symbols"; then
4105     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4106         enable_symbols=yes
4107     else
4108         enable_symbols=no
4109     fi
4111 if test "$enable_symbols" = yes; then
4112     ENABLE_SYMBOLS_FOR=all
4113     AC_MSG_RESULT([yes])
4114 elif test "$enable_symbols" = no; then
4115     ENABLE_SYMBOLS_FOR=
4116     AC_MSG_RESULT([no])
4117 else
4118     # Selective debuginfo.
4119     ENABLE_SYMBOLS_FOR="$enable_symbols"
4120     AC_MSG_RESULT([for "$enable_symbols"])
4122 AC_SUBST(ENABLE_SYMBOLS_FOR)
4124 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4125     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4126     AC_MSG_CHECKING([whether enough memory is available for linking])
4127     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4128     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4129     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4130         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4131     else
4132         AC_MSG_RESULT([yes])
4133     fi
4136 AC_MSG_CHECKING([whether to compile with optimization flags])
4137 if test -z "$enable_optimized"; then
4138     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4139         enable_optimized=no
4140     else
4141         enable_optimized=yes
4142     fi
4144 if test "$enable_optimized" != no; then
4145     ENABLE_OPTIMIZED=TRUE
4146     AC_MSG_RESULT([yes])
4147 else
4148     ENABLE_OPTIMIZED=
4149     AC_MSG_RESULT([no])
4151 AC_SUBST(ENABLE_OPTIMIZED)
4154 # determine CPUNAME, OS, ...
4155 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4157 case "$host_os" in
4159 aix*)
4160     COM=GCC
4161     CPUNAME=POWERPC
4162     USING_X11=TRUE
4163     OS=AIX
4164     RTL_OS=AIX
4165     RTL_ARCH=PowerPC
4166     PLATFORMID=aix_powerpc
4167     P_SEP=:
4168     ;;
4170 cygwin*)
4171     COM=MSC
4172     USING_X11=
4173     OS=WNT
4174     RTL_OS=Windows
4175     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4176         P_SEP=";"
4177     else
4178         P_SEP=:
4179     fi
4180     case "$host_cpu" in
4181     i*86|x86_64)
4182         if test "$BITNESS_OVERRIDE" = 64; then
4183             CPUNAME=X86_64
4184             RTL_ARCH=X86_64
4185             PLATFORMID=windows_x86_64
4186             WINDOWS_X64=1
4187             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4188         else
4189             CPUNAME=INTEL
4190             RTL_ARCH=x86
4191             PLATFORMID=windows_x86
4192         fi
4193         ;;
4194     *)
4195         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4196         ;;
4197     esac
4198     SCPDEFS="$SCPDEFS -D_MSC_VER"
4199     ;;
4201 darwin*)
4202     COM=GCC
4203     USING_X11=
4204     OS=MACOSX
4205     RTL_OS=MacOSX
4206     P_SEP=:
4208     case "$host_cpu" in
4209     arm)
4210         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4211         ;;
4212     arm64)
4213         OS=iOS
4214         if test "$enable_ios_simulator" = "yes"; then
4215             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4216         else
4217             CPUNAME=ARM64
4218             RTL_ARCH=ARM_EABI
4219             PLATFORMID=ios_arm64
4220         fi
4221         ;;
4222     i*86)
4223         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4224         ;;
4225     x86_64)
4226         if test "$enable_ios_simulator" = "yes"; then
4227             OS=iOS
4228         fi
4229         CPUNAME=X86_64
4230         RTL_ARCH=X86_64
4231         PLATFORMID=macosx_x86_64
4232         ;;
4233     *)
4234         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4235         ;;
4236     esac
4237     ;;
4239 dragonfly*)
4240     COM=GCC
4241     USING_X11=TRUE
4242     OS=DRAGONFLY
4243     RTL_OS=DragonFly
4244     P_SEP=:
4246     case "$host_cpu" in
4247     i*86)
4248         CPUNAME=INTEL
4249         RTL_ARCH=x86
4250         PLATFORMID=dragonfly_x86
4251         ;;
4252     x86_64)
4253         CPUNAME=X86_64
4254         RTL_ARCH=X86_64
4255         PLATFORMID=dragonfly_x86_64
4256         ;;
4257     *)
4258         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4259         ;;
4260     esac
4261     ;;
4263 freebsd*)
4264     COM=GCC
4265     USING_X11=TRUE
4266     RTL_OS=FreeBSD
4267     OS=FREEBSD
4268     P_SEP=:
4270     case "$host_cpu" in
4271     i*86)
4272         CPUNAME=INTEL
4273         RTL_ARCH=x86
4274         PLATFORMID=freebsd_x86
4275         ;;
4276     x86_64|amd64)
4277         CPUNAME=X86_64
4278         RTL_ARCH=X86_64
4279         PLATFORMID=freebsd_x86_64
4280         ;;
4281     *)
4282         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4283         ;;
4284     esac
4285     ;;
4287 haiku*)
4288     COM=GCC
4289     USING_X11=
4290     GUIBASE=haiku
4291     RTL_OS=Haiku
4292     OS=HAIKU
4293     P_SEP=:
4295     case "$host_cpu" in
4296     i*86)
4297         CPUNAME=INTEL
4298         RTL_ARCH=x86
4299         PLATFORMID=haiku_x86
4300         ;;
4301     x86_64|amd64)
4302         CPUNAME=X86_64
4303         RTL_ARCH=X86_64
4304         PLATFORMID=haiku_x86_64
4305         ;;
4306     *)
4307         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4308         ;;
4309     esac
4310     ;;
4312 kfreebsd*)
4313     COM=GCC
4314     USING_X11=TRUE
4315     OS=LINUX
4316     RTL_OS=kFreeBSD
4317     P_SEP=:
4319     case "$host_cpu" in
4321     i*86)
4322         CPUNAME=INTEL
4323         RTL_ARCH=x86
4324         PLATFORMID=kfreebsd_x86
4325         ;;
4326     x86_64)
4327         CPUNAME=X86_64
4328         RTL_ARCH=X86_64
4329         PLATFORMID=kfreebsd_x86_64
4330         ;;
4331     *)
4332         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4333         ;;
4334     esac
4335     ;;
4337 linux-gnu*)
4338     COM=GCC
4339     USING_X11=TRUE
4340     OS=LINUX
4341     RTL_OS=Linux
4342     P_SEP=:
4344     case "$host_cpu" in
4346     aarch64)
4347         CPUNAME=AARCH64
4348         PLATFORMID=linux_aarch64
4349         RTL_ARCH=AARCH64
4350         ;;
4351     alpha)
4352         CPUNAME=AXP
4353         RTL_ARCH=ALPHA
4354         PLATFORMID=linux_alpha
4355         ;;
4356     arm*)
4357         CPUNAME=ARM
4358         EPM_FLAGS="-a arm"
4359         RTL_ARCH=ARM_EABI
4360         PLATFORMID=linux_arm_eabi
4361         case "$host_cpu" in
4362         arm*-linux)
4363             RTL_ARCH=ARM_OABI
4364             PLATFORMID=linux_arm_oabi
4365             ;;
4366         esac
4367         ;;
4368     hppa)
4369         CPUNAME=HPPA
4370         RTL_ARCH=HPPA
4371         EPM_FLAGS="-a hppa"
4372         PLATFORMID=linux_hppa
4373         ;;
4374     i*86)
4375         CPUNAME=INTEL
4376         RTL_ARCH=x86
4377         PLATFORMID=linux_x86
4378         ;;
4379     ia64)
4380         CPUNAME=IA64
4381         RTL_ARCH=IA64
4382         PLATFORMID=linux_ia64
4383         ;;
4384     mips)
4385         CPUNAME=GODSON
4386         RTL_ARCH=MIPS_EB
4387         EPM_FLAGS="-a mips"
4388         PLATFORMID=linux_mips_eb
4389         ;;
4390     mips64)
4391         CPUNAME=GODSON64
4392         RTL_ARCH=MIPS64_EB
4393         EPM_FLAGS="-a mips64"
4394         PLATFORMID=linux_mips64_eb
4395         ;;
4396     mips64el)
4397         CPUNAME=GODSON64
4398         RTL_ARCH=MIPS64_EL
4399         EPM_FLAGS="-a mips64el"
4400         PLATFORMID=linux_mips64_el
4401         ;;
4402     mipsel)
4403         CPUNAME=GODSON
4404         RTL_ARCH=MIPS_EL
4405         EPM_FLAGS="-a mipsel"
4406         PLATFORMID=linux_mips_el
4407         ;;
4408     m68k)
4409         CPUNAME=M68K
4410         RTL_ARCH=M68K
4411         PLATFORMID=linux_m68k
4412         ;;
4413     powerpc)
4414         CPUNAME=POWERPC
4415         RTL_ARCH=PowerPC
4416         PLATFORMID=linux_powerpc
4417         ;;
4418     powerpc64)
4419         CPUNAME=POWERPC64
4420         RTL_ARCH=PowerPC_64
4421         PLATFORMID=linux_powerpc64
4422         ;;
4423     powerpc64le)
4424         CPUNAME=POWERPC64
4425         RTL_ARCH=PowerPC_64_LE
4426         PLATFORMID=linux_powerpc64_le
4427         ;;
4428     sparc)
4429         CPUNAME=SPARC
4430         RTL_ARCH=SPARC
4431         PLATFORMID=linux_sparc
4432         ;;
4433     sparc64)
4434         CPUNAME=SPARC64
4435         RTL_ARCH=SPARC64
4436         PLATFORMID=linux_sparc64
4437         ;;
4438     s390)
4439         CPUNAME=S390
4440         RTL_ARCH=S390
4441         PLATFORMID=linux_s390
4442         ;;
4443     s390x)
4444         CPUNAME=S390X
4445         RTL_ARCH=S390x
4446         PLATFORMID=linux_s390x
4447         ;;
4448     x86_64)
4449         CPUNAME=X86_64
4450         RTL_ARCH=X86_64
4451         PLATFORMID=linux_x86_64
4452         ;;
4453     *)
4454         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4455         ;;
4456     esac
4457     ;;
4459 linux-android*)
4460     COM=GCC
4461     USING_X11=
4462     OS=ANDROID
4463     RTL_OS=Android
4464     P_SEP=:
4466     case "$host_cpu" in
4468     arm|armel)
4469         CPUNAME=ARM
4470         RTL_ARCH=ARM_EABI
4471         PLATFORMID=android_arm_eabi
4472         ;;
4473     aarch64)
4474         CPUNAME=AARCH64
4475         RTL_ARCH=AARCH64
4476         PLATFORMID=android_aarch64
4477         ;;
4478     mips|mipsel)
4479         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4480         RTL_ARCH=MIPS_EL
4481         PLATFORMID=android_mips_el
4482         ;;
4483     i*86)
4484         CPUNAME=INTEL
4485         RTL_ARCH=x86
4486         PLATFORMID=android_x86
4487         ;;
4488     *)
4489         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4490         ;;
4491     esac
4492     ;;
4494 *netbsd*)
4495     COM=GCC
4496     USING_X11=TRUE
4497     OS=NETBSD
4498     RTL_OS=NetBSD
4499     P_SEP=:
4501     case "$host_cpu" in
4502     i*86)
4503         CPUNAME=INTEL
4504         RTL_ARCH=x86
4505         PLATFORMID=netbsd_x86
4506         ;;
4507     powerpc)
4508         CPUNAME=POWERPC
4509         RTL_ARCH=PowerPC
4510         PLATFORMID=netbsd_powerpc
4511         ;;
4512     sparc)
4513         CPUNAME=SPARC
4514         RTL_ARCH=SPARC
4515         PLATFORMID=netbsd_sparc
4516         ;;
4517     x86_64)
4518         CPUNAME=X86_64
4519         RTL_ARCH=X86_64
4520         PLATFORMID=netbsd_x86_64
4521         ;;
4522     *)
4523         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4524         ;;
4525     esac
4526     ;;
4528 openbsd*)
4529     COM=GCC
4530     USING_X11=TRUE
4531     OS=OPENBSD
4532     RTL_OS=OpenBSD
4533     P_SEP=:
4535     case "$host_cpu" in
4536     i*86)
4537         CPUNAME=INTEL
4538         RTL_ARCH=x86
4539         PLATFORMID=openbsd_x86
4540         ;;
4541     x86_64)
4542         CPUNAME=X86_64
4543         RTL_ARCH=X86_64
4544         PLATFORMID=openbsd_x86_64
4545         ;;
4546     *)
4547         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4548         ;;
4549     esac
4550     SOLARINC="$SOLARINC -I/usr/local/include"
4551     ;;
4553 solaris*)
4554     COM=GCC
4555     USING_X11=TRUE
4556     OS=SOLARIS
4557     RTL_OS=Solaris
4558     P_SEP=:
4560     case "$host_cpu" in
4561     i*86)
4562         CPUNAME=INTEL
4563         RTL_ARCH=x86
4564         PLATFORMID=solaris_x86
4565         ;;
4566     sparc)
4567         CPUNAME=SPARC
4568         RTL_ARCH=SPARC
4569         PLATFORMID=solaris_sparc
4570         ;;
4571     sparc64)
4572         CPUNAME=SPARC64
4573         RTL_ARCH=SPARC64
4574         PLATFORMID=solaris_sparc64
4575         ;;
4576     *)
4577         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4578         ;;
4579     esac
4580     SOLARINC="$SOLARINC -I/usr/local/include"
4581     ;;
4584     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4585     ;;
4586 esac
4588 if test "$with_x" = "no"; then
4589     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4592 DISABLE_GUI=""
4593 if test "$enable_gui" = "no"; then
4594     if test "$USING_X11" != TRUE; then
4595         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4596     fi
4597     USING_X11=
4598     DISABLE_GUI=TRUE
4599     AC_DEFINE(HAVE_FEATURE_UI,0)
4600     test_cairo=yes
4602 AC_SUBST(DISABLE_GUI)
4604 WORKDIR="${BUILDDIR}/workdir"
4605 INSTDIR="${BUILDDIR}/instdir"
4606 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4607 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4608 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4609 AC_SUBST(COM)
4610 AC_SUBST(CPUNAME)
4611 AC_SUBST(RTL_OS)
4612 AC_SUBST(RTL_ARCH)
4613 AC_SUBST(EPM_FLAGS)
4614 AC_SUBST(USING_X11)
4615 AC_SUBST([INSTDIR])
4616 AC_SUBST([INSTROOT])
4617 AC_SUBST([INSTROOTBASE])
4618 AC_SUBST(OS)
4619 AC_SUBST(P_SEP)
4620 AC_SUBST(WORKDIR)
4621 AC_SUBST(PLATFORMID)
4622 AC_SUBST(WINDOWS_X64)
4623 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4625 dnl ===================================================================
4626 dnl Test which package format to use
4627 dnl ===================================================================
4628 AC_MSG_CHECKING([which package format to use])
4629 if test -n "$with_package_format" -a "$with_package_format" != no; then
4630     for i in $with_package_format; do
4631         case "$i" in
4632         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4633             ;;
4634         *)
4635             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4636 aix - AIX software distribution
4637 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4638 deb - Debian software distribution
4639 pkg - Solaris software distribution
4640 rpm - RedHat software distribution
4642 LibreOffice additionally supports:
4643 archive - .tar.gz or .zip
4644 dmg - macOS .dmg
4645 installed - installation tree
4646 msi - Windows .msi
4647         ])
4648             ;;
4649         esac
4650     done
4651     # fakeroot is needed to ensure correct file ownerships/permissions
4652     # inside deb packages and tar archives created on Linux and Solaris.
4653     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4654         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4655         if test "$FAKEROOT" = "no"; then
4656             AC_MSG_ERROR(
4657                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4658         fi
4659     fi
4660     PKGFORMAT="$with_package_format"
4661     AC_MSG_RESULT([$PKGFORMAT])
4662 else
4663     PKGFORMAT=
4664     AC_MSG_RESULT([none])
4666 AC_SUBST(PKGFORMAT)
4668 dnl ===================================================================
4669 dnl Set up a different compiler to produce tools to run on the build
4670 dnl machine when doing cross-compilation
4671 dnl ===================================================================
4673 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4674 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4675 if test "$cross_compiling" = "yes"; then
4676     AC_MSG_CHECKING([for BUILD platform configuration])
4677     echo
4678     rm -rf CONF-FOR-BUILD config_build.mk
4679     mkdir CONF-FOR-BUILD
4680     # Here must be listed all files needed when running the configure script. In particular, also
4681     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4682     # keep them in the same order as there.
4683     (cd $SRC_ROOT && tar cf - \
4684         config.guess \
4685         bin/get_config_variables \
4686         solenv/bin/getcompver.awk \
4687         solenv/inc/langlist.mk \
4688         download.lst \
4689         config_host.mk.in \
4690         config_host_lang.mk.in \
4691         Makefile.in \
4692         bin/bffvalidator.sh.in \
4693         bin/odfvalidator.sh.in \
4694         bin/officeotron.sh.in \
4695         instsetoo_native/util/openoffice.lst.in \
4696         config_host/*.in \
4697         sysui/desktop/macosx/Info.plist.in) \
4698     | (cd CONF-FOR-BUILD && tar xf -)
4699     cp configure CONF-FOR-BUILD
4700     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4701     (
4702     unset COM USING_X11 OS CPUNAME
4703     unset CC CXX SYSBASE CFLAGS
4704     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4705     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4706     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4707     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4708     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4709     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4710     cd CONF-FOR-BUILD
4711     sub_conf_opts=""
4712     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4713     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4714     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4715     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4716     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4717     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4718     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4719     # Don't bother having configure look for stuff not needed for the build platform anyway
4720     ./configure \
4721         --disable-cups \
4722         --disable-gstreamer-1-0 \
4723         --disable-gstreamer-0-10 \
4724         --disable-gtk \
4725         --disable-gtk3 \
4726         --disable-pdfimport \
4727         --disable-postgresql-sdbc \
4728         --with-parallelism="$with_parallelism" \
4729         --without-doxygen \
4730         --without-java \
4731         $sub_conf_opts \
4732         --srcdir=$srcdir \
4733         2>&1 | sed -e 's/^/    /'
4734     test -f ./config_host.mk 2>/dev/null || exit
4735     cp config_host.mk ../config_build.mk
4736     cp config_host_lang.mk ../config_build_lang.mk
4737     mv config.log ../config.Build.log
4738     mkdir -p ../config_build
4739     mv config_host/*.h ../config_build
4740     . ./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
4742     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
4743         VV='$'$V
4744         VV=`eval "echo $VV"`
4745         if test -n "$VV"; then
4746             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4747             echo "$line" >>build-config
4748         fi
4749     done
4751     for V in INSTDIR INSTROOT WORKDIR; do
4752         VV='$'$V
4753         VV=`eval "echo $VV"`
4754         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4755         if test -n "$VV"; then
4756             line="${V}_FOR_BUILD='$VV'"
4757             echo "$line" >>build-config
4758         fi
4759     done
4761     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4762     echo "$line" >>build-config
4764     )
4765     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4766     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])
4767     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4768              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4770     eval `cat CONF-FOR-BUILD/build-config`
4772     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4774     rm -rf CONF-FOR-BUILD
4775 else
4776     OS_FOR_BUILD="$OS"
4777     CC_FOR_BUILD="$CC"
4778     CXX_FOR_BUILD="$CXX"
4779     INSTDIR_FOR_BUILD="$INSTDIR"
4780     INSTROOT_FOR_BUILD="$INSTROOT"
4781     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4782     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4783     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4784     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4785     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4786     WORKDIR_FOR_BUILD="$WORKDIR"
4788 AC_SUBST(OS_FOR_BUILD)
4789 AC_SUBST(INSTDIR_FOR_BUILD)
4790 AC_SUBST(INSTROOT_FOR_BUILD)
4791 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4792 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4793 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4794 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4795 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4796 AC_SUBST(WORKDIR_FOR_BUILD)
4798 dnl ===================================================================
4799 dnl Check for syslog header
4800 dnl ===================================================================
4801 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4803 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4804 dnl ===================================================================
4805 AC_MSG_CHECKING([whether to turn warnings to errors])
4806 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4807     ENABLE_WERROR="TRUE"
4808     AC_MSG_RESULT([yes])
4809 else
4810     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4811         ENABLE_WERROR="TRUE"
4812         AC_MSG_RESULT([yes])
4813     else
4814         AC_MSG_RESULT([no])
4815     fi
4817 AC_SUBST(ENABLE_WERROR)
4819 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4820 dnl ===================================================================
4821 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4822 if test -z "$enable_assert_always_abort"; then
4823    if test "$ENABLE_DEBUG" = TRUE; then
4824        enable_assert_always_abort=yes
4825    else
4826        enable_assert_always_abort=no
4827    fi
4829 if test "$enable_assert_always_abort" = "yes"; then
4830     ASSERT_ALWAYS_ABORT="TRUE"
4831     AC_MSG_RESULT([yes])
4832 else
4833     ASSERT_ALWAYS_ABORT="FALSE"
4834     AC_MSG_RESULT([no])
4836 AC_SUBST(ASSERT_ALWAYS_ABORT)
4838 # Determine whether to use ooenv for the instdir installation
4839 # ===================================================================
4840 if test $_os != "WINNT" -a $_os != "Darwin"; then
4841     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4842     if test "$enable_ooenv" = "no"; then
4843         AC_MSG_RESULT([no])
4844     else
4845         ENABLE_OOENV="TRUE"
4846         AC_MSG_RESULT([yes])
4847     fi
4849 AC_SUBST(ENABLE_OOENV)
4851 if test "$USING_X11" != TRUE; then
4852     # be sure to do not mess with unneeded stuff
4853     test_randr=no
4854     test_xrender=no
4855     test_cups=no
4856     test_dbus=no
4857     test_gtk=no
4858     build_gstreamer_1_0=no
4859     build_gstreamer_0_10=no
4860     test_kde5=no
4861     test_qt5=no
4862     test_gtk3_kde5=no
4863     enable_cairo_canvas=no
4866 if test "$OS" = "HAIKU"; then
4867     enable_cairo_canvas=yes
4868     test_kde5=yes
4871 if test "$test_kde5" = "yes"; then
4872     test_qt5=yes
4875 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4876     if test "$enable_qt5" = "no"; then
4877         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4878     else
4879         enable_qt5=yes
4880     fi
4883 dnl ===================================================================
4884 dnl check for cups support
4885 dnl ===================================================================
4886 ENABLE_CUPS=""
4888 if test "$enable_cups" = "no"; then
4889     test_cups=no
4892 AC_MSG_CHECKING([whether to enable CUPS support])
4893 if test "$test_cups" = "yes"; then
4894     ENABLE_CUPS="TRUE"
4895     AC_MSG_RESULT([yes])
4897     AC_MSG_CHECKING([whether cups support is present])
4898     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4899     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4900     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4901         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4902     fi
4904 else
4905     AC_MSG_RESULT([no])
4908 AC_SUBST(ENABLE_CUPS)
4910 # fontconfig checks
4911 if test "$test_fontconfig" = "yes"; then
4912     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4913     SYSTEM_FONTCONFIG=TRUE
4914     FilterLibs "${FONTCONFIG_LIBS}"
4915     FONTCONFIG_LIBS="${filteredlibs}"
4917 AC_SUBST(FONTCONFIG_CFLAGS)
4918 AC_SUBST(FONTCONFIG_LIBS)
4919 AC_SUBST([SYSTEM_FONTCONFIG])
4921 dnl whether to find & fetch external tarballs?
4922 dnl ===================================================================
4923 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4924    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4925        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4926    else
4927        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4928    fi
4930 if test -z "$TARFILE_LOCATION"; then
4931     if test -d "$SRC_ROOT/src" ; then
4932         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4933         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4934     fi
4935     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4936 else
4937     AbsolutePath "$TARFILE_LOCATION"
4938     PathFormat "${absolute_path}"
4939     TARFILE_LOCATION="${formatted_path}"
4941 AC_SUBST(TARFILE_LOCATION)
4943 AC_MSG_CHECKING([whether we want to fetch tarballs])
4944 if test "$enable_fetch_external" != "no"; then
4945     if test "$with_all_tarballs" = "yes"; then
4946         AC_MSG_RESULT([yes, all of them])
4947         DO_FETCH_TARBALLS="ALL"
4948     else
4949         AC_MSG_RESULT([yes, if we use them])
4950         DO_FETCH_TARBALLS="TRUE"
4951     fi
4952 else
4953     AC_MSG_RESULT([no])
4954     DO_FETCH_TARBALLS=
4956 AC_SUBST(DO_FETCH_TARBALLS)
4958 AC_MSG_CHECKING([whether to build help])
4959 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4960     BUILD_TYPE="$BUILD_TYPE HELP"
4961     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4962     case "$with_help" in
4963     "html")
4964         ENABLE_HTMLHELP=TRUE
4965         SCPDEFS="$SCPDEFS -DWITH_HELP"
4966         AC_MSG_RESULT([HTML])
4967         ;;
4968     "online")
4969         ENABLE_HTMLHELP=TRUE
4970         HELP_ONLINE=TRUE
4971         AC_MSG_RESULT([HTML])
4972         ;;
4973     yes)
4974         SCPDEFS="$SCPDEFS -DWITH_HELP"
4975         AC_MSG_RESULT([yes])
4976         ;;
4977     *)
4978         AC_MSG_ERROR([Unknown --with-help=$with_help])
4979         ;;
4980     esac
4981 else
4982     AC_MSG_RESULT([no])
4984 AC_SUBST([ENABLE_HTMLHELP])
4985 AC_SUBST([HELP_ONLINE])
4987 dnl Test whether to include MySpell dictionaries
4988 dnl ===================================================================
4989 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4990 if test "$with_myspell_dicts" = "yes"; then
4991     AC_MSG_RESULT([yes])
4992     WITH_MYSPELL_DICTS=TRUE
4993     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4994     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4995 else
4996     AC_MSG_RESULT([no])
4997     WITH_MYSPELL_DICTS=
4999 AC_SUBST(WITH_MYSPELL_DICTS)
5001 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5002 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5003     if test "$with_system_dicts" = yes; then
5004         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5005     fi
5006     with_system_dicts=no
5009 AC_MSG_CHECKING([whether to use dicts from external paths])
5010 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5011     AC_MSG_RESULT([yes])
5012     SYSTEM_DICTS=TRUE
5013     AC_MSG_CHECKING([for spelling dictionary directory])
5014     if test -n "$with_external_dict_dir"; then
5015         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5016     else
5017         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5018         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5019             DICT_SYSTEM_DIR=file:///usr/share/myspell
5020         fi
5021     fi
5022     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5023     AC_MSG_CHECKING([for hyphenation patterns directory])
5024     if test -n "$with_external_hyph_dir"; then
5025         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5026     else
5027         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5028     fi
5029     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5030     AC_MSG_CHECKING([for thesaurus directory])
5031     if test -n "$with_external_thes_dir"; then
5032         THES_SYSTEM_DIR=file://$with_external_thes_dir
5033     else
5034         THES_SYSTEM_DIR=file:///usr/share/mythes
5035     fi
5036     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5037 else
5038     AC_MSG_RESULT([no])
5039     SYSTEM_DICTS=
5041 AC_SUBST(SYSTEM_DICTS)
5042 AC_SUBST(DICT_SYSTEM_DIR)
5043 AC_SUBST(HYPH_SYSTEM_DIR)
5044 AC_SUBST(THES_SYSTEM_DIR)
5046 dnl ===================================================================
5047 dnl Precompiled headers.
5048 ENABLE_PCH=""
5049 AC_MSG_CHECKING([whether to enable pch feature])
5050 if test -z "$enable_pch"; then
5051     if test "$_os" = "WINNT"; then
5052         # Enabled by default on Windows.
5053         enable_pch=yes
5054     else
5055         enable_pch=no
5056     fi
5058 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5059     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5061 if test "$enable_pch" = "system"; then
5062     ENABLE_PCH="1"
5063     AC_MSG_RESULT([yes (system headers)])
5064 elif test "$enable_pch" = "base"; then
5065     ENABLE_PCH="2"
5066     AC_MSG_RESULT([yes (system and base headers)])
5067 elif test "$enable_pch" = "normal"; then
5068     ENABLE_PCH="3"
5069     AC_MSG_RESULT([yes (normal)])
5070 elif test "$enable_pch" = "full"; then
5071     ENABLE_PCH="4"
5072     AC_MSG_RESULT([yes (full)])
5073 elif test "$enable_pch" = "yes"; then
5074     # Pick a suitable default.
5075     if test "$GCC" = "yes"; then
5076         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5077         # while making the PCHs larger and rebuilds more likely.
5078         ENABLE_PCH="2"
5079         AC_MSG_RESULT([yes (system and base headers)])
5080     else
5081         # With MSVC the highest level makes a significant difference,
5082         # and it was the default when there used to be no PCH levels.
5083         ENABLE_PCH="4"
5084         AC_MSG_RESULT([yes (full)])
5085     fi
5086 elif test "$enable_pch" = "no"; then
5087     AC_MSG_RESULT([no])
5088 else
5089     AC_MSG_ERROR([Unknown value for --enable-pch])
5091 AC_SUBST(ENABLE_PCH)
5092 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5093 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5094     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5095     if test "$CCACHE_BIN" != "not found"; then
5096         AC_MSG_CHECKING([ccache version])
5097         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5098         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5099         AC_MSG_RESULT([$CCACHE_VERSION])
5100         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5101         if test "$CCACHE_NUMVER" -gt "030701"; then
5102             AC_MSG_RESULT([yes])
5103         else
5104             AC_MSG_RESULT([no (not newer than 3.7.1)])
5105             CCACHE_DEPEND_MODE=
5106         fi
5107     fi
5110 TAB=`printf '\t'`
5112 AC_MSG_CHECKING([the GNU Make version])
5113 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5114 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5115 if test "$_make_longver" -ge "038200"; then
5116     AC_MSG_RESULT([$GNUMAKE $_make_version])
5118 elif test "$_make_longver" -ge "038100"; then
5119     if test "$build_os" = "cygwin"; then
5120         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5121     fi
5122     AC_MSG_RESULT([$GNUMAKE $_make_version])
5124     dnl ===================================================================
5125     dnl Search all the common names for sha1sum
5126     dnl ===================================================================
5127     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5128     if test -z "$SHA1SUM"; then
5129         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5130     elif test "$SHA1SUM" = "openssl"; then
5131         SHA1SUM="openssl sha1"
5132     fi
5133     AC_MSG_CHECKING([for GNU Make bug 20033])
5134     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5135     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5136 A := \$(wildcard *.a)
5138 .PHONY: all
5139 all: \$(A:.a=.b)
5140 <TAB>@echo survived bug20033.
5142 .PHONY: setup
5143 setup:
5144 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5146 define d1
5147 @echo lala \$(1)
5148 @sleep 1
5149 endef
5151 define d2
5152 @echo tyty \$(1)
5153 @sleep 1
5154 endef
5156 %.b : %.a
5157 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5158 <TAB>\$(call d1,\$(CHECKSUM)),\
5159 <TAB>\$(call d2,\$(CHECKSUM)))
5161     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5162         no_parallelism_make="YES"
5163         AC_MSG_RESULT([yes, disable parallelism])
5164     else
5165         AC_MSG_RESULT([no, keep parallelism enabled])
5166     fi
5167     rm -rf $TESTGMAKEBUG20033
5168 else
5169     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5172 # find if gnumake support file function
5173 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5174 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5175 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5176     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5178 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5179 \$(file >test.txt,Success )
5181 .PHONY: all
5182 all:
5183 <TAB>@cat test.txt
5186 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5187 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5188     HAVE_GNUMAKE_FILE_FUNC=TRUE
5189     AC_MSG_RESULT([yes])
5190 else
5191     AC_MSG_RESULT([no])
5193 rm -rf $TESTGMAKEFILEFUNC
5194 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5195 AC_SUBST(GNUMAKE_WIN_NATIVE)
5197 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5198 STALE_MAKE=
5199 if test "$_make_ver_check" = ""; then
5200    STALE_MAKE=TRUE
5203 HAVE_LD_HASH_STYLE=FALSE
5204 WITH_LINKER_HASH_STYLE=
5205 AC_MSG_CHECKING([for --hash-style gcc linker support])
5206 if test "$GCC" = "yes"; then
5207     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5208         hash_styles="gnu sysv"
5209     elif test "$with_linker_hash_style" = "no"; then
5210         hash_styles=
5211     else
5212         hash_styles="$with_linker_hash_style"
5213     fi
5215     for hash_style in $hash_styles; do
5216         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5217         hash_style_ldflags_save=$LDFLAGS
5218         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5220         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5221             [
5222 #include <stdio.h>
5223             ],[
5224 printf ("");
5225             ])],
5226             [
5227                   HAVE_LD_HASH_STYLE=TRUE
5228                   WITH_LINKER_HASH_STYLE=$hash_style
5229             ],
5230             [HAVE_LD_HASH_STYLE=FALSE],
5231             [HAVE_LD_HASH_STYLE=FALSE])
5232         LDFLAGS=$hash_style_ldflags_save
5233     done
5235     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5236         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5237     else
5238         AC_MSG_RESULT( no )
5239     fi
5240     LDFLAGS=$hash_style_ldflags_save
5241 else
5242     AC_MSG_RESULT( no )
5244 AC_SUBST(HAVE_LD_HASH_STYLE)
5245 AC_SUBST(WITH_LINKER_HASH_STYLE)
5247 dnl ===================================================================
5248 dnl Check whether there's a Perl version available.
5249 dnl ===================================================================
5250 if test -z "$with_perl_home"; then
5251     AC_PATH_PROG(PERL, perl)
5252 else
5253     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5254     _perl_path="$with_perl_home/bin/perl"
5255     if test -x "$_perl_path"; then
5256         PERL=$_perl_path
5257     else
5258         AC_MSG_ERROR([$_perl_path not found])
5259     fi
5262 dnl ===================================================================
5263 dnl Testing for Perl version 5 or greater.
5264 dnl $] is the Perl version variable, it is returned as an integer
5265 dnl ===================================================================
5266 if test "$PERL"; then
5267     AC_MSG_CHECKING([the Perl version])
5268     ${PERL} -e "exit($]);"
5269     _perl_version=$?
5270     if test "$_perl_version" -lt 5; then
5271         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5272     fi
5273     AC_MSG_RESULT([Perl $_perl_version])
5274 else
5275     AC_MSG_ERROR([Perl not found, install Perl 5])
5278 dnl ===================================================================
5279 dnl Testing for required Perl modules
5280 dnl ===================================================================
5282 AC_MSG_CHECKING([for required Perl modules])
5283 perl_use_string="use Cwd ; use Digest::MD5"
5284 if test "$_os" = "WINNT"; then
5285     if test -n "$PKGFORMAT"; then
5286         for i in $PKGFORMAT; do
5287             case "$i" in
5288             msi)
5289                 # for getting fonts versions to use in MSI
5290                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5291                 ;;
5292             esac
5293         done
5294     fi
5296 if test "$with_system_hsqldb" = "yes"; then
5297         perl_use_string="$perl_use_string ; use Archive::Zip"
5299 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5300     AC_MSG_RESULT([all modules found])
5301 else
5302     AC_MSG_RESULT([failed to find some modules])
5303     # Find out which modules are missing.
5304     for i in $perl_use_string; do
5305         if test "$i" != "use" -a "$i" != ";"; then
5306             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5307                 missing_perl_modules="$missing_perl_modules $i"
5308             fi
5309         fi
5310     done
5311     AC_MSG_ERROR([
5312     The missing Perl modules are: $missing_perl_modules
5313     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5316 dnl ===================================================================
5317 dnl Check for pkg-config
5318 dnl ===================================================================
5319 if test "$_os" != "WINNT"; then
5320     PKG_PROG_PKG_CONFIG
5323 if test "$_os" != "WINNT"; then
5325     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5326     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5327     # explicitly. Or put /path/to/compiler in PATH yourself.
5329     # Use wrappers for LTO
5330     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5331         AC_CHECK_TOOL(AR,gcc-ar)
5332         AC_CHECK_TOOL(NM,gcc-nm)
5333         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5334     else
5335         AC_CHECK_TOOL(AR,ar)
5336         AC_CHECK_TOOL(NM,nm)
5337         AC_CHECK_TOOL(RANLIB,ranlib)
5338     fi
5339     AC_CHECK_TOOL(OBJDUMP,objdump)
5340     AC_CHECK_TOOL(READELF,readelf)
5341     AC_CHECK_TOOL(STRIP,strip)
5342     if test "$_os" = "WINNT"; then
5343         AC_CHECK_TOOL(DLLTOOL,dlltool)
5344         AC_CHECK_TOOL(WINDRES,windres)
5345     fi
5347 AC_SUBST(AR)
5348 AC_SUBST(DLLTOOL)
5349 AC_SUBST(NM)
5350 AC_SUBST(OBJDUMP)
5351 AC_SUBST(PKG_CONFIG)
5352 AC_SUBST(RANLIB)
5353 AC_SUBST(READELF)
5354 AC_SUBST(STRIP)
5355 AC_SUBST(WINDRES)
5357 dnl ===================================================================
5358 dnl pkg-config checks on macOS
5359 dnl ===================================================================
5361 if test $_os = Darwin; then
5362     AC_MSG_CHECKING([for bogus pkg-config])
5363     if test -n "$PKG_CONFIG"; then
5364         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5365             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5366         else
5367             if test "$enable_bogus_pkg_config" = "yes"; then
5368                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5369             else
5370                 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.])
5371             fi
5372         fi
5373     else
5374         AC_MSG_RESULT([no, good])
5375     fi
5378 find_csc()
5380     # Return value: $csctest
5382     unset csctest
5384     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5385     if test -n "$regvalue"; then
5386         csctest=$regvalue
5387         return
5388     fi
5391 find_al()
5393     # Return value: $altest
5395     unset altest
5397     # We need this check to detect 4.6.1 or above.
5398     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5399         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5400         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5401             altest=$regvalue
5402             return
5403         fi
5404     done
5406     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5407         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5408         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5409             altest=$regvalue
5410             return
5411         fi
5412     done
5417 find_dotnetsdk46()
5419     unset frametest
5421     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5422         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5423         if test -n "$regvalue"; then
5424             frametest=$regvalue
5425             return
5426         fi
5427     done
5430 find_winsdk_version()
5432     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5433     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5435     unset winsdktest winsdkbinsubdir winsdklibsubdir
5437     case "$1" in
5438     7.*)
5439         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5440         if test -n "$regvalue"; then
5441             winsdktest=$regvalue
5442             winsdklibsubdir=.
5443             return
5444         fi
5445         ;;
5446     8.0|8.0A)
5447         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5448         if test -n "$regvalue"; then
5449             winsdktest=$regvalue
5450             winsdklibsubdir=win8
5451             return
5452         fi
5453         ;;
5454     8.1|8.1A)
5455         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5456         if test -n "$regvalue"; then
5457             winsdktest=$regvalue
5458             winsdklibsubdir=winv6.3
5459             return
5460         fi
5461         ;;
5462     10.0)
5463         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5464         if test -n "$regvalue"; then
5465             winsdktest=$regvalue
5466             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5467             if test -n "$regvalue"; then
5468                 winsdkbinsubdir="$regvalue".0
5469                 winsdklibsubdir=$winsdkbinsubdir
5470                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5471                 # test exist the SDK path
5472                 if test -d "$tmppath"; then
5473                    # when path is convertible to a short path then path is okay
5474                    if ! cygpath -d "$tmppath"; then
5475                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5476                    fi
5477                 else
5478                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5479                 fi
5480             fi
5481             return
5482         fi
5483         ;;
5484     esac
5487 find_winsdk()
5489     # Return value: From find_winsdk_version
5491     unset winsdktest
5493     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5494         find_winsdk_version $ver
5495         if test -n "$winsdktest"; then
5496             return
5497         fi
5498     done
5501 find_msms()
5503     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5504     case "$VCVER" in
5505         150|160)
5506         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5507         ;;
5508     esac
5509     AC_MSG_CHECKING([for ${my_msm_files}])
5510     msmdir=
5511     for ver in 14.0 15.0; do
5512         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5513         if test -n "$regvalue"; then
5514             for f in ${my_msm_files}; do
5515                 if test -e "$regvalue/${f}"; then
5516                     msmdir=$regvalue
5517                     break
5518                 fi
5519             done
5520         fi
5521     done
5522     dnl Is the following fallback really necessary, or was it added in response
5523     dnl to never having started Visual Studio on a given machine, so the
5524     dnl registry keys checked above had presumably not yet been created?
5525     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5526     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5527     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5528     dnl expanding to "C:\Program Files\Common Files"), which would need
5529     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5530     dnl obtain its value from cygwin:
5531     if test -z "$msmdir"; then
5532         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5533         for f in ${my_msm_files}; do
5534             if test -e "$my_msm_dir/${f}"; then
5535                 msmdir=$my_msm_dir
5536             fi
5537         done
5538     fi
5540     dnl Starting from MSVC 15.0, merge modules are located in different directory
5541     case "$VCVER" in
5542     150|160)
5543         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5544             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5545             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5546             for f in ${my_msm_files}; do
5547                 if test -e "$my_msm_dir/${f}"; then
5548                     msmdir=$my_msm_dir
5549                     break
5550                 fi
5551             done
5552         done
5553         ;;
5554     esac
5556     if test -n "$msmdir"; then
5557         msmdir=`cygpath -m "$msmdir"`
5558         AC_MSG_RESULT([$msmdir])
5559     else
5560         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5561             AC_MSG_ERROR([not found])
5562         else
5563             AC_MSG_WARN([not found])
5564             add_warning "MSM none of ${my_msm_files} found"
5565         fi
5566     fi
5569 find_msvc_x64_dlls()
5571     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5572     case "$VCVER" in
5573     150|160)
5574         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5575             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5576             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5577                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5578                 break
5579             fi
5580             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT])
5581             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5582                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5583                 break
5584             fi
5585             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5586                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5587                 break
5588             fi
5589         done
5590         ;;
5591     esac
5592     msvcdlls="msvcp140.dll vcruntime140.dll"
5593     for dll in $msvcdlls; do
5594         if ! test -f "$msvcdllpath/$dll"; then
5595             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5596         fi
5597     done
5600 dnl =========================================
5601 dnl Check for the Windows  SDK.
5602 dnl =========================================
5603 if test "$_os" = "WINNT"; then
5604     AC_MSG_CHECKING([for Windows SDK])
5605     if test "$build_os" = "cygwin"; then
5606         find_winsdk
5607         WINDOWS_SDK_HOME=$winsdktest
5609         # normalize if found
5610         if test -n "$WINDOWS_SDK_HOME"; then
5611             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5612             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5613         fi
5615         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5616     fi
5618     if test -n "$WINDOWS_SDK_HOME"; then
5619         # Remove a possible trailing backslash
5620         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5622         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5623              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5624              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5625             have_windows_sdk_headers=yes
5626         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5627              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5628              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5629             have_windows_sdk_headers=yes
5630         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5631              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5632              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5633             have_windows_sdk_headers=yes
5634         else
5635             have_windows_sdk_headers=no
5636         fi
5638         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5639             have_windows_sdk_libs=yes
5640         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5641             have_windows_sdk_libs=yes
5642         else
5643             have_windows_sdk_libs=no
5644         fi
5646         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5647             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5648 the  Windows SDK are installed.])
5649         fi
5650     fi
5652     if test -z "$WINDOWS_SDK_HOME"; then
5653         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5654     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5655         WINDOWS_SDK_VERSION=70
5656         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5657     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5658         WINDOWS_SDK_VERSION=80
5659         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5660     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5661         WINDOWS_SDK_VERSION=81
5662         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5663     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5664         WINDOWS_SDK_VERSION=10
5665         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5666     else
5667         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5668     fi
5669     PathFormat "$WINDOWS_SDK_HOME"
5670     WINDOWS_SDK_HOME="$formatted_path"
5671     if test "$build_os" = "cygwin"; then
5672         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5673         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5674             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5675         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5676             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5677         fi
5678     fi
5680     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5681     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5682     dnl but not in v8.0), so allow this to be overridden with a
5683     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5684     dnl and configuration error if no WiLangId.vbs is found would arguably be
5685     dnl better, but I do not know under which conditions exactly it is needed by
5686     dnl msiglobal.pm:
5687     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5688         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5689         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5690             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5691         fi
5692         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5693             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5694         fi
5695         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5696             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5697         fi
5698     fi
5699     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5700         if test -n "$with_package_format" -a "$with_package_format" != no; then
5701             for i in "$with_package_format"; do
5702                 if test "$i" = "msi"; then
5703                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5704                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5705                     fi
5706                 fi
5707             done
5708         fi
5709     fi
5711 AC_SUBST(WINDOWS_SDK_HOME)
5712 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5713 AC_SUBST(WINDOWS_SDK_VERSION)
5714 AC_SUBST(WINDOWS_SDK_WILANGID)
5716 if test "$build_os" = "cygwin"; then
5717     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5718     dnl dir, it also determines that dir's path w/o an arch segment if any,
5719     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5720     AC_MSG_CHECKING([for midl.exe])
5722     find_winsdk
5723     if test -n "$winsdkbinsubdir" \
5724         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5725     then
5726         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5727         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5728     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5729         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5730         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5731     elif test -f "$winsdktest/Bin/midl.exe"; then
5732         MIDL_PATH=$winsdktest/Bin
5733         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5734     fi
5735     if test ! -f "$MIDL_PATH/midl.exe"; then
5736         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5737     else
5738         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5739     fi
5741     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5742     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5744     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5745          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5746          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5747          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5748     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5749          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5750          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5751          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5752     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5753          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5754          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5755          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5756     else
5757         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5758     fi
5760     dnl Check csc.exe
5761     AC_MSG_CHECKING([for csc.exe])
5762     find_csc
5763     if test -f "$csctest/csc.exe"; then
5764         CSC_PATH="$csctest"
5765     fi
5766     if test ! -f "$CSC_PATH/csc.exe"; then
5767         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5768     else
5769         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5770     fi
5772     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5774     dnl Check al.exe
5775     AC_MSG_CHECKING([for al.exe])
5776     find_winsdk
5777     if test -n "$winsdkbinsubdir" \
5778         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5779     then
5780         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5781     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5782         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5783     elif test -f "$winsdktest/Bin/al.exe"; then
5784         AL_PATH="$winsdktest/Bin"
5785     fi
5787     if test -z "$AL_PATH"; then
5788         find_al
5789         if test -f "$altest/bin/al.exe"; then
5790             AL_PATH="$altest/bin"
5791         elif test -f "$altest/al.exe"; then
5792             AL_PATH="$altest"
5793         fi
5794     fi
5795     if test ! -f "$AL_PATH/al.exe"; then
5796         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5797     else
5798         AC_MSG_RESULT([$AL_PATH/al.exe])
5799     fi
5801     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5803     dnl Check mscoree.lib / .NET Framework dir
5804     AC_MSG_CHECKING(.NET Framework)
5805     find_dotnetsdk46
5806     PathFormat "$frametest"
5807     frametest="$formatted_path"
5808     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5809         DOTNET_FRAMEWORK_HOME="$frametest"
5810     else
5811         find_winsdk
5812         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5813             DOTNET_FRAMEWORK_HOME="$winsdktest"
5814         fi
5815     fi
5816     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
5817         AC_MSG_ERROR([mscoree.lib not found])
5818     fi
5819     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5821     PathFormat "$MIDL_PATH"
5822     MIDL_PATH="$formatted_path"
5824     PathFormat "$AL_PATH"
5825     AL_PATH="$formatted_path"
5827     PathFormat "$DOTNET_FRAMEWORK_HOME"
5828     DOTNET_FRAMEWORK_HOME="$formatted_path"
5830     PathFormat "$CSC_PATH"
5831     CSC_PATH="$formatted_path"
5834 dnl ===================================================================
5835 dnl Check if stdc headers are available excluding MSVC.
5836 dnl ===================================================================
5837 if test "$_os" != "WINNT"; then
5838     AC_HEADER_STDC
5841 dnl ===================================================================
5842 dnl Testing for C++ compiler and version...
5843 dnl ===================================================================
5845 if test "$_os" != "WINNT"; then
5846     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5847     save_CXXFLAGS=$CXXFLAGS
5848     AC_PROG_CXX
5849     CXXFLAGS=$save_CXXFLAGS
5850 else
5851     if test -n "$CC" -a -z "$CXX"; then
5852         CXX="$CC"
5853     fi
5856 dnl check for GNU C++ compiler version
5857 if test "$GXX" = "yes"; then
5858     AC_MSG_CHECKING([the GNU C++ compiler version])
5860     _gpp_version=`$CXX -dumpversion`
5861     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5863     if test "$_gpp_majmin" -lt "401"; then
5864         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5865     else
5866         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5867     fi
5869     dnl see https://code.google.com/p/android/issues/detail?id=41770
5870     if test "$_gpp_majmin" -ge "401"; then
5871         glibcxx_threads=no
5872         AC_LANG_PUSH([C++])
5873         AC_REQUIRE_CPP
5874         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5875         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5876             #include <bits/c++config.h>]],[[
5877             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5878             && !defined(_GLIBCXX__PTHREADS) \
5879             && !defined(_GLIBCXX_HAS_GTHREADS)
5880             choke me
5881             #endif
5882         ]])],[AC_MSG_RESULT([yes])
5883         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5884         AC_LANG_POP([C++])
5885         if test $glibcxx_threads = yes; then
5886             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5887         fi
5888      fi
5890 AC_SUBST(BOOST_CXXFLAGS)
5893 # prefx CXX with ccache if needed
5895 if test "$CCACHE" != ""; then
5896     AC_MSG_CHECKING([whether $CXX is already ccached])
5897     AC_LANG_PUSH([C++])
5898     save_CXXFLAGS=$CXXFLAGS
5899     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5900     dnl an empty program will do, we're checking the compiler flags
5901     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5902                       [use_ccache=yes], [use_ccache=no])
5903     if test $use_ccache = yes; then
5904         AC_MSG_RESULT([yes])
5905     else
5906         CXX="$CCACHE $CXX"
5907         AC_MSG_RESULT([no])
5908     fi
5909     CXXFLAGS=$save_CXXFLAGS
5910     AC_LANG_POP([C++])
5913 dnl ===================================================================
5914 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5915 dnl ===================================================================
5917 if test "$_os" != "WINNT"; then
5918     AC_PROG_CXXCPP
5920     dnl Check whether there's a C pre-processor.
5921     AC_PROG_CPP
5925 dnl ===================================================================
5926 dnl Find integral type sizes and alignments
5927 dnl ===================================================================
5929 if test "$_os" != "WINNT"; then
5931 if test "$_os" == "iOS"; then
5932     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5933     ac_cv_sizeof_long=8
5934     ac_cv_sizeof_short=2
5935     ac_cv_sizeof_int=4
5936     ac_cv_sizeof_long_long=8
5937     ac_cv_sizeof_double=8
5938     ac_cv_sizeof_voidp=8
5939 else
5940     AC_CHECK_SIZEOF(long)
5941     AC_CHECK_SIZEOF(short)
5942     AC_CHECK_SIZEOF(int)
5943     AC_CHECK_SIZEOF(long long)
5944     AC_CHECK_SIZEOF(double)
5945     AC_CHECK_SIZEOF(void*)
5948     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5949     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5950     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5951     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5952     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5954     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5955     m4_pattern_allow([AC_CHECK_ALIGNOF])
5956     m4_ifdef([AC_CHECK_ALIGNOF],
5957         [
5958             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5959             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5960             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5961             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5962         ],
5963         [
5964             case "$_os-$host_cpu" in
5965             Linux-i686)
5966                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5967                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5968                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5969                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5970                 ;;
5971             Linux-x86_64)
5972                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5973                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5974                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5975                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5976                 ;;
5977             *)
5978                 if test -z "$ac_cv_alignof_short" -o \
5979                         -z "$ac_cv_alignof_int" -o \
5980                         -z "$ac_cv_alignof_long" -o \
5981                         -z "$ac_cv_alignof_double"; then
5982                    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.])
5983                 fi
5984                 ;;
5985             esac
5986         ])
5988     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5989     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5990     if test $ac_cv_sizeof_long -eq 8; then
5991         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5992     elif test $ac_cv_sizeof_double -eq 8; then
5993         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5994     else
5995         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5996     fi
5998     dnl Check for large file support
5999     AC_SYS_LARGEFILE
6000     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6001         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6002     fi
6003     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6004         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6005     fi
6006 else
6007     # Hardcode for MSVC
6008     SAL_TYPES_SIZEOFSHORT=2
6009     SAL_TYPES_SIZEOFINT=4
6010     SAL_TYPES_SIZEOFLONG=4
6011     SAL_TYPES_SIZEOFLONGLONG=8
6012     if test "$BITNESS_OVERRIDE" = ""; then
6013         SAL_TYPES_SIZEOFPOINTER=4
6014     else
6015         SAL_TYPES_SIZEOFPOINTER=8
6016     fi
6017     SAL_TYPES_ALIGNMENT2=2
6018     SAL_TYPES_ALIGNMENT4=4
6019     SAL_TYPES_ALIGNMENT8=8
6020     LFS_CFLAGS=''
6022 AC_SUBST(LFS_CFLAGS)
6024 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6025 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6026 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6027 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6028 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6029 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6030 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6031 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6033 dnl ===================================================================
6034 dnl Check whether to enable runtime optimizations
6035 dnl ===================================================================
6036 ENABLE_RUNTIME_OPTIMIZATIONS=
6037 AC_MSG_CHECKING([whether to enable runtime optimizations])
6038 if test -z "$enable_runtime_optimizations"; then
6039     for i in $CC; do
6040         case $i in
6041         -fsanitize=*)
6042             enable_runtime_optimizations=no
6043             break
6044             ;;
6045         esac
6046     done
6048 if test "$enable_runtime_optimizations" != no; then
6049     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6050     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6051     AC_MSG_RESULT([yes])
6052 else
6053     AC_MSG_RESULT([no])
6055 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6057 dnl ===================================================================
6058 dnl Check if valgrind headers are available
6059 dnl ===================================================================
6060 ENABLE_VALGRIND=
6061 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6062     prev_cppflags=$CPPFLAGS
6063     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6064     # or where does it come from?
6065     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6066     AC_CHECK_HEADER([valgrind/valgrind.h],
6067         [ENABLE_VALGRIND=TRUE])
6068     CPPFLAGS=$prev_cppflags
6070 AC_SUBST([ENABLE_VALGRIND])
6071 if test -z "$ENABLE_VALGRIND"; then
6072     if test "$with_valgrind" = yes; then
6073         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6074     fi
6075     VALGRIND_CFLAGS=
6077 AC_SUBST([VALGRIND_CFLAGS])
6080 dnl ===================================================================
6081 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6082 dnl ===================================================================
6084 # We need at least the sys/sdt.h include header.
6085 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6086 if test "$SDT_H_FOUND" = "TRUE"; then
6087     # Found sys/sdt.h header, now make sure the c++ compiler works.
6088     # Old g++ versions had problems with probes in constructors/destructors.
6089     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6090     AC_LANG_PUSH([C++])
6091     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6092     #include <sys/sdt.h>
6093     class ProbeClass
6094     {
6095     private:
6096       int& ref;
6097       const char *name;
6099     public:
6100       ProbeClass(int& v, const char *n) : ref(v), name(n)
6101       {
6102         DTRACE_PROBE2(_test_, cons, name, ref);
6103       }
6105       void method(int min)
6106       {
6107         DTRACE_PROBE3(_test_, meth, name, ref, min);
6108         ref -= min;
6109       }
6111       ~ProbeClass()
6112       {
6113         DTRACE_PROBE2(_test_, dest, name, ref);
6114       }
6115     };
6116     ]],[[
6117     int i = 64;
6118     DTRACE_PROBE1(_test_, call, i);
6119     ProbeClass inst = ProbeClass(i, "call");
6120     inst.method(24);
6121     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6122           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6123     AC_LANG_POP([C++])
6125 AC_CONFIG_HEADERS([config_host/config_probes.h])
6127 dnl ===================================================================
6128 dnl GCC features
6129 dnl ===================================================================
6130 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6131     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6132     save_CFLAGS=$CFLAGS
6133     CFLAGS="$CFLAGS -Werror -mno-avx"
6134     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6135     CFLAGS=$save_CFLAGS
6136     if test "$HAVE_GCC_AVX" = "TRUE"; then
6137         AC_MSG_RESULT([yes])
6138     else
6139         AC_MSG_RESULT([no])
6140     fi
6142     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
6143     save_CFLAGS=$CFLAGS
6144     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6145     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6146     CFLAGS=$save_CFLAGS
6147     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6148         AC_MSG_RESULT([yes])
6149     else
6150         AC_MSG_RESULT([no])
6151     fi
6153     AC_MSG_CHECKING([whether $CC supports atomic functions])
6154     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6155     int v = 0;
6156     if (__sync_add_and_fetch(&v, 1) != 1 ||
6157         __sync_sub_and_fetch(&v, 1) != 0)
6158         return 1;
6159     __sync_synchronize();
6160     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6161         v != 1)
6162         return 1;
6163     return 0;
6164 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6165     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6166         AC_MSG_RESULT([yes])
6167         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6168     else
6169         AC_MSG_RESULT([no])
6170     fi
6172     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
6173     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6174     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6175         AC_MSG_RESULT([yes])
6176         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6177     else
6178         AC_MSG_RESULT([no])
6179     fi
6181     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6182     save_CFLAGS=$CFLAGS
6183     CFLAGS="$CFLAGS -Werror"
6184     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6185             __attribute__((deprecated("test"))) void f();
6186         ])], [
6187             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6188             AC_MSG_RESULT([yes])
6189         ], [AC_MSG_RESULT([no])])
6190     CFLAGS=$save_CFLAGS
6192     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6193     AC_LANG_PUSH([C++])
6194     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6195             #include <cstddef>
6196             #include <cxxabi.h>
6197             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6198         ])], [
6199             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6200             AC_MSG_RESULT([yes])
6201         ], [AC_MSG_RESULT([no])])
6202     AC_LANG_POP([C++])
6204     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6205     AC_LANG_PUSH([C++])
6206     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6207             #include <cstddef>
6208             #include <cxxabi.h>
6209             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6210         ])], [
6211             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6212             AC_MSG_RESULT([yes])
6213         ], [AC_MSG_RESULT([no])])
6214     AC_LANG_POP([C++])
6216     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6217     AC_LANG_PUSH([C++])
6218     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6219             #include <cxxabi.h>
6220             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6221         ])], [
6222             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6223             AC_MSG_RESULT([yes])
6224         ], [AC_MSG_RESULT([no])])
6225     AC_LANG_POP([C++])
6227     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6228     AC_LANG_PUSH([C++])
6229     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6230             #include <cstddef>
6231             #include <cxxabi.h>
6232             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6233         ])], [
6234             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6235             AC_MSG_RESULT([yes])
6236         ], [AC_MSG_RESULT([no])])
6237     AC_LANG_POP([C++])
6239     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6240     AC_LANG_PUSH([C++])
6241     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6242             #include <cstddef>
6243             #include <cxxabi.h>
6244             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6245         ])], [
6246             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6247             AC_MSG_RESULT([yes])
6248         ], [AC_MSG_RESULT([no])])
6249     AC_LANG_POP([C++])
6251     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6252     AC_LANG_PUSH([C++])
6253     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6254             #include <cxxabi.h>
6255             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6256         ])], [
6257             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6258             AC_MSG_RESULT([yes])
6259         ], [AC_MSG_RESULT([no])])
6260     AC_LANG_POP([C++])
6262     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6263     AC_LANG_PUSH([C++])
6264     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6265             #include <cxxabi.h>
6266             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6267         ])], [
6268             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6269             AC_MSG_RESULT([yes])
6270         ], [AC_MSG_RESULT([no])])
6271     AC_LANG_POP([C++])
6273     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6274     AC_LANG_PUSH([C++])
6275     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6276             #include <cxxabi.h>
6277             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6278         ])], [
6279             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6280             AC_MSG_RESULT([yes])
6281         ], [AC_MSG_RESULT([no])])
6282     AC_LANG_POP([C++])
6284     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6285     AC_LANG_PUSH([C++])
6286     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6287             #include <cstddef>
6288             #include <cxxabi.h>
6289             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6290         ])], [
6291             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6292             AC_MSG_RESULT([yes])
6293         ], [AC_MSG_RESULT([no])])
6294     AC_LANG_POP([C++])
6296     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6297     AC_LANG_PUSH([C++])
6298     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6299             #include <cstddef>
6300             #include <cxxabi.h>
6301             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6302         ])], [
6303             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6304             AC_MSG_RESULT([yes])
6305         ], [AC_MSG_RESULT([no])])
6306     AC_LANG_POP([C++])
6308     dnl Available in GCC 4.9 and at least since Clang 3.4:
6309     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6310     AC_LANG_PUSH([C++])
6311     save_CXXFLAGS=$CXXFLAGS
6312     CXXFLAGS="$CXXFLAGS -Werror"
6313     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6314             struct __attribute__((warn_unused)) dummy {};
6315         ])], [
6316             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6317             AC_MSG_RESULT([yes])
6318         ], [AC_MSG_RESULT([no])])
6319     CXXFLAGS=$save_CXXFLAGS
6320 AC_LANG_POP([C++])
6323 AC_SUBST(HAVE_GCC_AVX)
6324 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6325 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6326 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6328 dnl ===================================================================
6329 dnl Identify the C++ library
6330 dnl ===================================================================
6332 AC_MSG_CHECKING([what the C++ library is])
6333 AC_LANG_PUSH([C++])
6334 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6335 #include <utility>
6336 #ifndef __GLIBCXX__
6337 foo bar
6338 #endif
6339 ]])],
6340     [CPP_LIBRARY=GLIBCXX
6341      cpp_library_name="GNU libstdc++"
6342     ],
6343     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6344 #include <utility>
6345 #ifndef _LIBCPP_VERSION
6346 foo bar
6347 #endif
6348 ]])],
6349     [CPP_LIBRARY=LIBCPP
6350      cpp_library_name="LLVM libc++"
6351      AC_DEFINE([HAVE_LIBCXX])
6352     ],
6353     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6354 #include <utility>
6355 #ifndef _MSC_VER
6356 foo bar
6357 #endif
6358 ]])],
6359     [CPP_LIBRARY=MSVCRT
6360      cpp_library_name="Microsoft"
6361     ],
6362     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6363 AC_MSG_RESULT([$cpp_library_name])
6364 AC_LANG_POP([C++])
6366 dnl ===================================================================
6367 dnl Check for gperf
6368 dnl ===================================================================
6369 AC_PATH_PROG(GPERF, gperf)
6370 if test -z "$GPERF"; then
6371     AC_MSG_ERROR([gperf not found but needed. Install it.])
6373 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6374     GPERF=`cygpath -m $GPERF`
6376 AC_MSG_CHECKING([whether gperf is new enough])
6377 my_gperf_ver1=$($GPERF --version | head -n 1)
6378 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6379 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6380 if test "$my_gperf_ver3" -ge 301; then
6381     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6382 else
6383     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6385 AC_SUBST(GPERF)
6387 dnl ===================================================================
6388 dnl Check for system libcmis
6389 dnl ===================================================================
6390 # libcmis requires curl and we can't build curl for iOS
6391 if test $_os != iOS; then
6392     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6393     ENABLE_LIBCMIS=TRUE
6394 else
6395     ENABLE_LIBCMIS=
6397 AC_SUBST(ENABLE_LIBCMIS)
6399 dnl ===================================================================
6400 dnl C++11
6401 dnl ===================================================================
6403 AC_MSG_CHECKING([whether $CXX supports C++17])
6404 CXXFLAGS_CXX11=
6405 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6406     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6407 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6408     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6409     for flag in $my_flags; do
6410         if test "$COM" = MSC; then
6411             flag="-Xclang $flag"
6412         fi
6413         save_CXXFLAGS=$CXXFLAGS
6414         CXXFLAGS="$CXXFLAGS $flag -Werror"
6415         if test "$SYSTEM_LIBCMIS" = TRUE; then
6416             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6417         fi
6418         AC_LANG_PUSH([C++])
6419         dnl Clang 3.9 supports __float128 since
6420         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6421         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6422         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6423         dnl $flag is supported below, so check this first):
6424         my_float128hack=
6425         my_float128hack_impl=-D__float128=void
6426         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6427             #include <vector>
6428             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6429             // (__float128)
6430             ]])
6431         ],,[
6432             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6433             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6434             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6435             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6436             dnl place where __float128 is used is in a template specialization, -D__float128=void
6437             dnl will avoid the problem there while still causing a problem if somebody actually uses
6438             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6439             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6440             dnl "fixed" with this hack):
6441             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6442             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6443                 #include <vector>
6444                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6445                 // (__float128)
6446                 ]])
6447             ],[my_float128hack=$my_float128hack_impl])
6448         ])
6449         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6450             #include <algorithm>
6451             #include <cmath>
6452             #include <functional>
6453             #include <vector>
6455             #if defined SYSTEM_LIBCMIS
6456             // See ucb/source/ucp/cmis/auth_provider.hxx:
6457             #if !defined __clang__
6458             #pragma GCC diagnostic push
6459             #pragma GCC diagnostic ignored "-Wdeprecated"
6460             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6461             #endif
6462             #include <libcmis/libcmis.hxx>
6463             #if !defined __clang__
6464             #pragma GCC diagnostic pop
6465             #endif
6466             #endif
6468             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6469                 std::sort(v.begin(), v.end(), fn);
6470             }
6472             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6473             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6474             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6475             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6476             // needed by sc/source/core/tool/math.cxx):
6477             int g() { return math_errhandling; }
6478             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6479         AC_LANG_POP([C++])
6480         CXXFLAGS=$save_CXXFLAGS
6481         if test -n "$CXXFLAGS_CXX11"; then
6482             break
6483         fi
6484     done
6486 if test -n "$CXXFLAGS_CXX11"; then
6487     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6488 else
6489     AC_MSG_ERROR(no)
6491 AC_SUBST(CXXFLAGS_CXX11)
6493 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6494 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6495 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6496 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6497 dnl again towards 4.7.2:
6498 if test $CPP_LIBRARY = GLIBCXX; then
6499     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6500     AC_LANG_PUSH([C++])
6501     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6502 #include <list>
6503 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6504     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6505     //   GCC 4.7.0: 20120322
6506     //   GCC 4.7.1: 20120614
6507     // and using a range check is not possible as the mapping between
6508     // __GLIBCXX__ values and GCC versions is not monotonic
6509 /* ok */
6510 #else
6511 abi broken
6512 #endif
6513         ]])], [AC_MSG_RESULT(no, ok)],
6514         [AC_MSG_ERROR(yes)])
6515     AC_LANG_POP([C++])
6518 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6519 save_CXXFLAGS=$CXXFLAGS
6520 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6521 AC_LANG_PUSH([C++])
6523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6524 #include <stddef.h>
6526 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6528 namespace
6530         struct b
6531         {
6532                 int i;
6533                 int j;
6534         };
6536 ]], [[
6537 struct a
6539         int i;
6540         int j;
6542 a thinga[]={{0,0}, {1,1}};
6543 b thingb[]={{0,0}, {1,1}};
6544 size_t i = sizeof(sal_n_array_size(thinga));
6545 size_t j = sizeof(sal_n_array_size(thingb));
6546 return !(i != 0 && j != 0);
6548     ], [ AC_MSG_RESULT(yes) ],
6549     [ AC_MSG_ERROR(no)])
6550 AC_LANG_POP([C++])
6551 CXXFLAGS=$save_CXXFLAGS
6553 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6554 AC_MSG_CHECKING([that $CXX supports C++14 constexpr])
6555 save_CXXFLAGS=$CXXFLAGS
6556 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6557 AC_LANG_PUSH([C++])
6558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6559     // A somewhat over-complicated way of checking for
6560     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6561     // in constexpr function":
6562     #include <cassert>
6563     template<typename T> inline constexpr T f(T x) { return x; }
6564     template<typename T> inline constexpr T g(T x) {
6565         assert(f(static_cast<int>(x)));
6566         return x;
6567     }
6568     enum E { e };
6569     auto v = g(E::e);
6571     struct S {
6572         int n_;
6573         constexpr bool f() {
6574             int n = n_;
6575             int i = 0;
6576             while (n > 0) { --n; ++i; }
6577             assert(i >= 0);
6578             return i == 0;
6579         }
6580     };
6581     constexpr auto v2 = S{10}.f();
6582     ]])], AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required C++14 constexpr support]))
6583 AC_LANG_POP([C++])
6584 CXXFLAGS=$save_CXXFLAGS
6586 dnl _Pragma support (may require C++11)
6587 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6588     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6589     AC_LANG_PUSH([C++])
6590     save_CXXFLAGS=$CXXFLAGS
6591     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6592     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6593             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6594         ])], [
6595             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6596             AC_MSG_RESULT([yes])
6597         ], [AC_MSG_RESULT([no])])
6598     AC_LANG_POP([C++])
6599     CXXFLAGS=$save_CXXFLAGS
6602 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6603 if test "$GCC" = yes; then
6604     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6605     AC_LANG_PUSH([C++])
6606     save_CXXFLAGS=$CXXFLAGS
6607     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6608     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6609     CXXFLAGS=$save_CXXFLAGS
6610     AC_LANG_POP([C++])
6611     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6612         AC_MSG_RESULT([yes])
6613     else
6614         AC_MSG_RESULT([no])
6615     fi
6617 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6619 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6620 AC_MSG_CHECKING([[that $CXX supports [[fallthrough]]]])
6621 AC_LANG_PUSH([C++])
6622 save_CXXFLAGS=$CXXFLAGS
6623 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6624 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6625 if test "$COM" = MSC; then
6626     CXXFLAGS="$CXXFLAGS /we5030"
6627 else
6628     CXXFLAGS="$CXXFLAGS -Werror"
6630 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6631         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6632         // by checking for __cplusplus:
6633         #if __cplusplus > 201703L
6634         #if !__has_cpp_attribute(fallthrough)
6635         #error
6636         #endif
6637         #else
6638         void f(int & x) {
6639             switch (x) {
6640             case 0:
6641                 ++x;
6642                 [[fallthrough]];
6643             default:
6644                 ++x;
6645             }
6646         }
6647         #endif
6648     ]])],
6649     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[fallthrough]] support]))
6650 CXXFLAGS=$save_CXXFLAGS
6651 AC_LANG_POP([C++])
6653 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6654 AC_MSG_CHECKING([[that $CXX supports [[nodiscard]]]])
6655 AC_LANG_PUSH([C++])
6656 save_CXXFLAGS=$CXXFLAGS
6657 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6658 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6659 if test "$COM" = MSC; then
6660     CXXFLAGS="$CXXFLAGS /we5030"
6661 else
6662     CXXFLAGS="$CXXFLAGS -Werror"
6664 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6665         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6666         // by checking for __cplusplus:
6667         #if __cplusplus > 201703L
6668         #if !__has_cpp_attribute(nodiscard)
6669         #error
6670         #endif
6671         #else
6672         [[nodiscard]] int f();
6673         #endif
6674     ]])],
6675     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[nodiscard]] support]))
6676 CXXFLAGS=$save_CXXFLAGS
6677 AC_LANG_POP([C++])
6679 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6680 AC_LANG_PUSH([C++])
6681 save_CXXFLAGS=$CXXFLAGS
6682 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6683 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6684         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6685         // supporting it:
6686         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6687         struct S {
6688         private:
6689             S(S const &);
6690         public:
6691             S();
6692             ~S();
6693         };
6694         S copy();
6695         void f() { S c(copy()); }
6696         #endif
6697     ])], [
6698         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6699         AC_MSG_RESULT([yes])
6700     ], [AC_MSG_RESULT([no])])
6701 CXXFLAGS=$save_CXXFLAGS
6702 AC_LANG_POP([C++])
6704 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6705 AC_MSG_CHECKING([that $CXX has a fix for CWG1579])
6706 AC_LANG_PUSH([C++])
6707 save_CXXFLAGS=$CXXFLAGS
6708 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6709 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6710         #include <memory>
6711         struct S1 {};
6712         struct S2: S1 {};
6713         std::unique_ptr<S1> f() {
6714             std::unique_ptr<S2> s2(new S2);
6715             return s2;
6716         }
6717     ])],
6718     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks a required fix for CWG1579]))
6719 CXXFLAGS=$save_CXXFLAGS
6720 AC_LANG_POP([C++])
6722 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6723 AC_LANG_PUSH([C++])
6724 save_CXXFLAGS=$CXXFLAGS
6725 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6726 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6727         struct S1 { S1(S1 &&); };
6728         struct S2: S1 {};
6729         S1 f(S2 s) { return s; }
6730     ])], [
6731         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6732         AC_MSG_RESULT([yes])
6733     ], [AC_MSG_RESULT([no])])
6734 CXXFLAGS=$save_CXXFLAGS
6735 AC_LANG_POP([C++])
6737 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6738 dnl uninitialized warning for code like
6740 dnl   OString f();
6741 dnl   boost::optional<OString> * g(bool b) {
6742 dnl       boost::optional<OString> o;
6743 dnl       if (b) o = f();
6744 dnl       return new boost::optional<OString>(o);
6745 dnl   }
6747 dnl (as is e.g. present, in a slightly more elaborate form, in
6748 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6749 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6750 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6751 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6752     AC_MSG_CHECKING([whether $CXX might report false -Werror=maybe-uninitialized])
6753     AC_LANG_PUSH([C++])
6754     save_CXXFLAGS=$CXXFLAGS
6755     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6756     if test "$ENABLE_OPTIMIZED" = TRUE; then
6757         CXXFLAGS="$CXXFLAGS -O2"
6758     else
6759         CXXFLAGS="$CXXFLAGS -O0"
6760     fi
6761     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6762             #include <new>
6763             void f1(int);
6764             struct S1 {
6765                 ~S1() { f1(n); }
6766                 int n = 0;
6767             };
6768             struct S2 {
6769                 S2() {}
6770                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6771                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6772                 void set(S1 s) {
6773                     new (stg) S1(s);
6774                     init = true;
6775                 }
6776                 bool init = false;
6777                 char stg[sizeof (S1)];
6778             } ;
6779             S1 f2();
6780             S2 * f3(bool b) {
6781                 S2 o;
6782                 if (b) o.set(f2());
6783                 return new S2(o);
6784             }
6785         ]])], [AC_MSG_RESULT([no])], [
6786             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6787             AC_MSG_RESULT([yes])
6788         ])
6789     CXXFLAGS=$save_CXXFLAGS
6790     AC_LANG_POP([C++])
6792 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6794 dnl ===================================================================
6795 dnl system stl sanity tests
6796 dnl ===================================================================
6797 if test "$_os" != "WINNT"; then
6799     AC_LANG_PUSH([C++])
6801     save_CPPFLAGS="$CPPFLAGS"
6802     if test -n "$MACOSX_SDK_PATH"; then
6803         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6804     fi
6806     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6807     # only.
6808     if test "$CPP_LIBRARY" = GLIBCXX; then
6809         dnl gcc#19664, gcc#22482, rhbz#162935
6810         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6811         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6812         AC_MSG_RESULT([$stlvisok])
6813         if test "$stlvisok" = "no"; then
6814             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6815         fi
6816     fi
6818     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6819     # when we don't make any dynamic libraries?
6820     if test "$DISABLE_DYNLOADING" = ""; then
6821         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6822         cat > conftestlib1.cc <<_ACEOF
6823 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6824 struct S2: S1<int> { virtual ~S2(); };
6825 S2::~S2() {}
6826 _ACEOF
6827         cat > conftestlib2.cc <<_ACEOF
6828 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6829 struct S2: S1<int> { virtual ~S2(); };
6830 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6831 _ACEOF
6832         gccvisinlineshiddenok=yes
6833         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6834             gccvisinlineshiddenok=no
6835         else
6836             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6837             dnl known to not work with -z defs (unsetting which makes the test
6838             dnl moot, though):
6839             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6840             if test "$COM_IS_CLANG" = TRUE; then
6841                 for i in $CXX $CXXFLAGS; do
6842                     case $i in
6843                     -fsanitize=*)
6844                         my_linkflagsnoundefs=
6845                         break
6846                         ;;
6847                     esac
6848                 done
6849             fi
6850             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6851                 gccvisinlineshiddenok=no
6852             fi
6853         fi
6855         rm -fr libconftest*
6856         AC_MSG_RESULT([$gccvisinlineshiddenok])
6857         if test "$gccvisinlineshiddenok" = "no"; then
6858             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6859         fi
6860     fi
6862    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6863     cat >visibility.cxx <<_ACEOF
6864 #pragma GCC visibility push(hidden)
6865 struct __attribute__ ((visibility ("default"))) TestStruct {
6866   static void Init();
6868 __attribute__ ((visibility ("default"))) void TestFunc() {
6869   TestStruct::Init();
6871 _ACEOF
6872     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6873         gccvisbroken=yes
6874     else
6875         case "$host_cpu" in
6876         i?86|x86_64)
6877             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6878                 gccvisbroken=no
6879             else
6880                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6881                     gccvisbroken=no
6882                 else
6883                     gccvisbroken=yes
6884                 fi
6885             fi
6886             ;;
6887         *)
6888             gccvisbroken=no
6889             ;;
6890         esac
6891     fi
6892     rm -f visibility.s visibility.cxx
6894     AC_MSG_RESULT([$gccvisbroken])
6895     if test "$gccvisbroken" = "yes"; then
6896         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6897     fi
6899     CPPFLAGS="$save_CPPFLAGS"
6901     AC_LANG_POP([C++])
6904 dnl ===================================================================
6905 dnl  Clang++ tests
6906 dnl ===================================================================
6908 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6909 if test "$GCC" = "yes"; then
6910     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6911     AC_LANG_PUSH([C++])
6912     save_CXXFLAGS=$CXXFLAGS
6913     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6914     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6915     CXXFLAGS=$save_CXXFLAGS
6916     AC_LANG_POP([C++])
6917     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6918         AC_MSG_RESULT([yes])
6919     else
6920         AC_MSG_RESULT([no])
6921     fi
6923 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6925 dnl ===================================================================
6926 dnl Compiler plugins
6927 dnl ===================================================================
6929 COMPILER_PLUGINS=
6930 # currently only Clang
6932 if test "$COM_IS_CLANG" != "TRUE"; then
6933     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6934         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6935         enable_compiler_plugins=no
6936     fi
6939 if test "$COM_IS_CLANG" = "TRUE"; then
6940     if test -n "$enable_compiler_plugins"; then
6941         compiler_plugins="$enable_compiler_plugins"
6942     elif test -n "$ENABLE_DBGUTIL"; then
6943         compiler_plugins=test
6944     else
6945         compiler_plugins=no
6946     fi
6947     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 50002; then
6948         if test "$compiler_plugins" = yes; then
6949             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6950         else
6951             compiler_plugins=no
6952         fi
6953     fi
6954     if test "$compiler_plugins" != "no"; then
6955         dnl The prefix where Clang resides, override to where Clang resides if
6956         dnl using a source build:
6957         if test -z "$CLANGDIR"; then
6958             CLANGDIR=/usr
6959         fi
6960         AC_LANG_PUSH([C++])
6961         save_CPPFLAGS=$CPPFLAGS
6962         save_CXX=$CXX
6963         save_CXXCPP=$CXXCPP
6964         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6965         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6966         CXX=$COMPILER_PLUGINS_CXX
6967         CXXCPP="$COMPILER_PLUGINS_CXX -E"
6968         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6969         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6970             [COMPILER_PLUGINS=TRUE],
6971             [
6972             if test "$compiler_plugins" = "yes"; then
6973                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6974             else
6975                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6976                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6977             fi
6978             ])
6979         CXX=$save_CXX
6980         CXXCPP=$save_CXXCPP
6981         CPPFLAGS=$save_CPPFLAGS
6982         AC_LANG_POP([C++])
6983     fi
6984 else
6985     if test "$enable_compiler_plugins" = "yes"; then
6986         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6987     fi
6989 AC_SUBST(COMPILER_PLUGINS)
6990 AC_SUBST(COMPILER_PLUGINS_CXX)
6991 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6992 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6993 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
6994 AC_SUBST(CLANGDIR)
6995 AC_SUBST(CLANGLIBDIR)
6997 # Plugin to help linker.
6998 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6999 # This makes --enable-lto build with clang work.
7000 AC_SUBST(LD_PLUGIN)
7002 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7003 AC_SUBST(HAVE_POSIX_FALLOCATE)
7005 dnl ===================================================================
7006 dnl Custom build version
7007 dnl ===================================================================
7009 AC_MSG_CHECKING([whether to add custom build version])
7010 if test "$with_build_version" != ""; then
7011     BUILD_VER_STRING=$with_build_version
7012     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7013 else
7014     BUILD_VER_STRING=
7015     AC_MSG_RESULT([no])
7017 AC_SUBST(BUILD_VER_STRING)
7019 JITC_PROCESSOR_TYPE=""
7020 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7021     # IBMs JDK needs this...
7022     JITC_PROCESSOR_TYPE=6
7023     export JITC_PROCESSOR_TYPE
7025 AC_SUBST([JITC_PROCESSOR_TYPE])
7027 # Misc Windows Stuff
7028 AC_ARG_WITH(ucrt-dir,
7029     AS_HELP_STRING([--with-ucrt-dir],
7030         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7031         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7032         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7033             Windows6.1-KB2999226-x64.msu
7034             Windows6.1-KB2999226-x86.msu
7035             Windows8.1-KB2999226-x64.msu
7036             Windows8.1-KB2999226-x86.msu
7037             Windows8-RT-KB2999226-x64.msu
7038             Windows8-RT-KB2999226-x86.msu
7039         A zip archive including those files is available from Microsoft site:
7040         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7042 UCRT_REDISTDIR="$with_ucrt_dir"
7043 if test $_os = "WINNT"; then
7044     find_msvc_x64_dlls
7045     find_msms
7046     MSVC_DLL_PATH="$msvcdllpath"
7047     MSVC_DLLS="$msvcdlls"
7048     MSM_PATH="$msmdir"
7049     # MSVC 15.3 changed it to VC141
7050     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
7051         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7052     else
7053         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7054     fi
7055     if test "$UCRT_REDISTDIR" = "no"; then
7056         dnl explicitly disabled
7057         UCRT_REDISTDIR=""
7058     else
7059         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7060                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7061                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7062                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7063                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7064                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7065             UCRT_REDISTDIR=""
7066             if test -n "$PKGFORMAT"; then
7067                for i in $PKGFORMAT; do
7068                    case "$i" in
7069                    msi)
7070                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7071                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7072                        ;;
7073                    esac
7074                done
7075             fi
7076         fi
7077     fi
7080 AC_SUBST(UCRT_REDISTDIR)
7081 AC_SUBST(MSVC_DLL_PATH)
7082 AC_SUBST(MSVC_DLLS)
7083 AC_SUBST(MSM_PATH)
7085 dnl ===================================================================
7086 dnl Checks for Java
7087 dnl ===================================================================
7088 if test "$ENABLE_JAVA" != ""; then
7090     # Windows-specific tests
7091     if test "$build_os" = "cygwin"; then
7092         if test "$BITNESS_OVERRIDE" = 64; then
7093             bitness=64
7094         else
7095             bitness=32
7096         fi
7098         if test -z "$with_jdk_home"; then
7099             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7100             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7101             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7102             if test -n "$regvalue"; then
7103                 ver=$regvalue
7104                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7105                 _jdk_home=$regvalue
7106             fi
7107             if test -z "$with_jdk_home"; then
7108                 for ver in 1.8 1.7 1.6; do
7109                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7110                     if test -n "$regvalue"; then
7111                         _jdk_home=$regvalue
7112                         break
7113                     fi
7114                 done
7115             fi
7116             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7117                 with_jdk_home="$_jdk_home"
7118                 howfound="found automatically"
7119             else
7120                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7121             fi
7122         else
7123             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7124             howfound="you passed"
7125         fi
7126     fi
7128     # 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.
7129     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7130     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7131         with_jdk_home=`/usr/libexec/java_home`
7132     fi
7134     JAVA_HOME=; export JAVA_HOME
7135     if test -z "$with_jdk_home"; then
7136         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7137     else
7138         _java_path="$with_jdk_home/bin/$with_java"
7139         dnl Check if there is a Java interpreter at all.
7140         if test -x "$_java_path"; then
7141             JAVAINTERPRETER=$_java_path
7142         else
7143             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7144         fi
7145     fi
7147     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7148     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7149     dnl loaded by java to run JunitTests:
7150     if test "$build_os" = "cygwin"; then
7151         shortjdkhome=`cygpath -d "$with_jdk_home"`
7152         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
7153             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7154             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7155         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
7156             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7157             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7158         fi
7160         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7161             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7162         fi
7163         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7164     elif test "$cross_compiling" != "yes"; then
7165         case $CPUNAME in
7166             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7167                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7168                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7169                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7170                 fi
7171                 ;;
7172             *) # assumption: everything else 32-bit
7173                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7174                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7175                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7176                 fi
7177                 ;;
7178         esac
7179     fi
7182 dnl ===================================================================
7183 dnl Checks for JDK.
7184 dnl ===================================================================
7186 # Note that JAVA_HOME as for now always means the *build* platform's
7187 # JAVA_HOME. Whether all the complexity here actually is needed any
7188 # more or not, no idea.
7190 if test "$ENABLE_JAVA" != ""; then
7191     _gij_longver=0
7192     AC_MSG_CHECKING([the installed JDK])
7193     if test -n "$JAVAINTERPRETER"; then
7194         dnl java -version sends output to stderr!
7195         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7196             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7197         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7198             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7199         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7200             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7201         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7202             JDK=ibm
7204             dnl IBM JDK specific tests
7205             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7206             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7208             if test "$_jdk_ver" -lt 10600; then
7209                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
7210             fi
7212             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
7214             if test "$with_jdk_home" = ""; then
7215                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7216 you must use the "--with-jdk-home" configure option explicitly])
7217             fi
7219             JAVA_HOME=$with_jdk_home
7220         else
7221             JDK=sun
7223             dnl Sun JDK specific tests
7224             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7225             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7227             if test "$_jdk_ver" -lt 10600; then
7228                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
7229             fi
7230             if test "$_jdk_ver" -gt 10600; then
7231                 JAVA_CLASSPATH_NOT_SET=TRUE
7232             fi
7234             AC_MSG_RESULT([checked (JDK $_jdk)])
7235             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7236             if test "$_os" = "WINNT"; then
7237                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7238             fi
7240             # set to limit VM usage for JunitTests
7241             JAVAIFLAGS=-Xmx64M
7242             # set to limit VM usage for javac
7243             JAVAFLAGS=-J-Xmx128M
7244         fi
7245     else
7246         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7247     fi
7248 else
7249     dnl Java disabled
7250     JAVA_HOME=
7251     export JAVA_HOME
7254 dnl ===================================================================
7255 dnl Checks for javac
7256 dnl ===================================================================
7257 if test "$ENABLE_JAVA" != ""; then
7258     javacompiler="javac"
7259     : ${JAVA_SOURCE_VER=1.6}
7260     : ${JAVA_TARGET_VER=1.6}
7261     if test -z "$with_jdk_home"; then
7262         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7263     else
7264         _javac_path="$with_jdk_home/bin/$javacompiler"
7265         dnl Check if there is a Java compiler at all.
7266         if test -x "$_javac_path"; then
7267             JAVACOMPILER=$_javac_path
7268         fi
7269     fi
7270     if test -z "$JAVACOMPILER"; then
7271         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7272     fi
7273     if test "$build_os" = "cygwin"; then
7274         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7275             JAVACOMPILER="${JAVACOMPILER}.exe"
7276         fi
7277         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7278     fi
7281 dnl ===================================================================
7282 dnl Checks for javadoc
7283 dnl ===================================================================
7284 if test "$ENABLE_JAVA" != ""; then
7285     if test -z "$with_jdk_home"; then
7286         AC_PATH_PROG(JAVADOC, javadoc)
7287     else
7288         _javadoc_path="$with_jdk_home/bin/javadoc"
7289         dnl Check if there is a javadoc at all.
7290         if test -x "$_javadoc_path"; then
7291             JAVADOC=$_javadoc_path
7292         else
7293             AC_PATH_PROG(JAVADOC, javadoc)
7294         fi
7295     fi
7296     if test -z "$JAVADOC"; then
7297         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7298     fi
7299     if test "$build_os" = "cygwin"; then
7300         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7301             JAVADOC="${JAVADOC}.exe"
7302         fi
7303         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7304     fi
7306     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7307     JAVADOCISGJDOC="yes"
7308     fi
7310 AC_SUBST(JAVADOCISGJDOC)
7312 if test "$ENABLE_JAVA" != ""; then
7313     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7314     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7315         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7316            # try to recover first by looking whether we have an alternative
7317            # system as in Debian or newer SuSEs where following /usr/bin/javac
7318            # over /etc/alternatives/javac leads to the right bindir where we
7319            # just need to strip a bit away to get a valid JAVA_HOME
7320            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7321         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7322             # maybe only one level of symlink (e.g. on Mac)
7323             JAVA_HOME=$(readlink $JAVACOMPILER)
7324             if test "$(dirname $JAVA_HOME)" = "."; then
7325                 # we've got no path to trim back
7326                 JAVA_HOME=""
7327             fi
7328         else
7329             # else warn
7330             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7331             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7332             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7333             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7334         fi
7335         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7336         if test "$JAVA_HOME" != "/usr"; then
7337             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7338                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7339                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7340                 dnl Tiger already returns a JDK path..
7341                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7342             else
7343                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7344                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7345                 dnl that checks which version to run
7346                 if test -f "$JAVA_HOME"; then
7347                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7348                 fi
7349             fi
7350         fi
7351     fi
7352     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7354     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7355     if test -z "$JAVA_HOME"; then
7356         if test "x$with_jdk_home" = "x"; then
7357             cat > findhome.java <<_ACEOF
7358 [import java.io.File;
7360 class findhome
7362     public static void main(String args[])
7363     {
7364         String jrelocation = System.getProperty("java.home");
7365         File jre = new File(jrelocation);
7366         System.out.println(jre.getParent());
7367     }
7369 _ACEOF
7370             AC_MSG_CHECKING([if javac works])
7371             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7372             AC_TRY_EVAL(javac_cmd)
7373             if test $? = 0 -a -f ./findhome.class; then
7374                 AC_MSG_RESULT([javac works])
7375             else
7376                 echo "configure: javac test failed" >&5
7377                 cat findhome.java >&5
7378                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7379             fi
7380             AC_MSG_CHECKING([if gij knows its java.home])
7381             JAVA_HOME=`$JAVAINTERPRETER findhome`
7382             if test $? = 0 -a "$JAVA_HOME" != ""; then
7383                 AC_MSG_RESULT([$JAVA_HOME])
7384             else
7385                 echo "configure: java test failed" >&5
7386                 cat findhome.java >&5
7387                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7388             fi
7389             # clean-up after ourselves
7390             rm -f ./findhome.java ./findhome.class
7391         else
7392             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7393         fi
7394     fi
7396     # now check if $JAVA_HOME is really valid
7397     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7398         case "${JAVA_HOME}" in
7399             /Library/Java/JavaVirtualMachines/*)
7400                 ;;
7401             *)
7402                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7403                 ;;
7404         esac
7405         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7406             JAVA_HOME_OK="NO"
7407         fi
7408     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7409         JAVA_HOME_OK="NO"
7410     fi
7411     if test "$JAVA_HOME_OK" = "NO"; then
7412         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7413         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7414         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7415         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7416         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7417         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7418     fi
7419     PathFormat "$JAVA_HOME"
7420     JAVA_HOME="$formatted_path"
7423 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7424     "$_os" != Darwin
7425 then
7426     AC_MSG_CHECKING([for JAWT lib])
7427     if test "$_os" = WINNT; then
7428         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7429         JAWTLIB=jawt.lib
7430     else
7431         case "$host_cpu" in
7432         arm*)
7433             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7434             JAVA_ARCH=$my_java_arch
7435             ;;
7436         i*86)
7437             my_java_arch=i386
7438             ;;
7439         m68k)
7440             my_java_arch=m68k
7441             ;;
7442         powerpc)
7443             my_java_arch=ppc
7444             ;;
7445         powerpc64)
7446             my_java_arch=ppc64
7447             ;;
7448         powerpc64le)
7449             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7450             JAVA_ARCH=$my_java_arch
7451             ;;
7452         sparc64)
7453             my_java_arch=sparcv9
7454             ;;
7455         x86_64)
7456             my_java_arch=amd64
7457             ;;
7458         *)
7459             my_java_arch=$host_cpu
7460             ;;
7461         esac
7462         # This is where JDK9 puts the library
7463         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7464             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7465         else
7466             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7467         fi
7468         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7469     fi
7470     AC_MSG_RESULT([$JAWTLIB])
7472 AC_SUBST(JAWTLIB)
7474 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7475     case "$host_os" in
7477     aix*)
7478         JAVAINC="-I$JAVA_HOME/include"
7479         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7480         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7481         ;;
7483     cygwin*)
7484         JAVAINC="-I$JAVA_HOME/include/win32"
7485         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7486         ;;
7488     darwin*)
7489         if test -d "$JAVA_HOME/include/darwin"; then
7490             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7491         else
7492             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7493         fi
7494         ;;
7496     dragonfly*)
7497         JAVAINC="-I$JAVA_HOME/include"
7498         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7499         ;;
7501     freebsd*)
7502         JAVAINC="-I$JAVA_HOME/include"
7503         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7504         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7505         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7506         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7507         ;;
7509     k*bsd*-gnu*)
7510         JAVAINC="-I$JAVA_HOME/include"
7511         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7512         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7513         ;;
7515     linux-gnu*)
7516         JAVAINC="-I$JAVA_HOME/include"
7517         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7518         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7519         ;;
7521     *netbsd*)
7522         JAVAINC="-I$JAVA_HOME/include"
7523         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7524         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7525        ;;
7527     openbsd*)
7528         JAVAINC="-I$JAVA_HOME/include"
7529         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7530         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7531         ;;
7533     solaris*)
7534         JAVAINC="-I$JAVA_HOME/include"
7535         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7536         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7537         ;;
7538     esac
7540 SOLARINC="$SOLARINC $JAVAINC"
7542 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7543     url_check_unknown=0
7544     java_base="testurlcheck"
7545     java_src="${java_base}.java"
7546     java_cls="${java_base}.class"
7547     cat > "${java_src}" <<_ACEOF
7548 [import jdk.internal.loader.URLClassPath;
7549 import java.lang.reflect.Field;
7550 import java.net.URL;
7552 class ${java_base}
7554     public static void main(String args[])
7555     {
7556         try {
7557             URLClassPath cp = new URLClassPath(new URL[0], null);
7558             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7559             field.setAccessible(true);
7560             System.out.println(field.get(cp).toString());
7561         } catch(Exception e) {
7562             System.out.println("unknown");
7563         }
7564     }
7566 _ACEOF
7567     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7568     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7569     AC_TRY_EVAL(java_cmd)
7570     if test $? = 0 -a -f "./${java_cls}"; then
7571         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7572         if test $? = 0; then
7573             case "${java_res}" in
7574             true) AC_MSG_RESULT([yes]) ;;
7575             false)
7576                 rm -f "./${java_src}" "./${java_cls}"
7577                 AC_MSG_ERROR([no - Java unit tests will break!])
7578                 ;;
7579             *) url_check_unknown=1 ;;
7580             esac
7581         else
7582             url_check_unknown=1
7583         fi
7584     else
7585         url_check_unknown=1
7586     fi
7587     if test $url_check_unknown -eq 1; then
7588         AC_MSG_RESULT([unknown - assuming yes])
7589         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7590     fi
7591     rm -f "./${java_src}" "./${java_cls}"
7594 AC_SUBST(JAVACOMPILER)
7595 AC_SUBST(JAVADOC)
7596 AC_SUBST(JAVAINTERPRETER)
7597 AC_SUBST(JAVAIFLAGS)
7598 AC_SUBST(JAVAFLAGS)
7599 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7600 AC_SUBST(JAVA_HOME)
7601 AC_SUBST(JAVA_SOURCE_VER)
7602 AC_SUBST(JAVA_TARGET_VER)
7603 AC_SUBST(JDK)
7606 dnl ===================================================================
7607 dnl Export file validation
7608 dnl ===================================================================
7609 AC_MSG_CHECKING([whether to enable export file validation])
7610 if test "$with_export_validation" != "no"; then
7611     if test -z "$ENABLE_JAVA"; then
7612         if test "$with_export_validation" = "yes"; then
7613             AC_MSG_ERROR([requested, but Java is disabled])
7614         else
7615             AC_MSG_RESULT([no, as Java is disabled])
7616         fi
7617     elif test "$_jdk_ver" -lt 10800; then
7618         if test "$with_export_validation" = "yes"; then
7619             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7620         else
7621             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7622         fi
7623     else
7624         AC_MSG_RESULT([yes])
7625         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7627         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7628         if test -z "$ODFVALIDATOR"; then
7629             # remember to download the ODF toolkit with validator later
7630             AC_MSG_NOTICE([no odfvalidator found, will download it])
7631             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7632             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7634             # and fetch name of odfvalidator jar name from download.lst
7635             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7636             AC_SUBST(ODFVALIDATOR_JAR)
7638             if test -z "$ODFVALIDATOR_JAR"; then
7639                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7640             fi
7641         fi
7642         if test "$build_os" = "cygwin"; then
7643             # In case of Cygwin it will be executed from Windows,
7644             # so we need to run bash and absolute path to validator
7645             # so instead of "odfvalidator" it will be
7646             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7647             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7648         else
7649             ODFVALIDATOR="sh $ODFVALIDATOR"
7650         fi
7651         AC_SUBST(ODFVALIDATOR)
7654         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7655         if test -z "$OFFICEOTRON"; then
7656             # remember to download the officeotron with validator later
7657             AC_MSG_NOTICE([no officeotron found, will download it])
7658             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7659             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7661             # and fetch name of officeotron jar name from download.lst
7662             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7663             AC_SUBST(OFFICEOTRON_JAR)
7665             if test -z "$OFFICEOTRON_JAR"; then
7666                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7667             fi
7668         else
7669             # check version of existing officeotron
7670             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7671             if test 0"$OFFICEOTRON_VER" -lt 704; then
7672                 AC_MSG_ERROR([officeotron too old])
7673             fi
7674         fi
7675         if test "$build_os" = "cygwin"; then
7676             # In case of Cygwin it will be executed from Windows,
7677             # so we need to run bash and absolute path to validator
7678             # so instead of "odfvalidator" it will be
7679             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7680             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7681         else
7682             OFFICEOTRON="sh $OFFICEOTRON"
7683         fi
7684     fi
7685     AC_SUBST(OFFICEOTRON)
7686 else
7687     AC_MSG_RESULT([no])
7690 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7691 if test "$with_bffvalidator" != "no"; then
7692     AC_DEFINE(HAVE_BFFVALIDATOR)
7694     if test "$with_export_validation" = "no"; then
7695         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7696     fi
7698     if test "$with_bffvalidator" = "yes"; then
7699         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7700     else
7701         BFFVALIDATOR="$with_bffvalidator"
7702     fi
7704     if test "$build_os" = "cygwin"; then
7705         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7706             AC_MSG_RESULT($BFFVALIDATOR)
7707         else
7708             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7709         fi
7710     elif test -n "$BFFVALIDATOR"; then
7711         # We are not in Cygwin but need to run Windows binary with wine
7712         AC_PATH_PROGS(WINE, wine)
7714         # so swap in a shell wrapper that converts paths transparently
7715         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7716         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7717         AC_SUBST(BFFVALIDATOR_EXE)
7718         AC_MSG_RESULT($BFFVALIDATOR)
7719     else
7720         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7721     fi
7722     AC_SUBST(BFFVALIDATOR)
7723 else
7724     AC_MSG_RESULT([no])
7727 dnl ===================================================================
7728 dnl Check for C preprocessor to use
7729 dnl ===================================================================
7730 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7731 if test -n "$with_idlc_cpp"; then
7732     AC_MSG_RESULT([$with_idlc_cpp])
7733     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7734 else
7735     AC_MSG_RESULT([ucpp])
7736     AC_MSG_CHECKING([which ucpp tp use])
7737     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7738         AC_MSG_RESULT([external])
7739         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7740     else
7741         AC_MSG_RESULT([internal])
7742         BUILD_TYPE="$BUILD_TYPE UCPP"
7743     fi
7745 AC_SUBST(SYSTEM_UCPP)
7747 dnl ===================================================================
7748 dnl Check for epm (not needed for Windows)
7749 dnl ===================================================================
7750 AC_MSG_CHECKING([whether to enable EPM for packing])
7751 if test "$enable_epm" = "yes"; then
7752     AC_MSG_RESULT([yes])
7753     if test "$_os" != "WINNT"; then
7754         if test $_os = Darwin; then
7755             EPM=internal
7756         elif test -n "$with_epm"; then
7757             EPM=$with_epm
7758         else
7759             AC_PATH_PROG(EPM, epm, no)
7760         fi
7761         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7762             AC_MSG_NOTICE([EPM will be built.])
7763             BUILD_TYPE="$BUILD_TYPE EPM"
7764             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7765         else
7766             # Gentoo has some epm which is something different...
7767             AC_MSG_CHECKING([whether the found epm is the right epm])
7768             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7769                 AC_MSG_RESULT([yes])
7770             else
7771                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7772             fi
7773             AC_MSG_CHECKING([epm version])
7774             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7775             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7776                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7777                 AC_MSG_RESULT([OK, >= 3.7])
7778             else
7779                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7780                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7781             fi
7782         fi
7783     fi
7785     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7786         AC_MSG_CHECKING([for rpm])
7787         for a in "$RPM" rpmbuild rpm; do
7788             $a --usage >/dev/null 2> /dev/null
7789             if test $? -eq 0; then
7790                 RPM=$a
7791                 break
7792             else
7793                 $a --version >/dev/null 2> /dev/null
7794                 if test $? -eq 0; then
7795                     RPM=$a
7796                     break
7797                 fi
7798             fi
7799         done
7800         if test -z "$RPM"; then
7801             AC_MSG_ERROR([not found])
7802         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7803             RPM_PATH=`which $RPM`
7804             AC_MSG_RESULT([$RPM_PATH])
7805             SCPDEFS="$SCPDEFS -DWITH_RPM"
7806         else
7807             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7808         fi
7809     fi
7810     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7811         AC_PATH_PROG(DPKG, dpkg, no)
7812         if test "$DPKG" = "no"; then
7813             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7814         fi
7815     fi
7816     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7817        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7818         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7819             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7820                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7821                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7822                     AC_MSG_RESULT([yes])
7823                 else
7824                     AC_MSG_RESULT([no])
7825                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7826                         _pt="rpm"
7827                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7828                         add_warning "the rpms will need to be installed with --nodeps"
7829                     else
7830                         _pt="pkg"
7831                     fi
7832                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7833                     add_warning "the ${_pt}s will not be relocatable"
7834                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7835                                  relocation will work, you need to patch your epm with the
7836                                  patch in epm/epm-3.7.patch or build with
7837                                  --with-epm=internal which will build a suitable epm])
7838                 fi
7839             fi
7840         fi
7841     fi
7842     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7843         AC_PATH_PROG(PKGMK, pkgmk, no)
7844         if test "$PKGMK" = "no"; then
7845             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7846         fi
7847     fi
7848     AC_SUBST(RPM)
7849     AC_SUBST(DPKG)
7850     AC_SUBST(PKGMK)
7851 else
7852     for i in $PKGFORMAT; do
7853         case "$i" in
7854         aix | bsd | deb | pkg | rpm | native | portable)
7855             AC_MSG_ERROR(
7856                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7857             ;;
7858         esac
7859     done
7860     AC_MSG_RESULT([no])
7861     EPM=NO
7863 AC_SUBST(EPM)
7865 ENABLE_LWP=
7866 if test "$enable_lotuswordpro" = "yes"; then
7867     ENABLE_LWP="TRUE"
7869 AC_SUBST(ENABLE_LWP)
7871 dnl ===================================================================
7872 dnl Check for building ODK
7873 dnl ===================================================================
7874 if test "$enable_odk" = no; then
7875     unset DOXYGEN
7876 else
7877     if test "$with_doxygen" = no; then
7878         AC_MSG_CHECKING([for doxygen])
7879         unset DOXYGEN
7880         AC_MSG_RESULT([no])
7881     else
7882         if test "$with_doxygen" = yes; then
7883             AC_PATH_PROG([DOXYGEN], [doxygen])
7884             if test -z "$DOXYGEN"; then
7885                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7886             fi
7887             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7888                 if ! dot -V 2>/dev/null; then
7889                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7890                 fi
7891             fi
7892         else
7893             AC_MSG_CHECKING([for doxygen])
7894             DOXYGEN=$with_doxygen
7895             AC_MSG_RESULT([$DOXYGEN])
7896         fi
7897         if test -n "$DOXYGEN"; then
7898             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7899             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7900             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7901                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7902             fi
7903         fi
7904     fi
7906 AC_SUBST([DOXYGEN])
7908 AC_MSG_CHECKING([whether to build the ODK])
7909 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7910     AC_MSG_RESULT([yes])
7912     if test "$with_java" != "no"; then
7913         AC_MSG_CHECKING([whether to build unowinreg.dll])
7914         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7915             # build on Win by default
7916             enable_build_unowinreg=yes
7917         fi
7918         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7919             AC_MSG_RESULT([no])
7920             BUILD_UNOWINREG=
7921         else
7922             AC_MSG_RESULT([yes])
7923             BUILD_UNOWINREG=TRUE
7924         fi
7925         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7926             if test -z "$with_mingw_cross_compiler"; then
7927                 dnl Guess...
7928                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7929             elif test -x "$with_mingw_cross_compiler"; then
7930                  MINGWCXX="$with_mingw_cross_compiler"
7931             else
7932                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7933             fi
7935             if test "$MINGWCXX" = "false"; then
7936                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7937             fi
7939             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7940             if test -x "$mingwstrip_test"; then
7941                 MINGWSTRIP="$mingwstrip_test"
7942             else
7943                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7944             fi
7946             if test "$MINGWSTRIP" = "false"; then
7947                 AC_MSG_ERROR(MinGW32 binutils not found.)
7948             fi
7949         fi
7950     fi
7951     BUILD_TYPE="$BUILD_TYPE ODK"
7952 else
7953     AC_MSG_RESULT([no])
7954     BUILD_UNOWINREG=
7956 AC_SUBST(BUILD_UNOWINREG)
7957 AC_SUBST(MINGWCXX)
7958 AC_SUBST(MINGWSTRIP)
7960 dnl ===================================================================
7961 dnl Check for system zlib
7962 dnl ===================================================================
7963 if test "$with_system_zlib" = "auto"; then
7964     case "$_os" in
7965     WINNT)
7966         with_system_zlib="$with_system_libs"
7967         ;;
7968     *)
7969         if test "$enable_fuzzers" != "yes"; then
7970             with_system_zlib=yes
7971         else
7972             with_system_zlib=no
7973         fi
7974         ;;
7975     esac
7978 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
7979 dnl and has no pkg-config for it at least on some tinderboxes,
7980 dnl so leaving that out for now
7981 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7982 AC_MSG_CHECKING([which zlib to use])
7983 if test "$with_system_zlib" = "yes"; then
7984     AC_MSG_RESULT([external])
7985     SYSTEM_ZLIB=TRUE
7986     AC_CHECK_HEADER(zlib.h, [],
7987         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7988     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7989         [AC_MSG_ERROR(zlib not found or functional)], [])
7990 else
7991     AC_MSG_RESULT([internal])
7992     SYSTEM_ZLIB=
7993     BUILD_TYPE="$BUILD_TYPE ZLIB"
7994     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7995     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7997 AC_SUBST(ZLIB_CFLAGS)
7998 AC_SUBST(ZLIB_LIBS)
7999 AC_SUBST(SYSTEM_ZLIB)
8001 dnl ===================================================================
8002 dnl Check for system jpeg
8003 dnl ===================================================================
8004 AC_MSG_CHECKING([which libjpeg to use])
8005 if test "$with_system_jpeg" = "yes"; then
8006     AC_MSG_RESULT([external])
8007     SYSTEM_LIBJPEG=TRUE
8008     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8009         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8010     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8011         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8012 else
8013     SYSTEM_LIBJPEG=
8014     AC_MSG_RESULT([internal, libjpeg-turbo])
8015     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8016     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8017     if test "$COM" = "MSC"; then
8018         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8019     else
8020         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8021     fi
8023     case "$host_cpu" in
8024     x86_64 | amd64 | i*86 | x86 | ia32)
8025         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8026         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8027             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8028                 NASM="$LODE_HOME/opt/bin/nasm"
8029             elif test -x "/opt/lo/bin/nasm"; then
8030                 NASM="/opt/lo/bin/nasm"
8031             fi
8032         fi
8034         if test -n "$NASM"; then
8035             AC_MSG_CHECKING([for object file format of host system])
8036             case "$host_os" in
8037               cygwin* | mingw* | pw32* | interix*)
8038                 case "$host_cpu" in
8039                   x86_64)
8040                     objfmt='Win64-COFF'
8041                     ;;
8042                   *)
8043                     objfmt='Win32-COFF'
8044                     ;;
8045                 esac
8046               ;;
8047               msdosdjgpp* | go32*)
8048                 objfmt='COFF'
8049               ;;
8050               os2-emx*)                 # not tested
8051                 objfmt='MSOMF'          # obj
8052               ;;
8053               linux*coff* | linux*oldld*)
8054                 objfmt='COFF'           # ???
8055               ;;
8056               linux*aout*)
8057                 objfmt='a.out'
8058               ;;
8059               linux*)
8060                 case "$host_cpu" in
8061                   x86_64)
8062                     objfmt='ELF64'
8063                     ;;
8064                   *)
8065                     objfmt='ELF'
8066                     ;;
8067                 esac
8068               ;;
8069               kfreebsd* | freebsd* | netbsd* | openbsd*)
8070                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8071                   objfmt='BSD-a.out'
8072                 else
8073                   case "$host_cpu" in
8074                     x86_64 | amd64)
8075                       objfmt='ELF64'
8076                       ;;
8077                     *)
8078                       objfmt='ELF'
8079                       ;;
8080                   esac
8081                 fi
8082               ;;
8083               solaris* | sunos* | sysv* | sco*)
8084                 case "$host_cpu" in
8085                   x86_64)
8086                     objfmt='ELF64'
8087                     ;;
8088                   *)
8089                     objfmt='ELF'
8090                     ;;
8091                 esac
8092               ;;
8093               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8094                 case "$host_cpu" in
8095                   x86_64)
8096                     objfmt='Mach-O64'
8097                     ;;
8098                   *)
8099                     objfmt='Mach-O'
8100                     ;;
8101                 esac
8102               ;;
8103               *)
8104                 objfmt='ELF ?'
8105               ;;
8106             esac
8108             AC_MSG_RESULT([$objfmt])
8109             if test "$objfmt" = 'ELF ?'; then
8110               objfmt='ELF'
8111               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8112             fi
8114             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8115             case "$objfmt" in
8116               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8117               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8118               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8119               COFF)       NAFLAGS='-fcoff -DCOFF';;
8120               a.out)      NAFLAGS='-faout -DAOUT';;
8121               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8122               ELF)        NAFLAGS='-felf -DELF';;
8123               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8124               RDF)        NAFLAGS='-frdf -DRDF';;
8125               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8126               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8127             esac
8128             AC_MSG_RESULT([$NAFLAGS])
8130             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8131             cat > conftest.asm << EOF
8132             [%line __oline__ "configure"
8133                     section .text
8134                     global  _main,main
8135             _main:
8136             main:   xor     eax,eax
8137                     ret
8138             ]
8140             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8141             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8142               AC_MSG_RESULT(yes)
8143             else
8144               echo "configure: failed program was:" >&AC_FD_CC
8145               cat conftest.asm >&AC_FD_CC
8146               rm -rf conftest*
8147               AC_MSG_RESULT(no)
8148               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8149               NASM=""
8150             fi
8152         fi
8154         if test -z "$NASM"; then
8155 cat << _EOS
8156 ****************************************************************************
8157 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8158 To get one please:
8160 _EOS
8161             if test "$build_os" = "cygwin"; then
8162 cat << _EOS
8163 install a pre-compiled binary for Win32
8165 mkdir -p /opt/lo/bin
8166 cd /opt/lo/bin
8167 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8168 chmod +x nasm
8170 or get and install one from http://www.nasm.us/
8172 Then re-run autogen.sh
8174 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8175 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8177 _EOS
8178             else
8179 cat << _EOS
8180 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8182 _EOS
8183             fi
8184             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8185             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8186         fi
8187       ;;
8188     esac
8191 AC_SUBST(NASM)
8192 AC_SUBST(LIBJPEG_CFLAGS)
8193 AC_SUBST(LIBJPEG_LIBS)
8194 AC_SUBST(SYSTEM_LIBJPEG)
8196 dnl ===================================================================
8197 dnl Check for system clucene
8198 dnl ===================================================================
8199 dnl we should rather be using
8200 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8201 dnl but the contribs-lib check seems tricky
8202 AC_MSG_CHECKING([which clucene to use])
8203 if test "$with_system_clucene" = "yes"; then
8204     AC_MSG_RESULT([external])
8205     SYSTEM_CLUCENE=TRUE
8206     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8207     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8208     FilterLibs "${CLUCENE_LIBS}"
8209     CLUCENE_LIBS="${filteredlibs}"
8210     AC_LANG_PUSH([C++])
8211     save_CXXFLAGS=$CXXFLAGS
8212     save_CPPFLAGS=$CPPFLAGS
8213     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8214     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8215     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8216     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8217     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8218                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8219     CXXFLAGS=$save_CXXFLAGS
8220     CPPFLAGS=$save_CPPFLAGS
8221     AC_LANG_POP([C++])
8223     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8224 else
8225     AC_MSG_RESULT([internal])
8226     SYSTEM_CLUCENE=
8227     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8229 AC_SUBST(SYSTEM_CLUCENE)
8230 AC_SUBST(CLUCENE_CFLAGS)
8231 AC_SUBST(CLUCENE_LIBS)
8233 dnl ===================================================================
8234 dnl Check for system expat
8235 dnl ===================================================================
8236 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8238 dnl ===================================================================
8239 dnl Check for system xmlsec
8240 dnl ===================================================================
8241 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8243 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8244 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8245     ENABLE_EOT="TRUE"
8246     AC_DEFINE([ENABLE_EOT])
8247     AC_MSG_RESULT([yes])
8249     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8250 else
8251     ENABLE_EOT=
8252     AC_MSG_RESULT([no])
8254 AC_SUBST([ENABLE_EOT])
8256 dnl ===================================================================
8257 dnl Check for DLP libs
8258 dnl ===================================================================
8259 AS_IF([test "$COM" = "MSC"],
8260       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8261       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8263 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8265 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8267 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8269 AS_IF([test "$COM" = "MSC"],
8270       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8271       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8273 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8275 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8277 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8278 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8280 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8282 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8284 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8286 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8287 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8289 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8290 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8292 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8294 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8295 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8297 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8299 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8301 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8303 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8305 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8306 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8308 dnl ===================================================================
8309 dnl Check for system lcms2
8310 dnl ===================================================================
8311 if test "$with_system_lcms2" != "yes"; then
8312     SYSTEM_LCMS2=
8314 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8315 if test "$GCC" = "yes"; then
8316     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8318 if test "$COM" = "MSC"; then # override the above
8319     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8322 dnl ===================================================================
8323 dnl Check for system cppunit
8324 dnl ===================================================================
8325 if test "$_os" != "Android" ; then
8326     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8329 dnl ===================================================================
8330 dnl Check whether freetype is available
8331 dnl ===================================================================
8332 if test  "$test_freetype" = "yes"; then
8333     AC_MSG_CHECKING([whether freetype is available])
8334     # FreeType has 3 different kinds of versions
8335     # * release, like 2.4.10
8336     # * libtool, like 13.0.7 (this what pkg-config returns)
8337     # * soname
8338     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8339     #
8340     # 9.9.3 is 2.2.0
8341     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8342     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8343     FilterLibs "${FREETYPE_LIBS}"
8344     FREETYPE_LIBS="${filteredlibs}"
8345     SYSTEM_FREETYPE=TRUE
8346 else
8347     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8348     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8350 AC_SUBST(FREETYPE_CFLAGS)
8351 AC_SUBST(FREETYPE_LIBS)
8352 AC_SUBST([SYSTEM_FREETYPE])
8354 # ===================================================================
8355 # Check for system libxslt
8356 # to prevent incompatibilities between internal libxml2 and external libxslt,
8357 # or vice versa, use with_system_libxml here
8358 # ===================================================================
8359 if test "$with_system_libxml" = "auto"; then
8360     case "$_os" in
8361     WINNT|iOS|Android)
8362         with_system_libxml="$with_system_libs"
8363         ;;
8364     *)
8365         if test "$enable_fuzzers" != "yes"; then
8366             with_system_libxml=yes
8367         else
8368             with_system_libxml=no
8369         fi
8370         ;;
8371     esac
8374 AC_MSG_CHECKING([which libxslt to use])
8375 if test "$with_system_libxml" = "yes"; then
8376     AC_MSG_RESULT([external])
8377     SYSTEM_LIBXSLT=TRUE
8378     if test "$_os" = "Darwin"; then
8379         dnl make sure to use SDK path
8380         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8381         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8382         dnl omit -L/usr/lib
8383         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8384         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8385     else
8386         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8387         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8388         FilterLibs "${LIBXSLT_LIBS}"
8389         LIBXSLT_LIBS="${filteredlibs}"
8390         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8391         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8392         FilterLibs "${LIBEXSLT_LIBS}"
8393         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8394     fi
8396     dnl Check for xsltproc
8397     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8398     if test "$XSLTPROC" = "no"; then
8399         AC_MSG_ERROR([xsltproc is required])
8400     fi
8401 else
8402     AC_MSG_RESULT([internal])
8403     SYSTEM_LIBXSLT=
8404     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8406     if test "$cross_compiling" = "yes"; then
8407         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8408         if test "$XSLTPROC" = "no"; then
8409             AC_MSG_ERROR([xsltproc is required])
8410         fi
8411     fi
8413 AC_SUBST(SYSTEM_LIBXSLT)
8414 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8415     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8417 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8419 AC_SUBST(LIBEXSLT_CFLAGS)
8420 AC_SUBST(LIBEXSLT_LIBS)
8421 AC_SUBST(LIBXSLT_CFLAGS)
8422 AC_SUBST(LIBXSLT_LIBS)
8423 AC_SUBST(XSLTPROC)
8425 # ===================================================================
8426 # Check for system libxml
8427 # ===================================================================
8428 AC_MSG_CHECKING([which libxml to use])
8429 if test "$with_system_libxml" = "yes"; then
8430     AC_MSG_RESULT([external])
8431     SYSTEM_LIBXML=TRUE
8432     if test "$_os" = "Darwin"; then
8433         dnl make sure to use SDK path
8434         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8435         dnl omit -L/usr/lib
8436         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8437     elif test $_os = iOS; then
8438         dnl make sure to use SDK path
8439         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8440         LIBXML_CFLAGS="-I$usr/include/libxml2"
8441         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8442     else
8443         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8444         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8445         FilterLibs "${LIBXML_LIBS}"
8446         LIBXML_LIBS="${filteredlibs}"
8447     fi
8449     dnl Check for xmllint
8450     AC_PATH_PROG(XMLLINT, xmllint, no)
8451     if test "$XMLLINT" = "no"; then
8452         AC_MSG_ERROR([xmllint is required])
8453     fi
8454 else
8455     AC_MSG_RESULT([internal])
8456     SYSTEM_LIBXML=
8457     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8458     if test "$COM" = "MSC"; then
8459         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8460     fi
8461     if test "$COM" = "MSC"; then
8462         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8463     else
8464         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8465     fi
8466     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8468 AC_SUBST(SYSTEM_LIBXML)
8469 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8470     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8472 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8473 AC_SUBST(LIBXML_CFLAGS)
8474 AC_SUBST(LIBXML_LIBS)
8475 AC_SUBST(XMLLINT)
8477 # =====================================================================
8478 # Checking for a Python interpreter with version >= 2.7.
8479 # Build and runtime requires Python 3 compatible version (>= 2.7).
8480 # Optionally user can pass an option to configure, i. e.
8481 # ./configure PYTHON=/usr/bin/python
8482 # =====================================================================
8483 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8484     # This allows a lack of system python with no error, we use internal one in that case.
8485     AM_PATH_PYTHON([2.7],, [:])
8486     # Clean PYTHON_VERSION checked below if cross-compiling
8487     PYTHON_VERSION=""
8488     if test "$PYTHON" != ":"; then
8489         PYTHON_FOR_BUILD=$PYTHON
8490     fi
8492 AC_SUBST(PYTHON_FOR_BUILD)
8494 # Checks for Python to use for Pyuno
8495 AC_MSG_CHECKING([which Python to use for Pyuno])
8496 case "$enable_python" in
8497 no|disable)
8498     if test -z $PYTHON_FOR_BUILD; then
8499         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8500         # requirement from the choice whether to include Python stuff in the installer, but why
8501         # bother?
8502         AC_MSG_ERROR([Python is required at build time.])
8503     fi
8504     enable_python=no
8505     AC_MSG_RESULT([none])
8506     ;;
8507 ""|yes|auto)
8508     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8509         AC_MSG_RESULT([no, overridden by --disable-scripting])
8510         enable_python=no
8511     elif test $build_os = cygwin; then
8512         dnl When building on Windows we don't attempt to use any installed
8513         dnl "system"  Python.
8514         AC_MSG_RESULT([fully internal])
8515         enable_python=internal
8516     elif test "$cross_compiling" = yes; then
8517         AC_MSG_RESULT([system])
8518         enable_python=system
8519     else
8520         # Unset variables set by the above AM_PATH_PYTHON so that
8521         # we actually do check anew.
8522         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
8523         AM_PATH_PYTHON([3.3],, [:])
8524         if test "$PYTHON" = ":"; then
8525             if test -z "$PYTHON_FOR_BUILD"; then
8526                 AC_MSG_RESULT([fully internal])
8527             else
8528                 AC_MSG_RESULT([internal])
8529             fi
8530             enable_python=internal
8531         else
8532             AC_MSG_RESULT([system])
8533             enable_python=system
8534         fi
8535     fi
8536     ;;
8537 internal)
8538     AC_MSG_RESULT([internal])
8539     ;;
8540 fully-internal)
8541     AC_MSG_RESULT([fully internal])
8542     enable_python=internal
8543     ;;
8544 system)
8545     AC_MSG_RESULT([system])
8546     if test "$_os" = Darwin; then
8547         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])
8548     fi
8549     ;;
8551     AC_MSG_ERROR([Incorrect --enable-python option])
8552     ;;
8553 esac
8555 if test $enable_python != no; then
8556     BUILD_TYPE="$BUILD_TYPE PYUNO"
8559 if test $enable_python = system; then
8560     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8561         # Fallback: Accept these in the environment, or as set above
8562         # for MacOSX.
8563         :
8564     elif test "$cross_compiling" != yes; then
8565         # Unset variables set by the above AM_PATH_PYTHON so that
8566         # we actually do check anew.
8567         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
8568         # This causes an error if no python command is found
8569         AM_PATH_PYTHON([3.3])
8570         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8571         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8572         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8573         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8574         if test -z "$PKG_CONFIG"; then
8575             PYTHON_CFLAGS="-I$python_include"
8576             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8577         elif $PKG_CONFIG --exists python-$python_version; then
8578             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8579             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8580         else
8581             PYTHON_CFLAGS="-I$python_include"
8582             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8583         fi
8584         FilterLibs "${PYTHON_LIBS}"
8585         PYTHON_LIBS="${filteredlibs}"
8586     else
8587         dnl How to find out the cross-compilation Python installation path?
8588         AC_MSG_CHECKING([for python version])
8589         AS_IF([test -n "$PYTHON_VERSION"],
8590               [AC_MSG_RESULT([$PYTHON_VERSION])],
8591               [AC_MSG_RESULT([not found])
8592                AC_MSG_ERROR([no usable python found])])
8593         test -n "$PYTHON_CFLAGS" && break
8594     fi
8596     dnl Check if the headers really work
8597     save_CPPFLAGS="$CPPFLAGS"
8598     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8599     AC_CHECK_HEADER(Python.h)
8600     CPPFLAGS="$save_CPPFLAGS"
8602     # let the PYTHON_FOR_BUILD match the same python installation that
8603     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8604     # better for PythonTests.
8605     PYTHON_FOR_BUILD=$PYTHON
8608 if test "$with_lxml" != no; then
8609     if test -z "$PYTHON_FOR_BUILD"; then
8610         case $build_os in
8611             cygwin)
8612                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8613                 ;;
8614             *)
8615                 if test "$cross_compiling" != yes ; then
8616                     BUILD_TYPE="$BUILD_TYPE LXML"
8617                 fi
8618                 ;;
8619         esac
8620     else
8621         AC_MSG_CHECKING([for python lxml])
8622         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8623             AC_MSG_RESULT([yes])
8624         else
8625             case $build_os in
8626                 cygwin)
8627                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8628                     ;;
8629                 *)
8630                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8631                         BUILD_TYPE="$BUILD_TYPE LXML"
8632                         AC_MSG_RESULT([no, using internal lxml])
8633                     else
8634                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8635                     fi
8636                     ;;
8637             esac
8638         fi
8639     fi
8642 dnl By now enable_python should be "system", "internal" or "no"
8643 case $enable_python in
8644 system)
8645     SYSTEM_PYTHON=TRUE
8647     if test "x$ac_cv_header_Python_h" != "xyes"; then
8648        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8649     fi
8651     AC_LANG_PUSH(C)
8652     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8653     AC_MSG_CHECKING([for correct python library version])
8654        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8655 #include <Python.h>
8657 int main(int argc, char **argv) {
8658    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8659        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8660    else return 1;
8662        ]])],[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])])
8663     CFLAGS=$save_CFLAGS
8664     AC_LANG_POP(C)
8666     dnl FIXME Check if the Python library can be linked with, too?
8667     ;;
8669 internal)
8670     SYSTEM_PYTHON=
8671     PYTHON_VERSION_MAJOR=3
8672     PYTHON_VERSION_MINOR=5
8673     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8674     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8675         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8676     fi
8677     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8678     BUILD_TYPE="$BUILD_TYPE PYTHON"
8679     # Embedded Python dies without Home set
8680     if test "$HOME" = ""; then
8681         export HOME=""
8682     fi
8683     ;;
8685     DISABLE_PYTHON=TRUE
8686     SYSTEM_PYTHON=
8687     ;;
8689     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8690     ;;
8691 esac
8693 AC_SUBST(DISABLE_PYTHON)
8694 AC_SUBST(SYSTEM_PYTHON)
8695 AC_SUBST(PYTHON_CFLAGS)
8696 AC_SUBST(PYTHON_LIBS)
8697 AC_SUBST(PYTHON_VERSION)
8698 AC_SUBST(PYTHON_VERSION_MAJOR)
8699 AC_SUBST(PYTHON_VERSION_MINOR)
8701 ENABLE_MARIADBC=TRUE
8702 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8703     ENABLE_MARIADBC=
8705 MARIADBC_MAJOR=1
8706 MARIADBC_MINOR=0
8707 MARIADBC_MICRO=2
8708 if test "$ENABLE_MARIADBC" = "TRUE"; then
8709     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8712 AC_SUBST(ENABLE_MARIADBC)
8713 AC_SUBST(MARIADBC_MAJOR)
8714 AC_SUBST(MARIADBC_MINOR)
8715 AC_SUBST(MARIADBC_MICRO)
8717 if test "$ENABLE_MARIADBC" = "TRUE"; then
8718     dnl ===================================================================
8719     dnl Check for system MariaDB
8720     dnl ===================================================================
8721     AC_MSG_CHECKING([which MariaDB to use])
8722     if test "$with_system_mariadb" = "yes"; then
8723         AC_MSG_RESULT([external])
8724         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8725         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8726         if test -z "$MARIADBCONFIG"; then
8727             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8728             if test -z "$MARIADBCONFIG"; then
8729                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8730                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8731             fi
8732         fi
8733         AC_MSG_CHECKING([MariaDB version])
8734         MARIADB_VERSION=`$MARIADBCONFIG --version`
8735         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8736         if test "$MARIADB_MAJOR" -ge "5"; then
8737             AC_MSG_RESULT([OK])
8738         else
8739             AC_MSG_ERROR([too old, use 5.0.x or later])
8740         fi
8741         AC_MSG_CHECKING([for MariaDB Client library])
8742         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8743         if test "$COM_IS_CLANG" = TRUE; then
8744             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8745         fi
8746         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8747         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8748         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8749         dnl linux32:
8750         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8751             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8752             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8753                 | sed -e 's|/lib64/|/lib/|')
8754         fi
8755         FilterLibs "${MARIADB_LIBS}"
8756         MARIADB_LIBS="${filteredlibs}"
8757         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8758         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8759         if test "$enable_bundle_mariadb" = "yes"; then
8760             AC_MSG_RESULT([yes])
8761             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8762             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8764 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8766 /g' | grep -E '(mysqlclient|mariadb)')
8767             if test "$_os" = "Darwin"; then
8768                 LIBMARIADB=${LIBMARIADB}.dylib
8769             elif test "$_os" = "WINNT"; then
8770                 LIBMARIADB=${LIBMARIADB}.dll
8771             else
8772                 LIBMARIADB=${LIBMARIADB}.so
8773             fi
8774             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8775             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8776             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8777                 AC_MSG_RESULT([found.])
8778                 PathFormat "$LIBMARIADB_PATH"
8779                 LIBMARIADB_PATH="$formatted_path"
8780             else
8781                 AC_MSG_ERROR([not found.])
8782             fi
8783         else
8784             AC_MSG_RESULT([no])
8785             BUNDLE_MARIADB_CONNECTOR_C=
8786         fi
8787     else
8788         AC_MSG_RESULT([internal])
8789         SYSTEM_MARIADB_CONNECTOR_C=
8790         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8791         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8792         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8793     fi
8795     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8796     AC_SUBST(MARIADB_CFLAGS)
8797     AC_SUBST(MARIADB_LIBS)
8798     AC_SUBST(LIBMARIADB)
8799     AC_SUBST(LIBMARIADB_PATH)
8800     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8803 dnl ===================================================================
8804 dnl Check for system hsqldb
8805 dnl ===================================================================
8806 if test "$with_java" != "no"; then
8807     HSQLDB_USE_JDBC_4_1=
8808     AC_MSG_CHECKING([which hsqldb to use])
8809     if test "$with_system_hsqldb" = "yes"; then
8810         AC_MSG_RESULT([external])
8811         SYSTEM_HSQLDB=TRUE
8812         if test -z $HSQLDB_JAR; then
8813             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8814         fi
8815         if ! test -f $HSQLDB_JAR; then
8816                AC_MSG_ERROR(hsqldb.jar not found.)
8817         fi
8818         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8819         export HSQLDB_JAR
8820         if $PERL -e \
8821            'use Archive::Zip;
8822             my $file = "$ENV{'HSQLDB_JAR'}";
8823             my $zip = Archive::Zip->new( $file );
8824             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8825             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8826             {
8827                 push @l, split(/\n/, $mf);
8828                 foreach my $line (@l)
8829                 {
8830                     if ($line =~ m/Specification-Version:/)
8831                     {
8832                         ($t, $version) = split (/:/,$line);
8833                         $version =~ s/^\s//;
8834                         ($a, $b, $c, $d) = split (/\./,$version);
8835                         if ($c == "0" && $d > "8")
8836                         {
8837                             exit 0;
8838                         }
8839                         else
8840                         {
8841                             exit 1;
8842                         }
8843                     }
8844                 }
8845             }
8846             else
8847             {
8848                 exit 1;
8849             }'; then
8850             AC_MSG_RESULT([yes])
8851         else
8852             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8853         fi
8854     else
8855         AC_MSG_RESULT([internal])
8856         SYSTEM_HSQLDB=
8857         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8858         NEED_ANT=TRUE
8859         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8860         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8861         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8862             AC_MSG_RESULT([yes])
8863             HSQLDB_USE_JDBC_4_1=TRUE
8864         else
8865             AC_MSG_RESULT([no])
8866         fi
8867     fi
8868     AC_SUBST(SYSTEM_HSQLDB)
8869     AC_SUBST(HSQLDB_JAR)
8870     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8873 dnl ===================================================================
8874 dnl Check for PostgreSQL stuff
8875 dnl ===================================================================
8876 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8877 if test "x$enable_postgresql_sdbc" != "xno"; then
8878     AC_MSG_RESULT([yes])
8879     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8881     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8882         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8883     fi
8884     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8885         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8886     fi
8888     postgres_interface=""
8889     if test "$with_system_postgresql" = "yes"; then
8890         postgres_interface="external PostgreSQL"
8891         SYSTEM_POSTGRESQL=TRUE
8892         if test "$_os" = Darwin; then
8893             supp_path=''
8894             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8895                 pg_supp_path="$P_SEP$d$pg_supp_path"
8896             done
8897         fi
8898         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8899         if test -n "$PGCONFIG"; then
8900             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8901             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8902         else
8903             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8904               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8905               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8906             ],[
8907               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8908             ])
8909         fi
8910         FilterLibs "${POSTGRESQL_LIB}"
8911         POSTGRESQL_LIB="${filteredlibs}"
8912     else
8913         # if/when anything else than PostgreSQL uses Kerberos,
8914         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8915         WITH_KRB5=
8916         WITH_GSSAPI=
8917         case "$_os" in
8918         Darwin)
8919             # macOS has system MIT Kerberos 5 since 10.4
8920             if test "$with_krb5" != "no"; then
8921                 WITH_KRB5=TRUE
8922                 save_LIBS=$LIBS
8923                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8924                 # that the libraries where these functions are located on macOS will change, is it?
8925                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8926                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8927                 KRB5_LIBS=$LIBS
8928                 LIBS=$save_LIBS
8929                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8930                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8931                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8932                 LIBS=$save_LIBS
8933             fi
8934             if test "$with_gssapi" != "no"; then
8935                 WITH_GSSAPI=TRUE
8936                 save_LIBS=$LIBS
8937                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8938                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8939                 GSSAPI_LIBS=$LIBS
8940                 LIBS=$save_LIBS
8941             fi
8942             ;;
8943         WINNT)
8944             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8945                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8946             fi
8947             ;;
8948         Linux|GNU|*BSD|DragonFly)
8949             if test "$with_krb5" != "no"; then
8950                 WITH_KRB5=TRUE
8951                 save_LIBS=$LIBS
8952                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8953                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8954                 KRB5_LIBS=$LIBS
8955                 LIBS=$save_LIBS
8956                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8957                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8958                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8959                 LIBS=$save_LIBS
8960             fi
8961             if test "$with_gssapi" != "no"; then
8962                 WITH_GSSAPI=TRUE
8963                 save_LIBS=$LIBS
8964                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8965                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8966                 GSSAPI_LIBS=$LIBS
8967                 LIBS=$save_LIBS
8968             fi
8969             ;;
8970         *)
8971             if test "$with_krb5" = "yes"; then
8972                 WITH_KRB5=TRUE
8973                 save_LIBS=$LIBS
8974                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8975                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8976                 KRB5_LIBS=$LIBS
8977                 LIBS=$save_LIBS
8978                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8979                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8980                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8981                 LIBS=$save_LIBS
8982             fi
8983             if test "$with_gssapi" = "yes"; then
8984                 WITH_GSSAPI=TRUE
8985                 save_LIBS=$LIBS
8986                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8987                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8988                 LIBS=$save_LIBS
8989                 GSSAPI_LIBS=$LIBS
8990             fi
8991         esac
8993         if test -n "$with_libpq_path"; then
8994             SYSTEM_POSTGRESQL=TRUE
8995             postgres_interface="external libpq"
8996             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8997             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8998         else
8999             SYSTEM_POSTGRESQL=
9000             postgres_interface="internal"
9001             POSTGRESQL_LIB=""
9002             POSTGRESQL_INC="%OVERRIDE_ME%"
9003             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9004         fi
9005     fi
9007     AC_MSG_CHECKING([PostgreSQL C interface])
9008     AC_MSG_RESULT([$postgres_interface])
9010     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9011         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9012         save_CFLAGS=$CFLAGS
9013         save_CPPFLAGS=$CPPFLAGS
9014         save_LIBS=$LIBS
9015         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9016         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9017         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9018         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9019             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9020         CFLAGS=$save_CFLAGS
9021         CPPFLAGS=$save_CPPFLAGS
9022         LIBS=$save_LIBS
9023     fi
9024     BUILD_POSTGRESQL_SDBC=TRUE
9025 else
9026     AC_MSG_RESULT([no])
9028 AC_SUBST(WITH_KRB5)
9029 AC_SUBST(WITH_GSSAPI)
9030 AC_SUBST(GSSAPI_LIBS)
9031 AC_SUBST(KRB5_LIBS)
9032 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9033 AC_SUBST(SYSTEM_POSTGRESQL)
9034 AC_SUBST(POSTGRESQL_INC)
9035 AC_SUBST(POSTGRESQL_LIB)
9037 dnl ===================================================================
9038 dnl Check for Firebird stuff
9039 dnl ===================================================================
9040 ENABLE_FIREBIRD_SDBC=
9041 if test "$enable_firebird_sdbc" = "yes" ; then
9042     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9044     dnl ===================================================================
9045     dnl Check for system Firebird
9046     dnl ===================================================================
9047     AC_MSG_CHECKING([which Firebird to use])
9048     if test "$with_system_firebird" = "yes"; then
9049         AC_MSG_RESULT([external])
9050         SYSTEM_FIREBIRD=TRUE
9051         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9052         if test -z "$FIREBIRDCONFIG"; then
9053             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9054             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9055                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9056             ])
9057             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9058         else
9059             AC_MSG_NOTICE([fb_config found])
9060             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9061             AC_MSG_CHECKING([for Firebird Client library])
9062             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9063             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9064             FilterLibs "${FIREBIRD_LIBS}"
9065             FIREBIRD_LIBS="${filteredlibs}"
9066         fi
9067         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9068         AC_MSG_CHECKING([Firebird version])
9069         if test -n "${FIREBIRD_VERSION}"; then
9070             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9071             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9072             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9073                 AC_MSG_RESULT([OK])
9074             else
9075                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9076             fi
9077         else
9078             __save_CFLAGS="${CFLAGS}"
9079             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9080             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9081 #if defined(FB_API_VER) && FB_API_VER == 30
9082 int fb_api_is_30(void) { return 0; }
9083 #else
9084 #error "Wrong Firebird API version"
9085 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9086             CFLAGS="${__save_CFLAGS}"
9087         fi
9088         ENABLE_FIREBIRD_SDBC=TRUE
9089         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9090     elif test "$enable_database_connectivity" != yes; then
9091         AC_MSG_RESULT([none])
9092     elif test "$cross_compiling" = "yes"; then
9093         AC_MSG_RESULT([none])
9094     else
9095         dnl Embedded Firebird has version 3.0
9096         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9097         dnl We need libatomic_ops for any non X86/X64 system
9098         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9099             dnl ===================================================================
9100             dnl Check for system libatomic_ops
9101             dnl ===================================================================
9102             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9103             if test "$with_system_libatomic_ops" = "yes"; then
9104                 SYSTEM_LIBATOMIC_OPS=TRUE
9105                 AC_CHECK_HEADERS(atomic_ops.h, [],
9106                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9107             else
9108                 SYSTEM_LIBATOMIC_OPS=
9109                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9110                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9111                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9112             fi
9113         fi
9115         AC_MSG_RESULT([internal])
9116         SYSTEM_FIREBIRD=
9117         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9118         FIREBIRD_LIBS="-lfbclient"
9120         if test "$with_system_libtommath" = "yes"; then
9121             SYSTEM_LIBTOMMATH=TRUE
9122             dnl check for tommath presence
9123             save_LIBS=$LIBS
9124             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9125             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9126             LIBS=$save_LIBS
9127         else
9128             SYSTEM_LIBTOMMATH=
9129             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9130             LIBTOMMATH_LIBS="-ltommath"
9131             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9132         fi
9134         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9135         ENABLE_FIREBIRD_SDBC=TRUE
9136         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9137     fi
9139 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9140 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9141 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9142 AC_SUBST(LIBATOMIC_OPS_LIBS)
9143 AC_SUBST(SYSTEM_FIREBIRD)
9144 AC_SUBST(FIREBIRD_CFLAGS)
9145 AC_SUBST(FIREBIRD_LIBS)
9146 AC_SUBST([TOMMATH_CFLAGS])
9147 AC_SUBST([TOMMATH_LIBS])
9149 dnl ===================================================================
9150 dnl Check for system curl
9151 dnl ===================================================================
9152 AC_MSG_CHECKING([which libcurl to use])
9153 if test "$with_system_curl" = "auto"; then
9154     with_system_curl="$with_system_libs"
9157 if test "$with_system_curl" = "yes"; then
9158     AC_MSG_RESULT([external])
9159     SYSTEM_CURL=TRUE
9161     # First try PKGCONFIG and then fall back
9162     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9164     if test -n "$CURL_PKG_ERRORS"; then
9165         AC_PATH_PROG(CURLCONFIG, curl-config)
9166         if test -z "$CURLCONFIG"; then
9167             AC_MSG_ERROR([curl development files not found])
9168         fi
9169         CURL_LIBS=`$CURLCONFIG --libs`
9170         FilterLibs "${CURL_LIBS}"
9171         CURL_LIBS="${filteredlibs}"
9172         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9173         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9175         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9176         case $curl_version in
9177         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9178         dnl so they need to be doubled to end up in the configure script
9179         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9180             AC_MSG_RESULT([yes])
9181             ;;
9182         *)
9183             AC_MSG_ERROR([no, you have $curl_version])
9184             ;;
9185         esac
9186     fi
9188     ENABLE_CURL=TRUE
9189 elif test $_os = iOS; then
9190     # Let's see if we need curl, I think not?
9191     AC_MSG_RESULT([none])
9192     ENABLE_CURL=
9193 else
9194     AC_MSG_RESULT([internal])
9195     SYSTEM_CURL=
9196     BUILD_TYPE="$BUILD_TYPE CURL"
9197     ENABLE_CURL=TRUE
9199 AC_SUBST(SYSTEM_CURL)
9200 AC_SUBST(CURL_CFLAGS)
9201 AC_SUBST(CURL_LIBS)
9202 AC_SUBST(ENABLE_CURL)
9204 dnl ===================================================================
9205 dnl Check for system boost
9206 dnl ===================================================================
9207 AC_MSG_CHECKING([which boost to use])
9208 if test "$with_system_boost" = "yes"; then
9209     AC_MSG_RESULT([external])
9210     SYSTEM_BOOST=TRUE
9211     AX_BOOST_BASE(1.47)
9212     AX_BOOST_DATE_TIME
9213     AX_BOOST_FILESYSTEM
9214     AX_BOOST_IOSTREAMS
9215     AX_BOOST_LOCALE
9216     AC_LANG_PUSH([C++])
9217     save_CXXFLAGS=$CXXFLAGS
9218     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9219     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9220        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9221     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9222        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9223     CXXFLAGS=$save_CXXFLAGS
9224     AC_LANG_POP([C++])
9225     # this is in m4/ax_boost_base.m4
9226     FilterLibs "${BOOST_LDFLAGS}"
9227     BOOST_LDFLAGS="${filteredlibs}"
9228 else
9229     AC_MSG_RESULT([internal])
9230     BUILD_TYPE="$BUILD_TYPE BOOST"
9231     SYSTEM_BOOST=
9232     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9233         # use warning-suppressing wrapper headers
9234         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9235     else
9236         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9237     fi
9239 AC_SUBST(SYSTEM_BOOST)
9241 dnl ===================================================================
9242 dnl Check for system mdds
9243 dnl ===================================================================
9244 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9246 dnl ===================================================================
9247 dnl Check for system glm
9248 dnl ===================================================================
9249 AC_MSG_CHECKING([which glm to use])
9250 if test "$with_system_glm" = "yes"; then
9251     AC_MSG_RESULT([external])
9252     SYSTEM_GLM=TRUE
9253     AC_LANG_PUSH([C++])
9254     AC_CHECK_HEADER([glm/glm.hpp], [],
9255        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9256     AC_LANG_POP([C++])
9257 else
9258     AC_MSG_RESULT([internal])
9259     BUILD_TYPE="$BUILD_TYPE GLM"
9260     SYSTEM_GLM=
9261     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9263 AC_SUBST([GLM_CFLAGS])
9264 AC_SUBST([SYSTEM_GLM])
9266 dnl ===================================================================
9267 dnl Check for system odbc
9268 dnl ===================================================================
9269 AC_MSG_CHECKING([which odbc headers to use])
9270 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
9271     AC_MSG_RESULT([external])
9272     SYSTEM_ODBC_HEADERS=TRUE
9274     if test "$build_os" = "cygwin"; then
9275         save_CPPFLAGS=$CPPFLAGS
9276         find_winsdk
9277         PathFormat "$winsdktest"
9278         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"
9279         AC_CHECK_HEADER(sqlext.h, [],
9280             [AC_MSG_ERROR(odbc not found. install odbc)],
9281             [#include <windows.h>])
9282         CPPFLAGS=$save_CPPFLAGS
9283     else
9284         AC_CHECK_HEADER(sqlext.h, [],
9285             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9286     fi
9287 elif test "$enable_database_connectivity" != yes; then
9288     AC_MSG_RESULT([none])
9289 else
9290     AC_MSG_RESULT([internal])
9291     SYSTEM_ODBC_HEADERS=
9293 AC_SUBST(SYSTEM_ODBC_HEADERS)
9295 dnl ===================================================================
9296 dnl Enable LDAP support
9297 dnl ===================================================================
9299 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9300 AC_MSG_CHECKING([whether to enable LDAP support])
9301     if test "$enable_ldap" != "yes"; then
9302         AC_MSG_RESULT([no])
9303         ENABLE_LDAP=""
9304         enable_ldap=no
9305     else
9306         AC_MSG_RESULT([yes])
9307         ENABLE_LDAP="TRUE"
9308         AC_DEFINE(HAVE_FEATURE_LDAP)
9309     fi
9311 AC_SUBST(ENABLE_LDAP)
9313 dnl ===================================================================
9314 dnl Check for system openldap
9315 dnl ===================================================================
9317 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9318 AC_MSG_CHECKING([which openldap library to use])
9319 if test "$with_system_openldap" = "yes"; then
9320     AC_MSG_RESULT([external])
9321     SYSTEM_OPENLDAP=TRUE
9322     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9323     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9324     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9325 else
9326     AC_MSG_RESULT([internal])
9327     SYSTEM_OPENLDAP=
9328     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9331 AC_SUBST(SYSTEM_OPENLDAP)
9333 dnl ===================================================================
9334 dnl Check for system NSS
9335 dnl ===================================================================
9336 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9337     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9338     AC_DEFINE(HAVE_FEATURE_NSS)
9339     ENABLE_NSS="TRUE"
9340     AC_DEFINE(ENABLE_NSS)
9341 elif test $_os != iOS ; then
9342     with_tls=openssl
9344 AC_SUBST(ENABLE_NSS)
9346 dnl ===================================================================
9347 dnl Check for TLS/SSL and cryptographic implementation to use
9348 dnl ===================================================================
9349 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9350 if test -n "$with_tls"; then
9351     case $with_tls in
9352     openssl)
9353         AC_DEFINE(USE_TLS_OPENSSL)
9354         TLS=OPENSSL
9356         if test "$enable_openssl" != "yes"; then
9357             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9358         fi
9360         # warn that OpenSSL has been selected but not all TLS code has this option
9361         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9362         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9363         ;;
9364     nss)
9365         AC_DEFINE(USE_TLS_NSS)
9366         TLS=NSS
9367         ;;
9368     no)
9369         AC_MSG_WARN([Skipping TLS/SSL])
9370         ;;
9371     *)
9372         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9373 openssl - OpenSSL
9374 nss - Mozilla's Network Security Services (NSS)
9375     ])
9376         ;;
9377     esac
9378 else
9379     # default to using NSS, it results in smaller oox lib
9380     AC_DEFINE(USE_TLS_NSS)
9381     TLS=NSS
9383 AC_MSG_RESULT([$TLS])
9384 AC_SUBST(TLS)
9386 dnl ===================================================================
9387 dnl Check for system sane
9388 dnl ===================================================================
9389 AC_MSG_CHECKING([which sane header to use])
9390 if test "$with_system_sane" = "yes"; then
9391     AC_MSG_RESULT([external])
9392     AC_CHECK_HEADER(sane/sane.h, [],
9393       [AC_MSG_ERROR(sane not found. install sane)], [])
9394 else
9395     AC_MSG_RESULT([internal])
9396     BUILD_TYPE="$BUILD_TYPE SANE"
9399 dnl ===================================================================
9400 dnl Check for system icu
9401 dnl ===================================================================
9402 SYSTEM_GENBRK=
9403 SYSTEM_GENCCODE=
9404 SYSTEM_GENCMN=
9406 ICU_MAJOR=63
9407 ICU_MINOR=1
9408 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9409 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9410 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9411 AC_MSG_CHECKING([which icu to use])
9412 if test "$with_system_icu" = "yes"; then
9413     AC_MSG_RESULT([external])
9414     SYSTEM_ICU=TRUE
9415     AC_LANG_PUSH([C++])
9416     AC_MSG_CHECKING([for unicode/rbbi.h])
9417     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9418     AC_LANG_POP([C++])
9420     if test "$cross_compiling" != "yes"; then
9421         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9422         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9423         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9424         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9425     fi
9427     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9428         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9429         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9430         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9431         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9432         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9433             AC_MSG_RESULT([yes])
9434         else
9435             AC_MSG_RESULT([no])
9436             if test "$with_system_icu_for_build" != "force"; then
9437                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9438 You can use --with-system-icu-for-build=force to use it anyway.])
9439             fi
9440         fi
9441     fi
9443     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9444         # using the system icu tools can lead to version confusion, use the
9445         # ones from the build environment when cross-compiling
9446         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9447         if test -z "$SYSTEM_GENBRK"; then
9448             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9449         fi
9450         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9451         if test -z "$SYSTEM_GENCCODE"; then
9452             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9453         fi
9454         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9455         if test -z "$SYSTEM_GENCMN"; then
9456             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9457         fi
9458         if test "$ICU_MAJOR" -ge "49"; then
9459             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9460             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9461             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9462         else
9463             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9464             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9465             ICU_RECLASSIFIED_HEBREW_LETTER=
9466         fi
9467     fi
9469     if test "$cross_compiling" = "yes"; then
9470         if test "$ICU_MAJOR" -ge "50"; then
9471             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9472             ICU_MINOR=""
9473         fi
9474     fi
9475 else
9476     AC_MSG_RESULT([internal])
9477     SYSTEM_ICU=
9478     BUILD_TYPE="$BUILD_TYPE ICU"
9479     # surprisingly set these only for "internal" (to be used by various other
9480     # external libs): the system icu-config is quite unhelpful and spits out
9481     # dozens of weird flags and also default path -I/usr/include
9482     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9483     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9485 if test "$ICU_MAJOR" -ge "59"; then
9486     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9487     # with -std=c++11 but not all external libraries can be built with that,
9488     # for those use a bit-compatible typedef uint16_t UChar; see
9489     # icu/source/common/unicode/umachine.h
9490     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9491 else
9492     ICU_UCHAR_TYPE=""
9494 AC_SUBST(SYSTEM_ICU)
9495 AC_SUBST(SYSTEM_GENBRK)
9496 AC_SUBST(SYSTEM_GENCCODE)
9497 AC_SUBST(SYSTEM_GENCMN)
9498 AC_SUBST(ICU_MAJOR)
9499 AC_SUBST(ICU_MINOR)
9500 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9501 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9502 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9503 AC_SUBST(ICU_CFLAGS)
9504 AC_SUBST(ICU_LIBS)
9505 AC_SUBST(ICU_UCHAR_TYPE)
9507 dnl ==================================================================
9508 dnl Breakpad
9509 dnl ==================================================================
9510 AC_MSG_CHECKING([whether to enable breakpad])
9511 if test "$enable_breakpad" != yes; then
9512     AC_MSG_RESULT([no])
9513 else
9514     AC_MSG_RESULT([yes])
9515     ENABLE_BREAKPAD="TRUE"
9516     AC_DEFINE(ENABLE_BREAKPAD)
9517     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9518     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9520     AC_MSG_CHECKING([for crashreport config])
9521     if test "$with_symbol_config" = "no"; then
9522         BREAKPAD_SYMBOL_CONFIG="invalid"
9523         AC_MSG_RESULT([no])
9524     else
9525         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9526         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9527         AC_MSG_RESULT([yes])
9528     fi
9529     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9531 AC_SUBST(ENABLE_BREAKPAD)
9533 dnl ==================================================================
9534 dnl libfuzzer
9535 dnl ==================================================================
9536 AC_MSG_CHECKING([whether to enable fuzzers])
9537 if test "$enable_fuzzers" != yes; then
9538     AC_MSG_RESULT([no])
9539 else
9540     AC_MSG_RESULT([yes])
9541     ENABLE_FUZZERS="TRUE"
9542     AC_DEFINE([ENABLE_FUZZERS],1)
9543     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9545 AC_SUBST(ENABLE_FUZZERS)
9547 dnl ===================================================================
9548 dnl Orcus
9549 dnl ===================================================================
9550 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9551 if test "$with_system_orcus" != "yes"; then
9552     if test "$SYSTEM_BOOST" = "TRUE"; then
9553         # ===========================================================
9554         # Determine if we are going to need to link with Boost.System
9555         # ===========================================================
9556         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9557         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9558         dnl in documentation has no effect.
9559         AC_MSG_CHECKING([if we need to link with Boost.System])
9560         AC_LANG_PUSH([C++])
9561         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9562                 @%:@include <boost/version.hpp>
9563             ]],[[
9564                 #if BOOST_VERSION >= 105000
9565                 #   error yes, we need to link with Boost.System
9566                 #endif
9567             ]])],[
9568                 AC_MSG_RESULT([no])
9569             ],[
9570                 AC_MSG_RESULT([yes])
9571                 AX_BOOST_SYSTEM
9572         ])
9573         AC_LANG_POP([C++])
9574     fi
9576 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9577 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9578 AC_SUBST([BOOST_SYSTEM_LIB])
9579 AC_SUBST(SYSTEM_LIBORCUS)
9581 dnl ===================================================================
9582 dnl HarfBuzz
9583 dnl ===================================================================
9584 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9585                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9586                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9588 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9589                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9590                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9592 if test "$COM" = "MSC"; then # override the above
9593     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9594     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9597 if test "$with_system_harfbuzz" = "yes"; then
9598     if test "$with_system_graphite" = "no"; then
9599         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9600     fi
9601     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9602     _save_libs="$LIBS"
9603     _save_cflags="$CFLAGS"
9604     LIBS="$LIBS $HARFBUZZ_LIBS"
9605     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9606     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9607     LIBS="$_save_libs"
9608     CFLAGS="$_save_cflags"
9609 else
9610     if test "$with_system_graphite" = "yes"; then
9611         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9612     fi
9615 AC_MSG_CHECKING([whether to use X11])
9616 dnl ***************************************
9617 dnl testing for X libraries and includes...
9618 dnl ***************************************
9619 if test "$USING_X11" = TRUE; then
9620     AC_DEFINE(HAVE_FEATURE_X11)
9622 AC_MSG_RESULT([$USING_X11])
9624 if test "$USING_X11" = TRUE; then
9625     AC_PATH_X
9626     AC_PATH_XTRA
9627     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9629     if test -z "$x_includes"; then
9630         x_includes="default_x_includes"
9631     fi
9632     if test -z "$x_libraries"; then
9633         x_libraries="default_x_libraries"
9634     fi
9635     CFLAGS="$CFLAGS $X_CFLAGS"
9636     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9637     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9638 else
9639     x_includes="no_x_includes"
9640     x_libraries="no_x_libraries"
9643 if test "$USING_X11" = TRUE; then
9644     dnl ===================================================================
9645     dnl Check for extension headers
9646     dnl ===================================================================
9647     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9648      [#include <X11/extensions/shape.h>])
9650     # vcl needs ICE and SM
9651     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9652     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9653         [AC_MSG_ERROR(ICE library not found)])
9654     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9655     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9656         [AC_MSG_ERROR(SM library not found)])
9659 dnl ===================================================================
9660 dnl Check for system Xrender
9661 dnl ===================================================================
9662 AC_MSG_CHECKING([whether to use Xrender])
9663 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9664     AC_MSG_RESULT([yes])
9665     PKG_CHECK_MODULES(XRENDER, xrender)
9666     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9667     FilterLibs "${XRENDER_LIBS}"
9668     XRENDER_LIBS="${filteredlibs}"
9669     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9670       [AC_MSG_ERROR(libXrender not found or functional)], [])
9671     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9672       [AC_MSG_ERROR(Xrender not found. install X)], [])
9673 else
9674     AC_MSG_RESULT([no])
9676 AC_SUBST(XRENDER_CFLAGS)
9677 AC_SUBST(XRENDER_LIBS)
9679 dnl ===================================================================
9680 dnl Check for XRandr
9681 dnl ===================================================================
9682 AC_MSG_CHECKING([whether to enable RandR support])
9683 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9684     AC_MSG_RESULT([yes])
9685     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9686     if test "$ENABLE_RANDR" != "TRUE"; then
9687         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9688                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9689         XRANDR_CFLAGS=" "
9690         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9691           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9692         XRANDR_LIBS="-lXrandr "
9693         ENABLE_RANDR="TRUE"
9694     fi
9695     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9696     FilterLibs "${XRANDR_LIBS}"
9697     XRANDR_LIBS="${filteredlibs}"
9698 else
9699     ENABLE_RANDR=""
9700     AC_MSG_RESULT([no])
9702 AC_SUBST(XRANDR_CFLAGS)
9703 AC_SUBST(XRANDR_LIBS)
9704 AC_SUBST(ENABLE_RANDR)
9706 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9707     WITH_WEBDAV="serf"
9709 if test $_os = iOS -o $_os = Android; then
9710     WITH_WEBDAV="no"
9712 AC_MSG_CHECKING([for webdav library])
9713 case "$WITH_WEBDAV" in
9714 serf)
9715     AC_MSG_RESULT([serf])
9716     # Check for system apr-util
9717     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9718                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9719                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9720     if test "$COM" = "MSC"; then
9721         APR_LIB_DIR="LibR"
9722         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9723         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9724     fi
9726     # Check for system serf
9727     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9728                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9729     if test "$COM" = "MSC"; then
9730         SERF_LIB_DIR="Release"
9731         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9732         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9733     fi
9734     ;;
9735 neon)
9736     AC_MSG_RESULT([neon])
9737     # Check for system neon
9738     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9739     if test "$with_system_neon" = "yes"; then
9740         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9741     else
9742         NEON_VERSION=0295
9743     fi
9744     AC_SUBST(NEON_VERSION)
9745     ;;
9747     AC_MSG_RESULT([none, disabled])
9748     WITH_WEBDAV=""
9749     ;;
9750 esac
9751 AC_SUBST(WITH_WEBDAV)
9753 dnl ===================================================================
9754 dnl Check for disabling cve_tests
9755 dnl ===================================================================
9756 AC_MSG_CHECKING([whether to execute CVE tests])
9757 # If not explicitly enabled or disabled, default
9758 if test -z "$enable_cve_tests"; then
9759     case "$OS" in
9760     WNT)
9761         # Default cves off for Windows with its wild and wonderful
9762         # variety of AV software kicking in and panicking
9763         enable_cve_tests=no
9764         ;;
9765     *)
9766         # otherwise yes
9767         enable_cve_tests=yes
9768         ;;
9769     esac
9771 if test "$enable_cve_tests" = "no"; then
9772     AC_MSG_RESULT([no])
9773     DISABLE_CVE_TESTS=TRUE
9774     AC_SUBST(DISABLE_CVE_TESTS)
9775 else
9776     AC_MSG_RESULT([yes])
9779 dnl ===================================================================
9780 dnl Check for enabling chart XShape tests
9781 dnl ===================================================================
9782 AC_MSG_CHECKING([whether to execute chart XShape tests])
9783 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9784     AC_MSG_RESULT([yes])
9785     ENABLE_CHART_TESTS=TRUE
9786     AC_SUBST(ENABLE_CHART_TESTS)
9787 else
9788     AC_MSG_RESULT([no])
9791 dnl ===================================================================
9792 dnl Check for system openssl
9793 dnl ===================================================================
9794 DISABLE_OPENSSL=
9795 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9796 if test "$enable_openssl" = "yes"; then
9797     AC_MSG_RESULT([no])
9798     if test "$_os" = Darwin ; then
9799         # OpenSSL is deprecated when building for 10.7 or later.
9800         #
9801         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9802         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9804         with_system_openssl=no
9805         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9806     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9807             && test "$with_system_openssl" != "no"; then
9808         with_system_openssl=yes
9809         SYSTEM_OPENSSL=TRUE
9810         OPENSSL_CFLAGS=
9811         OPENSSL_LIBS="-lssl -lcrypto"
9812     else
9813         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9814     fi
9815     if test "$with_system_openssl" = "yes"; then
9816         AC_MSG_CHECKING([whether openssl supports SHA512])
9817         AC_LANG_PUSH([C])
9818         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9819             SHA512_CTX context;
9820 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9821         AC_LANG_POP(C)
9822     fi
9823 else
9824     AC_MSG_RESULT([yes])
9825     DISABLE_OPENSSL=TRUE
9827     # warn that although OpenSSL is disabled, system libraries may depend on it
9828     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies])
9829     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies"
9832 AC_SUBST([DISABLE_OPENSSL])
9834 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9835     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9836         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9837         enable_cipher_openssl_backend=no
9838     else
9839         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9840     fi
9842 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9843 ENABLE_CIPHER_OPENSSL_BACKEND=
9844 if test "$enable_cipher_openssl_backend" = yes; then
9845     AC_MSG_RESULT([yes])
9846     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9847 else
9848     AC_MSG_RESULT([no])
9850 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9852 dnl ===================================================================
9853 dnl Check for building gnutls
9854 dnl ===================================================================
9855 AC_MSG_CHECKING([whether to use gnutls])
9856 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9857     AC_MSG_RESULT([yes])
9858     AM_PATH_LIBGCRYPT()
9859     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9860         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9861                       available in the system to use as replacement.]]))
9862     FilterLibs "${LIBGCRYPT_LIBS}"
9863     LIBGCRYPT_LIBS="${filteredlibs}"
9864 else
9865     AC_MSG_RESULT([no])
9868 AC_SUBST([LIBGCRYPT_CFLAGS])
9869 AC_SUBST([LIBGCRYPT_LIBS])
9871 dnl ===================================================================
9872 dnl Check for system redland
9873 dnl ===================================================================
9874 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9875 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9876 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9877 if test "$with_system_redland" = "yes"; then
9878     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9879             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9880 else
9881     RAPTOR_MAJOR="0"
9882     RASQAL_MAJOR="3"
9883     REDLAND_MAJOR="0"
9885 AC_SUBST(RAPTOR_MAJOR)
9886 AC_SUBST(RASQAL_MAJOR)
9887 AC_SUBST(REDLAND_MAJOR)
9889 dnl ===================================================================
9890 dnl Check for system hunspell
9891 dnl ===================================================================
9892 AC_MSG_CHECKING([which libhunspell to use])
9893 if test "$with_system_hunspell" = "yes"; then
9894     AC_MSG_RESULT([external])
9895     SYSTEM_HUNSPELL=TRUE
9896     AC_LANG_PUSH([C++])
9897     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9898     if test "$HUNSPELL_PC" != "TRUE"; then
9899         AC_CHECK_HEADER(hunspell.hxx, [],
9900             [
9901             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9902             [AC_MSG_ERROR(hunspell headers not found.)], [])
9903             ], [])
9904         AC_CHECK_LIB([hunspell], [main], [:],
9905            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9906         HUNSPELL_LIBS=-lhunspell
9907     fi
9908     AC_LANG_POP([C++])
9909     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9910     FilterLibs "${HUNSPELL_LIBS}"
9911     HUNSPELL_LIBS="${filteredlibs}"
9912 else
9913     AC_MSG_RESULT([internal])
9914     SYSTEM_HUNSPELL=
9915     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9916     if test "$COM" = "MSC"; then
9917         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9918     else
9919         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9920     fi
9921     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9923 AC_SUBST(SYSTEM_HUNSPELL)
9924 AC_SUBST(HUNSPELL_CFLAGS)
9925 AC_SUBST(HUNSPELL_LIBS)
9927 dnl ===================================================================
9928 dnl Checking for altlinuxhyph
9929 dnl ===================================================================
9930 AC_MSG_CHECKING([which altlinuxhyph to use])
9931 if test "$with_system_altlinuxhyph" = "yes"; then
9932     AC_MSG_RESULT([external])
9933     SYSTEM_HYPH=TRUE
9934     AC_CHECK_HEADER(hyphen.h, [],
9935        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9936     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9937        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9938        [#include <hyphen.h>])
9939     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9940         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9941     if test -z "$HYPHEN_LIB"; then
9942         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9943            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9944     fi
9945     if test -z "$HYPHEN_LIB"; then
9946         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9947            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9948     fi
9949 else
9950     AC_MSG_RESULT([internal])
9951     SYSTEM_HYPH=
9952     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9953     if test "$COM" = "MSC"; then
9954         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9955     else
9956         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9957     fi
9959 AC_SUBST(SYSTEM_HYPH)
9960 AC_SUBST(HYPHEN_LIB)
9962 dnl ===================================================================
9963 dnl Checking for mythes
9964 dnl ===================================================================
9965 AC_MSG_CHECKING([which mythes to use])
9966 if test "$with_system_mythes" = "yes"; then
9967     AC_MSG_RESULT([external])
9968     SYSTEM_MYTHES=TRUE
9969     AC_LANG_PUSH([C++])
9970     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9971     if test "$MYTHES_PKGCONFIG" = "no"; then
9972         AC_CHECK_HEADER(mythes.hxx, [],
9973             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9974         AC_CHECK_LIB([mythes-1.2], [main], [:],
9975             [ MYTHES_FOUND=no], [])
9976     if test "$MYTHES_FOUND" = "no"; then
9977         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9978                 [ MYTHES_FOUND=no], [])
9979     fi
9980     if test "$MYTHES_FOUND" = "no"; then
9981         AC_MSG_ERROR([mythes library not found!.])
9982     fi
9983     fi
9984     AC_LANG_POP([C++])
9985     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9986     FilterLibs "${MYTHES_LIBS}"
9987     MYTHES_LIBS="${filteredlibs}"
9988 else
9989     AC_MSG_RESULT([internal])
9990     SYSTEM_MYTHES=
9991     BUILD_TYPE="$BUILD_TYPE MYTHES"
9992     if test "$COM" = "MSC"; then
9993         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9994     else
9995         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9996     fi
9998 AC_SUBST(SYSTEM_MYTHES)
9999 AC_SUBST(MYTHES_CFLAGS)
10000 AC_SUBST(MYTHES_LIBS)
10002 dnl ===================================================================
10003 dnl How should we build the linear programming solver ?
10004 dnl ===================================================================
10006 ENABLE_COINMP=
10007 AC_MSG_CHECKING([whether to build with CoinMP])
10008 if test "$enable_coinmp" != "no"; then
10009     ENABLE_COINMP=TRUE
10010     AC_MSG_RESULT([yes])
10011     if test "$with_system_coinmp" = "yes"; then
10012         SYSTEM_COINMP=TRUE
10013         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10014         FilterLibs "${COINMP_LIBS}"
10015         COINMP_LIBS="${filteredlibs}"
10016     else
10017         BUILD_TYPE="$BUILD_TYPE COINMP"
10018     fi
10019 else
10020     AC_MSG_RESULT([no])
10022 AC_SUBST(ENABLE_COINMP)
10023 AC_SUBST(SYSTEM_COINMP)
10024 AC_SUBST(COINMP_CFLAGS)
10025 AC_SUBST(COINMP_LIBS)
10027 ENABLE_LPSOLVE=
10028 AC_MSG_CHECKING([whether to build with lpsolve])
10029 if test "$enable_lpsolve" != "no"; then
10030     ENABLE_LPSOLVE=TRUE
10031     AC_MSG_RESULT([yes])
10032 else
10033     AC_MSG_RESULT([no])
10035 AC_SUBST(ENABLE_LPSOLVE)
10037 if test "$ENABLE_LPSOLVE" = TRUE; then
10038     AC_MSG_CHECKING([which lpsolve to use])
10039     if test "$with_system_lpsolve" = "yes"; then
10040         AC_MSG_RESULT([external])
10041         SYSTEM_LPSOLVE=TRUE
10042         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10043            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10044         save_LIBS=$LIBS
10045         # some systems need this. Like Ubuntu....
10046         AC_CHECK_LIB(m, floor)
10047         AC_CHECK_LIB(dl, dlopen)
10048         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10049             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10050         LIBS=$save_LIBS
10051     else
10052         AC_MSG_RESULT([internal])
10053         SYSTEM_LPSOLVE=
10054         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10055     fi
10057 AC_SUBST(SYSTEM_LPSOLVE)
10059 dnl ===================================================================
10060 dnl Checking for libexttextcat
10061 dnl ===================================================================
10062 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10063 if test "$with_system_libexttextcat" = "yes"; then
10064     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10066 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10068 dnl ===================================================================
10069 dnl Checking for libnumbertext
10070 dnl ===================================================================
10071 AC_MSG_CHECKING([whether to use libnumbertext])
10072 if test "$enable_libnumbertext" = "no"; then
10073     AC_MSG_RESULT([no])
10074     ENABLE_LIBNUMBERTEXT=
10075     SYSTEM_LIBNUMBERTEXT=
10076 else
10077     AC_MSG_RESULT([yes])
10078     ENABLE_LIBNUMBERTEXT=TRUE
10079     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10080     if test "$with_system_libnumbertext" = "yes"; then
10081         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10082         SYSTEM_LIBNUMBERTEXT=YES
10083     else
10084         SYSTEM_LIBNUMBERTEXT=
10085         AC_LANG_PUSH([C++])
10086         save_CPPFLAGS=$CPPFLAGS
10087         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10088         AC_CHECK_HEADERS([codecvt regex])
10089         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10090                 [ ENABLE_LIBNUMBERTEXT=''
10091                   LIBNUMBERTEXT_CFLAGS=''
10092                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10093                                Enable libnumbertext fallback (missing number to number name conversion).])
10094                 ])
10095         CPPFLAGS=$save_CPPFLAGS
10096         AC_LANG_POP([C++])
10097     fi
10098     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10099         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10100     fi
10102 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10103 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10104 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10105 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10107 dnl ***************************************
10108 dnl testing libc version for Linux...
10109 dnl ***************************************
10110 if test "$_os" = "Linux"; then
10111     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10112     exec 6>/dev/null # no output
10113     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10114     exec 6>&1 # output on again
10115     if test "$HAVE_LIBC"; then
10116         AC_MSG_RESULT([yes])
10117     else
10118         AC_MSG_ERROR([no, upgrade libc])
10119     fi
10122 dnl =========================================
10123 dnl Check for uuidgen
10124 dnl =========================================
10125 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10126     # presence is already tested above in the WINDOWS_SDK_HOME check
10127     UUIDGEN=uuidgen.exe
10128     AC_SUBST(UUIDGEN)
10129 else
10130     AC_PATH_PROG([UUIDGEN], [uuidgen])
10131     if test -z "$UUIDGEN"; then
10132         AC_MSG_WARN([uuid is needed for building installation sets])
10133     fi
10136 dnl ***************************************
10137 dnl Checking for bison and flex
10138 dnl ***************************************
10139 AC_PATH_PROG(BISON, bison)
10140 if test -z "$BISON"; then
10141     AC_MSG_ERROR([no bison found in \$PATH, install it])
10142 else
10143     AC_MSG_CHECKING([the bison version])
10144     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10145     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10146     # Accept newer than 2.0
10147     if test "$_bison_longver" -lt 2000; then
10148         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10149     fi
10152 AC_PATH_PROG(FLEX, flex)
10153 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10154     FLEX=`cygpath -m $FLEX`
10156 if test -z "$FLEX"; then
10157     AC_MSG_ERROR([no flex found in \$PATH, install it])
10158 else
10159     AC_MSG_CHECKING([the flex version])
10160     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10161     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10162         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10163     fi
10165 AC_SUBST([FLEX])
10166 dnl ***************************************
10167 dnl Checking for patch
10168 dnl ***************************************
10169 AC_PATH_PROG(PATCH, patch)
10170 if test -z "$PATCH"; then
10171     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10174 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10175 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10176     if test -z "$with_gnu_patch"; then
10177         GNUPATCH=$PATCH
10178     else
10179         if test -x "$with_gnu_patch"; then
10180             GNUPATCH=$with_gnu_patch
10181         else
10182             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10183         fi
10184     fi
10186     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10187     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10188         AC_MSG_RESULT([yes])
10189     else
10190         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10191     fi
10192 else
10193     GNUPATCH=$PATCH
10196 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10197     GNUPATCH=`cygpath -m $GNUPATCH`
10200 dnl We also need to check for --with-gnu-cp
10202 if test -z "$with_gnu_cp"; then
10203     # check the place where the good stuff is hidden on Solaris...
10204     if test -x /usr/gnu/bin/cp; then
10205         GNUCP=/usr/gnu/bin/cp
10206     else
10207         AC_PATH_PROGS(GNUCP, gnucp cp)
10208     fi
10209     if test -z $GNUCP; then
10210         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10211     fi
10212 else
10213     if test -x "$with_gnu_cp"; then
10214         GNUCP=$with_gnu_cp
10215     else
10216         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10217     fi
10220 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10221     GNUCP=`cygpath -m $GNUCP`
10224 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10225 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10226     AC_MSG_RESULT([yes])
10227 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10228     AC_MSG_RESULT([yes])
10229 else
10230     case "$build_os" in
10231     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10232         x_GNUCP=[\#]
10233         GNUCP=''
10234         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10235         ;;
10236     *)
10237         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10238         ;;
10239     esac
10242 AC_SUBST(GNUPATCH)
10243 AC_SUBST(GNUCP)
10244 AC_SUBST(x_GNUCP)
10246 dnl ***************************************
10247 dnl testing assembler path
10248 dnl ***************************************
10249 ML_EXE=""
10250 if test "$_os" = "WINNT"; then
10251     if test "$BITNESS_OVERRIDE" = ""; then
10252         assembler=ml.exe
10253         assembler_bin=$CL_DIR
10254     else
10255         assembler=ml64.exe
10256         assembler_bin=$CL_DIR
10257     fi
10259     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10260     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10261         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10262         AC_MSG_RESULT([found])
10263         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10264     else
10265         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10266     fi
10268     PathFormat "$ASM_HOME"
10269     ASM_HOME="$formatted_path"
10270 else
10271     ASM_HOME=""
10274 AC_SUBST(ML_EXE)
10276 dnl ===================================================================
10277 dnl We need zip and unzip
10278 dnl ===================================================================
10279 AC_PATH_PROG(ZIP, zip)
10280 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10281 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10282     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],,)
10285 AC_PATH_PROG(UNZIP, unzip)
10286 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10288 dnl ===================================================================
10289 dnl Zip must be a specific type for different build types.
10290 dnl ===================================================================
10291 if test $build_os = cygwin; then
10292     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10293         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10294     fi
10297 dnl ===================================================================
10298 dnl We need touch with -h option support.
10299 dnl ===================================================================
10300 AC_PATH_PROG(TOUCH, touch)
10301 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10302 touch warn
10303 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10304     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],,)
10307 dnl ===================================================================
10308 dnl Check for system epoxy
10309 dnl ===================================================================
10310 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10312 dnl ===================================================================
10313 dnl Set vcl option: coordinate device in double or sal_Int32
10314 dnl ===================================================================
10316 dnl disabled for now, we don't want subtle differences between OSs
10317 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10318 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10319 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10320 dnl     AC_MSG_RESULT([double])
10321 dnl else
10322 dnl     AC_MSG_RESULT([sal_Int32])
10323 dnl fi
10325 dnl ===================================================================
10326 dnl Test which vclplugs have to be built.
10327 dnl ===================================================================
10328 R=""
10329 if test "$USING_X11" != TRUE; then
10330     enable_gtk=no
10331     enable_gtk3=no
10333 GTK3_CFLAGS=""
10334 GTK3_LIBS=""
10335 ENABLE_GTK3=""
10336 if test "x$enable_gtk3" = "xyes"; then
10337     if test "$with_system_cairo" = no; then
10338         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10339     fi
10340     : ${with_system_cairo:=yes}
10341     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="")
10342     if test "x$ENABLE_GTK3" = "xTRUE"; then
10343         R="gtk3"
10344         dnl Avoid installed by unpackaged files for now.
10345         if test -z "$PKGFORMAT"; then
10346             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10347         fi
10348     else
10349         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10350     fi
10351     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10352     FilterLibs "${GTK3_LIBS}"
10353     GTK3_LIBS="${filteredlibs}"
10355     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10356     if test "$with_system_epoxy" != "yes"; then
10357         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10358         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10359                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10360     fi
10362 AC_SUBST(GTK3_LIBS)
10363 AC_SUBST(GTK3_CFLAGS)
10364 AC_SUBST(ENABLE_GTK3)
10366 ENABLE_GTK=""
10367 if test "x$enable_gtk" = "xyes"; then
10368     if test "$with_system_cairo" = no; then
10369         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10370     fi
10371     : ${with_system_cairo:=yes}
10372     ENABLE_GTK="TRUE"
10373     AC_DEFINE(ENABLE_GTK)
10374     R="gtk $R"
10376 AC_SUBST(ENABLE_GTK)
10378 ENABLE_QT5=""
10379 if test "x$enable_qt5" = "xyes"; then
10380     ENABLE_QT5="TRUE"
10381     AC_DEFINE(ENABLE_QT5)
10382     R="$R qt5"
10384 AC_SUBST(ENABLE_QT5)
10386 ENABLE_KDE5=""
10387 if test "x$enable_kde5" = "xyes"; then
10388     ENABLE_KDE5="TRUE"
10389     AC_DEFINE(ENABLE_KDE5)
10390     R="$R kde5"
10392 AC_SUBST(ENABLE_KDE5)
10394 ENABLE_GTK3_KDE5=""
10395 if test "x$enable_gtk3_kde5" = "xyes"; then
10396     ENABLE_GTK3_KDE5="TRUE"
10397     AC_DEFINE(ENABLE_GTK3_KDE5)
10398     R="$R gtk3_kde5"
10400 AC_SUBST(ENABLE_GTK3_KDE5)
10402 build_vcl_plugins="$R"
10403 if test -z "$build_vcl_plugins"; then
10404     build_vcl_plugins="none"
10406 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10408 dnl ===================================================================
10409 dnl check for dbus support
10410 dnl ===================================================================
10411 ENABLE_DBUS=""
10412 DBUS_CFLAGS=""
10413 DBUS_LIBS=""
10414 DBUS_GLIB_CFLAGS=""
10415 DBUS_GLIB_LIBS=""
10416 DBUS_HAVE_GLIB=""
10418 if test "$enable_dbus" = "no"; then
10419     test_dbus=no
10422 AC_MSG_CHECKING([whether to enable DBUS support])
10423 if test "$test_dbus" = "yes"; then
10424     ENABLE_DBUS="TRUE"
10425     AC_MSG_RESULT([yes])
10426     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10427     AC_DEFINE(ENABLE_DBUS)
10428     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10429     FilterLibs "${DBUS_LIBS}"
10430     DBUS_LIBS="${filteredlibs}"
10432     # Glib is needed for BluetoothServer
10433     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10434     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10435         [
10436             DBUS_HAVE_GLIB="TRUE"
10437             AC_DEFINE(DBUS_HAVE_GLIB,1)
10438         ],
10439         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10440     )
10441 else
10442     AC_MSG_RESULT([no])
10445 AC_SUBST(ENABLE_DBUS)
10446 AC_SUBST(DBUS_CFLAGS)
10447 AC_SUBST(DBUS_LIBS)
10448 AC_SUBST(DBUS_GLIB_CFLAGS)
10449 AC_SUBST(DBUS_GLIB_LIBS)
10450 AC_SUBST(DBUS_HAVE_GLIB)
10452 AC_MSG_CHECKING([whether to enable Impress remote control])
10453 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10454     AC_MSG_RESULT([yes])
10455     ENABLE_SDREMOTE=TRUE
10456     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10458     # If not explicitly enabled or disabled, default
10459     if test -z "$enable_sdremote_bluetooth"; then
10460         case "$OS" in
10461         LINUX|MACOSX|WNT)
10462             # Default to yes for these
10463             enable_sdremote_bluetooth=yes
10464             ;;
10465         *)
10466             # otherwise no
10467             enable_sdremote_bluetooth=no
10468             ;;
10469         esac
10470     fi
10471     # $enable_sdremote_bluetooth is guaranteed non-empty now
10473     if test "$enable_sdremote_bluetooth" != "no"; then
10474         if test "$OS" = "LINUX"; then
10475             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10476                 AC_MSG_RESULT([yes])
10477                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10478                 dnl ===================================================================
10479                 dnl Check for system bluez
10480                 dnl ===================================================================
10481                 AC_MSG_CHECKING([which Bluetooth header to use])
10482                 if test "$with_system_bluez" = "yes"; then
10483                     AC_MSG_RESULT([external])
10484                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10485                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10486                     SYSTEM_BLUEZ=TRUE
10487                 else
10488                     AC_MSG_RESULT([internal])
10489                     SYSTEM_BLUEZ=
10490                 fi
10491             else
10492                 AC_MSG_RESULT([no, dbus disabled])
10493                 ENABLE_SDREMOTE_BLUETOOTH=
10494                 SYSTEM_BLUEZ=
10495             fi
10496         else
10497             AC_MSG_RESULT([yes])
10498             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10499             SYSTEM_BLUEZ=
10500         fi
10501     else
10502         AC_MSG_RESULT([no])
10503         ENABLE_SDREMOTE_BLUETOOTH=
10504         SYSTEM_BLUEZ=
10505     fi
10506 else
10507     ENABLE_SDREMOTE=
10508     SYSTEM_BLUEZ=
10509     AC_MSG_RESULT([no])
10511 AC_SUBST(ENABLE_SDREMOTE)
10512 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10513 AC_SUBST(SYSTEM_BLUEZ)
10515 dnl ===================================================================
10516 dnl Check whether the gtk 2.0 libraries are available.
10517 dnl ===================================================================
10519 GTK_CFLAGS=""
10520 GTK_LIBS=""
10521 if test  "$test_gtk" = "yes"; then
10523     if test "$ENABLE_GTK" = "TRUE"; then
10524         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]))
10525         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10526         FilterLibs "${GTK_LIBS}"
10527         GTK_LIBS="${filteredlibs}"
10528         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]))
10529         BUILD_TYPE="$BUILD_TYPE GTK"
10530         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10531         FilterLibs "${GTHREAD_LIBS}"
10532         GTHREAD_LIBS="${filteredlibs}"
10534         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10535         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10536                           [ENABLE_GTK_PRINT="TRUE"],
10537                           [ENABLE_GTK_PRINT=""])
10538         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10539         FilterLibs "${GTK_PRINT_LIBS}"
10540         GTK_PRINT_LIBS="${filteredlibs}"
10541     fi
10543     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10544         AC_MSG_CHECKING([whether to enable GIO support])
10545         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10546             dnl Need at least 2.26 for the dbus support.
10547             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10548                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10549             if test "$ENABLE_GIO" = "TRUE"; then
10550                 AC_DEFINE(ENABLE_GIO)
10551                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10552                 FilterLibs "${GIO_LIBS}"
10553                 GIO_LIBS="${filteredlibs}"
10554             fi
10555         else
10556             AC_MSG_RESULT([no])
10557         fi
10558     fi
10560 AC_SUBST(ENABLE_GIO)
10561 AC_SUBST(GIO_CFLAGS)
10562 AC_SUBST(GIO_LIBS)
10563 AC_SUBST(GTK_CFLAGS)
10564 AC_SUBST(GTK_LIBS)
10565 AC_SUBST(GTHREAD_CFLAGS)
10566 AC_SUBST(GTHREAD_LIBS)
10567 AC_SUBST([ENABLE_GTK_PRINT])
10568 AC_SUBST([GTK_PRINT_CFLAGS])
10569 AC_SUBST([GTK_PRINT_LIBS])
10572 dnl ===================================================================
10574 SPLIT_APP_MODULES=""
10575 if test "$enable_split_app_modules" = "yes"; then
10576     SPLIT_APP_MODULES="TRUE"
10578 AC_SUBST(SPLIT_APP_MODULES)
10580 SPLIT_OPT_FEATURES=""
10581 if test "$enable_split_opt_features" = "yes"; then
10582     SPLIT_OPT_FEATURES="TRUE"
10584 AC_SUBST(SPLIT_OPT_FEATURES)
10586 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10587     if test "$enable_cairo_canvas" = yes; then
10588         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10589     fi
10590     enable_cairo_canvas=no
10591 elif test -z "$enable_cairo_canvas"; then
10592     enable_cairo_canvas=yes
10595 ENABLE_CAIRO_CANVAS=""
10596 if test "$enable_cairo_canvas" = "yes"; then
10597     test_cairo=yes
10598     ENABLE_CAIRO_CANVAS="TRUE"
10599     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10601 AC_SUBST(ENABLE_CAIRO_CANVAS)
10603 dnl ===================================================================
10604 dnl Check whether the GStreamer libraries are available.
10605 dnl It's possible to build avmedia with both GStreamer backends!
10606 dnl ===================================================================
10608 ENABLE_GSTREAMER_1_0=""
10610 if test "$build_gstreamer_1_0" = "yes"; then
10612     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10613     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10614         ENABLE_GSTREAMER_1_0="TRUE"
10615         AC_MSG_RESULT([yes])
10616         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10617         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10618         FilterLibs "${GSTREAMER_1_0_LIBS}"
10619         GSTREAMER_1_0_LIBS="${filteredlibs}"
10620     else
10621         AC_MSG_RESULT([no])
10622     fi
10624 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10625 AC_SUBST(GSTREAMER_1_0_LIBS)
10626 AC_SUBST(ENABLE_GSTREAMER_1_0)
10629 ENABLE_GSTREAMER_0_10=""
10630 if test "$build_gstreamer_0_10" = "yes"; then
10632     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10633     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10634         ENABLE_GSTREAMER_0_10="TRUE"
10635         AC_MSG_RESULT([yes])
10636         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10637             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10638         ])
10639         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10640         FilterLibs "${GSTREAMER_0_10_LIBS}"
10641         GSTREAMER_0_10_LIBS="${filteredlibs}"
10642     else
10643         AC_MSG_RESULT([no])
10644     fi
10647 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10648 AC_SUBST(GSTREAMER_0_10_LIBS)
10649 AC_SUBST(ENABLE_GSTREAMER_0_10)
10651 dnl ===================================================================
10652 dnl Check whether to build the VLC avmedia backend
10653 dnl ===================================================================
10655 ENABLE_VLC=""
10657 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10658 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10659     ENABLE_VLC="TRUE"
10660     AC_MSG_RESULT([yes])
10661 else
10662     AC_MSG_RESULT([no])
10664 AC_SUBST(ENABLE_VLC)
10666 ENABLE_OPENGL_TRANSITIONS=
10667 ENABLE_OPENGL_CANVAS=
10668 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10669    : # disable
10670 elif test "$_os" = "Darwin"; then
10671     # We use frameworks on macOS, no need for detail checks
10672     ENABLE_OPENGL_TRANSITIONS=TRUE
10673     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10674     ENABLE_OPENGL_CANVAS=TRUE
10675 elif test $_os = WINNT; then
10676     ENABLE_OPENGL_TRANSITIONS=TRUE
10677     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10678     ENABLE_OPENGL_CANVAS=TRUE
10679 else
10680     if test "$USING_X11" = TRUE; then
10681         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10682         ENABLE_OPENGL_TRANSITIONS=TRUE
10683         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10684         ENABLE_OPENGL_CANVAS=TRUE
10685     fi
10688 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10689 AC_SUBST(ENABLE_OPENGL_CANVAS)
10691 dnl =================================================
10692 dnl Check whether to build with OpenCL support.
10693 dnl =================================================
10695 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10696     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10697     # platform (optional at run-time, used through clew).
10698     BUILD_TYPE="$BUILD_TYPE OPENCL"
10699     AC_DEFINE(HAVE_FEATURE_OPENCL)
10702 dnl =================================================
10703 dnl Check whether to build with dconf support.
10704 dnl =================================================
10706 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10707     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10708         if test "$enable_dconf" = yes; then
10709             AC_MSG_ERROR([dconf not found])
10710         else
10711             enable_dconf=no
10712         fi])
10714 AC_MSG_CHECKING([whether to enable dconf])
10715 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10716     DCONF_CFLAGS=
10717     DCONF_LIBS=
10718     ENABLE_DCONF=
10719     AC_MSG_RESULT([no])
10720 else
10721     ENABLE_DCONF=TRUE
10722     AC_DEFINE(ENABLE_DCONF)
10723     AC_MSG_RESULT([yes])
10725 AC_SUBST([DCONF_CFLAGS])
10726 AC_SUBST([DCONF_LIBS])
10727 AC_SUBST([ENABLE_DCONF])
10729 # pdf import?
10730 AC_MSG_CHECKING([whether to build the PDF import feature])
10731 ENABLE_PDFIMPORT=
10732 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10733     AC_MSG_RESULT([yes])
10734     ENABLE_PDFIMPORT=TRUE
10735     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10736 else
10737     AC_MSG_RESULT([no])
10740 # Pdfium?
10741 AC_MSG_CHECKING([whether to build PDFium])
10742 ENABLE_PDFIUM=
10743 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10744     AC_MSG_RESULT([yes])
10745     ENABLE_PDFIUM=TRUE
10746     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10747     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10748 else
10749     AC_MSG_RESULT([no])
10751 AC_SUBST(ENABLE_PDFIUM)
10753 dnl ===================================================================
10754 dnl Check for poppler
10755 dnl ===================================================================
10756 ENABLE_POPPLER=
10757 AC_MSG_CHECKING([whether to build Poppler])
10758 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10759     AC_MSG_RESULT([yes])
10760     ENABLE_POPPLER=TRUE
10761     AC_DEFINE(HAVE_FEATURE_POPPLER)
10762 else
10763     AC_MSG_RESULT([no])
10765 AC_SUBST(ENABLE_POPPLER)
10767 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10768     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10771 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10772     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10775 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10776     dnl ===================================================================
10777     dnl Check for system poppler
10778     dnl ===================================================================
10779     AC_MSG_CHECKING([which PDF import poppler to use])
10780     if test "$with_system_poppler" = "yes"; then
10781         AC_MSG_RESULT([external])
10782         SYSTEM_POPPLER=TRUE
10783         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10784         AC_LANG_PUSH([C++])
10785         save_CXXFLAGS=$CXXFLAGS
10786         save_CPPFLAGS=$CPPFLAGS
10787         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10788         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10789         AC_CHECK_HEADER([cpp/poppler-version.h],
10790             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10791             [])
10792         CXXFLAGS=$save_CXXFLAGS
10793         CPPFLAGS=$save_CPPFLAGS
10794         AC_LANG_POP([C++])
10795         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10797         FilterLibs "${POPPLER_LIBS}"
10798         POPPLER_LIBS="${filteredlibs}"
10799     else
10800         AC_MSG_RESULT([internal])
10801         SYSTEM_POPPLER=
10802         BUILD_TYPE="$BUILD_TYPE POPPLER"
10803         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10804     fi
10805     AC_DEFINE([ENABLE_PDFIMPORT],1)
10807 AC_SUBST(ENABLE_PDFIMPORT)
10808 AC_SUBST(SYSTEM_POPPLER)
10809 AC_SUBST(POPPLER_CFLAGS)
10810 AC_SUBST(POPPLER_LIBS)
10812 SYSTEM_GPGMEPP=
10814 if test "$build_for_ios" = "YES"; then
10815     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10816     AC_MSG_RESULT([yes])
10817 elif test "$enable_mpl_subset" = "yes"; then
10818     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10819     AC_MSG_RESULT([yes])
10820 elif test "$enable_fuzzers" = "yes"; then
10821     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10822     AC_MSG_RESULT([yes])
10823 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10824     dnl ===================================================================
10825     dnl Check for system gpgme
10826     dnl ===================================================================
10827     AC_MSG_CHECKING([which gpgmepp to use])
10828     if test "$with_system_gpgmepp" = "yes"; then
10829         AC_MSG_RESULT([external])
10830         SYSTEM_GPGMEPP=TRUE
10832         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10833         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10834             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10835         # progress_callback is the only func with plain C linkage
10836         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10837         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10838             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10839         AC_CHECK_HEADER(gpgme.h, [],
10840             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10841     else
10842         AC_MSG_RESULT([internal])
10843         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10844         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10846         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10847         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10848         if test "$_os" != "WINNT"; then
10849             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10850             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10851         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10852             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10853         fi
10854     fi
10855     ENABLE_GPGMEPP=TRUE
10856     AC_DEFINE([HAVE_FEATURE_GPGME])
10857     AC_PATH_PROG(GPG, gpg)
10858     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10859     # so let's exclude that manually for the moment
10860     if test -n "$GPG" -a "$_os" != "WINNT"; then
10861         # make sure we not only have a working gpgme, but a full working
10862         # gpg installation to run OpenPGP signature verification
10863         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10864     fi
10865     if test "$_os" = "Linux"; then
10866       uid=`id -u`
10867       AC_MSG_CHECKING([for /run/user/$uid])
10868       if test -d /run/user/$uid; then
10869         AC_MSG_RESULT([yes])
10870         AC_PATH_PROG(GPGCONF, gpgconf)
10872         # Older versions of gpgconf are not working as expected, since
10873         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10874         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10875         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10876         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10877         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10878         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10879         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10880           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10881           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10882           if $GPGCONF --dump-options > /dev/null ; then
10883             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10884               AC_MSG_RESULT([yes])
10885               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10886               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10887             else
10888               AC_MSG_RESULT([no])
10889             fi
10890           else
10891             AC_MSG_RESULT([no. missing or broken gpgconf?])
10892           fi
10893         else
10894           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10895         fi
10896       else
10897         AC_MSG_RESULT([no])
10898      fi
10899    fi
10901 AC_SUBST(ENABLE_GPGMEPP)
10902 AC_SUBST(SYSTEM_GPGMEPP)
10903 AC_SUBST(GPG_ERROR_CFLAGS)
10904 AC_SUBST(GPG_ERROR_LIBS)
10905 AC_SUBST(LIBASSUAN_CFLAGS)
10906 AC_SUBST(LIBASSUAN_LIBS)
10907 AC_SUBST(GPGMEPP_CFLAGS)
10908 AC_SUBST(GPGMEPP_LIBS)
10910 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10911 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10912     AC_MSG_RESULT([yes])
10913     ENABLE_MEDIAWIKI=TRUE
10914     BUILD_TYPE="$BUILD_TYPE XSLTML"
10915     if test  "x$with_java" = "xno"; then
10916         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10917     fi
10918 else
10919     AC_MSG_RESULT([no])
10920     ENABLE_MEDIAWIKI=
10921     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10923 AC_SUBST(ENABLE_MEDIAWIKI)
10925 AC_MSG_CHECKING([whether to build the Report Builder])
10926 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10927     AC_MSG_RESULT([yes])
10928     ENABLE_REPORTBUILDER=TRUE
10929     AC_MSG_CHECKING([which jfreereport libs to use])
10930     if test "$with_system_jfreereport" = "yes"; then
10931         SYSTEM_JFREEREPORT=TRUE
10932         AC_MSG_RESULT([external])
10933         if test -z $SAC_JAR; then
10934             SAC_JAR=/usr/share/java/sac.jar
10935         fi
10936         if ! test -f $SAC_JAR; then
10937              AC_MSG_ERROR(sac.jar not found.)
10938         fi
10940         if test -z $LIBXML_JAR; then
10941             if test -f /usr/share/java/libxml-1.0.0.jar; then
10942                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10943             elif test -f /usr/share/java/libxml.jar; then
10944                 LIBXML_JAR=/usr/share/java/libxml.jar
10945             else
10946                 AC_MSG_ERROR(libxml.jar replacement not found.)
10947             fi
10948         elif ! test -f $LIBXML_JAR; then
10949             AC_MSG_ERROR(libxml.jar not found.)
10950         fi
10952         if test -z $FLUTE_JAR; then
10953             if test -f/usr/share/java/flute-1.3.0.jar; then
10954                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10955             elif test -f /usr/share/java/flute.jar; then
10956                 FLUTE_JAR=/usr/share/java/flute.jar
10957             else
10958                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10959             fi
10960         elif ! test -f $FLUTE_JAR; then
10961             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10962         fi
10964         if test -z $JFREEREPORT_JAR; then
10965             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10966                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10967             elif test -f /usr/share/java/flow-engine.jar; then
10968                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10969             else
10970                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10971             fi
10972         elif ! test -f  $JFREEREPORT_JAR; then
10973                 AC_MSG_ERROR(jfreereport.jar not found.)
10974         fi
10976         if test -z $LIBLAYOUT_JAR; then
10977             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10978                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10979             elif test -f /usr/share/java/liblayout.jar; then
10980                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10981             else
10982                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10983             fi
10984         elif ! test -f $LIBLAYOUT_JAR; then
10985                 AC_MSG_ERROR(liblayout.jar not found.)
10986         fi
10988         if test -z $LIBLOADER_JAR; then
10989             if test -f /usr/share/java/libloader-1.0.0.jar; then
10990                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10991             elif test -f /usr/share/java/libloader.jar; then
10992                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10993             else
10994                 AC_MSG_ERROR(libloader.jar replacement not found.)
10995             fi
10996         elif ! test -f  $LIBLOADER_JAR; then
10997             AC_MSG_ERROR(libloader.jar not found.)
10998         fi
11000         if test -z $LIBFORMULA_JAR; then
11001             if test -f /usr/share/java/libformula-0.2.0.jar; then
11002                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11003             elif test -f /usr/share/java/libformula.jar; then
11004                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11005             else
11006                 AC_MSG_ERROR(libformula.jar replacement not found.)
11007             fi
11008         elif ! test -f $LIBFORMULA_JAR; then
11009                 AC_MSG_ERROR(libformula.jar not found.)
11010         fi
11012         if test -z $LIBREPOSITORY_JAR; then
11013             if test -f /usr/share/java/librepository-1.0.0.jar; then
11014                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11015             elif test -f /usr/share/java/librepository.jar; then
11016                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11017             else
11018                 AC_MSG_ERROR(librepository.jar replacement not found.)
11019             fi
11020         elif ! test -f $LIBREPOSITORY_JAR; then
11021             AC_MSG_ERROR(librepository.jar not found.)
11022         fi
11024         if test -z $LIBFONTS_JAR; then
11025             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11026                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11027             elif test -f /usr/share/java/libfonts.jar; then
11028                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11029             else
11030                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11031             fi
11032         elif ! test -f $LIBFONTS_JAR; then
11033                 AC_MSG_ERROR(libfonts.jar not found.)
11034         fi
11036         if test -z $LIBSERIALIZER_JAR; then
11037             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11038                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11039             elif test -f /usr/share/java/libserializer.jar; then
11040                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11041             else
11042                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11043             fi
11044         elif ! test -f $LIBSERIALIZER_JAR; then
11045                 AC_MSG_ERROR(libserializer.jar not found.)
11046         fi
11048         if test -z $LIBBASE_JAR; then
11049             if test -f /usr/share/java/libbase-1.0.0.jar; then
11050                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11051             elif test -f /usr/share/java/libbase.jar; then
11052                 LIBBASE_JAR=/usr/share/java/libbase.jar
11053             else
11054                 AC_MSG_ERROR(libbase.jar replacement not found.)
11055             fi
11056         elif ! test -f $LIBBASE_JAR; then
11057             AC_MSG_ERROR(libbase.jar not found.)
11058         fi
11060     else
11061         AC_MSG_RESULT([internal])
11062         SYSTEM_JFREEREPORT=
11063         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11064         NEED_ANT=TRUE
11065     fi
11066 else
11067     AC_MSG_RESULT([no])
11068     ENABLE_REPORTBUILDER=
11069     SYSTEM_JFREEREPORT=
11071 AC_SUBST(ENABLE_REPORTBUILDER)
11072 AC_SUBST(SYSTEM_JFREEREPORT)
11073 AC_SUBST(SAC_JAR)
11074 AC_SUBST(LIBXML_JAR)
11075 AC_SUBST(FLUTE_JAR)
11076 AC_SUBST(JFREEREPORT_JAR)
11077 AC_SUBST(LIBBASE_JAR)
11078 AC_SUBST(LIBLAYOUT_JAR)
11079 AC_SUBST(LIBLOADER_JAR)
11080 AC_SUBST(LIBFORMULA_JAR)
11081 AC_SUBST(LIBREPOSITORY_JAR)
11082 AC_SUBST(LIBFONTS_JAR)
11083 AC_SUBST(LIBSERIALIZER_JAR)
11085 # this has to be here because both the Wiki Publisher and the SRB use
11086 # commons-logging
11087 COMMONS_LOGGING_VERSION=1.2
11088 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11089     AC_MSG_CHECKING([which Apache commons-* libs to use])
11090     if test "$with_system_apache_commons" = "yes"; then
11091         SYSTEM_APACHE_COMMONS=TRUE
11092         AC_MSG_RESULT([external])
11093         if test -z $COMMONS_LOGGING_JAR; then
11094             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11095                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11096            elif test -f /usr/share/java/commons-logging.jar; then
11097                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11098             else
11099                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11100             fi
11101         elif ! test -f $COMMONS_LOGGING_JAR; then
11102             AC_MSG_ERROR(commons-logging.jar not found.)
11103         fi
11104     else
11105         AC_MSG_RESULT([internal])
11106         SYSTEM_APACHE_COMMONS=
11107         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11108         NEED_ANT=TRUE
11109     fi
11111 AC_SUBST(SYSTEM_APACHE_COMMONS)
11112 AC_SUBST(COMMONS_LOGGING_JAR)
11113 AC_SUBST(COMMONS_LOGGING_VERSION)
11115 # scripting provider for BeanShell?
11116 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11117 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11118     AC_MSG_RESULT([yes])
11119     ENABLE_SCRIPTING_BEANSHELL=TRUE
11121     dnl ===================================================================
11122     dnl Check for system beanshell
11123     dnl ===================================================================
11124     AC_MSG_CHECKING([which beanshell to use])
11125     if test "$with_system_beanshell" = "yes"; then
11126         AC_MSG_RESULT([external])
11127         SYSTEM_BSH=TRUE
11128         if test -z $BSH_JAR; then
11129             BSH_JAR=/usr/share/java/bsh.jar
11130         fi
11131         if ! test -f $BSH_JAR; then
11132             AC_MSG_ERROR(bsh.jar not found.)
11133         fi
11134     else
11135         AC_MSG_RESULT([internal])
11136         SYSTEM_BSH=
11137         BUILD_TYPE="$BUILD_TYPE BSH"
11138     fi
11139 else
11140     AC_MSG_RESULT([no])
11141     ENABLE_SCRIPTING_BEANSHELL=
11142     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11144 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11145 AC_SUBST(SYSTEM_BSH)
11146 AC_SUBST(BSH_JAR)
11148 # scripting provider for JavaScript?
11149 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11150 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11151     AC_MSG_RESULT([yes])
11152     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11154     dnl ===================================================================
11155     dnl Check for system rhino
11156     dnl ===================================================================
11157     AC_MSG_CHECKING([which rhino to use])
11158     if test "$with_system_rhino" = "yes"; then
11159         AC_MSG_RESULT([external])
11160         SYSTEM_RHINO=TRUE
11161         if test -z $RHINO_JAR; then
11162             RHINO_JAR=/usr/share/java/js.jar
11163         fi
11164         if ! test -f $RHINO_JAR; then
11165             AC_MSG_ERROR(js.jar not found.)
11166         fi
11167     else
11168         AC_MSG_RESULT([internal])
11169         SYSTEM_RHINO=
11170         BUILD_TYPE="$BUILD_TYPE RHINO"
11171         NEED_ANT=TRUE
11172     fi
11173 else
11174     AC_MSG_RESULT([no])
11175     ENABLE_SCRIPTING_JAVASCRIPT=
11176     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11178 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11179 AC_SUBST(SYSTEM_RHINO)
11180 AC_SUBST(RHINO_JAR)
11182 # This is only used in Qt5/KDE5 checks to determine if /usr/lib64
11183 # paths should be added to library search path. So lets put all 64-bit
11184 # platforms there.
11185 supports_multilib=
11186 case "$host_cpu" in
11187 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11188     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11189         supports_multilib="yes"
11190     fi
11191     ;;
11193     ;;
11194 esac
11196 dnl ===================================================================
11197 dnl QT5 Integration
11198 dnl ===================================================================
11200 QT5_CFLAGS=""
11201 QT5_LIBS=""
11202 QMAKE5="qmake"
11203 MOC5="moc"
11204 QT5_GLIB_CFLAGS=""
11205 QT5_GLIB_LIBS=""
11206 QT5_HAVE_GLIB=""
11207 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11208         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11209         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11210 then
11211     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11212     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11214     if test -n "$supports_multilib"; then
11215         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11216     fi
11218     qt5_test_include="QtWidgets/qapplication.h"
11219     qt5_test_library="libQt5Widgets.so"
11221     dnl Check for qmake5
11222     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11223     if test "$QMAKE5" = "no"; then
11224         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11225     else
11226         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11227         if test -z "$qmake5_test_ver"; then
11228             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11229         fi
11230         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11231         qt5_minimal_minor="6"
11232         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11233             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11234         else
11235             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11236         fi
11237     fi
11239     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11240     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11242     AC_MSG_CHECKING([for Qt5 headers])
11243     qt5_incdir="no"
11244     for inc_dir in $qt5_incdirs; do
11245         if test -r "$inc_dir/$qt5_test_include"; then
11246             qt5_incdir="$inc_dir"
11247             break
11248         fi
11249     done
11250     AC_MSG_RESULT([$qt5_incdir])
11251     if test "x$qt5_incdir" = "xno"; then
11252         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11253     fi
11255     AC_MSG_CHECKING([for Qt5 libraries])
11256     qt5_libdir="no"
11257     for lib_dir in $qt5_libdirs; do
11258         if test -r "$lib_dir/$qt5_test_library"; then
11259             qt5_libdir="$lib_dir"
11260             break
11261         fi
11262     done
11263     AC_MSG_RESULT([$qt5_libdir])
11264     if test "x$qt5_libdir" = "xno"; then
11265         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11266     fi
11268     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11269     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11270     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11272     dnl Check for Meta Object Compiler
11274     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11275     if test "$MOC5" = "no"; then
11276         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11277 the root of your Qt installation by exporting QT5DIR before running "configure".])
11278     fi
11280     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11281     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11282     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11283         [
11284             QT5_HAVE_GLIB=1
11285             AC_DEFINE(QT5_HAVE_GLIB,1)
11286         ],
11287         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11288     )
11290 AC_SUBST(QT5_CFLAGS)
11291 AC_SUBST(QT5_LIBS)
11292 AC_SUBST(MOC5)
11293 AC_SUBST(QT5_GLIB_CFLAGS)
11294 AC_SUBST(QT5_GLIB_LIBS)
11295 AC_SUBST(QT5_HAVE_GLIB)
11297 dnl ===================================================================
11298 dnl KDE5 Integration
11299 dnl ===================================================================
11301 KF5_CFLAGS=""
11302 KF5_LIBS=""
11303 KF5_CONFIG="kf5-config"
11304 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11305         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11306         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11307 then
11308     if test "$OS" = "HAIKU"; then
11309         haiku_arch="`echo $RTL_ARCH | tr X x`"
11310         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11311         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11312     fi
11314     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11315     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11316     if test -n "$supports_multilib"; then
11317         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11318     fi
11320     kf5_test_include="KF5/kcoreaddons_version.h"
11321     kf5_test_library="libKF5CoreAddons.so"
11322     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11324     dnl kf5 KDE4 support compatibility installed
11325     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11326     if test "$KF5_CONFIG" != "no"; then
11327         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11328         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11329     fi
11331     dnl Check for KF5 headers
11332     AC_MSG_CHECKING([for KF5 headers])
11333     kf5_incdir="no"
11334     for kf5_check in $kf5_incdirs; do
11335         if test -r "$kf5_check/$kf5_test_include"; then
11336             kf5_incdir="$kf5_check/KF5"
11337             break
11338         fi
11339     done
11340     AC_MSG_RESULT([$kf5_incdir])
11341     if test "x$kf5_incdir" = "xno"; then
11342         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11343     fi
11345     dnl Check for KF5 libraries
11346     AC_MSG_CHECKING([for KF5 libraries])
11347     kf5_libdir="no"
11348     for kf5_check in $kf5_libdirs; do
11349         if test -r "$kf5_check/$kf5_test_library"; then
11350             kf5_libdir="$kf5_check"
11351             break
11352         fi
11353     done
11355     AC_MSG_RESULT([$kf5_libdir])
11356     if test "x$kf5_libdir" = "xno"; then
11357         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11358     fi
11360     if test "$USING_X11" = TRUE; then
11361         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11362     fi
11364     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 $KF5_XCB_CFLAGS"
11365     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11366     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11368     if test "$USING_X11" = TRUE; then
11369         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11370     fi
11372     AC_LANG_PUSH([C++])
11373     save_CXXFLAGS=$CXXFLAGS
11374     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11375     AC_MSG_CHECKING([whether KDE is >= 5.0])
11376        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11377 #include <kcoreaddons_version.h>
11379 int main(int argc, char **argv) {
11380        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11381        else return 1;
11383        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11384     CXXFLAGS=$save_CXXFLAGS
11385     AC_LANG_POP([C++])
11387 AC_SUBST(KF5_CFLAGS)
11388 AC_SUBST(KF5_LIBS)
11390 dnl ===================================================================
11391 dnl Test whether to include Evolution 2 support
11392 dnl ===================================================================
11393 AC_MSG_CHECKING([whether to enable evolution 2 support])
11394 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11395     AC_MSG_RESULT([yes])
11396     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11397     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11398     FilterLibs "${GOBJECT_LIBS}"
11399     GOBJECT_LIBS="${filteredlibs}"
11400     ENABLE_EVOAB2="TRUE"
11401 else
11402     ENABLE_EVOAB2=""
11403     AC_MSG_RESULT([no])
11405 AC_SUBST(ENABLE_EVOAB2)
11406 AC_SUBST(GOBJECT_CFLAGS)
11407 AC_SUBST(GOBJECT_LIBS)
11409 dnl ===================================================================
11410 dnl Test which themes to include
11411 dnl ===================================================================
11412 AC_MSG_CHECKING([which themes to include])
11413 # if none given use default subset of available themes
11414 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11415     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_svg sifr_dark tango"
11418 WITH_THEMES=""
11419 if test "x$with_theme" != "xno"; then
11420     for theme in $with_theme; do
11421         case $theme in
11422         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11423         default) real_theme=colibre ;;
11424         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11425         esac
11426         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11427     done
11429 AC_MSG_RESULT([$WITH_THEMES])
11430 AC_SUBST([WITH_THEMES])
11431 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11432 for theme in $with_theme; do
11433     case $theme in
11434     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11435     *) ;;
11436     esac
11437 done
11439 dnl ===================================================================
11440 dnl Test whether to integrate helppacks into the product's installer
11441 dnl ===================================================================
11442 AC_MSG_CHECKING([for helppack integration])
11443 if test "$with_helppack_integration" = "no"; then
11444     AC_MSG_RESULT([no integration])
11445 else
11446     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11447     AC_MSG_RESULT([integration])
11450 ###############################################################################
11451 # Extensions checking
11452 ###############################################################################
11453 AC_MSG_CHECKING([for extensions integration])
11454 if test "x$enable_extension_integration" != "xno"; then
11455     WITH_EXTENSION_INTEGRATION=TRUE
11456     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11457     AC_MSG_RESULT([yes, use integration])
11458 else
11459     WITH_EXTENSION_INTEGRATION=
11460     AC_MSG_RESULT([no, do not integrate])
11462 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11464 dnl Should any extra extensions be included?
11465 dnl There are standalone tests for each of these below.
11466 WITH_EXTRA_EXTENSIONS=
11467 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11469 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11470 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11471 if test "x$with_java" != "xno"; then
11472     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11473     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11476 AC_MSG_CHECKING([whether to build opens___.ttf])
11477 if test "$enable_build_opensymbol" = "yes"; then
11478     AC_MSG_RESULT([yes])
11479     AC_PATH_PROG(FONTFORGE, fontforge)
11480     if test -z "$FONTFORGE"; then
11481         AC_MSG_ERROR([fontforge not installed])
11482     fi
11483 else
11484     AC_MSG_RESULT([no])
11485     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11486     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11488 AC_SUBST(OPENSYMBOL_TTF)
11489 AC_SUBST(FONTFORGE)
11491 dnl ===================================================================
11492 dnl Test whether to include fonts
11493 dnl ===================================================================
11494 AC_MSG_CHECKING([whether to include third-party fonts])
11495 if test "$with_fonts" != "no"; then
11496     AC_MSG_RESULT([yes])
11497     WITH_FONTS=TRUE
11498     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11499     AC_DEFINE(HAVE_MORE_FONTS)
11500 else
11501     AC_MSG_RESULT([no])
11502     WITH_FONTS=
11503     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11505 AC_SUBST(WITH_FONTS)
11508 dnl ===================================================================
11509 dnl Test whether to enable online update service
11510 dnl ===================================================================
11511 AC_MSG_CHECKING([whether to enable online update])
11512 ENABLE_ONLINE_UPDATE=
11513 ENABLE_ONLINE_UPDATE_MAR=
11514 UPDATE_CONFIG=
11515 if test "$enable_online_update" = ""; then
11516     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11517         AC_MSG_RESULT([yes])
11518         ENABLE_ONLINE_UPDATE="TRUE"
11519     else
11520         AC_MSG_RESULT([no])
11521     fi
11522 else
11523     if test "$enable_online_update" = "mar"; then
11524         AC_MSG_RESULT([yes - MAR-based online update])
11525         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11526         if test "$with_update_config" = ""; then
11527             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11528         fi
11529         UPDATE_CONFIG="$with_update_config"
11530         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11531     elif test "$enable_online_update" = "yes"; then
11532         AC_MSG_RESULT([yes])
11533         ENABLE_ONLINE_UPDATE="TRUE"
11534     else
11535         AC_MSG_RESULT([no])
11536     fi
11538 AC_SUBST(ENABLE_ONLINE_UPDATE)
11539 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11540 AC_SUBST(UPDATE_CONFIG)
11542 dnl ===================================================================
11543 dnl Test whether we need bzip2
11544 dnl ===================================================================
11545 SYSTEM_BZIP2=
11546 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11547     AC_MSG_CHECKING([whether to use system bzip2])
11548     if test "$with_system_bzip2" = yes; then
11549         SYSTEM_BZIP2=TRUE
11550         AC_MSG_RESULT([yes])
11551         PKG_CHECK_MODULES(BZIP2, bzip2)
11552         FilterLibs "${BZIP2_LIBS}"
11553         BZIP2_LIBS="${filteredlibs}"
11554     else
11555         AC_MSG_RESULT([no])
11556         BUILD_TYPE="$BUILD_TYPE BZIP2"
11557     fi
11559 AC_SUBST(SYSTEM_BZIP2)
11560 AC_SUBST(BZIP2_CFLAGS)
11561 AC_SUBST(BZIP2_LIBS)
11563 dnl ===================================================================
11564 dnl Test whether to enable extension update
11565 dnl ===================================================================
11566 AC_MSG_CHECKING([whether to enable extension update])
11567 ENABLE_EXTENSION_UPDATE=
11568 if test "x$enable_extension_update" = "xno"; then
11569     AC_MSG_RESULT([no])
11570 else
11571     AC_MSG_RESULT([yes])
11572     ENABLE_EXTENSION_UPDATE="TRUE"
11573     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11574     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11576 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11579 dnl ===================================================================
11580 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11581 dnl ===================================================================
11582 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11583 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11584     AC_MSG_RESULT([no])
11585     ENABLE_SILENT_MSI=
11586 else
11587     AC_MSG_RESULT([yes])
11588     ENABLE_SILENT_MSI=TRUE
11589     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11591 AC_SUBST(ENABLE_SILENT_MSI)
11593 AC_MSG_CHECKING([whether and how to use Xinerama])
11594 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11595     if test "$x_libraries" = "default_x_libraries"; then
11596         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11597         if test "x$XINERAMALIB" = x; then
11598            XINERAMALIB="/usr/lib"
11599         fi
11600     else
11601         XINERAMALIB="$x_libraries"
11602     fi
11603     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11604         # we have both versions, let the user decide but use the dynamic one
11605         # per default
11606         USE_XINERAMA=TRUE
11607         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11608             XINERAMA_LINK=dynamic
11609         else
11610             XINERAMA_LINK=static
11611         fi
11612     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11613         # we have only the dynamic version
11614         USE_XINERAMA=TRUE
11615         XINERAMA_LINK=dynamic
11616     elif test -e "$XINERAMALIB/libXinerama.a"; then
11617         # static version
11618         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11619             USE_XINERAMA=TRUE
11620             XINERAMA_LINK=static
11621         else
11622             USE_XINERAMA=
11623             XINERAMA_LINK=none
11624         fi
11625     else
11626         # no Xinerama
11627         USE_XINERAMA=
11628         XINERAMA_LINK=none
11629     fi
11630     if test "$USE_XINERAMA" = "TRUE"; then
11631         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11632         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11633             [AC_MSG_ERROR(Xinerama header not found.)], [])
11634         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11635         if test "x$XEXTLIB" = x; then
11636            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11637         fi
11638         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11639         if test "$_os" = "FreeBSD"; then
11640             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11641         fi
11642         if test "$_os" = "Linux"; then
11643             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11644         fi
11645         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11646             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11647     else
11648         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11649     fi
11650 else
11651     USE_XINERAMA=
11652     XINERAMA_LINK=none
11653     AC_MSG_RESULT([no])
11655 AC_SUBST(USE_XINERAMA)
11656 AC_SUBST(XINERAMA_LINK)
11658 dnl ===================================================================
11659 dnl Test whether to build cairo or rely on the system version
11660 dnl ===================================================================
11662 if test "$USING_X11" = TRUE; then
11663     # Used in vcl/Library_vclplug_gen.mk
11664     test_cairo=yes
11667 if test "$test_cairo" = "yes"; then
11668     AC_MSG_CHECKING([whether to use the system cairo])
11670     : ${with_system_cairo:=$with_system_libs}
11671     if test "$with_system_cairo" = "yes"; then
11672         SYSTEM_CAIRO=TRUE
11673         AC_MSG_RESULT([yes])
11675         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11676         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11677         FilterLibs "${CAIRO_LIBS}"
11678         CAIRO_LIBS="${filteredlibs}"
11680         if test "$test_xrender" = "yes"; then
11681             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11682             AC_LANG_PUSH([C])
11683             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11684 #ifdef PictStandardA8
11685 #else
11686       return fail;
11687 #endif
11688 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11690             AC_LANG_POP([C])
11691         fi
11692     else
11693         SYSTEM_CAIRO=
11694         AC_MSG_RESULT([no])
11696         BUILD_TYPE="$BUILD_TYPE CAIRO"
11697     fi
11700 AC_SUBST(SYSTEM_CAIRO)
11701 AC_SUBST(CAIRO_CFLAGS)
11702 AC_SUBST(CAIRO_LIBS)
11704 dnl ===================================================================
11705 dnl Test whether to use avahi
11706 dnl ===================================================================
11707 if test "$_os" = "WINNT"; then
11708     # Windows uses bundled mDNSResponder
11709     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11710 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11711     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11712                       [ENABLE_AVAHI="TRUE"])
11713     AC_DEFINE(HAVE_FEATURE_AVAHI)
11714     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11715     FilterLibs "${AVAHI_LIBS}"
11716     AVAHI_LIBS="${filteredlibs}"
11719 AC_SUBST(ENABLE_AVAHI)
11720 AC_SUBST(AVAHI_CFLAGS)
11721 AC_SUBST(AVAHI_LIBS)
11723 dnl ===================================================================
11724 dnl Test whether to use liblangtag
11725 dnl ===================================================================
11726 SYSTEM_LIBLANGTAG=
11727 AC_MSG_CHECKING([whether to use system liblangtag])
11728 if test "$with_system_liblangtag" = yes; then
11729     SYSTEM_LIBLANGTAG=TRUE
11730     AC_MSG_RESULT([yes])
11731     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11732     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11733     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11734     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11735     FilterLibs "${LIBLANGTAG_LIBS}"
11736     LIBLANGTAG_LIBS="${filteredlibs}"
11737 else
11738     SYSTEM_LIBLANGTAG=
11739     AC_MSG_RESULT([no])
11740     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11741     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11742     if test "$COM" = "MSC"; then
11743         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11744     else
11745         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11746     fi
11748 AC_SUBST(SYSTEM_LIBLANGTAG)
11749 AC_SUBST(LIBLANGTAG_CFLAGS)
11750 AC_SUBST(LIBLANGTAG_LIBS)
11752 dnl ===================================================================
11753 dnl Test whether to build libpng or rely on the system version
11754 dnl ===================================================================
11756 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11758 dnl ===================================================================
11759 dnl Check for runtime JVM search path
11760 dnl ===================================================================
11761 if test "$ENABLE_JAVA" != ""; then
11762     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11763     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11764         AC_MSG_RESULT([yes])
11765         if ! test -d "$with_jvm_path"; then
11766             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11767         fi
11768         if ! test -d "$with_jvm_path"jvm; then
11769             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11770         fi
11771         JVM_ONE_PATH_CHECK="$with_jvm_path"
11772         AC_SUBST(JVM_ONE_PATH_CHECK)
11773     else
11774         AC_MSG_RESULT([no])
11775     fi
11778 dnl ===================================================================
11779 dnl Test for the presence of Ant and that it works
11780 dnl ===================================================================
11782 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11783     ANT_HOME=; export ANT_HOME
11784     WITH_ANT_HOME=; export WITH_ANT_HOME
11785     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11786         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11787             if test "$_os" = "WINNT"; then
11788                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11789             else
11790                 with_ant_home="$LODE_HOME/opt/ant"
11791             fi
11792         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11793             with_ant_home="$LODE_HOME/opt/ant"
11794         fi
11795     fi
11796     if test -z "$with_ant_home"; then
11797         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11798     else
11799         if test "$_os" = "WINNT"; then
11800             # AC_PATH_PROGS needs unix path
11801             with_ant_home=`cygpath -u "$with_ant_home"`
11802         fi
11803         AbsolutePath "$with_ant_home"
11804         with_ant_home=$absolute_path
11805         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11806         WITH_ANT_HOME=$with_ant_home
11807         ANT_HOME=$with_ant_home
11808     fi
11810     if test -z "$ANT"; then
11811         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11812     else
11813         # resolve relative or absolute symlink
11814         while test -h "$ANT"; do
11815             a_cwd=`pwd`
11816             a_basename=`basename "$ANT"`
11817             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11818             cd "`dirname "$ANT"`"
11819             cd "`dirname "$a_script"`"
11820             ANT="`pwd`"/"`basename "$a_script"`"
11821             cd "$a_cwd"
11822         done
11824         AC_MSG_CHECKING([if $ANT works])
11825         mkdir -p conftest.dir
11826         a_cwd=$(pwd)
11827         cd conftest.dir
11828         cat > conftest.java << EOF
11829         public class conftest {
11830             int testmethod(int a, int b) {
11831                     return a + b;
11832             }
11833         }
11836         cat > conftest.xml << EOF
11837         <project name="conftest" default="conftest">
11838         <target name="conftest">
11839             <javac srcdir="." includes="conftest.java">
11840             </javac>
11841         </target>
11842         </project>
11845         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11846         if test $? = 0 -a -f ./conftest.class; then
11847             AC_MSG_RESULT([Ant works])
11848             if test -z "$WITH_ANT_HOME"; then
11849                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11850                 if test -z "$ANT_HOME"; then
11851                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11852                 fi
11853             else
11854                 ANT_HOME="$WITH_ANT_HOME"
11855             fi
11856         else
11857             echo "configure: Ant test failed" >&5
11858             cat conftest.java >&5
11859             cat conftest.xml >&5
11860             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11861         fi
11862         cd "$a_cwd"
11863         rm -fr conftest.dir
11864     fi
11865     if test -z "$ANT_HOME"; then
11866         ANT_HOME="NO_ANT_HOME"
11867     else
11868         PathFormat "$ANT_HOME"
11869         ANT_HOME="$formatted_path"
11870         PathFormat "$ANT"
11871         ANT="$formatted_path"
11872     fi
11873     AC_SUBST(ANT_HOME)
11874     AC_SUBST(ANT)
11876     dnl Checking for ant.jar
11877     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11878         AC_MSG_CHECKING([Ant lib directory])
11879         if test -f $ANT_HOME/lib/ant.jar; then
11880             ANT_LIB="$ANT_HOME/lib"
11881         else
11882             if test -f $ANT_HOME/ant.jar; then
11883                 ANT_LIB="$ANT_HOME"
11884             else
11885                 if test -f /usr/share/java/ant.jar; then
11886                     ANT_LIB=/usr/share/java
11887                 else
11888                     if test -f /usr/share/ant-core/lib/ant.jar; then
11889                         ANT_LIB=/usr/share/ant-core/lib
11890                     else
11891                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11892                             ANT_LIB="$ANT_HOME/lib/ant"
11893                         else
11894                             if test -f /usr/share/lib/ant/ant.jar; then
11895                                 ANT_LIB=/usr/share/lib/ant
11896                             else
11897                                 AC_MSG_ERROR([Ant libraries not found!])
11898                             fi
11899                         fi
11900                     fi
11901                 fi
11902             fi
11903         fi
11904         PathFormat "$ANT_LIB"
11905         ANT_LIB="$formatted_path"
11906         AC_MSG_RESULT([Ant lib directory found.])
11907     fi
11908     AC_SUBST(ANT_LIB)
11910     ant_minver=1.6.0
11911     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11913     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11914     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11915     ant_version_major=`echo $ant_version | cut -d. -f1`
11916     ant_version_minor=`echo $ant_version | cut -d. -f2`
11917     echo "configure: ant_version $ant_version " >&5
11918     echo "configure: ant_version_major $ant_version_major " >&5
11919     echo "configure: ant_version_minor $ant_version_minor " >&5
11920     if test "$ant_version_major" -ge "2"; then
11921         AC_MSG_RESULT([yes, $ant_version])
11922     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11923         AC_MSG_RESULT([yes, $ant_version])
11924     else
11925         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11926     fi
11928     rm -f conftest* core core.* *.core
11931 OOO_JUNIT_JAR=
11932 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11933     AC_MSG_CHECKING([for JUnit 4])
11934     if test "$with_junit" = "yes"; then
11935         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11936             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11937         elif test -e /usr/share/java/junit4.jar; then
11938             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11939         else
11940            if test -e /usr/share/lib/java/junit.jar; then
11941               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11942            else
11943               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11944            fi
11945         fi
11946     else
11947         OOO_JUNIT_JAR=$with_junit
11948     fi
11949     if test "$_os" = "WINNT"; then
11950         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11951     fi
11952     printf 'import org.junit.Before;' > conftest.java
11953     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11954         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11955     else
11956         AC_MSG_ERROR(
11957 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11958  specify its pathname via --with-junit=..., or disable it via --without-junit])
11959     fi
11960     rm -f conftest.class conftest.java
11961     if test $OOO_JUNIT_JAR != ""; then
11962     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11963     fi
11965 AC_SUBST(OOO_JUNIT_JAR)
11967 HAMCREST_JAR=
11968 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11969     AC_MSG_CHECKING([for included Hamcrest])
11970     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11971     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11972         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11973     else
11974         AC_MSG_RESULT([Not included])
11975         AC_MSG_CHECKING([for standalone hamcrest jar.])
11976         if test "$with_hamcrest" = "yes"; then
11977             if test -e /usr/share/lib/java/hamcrest.jar; then
11978                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11979             elif test -e /usr/share/java/hamcrest/core.jar; then
11980                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11981             else
11982                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11983             fi
11984         else
11985             HAMCREST_JAR=$with_hamcrest
11986         fi
11987         if test "$_os" = "WINNT"; then
11988             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11989         fi
11990         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11991             AC_MSG_RESULT([$HAMCREST_JAR])
11992         else
11993             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),
11994                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11995         fi
11996     fi
11997     rm -f conftest.class conftest.java
11999 AC_SUBST(HAMCREST_JAR)
12002 AC_SUBST(SCPDEFS)
12005 # check for wget and curl
12007 WGET=
12008 CURL=
12010 if test "$enable_fetch_external" != "no"; then
12012 CURL=`which curl 2>/dev/null`
12014 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12015     # wget new enough?
12016     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12017     if test $? -eq 0; then
12018         WGET=$i
12019         break
12020     fi
12021 done
12023 if test -z "$WGET" -a -z "$CURL"; then
12024     AC_MSG_ERROR([neither wget nor curl found!])
12029 AC_SUBST(WGET)
12030 AC_SUBST(CURL)
12033 # check for sha256sum
12035 SHA256SUM=
12037 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12038     eval "$i -a 256 --version" > /dev/null 2>&1
12039     ret=$?
12040     if test $ret -eq 0; then
12041         SHA256SUM="$i -a 256"
12042         break
12043     fi
12044 done
12046 if test -z "$SHA256SUM"; then
12047     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12048         eval "$i --version" > /dev/null 2>&1
12049         ret=$?
12050         if test $ret -eq 0; then
12051             SHA256SUM=$i
12052             break
12053         fi
12054     done
12057 if test -z "$SHA256SUM"; then
12058     AC_MSG_ERROR([no sha256sum found!])
12061 AC_SUBST(SHA256SUM)
12063 dnl ===================================================================
12064 dnl Dealing with l10n options
12065 dnl ===================================================================
12066 AC_MSG_CHECKING([which languages to be built])
12067 # get list of all languages
12068 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12069 # the sed command does the following:
12070 #   + if a line ends with a backslash, append the next line to it
12071 #   + adds " on the beginning of the value (after =)
12072 #   + adds " at the end of the value
12073 #   + removes en-US; we want to put it on the beginning
12074 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12075 [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)]
12076 ALL_LANGS="en-US $completelangiso"
12077 # check the configured localizations
12078 WITH_LANG="$with_lang"
12080 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12081 # (Norwegian is "nb" and "nn".)
12082 if test "$WITH_LANG" = "no"; then
12083     WITH_LANG=
12086 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12087     AC_MSG_RESULT([en-US])
12088 else
12089     AC_MSG_RESULT([$WITH_LANG])
12090     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12091     if test -z "$MSGFMT"; then
12092         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12093             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12094         elif test -x "/opt/lo/bin/msgfmt"; then
12095             MSGFMT="/opt/lo/bin/msgfmt"
12096         else
12097             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12098             if test -z "$MSGFMT"; then
12099                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12100             fi
12101         fi
12102     fi
12103     if test -z "$MSGUNIQ"; then
12104         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12105             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12106         elif test -x "/opt/lo/bin/msguniq"; then
12107             MSGUNIQ="/opt/lo/bin/msguniq"
12108         else
12109             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12110             if test -z "$MSGUNIQ"; then
12111                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12112             fi
12113         fi
12114     fi
12116 AC_SUBST(MSGFMT)
12117 AC_SUBST(MSGUNIQ)
12118 # check that the list is valid
12119 for lang in $WITH_LANG; do
12120     test "$lang" = "ALL" && continue
12121     # need to check for the exact string, so add space before and after the list of all languages
12122     for vl in $ALL_LANGS; do
12123         if test "$vl" = "$lang"; then
12124            break
12125         fi
12126     done
12127     if test "$vl" != "$lang"; then
12128         # if you're reading this - you prolly quoted your languages remove the quotes ...
12129         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12130     fi
12131 done
12132 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12133     echo $WITH_LANG | grep -q en-US
12134     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12136 # list with substituted ALL
12137 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12138 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12139 test "$WITH_LANG" = "en-US" && WITH_LANG=
12140 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12141     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12142     ALL_LANGS=`echo $ALL_LANGS qtz`
12144 AC_SUBST(ALL_LANGS)
12145 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12146 AC_SUBST(WITH_LANG)
12147 AC_SUBST(WITH_LANG_LIST)
12148 AC_SUBST(GIT_NEEDED_SUBMODULES)
12150 WITH_POOR_HELP_LOCALIZATIONS=
12151 if test -d "$SRC_ROOT/translations/source"; then
12152     for l in `ls -1 $SRC_ROOT/translations/source`; do
12153         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12154             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12155         fi
12156     done
12158 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12160 if test -n "$with_locales"; then
12161     WITH_LOCALES="$with_locales"
12163     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12164     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12165     # config_host/config_locales.h.in
12166     for locale in $WITH_LOCALES; do
12167         lang=${locale%_*}
12169         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12171         case $lang in
12172         hi|mr*ne)
12173             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12174             ;;
12175         bg|ru)
12176             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12177             ;;
12178         esac
12179     done
12180 else
12181     AC_DEFINE(WITH_LOCALE_ALL)
12183 AC_SUBST(WITH_LOCALES)
12185 dnl git submodule update --reference
12186 dnl ===================================================================
12187 if test -n "${GIT_REFERENCE_SRC}"; then
12188     for repo in ${GIT_NEEDED_SUBMODULES}; do
12189         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12190             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12191         fi
12192     done
12194 AC_SUBST(GIT_REFERENCE_SRC)
12196 dnl git submodules linked dirs
12197 dnl ===================================================================
12198 if test -n "${GIT_LINK_SRC}"; then
12199     for repo in ${GIT_NEEDED_SUBMODULES}; do
12200         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12201             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12202         fi
12203     done
12205 AC_SUBST(GIT_LINK_SRC)
12207 dnl branding
12208 dnl ===================================================================
12209 AC_MSG_CHECKING([for alternative branding images directory])
12210 # initialize mapped arrays
12211 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12212 brand_files="$BRAND_INTRO_IMAGES about.svg"
12214 if test -z "$with_branding" -o "$with_branding" = "no"; then
12215     AC_MSG_RESULT([none])
12216     DEFAULT_BRAND_IMAGES="$brand_files"
12217 else
12218     if ! test -d $with_branding ; then
12219         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12220     else
12221         AC_MSG_RESULT([$with_branding])
12222         CUSTOM_BRAND_DIR="$with_branding"
12223         for lfile in $brand_files
12224         do
12225             if ! test -f $with_branding/$lfile ; then
12226                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12227                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12228             else
12229                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12230             fi
12231         done
12232         check_for_progress="yes"
12233     fi
12235 AC_SUBST([BRAND_INTRO_IMAGES])
12236 AC_SUBST([CUSTOM_BRAND_DIR])
12237 AC_SUBST([CUSTOM_BRAND_IMAGES])
12238 AC_SUBST([DEFAULT_BRAND_IMAGES])
12241 AC_MSG_CHECKING([for 'intro' progress settings])
12242 PROGRESSBARCOLOR=
12243 PROGRESSSIZE=
12244 PROGRESSPOSITION=
12245 PROGRESSFRAMECOLOR=
12246 PROGRESSTEXTCOLOR=
12247 PROGRESSTEXTBASELINE=
12249 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12250     source "$with_branding/progress.conf"
12251     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12252 else
12253     AC_MSG_RESULT([none])
12256 AC_SUBST(PROGRESSBARCOLOR)
12257 AC_SUBST(PROGRESSSIZE)
12258 AC_SUBST(PROGRESSPOSITION)
12259 AC_SUBST(PROGRESSFRAMECOLOR)
12260 AC_SUBST(PROGRESSTEXTCOLOR)
12261 AC_SUBST(PROGRESSTEXTBASELINE)
12264 AC_MSG_CHECKING([for extra build ID])
12265 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12266     EXTRA_BUILDID="$with_extra_buildid"
12268 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12269 if test -n "$EXTRA_BUILDID" ; then
12270     AC_MSG_RESULT([$EXTRA_BUILDID])
12271 else
12272     AC_MSG_RESULT([not set])
12274 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12276 OOO_VENDOR=
12277 AC_MSG_CHECKING([for vendor])
12278 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12279     OOO_VENDOR="$USERNAME"
12281     if test -z "$OOO_VENDOR"; then
12282         OOO_VENDOR="$USER"
12283     fi
12285     if test -z "$OOO_VENDOR"; then
12286         OOO_VENDOR="`id -u -n`"
12287     fi
12289     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12290 else
12291     OOO_VENDOR="$with_vendor"
12292     AC_MSG_RESULT([$OOO_VENDOR])
12294 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12295 AC_SUBST(OOO_VENDOR)
12297 if test "$_os" = "Android" ; then
12298     ANDROID_PACKAGE_NAME=
12299     AC_MSG_CHECKING([for Android package name])
12300     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12301         if test -n "$ENABLE_DEBUG"; then
12302             # Default to the package name that makes ndk-gdb happy.
12303             ANDROID_PACKAGE_NAME="org.libreoffice"
12304         else
12305             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12306         fi
12308         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12309     else
12310         ANDROID_PACKAGE_NAME="$with_android_package_name"
12311         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12312     fi
12313     AC_SUBST(ANDROID_PACKAGE_NAME)
12316 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12317 if test "$with_compat_oowrappers" = "yes"; then
12318     WITH_COMPAT_OOWRAPPERS=TRUE
12319     AC_MSG_RESULT(yes)
12320 else
12321     WITH_COMPAT_OOWRAPPERS=
12322     AC_MSG_RESULT(no)
12324 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12326 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12327 AC_MSG_CHECKING([for install dirname])
12328 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12329     INSTALLDIRNAME="$with_install_dirname"
12331 AC_MSG_RESULT([$INSTALLDIRNAME])
12332 AC_SUBST(INSTALLDIRNAME)
12334 AC_MSG_CHECKING([for prefix])
12335 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12336 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12337 PREFIXDIR="$prefix"
12338 AC_MSG_RESULT([$PREFIXDIR])
12339 AC_SUBST(PREFIXDIR)
12341 LIBDIR=[$(eval echo $(eval echo $libdir))]
12342 AC_SUBST(LIBDIR)
12344 DATADIR=[$(eval echo $(eval echo $datadir))]
12345 AC_SUBST(DATADIR)
12347 MANDIR=[$(eval echo $(eval echo $mandir))]
12348 AC_SUBST(MANDIR)
12350 DOCDIR=[$(eval echo $(eval echo $docdir))]
12351 AC_SUBST(DOCDIR)
12353 BINDIR=[$(eval echo $(eval echo $bindir))]
12354 AC_SUBST(BINDIR)
12356 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12357 AC_SUBST(INSTALLDIR)
12359 TESTINSTALLDIR="${BUILDDIR}/test-install"
12360 AC_SUBST(TESTINSTALLDIR)
12363 # ===================================================================
12364 # OAuth2 id and secrets
12365 # ===================================================================
12367 AC_MSG_CHECKING([for Google Drive client id and secret])
12368 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12369     AC_MSG_RESULT([not set])
12370     GDRIVE_CLIENT_ID="\"\""
12371     GDRIVE_CLIENT_SECRET="\"\""
12372 else
12373     AC_MSG_RESULT([set])
12374     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12375     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12377 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12378 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12380 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12381 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12382     AC_MSG_RESULT([not set])
12383     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12384     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12385 else
12386     AC_MSG_RESULT([set])
12387     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12388     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12390 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12391 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12393 AC_MSG_CHECKING([for OneDrive client id and secret])
12394 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12395     AC_MSG_RESULT([not set])
12396     ONEDRIVE_CLIENT_ID="\"\""
12397     ONEDRIVE_CLIENT_SECRET="\"\""
12398 else
12399     AC_MSG_RESULT([set])
12400     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12401     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12403 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12404 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12407 dnl ===================================================================
12408 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12409 dnl --enable-dependency-tracking configure option
12410 dnl ===================================================================
12411 AC_MSG_CHECKING([whether to enable dependency tracking])
12412 if test "$enable_dependency_tracking" = "no"; then
12413     nodep=TRUE
12414     AC_MSG_RESULT([no])
12415 else
12416     AC_MSG_RESULT([yes])
12418 AC_SUBST(nodep)
12420 dnl ===================================================================
12421 dnl Number of CPUs to use during the build
12422 dnl ===================================================================
12423 AC_MSG_CHECKING([for number of processors to use])
12424 # plain --with-parallelism is just the default
12425 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12426     if test "$with_parallelism" = "no"; then
12427         PARALLELISM=0
12428     else
12429         PARALLELISM=$with_parallelism
12430     fi
12431 else
12432     if test "$enable_icecream" = "yes"; then
12433         PARALLELISM="10"
12434     else
12435         case `uname -s` in
12437         Darwin|FreeBSD|NetBSD|OpenBSD)
12438             PARALLELISM=`sysctl -n hw.ncpu`
12439             ;;
12441         Linux)
12442             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12443         ;;
12444         # what else than above does profit here *and* has /proc?
12445         *)
12446             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12447             ;;
12448         esac
12450         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12451         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12452     fi
12455 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12456     if test -z "$with_parallelism"; then
12457             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12458             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12459             PARALLELISM="1"
12460     else
12461         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."
12462     fi
12465 if test $PARALLELISM -eq 0; then
12466     AC_MSG_RESULT([explicit make -j option needed])
12467 else
12468     AC_MSG_RESULT([$PARALLELISM])
12470 AC_SUBST(PARALLELISM)
12472 IWYU_PATH="$with_iwyu"
12473 AC_SUBST(IWYU_PATH)
12474 if test ! -z "$IWYU_PATH"; then
12475     if test ! -f "$IWYU_PATH"; then
12476         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12477     fi
12481 # Set up ILIB for MSVC build
12483 ILIB1=
12484 if test "$build_os" = "cygwin"; then
12485     ILIB="."
12486     if test -n "$JAVA_HOME"; then
12487         ILIB="$ILIB;$JAVA_HOME/lib"
12488     fi
12489     ILIB1=-link
12490     if test "$BITNESS_OVERRIDE" = 64; then
12491         ILIB="$ILIB;$COMPATH/lib/x64"
12492         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12493         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12494         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12495         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12496             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12497             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12498         fi
12499         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12500         ucrtlibpath_formatted=$formatted_path
12501         ILIB="$ILIB;$ucrtlibpath_formatted"
12502         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12503     else
12504         ILIB="$ILIB;$COMPATH/lib/x86"
12505         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12506         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12507         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12508         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12509             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12510             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12511         fi
12512         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12513         ucrtlibpath_formatted=$formatted_path
12514         ILIB="$ILIB;$ucrtlibpath_formatted"
12515         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12516     fi
12517     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12518         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12519     else
12520         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12521     fi
12523     AC_SUBST(ILIB)
12526 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12527 AC_MSG_CHECKING([that $CXX supports inline variables])
12528 AC_LANG_PUSH([C++])
12529 save_CXXFLAGS=$CXXFLAGS
12530 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12531 if test "$build_os" = cygwin; then
12532     save_LIB=$LIB
12533     export LIB=$ILIB
12535 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12536         #if !defined __cpp_inline_variables
12537         // This tests for one specific aspect of inline variables that is actually used by
12538         // ORegistry::ROOT (registry/source/regimpl.cxx):
12539         struct S { constexpr S() {} };
12540         struct T { static constexpr S s{}; };
12541         S const * f() { return &T::s; }
12542         #endif
12543     ]])],
12544     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required inline variable support]))
12545 CXXFLAGS=$save_CXXFLAGS
12546 if test "$build_os" = cygwin; then
12547     LIB=$save_LIB
12549 AC_LANG_POP([C++])
12551 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12552 AC_MSG_CHECKING(
12553     [that C++11 use of const_iterator in standard containers is not broken])
12554 save_CXXFLAGS=$CXXFLAGS
12555 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12556 AC_LANG_PUSH([C++])
12557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12558     #include <list>
12559     ]],[[
12560         std::list<int> l;
12561         l.erase(l.cbegin());
12562     ]])],
12563     AC_MSG_RESULT([yes]),
12564     AC_MSG_ERROR([C++11 use of const_iterator in standard containers must not broken]))
12565 AC_LANG_POP([C++])
12566 CXXFLAGS=$save_CXXFLAGS
12568 # ===================================================================
12569 # Creating bigger shared library to link against
12570 # ===================================================================
12571 AC_MSG_CHECKING([whether to create huge library])
12572 MERGELIBS=
12574 if test $_os = iOS -o $_os = Android; then
12575     # Never any point in mergelibs for these as we build just static
12576     # libraries anyway...
12577     enable_mergelibs=no
12580 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12581     if test $_os != Linux -a $_os != WINNT; then
12582         add_warning "--enable-mergelibs is not tested for this platform"
12583     fi
12584     MERGELIBS="TRUE"
12585     AC_MSG_RESULT([yes])
12586 else
12587     AC_MSG_RESULT([no])
12589 AC_SUBST([MERGELIBS])
12591 dnl ===================================================================
12592 dnl icerun is a wrapper that stops us spawning tens of processes
12593 dnl locally - for tools that can't be executed on the compile cluster
12594 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12595 dnl ===================================================================
12596 AC_MSG_CHECKING([whether to use icerun wrapper])
12597 ICECREAM_RUN=
12598 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12599     ICECREAM_RUN=icerun
12600     AC_MSG_RESULT([yes])
12601 else
12602     AC_MSG_RESULT([no])
12604 AC_SUBST(ICECREAM_RUN)
12606 dnl ===================================================================
12607 dnl Setup the ICECC_VERSION for the build the same way it was set for
12608 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12609 dnl ===================================================================
12610 x_ICECC_VERSION=[\#]
12611 if test -n "$ICECC_VERSION" ; then
12612     x_ICECC_VERSION=
12614 AC_SUBST(x_ICECC_VERSION)
12615 AC_SUBST(ICECC_VERSION)
12617 dnl ===================================================================
12619 AC_MSG_CHECKING([MPL subset])
12620 MPL_SUBSET=
12622 if test "$enable_mpl_subset" = "yes"; then
12623     warn_report=false
12624     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12625         warn_report=true
12626     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12627         warn_report=true
12628     fi
12629     if test "$warn_report" = "true"; then
12630         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12631     fi
12632     if test "x$enable_postgresql_sdbc" != "xno"; then
12633         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12634     fi
12635     if test "$enable_lotuswordpro" = "yes"; then
12636         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12637     fi
12638     if test "$WITH_WEBDAV" = "neon"; then
12639         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12640     fi
12641     if test -n "$ENABLE_POPPLER"; then
12642         if test "x$SYSTEM_POPPLER" = "x"; then
12643             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12644         fi
12645     fi
12646     # cf. m4/libo_check_extension.m4
12647     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12648         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12649     fi
12650     for theme in $WITH_THEMES; do
12651         case $theme in
12652         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12653             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12654         *) : ;;
12655         esac
12656     done
12658     ENABLE_OPENGL_TRANSITIONS=
12660     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12661         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12662     fi
12664     MPL_SUBSET="TRUE"
12665     AC_DEFINE(MPL_HAVE_SUBSET)
12666     AC_MSG_RESULT([only])
12667 else
12668     AC_MSG_RESULT([no restrictions])
12670 AC_SUBST(MPL_SUBSET)
12672 dnl ===================================================================
12674 AC_MSG_CHECKING([formula logger])
12675 ENABLE_FORMULA_LOGGER=
12677 if test "x$enable_formula_logger" = "xyes"; then
12678     AC_MSG_RESULT([yes])
12679     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12680     ENABLE_FORMULA_LOGGER=TRUE
12681 elif test -n "$ENABLE_DBGUTIL" ; then
12682     AC_MSG_RESULT([yes])
12683     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12684     ENABLE_FORMULA_LOGGER=TRUE
12685 else
12686     AC_MSG_RESULT([no])
12689 AC_SUBST(ENABLE_FORMULA_LOGGER)
12691 dnl ===================================================================
12692 dnl Setting up the environment.
12693 dnl ===================================================================
12694 AC_MSG_NOTICE([setting up the build environment variables...])
12696 AC_SUBST(COMPATH)
12698 if test "$build_os" = "cygwin"; then
12699     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12700         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12701         ATL_INCLUDE="$COMPATH/atlmfc/include"
12702     elif test -d "$COMPATH/atlmfc/lib"; then
12703         ATL_LIB="$COMPATH/atlmfc/lib"
12704         ATL_INCLUDE="$COMPATH/atlmfc/include"
12705     else
12706         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12707         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12708     fi
12709     if test "$BITNESS_OVERRIDE" = 64; then
12710         ATL_LIB="$ATL_LIB/x64"
12711     else
12712         ATL_LIB="$ATL_LIB/x86"
12713     fi
12714     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12715     PathFormat "/usr/bin/find.exe"
12716     FIND="$formatted_path"
12717     PathFormat "/usr/bin/sort.exe"
12718     SORT="$formatted_path"
12719     PathFormat "/usr/bin/grep.exe"
12720     WIN_GREP="$formatted_path"
12721     PathFormat "/usr/bin/ls.exe"
12722     WIN_LS="$formatted_path"
12723     PathFormat "/usr/bin/touch.exe"
12724     WIN_TOUCH="$formatted_path"
12725 else
12726     FIND=find
12727     SORT=sort
12730 AC_SUBST(ATL_INCLUDE)
12731 AC_SUBST(ATL_LIB)
12732 AC_SUBST(FIND)
12733 AC_SUBST(SORT)
12734 AC_SUBST(WIN_GREP)
12735 AC_SUBST(WIN_LS)
12736 AC_SUBST(WIN_TOUCH)
12738 AC_SUBST(BUILD_TYPE)
12740 AC_SUBST(SOLARINC)
12742 PathFormat "$PERL"
12743 PERL="$formatted_path"
12744 AC_SUBST(PERL)
12746 if test -n "$TMPDIR"; then
12747     TEMP_DIRECTORY="$TMPDIR"
12748 else
12749     TEMP_DIRECTORY="/tmp"
12751 if test "$build_os" = "cygwin"; then
12752     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12754 AC_SUBST(TEMP_DIRECTORY)
12756 # setup the PATH for the environment
12757 if test -n "$LO_PATH_FOR_BUILD"; then
12758     LO_PATH="$LO_PATH_FOR_BUILD"
12759 else
12760     LO_PATH="$PATH"
12762     case "$host_os" in
12764     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12765         if test "$ENABLE_JAVA" != ""; then
12766             pathmunge "$JAVA_HOME/bin" "after"
12767         fi
12768         ;;
12770     cygwin*)
12771         # Win32 make needs native paths
12772         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12773             LO_PATH=`cygpath -p -m "$PATH"`
12774         fi
12775         if test "$BITNESS_OVERRIDE" = 64; then
12776             # needed for msi packaging
12777             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12778         fi
12779         # .NET 4.6 and higher don't have bin directory
12780         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12781             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12782         fi
12783         pathmunge "$ASM_HOME" "before"
12784         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12785         pathmunge "$CSC_PATH" "before"
12786         pathmunge "$MIDL_PATH" "before"
12787         pathmunge "$AL_PATH" "before"
12788         pathmunge "$MSPDB_PATH" "before"
12789         if test -n "$MSBUILD_PATH" ; then
12790             pathmunge "$MSBUILD_PATH" "before"
12791         fi
12792         if test "$BITNESS_OVERRIDE" = 64; then
12793             pathmunge "$COMPATH/bin/amd64" "before"
12794             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12795         else
12796             pathmunge "$COMPATH/bin" "before"
12797             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12798         fi
12799         if test "$ENABLE_JAVA" != ""; then
12800             if test -d "$JAVA_HOME/jre/bin/client"; then
12801                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12802             fi
12803             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12804                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12805             fi
12806             pathmunge "$JAVA_HOME/bin" "before"
12807         fi
12808         ;;
12810     solaris*)
12811         pathmunge "/usr/css/bin" "before"
12812         if test "$ENABLE_JAVA" != ""; then
12813             pathmunge "$JAVA_HOME/bin" "after"
12814         fi
12815         ;;
12816     esac
12819 AC_SUBST(LO_PATH)
12821 libo_FUZZ_SUMMARY
12823 # Generate a configuration sha256 we can use for deps
12824 if test -f config_host.mk; then
12825     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12827 if test -f config_host_lang.mk; then
12828     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12831 CFLAGS=$my_original_CFLAGS
12832 CXXFLAGS=$my_original_CXXFLAGS
12833 CPPFLAGS=$my_original_CPPFLAGS
12835 AC_CONFIG_FILES([config_host.mk
12836                  config_host_lang.mk
12837                  Makefile
12838                  bin/bffvalidator.sh
12839                  bin/odfvalidator.sh
12840                  bin/officeotron.sh
12841                  instsetoo_native/util/openoffice.lst
12842                  sysui/desktop/macosx/Info.plist])
12843 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12844 AC_CONFIG_HEADERS([config_host/config_clang.h])
12845 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12846 AC_CONFIG_HEADERS([config_host/config_eot.h])
12847 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12848 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12849 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12850 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12851 AC_CONFIG_HEADERS([config_host/config_features.h])
12852 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12853 AC_CONFIG_HEADERS([config_host/config_folders.h])
12854 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12855 AC_CONFIG_HEADERS([config_host/config_gio.h])
12856 AC_CONFIG_HEADERS([config_host/config_global.h])
12857 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12858 AC_CONFIG_HEADERS([config_host/config_java.h])
12859 AC_CONFIG_HEADERS([config_host/config_langs.h])
12860 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12861 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12862 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12863 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12864 AC_CONFIG_HEADERS([config_host/config_locales.h])
12865 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12866 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12867 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12868 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12869 AC_CONFIG_HEADERS([config_host/config_oox.h])
12870 AC_CONFIG_HEADERS([config_host/config_options.h])
12871 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12872 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12873 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12874 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12875 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12876 AC_CONFIG_HEADERS([config_host/config_version.h])
12877 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12878 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12879 AC_CONFIG_HEADERS([config_host/config_python.h])
12880 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12881 AC_OUTPUT
12883 if test "$CROSS_COMPILING" = TRUE; then
12884     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12887 # touch the config timestamp file
12888 if test ! -f config_host.mk.stamp; then
12889     echo > config_host.mk.stamp
12890 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12891     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12892 else
12893     echo > config_host.mk.stamp
12896 # touch the config lang timestamp file
12897 if test ! -f config_host_lang.mk.stamp; then
12898     echo > config_host_lang.mk.stamp
12899 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12900     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12901 else
12902     echo > config_host_lang.mk.stamp
12906 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12908 cat << _EOS
12909 ****************************************************************************
12910 WARNING:
12911 Your make version is known to be horribly slow, and hard to debug
12912 problems with. To get a reasonably functional make please do:
12914 to install a pre-compiled binary make for Win32
12916  mkdir -p /opt/lo/bin
12917  cd /opt/lo/bin
12918  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12919  cp make-4.2.1-msvc.exe make
12920  chmod +x make
12922 to install from source:
12923 place yourself in a working directory of you choice.
12925  git clone git://git.savannah.gnu.org/make.git
12927  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12928  set PATH=%PATH%;C:\Cygwin\bin
12929  [or Cygwin64, if that is what you have]
12930  cd path-to-make-repo-you-cloned-above
12931  build_w32.bat --without-guile
12933 should result in a WinRel/gnumake.exe.
12934 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12936 Then re-run autogen.sh
12938 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12939 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12941 _EOS
12944 cat << _EOF
12945 ****************************************************************************
12947 To build, run:
12948 $GNUMAKE
12950 To view some help, run:
12951 $GNUMAKE help
12953 _EOF
12955 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12956     cat << _EOF
12957 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12958 _EOF
12960     if test $_os = Darwin; then
12961         echo open instdir/$PRODUCTNAME.app
12962     else
12963         echo instdir/program/soffice
12964     fi
12965     cat << _EOF
12967 If you want to run the smoketest, run:
12968 $GNUMAKE check
12970 _EOF
12973 if test -f warn; then
12974     cat warn
12975     rm warn
12978 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: