tdf#87884: UnoControlTabPageModel is using tabs w/o WB_NOBORDER
[LibreOffice.git] / configure.ac
blob277b60de88c64774cfd26393cded8b51711eeafe
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.3.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 to 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],
1079         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1082 libo_FUZZ_ARG_ENABLE(epm,
1083     AS_HELP_STRING([--enable-epm],
1084         [LibreOffice includes self-packaging code, that requires epm, however epm is
1085          useless for large scale package building.])
1088 libo_FUZZ_ARG_ENABLE(odk,
1089     AS_HELP_STRING([--disable-odk],
1090         [LibreOffice includes an ODK, office development kit which some packagers may
1091          wish to build without.])
1094 AC_ARG_ENABLE(mpl-subset,
1095     AS_HELP_STRING([--enable-mpl-subset],
1096         [Don't compile any pieces which are not MPL or more liberally licensed])
1099 libo_FUZZ_ARG_ENABLE(evolution2,
1100     AS_HELP_STRING([--enable-evolution2],
1101         [Allows the built-in evolution 2 addressbook connectivity build to be
1102          enabled.])
1105 AC_ARG_ENABLE(avahi,
1106     AS_HELP_STRING([--enable-avahi],
1107         [Determines whether to use Avahi to advertise Impress to remote controls.])
1110 libo_FUZZ_ARG_ENABLE(werror,
1111     AS_HELP_STRING([--enable-werror],
1112         [Turn warnings to errors. (Has no effect in modules where the treating
1113          of warnings as errors is disabled explicitly.)]),
1116 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1117     AS_HELP_STRING([--enable-assert-always-abort],
1118         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1121 libo_FUZZ_ARG_ENABLE(dbgutil,
1122     AS_HELP_STRING([--enable-dbgutil],
1123         [Provide debugging support from --enable-debug and include additional debugging
1124          utilities such as object counting or more expensive checks.
1125          This is the recommended option for developers.
1126          Note that this makes the build ABI incompatible, it is not possible to mix object
1127          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1129 libo_FUZZ_ARG_ENABLE(debug,
1130     AS_HELP_STRING([--enable-debug],
1131         [Include debugging information, disable compiler optimization and inlining plus
1132          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1134 libo_FUZZ_ARG_ENABLE(split-debug,
1135     AS_HELP_STRING([--disable-split-debug],
1136         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1137          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1139 libo_FUZZ_ARG_ENABLE(gdb-index,
1140     AS_HELP_STRING([--disable-gdb-index],
1141         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1142          The feature requires the gold or lld linker.]))
1144 libo_FUZZ_ARG_ENABLE(sal-log,
1145     AS_HELP_STRING([--enable-sal-log],
1146         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1148 AC_ARG_ENABLE(selective-debuginfo,
1149     AS_HELP_STRING([--enable-selective-debuginfo],
1150         [If --enable-debug or --enable-dbgutil is used, build debugging information
1151          (-g compiler flag) only for the specified gbuild build targets
1152          (where all means everything, - prepended means not to enable, / appended means
1153          everything in the directory; there is no ordering, more specific overrides
1154          more general, and disabling takes precedence).
1155          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1157 libo_FUZZ_ARG_ENABLE(symbols,
1158     AS_HELP_STRING([--enable-symbols],
1159         [Generate debug information.
1160          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1161          otherwise.]))
1163 libo_FUZZ_ARG_ENABLE(optimized,
1164     AS_HELP_STRING([--disable-optimized],
1165         [Whether to compile with optimization flags.
1166          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1167          otherwise.]))
1169 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1170     AS_HELP_STRING([--disable-runtime-optimizations],
1171         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1172          JVM JIT) that are known to interact badly with certain dynamic analysis
1173          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1174          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1175          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1177 AC_ARG_WITH(valgrind,
1178     AS_HELP_STRING([--with-valgrind],
1179         [Make availability of Valgrind headers a hard requirement.]))
1181 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1182     AS_HELP_STRING([--enable-compiler-plugins],
1183         [Enable compiler plugins that will perform additional checks during
1184          building. Enabled automatically by --enable-dbgutil.
1185          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1186 COMPILER_PLUGINS_DEBUG=
1187 if test "$enable_compiler_plugins" = debug; then
1188     enable_compiler_plugins=yes
1189     COMPILER_PLUGINS_DEBUG=TRUE
1192 libo_FUZZ_ARG_ENABLE(ooenv,
1193     AS_HELP_STRING([--disable-ooenv],
1194         [Disable ooenv for the instdir installation.]))
1196 libo_FUZZ_ARG_ENABLE(libnumbertext,
1197     AS_HELP_STRING([--disable-libnumbertext],
1198         [Disable use of numbertext external library.]))
1200 AC_ARG_ENABLE(lto,
1201     AS_HELP_STRING([--enable-lto],
1202         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1203          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1204          linker. For MSVC, this option is broken at the moment. This is experimental work
1205          in progress that shouldn't be used unless you are working on it.)]))
1207 AC_ARG_ENABLE(python,
1208     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1209         [Enables or disables Python support at run-time.
1210          Also specifies what Python to use. 'auto' is the default.
1211          'fully-internal' even forces the internal version for uses of Python
1212          during the build.]))
1214 libo_FUZZ_ARG_ENABLE(gtk,
1215     AS_HELP_STRING([--disable-gtk],
1216         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1217 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1219 libo_FUZZ_ARG_ENABLE(gtk3,
1220     AS_HELP_STRING([--disable-gtk3],
1221         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1222 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1224 AC_ARG_ENABLE(split-app-modules,
1225     AS_HELP_STRING([--enable-split-app-modules],
1226         [Split file lists for app modules, e.g. base, calc.
1227          Has effect only with make distro-pack-install]),
1230 AC_ARG_ENABLE(split-opt-features,
1231     AS_HELP_STRING([--enable-split-opt-features],
1232         [Split file lists for some optional features, e.g. pyuno, testtool.
1233          Has effect only with make distro-pack-install]),
1236 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1237     AS_HELP_STRING([--disable-cairo-canvas],
1238         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1241 libo_FUZZ_ARG_ENABLE(dbus,
1242     AS_HELP_STRING([--disable-dbus],
1243         [Determines whether to enable features that depend on dbus.
1244          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1245 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1247 libo_FUZZ_ARG_ENABLE(sdremote,
1248     AS_HELP_STRING([--disable-sdremote],
1249         [Determines whether to enable Impress remote control (i.e. the server component).]),
1250 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1252 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1253     AS_HELP_STRING([--disable-sdremote-bluetooth],
1254         [Determines whether to build sdremote with bluetooth support.
1255          Requires dbus on Linux.]))
1257 libo_FUZZ_ARG_ENABLE(gio,
1258     AS_HELP_STRING([--disable-gio],
1259         [Determines whether to use the GIO support.]),
1260 ,test "${enable_gio+set}" = set || enable_gio=yes)
1262 AC_ARG_ENABLE(qt5,
1263     AS_HELP_STRING([--enable-qt5],
1264         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1265          available.]),
1268 AC_ARG_ENABLE(kde5,
1269     AS_HELP_STRING([--enable-kde5],
1270         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1271          KF5 are available.]),
1274 AC_ARG_ENABLE(gtk3_kde5,
1275     AS_HELP_STRING([--enable-gtk3-kde5],
1276         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1277          platforms where Gtk3, Qt5 and Plasma is available.]),
1280 libo_FUZZ_ARG_ENABLE(gui,
1281     AS_HELP_STRING([--disable-gui],
1282         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1283          command-line option. Not related to LibreOffice Online functionality. Don't use
1284          unless you are certain you need to. Nobody will help you if you insist on trying
1285          this and run into problems.]),
1286 ,test "${enable_gui+set}" = set || enable_gui=yes)
1288 libo_FUZZ_ARG_ENABLE(randr,
1289     AS_HELP_STRING([--disable-randr],
1290         [Disable RandR support in the vcl project.]),
1291 ,test "${enable_randr+set}" = set || enable_randr=yes)
1293 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1294     AS_HELP_STRING([--disable-gstreamer-1-0],
1295         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1296 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1298 AC_ARG_ENABLE(gstreamer-0-10,
1299     AS_HELP_STRING([--enable-gstreamer-0-10],
1300         [Enable building with the gstreamer 0.10 avmedia backend.]),
1301 ,enable_gstreamer_0_10=no)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
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 dnl ===================================================================
1523 dnl Optional Packages (--with/without-)
1524 dnl ===================================================================
1526 AC_ARG_WITH(gcc-home,
1527     AS_HELP_STRING([--with-gcc-home],
1528         [Specify the location of gcc/g++ manually. This can be used in conjunction
1529          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1530          non-default path.]),
1533 AC_ARG_WITH(gnu-patch,
1534     AS_HELP_STRING([--with-gnu-patch],
1535         [Specify location of GNU patch on Solaris or FreeBSD.]),
1538 AC_ARG_WITH(build-platform-configure-options,
1539     AS_HELP_STRING([--with-build-platform-configure-options],
1540         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1543 AC_ARG_WITH(gnu-cp,
1544     AS_HELP_STRING([--with-gnu-cp],
1545         [Specify location of GNU cp on Solaris or FreeBSD.]),
1548 AC_ARG_WITH(external-tar,
1549     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1550         [Specify an absolute path of where to find (and store) tarfiles.]),
1551     TARFILE_LOCATION=$withval ,
1554 AC_ARG_WITH(referenced-git,
1555     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1556         [Specify another checkout directory to reference. This makes use of
1557                  git submodule update --reference, and saves a lot of diskspace
1558                  when having multiple trees side-by-side.]),
1559     GIT_REFERENCE_SRC=$withval ,
1562 AC_ARG_WITH(linked-git,
1563     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1564         [Specify a directory where the repositories of submodules are located.
1565          This uses a method similar to git-new-workdir to get submodules.]),
1566     GIT_LINK_SRC=$withval ,
1569 AC_ARG_WITH(galleries,
1570     AS_HELP_STRING([--with-galleries],
1571         [Specify how galleries should be built. It is possible either to
1572          build these internally from source ("build"),
1573          or to disable them ("no")]),
1576 AC_ARG_WITH(theme,
1577     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1578         [Choose which themes to include. By default those themes with an '*' are included.
1579          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1580          *elementary_svg, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1583 libo_FUZZ_ARG_WITH(helppack-integration,
1584     AS_HELP_STRING([--without-helppack-integration],
1585         [It will not integrate the helppacks to the installer
1586          of the product. Please use this switch to use the online help
1587          or separate help packages.]),
1590 libo_FUZZ_ARG_WITH(fonts,
1591     AS_HELP_STRING([--without-fonts],
1592         [LibreOffice includes some third-party fonts to provide a reliable basis for
1593          help content, templates, samples, etc. When these fonts are already
1594          known to be available on the system then you should use this option.]),
1597 AC_ARG_WITH(epm,
1598     AS_HELP_STRING([--with-epm],
1599         [Decides which epm to use. Default is to use the one from the system if
1600          one is built. When either this is not there or you say =internal epm
1601          will be built.]),
1604 AC_ARG_WITH(package-format,
1605     AS_HELP_STRING([--with-package-format],
1606         [Specify package format(s) for LibreOffice installation sets. The
1607          implicit --without-package-format leads to no installation sets being
1608          generated. Possible values: aix, archive, bsd, deb, dmg,
1609          installed, msi, pkg, and rpm.
1610          Example: --with-package-format='deb rpm']),
1613 AC_ARG_WITH(tls,
1614     AS_HELP_STRING([--with-tls],
1615         [Decides which TLS/SSL and cryptographic implementations to use for
1616          LibreOffice's code. Notice that this doesn't apply for depending
1617          libraries like "neon", for example. Default is to use OpenSSL
1618          although NSS is also possible. Notice that selecting NSS restricts
1619          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1620          restrict by now the usage of NSS in LO's code. Possible values:
1621          openssl, nss. Example: --with-tls="nss"]),
1624 AC_ARG_WITH(system-libs,
1625     AS_HELP_STRING([--with-system-libs],
1626         [Use libraries already on system -- enables all --with-system-* flags.]),
1629 AC_ARG_WITH(system-bzip2,
1630     AS_HELP_STRING([--with-system-bzip2],
1631         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1632     [with_system_bzip2="$with_system_libs"])
1634 AC_ARG_WITH(system-headers,
1635     AS_HELP_STRING([--with-system-headers],
1636         [Use headers already on system -- enables all --with-system-* flags for
1637          external packages whose headers are the only entities used i.e.
1638          boost/odbc/sane-header(s).]),,
1639     [with_system_headers="$with_system_libs"])
1641 AC_ARG_WITH(system-jars,
1642     AS_HELP_STRING([--without-system-jars],
1643         [When building with --with-system-libs, also the needed jars are expected
1644          on the system. Use this to disable that]),,
1645     [with_system_jars="$with_system_libs"])
1647 AC_ARG_WITH(system-cairo,
1648     AS_HELP_STRING([--with-system-cairo],
1649         [Use cairo libraries already on system.  Happens automatically for
1650          (implicit) --enable-gtk and for --enable-gtk3.]))
1652 AC_ARG_WITH(system-epoxy,
1653     AS_HELP_STRING([--with-system-epoxy],
1654         [Use epoxy libraries already on system.  Happens automatically for
1655          --enable-gtk3.]),,
1656        [with_system_epoxy="$with_system_libs"])
1658 AC_ARG_WITH(myspell-dicts,
1659     AS_HELP_STRING([--with-myspell-dicts],
1660         [Adds myspell dictionaries to the LibreOffice installation set]),
1663 AC_ARG_WITH(system-dicts,
1664     AS_HELP_STRING([--without-system-dicts],
1665         [Do not use dictionaries from system paths.]),
1668 AC_ARG_WITH(external-dict-dir,
1669     AS_HELP_STRING([--with-external-dict-dir],
1670         [Specify external dictionary dir.]),
1673 AC_ARG_WITH(external-hyph-dir,
1674     AS_HELP_STRING([--with-external-hyph-dir],
1675         [Specify external hyphenation pattern dir.]),
1678 AC_ARG_WITH(external-thes-dir,
1679     AS_HELP_STRING([--with-external-thes-dir],
1680         [Specify external thesaurus dir.]),
1683 AC_ARG_WITH(system-zlib,
1684     AS_HELP_STRING([--with-system-zlib],
1685         [Use zlib already on system.]),,
1686     [with_system_zlib=auto])
1688 AC_ARG_WITH(system-jpeg,
1689     AS_HELP_STRING([--with-system-jpeg],
1690         [Use jpeg already on system.]),,
1691     [with_system_jpeg="$with_system_libs"])
1693 AC_ARG_WITH(system-clucene,
1694     AS_HELP_STRING([--with-system-clucene],
1695         [Use clucene already on system.]),,
1696     [with_system_clucene="$with_system_libs"])
1698 AC_ARG_WITH(system-expat,
1699     AS_HELP_STRING([--with-system-expat],
1700         [Use expat already on system.]),,
1701     [with_system_expat="$with_system_libs"])
1703 AC_ARG_WITH(system-libxml,
1704     AS_HELP_STRING([--with-system-libxml],
1705         [Use libxml/libxslt already on system.]),,
1706     [with_system_libxml=auto])
1708 AC_ARG_WITH(system-icu,
1709     AS_HELP_STRING([--with-system-icu],
1710         [Use icu already on system.]),,
1711     [with_system_icu="$with_system_libs"])
1713 AC_ARG_WITH(system-ucpp,
1714     AS_HELP_STRING([--with-system-ucpp],
1715         [Use ucpp already on system.]),,
1716     [])
1718 AC_ARG_WITH(system-openldap,
1719     AS_HELP_STRING([--with-system-openldap],
1720         [Use the OpenLDAP LDAP SDK already on system.]),,
1721     [with_system_openldap="$with_system_libs"])
1723 AC_ARG_WITH(system-poppler,
1724     AS_HELP_STRING([--with-system-poppler],
1725         [Use system poppler (only needed for PDF import).]),,
1726     [with_system_poppler="$with_system_libs"])
1728 AC_ARG_WITH(system-gpgmepp,
1729     AS_HELP_STRING([--with-system-gpgmepp],
1730         [Use gpgmepp already on system]),,
1731     [with_system_gpgmepp="$with_system_libs"])
1733 AC_ARG_WITH(system-apache-commons,
1734     AS_HELP_STRING([--with-system-apache-commons],
1735         [Use Apache commons libraries already on system.]),,
1736     [with_system_apache_commons="$with_system_jars"])
1738 AC_ARG_WITH(system-mariadb,
1739     AS_HELP_STRING([--with-system-mariadb],
1740         [Use MariaDB/MySQL libraries already on system.]),,
1741     [with_system_mariadb="$with_system_libs"])
1743 AC_ARG_ENABLE(bundle-mariadb,
1744     AS_HELP_STRING([--enable-bundle-mariadb],
1745         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1748 AC_ARG_WITH(system-postgresql,
1749     AS_HELP_STRING([--with-system-postgresql],
1750         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1751          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1752     [with_system_postgresql="$with_system_libs"])
1754 AC_ARG_WITH(libpq-path,
1755     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1756         [Use this PostgreSQL C interface (libpq) installation for building
1757          the PostgreSQL-SDBC extension.]),
1760 AC_ARG_WITH(system-firebird,
1761     AS_HELP_STRING([--with-system-firebird],
1762         [Use Firebird libraries already on system, for building the Firebird-SDBC
1763          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1764     [with_system_firebird="$with_system_libs"])
1766 AC_ARG_WITH(system-libtommath,
1767             AS_HELP_STRING([--with-system-libtommath],
1768                            [Use libtommath already on system]),,
1769             [with_system_libtommath="$with_system_libs"])
1771 AC_ARG_WITH(system-hsqldb,
1772     AS_HELP_STRING([--with-system-hsqldb],
1773         [Use hsqldb already on system.]))
1775 AC_ARG_WITH(hsqldb-jar,
1776     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1777         [Specify path to jarfile manually.]),
1778     HSQLDB_JAR=$withval)
1780 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1781     AS_HELP_STRING([--disable-scripting-beanshell],
1782         [Disable support for scripts in BeanShell.]),
1786 AC_ARG_WITH(system-beanshell,
1787     AS_HELP_STRING([--with-system-beanshell],
1788         [Use beanshell already on system.]),,
1789     [with_system_beanshell="$with_system_jars"])
1791 AC_ARG_WITH(beanshell-jar,
1792     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1793         [Specify path to jarfile manually.]),
1794     BSH_JAR=$withval)
1796 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1797     AS_HELP_STRING([--disable-scripting-javascript],
1798         [Disable support for scripts in JavaScript.]),
1802 AC_ARG_WITH(system-rhino,
1803     AS_HELP_STRING([--with-system-rhino],
1804         [Use rhino already on system.]),,)
1805 #    [with_system_rhino="$with_system_jars"])
1806 # Above is not used as we have different debug interface
1807 # patched into internal rhino. This code needs to be fixed
1808 # before we can enable it by default.
1810 AC_ARG_WITH(rhino-jar,
1811     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1812         [Specify path to jarfile manually.]),
1813     RHINO_JAR=$withval)
1815 AC_ARG_WITH(commons-logging-jar,
1816     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     COMMONS_LOGGING_JAR=$withval)
1820 AC_ARG_WITH(system-jfreereport,
1821     AS_HELP_STRING([--with-system-jfreereport],
1822         [Use JFreeReport already on system.]),,
1823     [with_system_jfreereport="$with_system_jars"])
1825 AC_ARG_WITH(sac-jar,
1826     AS_HELP_STRING([--with-sac-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     SAC_JAR=$withval)
1830 AC_ARG_WITH(libxml-jar,
1831     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     LIBXML_JAR=$withval)
1835 AC_ARG_WITH(flute-jar,
1836     AS_HELP_STRING([--with-flute-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     FLUTE_JAR=$withval)
1840 AC_ARG_WITH(jfreereport-jar,
1841     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     JFREEREPORT_JAR=$withval)
1845 AC_ARG_WITH(liblayout-jar,
1846     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     LIBLAYOUT_JAR=$withval)
1850 AC_ARG_WITH(libloader-jar,
1851     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     LIBLOADER_JAR=$withval)
1855 AC_ARG_WITH(libformula-jar,
1856     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBFORMULA_JAR=$withval)
1860 AC_ARG_WITH(librepository-jar,
1861     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBREPOSITORY_JAR=$withval)
1865 AC_ARG_WITH(libfonts-jar,
1866     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBFONTS_JAR=$withval)
1870 AC_ARG_WITH(libserializer-jar,
1871     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBSERIALIZER_JAR=$withval)
1875 AC_ARG_WITH(libbase-jar,
1876     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBBASE_JAR=$withval)
1880 AC_ARG_WITH(system-odbc,
1881     AS_HELP_STRING([--with-system-odbc],
1882         [Use the odbc headers already on system.]),,
1883     [with_system_odbc="auto"])
1885 AC_ARG_WITH(system-sane,
1886     AS_HELP_STRING([--with-system-sane],
1887         [Use sane.h already on system.]),,
1888     [with_system_sane="$with_system_headers"])
1890 AC_ARG_WITH(system-bluez,
1891     AS_HELP_STRING([--with-system-bluez],
1892         [Use bluetooth.h already on system.]),,
1893     [with_system_bluez="$with_system_headers"])
1895 AC_ARG_WITH(system-curl,
1896     AS_HELP_STRING([--with-system-curl],
1897         [Use curl already on system.]),,
1898     [with_system_curl=auto])
1900 AC_ARG_WITH(system-boost,
1901     AS_HELP_STRING([--with-system-boost],
1902         [Use boost already on system.]),,
1903     [with_system_boost="$with_system_headers"])
1905 AC_ARG_WITH(system-glm,
1906     AS_HELP_STRING([--with-system-glm],
1907         [Use glm already on system.]),,
1908     [with_system_glm="$with_system_headers"])
1910 AC_ARG_WITH(system-hunspell,
1911     AS_HELP_STRING([--with-system-hunspell],
1912         [Use libhunspell already on system.]),,
1913     [with_system_hunspell="$with_system_libs"])
1915 AC_ARG_WITH(system-mythes,
1916     AS_HELP_STRING([--with-system-mythes],
1917         [Use mythes already on system.]),,
1918     [with_system_mythes="$with_system_libs"])
1920 AC_ARG_WITH(system-altlinuxhyph,
1921     AS_HELP_STRING([--with-system-altlinuxhyph],
1922         [Use ALTLinuxhyph already on system.]),,
1923     [with_system_altlinuxhyph="$with_system_libs"])
1925 AC_ARG_WITH(system-lpsolve,
1926     AS_HELP_STRING([--with-system-lpsolve],
1927         [Use lpsolve already on system.]),,
1928     [with_system_lpsolve="$with_system_libs"])
1930 AC_ARG_WITH(system-coinmp,
1931     AS_HELP_STRING([--with-system-coinmp],
1932         [Use CoinMP already on system.]),,
1933     [with_system_coinmp="$with_system_libs"])
1935 AC_ARG_WITH(system-liblangtag,
1936     AS_HELP_STRING([--with-system-liblangtag],
1937         [Use liblangtag library already on system.]),,
1938     [with_system_liblangtag="$with_system_libs"])
1940 AC_ARG_WITH(webdav,
1941     AS_HELP_STRING([--with-webdav],
1942         [Specify which library to use for webdav implementation.
1943          Possible values: "neon", "serf", "no". The default value is "neon".
1944          Example: --with-webdav="serf"]),
1945     WITH_WEBDAV=$withval,
1946     WITH_WEBDAV="neon")
1948 AC_ARG_WITH(linker-hash-style,
1949     AS_HELP_STRING([--with-linker-hash-style],
1950         [Use linker with --hash-style=<style> when linking shared objects.
1951          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1952          if supported on the build system, and "sysv" otherwise.]))
1954 AC_ARG_WITH(jdk-home,
1955     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1956         [If you have installed JDK 1.6 or later on your system please supply the
1957          path here. Note that this is not the location of the java command but the
1958          location of the entire distribution.]),
1961 AC_ARG_WITH(help,
1962     AS_HELP_STRING([--with-help],
1963         [Enable the build of help. There is a special parameter "common" that
1964          can be used to bundle only the common part, .e.g help-specific icons.
1965          This is useful when you build the helpcontent separately.])
1966     [
1967                           Usage:     --with-help    build the old local help
1968                                  --without-help     no local help (default)
1969                                  --with-help=html   build the new HTML local help
1970                                  --with-help=online build the new HTML online help
1971     ],
1974 libo_FUZZ_ARG_WITH(java,
1975     AS_HELP_STRING([--with-java=<java command>],
1976         [Specify the name of the Java interpreter command. Typically "java"
1977          which is the default.
1979          To build without support for Java components, applets, accessibility
1980          or the XML filters written in Java, use --without-java or --with-java=no.]),
1981     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1982     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1985 AC_ARG_WITH(jvm-path,
1986     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1987         [Use a specific JVM search path at runtime.
1988          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1991 AC_ARG_WITH(ant-home,
1992     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1993         [If you have installed Apache Ant on your system, please supply the path here.
1994          Note that this is not the location of the Ant binary but the location
1995          of the entire distribution.]),
1998 AC_ARG_WITH(symbol-config,
1999     AS_HELP_STRING([--with-symbol-config],
2000         [Configuration for the crashreport symbol upload]),
2001         [],
2002         [with_symbol_config=no])
2004 AC_ARG_WITH(export-validation,
2005     AS_HELP_STRING([--without-export-validation],
2006         [Disable validating OOXML and ODF files as exported from in-tree tests.
2007          Use this option e.g. if your system only provides Java 5.]),
2008 ,with_export_validation=auto)
2010 AC_ARG_WITH(bffvalidator,
2011     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2012         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2013          Requires installed Microsoft Office Binary File Format Validator.
2014          Note: export-validation (--with-export-validation) is required to be turned on.
2015          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2016 ,with_bffvalidator=no)
2018 libo_FUZZ_ARG_WITH(junit,
2019     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2020         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2021          --without-junit disables those tests. Not relevant in the --without-java case.]),
2022 ,with_junit=yes)
2024 AC_ARG_WITH(hamcrest,
2025     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2026         [Specifies the hamcrest jar file to use for JUnit-based tests.
2027          --without-junit disables those tests. Not relevant in the --without-java case.]),
2028 ,with_hamcrest=yes)
2030 AC_ARG_WITH(perl-home,
2031     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2032         [If you have installed Perl 5 Distribution, on your system, please
2033          supply the path here. Note that this is not the location of the Perl
2034          binary but the location of the entire distribution.]),
2037 libo_FUZZ_ARG_WITH(doxygen,
2038     AS_HELP_STRING(
2039         [--with-doxygen=<absolute path to doxygen executable>],
2040         [Specifies the doxygen executable to use when generating ODK C/C++
2041          documentation. --without-doxygen disables generation of ODK C/C++
2042          documentation. Not relevant in the --disable-odk case.]),
2043 ,with_doxygen=yes)
2045 AC_ARG_WITH(visual-studio,
2046     AS_HELP_STRING([--with-visual-studio=<2017>],
2047         [Specify which Visual Studio version to use in case several are
2048          installed. Currently only 2017 is supported.]),
2051 AC_ARG_WITH(windows-sdk,
2052     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2053         [Specify which Windows SDK, or "Windows Kit", version to use
2054          in case the one that came with the selected Visual Studio
2055          is not what you want for some reason. Note that not all compiler/SDK
2056          combinations are supported. The intent is that this option should not
2057          be needed.]),
2060 AC_ARG_WITH(lang,
2061     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2062         [Use this option to build LibreOffice with additional UI language support.
2063          English (US) is always included by default.
2064          Separate multiple languages with space.
2065          For all languages, use --with-lang=ALL.]),
2068 AC_ARG_WITH(locales,
2069     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2070         [Use this option to limit the locale information built in.
2071          Separate multiple locales with space.
2072          Very experimental and might well break stuff.
2073          Just a desperate measure to shrink code and data size.
2074          By default all the locales available is included.
2075          This option is completely unrelated to --with-lang.])
2076     [
2077                           Affects also our character encoding conversion
2078                           tables for encodings mainly targeted for a
2079                           particular locale, like EUC-CN and EUC-TW for
2080                           zh, ISO-2022-JP for ja.
2082                           Affects also our add-on break iterator data for
2083                           some languages.
2085                           For the default, all locales, don't use this switch at all.
2086                           Specifying just the language part of a locale means all matching
2087                           locales will be included.
2088     ],
2091 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2092 libo_FUZZ_ARG_WITH(krb5,
2093     AS_HELP_STRING([--with-krb5],
2094         [Enable MIT Kerberos 5 support in modules that support it.
2095          By default automatically enabled on platforms
2096          where a good system Kerberos 5 is available.]),
2099 libo_FUZZ_ARG_WITH(gssapi,
2100     AS_HELP_STRING([--with-gssapi],
2101         [Enable GSSAPI support in modules that support it.
2102          By default automatically enabled on platforms
2103          where a good system GSSAPI is available.]),
2106 AC_ARG_WITH(iwyu,
2107     AS_HELP_STRING([--with-iwyu],
2108         [Use given IWYU binary path to check unneeded includes instead of building.
2109          Use only if you are hacking on it.]),
2112 libo_FUZZ_ARG_WITH(lxml,
2113     AS_HELP_STRING([--without-lxml],
2114         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2115          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2116          report widget classes and ids.]),
2119 dnl ===================================================================
2120 dnl Branding
2121 dnl ===================================================================
2123 AC_ARG_WITH(branding,
2124     AS_HELP_STRING([--with-branding=/path/to/images],
2125         [Use given path to retrieve branding images set.])
2126     [
2127                           Search for intro.png about.svg and flat_logo.svg.
2128                           If any is missing, default ones will be used instead.
2130                           Search also progress.conf for progress
2131                           settings on intro screen :
2133                           PROGRESSBARCOLOR="255,255,255" Set color of
2134                           progress bar. Comma separated RGB decimal values.
2135                           PROGRESSSIZE="407,6" Set size of progress bar.
2136                           Comma separated decimal values (width, height).
2137                           PROGRESSPOSITION="61,317" Set position of progress
2138                           bar from left,top. Comma separated decimal values.
2139                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2140                           bar frame. Comma separated RGB decimal values.
2141                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2142                           bar text. Comma separated RGB decimal values.
2143                           PROGRESSTEXTBASELINE="287" Set vertical position of
2144                           progress bar text from top. Decimal value.
2146                           Default values will be used if not found.
2147     ],
2151 AC_ARG_WITH(extra-buildid,
2152     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2153         [Show addition build identification in about dialog.]),
2157 AC_ARG_WITH(vendor,
2158     AS_HELP_STRING([--with-vendor="John the Builder"],
2159         [Set vendor of the build.]),
2162 AC_ARG_WITH(android-package-name,
2163     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2164         [Set Android package name of the build.]),
2167 AC_ARG_WITH(compat-oowrappers,
2168     AS_HELP_STRING([--with-compat-oowrappers],
2169         [Install oo* wrappers in parallel with
2170          lo* ones to keep backward compatibility.
2171          Has effect only with make distro-pack-install]),
2174 AC_ARG_WITH(os-version,
2175     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2176         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2179 AC_ARG_WITH(mingw-cross-compiler,
2180     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2181         [Specify the MinGW cross-compiler to use.
2182          When building on the ODK on Unix and building unowinreg.dll,
2183          specify the MinGW C++ cross-compiler.]),
2186 AC_ARG_WITH(idlc-cpp,
2187     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2188         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2191 AC_ARG_WITH(build-version,
2192     AS_HELP_STRING([--with-build-version="Built by Jim"],
2193         [Allows the builder to add a custom version tag that will appear in the
2194          Help/About box for QA purposes.]),
2195 with_build_version=$withval,
2198 AC_ARG_WITH(parallelism,
2199     AS_HELP_STRING([--with-parallelism],
2200         [Number of jobs to run simultaneously during build. Parallel builds can
2201         save a lot of time on multi-cpu machines. Defaults to the number of
2202         CPUs on the machine, unless you configure --enable-icecream - then to
2203         10.]),
2206 AC_ARG_WITH(all-tarballs,
2207     AS_HELP_STRING([--with-all-tarballs],
2208         [Download all external tarballs unconditionally]))
2210 AC_ARG_WITH(gdrive-client-id,
2211     AS_HELP_STRING([--with-gdrive-client-id],
2212         [Provides the client id of the application for OAuth2 authentication
2213         on Google Drive. If either this or --with-gdrive-client-secret is
2214         empty, the feature will be disabled]),
2217 AC_ARG_WITH(gdrive-client-secret,
2218     AS_HELP_STRING([--with-gdrive-client-secret],
2219         [Provides the client secret of the application for OAuth2
2220         authentication on Google Drive. If either this or
2221         --with-gdrive-client-id is empty, the feature will be disabled]),
2224 AC_ARG_WITH(alfresco-cloud-client-id,
2225     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2226         [Provides the client id of the application for OAuth2 authentication
2227         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2228         empty, the feature will be disabled]),
2231 AC_ARG_WITH(alfresco-cloud-client-secret,
2232     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2233         [Provides the client secret of the application for OAuth2
2234         authentication on Alfresco Cloud. If either this or
2235         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2238 AC_ARG_WITH(onedrive-client-id,
2239     AS_HELP_STRING([--with-onedrive-client-id],
2240         [Provides the client id of the application for OAuth2 authentication
2241         on OneDrive. If either this or --with-onedrive-client-secret is
2242         empty, the feature will be disabled]),
2245 AC_ARG_WITH(onedrive-client-secret,
2246     AS_HELP_STRING([--with-onedrive-client-secret],
2247         [Provides the client secret of the application for OAuth2
2248         authentication on OneDrive. If either this or
2249         --with-onedrive-client-id is empty, the feature will be disabled]),
2251 dnl ===================================================================
2252 dnl Do we want to use pre-build binary tarball for recompile
2253 dnl ===================================================================
2255 if test "$enable_library_bin_tar" = "yes" ; then
2256     USE_LIBRARY_BIN_TAR=TRUE
2257 else
2258     USE_LIBRARY_BIN_TAR=
2260 AC_SUBST(USE_LIBRARY_BIN_TAR)
2262 dnl ===================================================================
2263 dnl Test whether build target is Release Build
2264 dnl ===================================================================
2265 AC_MSG_CHECKING([whether build target is Release Build])
2266 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2267     AC_MSG_RESULT([no])
2268     ENABLE_RELEASE_BUILD=
2269 else
2270     AC_MSG_RESULT([yes])
2271     ENABLE_RELEASE_BUILD=TRUE
2273 AC_SUBST(ENABLE_RELEASE_BUILD)
2275 dnl ===================================================================
2276 dnl Test whether to sign Windows Build
2277 dnl ===================================================================
2278 AC_MSG_CHECKING([whether to sign windows build])
2279 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2280     AC_MSG_RESULT([yes])
2281     WINDOWS_BUILD_SIGNING="TRUE"
2282 else
2283     AC_MSG_RESULT([no])
2284     WINDOWS_BUILD_SIGNING="FALSE"
2286 AC_SUBST(WINDOWS_BUILD_SIGNING)
2288 dnl ===================================================================
2289 dnl MacOSX build and runtime environment options
2290 dnl ===================================================================
2292 AC_ARG_WITH(macosx-sdk,
2293     AS_HELP_STRING([--with-macosx-sdk=<version>],
2294         [Prefer a specific SDK for building.])
2295     [
2296                           If the requested SDK is not available, a search for the oldest one will be done.
2297                           With current Xcode versions, only the latest SDK is included, so this option is
2298                           not terribly useful. It works fine to build with a new SDK and run the result
2299                           on an older OS.
2301                           e. g.: --with-macosx-sdk=10.10
2303                           there are 3 options to control the MacOSX build:
2304                           --with-macosx-sdk (referred as 'sdk' below)
2305                           --with-macosx-version-min-required (referred as 'min' below)
2306                           --with-macosx-version-max-allowed (referred as 'max' below)
2308                           the connection between these value and the default they take is as follow:
2309                           ( ? means not specified on the command line, s means the SDK version found,
2310                           constraint: 8 <= x <= y <= z)
2312                           ==========================================
2313                            command line      || config result
2314                           ==========================================
2315                           min  | max  | sdk  || min   | max  | sdk  |
2316                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2317                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2318                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2319                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2320                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2321                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2322                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2323                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2326                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2327                           for a detailed technical explanation of these variables
2329                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2330     ],
2333 AC_ARG_WITH(macosx-version-min-required,
2334     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2335         [set the minimum OS version needed to run the built LibreOffice])
2336     [
2337                           e. g.: --with-macos-version-min-required=10.10
2338                           see --with-macosx-sdk for more info
2339     ],
2342 AC_ARG_WITH(macosx-version-max-allowed,
2343     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2344         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2345     [
2346                           e. g.: --with-macos-version-max-allowed=10.10
2347                           see --with-macosx-sdk for more info
2348     ],
2352 dnl ===================================================================
2353 dnl options for stuff used during cross-compilation build
2354 dnl Not quite superseded by --with-build-platform-configure-options.
2355 dnl TODO: check, if the "force" option is still needed anywhere.
2356 dnl ===================================================================
2358 AC_ARG_WITH(system-icu-for-build,
2359     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2360         [Use icu already on system for build tools (cross-compilation only).]))
2363 dnl ===================================================================
2364 dnl Check for incompatible options set by fuzzing, and reset those
2365 dnl automatically to working combinations
2366 dnl ===================================================================
2368 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2369         "$enable_dbus" != "$enable_avahi"; then
2370     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2371     enable_avahi=$enable_dbus
2374 dnl ===================================================================
2375 dnl check for required programs (grep, awk, sed, bash)
2376 dnl ===================================================================
2378 pathmunge ()
2380     if test -n "$1"; then
2381         if test "$build_os" = "cygwin"; then
2382             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2383                 PathFormat "$1"
2384                 new_path=`cygpath -sm "$formatted_path"`
2385             else
2386                 PathFormat "$1"
2387                 new_path=`cygpath -u "$formatted_path"`
2388             fi
2389         else
2390             new_path="$1"
2391         fi
2392         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2393             if test "$2" = "after"; then
2394                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2395             else
2396                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2397             fi
2398         fi
2399         unset new_path
2400     fi
2403 AC_PROG_AWK
2404 AC_PATH_PROG( AWK, $AWK)
2405 if test -z "$AWK"; then
2406     AC_MSG_ERROR([install awk to run this script])
2409 AC_PATH_PROG(BASH, bash)
2410 if test -z "$BASH"; then
2411     AC_MSG_ERROR([bash not found in \$PATH])
2413 AC_SUBST(BASH)
2415 AC_MSG_CHECKING([for GNU or BSD tar])
2416 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2417     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2418     if test $? -eq 0;  then
2419         GNUTAR=$a
2420         break
2421     fi
2422 done
2423 AC_MSG_RESULT($GNUTAR)
2424 if test -z "$GNUTAR"; then
2425     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2427 AC_SUBST(GNUTAR)
2429 AC_MSG_CHECKING([for tar's option to strip components])
2430 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2431 if test $? -eq 0; then
2432     STRIP_COMPONENTS="--strip-components"
2433 else
2434     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2435     if test $? -eq 0; then
2436         STRIP_COMPONENTS="--strip-path"
2437     else
2438         STRIP_COMPONENTS="unsupported"
2439     fi
2441 AC_MSG_RESULT($STRIP_COMPONENTS)
2442 if test x$STRIP_COMPONENTS = xunsupported; then
2443     AC_MSG_ERROR([you need a tar that is able to strip components.])
2445 AC_SUBST(STRIP_COMPONENTS)
2447 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2448 dnl desktop OSes from "mobile" ones.
2450 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2451 dnl In other words, that when building for an OS that is not a
2452 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2454 dnl Note the direction of the implication; there is no assumption that
2455 dnl cross-compiling would imply a non-desktop OS.
2457 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2458     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2459     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2460     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2463 # Whether to build "avmedia" functionality or not.
2465 if test -z "$enable_avmedia"; then
2466     enable_avmedia=yes
2469 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2470 if test "$enable_avmedia" = yes; then
2471     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2472 else
2473     USE_AVMEDIA_DUMMY='TRUE'
2475 AC_SUBST(USE_AVMEDIA_DUMMY)
2477 # Decide whether to build database connectivity stuff (including
2478 # Base) or not. We probably don't want to on non-desktop OSes.
2479 if test -z "$enable_database_connectivity"; then
2480     # --disable-database-connectivity is unfinished work in progress
2481     # and the iOS test app doesn't link if we actually try to use it.
2482     # if test $_os != iOS -a $_os != Android; then
2483     if test $_os != iOS; then
2484         enable_database_connectivity=yes
2485     fi
2488 if test "$enable_database_connectivity" = yes; then
2489     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2490     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2493 if test -z "$enable_extensions"; then
2494     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2495     if test $_os != iOS -a $_os != Android; then
2496         enable_extensions=yes
2497     fi
2500 if test "$enable_extensions" = yes; then
2501     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2502     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2505 if test -z "$enable_scripting"; then
2506     # Disable scripting for iOS unless specifically overridden
2507     # with --enable-scripting.
2508     if test $_os != iOS; then
2509         enable_scripting=yes
2510     fi
2513 DISABLE_SCRIPTING=''
2514 if test "$enable_scripting" = yes; then
2515     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2516     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2517 else
2518     DISABLE_SCRIPTING='TRUE'
2519     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2522 if test $_os = iOS -o $_os = Android; then
2523     # Disable dynamic_loading always for iOS and Android
2524     enable_dynamic_loading=no
2525 elif test -z "$enable_dynamic_loading"; then
2526     # Otherwise enable it unless specifically disabled
2527     enable_dynamic_loading=yes
2530 DISABLE_DYNLOADING=''
2531 if test "$enable_dynamic_loading" = yes; then
2532     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2533 else
2534     DISABLE_DYNLOADING='TRUE'
2536 AC_SUBST(DISABLE_DYNLOADING)
2538 # remember SYSBASE value
2539 AC_SUBST(SYSBASE)
2541 dnl ===================================================================
2542 dnl  Sort out various gallery compilation options
2543 dnl ===================================================================
2544 AC_MSG_CHECKING([how to build and package galleries])
2545 if test -n "${with_galleries}"; then
2546     if test "$with_galleries" = "build"; then
2547         WITH_GALLERY_BUILD=TRUE
2548         AC_MSG_RESULT([build from source images internally])
2549     elif test "$with_galleries" = "no"; then
2550         WITH_GALLERY_BUILD=
2551         AC_MSG_RESULT([disable non-internal gallery build])
2552     else
2553         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2554     fi
2555 else
2556     if test $_os != iOS -a $_os != Android; then
2557         WITH_GALLERY_BUILD=TRUE
2558         AC_MSG_RESULT([internal src images for desktop])
2559     else
2560         WITH_GALLERY_BUILD=
2561         AC_MSG_RESULT([disable src image build])
2562     fi
2564 AC_SUBST(WITH_GALLERY_BUILD)
2566 dnl ===================================================================
2567 dnl  Checks if ccache is available
2568 dnl ===================================================================
2569 if test "$_os" = "WINNT"; then
2570     # on windows/VC build do not use ccache
2571     CCACHE=""
2572 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2573     case "%$CC%$CXX%" in
2574     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2575     # assume that's good then
2576     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2577         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2578         ;;
2579     *)
2580         AC_PATH_PROG([CCACHE],[ccache],[not found])
2581         if test "$CCACHE" = "not found"; then
2582             CCACHE=""
2583         else
2584             # Need to check for ccache version: otherwise prevents
2585             # caching of the results (like "-x objective-c++" for Mac)
2586             if test $_os = Darwin -o $_os = iOS; then
2587                 # Check ccache version
2588                 AC_MSG_CHECKING([whether version of ccache is suitable])
2589                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2590                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2591                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2592                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2593                 else
2594                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2595                     CCACHE=""
2596                 fi
2597             fi
2598         fi
2599         ;;
2600     esac
2601 else
2602     CCACHE=""
2605 if test "$CCACHE" != ""; then
2606     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2607     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2608     if test "$ccache_size" = ""; then
2609         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2610         if test "$ccache_size" = ""; then
2611             ccache_size=0
2612         fi
2613         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2614         if test $ccache_size -lt 1024; then
2615             CCACHE=""
2616             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2617             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2618         else
2619             # warn that ccache may be too small for debug build
2620             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2621             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2622         fi
2623     else
2624         if test $ccache_size -lt 5; then
2625             #warn that ccache may be too small for debug build
2626             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2627             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2628         fi
2629     fi
2632 dnl ===================================================================
2633 dnl  Checks for C compiler,
2634 dnl  The check for the C++ compiler is later on.
2635 dnl ===================================================================
2636 if test "$_os" != "WINNT"; then
2637     GCC_HOME_SET="true"
2638     AC_MSG_CHECKING([gcc home])
2639     if test -z "$with_gcc_home"; then
2640         if test "$enable_icecream" = "yes"; then
2641             if test -d "/usr/lib/icecc/bin"; then
2642                 GCC_HOME="/usr/lib/icecc/"
2643             elif test -d "/usr/libexec/icecc/bin"; then
2644                 GCC_HOME="/usr/libexec/icecc/"
2645             elif test -d "/opt/icecream/bin"; then
2646                 GCC_HOME="/opt/icecream/"
2647             else
2648                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2650             fi
2651         else
2652             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2653             GCC_HOME_SET="false"
2654         fi
2655     else
2656         GCC_HOME="$with_gcc_home"
2657     fi
2658     AC_MSG_RESULT($GCC_HOME)
2659     AC_SUBST(GCC_HOME)
2661     if test "$GCC_HOME_SET" = "true"; then
2662         if test -z "$CC"; then
2663             CC="$GCC_HOME/bin/gcc"
2664         fi
2665         if test -z "$CXX"; then
2666             CXX="$GCC_HOME/bin/g++"
2667         fi
2668     fi
2671 COMPATH=`dirname "$CC"`
2672 if test "$COMPATH" = "."; then
2673     AC_PATH_PROGS(COMPATH, $CC)
2674     dnl double square bracket to get single because of M4 quote...
2675     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2677 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2679 dnl ===================================================================
2680 dnl Java support
2681 dnl ===================================================================
2682 AC_MSG_CHECKING([whether to build with Java support])
2683 if test "$with_java" != "no"; then
2684     if test "$DISABLE_SCRIPTING" = TRUE; then
2685         AC_MSG_RESULT([no, overridden by --disable-scripting])
2686         ENABLE_JAVA=""
2687         with_java=no
2688     else
2689         AC_MSG_RESULT([yes])
2690         ENABLE_JAVA="TRUE"
2691         AC_DEFINE(HAVE_FEATURE_JAVA)
2692     fi
2693 else
2694     AC_MSG_RESULT([no])
2695     ENABLE_JAVA=""
2698 AC_SUBST(ENABLE_JAVA)
2700 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2702 dnl ENABLE_JAVA="" indicate no Java support at all
2704 dnl ===================================================================
2705 dnl Check macOS SDK and compiler
2706 dnl ===================================================================
2708 if test $_os = Darwin -o $_os = iOS; then
2710     # If no --with-macosx-sdk option is given, look for one
2712     # The intent is that for "most" Mac-based developers, a suitable
2713     # SDK will be found automatically without any configure options.
2715     # For developers with a current Xcode, the lowest-numbered SDK
2716     # higher than or equal to the minimum required should be found.
2718     AC_MSG_CHECKING([what macOS SDK to use])
2719     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2720         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2721         if test -d "$MACOSX_SDK_PATH"; then
2722             with_macosx_sdk="${_macosx_sdk}"
2723             break
2724         else
2725             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2726             if test -d "$MACOSX_SDK_PATH"; then
2727                 with_macosx_sdk="${_macosx_sdk}"
2728                 break
2729             fi
2730         fi
2731     done
2732     if test ! -d "$MACOSX_SDK_PATH"; then
2733         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2734     fi
2736     if test $_os = iOS; then
2737         if test "$enable_ios_simulator" = "yes"; then
2738             useos=iphonesimulator
2739         else
2740             useos=iphoneos
2741         fi
2742         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2743     fi
2744     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2747     case $with_macosx_sdk in
2748     10.12)
2749         MACOSX_SDK_VERSION=101200
2750         ;;
2751     10.13)
2752         MACOSX_SDK_VERSION=101300
2753         ;;
2754     10.14)
2755         MACOSX_SDK_VERSION=101400
2756         ;;
2757     *)
2758         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2759         ;;
2760     esac
2762     if test "$with_macosx_version_min_required" = "" ; then
2763         with_macosx_version_min_required="10.10";
2764     fi
2766     if test "$with_macosx_version_max_allowed" = "" ; then
2767         with_macosx_version_max_allowed="$with_macosx_sdk"
2768     fi
2770     # export this so that "xcrun" invocations later return matching values
2771     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2772     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2773     export DEVELOPER_DIR
2774     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2775     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2777     AC_MSG_CHECKING([whether Xcode is new enough])
2778     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2779     my_xcode_ver2=${my_xcode_ver1#Xcode }
2780     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2781     if test "$my_xcode_ver3" -ge 903; then
2782         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2783     else
2784         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2785     fi
2787     case "$with_macosx_version_min_required" in
2788     10.10)
2789         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2790         ;;
2791     10.11)
2792         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2793         ;;
2794     10.12)
2795         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2796         ;;
2797     10.13)
2798         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2799         ;;
2800     10.14)
2801         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2802         ;;
2803     *)
2804         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--14])
2805         ;;
2806     esac
2807     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2809     LIBTOOL=/usr/bin/libtool
2810     INSTALL_NAME_TOOL=install_name_tool
2811     if test -z "$save_CC"; then
2812         AC_MSG_CHECKING([what compiler to use])
2813         stdlib=-stdlib=libc++
2814         if test "$ENABLE_LTO" = TRUE; then
2815             lto=-flto
2816         fi
2817         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2818         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2819         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2820         AR=`xcrun -find ar`
2821         NM=`xcrun -find nm`
2822         STRIP=`xcrun -find strip`
2823         LIBTOOL=`xcrun -find libtool`
2824         RANLIB=`xcrun -find ranlib`
2825         AC_MSG_RESULT([$CC and $CXX])
2826     fi
2828     case "$with_macosx_version_max_allowed" in
2829     10.10)
2830         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2831         ;;
2832     10.11)
2833         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2834         ;;
2835     10.12)
2836         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2837         ;;
2838     10.13)
2839         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2840         ;;
2841     10.14)
2842         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2843         ;;
2844     *)
2845         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--14])
2846         ;;
2847     esac
2849     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2850     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2851         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])
2852     else
2853         AC_MSG_RESULT([ok])
2854     fi
2856     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2857     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2858         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2859     else
2860         AC_MSG_RESULT([ok])
2861     fi
2862     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2863     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2865     AC_MSG_CHECKING([whether to do code signing])
2867     if test "$enable_macosx_code_signing" = yes; then
2868         # By default use the first suitable certificate (?).
2870         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2871         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2872         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2873         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2874         # "Developer ID Application" one.
2876         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2877         if test -n "$identity"; then
2878             MACOSX_CODESIGNING_IDENTITY=$identity
2879             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2880             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2881         else
2882             AC_MSG_ERROR([cannot determine identity to use])
2883         fi
2884     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2885         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2886         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2887         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2888     else
2889         AC_MSG_RESULT([no])
2890     fi
2892     AC_MSG_CHECKING([whether to create a Mac App Store package])
2894     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2895         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2896     elif test "$enable_macosx_package_signing" = yes; then
2897         # By default use the first suitable certificate.
2898         # It should be a "3rd Party Mac Developer Installer" one
2900         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2901         if test -n "$identity"; then
2902             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2903             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2904             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2905         else
2906             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2907         fi
2908     elif test -n "$enable_macosx_package_signing"; then
2909         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2910         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2911         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2912     else
2913         AC_MSG_RESULT([no])
2914     fi
2916     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2917         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2918     fi
2920     AC_MSG_CHECKING([whether to sandbox the application])
2922     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2923         AC_MSG_ERROR([macOS sandboxing requires code signing])
2924     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2925         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2926     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2927         ENABLE_MACOSX_SANDBOX=TRUE
2928         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2929         AC_MSG_RESULT([yes])
2930     else
2931         AC_MSG_RESULT([no])
2932     fi
2934     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2935     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2936     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2938 AC_SUBST(MACOSX_SDK_PATH)
2939 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2940 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2941 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2942 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2943 AC_SUBST(INSTALL_NAME_TOOL)
2944 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
2945 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2946 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2947 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2948 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2950 dnl ===================================================================
2951 dnl Check iOS SDK and compiler
2952 dnl ===================================================================
2954 if test $_os = iOS; then
2955     AC_MSG_CHECKING([what iOS SDK to use])
2956     current_sdk_ver=12.1
2957     older_sdk_vers="12.0 11.4"
2958     if test "$enable_ios_simulator" = "yes"; then
2959         platform=iPhoneSimulator
2960         versionmin=-mios-simulator-version-min=11.0
2961     else
2962         platform=iPhoneOS
2963         versionmin=-miphoneos-version-min=11.0
2964     fi
2965     xcode_developer=`xcode-select -print-path`
2967     for sdkver in $current_sdk_ver $older_sdk_vers; do
2968         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2969         if test -d $t; then
2970             sysroot=$t
2971             break
2972         fi
2973     done
2975     if test -z "$sysroot"; then
2976         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2977     fi
2979     AC_MSG_RESULT($sysroot)
2981     # LTO is not really recommended for iOS builds,
2982     # the link time will be astronomical
2983     if test "$ENABLE_LTO" = TRUE; then
2984         lto=-flto
2985     fi
2987     stdlib="-stdlib=libc++"
2989     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2990     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2992     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2993     AR=`xcrun -find ar`
2994     NM=`xcrun -find nm`
2995     STRIP=`xcrun -find strip`
2996     LIBTOOL=`xcrun -find libtool`
2997     RANLIB=`xcrun -find ranlib`
3000 AC_MSG_CHECKING([whether to treat the installation as read-only])
3002 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3003         "$enable_extensions" != yes; then
3004     enable_readonly_installset=yes
3006 if test "$enable_readonly_installset" = yes; then
3007     AC_MSG_RESULT([yes])
3008     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3009 else
3010     AC_MSG_RESULT([no])
3013 dnl ===================================================================
3014 dnl Structure of install set
3015 dnl ===================================================================
3017 if test $_os = Darwin; then
3018     LIBO_BIN_FOLDER=MacOS
3019     LIBO_ETC_FOLDER=Resources
3020     LIBO_LIBEXEC_FOLDER=MacOS
3021     LIBO_LIB_FOLDER=Frameworks
3022     LIBO_LIB_PYUNO_FOLDER=Resources
3023     LIBO_SHARE_FOLDER=Resources
3024     LIBO_SHARE_HELP_FOLDER=Resources/help
3025     LIBO_SHARE_JAVA_FOLDER=Resources/java
3026     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3027     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3028     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3029     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3030     LIBO_URE_BIN_FOLDER=MacOS
3031     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3032     LIBO_URE_LIB_FOLDER=Frameworks
3033     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3034     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3035 elif test $_os = WINNT; then
3036     LIBO_BIN_FOLDER=program
3037     LIBO_ETC_FOLDER=program
3038     LIBO_LIBEXEC_FOLDER=program
3039     LIBO_LIB_FOLDER=program
3040     LIBO_LIB_PYUNO_FOLDER=program
3041     LIBO_SHARE_FOLDER=share
3042     LIBO_SHARE_HELP_FOLDER=help
3043     LIBO_SHARE_JAVA_FOLDER=program/classes
3044     LIBO_SHARE_PRESETS_FOLDER=presets
3045     LIBO_SHARE_READMES_FOLDER=readmes
3046     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3047     LIBO_SHARE_SHELL_FOLDER=program/shell
3048     LIBO_URE_BIN_FOLDER=program
3049     LIBO_URE_ETC_FOLDER=program
3050     LIBO_URE_LIB_FOLDER=program
3051     LIBO_URE_MISC_FOLDER=program
3052     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3053 else
3054     LIBO_BIN_FOLDER=program
3055     LIBO_ETC_FOLDER=program
3056     LIBO_LIBEXEC_FOLDER=program
3057     LIBO_LIB_FOLDER=program
3058     LIBO_LIB_PYUNO_FOLDER=program
3059     LIBO_SHARE_FOLDER=share
3060     LIBO_SHARE_HELP_FOLDER=help
3061     LIBO_SHARE_JAVA_FOLDER=program/classes
3062     LIBO_SHARE_PRESETS_FOLDER=presets
3063     LIBO_SHARE_READMES_FOLDER=readmes
3064     if test "$enable_fuzzers" != yes; then
3065         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3066     else
3067         LIBO_SHARE_RESOURCE_FOLDER=resource
3068     fi
3069     LIBO_SHARE_SHELL_FOLDER=program/shell
3070     LIBO_URE_BIN_FOLDER=program
3071     LIBO_URE_ETC_FOLDER=program
3072     LIBO_URE_LIB_FOLDER=program
3073     LIBO_URE_MISC_FOLDER=program
3074     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3076 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3077 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3093 # Not all of them needed in config_host.mk, add more if need arises
3094 AC_SUBST(LIBO_BIN_FOLDER)
3095 AC_SUBST(LIBO_ETC_FOLDER)
3096 AC_SUBST(LIBO_LIB_FOLDER)
3097 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3098 AC_SUBST(LIBO_SHARE_FOLDER)
3099 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3100 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3101 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3102 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3103 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3104 AC_SUBST(LIBO_URE_BIN_FOLDER)
3105 AC_SUBST(LIBO_URE_ETC_FOLDER)
3106 AC_SUBST(LIBO_URE_LIB_FOLDER)
3107 AC_SUBST(LIBO_URE_MISC_FOLDER)
3108 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3110 dnl ===================================================================
3111 dnl Windows specific tests and stuff
3112 dnl ===================================================================
3114 reg_get_value()
3116     # Return value: $regvalue
3117     unset regvalue
3119     local _regentry="/proc/registry${1}/${2}"
3120     if test -f "$_regentry"; then
3121         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3122         # Registry keys read via /proc/registry* are always \0 terminated!
3123         local _regvalue=$(tr -d '\0' < "$_regentry")
3124         if test $? -eq 0; then
3125             regvalue=$_regvalue
3126         fi
3127     fi
3130 # Get a value from the 32-bit side of the Registry
3131 reg_get_value_32()
3133     reg_get_value "32" "$1"
3136 # Get a value from the 64-bit side of the Registry
3137 reg_get_value_64()
3139     reg_get_value "64" "$1"
3142 if test "$_os" = "WINNT"; then
3143     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3144     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3145         AC_MSG_RESULT([no])
3146         WINDOWS_SDK_ARCH="x86"
3147     else
3148         AC_MSG_RESULT([yes])
3149         WINDOWS_SDK_ARCH="x64"
3150         BITNESS_OVERRIDE=64
3151     fi
3153 if test "$_os" = "iOS"; then
3154     cross_compiling="yes"
3157 if test "$cross_compiling" = "yes"; then
3158     export CROSS_COMPILING=TRUE
3159 else
3160     CROSS_COMPILING=
3161     BUILD_TYPE="$BUILD_TYPE NATIVE"
3163 AC_SUBST(CROSS_COMPILING)
3165 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3166 # NOTE: must _not_ be used for bundled external libraries!
3167 ISYSTEM=
3168 if test "$GCC" = "yes"; then
3169     AC_MSG_CHECKING( for -isystem )
3170     save_CFLAGS=$CFLAGS
3171     CFLAGS="$CFLAGS -Werror"
3172     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3173     CFLAGS=$save_CFLAGS
3174     if test -n "$ISYSTEM"; then
3175         AC_MSG_RESULT(yes)
3176     else
3177         AC_MSG_RESULT(no)
3178     fi
3180 if test -z "$ISYSTEM"; then
3181     # fall back to using -I
3182     ISYSTEM=-I
3184 AC_SUBST(ISYSTEM)
3186 dnl ===================================================================
3187 dnl  Check which Visual Studio compiler is used
3188 dnl ===================================================================
3190 map_vs_year_to_version()
3192     # Return value: $vsversion
3194     unset vsversion
3196     case $1 in
3197     2017)
3198         vsversion=15.0;;
3199     *)
3200         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3201     esac
3204 vs_versions_to_check()
3206     # Args: $1 (optional) : versions to check, in the order of preference
3207     # Return value: $vsversions
3209     unset vsversions
3211     if test -n "$1"; then
3212         map_vs_year_to_version "$1"
3213         vsversions=$vsversion
3214     else
3215         # We accept only 2017
3216         vsversions="15.0"
3217     fi
3220 win_get_env_from_vsvars32bat()
3222     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3223     # Also seems to be located in another directory under the same name: vsvars32.bat
3224     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3225     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3226     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3227     chmod +x $WRAPPERBATCHFILEPATH
3228     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3229     rm -f $WRAPPERBATCHFILEPATH
3230     printf '%s' "$_win_get_env_from_vsvars32bat"
3233 find_ucrt()
3235     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3236     if test -n "$regvalue"; then
3237         PathFormat "$regvalue"
3238         UCRTSDKDIR=$formatted_path
3239         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3240         UCRTVERSION=$regvalue
3241         # Rest if not exist
3242         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3243           UCRTSDKDIR=
3244         fi
3245     fi
3246     if test -z "$UCRTSDKDIR"; then
3247         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3248         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3249         if test -f "$ide_env_file"; then
3250             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3251             UCRTSDKDIR=$formatted_path
3252             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3253             dnl Hack needed at least by tml:
3254             if test "$UCRTVERSION" = 10.0.15063.0 \
3255                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3256                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3257             then
3258                 UCRTVERSION=10.0.14393.0
3259             fi
3260         else
3261           AC_MSG_ERROR([No UCRT found])
3262         fi
3263     fi
3266 find_msvc()
3268     # Find Visual C++ 2017
3269     # Args: $1 (optional) : The VS version year
3270     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3272     unset vctest vcnum vcnumwithdot vcbuildnumber
3274     vs_versions_to_check "$1"
3276     for ver in $vsversions; do
3277         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3278         if test -n "$regvalue"; then
3279             vctest=$regvalue
3280             break
3281         fi
3282         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3283         if test -n "$regvalue"; then
3284             AC_MSG_RESULT([found: $regvalue])
3285             PathFormat "$regvalue"
3286             vctest=$formatted_path
3287             break
3288         fi
3289     done
3290     if test -n "$vctest"; then
3291         vcnumwithdot=$ver
3292         case "$vcnumwithdot" in
3293         15.0)
3294             vcyear=2017
3295             vcnum=150
3296             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3297             ;;
3298         esac
3299     fi
3302 SOLARINC=
3303 MSBUILD_PATH=
3304 DEVENV=
3305 if test "$_os" = "WINNT"; then
3306     AC_MSG_CHECKING([Visual C++])
3308     find_msvc "$with_visual_studio"
3309     if test -z "$vctest"; then
3310         if test -n "$with_visual_studio"; then
3311             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3312         else
3313             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3314         fi
3315     fi
3317     if test "$BITNESS_OVERRIDE" = ""; then
3318         if test -f "$vctest/bin/cl.exe"; then
3319             VC_PRODUCT_DIR=$vctest
3320         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3321             VC_PRODUCT_DIR=$vctest/VC
3322         else
3323             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3324         fi
3325     else
3326         if test -f "$vctest/bin/amd64/cl.exe"; then
3327             VC_PRODUCT_DIR=$vctest
3328         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3329             VC_PRODUCT_DIR=$vctest/VC
3330         else
3331             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])
3332         fi
3333     fi
3335     AC_MSG_CHECKING([for short pathname of VC product directory])
3336     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3337     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3339     UCRTSDKDIR=
3340     UCRTVERSION=
3342     AC_MSG_CHECKING([for UCRT location])
3343     find_ucrt
3344     # find_ucrt errors out if it doesn't find it
3345     AC_MSG_RESULT([found])
3346     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3347     ucrtincpath_formatted=$formatted_path
3348     # SOLARINC is used for external modules and must be set too.
3349     # And no, it's not sufficient to set SOLARINC only, as configure
3350     # itself doesn't honour it.
3351     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3352     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3353     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3354     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3356     AC_SUBST(UCRTSDKDIR)
3357     AC_SUBST(UCRTVERSION)
3359     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3360     # Find the proper version of MSBuild.exe to use based on the VS version
3361     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3362     if test -n "$regvalue" ; then
3363         AC_MSG_RESULT([found: $regvalue])
3364         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3365     else
3366         if test "$BITNESS_OVERRIDE" = ""; then
3367             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3368         else
3369             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3370         fi
3371         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3372         AC_MSG_RESULT([$regvalue])
3373     fi
3375     # Find the version of devenv.exe
3376     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3377     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3378     if test ! -e "$DEVENV"; then
3379         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3380     fi
3382     dnl ===========================================================
3383     dnl  Check for the corresponding mspdb*.dll
3384     dnl ===========================================================
3386     MSPDB_PATH=
3387     CL_DIR=
3388     CL_LIB=
3390     if test "$BITNESS_OVERRIDE" = ""; then
3391         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3392         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3393     else
3394         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3395         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3396     fi
3398     # MSVC 15.0 has libraries from 14.0?
3399     mspdbnum="140"
3401     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3402         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3403     fi
3405     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3406     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3408     dnl The path needs to be added before cl is called
3409     PATH="$MSPDB_PATH:$PATH"
3411     AC_MSG_CHECKING([cl.exe])
3413     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3414     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3415     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3416     # is not enough?
3418     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3419     dnl needed when building CLR code:
3420     if test -z "$MSVC_CXX"; then
3421         if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3422             MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3423         fi
3425         # This gives us a posix path with 8.3 filename restrictions
3426         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3427     fi
3429     if test -z "$CC"; then
3430         CC=$MSVC_CXX
3431     fi
3432     if test "$BITNESS_OVERRIDE" = ""; then
3433         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3434         MSVC_CXX="$MSVC_CXX -arch:SSE"
3435     fi
3437     if test -n "$CC"; then
3438         # Remove /cl.exe from CC case insensitive
3439         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3440         if test "$BITNESS_OVERRIDE" = ""; then
3441            COMPATH="$VC_PRODUCT_DIR"
3442         else
3443             if test -n "$VC_PRODUCT_DIR"; then
3444                 COMPATH=$VC_PRODUCT_DIR
3445             fi
3446         fi
3447         if test "$BITNESS_OVERRIDE" = ""; then
3448             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3449             CC="$CC -arch:SSE"
3450         fi
3452         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3454         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3456         PathFormat "$COMPATH"
3457         COMPATH="$formatted_path"
3459         VCVER=$vcnum
3460         MSVSVER=$vcyear
3462         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3463         # are always "better", we list them in reverse chronological order.
3465         case $vcnum in
3466         150)
3467             COMEX=19
3468             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3469             ;;
3470         esac
3472         # The expectation is that --with-windows-sdk should not need to be used
3473         if test -n "$with_windows_sdk"; then
3474             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3475             *" "$with_windows_sdk" "*)
3476                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3477                 ;;
3478             *)
3479                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3480                 ;;
3481             esac
3482         fi
3484         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3485         ac_objext=obj
3486         ac_exeext=exe
3488     else
3489         AC_MSG_ERROR([Visual C++ not found after all, huh])
3490     fi
3492     AC_MSG_CHECKING([$CC is at least Visual Studio 2017 version 15.7])
3493     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3494         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3495         // between Visual Studio versions and _MSC_VER:
3496         #if _MSC_VER < 1914
3497         #error
3498         #endif
3499     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3501     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3502     # version of the Explorer extension (and maybe other small
3503     # bits, too) needed when installing a 32-bit LibreOffice on a
3504     # 64-bit OS. The 64-bit Explorer extension is a feature that
3505     # has been present since long in OOo. Don't confuse it with
3506     # building LibreOffice itself as 64-bit code.
3508     BUILD_X64=
3509     CXX_X64_BINARY=
3510     LINK_X64_BINARY=
3512     if test "$BITNESS_OVERRIDE" = ""; then
3513         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3514         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3515             # Prefer native x64 compiler to cross-compiler, in case we are running
3516             # the build on a 64-bit OS.
3517             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3518                 BUILD_X64=TRUE
3519                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3520                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3521             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3522                 BUILD_X64=TRUE
3523                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3524                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3525             fi
3526         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3527             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3528             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3529                 BUILD_X64=TRUE
3530                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3531                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3532             fi
3533         fi
3534         if test "$BUILD_X64" = TRUE; then
3535             AC_MSG_RESULT([found])
3536         else
3537             AC_MSG_RESULT([not found])
3538             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3539         fi
3540     fi
3541     AC_SUBST(BUILD_X64)
3543     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3544     AC_SUBST(CXX_X64_BINARY)
3545     AC_SUBST(LINK_X64_BINARY)
3547     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3548     # needed to support TWAIN scan on both 32- and 64-bit systems
3550     BUILD_X86=
3552     if test "$BITNESS_OVERRIDE" = "64"; then
3553         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3554         if test -n "$CXX_X86_BINARY"; then
3555             BUILD_X86=TRUE
3556             AC_MSG_RESULT([preset])
3557         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3558             BUILD_X86=TRUE
3559             CXX_X86_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe -arch:SSE"
3560             AC_MSG_RESULT([found])
3561         else
3562             CXX_X86_BINARY=
3563             AC_MSG_RESULT([not found])
3564             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3565         fi
3566     else
3567         BUILD_X86=TRUE
3568         CXX_X86_BINARY=$MSVC_CXX
3569     fi
3570     AC_SUBST(BUILD_X86)
3571     AC_SUBST(CXX_X86_BINARY)
3573 AC_SUBST(VCVER)
3574 AC_SUBST(DEVENV)
3575 PathFormat "$MSPDB_PATH"
3576 MSPDB_PATH="$formatted_path"
3577 AC_SUBST(MSVC_CXX)
3580 # unowinreg.dll
3582 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3583 AC_SUBST(UNOWINREG_DLL)
3585 COM_IS_CLANG=
3586 AC_MSG_CHECKING([whether the compiler is actually Clang])
3587 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3588     #ifndef __clang__
3589     you lose
3590     #endif
3591     int foo=42;
3592     ]])],
3593     [AC_MSG_RESULT([yes])
3594      COM_IS_CLANG=TRUE],
3595     [AC_MSG_RESULT([no])])
3596 AC_SUBST(COM_IS_CLANG)
3598 CC_PLAIN=$CC
3599 CLANGVER=
3600 if test "$COM_IS_CLANG" = TRUE; then
3601     AC_MSG_CHECKING([whether Clang is new enough])
3602     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3603         #if !defined __apple_build_version__
3604         #error
3605         #endif
3606         ]])],
3607         [my_apple_clang=yes],[my_apple_clang=])
3608     if test "$my_apple_clang" = yes; then
3609         AC_MSG_RESULT([assumed yes (Apple Clang)])
3610     else
3611         if test "$_os" = WINNT; then
3612             dnl In which case, assume clang-cl:
3613             my_args="/EP /TC"
3614             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3615             dnl clang-cl:
3616             CC_PLAIN=
3617             for i in $CC; do
3618                 case $i in
3619                 -FIIntrin.h)
3620                     ;;
3621                 *)
3622                     CC_PLAIN="$CC_PLAIN $i"
3623                     ;;
3624                 esac
3625             done
3626         else
3627             my_args="-E -P"
3628         fi
3629         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3630         CLANGVER=`echo $clang_version \
3631             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3632         if test "$CLANGVER" -ge 50002; then
3633             AC_MSG_RESULT([yes ($clang_version)])
3634         else
3635             CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3636             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3637         fi
3638         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3639     fi
3642 SHOWINCLUDES_PREFIX=
3643 if test "$_os" = WINNT; then
3644     dnl We need to guess the prefix of the -showIncludes output, it can be
3645     dnl localized
3646     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3647     echo "#include <stdlib.h>" > conftest.c
3648     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3649         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3650     rm -f conftest.c conftest.obj
3651     if test -z "$SHOWINCLUDES_PREFIX"; then
3652         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3653     else
3654         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3655     fi
3657 AC_SUBST(SHOWINCLUDES_PREFIX)
3660 # prefix C with ccache if needed
3662 if test "$CCACHE" != ""; then
3663     AC_MSG_CHECKING([whether $CC is already ccached])
3665     AC_LANG_PUSH([C])
3666     save_CFLAGS=$CFLAGS
3667     CFLAGS="$CFLAGS --ccache-skip -O2"
3668     dnl an empty program will do, we're checking the compiler flags
3669     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3670                       [use_ccache=yes], [use_ccache=no])
3671     if test $use_ccache = yes; then
3672         AC_MSG_RESULT([yes])
3673     else
3674         CC="$CCACHE $CC"
3675         AC_MSG_RESULT([no])
3676     fi
3677     CFLAGS=$save_CFLAGS
3678     AC_LANG_POP([C])
3681 # ===================================================================
3682 # check various GCC options that Clang does not support now but maybe
3683 # will somewhen in the future, check them even for GCC, so that the
3684 # flags are set
3685 # ===================================================================
3687 HAVE_GCC_GGDB2=
3688 if test "$GCC" = "yes"; then
3689     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3690     save_CFLAGS=$CFLAGS
3691     CFLAGS="$CFLAGS -Werror -ggdb2"
3692     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3693     CFLAGS=$save_CFLAGS
3694     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3695         AC_MSG_RESULT([yes])
3696     else
3697         AC_MSG_RESULT([no])
3698     fi
3700     if test "$host_cpu" = "m68k"; then
3701         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3702         save_CFLAGS=$CFLAGS
3703         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3704         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3705         CFLAGS=$save_CFLAGS
3706         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3707             AC_MSG_RESULT([yes])
3708         else
3709             AC_MSG_ERROR([no])
3710         fi
3711     fi
3713 AC_SUBST(HAVE_GCC_GGDB2)
3715 dnl ===================================================================
3716 dnl  Test the gcc version
3717 dnl ===================================================================
3718 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3719     AC_MSG_CHECKING([the GCC version])
3720     _gcc_version=`$CC -dumpversion`
3721     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3722         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3723     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3725     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3727     if test "$gcc_full_version" -lt 70000; then
3728         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3729     fi
3730 else
3731     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3732     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3733     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3734     # (which reports itself as GCC 4.2.1).
3735     GCC_VERSION=
3737 AC_SUBST(GCC_VERSION)
3739 dnl Set the ENABLE_DBGUTIL variable
3740 dnl ===================================================================
3741 AC_MSG_CHECKING([whether to build with additional debug utilities])
3742 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3743     ENABLE_DBGUTIL="TRUE"
3744     # this is an extra var so it can have different default on different MSVC
3745     # versions (in case there are version specific problems with it)
3746     MSVC_USE_DEBUG_RUNTIME="TRUE"
3748     AC_MSG_RESULT([yes])
3749     # cppunit and graphite expose STL in public headers
3750     if test "$with_system_cppunit" = "yes"; then
3751         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3752     else
3753         with_system_cppunit=no
3754     fi
3755     if test "$with_system_graphite" = "yes"; then
3756         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3757     else
3758         with_system_graphite=no
3759     fi
3760     if test "$with_system_orcus" = "yes"; then
3761         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3762     else
3763         with_system_orcus=no
3764     fi
3765     if test "$with_system_libcmis" = "yes"; then
3766         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3767     else
3768         with_system_libcmis=no
3769     fi
3770     if test "$with_system_hunspell" = "yes"; then
3771         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3772     else
3773         with_system_hunspell=no
3774     fi
3775     if test "$with_system_gpgmepp" = "yes"; then
3776         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3777     else
3778         with_system_gpgmepp=no
3779     fi
3780     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3781     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3782     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3783     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3784     # of those two is using the system variant:
3785     if test "$with_system_libnumbertext" = "yes"; then
3786         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3787     else
3788         with_system_libnumbertext=no
3789     fi
3790     if test "$with_system_libwps" = "yes"; then
3791         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3792     else
3793         with_system_libwps=no
3794     fi
3795 else
3796     ENABLE_DBGUTIL=""
3797     MSVC_USE_DEBUG_RUNTIME=""
3798     AC_MSG_RESULT([no])
3800 AC_SUBST(ENABLE_DBGUTIL)
3801 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3803 dnl Set the ENABLE_DEBUG variable.
3804 dnl ===================================================================
3805 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3806     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3808 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3809     if test -z "$libo_fuzzed_enable_debug"; then
3810         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3811     else
3812         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3813         enable_debug=yes
3814     fi
3817 AC_MSG_CHECKING([whether to do a debug build])
3818 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3819     ENABLE_DEBUG="TRUE"
3820     if test -n "$ENABLE_DBGUTIL" ; then
3821         AC_MSG_RESULT([yes (dbgutil)])
3822     else
3823         AC_MSG_RESULT([yes])
3824     fi
3825 else
3826     ENABLE_DEBUG=""
3827     AC_MSG_RESULT([no])
3829 AC_SUBST(ENABLE_DEBUG)
3831 dnl ===================================================================
3832 dnl Select the linker to use (gold/lld/ld.bfd).
3833 dnl This is done only after compiler checks (need to know if Clang is
3834 dnl used, for different defaults) and after checking if a debug build
3835 dnl is wanted (non-debug builds get the default linker if not explictly
3836 dnl specified otherwise).
3837 dnl All checks for linker features/options should come after this.
3838 dnl ===================================================================
3839 check_use_ld()
3841     use_ld=$1
3842     use_ld_fail_if_error=$2
3843     use_ld_ok=
3844     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3845     use_ld_ldflags_save="$LDFLAGS"
3846     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3847     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3848 #include <stdio.h>
3849         ],[
3850 printf ("hello world\n");
3851         ])], USE_LD=$use_ld, [])
3852     if test -n "$USE_LD"; then
3853         AC_MSG_RESULT( yes )
3854         use_ld_ok=yes
3855         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3856         dnl if sanitizers are used, and lld doesn't support this option.
3857         use_ld_has_sanitizers=
3858         for i in $CC; do
3859             case $i in
3860             -fsanitize=*)
3861                 use_ld_has_sanitizers=yes
3862                 break
3863                 ;;
3864             esac
3865         done
3866         if test -n "$use_ld_has_sanitizers"; then
3867             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3868             use_ld_ldflags_save_2="$LDFLAGS"
3869             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3870             use_ld_has_cpp_typeinfo=
3871             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3872 #include <stdio.h>
3873                 ],[
3874 printf ("hello world\n");
3875                 ])], use_ld_has_cpp_typeinfo=yes, [])
3876             LDFLAGS="$use_ld_ldflags_save_2"
3877             if test -n "$use_ld_has_cpp_typeinfo"; then
3878                 AC_MSG_RESULT( yes )
3879             else
3880                 AC_MSG_RESULT( no )
3881                 use_ld_ok=
3882             fi
3883         fi
3884     else
3885         if test -n "$use_ld_fail_if_error"; then
3886             AC_MSG_ERROR( no )
3887         else
3888             AC_MSG_RESULT( no )
3889         fi
3890     fi
3891     if test -n "$use_ld_ok"; then
3892         dnl keep the value of LDFLAGS
3893         return 0
3894     fi
3895     LDFLAGS="$use_ld_ldflags_save"
3896     return 1
3898 USE_LD=
3899 if test "$enable_ld" != "no"; then
3900     if test "$GCC" = "yes"; then
3901         if test -n "$enable_ld"; then
3902             check_use_ld "$enable_ld" fail_if_error
3903         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3904             dnl non-debug builds default to the default linker
3905             true
3906         elif test -n "$COM_IS_CLANG"; then
3907             check_use_ld lld
3908             if test $? -ne 0; then
3909                 check_use_ld gold
3910             fi
3911         else
3912             check_use_ld gold
3913         fi
3914         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c - $CFLAGS $LDFLAGS 2>/dev/null)
3915         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
3916         if test -z "$ld_used"; then
3917             ld_used="unknown"
3918         fi
3919         AC_MSG_CHECKING([for linker that is used])
3920         AC_MSG_RESULT([$ld_used])
3921         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3922             if echo "$ld_used" | grep -q "^GNU ld"; then
3923                 if test -n "$COM_IS_CLANG"; then
3924                     AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
3925                     add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
3926                 else
3927                     AC_MSG_WARN([The default GNU linker is slow, consider using the GNU gold linker.])
3928                     add_warning "The default GNU linker is slow, consider using the GNU gold linker."
3929                 fi
3930             fi
3931         fi
3932     else
3933         if test "$enable_ld" = "yes"; then
3934             AC_MSG_ERROR([--enable-ld not supported])
3935         fi
3936     fi
3938 AC_SUBST(USE_LD)
3940 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3941 if test "$GCC" = "yes"; then
3942     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3943     bsymbolic_functions_ldflags_save=$LDFLAGS
3944     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3945     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3946 #include <stdio.h>
3947         ],[
3948 printf ("hello world\n");
3949         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3950     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3951         AC_MSG_RESULT( found )
3952     else
3953         AC_MSG_RESULT( not found )
3954     fi
3955     LDFLAGS=$bsymbolic_functions_ldflags_save
3957 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3960 HAVE_GSPLIT_DWARF=
3961 if test "$enable_split_debug" != no; then
3962     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
3963     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
3964         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3965         save_CFLAGS=$CFLAGS
3966         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3967         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3968         CFLAGS=$save_CFLAGS
3969         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3970             AC_MSG_RESULT([yes])
3971         else
3972             if test "$enable_split_debug" = yes; then
3973                 AC_MSG_ERROR([no])
3974             else
3975                 AC_MSG_RESULT([no])
3976             fi
3977         fi
3978     fi
3979     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3980         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
3981         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
3982     fi
3984 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3986 ENABLE_GDB_INDEX=
3987 if test "$enable_gdb_index" != "no"; then
3988     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
3989     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
3990         AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3991         save_CFLAGS=$CFLAGS
3992         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3993         have_ggnu_pubnames=
3994         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
3995         if test "$have_ggnu_pubnames" != "TRUE"; then
3996             if test "$enable_gdb_index" = "yes"; then
3997                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
3998             else
3999                 AC_MSG_RESULT( no )
4000             fi
4001         else
4002             AC_MSG_RESULT( yes )
4003             AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
4004             ldflags_save=$LDFLAGS
4005             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4006             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4007 #include <stdio.h>
4008                 ],[
4009 printf ("hello world\n");
4010                 ])], ENABLE_GDB_INDEX=TRUE, [])
4011             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4012                 AC_MSG_RESULT( yes )
4013             else
4014                 if test "$enable_gdb_index" = "yes"; then
4015                     AC_MSG_ERROR( no )
4016                 else
4017                     AC_MSG_RESULT( no )
4018                 fi
4019             fi
4020             LDFLAGS=$ldflags_save
4021         fi
4022         CFLAGS=$save_CFLAGS
4023         fi
4024     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4025         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4026         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4027     fi
4029 AC_SUBST(ENABLE_GDB_INDEX)
4031 if test "$enable_sal_log" = yes; then
4032     ENABLE_SAL_LOG=TRUE
4034 AC_SUBST(ENABLE_SAL_LOG)
4036 dnl Selective debuginfo
4037 ENABLE_DEBUGINFO_FOR=
4038 if test -n "$ENABLE_DEBUG"; then
4039     AC_MSG_CHECKING([whether to use selective debuginfo])
4040     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
4041         if test "$enable_selective_debuginfo" = "yes"; then
4042             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
4043         fi
4044         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
4045         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
4046     else
4047         ENABLE_DEBUGINFO_FOR=all
4048         AC_MSG_RESULT([no, for all])
4049     fi
4050 else
4051     if test -n "$enable_selective_debuginfo"; then
4052         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
4053     fi
4055 AC_SUBST(ENABLE_DEBUGINFO_FOR)
4057 dnl Check for enable symbols option
4058 dnl ===================================================================
4059 AC_MSG_CHECKING([whether to generate debug information])
4060 if test -z "$enable_symbols"; then
4061     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4062         enable_symbols=yes
4063     else
4064         enable_symbols=no
4065     fi
4067 if test "$enable_symbols" != no; then
4068     ENABLE_SYMBOLS=TRUE
4069     AC_MSG_RESULT([yes])
4070 else
4071     ENABLE_SYMBOLS=
4072     AC_MSG_RESULT([no])
4074 AC_SUBST(ENABLE_SYMBOLS)
4076 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4077     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4078     AC_MSG_CHECKING([whether enough memory is available for linking])
4079     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4080     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4081     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4082         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4083     else
4084         AC_MSG_RESULT([yes])
4085     fi
4088 AC_MSG_CHECKING([whether to compile with optimization flags])
4089 if test -z "$enable_optimized"; then
4090     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4091         enable_optimized=no
4092     else
4093         enable_optimized=yes
4094     fi
4096 if test "$enable_optimized" != no; then
4097     ENABLE_OPTIMIZED=TRUE
4098     AC_MSG_RESULT([yes])
4099 else
4100     ENABLE_OPTIMIZED=
4101     AC_MSG_RESULT([no])
4103 AC_SUBST(ENABLE_OPTIMIZED)
4106 # determine CPUNAME, OS, ...
4107 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4109 case "$host_os" in
4111 aix*)
4112     COM=GCC
4113     CPUNAME=POWERPC
4114     USING_X11=TRUE
4115     OS=AIX
4116     RTL_OS=AIX
4117     RTL_ARCH=PowerPC
4118     PLATFORMID=aix_powerpc
4119     P_SEP=:
4120     ;;
4122 cygwin*)
4123     COM=MSC
4124     USING_X11=
4125     OS=WNT
4126     RTL_OS=Windows
4127     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4128         P_SEP=";"
4129     else
4130         P_SEP=:
4131     fi
4132     case "$host_cpu" in
4133     i*86|x86_64)
4134         if test "$BITNESS_OVERRIDE" = 64; then
4135             CPUNAME=X86_64
4136             RTL_ARCH=X86_64
4137             PLATFORMID=windows_x86_64
4138             WINDOWS_X64=1
4139             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4140         else
4141             CPUNAME=INTEL
4142             RTL_ARCH=x86
4143             PLATFORMID=windows_x86
4144         fi
4145         ;;
4146     *)
4147         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4148         ;;
4149     esac
4150     SCPDEFS="$SCPDEFS -D_MSC_VER"
4151     ;;
4153 darwin*)
4154     COM=GCC
4155     USING_X11=
4156     OS=MACOSX
4157     RTL_OS=MacOSX
4158     P_SEP=:
4160     case "$host_cpu" in
4161     arm)
4162         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4163         ;;
4164     arm64)
4165         OS=iOS
4166         if test "$enable_ios_simulator" = "yes"; then
4167             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4168         else
4169             CPUNAME=ARM64
4170             RTL_ARCH=ARM_EABI
4171             PLATFORMID=ios_arm64
4172         fi
4173         ;;
4174     i*86)
4175         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4176         ;;
4177     x86_64)
4178         if test "$enable_ios_simulator" = "yes"; then
4179             OS=iOS
4180         fi
4181         CPUNAME=X86_64
4182         RTL_ARCH=X86_64
4183         PLATFORMID=macosx_x86_64
4184         ;;
4185     *)
4186         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4187         ;;
4188     esac
4189     ;;
4191 dragonfly*)
4192     COM=GCC
4193     USING_X11=TRUE
4194     OS=DRAGONFLY
4195     RTL_OS=DragonFly
4196     P_SEP=:
4198     case "$host_cpu" in
4199     i*86)
4200         CPUNAME=INTEL
4201         RTL_ARCH=x86
4202         PLATFORMID=dragonfly_x86
4203         ;;
4204     x86_64)
4205         CPUNAME=X86_64
4206         RTL_ARCH=X86_64
4207         PLATFORMID=dragonfly_x86_64
4208         ;;
4209     *)
4210         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4211         ;;
4212     esac
4213     ;;
4215 freebsd*)
4216     COM=GCC
4217     USING_X11=TRUE
4218     RTL_OS=FreeBSD
4219     OS=FREEBSD
4220     P_SEP=:
4222     case "$host_cpu" in
4223     i*86)
4224         CPUNAME=INTEL
4225         RTL_ARCH=x86
4226         PLATFORMID=freebsd_x86
4227         ;;
4228     x86_64|amd64)
4229         CPUNAME=X86_64
4230         RTL_ARCH=X86_64
4231         PLATFORMID=freebsd_x86_64
4232         ;;
4233     *)
4234         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4235         ;;
4236     esac
4237     ;;
4239 haiku*)
4240     COM=GCC
4241     USING_X11=
4242     GUIBASE=haiku
4243     RTL_OS=Haiku
4244     OS=HAIKU
4245     P_SEP=:
4247     case "$host_cpu" in
4248     i*86)
4249         CPUNAME=INTEL
4250         RTL_ARCH=x86
4251         PLATFORMID=haiku_x86
4252         ;;
4253     x86_64|amd64)
4254         CPUNAME=X86_64
4255         RTL_ARCH=X86_64
4256         PLATFORMID=haiku_x86_64
4257         ;;
4258     *)
4259         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4260         ;;
4261     esac
4262     ;;
4264 kfreebsd*)
4265     COM=GCC
4266     USING_X11=TRUE
4267     OS=LINUX
4268     RTL_OS=kFreeBSD
4269     P_SEP=:
4271     case "$host_cpu" in
4273     i*86)
4274         CPUNAME=INTEL
4275         RTL_ARCH=x86
4276         PLATFORMID=kfreebsd_x86
4277         ;;
4278     x86_64)
4279         CPUNAME=X86_64
4280         RTL_ARCH=X86_64
4281         PLATFORMID=kfreebsd_x86_64
4282         ;;
4283     *)
4284         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4285         ;;
4286     esac
4287     ;;
4289 linux-gnu*)
4290     COM=GCC
4291     USING_X11=TRUE
4292     OS=LINUX
4293     RTL_OS=Linux
4294     P_SEP=:
4296     case "$host_cpu" in
4298     aarch64)
4299         CPUNAME=AARCH64
4300         PLATFORMID=linux_aarch64
4301         RTL_ARCH=AARCH64
4302         ;;
4303     alpha)
4304         CPUNAME=AXP
4305         RTL_ARCH=ALPHA
4306         PLATFORMID=linux_alpha
4307         ;;
4308     arm*)
4309         CPUNAME=ARM
4310         EPM_FLAGS="-a arm"
4311         RTL_ARCH=ARM_EABI
4312         PLATFORMID=linux_arm_eabi
4313         case "$host_cpu" in
4314         arm*-linux)
4315             RTL_ARCH=ARM_OABI
4316             PLATFORMID=linux_arm_oabi
4317             ;;
4318         esac
4319         ;;
4320     hppa)
4321         CPUNAME=HPPA
4322         RTL_ARCH=HPPA
4323         EPM_FLAGS="-a hppa"
4324         PLATFORMID=linux_hppa
4325         ;;
4326     i*86)
4327         CPUNAME=INTEL
4328         RTL_ARCH=x86
4329         PLATFORMID=linux_x86
4330         ;;
4331     ia64)
4332         CPUNAME=IA64
4333         RTL_ARCH=IA64
4334         PLATFORMID=linux_ia64
4335         ;;
4336     mips)
4337         CPUNAME=GODSON
4338         RTL_ARCH=MIPS_EB
4339         EPM_FLAGS="-a mips"
4340         PLATFORMID=linux_mips_eb
4341         ;;
4342     mips64)
4343         CPUNAME=GODSON64
4344         RTL_ARCH=MIPS64_EB
4345         EPM_FLAGS="-a mips64"
4346         PLATFORMID=linux_mips64_eb
4347         ;;
4348     mips64el)
4349         CPUNAME=GODSON64
4350         RTL_ARCH=MIPS64_EL
4351         EPM_FLAGS="-a mips64el"
4352         PLATFORMID=linux_mips64_el
4353         ;;
4354     mipsel)
4355         CPUNAME=GODSON
4356         RTL_ARCH=MIPS_EL
4357         EPM_FLAGS="-a mipsel"
4358         PLATFORMID=linux_mips_el
4359         ;;
4360     m68k)
4361         CPUNAME=M68K
4362         RTL_ARCH=M68K
4363         PLATFORMID=linux_m68k
4364         ;;
4365     powerpc)
4366         CPUNAME=POWERPC
4367         RTL_ARCH=PowerPC
4368         PLATFORMID=linux_powerpc
4369         ;;
4370     powerpc64)
4371         CPUNAME=POWERPC64
4372         RTL_ARCH=PowerPC_64
4373         PLATFORMID=linux_powerpc64
4374         ;;
4375     powerpc64le)
4376         CPUNAME=POWERPC64
4377         RTL_ARCH=PowerPC_64_LE
4378         PLATFORMID=linux_powerpc64_le
4379         ;;
4380     sparc)
4381         CPUNAME=SPARC
4382         RTL_ARCH=SPARC
4383         PLATFORMID=linux_sparc
4384         ;;
4385     sparc64)
4386         CPUNAME=SPARC64
4387         RTL_ARCH=SPARC64
4388         PLATFORMID=linux_sparc64
4389         ;;
4390     s390)
4391         CPUNAME=S390
4392         RTL_ARCH=S390
4393         PLATFORMID=linux_s390
4394         ;;
4395     s390x)
4396         CPUNAME=S390X
4397         RTL_ARCH=S390x
4398         PLATFORMID=linux_s390x
4399         ;;
4400     x86_64)
4401         CPUNAME=X86_64
4402         RTL_ARCH=X86_64
4403         PLATFORMID=linux_x86_64
4404         ;;
4405     *)
4406         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4407         ;;
4408     esac
4409     ;;
4411 linux-android*)
4412     COM=GCC
4413     USING_X11=
4414     OS=ANDROID
4415     RTL_OS=Android
4416     P_SEP=:
4418     case "$host_cpu" in
4420     arm|armel)
4421         CPUNAME=ARM
4422         RTL_ARCH=ARM_EABI
4423         PLATFORMID=android_arm_eabi
4424         ;;
4425     aarch64)
4426         CPUNAME=AARCH64
4427         RTL_ARCH=AARCH64
4428         PLATFORMID=android_aarch64
4429         ;;
4430     mips|mipsel)
4431         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4432         RTL_ARCH=MIPS_EL
4433         PLATFORMID=android_mips_el
4434         ;;
4435     i*86)
4436         CPUNAME=INTEL
4437         RTL_ARCH=x86
4438         PLATFORMID=android_x86
4439         ;;
4440     *)
4441         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4442         ;;
4443     esac
4444     ;;
4446 *netbsd*)
4447     COM=GCC
4448     USING_X11=TRUE
4449     OS=NETBSD
4450     RTL_OS=NetBSD
4451     P_SEP=:
4453     case "$host_cpu" in
4454     i*86)
4455         CPUNAME=INTEL
4456         RTL_ARCH=x86
4457         PLATFORMID=netbsd_x86
4458         ;;
4459     powerpc)
4460         CPUNAME=POWERPC
4461         RTL_ARCH=PowerPC
4462         PLATFORMID=netbsd_powerpc
4463         ;;
4464     sparc)
4465         CPUNAME=SPARC
4466         RTL_ARCH=SPARC
4467         PLATFORMID=netbsd_sparc
4468         ;;
4469     x86_64)
4470         CPUNAME=X86_64
4471         RTL_ARCH=X86_64
4472         PLATFORMID=netbsd_x86_64
4473         ;;
4474     *)
4475         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4476         ;;
4477     esac
4478     ;;
4480 openbsd*)
4481     COM=GCC
4482     USING_X11=TRUE
4483     OS=OPENBSD
4484     RTL_OS=OpenBSD
4485     P_SEP=:
4487     case "$host_cpu" in
4488     i*86)
4489         CPUNAME=INTEL
4490         RTL_ARCH=x86
4491         PLATFORMID=openbsd_x86
4492         ;;
4493     x86_64)
4494         CPUNAME=X86_64
4495         RTL_ARCH=X86_64
4496         PLATFORMID=openbsd_x86_64
4497         ;;
4498     *)
4499         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4500         ;;
4501     esac
4502     SOLARINC="$SOLARINC -I/usr/local/include"
4503     ;;
4505 solaris*)
4506     COM=GCC
4507     USING_X11=TRUE
4508     OS=SOLARIS
4509     RTL_OS=Solaris
4510     P_SEP=:
4512     case "$host_cpu" in
4513     i*86)
4514         CPUNAME=INTEL
4515         RTL_ARCH=x86
4516         PLATFORMID=solaris_x86
4517         ;;
4518     sparc)
4519         CPUNAME=SPARC
4520         RTL_ARCH=SPARC
4521         PLATFORMID=solaris_sparc
4522         ;;
4523     sparc64)
4524         CPUNAME=SPARC64
4525         RTL_ARCH=SPARC64
4526         PLATFORMID=solaris_sparc64
4527         ;;
4528     *)
4529         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4530         ;;
4531     esac
4532     SOLARINC="$SOLARINC -I/usr/local/include"
4533     ;;
4536     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4537     ;;
4538 esac
4540 if test "$with_x" = "no"; then
4541     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4544 DISABLE_GUI=""
4545 if test "$enable_gui" = "no"; then
4546     if test "$USING_X11" != TRUE; then
4547         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4548     fi
4549     USING_X11=
4550     DISABLE_GUI=TRUE
4551     AC_DEFINE(HAVE_FEATURE_UI,0)
4552     test_cairo=yes
4554 AC_SUBST(DISABLE_GUI)
4556 WORKDIR="${BUILDDIR}/workdir"
4557 INSTDIR="${BUILDDIR}/instdir"
4558 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4559 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4560 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4561 AC_SUBST(COM)
4562 AC_SUBST(CPUNAME)
4563 AC_SUBST(RTL_OS)
4564 AC_SUBST(RTL_ARCH)
4565 AC_SUBST(EPM_FLAGS)
4566 AC_SUBST(USING_X11)
4567 AC_SUBST([INSTDIR])
4568 AC_SUBST([INSTROOT])
4569 AC_SUBST([INSTROOTBASE])
4570 AC_SUBST(OS)
4571 AC_SUBST(P_SEP)
4572 AC_SUBST(WORKDIR)
4573 AC_SUBST(PLATFORMID)
4574 AC_SUBST(WINDOWS_X64)
4575 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4577 dnl ===================================================================
4578 dnl Test which package format to use
4579 dnl ===================================================================
4580 AC_MSG_CHECKING([which package format to use])
4581 if test -n "$with_package_format" -a "$with_package_format" != no; then
4582     for i in $with_package_format; do
4583         case "$i" in
4584         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4585             ;;
4586         *)
4587             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4588 aix - AIX software distribution
4589 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4590 deb - Debian software distribution
4591 pkg - Solaris software distribution
4592 rpm - RedHat software distribution
4594 LibreOffice additionally supports:
4595 archive - .tar.gz or .zip
4596 dmg - macOS .dmg
4597 installed - installation tree
4598 msi - Windows .msi
4599         ])
4600             ;;
4601         esac
4602     done
4603     # fakeroot is needed to ensure correct file ownerships/permissions
4604     # inside deb packages and tar archives created on Linux and Solaris.
4605     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4606         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4607         if test "$FAKEROOT" = "no"; then
4608             AC_MSG_ERROR(
4609                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4610         fi
4611     fi
4612     PKGFORMAT="$with_package_format"
4613     AC_MSG_RESULT([$PKGFORMAT])
4614 else
4615     PKGFORMAT=
4616     AC_MSG_RESULT([none])
4618 AC_SUBST(PKGFORMAT)
4620 dnl ===================================================================
4621 dnl Set up a different compiler to produce tools to run on the build
4622 dnl machine when doing cross-compilation
4623 dnl ===================================================================
4625 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4626 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4627 if test "$cross_compiling" = "yes"; then
4628     AC_MSG_CHECKING([for BUILD platform configuration])
4629     echo
4630     rm -rf CONF-FOR-BUILD config_build.mk
4631     mkdir CONF-FOR-BUILD
4632     # Here must be listed all files needed when running the configure script. In particular, also
4633     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4634     # keep them in the same order as there.
4635     (cd $SRC_ROOT && tar cf - \
4636         config.guess \
4637         bin/get_config_variables \
4638         solenv/bin/getcompver.awk \
4639         solenv/inc/langlist.mk \
4640         download.lst \
4641         config_host.mk.in \
4642         config_host_lang.mk.in \
4643         Makefile.in \
4644         bin/bffvalidator.sh.in \
4645         bin/odfvalidator.sh.in \
4646         bin/officeotron.sh.in \
4647         instsetoo_native/util/openoffice.lst.in \
4648         config_host/*.in \
4649         sysui/desktop/macosx/Info.plist.in) \
4650     | (cd CONF-FOR-BUILD && tar xf -)
4651     cp configure CONF-FOR-BUILD
4652     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4653     (
4654     unset COM USING_X11 OS CPUNAME
4655     unset CC CXX SYSBASE CFLAGS
4656     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4657     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4658     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4659     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4660     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4661     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4662     cd CONF-FOR-BUILD
4663     sub_conf_opts=""
4664     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4665     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4666     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4667     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4668     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4669     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4670     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4671     # Don't bother having configure look for stuff not needed for the build platform anyway
4672     ./configure \
4673         --disable-cups \
4674         --disable-gstreamer-1-0 \
4675         --disable-gstreamer-0-10 \
4676         --disable-gtk \
4677         --disable-gtk3 \
4678         --disable-pdfimport \
4679         --disable-postgresql-sdbc \
4680         --with-parallelism="$with_parallelism" \
4681         --without-doxygen \
4682         --without-java \
4683         $sub_conf_opts \
4684         --srcdir=$srcdir \
4685         2>&1 | sed -e 's/^/    /'
4686     test -f ./config_host.mk 2>/dev/null || exit
4687     cp config_host.mk ../config_build.mk
4688     cp config_host_lang.mk ../config_build_lang.mk
4689     mv config.log ../config.Build.log
4690     mkdir -p ../config_build
4691     mv config_host/*.h ../config_build
4692     . ./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
4694     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
4695         VV='$'$V
4696         VV=`eval "echo $VV"`
4697         if test -n "$VV"; then
4698             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4699             echo "$line" >>build-config
4700         fi
4701     done
4703     for V in INSTDIR INSTROOT WORKDIR; do
4704         VV='$'$V
4705         VV=`eval "echo $VV"`
4706         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4707         if test -n "$VV"; then
4708             line="${V}_FOR_BUILD='$VV'"
4709             echo "$line" >>build-config
4710         fi
4711     done
4713     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4714     echo "$line" >>build-config
4716     )
4717     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4718     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])
4719     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4720              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4722     eval `cat CONF-FOR-BUILD/build-config`
4724     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4726     rm -rf CONF-FOR-BUILD
4727 else
4728     OS_FOR_BUILD="$OS"
4729     CC_FOR_BUILD="$CC"
4730     CXX_FOR_BUILD="$CXX"
4731     INSTDIR_FOR_BUILD="$INSTDIR"
4732     INSTROOT_FOR_BUILD="$INSTROOT"
4733     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4734     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4735     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4736     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4737     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4738     WORKDIR_FOR_BUILD="$WORKDIR"
4740 AC_SUBST(OS_FOR_BUILD)
4741 AC_SUBST(INSTDIR_FOR_BUILD)
4742 AC_SUBST(INSTROOT_FOR_BUILD)
4743 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4744 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4745 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4746 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4747 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4748 AC_SUBST(WORKDIR_FOR_BUILD)
4750 dnl ===================================================================
4751 dnl Check for syslog header
4752 dnl ===================================================================
4753 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4755 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4756 dnl ===================================================================
4757 AC_MSG_CHECKING([whether to turn warnings to errors])
4758 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4759     ENABLE_WERROR="TRUE"
4760     AC_MSG_RESULT([yes])
4761 else
4762     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4763         ENABLE_WERROR="TRUE"
4764         AC_MSG_RESULT([yes])
4765     else
4766         AC_MSG_RESULT([no])
4767     fi
4769 AC_SUBST(ENABLE_WERROR)
4771 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4772 dnl ===================================================================
4773 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4774 if test -z "$enable_assert_always_abort"; then
4775    if test "$ENABLE_DEBUG" = TRUE; then
4776        enable_assert_always_abort=yes
4777    else
4778        enable_assert_always_abort=no
4779    fi
4781 if test "$enable_assert_always_abort" = "yes"; then
4782     ASSERT_ALWAYS_ABORT="TRUE"
4783     AC_MSG_RESULT([yes])
4784 else
4785     ASSERT_ALWAYS_ABORT="FALSE"
4786     AC_MSG_RESULT([no])
4788 AC_SUBST(ASSERT_ALWAYS_ABORT)
4790 # Determine whether to use ooenv for the instdir installation
4791 # ===================================================================
4792 if test $_os != "WINNT" -a $_os != "Darwin"; then
4793     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4794     if test "$enable_ooenv" = "no"; then
4795         AC_MSG_RESULT([no])
4796     else
4797         ENABLE_OOENV="TRUE"
4798         AC_MSG_RESULT([yes])
4799     fi
4801 AC_SUBST(ENABLE_OOENV)
4803 if test "$USING_X11" != TRUE; then
4804     # be sure to do not mess with unneeded stuff
4805     test_randr=no
4806     test_xrender=no
4807     test_cups=no
4808     test_dbus=no
4809     test_gtk=no
4810     build_gstreamer_1_0=no
4811     build_gstreamer_0_10=no
4812     test_kde5=no
4813     test_qt5=no
4814     test_gtk3_kde5=no
4815     enable_cairo_canvas=no
4818 if test "$OS" = "HAIKU"; then
4819     enable_cairo_canvas=yes
4820     test_kde5=yes
4823 if test "$test_kde5" = "yes"; then
4824     test_qt5=yes
4827 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4828     if test "$enable_qt5" = "no"; then
4829         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4830     else
4831         enable_qt5=yes
4832     fi
4835 dnl ===================================================================
4836 dnl check for cups support
4837 dnl ===================================================================
4838 ENABLE_CUPS=""
4840 if test "$enable_cups" = "no"; then
4841     test_cups=no
4844 AC_MSG_CHECKING([whether to enable CUPS support])
4845 if test "$test_cups" = "yes"; then
4846     ENABLE_CUPS="TRUE"
4847     AC_MSG_RESULT([yes])
4849     AC_MSG_CHECKING([whether cups support is present])
4850     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4851     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4852     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4853         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4854     fi
4856 else
4857     AC_MSG_RESULT([no])
4860 AC_SUBST(ENABLE_CUPS)
4862 # fontconfig checks
4863 if test "$test_fontconfig" = "yes"; then
4864     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4865     SYSTEM_FONTCONFIG=TRUE
4866     FilterLibs "${FONTCONFIG_LIBS}"
4867     FONTCONFIG_LIBS="${filteredlibs}"
4869 AC_SUBST(FONTCONFIG_CFLAGS)
4870 AC_SUBST(FONTCONFIG_LIBS)
4871 AC_SUBST([SYSTEM_FONTCONFIG])
4873 dnl whether to find & fetch external tarballs?
4874 dnl ===================================================================
4875 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4876    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4877        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4878    else
4879        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4880    fi
4882 if test -z "$TARFILE_LOCATION"; then
4883     if test -d "$SRC_ROOT/src" ; then
4884         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4885         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4886     fi
4887     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4888 else
4889     AbsolutePath "$TARFILE_LOCATION"
4890     PathFormat "${absolute_path}"
4891     TARFILE_LOCATION="${formatted_path}"
4893 AC_SUBST(TARFILE_LOCATION)
4895 AC_MSG_CHECKING([whether we want to fetch tarballs])
4896 if test "$enable_fetch_external" != "no"; then
4897     if test "$with_all_tarballs" = "yes"; then
4898         AC_MSG_RESULT([yes, all of them])
4899         DO_FETCH_TARBALLS="ALL"
4900     else
4901         AC_MSG_RESULT([yes, if we use them])
4902         DO_FETCH_TARBALLS="TRUE"
4903     fi
4904 else
4905     AC_MSG_RESULT([no])
4906     DO_FETCH_TARBALLS=
4908 AC_SUBST(DO_FETCH_TARBALLS)
4910 AC_MSG_CHECKING([whether to build help])
4911 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4912     BUILD_TYPE="$BUILD_TYPE HELP"
4913     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4914     case "$with_help" in
4915     "html")
4916         ENABLE_HTMLHELP=TRUE
4917         SCPDEFS="$SCPDEFS -DWITH_HELP"
4918         AC_MSG_RESULT([HTML])
4919         ;;
4920     "online")
4921         ENABLE_HTMLHELP=TRUE
4922         HELP_ONLINE=TRUE
4923         AC_MSG_RESULT([HTML])
4924         ;;
4925     yes)
4926         SCPDEFS="$SCPDEFS -DWITH_HELP"
4927         AC_MSG_RESULT([yes])
4928         ;;
4929     *)
4930         AC_MSG_ERROR([Unknown --with-help=$with_help])
4931         ;;
4932     esac
4933 else
4934     AC_MSG_RESULT([no])
4936 AC_SUBST([ENABLE_HTMLHELP])
4937 AC_SUBST([HELP_ONLINE])
4939 dnl Test whether to include MySpell dictionaries
4940 dnl ===================================================================
4941 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4942 if test "$with_myspell_dicts" = "yes"; then
4943     AC_MSG_RESULT([yes])
4944     WITH_MYSPELL_DICTS=TRUE
4945     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4946     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4947 else
4948     AC_MSG_RESULT([no])
4949     WITH_MYSPELL_DICTS=
4951 AC_SUBST(WITH_MYSPELL_DICTS)
4953 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
4954 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4955     if test "$with_system_dicts" = yes; then
4956         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4957     fi
4958     with_system_dicts=no
4961 AC_MSG_CHECKING([whether to use dicts from external paths])
4962 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4963     AC_MSG_RESULT([yes])
4964     SYSTEM_DICTS=TRUE
4965     AC_MSG_CHECKING([for spelling dictionary directory])
4966     if test -n "$with_external_dict_dir"; then
4967         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4968     else
4969         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4970         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4971             DICT_SYSTEM_DIR=file:///usr/share/myspell
4972         fi
4973     fi
4974     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4975     AC_MSG_CHECKING([for hyphenation patterns directory])
4976     if test -n "$with_external_hyph_dir"; then
4977         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4978     else
4979         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4980     fi
4981     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4982     AC_MSG_CHECKING([for thesaurus directory])
4983     if test -n "$with_external_thes_dir"; then
4984         THES_SYSTEM_DIR=file://$with_external_thes_dir
4985     else
4986         THES_SYSTEM_DIR=file:///usr/share/mythes
4987     fi
4988     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4989 else
4990     AC_MSG_RESULT([no])
4991     SYSTEM_DICTS=
4993 AC_SUBST(SYSTEM_DICTS)
4994 AC_SUBST(DICT_SYSTEM_DIR)
4995 AC_SUBST(HYPH_SYSTEM_DIR)
4996 AC_SUBST(THES_SYSTEM_DIR)
4998 dnl ===================================================================
4999 dnl enable pch by default on windows
5000 dnl enable it explicitly otherwise
5001 ENABLE_PCH=""
5002 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
5003     if test -z "$libo_fuzzed_enable_pch"; then
5004         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
5005     else
5006         AC_MSG_NOTICE([Resetting --enable-pch=no])
5007         enable_pch=no
5008     fi
5011 AC_MSG_CHECKING([whether to enable pch feature])
5012 if test "$enable_pch" != "no"; then
5013     if test "$_os" = "WINNT"; then
5014         ENABLE_PCH="TRUE"
5015         AC_MSG_RESULT([yes])
5016     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
5017         ENABLE_PCH="TRUE"
5018         AC_MSG_RESULT([yes])
5019     elif test -n "$enable_pch"; then
5020         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5021     else
5022         AC_MSG_RESULT([no])
5023     fi
5024 else
5025     AC_MSG_RESULT([no])
5027 AC_SUBST(ENABLE_PCH)
5029 TAB=`printf '\t'`
5031 AC_MSG_CHECKING([the GNU Make version])
5032 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5033 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5034 if test "$_make_longver" -ge "038200"; then
5035     AC_MSG_RESULT([$GNUMAKE $_make_version])
5037 elif test "$_make_longver" -ge "038100"; then
5038     if test "$build_os" = "cygwin"; then
5039         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5040     fi
5041     AC_MSG_RESULT([$GNUMAKE $_make_version])
5043     dnl ===================================================================
5044     dnl Search all the common names for sha1sum
5045     dnl ===================================================================
5046     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5047     if test -z "$SHA1SUM"; then
5048         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5049     elif test "$SHA1SUM" = "openssl"; then
5050         SHA1SUM="openssl sha1"
5051     fi
5052     AC_MSG_CHECKING([for GNU Make bug 20033])
5053     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5054     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5055 A := \$(wildcard *.a)
5057 .PHONY: all
5058 all: \$(A:.a=.b)
5059 <TAB>@echo survived bug20033.
5061 .PHONY: setup
5062 setup:
5063 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5065 define d1
5066 @echo lala \$(1)
5067 @sleep 1
5068 endef
5070 define d2
5071 @echo tyty \$(1)
5072 @sleep 1
5073 endef
5075 %.b : %.a
5076 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5077 <TAB>\$(call d1,\$(CHECKSUM)),\
5078 <TAB>\$(call d2,\$(CHECKSUM)))
5080     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5081         no_parallelism_make="YES"
5082         AC_MSG_RESULT([yes, disable parallelism])
5083     else
5084         AC_MSG_RESULT([no, keep parallelism enabled])
5085     fi
5086     rm -rf $TESTGMAKEBUG20033
5087 else
5088     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5091 # find if gnumake support file function
5092 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5093 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5094 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5095     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5097 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5098 \$(file >test.txt,Success )
5100 .PHONY: all
5101 all:
5102 <TAB>@cat test.txt
5105 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5106 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5107     HAVE_GNUMAKE_FILE_FUNC=TRUE
5108     AC_MSG_RESULT([yes])
5109 else
5110     AC_MSG_RESULT([no])
5112 rm -rf $TESTGMAKEFILEFUNC
5113 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5114 AC_SUBST(GNUMAKE_WIN_NATIVE)
5116 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5117 STALE_MAKE=
5118 if test "$_make_ver_check" = ""; then
5119    STALE_MAKE=TRUE
5122 HAVE_LD_HASH_STYLE=FALSE
5123 WITH_LINKER_HASH_STYLE=
5124 AC_MSG_CHECKING([for --hash-style gcc linker support])
5125 if test "$GCC" = "yes"; then
5126     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5127         hash_styles="gnu sysv"
5128     elif test "$with_linker_hash_style" = "no"; then
5129         hash_styles=
5130     else
5131         hash_styles="$with_linker_hash_style"
5132     fi
5134     for hash_style in $hash_styles; do
5135         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5136         hash_style_ldflags_save=$LDFLAGS
5137         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5139         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5140             [
5141 #include <stdio.h>
5142             ],[
5143 printf ("");
5144             ])],
5145             [
5146                   HAVE_LD_HASH_STYLE=TRUE
5147                   WITH_LINKER_HASH_STYLE=$hash_style
5148             ],
5149             [HAVE_LD_HASH_STYLE=FALSE],
5150             [HAVE_LD_HASH_STYLE=FALSE])
5151         LDFLAGS=$hash_style_ldflags_save
5152     done
5154     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5155         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5156     else
5157         AC_MSG_RESULT( no )
5158     fi
5159     LDFLAGS=$hash_style_ldflags_save
5160 else
5161     AC_MSG_RESULT( no )
5163 AC_SUBST(HAVE_LD_HASH_STYLE)
5164 AC_SUBST(WITH_LINKER_HASH_STYLE)
5166 dnl ===================================================================
5167 dnl Check whether there's a Perl version available.
5168 dnl ===================================================================
5169 if test -z "$with_perl_home"; then
5170     AC_PATH_PROG(PERL, perl)
5171 else
5172     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5173     _perl_path="$with_perl_home/bin/perl"
5174     if test -x "$_perl_path"; then
5175         PERL=$_perl_path
5176     else
5177         AC_MSG_ERROR([$_perl_path not found])
5178     fi
5181 dnl ===================================================================
5182 dnl Testing for Perl version 5 or greater.
5183 dnl $] is the Perl version variable, it is returned as an integer
5184 dnl ===================================================================
5185 if test "$PERL"; then
5186     AC_MSG_CHECKING([the Perl version])
5187     ${PERL} -e "exit($]);"
5188     _perl_version=$?
5189     if test "$_perl_version" -lt 5; then
5190         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5191     fi
5192     AC_MSG_RESULT([Perl $_perl_version])
5193 else
5194     AC_MSG_ERROR([Perl not found, install Perl 5])
5197 dnl ===================================================================
5198 dnl Testing for required Perl modules
5199 dnl ===================================================================
5201 AC_MSG_CHECKING([for required Perl modules])
5202 perl_use_string="use Cwd ; use Digest::MD5"
5203 if test "$_os" = "WINNT"; then
5204     if test -n "$PKGFORMAT"; then
5205         for i in $PKGFORMAT; do
5206             case "$i" in
5207             msi)
5208                 # for getting fonts versions to use in MSI
5209                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5210                 ;;
5211             esac
5212         done
5213     fi
5215 if test "$with_system_hsqldb" = "yes"; then
5216         perl_use_string="$perl_use_string ; use Archive::Zip"
5218 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5219     AC_MSG_RESULT([all modules found])
5220 else
5221     AC_MSG_RESULT([failed to find some modules])
5222     # Find out which modules are missing.
5223     for i in $perl_use_string; do
5224         if test "$i" != "use" -a "$i" != ";"; then
5225             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5226                 missing_perl_modules="$missing_perl_modules $i"
5227             fi
5228         fi
5229     done
5230     AC_MSG_ERROR([
5231     The missing Perl modules are: $missing_perl_modules
5232     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5235 dnl ===================================================================
5236 dnl Check for pkg-config
5237 dnl ===================================================================
5238 if test "$_os" != "WINNT"; then
5239     PKG_PROG_PKG_CONFIG
5242 if test "$_os" != "WINNT"; then
5244     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5245     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5246     # explicitly. Or put /path/to/compiler in PATH yourself.
5248     # Use wrappers for LTO
5249     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5250         AC_CHECK_TOOL(AR,gcc-ar)
5251         AC_CHECK_TOOL(NM,gcc-nm)
5252         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5253     else
5254         AC_CHECK_TOOL(AR,ar)
5255         AC_CHECK_TOOL(NM,nm)
5256         AC_CHECK_TOOL(RANLIB,ranlib)
5257     fi
5258     AC_CHECK_TOOL(OBJDUMP,objdump)
5259     AC_CHECK_TOOL(READELF,readelf)
5260     AC_CHECK_TOOL(STRIP,strip)
5261     if test "$_os" = "WINNT"; then
5262         AC_CHECK_TOOL(DLLTOOL,dlltool)
5263         AC_CHECK_TOOL(WINDRES,windres)
5264     fi
5266 AC_SUBST(AR)
5267 AC_SUBST(DLLTOOL)
5268 AC_SUBST(NM)
5269 AC_SUBST(OBJDUMP)
5270 AC_SUBST(PKG_CONFIG)
5271 AC_SUBST(RANLIB)
5272 AC_SUBST(READELF)
5273 AC_SUBST(STRIP)
5274 AC_SUBST(WINDRES)
5276 dnl ===================================================================
5277 dnl pkg-config checks on macOS
5278 dnl ===================================================================
5280 if test $_os = Darwin; then
5281     AC_MSG_CHECKING([for bogus pkg-config])
5282     if test -n "$PKG_CONFIG"; then
5283         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5284             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5285         else
5286             if test "$enable_bogus_pkg_config" = "yes"; then
5287                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5288             else
5289                 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.])
5290             fi
5291         fi
5292     else
5293         AC_MSG_RESULT([no, good])
5294     fi
5297 find_csc()
5299     # Return value: $csctest
5301     unset csctest
5303     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5304     if test -n "$regvalue"; then
5305         csctest=$regvalue
5306         return
5307     fi
5310 find_al()
5312     # Return value: $altest
5314     unset altest
5316     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5317         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5318         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5319             altest=$regvalue
5320             return
5321         fi
5322     done
5324     # We need this additional check to detect 4.6.1 or above.
5325     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5326         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5327         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5328             altest=$regvalue
5329             return
5330         fi
5332         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5333         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5334             altest=$regvalue
5335             return
5336         fi
5337     done
5340 find_dotnetsdk46()
5342     unset frametest
5344     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5345         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5346         if test -n "$regvalue"; then
5347             frametest=$regvalue
5348             return
5349         fi
5350         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5351         if test -n "$regvalue"; then
5352             frametest=$regvalue
5353             return
5354         fi
5355     done
5358 find_winsdk_version()
5360     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5361     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5363     unset winsdktest winsdkbinsubdir winsdklibsubdir
5365     case "$1" in
5366     7.*)
5367         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5368         if test -n "$regvalue"; then
5369             winsdktest=$regvalue
5370             winsdklibsubdir=.
5371             return
5372         fi
5373         ;;
5374     8.0|8.0A)
5375         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5376         if test -n "$regvalue"; then
5377             winsdktest=$regvalue
5378             winsdklibsubdir=win8
5379             return
5380         fi
5381         ;;
5382     8.1|8.1A)
5383         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5384         if test -n "$regvalue"; then
5385             winsdktest=$regvalue
5386             winsdklibsubdir=winv6.3
5387             return
5388         fi
5389         ;;
5390     10.0)
5391         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5392         if test -n "$regvalue"; then
5393             winsdktest=$regvalue
5394             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5395             if test -n "$regvalue"; then
5396                 winsdkbinsubdir="$regvalue".0
5397                 winsdklibsubdir=$winsdkbinsubdir
5398                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5399                 # test exist the SDK path
5400                 if test -d "$tmppath"; then
5401                    # when path is convertible to a short path then path is okay
5402                    if ! cygpath -d "$tmppath"; then
5403                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5404                    fi
5405                 else
5406                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5407                 fi
5408             fi
5409             return
5410         fi
5411         ;;
5412     esac
5415 find_winsdk()
5417     # Return value: From find_winsdk_version
5419     unset winsdktest
5421     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5422         find_winsdk_version $ver
5423         if test -n "$winsdktest"; then
5424             return
5425         fi
5426     done
5429 find_msms()
5431     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5432     if test $VCVER = 150; then
5433         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5434     fi
5435     AC_MSG_CHECKING([for ${my_msm_files}])
5436     msmdir=
5437     for ver in 14.0 15.0; do
5438         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5439         if test -n "$regvalue"; then
5440             for f in ${my_msm_files}; do
5441                 if test -e "$regvalue/${f}"; then
5442                     msmdir=$regvalue
5443                     break
5444                 fi
5445             done
5446         fi
5447     done
5448     dnl Is the following fallback really necessary, or was it added in response
5449     dnl to never having started Visual Studio on a given machine, so the
5450     dnl registry keys checked above had presumably not yet been created?
5451     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5452     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5453     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5454     dnl expanding to "C:\Program Files\Common Files"), which would need
5455     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5456     dnl obtain its value from cygwin:
5457     if test -z "$msmdir"; then
5458         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5459         for f in ${my_msm_files}; do
5460             if test -e "$my_msm_dir/${f}"; then
5461                 msmdir=$my_msm_dir
5462             fi
5463         done
5464     fi
5466     dnl Starting from MSVC 15.0, merge modules are located in different directory
5467     if test $VCVER = 150; then
5468         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5469             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5470             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5471             for f in ${my_msm_files}; do
5472                 if test -e "$my_msm_dir/${f}"; then
5473                     msmdir=$my_msm_dir
5474                     break
5475                 fi
5476             done
5477         done
5478     fi
5480     if test -n "$msmdir"; then
5481         msmdir=`cygpath -m "$msmdir"`
5482         AC_MSG_RESULT([$msmdir])
5483     else
5484         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5485             AC_MSG_ERROR([not found])
5486         else
5487             AC_MSG_WARN([not found])
5488             add_warning "MSM none of ${my_msm_files} found"
5489         fi
5490     fi
5493 find_msvc_x64_dlls()
5495     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5496     if test "$VCVER" = 150; then
5497         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5498             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5499             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5500                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5501                 break
5502             fi
5503             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5504                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5505                 break
5506             fi
5507         done
5508     fi
5509     msvcdlls="msvcp140.dll vcruntime140.dll"
5510     for dll in $msvcdlls; do
5511         if ! test -f "$msvcdllpath/$dll"; then
5512             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5513         fi
5514     done
5517 dnl =========================================
5518 dnl Check for the Windows  SDK.
5519 dnl =========================================
5520 if test "$_os" = "WINNT"; then
5521     AC_MSG_CHECKING([for Windows SDK])
5522     if test "$build_os" = "cygwin"; then
5523         find_winsdk
5524         WINDOWS_SDK_HOME=$winsdktest
5526         # normalize if found
5527         if test -n "$WINDOWS_SDK_HOME"; then
5528             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5529             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5530         fi
5532         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5533     fi
5535     if test -n "$WINDOWS_SDK_HOME"; then
5536         # Remove a possible trailing backslash
5537         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5539         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5540              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5541              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5542             have_windows_sdk_headers=yes
5543         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5544              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5545              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5546             have_windows_sdk_headers=yes
5547         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5548              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5549              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5550             have_windows_sdk_headers=yes
5551         else
5552             have_windows_sdk_headers=no
5553         fi
5555         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5556             have_windows_sdk_libs=yes
5557         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5558             have_windows_sdk_libs=yes
5559         else
5560             have_windows_sdk_libs=no
5561         fi
5563         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5564             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5565 the  Windows SDK are installed.])
5566         fi
5567     fi
5569     if test -z "$WINDOWS_SDK_HOME"; then
5570         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5571     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5572         WINDOWS_SDK_VERSION=70
5573         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5574     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5575         WINDOWS_SDK_VERSION=80
5576         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5577     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5578         WINDOWS_SDK_VERSION=81
5579         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5580     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5581         WINDOWS_SDK_VERSION=10
5582         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5583     else
5584         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5585     fi
5586     PathFormat "$WINDOWS_SDK_HOME"
5587     WINDOWS_SDK_HOME="$formatted_path"
5588     if test "$build_os" = "cygwin"; then
5589         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5590         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5591             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5592         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5593             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5594         fi
5595     fi
5597     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5598     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5599     dnl but not in v8.0), so allow this to be overridden with a
5600     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5601     dnl and configuration error if no WiLangId.vbs is found would arguably be
5602     dnl better, but I do not know under which conditions exactly it is needed by
5603     dnl msiglobal.pm:
5604     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5605         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5606         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5607             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5608         fi
5609         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5610             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5611         fi
5612         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5613             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5614         fi
5615     fi
5616     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5617         if test -n "$with_package_format" -a "$with_package_format" != no; then
5618             for i in "$with_package_format"; do
5619                 if test "$i" = "msi"; then
5620                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5621                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5622                     fi
5623                 fi
5624             done
5625         fi
5626     fi
5628 AC_SUBST(WINDOWS_SDK_HOME)
5629 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5630 AC_SUBST(WINDOWS_SDK_VERSION)
5631 AC_SUBST(WINDOWS_SDK_WILANGID)
5633 if test "$build_os" = "cygwin"; then
5634     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5635     dnl dir, it also determines that dir's path w/o an arch segment if any,
5636     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5637     AC_MSG_CHECKING([for midl.exe])
5639     find_winsdk
5640     if test -n "$winsdkbinsubdir" \
5641         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5642     then
5643         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5644         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5645     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5646         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5647         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5648     elif test -f "$winsdktest/Bin/midl.exe"; then
5649         MIDL_PATH=$winsdktest/Bin
5650         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5651     fi
5652     if test ! -f "$MIDL_PATH/midl.exe"; then
5653         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5654     else
5655         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5656     fi
5658     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5659     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5661     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5662          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5663          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5664          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5665     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5666          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5667          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5668          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5669     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5670          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5671          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5672          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5673     else
5674         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5675     fi
5677     dnl Check csc.exe
5678     AC_MSG_CHECKING([for csc.exe])
5679     find_csc
5680     if test -f "$csctest/csc.exe"; then
5681         CSC_PATH="$csctest"
5682     fi
5683     if test ! -f "$CSC_PATH/csc.exe"; then
5684         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5685     else
5686         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5687     fi
5689     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5691     dnl Check al.exe
5692     AC_MSG_CHECKING([for al.exe])
5693     find_winsdk
5694     if test -n "$winsdkbinsubdir" \
5695         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5696     then
5697         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5698     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5699         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5700     elif test -f "$winsdktest/Bin/al.exe"; then
5701         AL_PATH="$winsdktest/Bin"
5702     fi
5704     if test -z "$AL_PATH"; then
5705         find_al
5706         if test -f "$altest/bin/al.exe"; then
5707             AL_PATH="$altest/bin"
5708         elif test -f "$altest/al.exe"; then
5709             AL_PATH="$altest"
5710         fi
5711     fi
5712     if test ! -f "$AL_PATH/al.exe"; then
5713         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5714     else
5715         AC_MSG_RESULT([$AL_PATH/al.exe])
5716     fi
5718     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5720     dnl Check mscoree.lib / .NET Framework dir
5721     AC_MSG_CHECKING(.NET Framework)
5722     find_dotnetsdk46
5723     PathFormat "$frametest"
5724     frametest="$formatted_path"
5725     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5726         DOTNET_FRAMEWORK_HOME="$frametest"
5727     else
5728         find_winsdk
5729         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5730             DOTNET_FRAMEWORK_HOME="$winsdktest"
5731         fi
5732     fi
5733     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
5734         AC_MSG_ERROR([mscoree.lib not found])
5735     fi
5736     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5738     PathFormat "$MIDL_PATH"
5739     MIDL_PATH="$formatted_path"
5741     PathFormat "$AL_PATH"
5742     AL_PATH="$formatted_path"
5744     PathFormat "$DOTNET_FRAMEWORK_HOME"
5745     DOTNET_FRAMEWORK_HOME="$formatted_path"
5747     PathFormat "$CSC_PATH"
5748     CSC_PATH="$formatted_path"
5751 dnl ===================================================================
5752 dnl Check if stdc headers are available excluding MSVC.
5753 dnl ===================================================================
5754 if test "$_os" != "WINNT"; then
5755     AC_HEADER_STDC
5758 dnl ===================================================================
5759 dnl Testing for C++ compiler and version...
5760 dnl ===================================================================
5762 if test "$_os" != "WINNT"; then
5763     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5764     save_CXXFLAGS=$CXXFLAGS
5765     AC_PROG_CXX
5766     CXXFLAGS=$save_CXXFLAGS
5767 else
5768     if test -n "$CC" -a -z "$CXX"; then
5769         CXX="$CC"
5770     fi
5773 dnl check for GNU C++ compiler version
5774 if test "$GXX" = "yes"; then
5775     AC_MSG_CHECKING([the GNU C++ compiler version])
5777     _gpp_version=`$CXX -dumpversion`
5778     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5780     if test "$_gpp_majmin" -lt "401"; then
5781         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5782     else
5783         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5784     fi
5786     dnl see https://code.google.com/p/android/issues/detail?id=41770
5787     if test "$_gpp_majmin" -ge "401"; then
5788         glibcxx_threads=no
5789         AC_LANG_PUSH([C++])
5790         AC_REQUIRE_CPP
5791         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5792         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5793             #include <bits/c++config.h>]],[[
5794             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5795             && !defined(_GLIBCXX__PTHREADS) \
5796             && !defined(_GLIBCXX_HAS_GTHREADS)
5797             choke me
5798             #endif
5799         ]])],[AC_MSG_RESULT([yes])
5800         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5801         AC_LANG_POP([C++])
5802         if test $glibcxx_threads = yes; then
5803             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5804         fi
5805      fi
5807 AC_SUBST(BOOST_CXXFLAGS)
5810 # prefx CXX with ccache if needed
5812 if test "$CCACHE" != ""; then
5813     AC_MSG_CHECKING([whether $CXX is already ccached])
5814     AC_LANG_PUSH([C++])
5815     save_CXXFLAGS=$CXXFLAGS
5816     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5817     dnl an empty program will do, we're checking the compiler flags
5818     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5819                       [use_ccache=yes], [use_ccache=no])
5820     if test $use_ccache = yes; then
5821         AC_MSG_RESULT([yes])
5822     else
5823         CXX="$CCACHE $CXX"
5824         AC_MSG_RESULT([no])
5825     fi
5826     CXXFLAGS=$save_CXXFLAGS
5827     AC_LANG_POP([C++])
5830 dnl ===================================================================
5831 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5832 dnl ===================================================================
5834 if test "$_os" != "WINNT"; then
5835     AC_PROG_CXXCPP
5837     dnl Check whether there's a C pre-processor.
5838     AC_PROG_CPP
5842 dnl ===================================================================
5843 dnl Find integral type sizes and alignments
5844 dnl ===================================================================
5846 if test "$_os" != "WINNT"; then
5848 if test "$_os" == "iOS"; then
5849     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5850     ac_cv_sizeof_long=8
5851     ac_cv_sizeof_short=2
5852     ac_cv_sizeof_int=4
5853     ac_cv_sizeof_long_long=8
5854     ac_cv_sizeof_double=8
5855     ac_cv_sizeof_voidp=8
5856 else
5857     AC_CHECK_SIZEOF(long)
5858     AC_CHECK_SIZEOF(short)
5859     AC_CHECK_SIZEOF(int)
5860     AC_CHECK_SIZEOF(long long)
5861     AC_CHECK_SIZEOF(double)
5862     AC_CHECK_SIZEOF(void*)
5865     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5866     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5867     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5868     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5869     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5871     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5872     m4_pattern_allow([AC_CHECK_ALIGNOF])
5873     m4_ifdef([AC_CHECK_ALIGNOF],
5874         [
5875             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5876             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5877             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5878             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5879         ],
5880         [
5881             case "$_os-$host_cpu" in
5882             Linux-i686)
5883                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5884                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5885                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5886                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5887                 ;;
5888             Linux-x86_64)
5889                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5890                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5891                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5892                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5893                 ;;
5894             *)
5895                 if test -z "$ac_cv_alignof_short" -o \
5896                         -z "$ac_cv_alignof_int" -o \
5897                         -z "$ac_cv_alignof_long" -o \
5898                         -z "$ac_cv_alignof_double"; then
5899                    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.])
5900                 fi
5901                 ;;
5902             esac
5903         ])
5905     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5906     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5907     if test $ac_cv_sizeof_long -eq 8; then
5908         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5909     elif test $ac_cv_sizeof_double -eq 8; then
5910         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5911     else
5912         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5913     fi
5915     dnl Check for large file support
5916     AC_SYS_LARGEFILE
5917     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5918         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5919     fi
5920     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5921         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5922     fi
5923 else
5924     # Hardcode for MSVC
5925     SAL_TYPES_SIZEOFSHORT=2
5926     SAL_TYPES_SIZEOFINT=4
5927     SAL_TYPES_SIZEOFLONG=4
5928     SAL_TYPES_SIZEOFLONGLONG=8
5929     if test "$BITNESS_OVERRIDE" = ""; then
5930         SAL_TYPES_SIZEOFPOINTER=4
5931     else
5932         SAL_TYPES_SIZEOFPOINTER=8
5933     fi
5934     SAL_TYPES_ALIGNMENT2=2
5935     SAL_TYPES_ALIGNMENT4=4
5936     SAL_TYPES_ALIGNMENT8=8
5937     LFS_CFLAGS=''
5939 AC_SUBST(LFS_CFLAGS)
5941 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5942 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5943 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5944 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5945 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5946 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5947 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5948 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5950 dnl ===================================================================
5951 dnl Check whether to enable runtime optimizations
5952 dnl ===================================================================
5953 ENABLE_RUNTIME_OPTIMIZATIONS=
5954 AC_MSG_CHECKING([whether to enable runtime optimizations])
5955 if test -z "$enable_runtime_optimizations"; then
5956     for i in $CC; do
5957         case $i in
5958         -fsanitize=*)
5959             enable_runtime_optimizations=no
5960             break
5961             ;;
5962         esac
5963     done
5965 if test "$enable_runtime_optimizations" != no; then
5966     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5967     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5968     AC_MSG_RESULT([yes])
5969 else
5970     AC_MSG_RESULT([no])
5972 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5974 dnl ===================================================================
5975 dnl Check if valgrind headers are available
5976 dnl ===================================================================
5977 ENABLE_VALGRIND=
5978 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5979     prev_cppflags=$CPPFLAGS
5980     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5981     # or where does it come from?
5982     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5983     AC_CHECK_HEADER([valgrind/valgrind.h],
5984         [ENABLE_VALGRIND=TRUE])
5985     CPPFLAGS=$prev_cppflags
5987 AC_SUBST([ENABLE_VALGRIND])
5988 if test -z "$ENABLE_VALGRIND"; then
5989     if test "$with_valgrind" = yes; then
5990         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5991     fi
5992     VALGRIND_CFLAGS=
5994 AC_SUBST([VALGRIND_CFLAGS])
5997 dnl ===================================================================
5998 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5999 dnl ===================================================================
6001 # We need at least the sys/sdt.h include header.
6002 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6003 if test "$SDT_H_FOUND" = "TRUE"; then
6004     # Found sys/sdt.h header, now make sure the c++ compiler works.
6005     # Old g++ versions had problems with probes in constructors/destructors.
6006     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6007     AC_LANG_PUSH([C++])
6008     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6009     #include <sys/sdt.h>
6010     class ProbeClass
6011     {
6012     private:
6013       int& ref;
6014       const char *name;
6016     public:
6017       ProbeClass(int& v, const char *n) : ref(v), name(n)
6018       {
6019         DTRACE_PROBE2(_test_, cons, name, ref);
6020       }
6022       void method(int min)
6023       {
6024         DTRACE_PROBE3(_test_, meth, name, ref, min);
6025         ref -= min;
6026       }
6028       ~ProbeClass()
6029       {
6030         DTRACE_PROBE2(_test_, dest, name, ref);
6031       }
6032     };
6033     ]],[[
6034     int i = 64;
6035     DTRACE_PROBE1(_test_, call, i);
6036     ProbeClass inst = ProbeClass(i, "call");
6037     inst.method(24);
6038     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6039           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6040     AC_LANG_POP([C++])
6042 AC_CONFIG_HEADERS([config_host/config_probes.h])
6044 dnl ===================================================================
6045 dnl GCC features
6046 dnl ===================================================================
6047 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6048     AC_MSG_CHECKING([whether $CC supports -mno-avx])
6049     save_CFLAGS=$CFLAGS
6050     CFLAGS="$CFLAGS -Werror -mno-avx"
6051     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6052     CFLAGS=$save_CFLAGS
6053     if test "$HAVE_GCC_AVX" = "TRUE"; then
6054         AC_MSG_RESULT([yes])
6055     else
6056         AC_MSG_RESULT([no])
6057     fi
6059     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
6060     save_CFLAGS=$CFLAGS
6061     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6062     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6063     CFLAGS=$save_CFLAGS
6064     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6065         AC_MSG_RESULT([yes])
6066     else
6067         AC_MSG_RESULT([no])
6068     fi
6070     AC_MSG_CHECKING([whether $CC supports atomic functions])
6071     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6072     int v = 0;
6073     if (__sync_add_and_fetch(&v, 1) != 1 ||
6074         __sync_sub_and_fetch(&v, 1) != 0)
6075         return 1;
6076     __sync_synchronize();
6077     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6078         v != 1)
6079         return 1;
6080     return 0;
6081 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6082     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6083         AC_MSG_RESULT([yes])
6084         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6085     else
6086         AC_MSG_RESULT([no])
6087     fi
6089     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
6090     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6091     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6092         AC_MSG_RESULT([yes])
6093         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6094     else
6095         AC_MSG_RESULT([no])
6096     fi
6098     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6099     save_CFLAGS=$CFLAGS
6100     CFLAGS="$CFLAGS -Werror"
6101     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6102             __attribute__((deprecated("test"))) void f();
6103         ])], [
6104             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6105             AC_MSG_RESULT([yes])
6106         ], [AC_MSG_RESULT([no])])
6107     CFLAGS=$save_CFLAGS
6109     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6110     AC_LANG_PUSH([C++])
6111     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6112             #include <cstddef>
6113             #include <cxxabi.h>
6114             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6115         ])], [
6116             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6117             AC_MSG_RESULT([yes])
6118         ], [AC_MSG_RESULT([no])])
6119     AC_LANG_POP([C++])
6121     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6122     AC_LANG_PUSH([C++])
6123     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6124             #include <cstddef>
6125             #include <cxxabi.h>
6126             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6127         ])], [
6128             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6129             AC_MSG_RESULT([yes])
6130         ], [AC_MSG_RESULT([no])])
6131     AC_LANG_POP([C++])
6133     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6134     AC_LANG_PUSH([C++])
6135     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6136             #include <cxxabi.h>
6137             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6138         ])], [
6139             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6140             AC_MSG_RESULT([yes])
6141         ], [AC_MSG_RESULT([no])])
6142     AC_LANG_POP([C++])
6144     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6145     AC_LANG_PUSH([C++])
6146     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6147             #include <cstddef>
6148             #include <cxxabi.h>
6149             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6150         ])], [
6151             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6152             AC_MSG_RESULT([yes])
6153         ], [AC_MSG_RESULT([no])])
6154     AC_LANG_POP([C++])
6156     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6157     AC_LANG_PUSH([C++])
6158     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6159             #include <cstddef>
6160             #include <cxxabi.h>
6161             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6162         ])], [
6163             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6164             AC_MSG_RESULT([yes])
6165         ], [AC_MSG_RESULT([no])])
6166     AC_LANG_POP([C++])
6168     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6169     AC_LANG_PUSH([C++])
6170     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6171             #include <cxxabi.h>
6172             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6173         ])], [
6174             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6175             AC_MSG_RESULT([yes])
6176         ], [AC_MSG_RESULT([no])])
6177     AC_LANG_POP([C++])
6179     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6180     AC_LANG_PUSH([C++])
6181     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6182             #include <cxxabi.h>
6183             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6184         ])], [
6185             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6186             AC_MSG_RESULT([yes])
6187         ], [AC_MSG_RESULT([no])])
6188     AC_LANG_POP([C++])
6190     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6191     AC_LANG_PUSH([C++])
6192     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6193             #include <cxxabi.h>
6194             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6195         ])], [
6196             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6197             AC_MSG_RESULT([yes])
6198         ], [AC_MSG_RESULT([no])])
6199     AC_LANG_POP([C++])
6201     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6202     AC_LANG_PUSH([C++])
6203     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6204             #include <cstddef>
6205             #include <cxxabi.h>
6206             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6207         ])], [
6208             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6209             AC_MSG_RESULT([yes])
6210         ], [AC_MSG_RESULT([no])])
6211     AC_LANG_POP([C++])
6213     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6214     AC_LANG_PUSH([C++])
6215     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6216             #include <cstddef>
6217             #include <cxxabi.h>
6218             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6219         ])], [
6220             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6221             AC_MSG_RESULT([yes])
6222         ], [AC_MSG_RESULT([no])])
6223     AC_LANG_POP([C++])
6225     dnl Available in GCC 4.9 and at least since Clang 3.4:
6226     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6227     AC_LANG_PUSH([C++])
6228     save_CXXFLAGS=$CXXFLAGS
6229     CXXFLAGS="$CXXFLAGS -Werror"
6230     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6231             struct __attribute__((warn_unused)) dummy {};
6232         ])], [
6233             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6234             AC_MSG_RESULT([yes])
6235         ], [AC_MSG_RESULT([no])])
6236     CXXFLAGS=$save_CXXFLAGS
6237 AC_LANG_POP([C++])
6240 AC_SUBST(HAVE_GCC_AVX)
6241 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6242 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6243 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6245 dnl ===================================================================
6246 dnl Identify the C++ library
6247 dnl ===================================================================
6249 AC_MSG_CHECKING([what the C++ library is])
6250 AC_LANG_PUSH([C++])
6251 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6252 #include <utility>
6253 #ifndef __GLIBCXX__
6254 foo bar
6255 #endif
6256 ]])],
6257     [CPP_LIBRARY=GLIBCXX
6258      cpp_library_name="GNU libstdc++"
6259     ],
6260     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6261 #include <utility>
6262 #ifndef _LIBCPP_VERSION
6263 foo bar
6264 #endif
6265 ]])],
6266     [CPP_LIBRARY=LIBCPP
6267      cpp_library_name="LLVM libc++"
6268      AC_DEFINE([HAVE_LIBCXX])
6269     ],
6270     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6271 #include <utility>
6272 #ifndef _MSC_VER
6273 foo bar
6274 #endif
6275 ]])],
6276     [CPP_LIBRARY=MSVCRT
6277      cpp_library_name="Microsoft"
6278     ],
6279     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6280 AC_MSG_RESULT([$cpp_library_name])
6281 AC_LANG_POP([C++])
6283 dnl ===================================================================
6284 dnl Check for gperf
6285 dnl ===================================================================
6286 AC_PATH_PROG(GPERF, gperf)
6287 if test -z "$GPERF"; then
6288     AC_MSG_ERROR([gperf not found but needed. Install it.])
6290 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6291     GPERF=`cygpath -m $GPERF`
6293 AC_MSG_CHECKING([whether gperf is new enough])
6294 my_gperf_ver1=$($GPERF --version | head -n 1)
6295 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6296 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6297 if test "$my_gperf_ver3" -ge 301; then
6298     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6299 else
6300     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6302 AC_SUBST(GPERF)
6304 dnl ===================================================================
6305 dnl Check for system libcmis
6306 dnl ===================================================================
6307 # libcmis requires curl and we can't build curl for iOS
6308 if test $_os != iOS; then
6309     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6310     ENABLE_LIBCMIS=TRUE
6311 else
6312     ENABLE_LIBCMIS=
6314 AC_SUBST(ENABLE_LIBCMIS)
6316 dnl ===================================================================
6317 dnl C++11
6318 dnl ===================================================================
6320 AC_MSG_CHECKING([whether $CXX supports C++17])
6321 CXXFLAGS_CXX11=
6322 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6323     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6324 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6325     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6326     for flag in $my_flags; do
6327         if test "$COM" = MSC; then
6328             flag="-Xclang $flag"
6329         fi
6330         save_CXXFLAGS=$CXXFLAGS
6331         CXXFLAGS="$CXXFLAGS $flag -Werror"
6332         if test "$SYSTEM_LIBCMIS" = TRUE; then
6333             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6334         fi
6335         AC_LANG_PUSH([C++])
6336         dnl Clang 3.9 supports __float128 since
6337         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6338         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6339         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6340         dnl $flag is supported below, so check this first):
6341         my_float128hack=
6342         my_float128hack_impl=-D__float128=void
6343         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6344             #include <vector>
6345             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6346             // (__float128)
6347             ]])
6348         ],,[
6349             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6350             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6351             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6352             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6353             dnl place where __float128 is used is in a template specialization, -D__float128=void
6354             dnl will avoid the problem there while still causing a problem if somebody actually uses
6355             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6356             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6357             dnl "fixed" with this hack):
6358             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6359             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6360                 #include <vector>
6361                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6362                 // (__float128)
6363                 ]])
6364             ],[my_float128hack=$my_float128hack_impl])
6365         ])
6366         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6367             #include <algorithm>
6368             #include <cmath>
6369             #include <functional>
6370             #include <vector>
6372             #if defined SYSTEM_LIBCMIS
6373             // See ucb/source/ucp/cmis/auth_provider.hxx:
6374             #if !defined __clang__
6375             #pragma GCC diagnostic push
6376             #pragma GCC diagnostic ignored "-Wdeprecated"
6377             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6378             #endif
6379             #include <libcmis/libcmis.hxx>
6380             #if !defined __clang__
6381             #pragma GCC diagnostic pop
6382             #endif
6383             #endif
6385             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6386                 std::sort(v.begin(), v.end(), fn);
6387             }
6389             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6390             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6391             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6392             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6393             // needed by sc/source/core/tool/math.cxx):
6394             int g() { return math_errhandling; }
6395             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6396         AC_LANG_POP([C++])
6397         CXXFLAGS=$save_CXXFLAGS
6398         if test -n "$CXXFLAGS_CXX11"; then
6399             break
6400         fi
6401     done
6403 if test -n "$CXXFLAGS_CXX11"; then
6404     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6405 else
6406     AC_MSG_ERROR(no)
6408 AC_SUBST(CXXFLAGS_CXX11)
6410 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6411 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6412 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6413 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6414 dnl again towards 4.7.2:
6415 if test $CPP_LIBRARY = GLIBCXX; then
6416     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6417     AC_LANG_PUSH([C++])
6418     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6419 #include <list>
6420 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6421     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6422     //   GCC 4.7.0: 20120322
6423     //   GCC 4.7.1: 20120614
6424     // and using a range check is not possible as the mapping between
6425     // __GLIBCXX__ values and GCC versions is not monotonic
6426 /* ok */
6427 #else
6428 abi broken
6429 #endif
6430         ]])], [AC_MSG_RESULT(no, ok)],
6431         [AC_MSG_ERROR(yes)])
6432     AC_LANG_POP([C++])
6435 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6436 save_CXXFLAGS=$CXXFLAGS
6437 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6438 AC_LANG_PUSH([C++])
6440 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6441 #include <stddef.h>
6443 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6445 namespace
6447         struct b
6448         {
6449                 int i;
6450                 int j;
6451         };
6453 ]], [[
6454 struct a
6456         int i;
6457         int j;
6459 a thinga[]={{0,0}, {1,1}};
6460 b thingb[]={{0,0}, {1,1}};
6461 size_t i = sizeof(sal_n_array_size(thinga));
6462 size_t j = sizeof(sal_n_array_size(thingb));
6463 return !(i != 0 && j != 0);
6465     ], [ AC_MSG_RESULT(yes) ],
6466     [ AC_MSG_ERROR(no)])
6467 AC_LANG_POP([C++])
6468 CXXFLAGS=$save_CXXFLAGS
6470 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6471 AC_MSG_CHECKING([that $CXX supports C++14 constexpr])
6472 save_CXXFLAGS=$CXXFLAGS
6473 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6474 AC_LANG_PUSH([C++])
6475 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6476     // A somewhat over-complicated way of checking for
6477     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6478     // in constexpr function":
6479     #include <cassert>
6480     template<typename T> inline constexpr T f(T x) { return x; }
6481     template<typename T> inline constexpr T g(T x) {
6482         assert(f(static_cast<int>(x)));
6483         return x;
6484     }
6485     enum E { e };
6486     auto v = g(E::e);
6488     struct S {
6489         int n_;
6490         constexpr bool f() {
6491             int n = n_;
6492             int i = 0;
6493             while (n > 0) { --n; ++i; }
6494             assert(i >= 0);
6495             return i == 0;
6496         }
6497     };
6498     constexpr auto v2 = S{10}.f();
6499     ]])], AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required C++14 constexpr support]))
6500 AC_LANG_POP([C++])
6501 CXXFLAGS=$save_CXXFLAGS
6503 dnl _Pragma support (may require C++11)
6504 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6505     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6506     AC_LANG_PUSH([C++])
6507     save_CXXFLAGS=$CXXFLAGS
6508     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6509     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6510             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6511         ])], [
6512             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6513             AC_MSG_RESULT([yes])
6514         ], [AC_MSG_RESULT([no])])
6515     AC_LANG_POP([C++])
6516     CXXFLAGS=$save_CXXFLAGS
6519 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6520 if test "$GCC" = yes; then
6521     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6522     AC_LANG_PUSH([C++])
6523     save_CXXFLAGS=$CXXFLAGS
6524     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6525     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6526     CXXFLAGS=$save_CXXFLAGS
6527     AC_LANG_POP([C++])
6528     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6529         AC_MSG_RESULT([yes])
6530     else
6531         AC_MSG_RESULT([no])
6532     fi
6534 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6536 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6537 AC_MSG_CHECKING([[that $CXX supports [[fallthrough]]]])
6538 AC_LANG_PUSH([C++])
6539 save_CXXFLAGS=$CXXFLAGS
6540 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6541 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6542 if test "$COM" = MSC; then
6543     CXXFLAGS="$CXXFLAGS /we5030"
6544 else
6545     CXXFLAGS="$CXXFLAGS -Werror"
6547 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6548         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6549         // by checking for __cplusplus:
6550         #if __cplusplus > 201703L
6551         #if !__has_cpp_attribute(fallthrough)
6552         #error
6553         #endif
6554         #else
6555         void f(int & x) {
6556             switch (x) {
6557             case 0:
6558                 ++x;
6559                 [[fallthrough]];
6560             default:
6561                 ++x;
6562             }
6563         }
6564         #endif
6565     ]])],
6566     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[fallthrough]] support]))
6567 CXXFLAGS=$save_CXXFLAGS
6568 AC_LANG_POP([C++])
6570 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6571 AC_MSG_CHECKING([[that $CXX supports [[nodiscard]]]])
6572 AC_LANG_PUSH([C++])
6573 save_CXXFLAGS=$CXXFLAGS
6574 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6575 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6576 if test "$COM" = MSC; then
6577     CXXFLAGS="$CXXFLAGS /we5030"
6578 else
6579     CXXFLAGS="$CXXFLAGS -Werror"
6581 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6582         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6583         // by checking for __cplusplus:
6584         #if __cplusplus > 201703L
6585         #if !__has_cpp_attribute(nodiscard)
6586         #error
6587         #endif
6588         #else
6589         [[nodiscard]] int f();
6590         #endif
6591     ]])],
6592     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[nodiscard]] support]))
6593 CXXFLAGS=$save_CXXFLAGS
6594 AC_LANG_POP([C++])
6596 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6597 AC_LANG_PUSH([C++])
6598 save_CXXFLAGS=$CXXFLAGS
6599 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6600 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6601         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6602         // supporting it:
6603         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6604         struct S {
6605         private:
6606             S(S const &);
6607         public:
6608             S();
6609             ~S();
6610         };
6611         S copy();
6612         void f() { S c(copy()); }
6613         #endif
6614     ])], [
6615         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6616         AC_MSG_RESULT([yes])
6617     ], [AC_MSG_RESULT([no])])
6618 CXXFLAGS=$save_CXXFLAGS
6619 AC_LANG_POP([C++])
6621 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
6622 AC_MSG_CHECKING([that $CXX has a fix for CWG1579])
6623 AC_LANG_PUSH([C++])
6624 save_CXXFLAGS=$CXXFLAGS
6625 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6626 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6627         #include <memory>
6628         struct S1 {};
6629         struct S2: S1 {};
6630         std::unique_ptr<S1> f() {
6631             std::unique_ptr<S2> s2(new S2);
6632             return s2;
6633         }
6634     ])],
6635     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks a required fix for CWG1579]))
6636 CXXFLAGS=$save_CXXFLAGS
6637 AC_LANG_POP([C++])
6639 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6640 AC_LANG_PUSH([C++])
6641 save_CXXFLAGS=$CXXFLAGS
6642 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6643 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6644         struct S1 { S1(S1 &&); };
6645         struct S2: S1 {};
6646         S1 f(S2 s) { return s; }
6647     ])], [
6648         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6649         AC_MSG_RESULT([yes])
6650     ], [AC_MSG_RESULT([no])])
6651 CXXFLAGS=$save_CXXFLAGS
6652 AC_LANG_POP([C++])
6654 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6655 dnl uninitialized warning for code like
6657 dnl   OString f();
6658 dnl   boost::optional<OString> * g(bool b) {
6659 dnl       boost::optional<OString> o;
6660 dnl       if (b) o = f();
6661 dnl       return new boost::optional<OString>(o);
6662 dnl   }
6664 dnl (as is e.g. present, in a slightly more elaborate form, in
6665 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6666 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6667 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6668 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6669     AC_MSG_CHECKING([whether $CXX might report false -Werror=maybe-uninitialized])
6670     AC_LANG_PUSH([C++])
6671     save_CXXFLAGS=$CXXFLAGS
6672     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6673     if test "$ENABLE_OPTIMIZED" = TRUE; then
6674         CXXFLAGS="$CXXFLAGS -O2"
6675     else
6676         CXXFLAGS="$CXXFLAGS -O0"
6677     fi
6678     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6679             #include <new>
6680             void f1(int);
6681             struct S1 {
6682                 ~S1() { f1(n); }
6683                 int n = 0;
6684             };
6685             struct S2 {
6686                 S2() {}
6687                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6688                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6689                 void set(S1 s) {
6690                     new (stg) S1(s);
6691                     init = true;
6692                 }
6693                 bool init = false;
6694                 char stg[sizeof (S1)];
6695             } ;
6696             S1 f2();
6697             S2 * f3(bool b) {
6698                 S2 o;
6699                 if (b) o.set(f2());
6700                 return new S2(o);
6701             }
6702         ]])], [AC_MSG_RESULT([no])], [
6703             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6704             AC_MSG_RESULT([yes])
6705         ])
6706     CXXFLAGS=$save_CXXFLAGS
6707     AC_LANG_POP([C++])
6709 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6711 dnl ===================================================================
6712 dnl system stl sanity tests
6713 dnl ===================================================================
6714 if test "$_os" != "WINNT"; then
6716     AC_LANG_PUSH([C++])
6718     save_CPPFLAGS="$CPPFLAGS"
6719     if test -n "$MACOSX_SDK_PATH"; then
6720         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6721     fi
6723     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6724     # only.
6725     if test "$CPP_LIBRARY" = GLIBCXX; then
6726         dnl gcc#19664, gcc#22482, rhbz#162935
6727         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6728         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6729         AC_MSG_RESULT([$stlvisok])
6730         if test "$stlvisok" = "no"; then
6731             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6732         fi
6733     fi
6735     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6736     # when we don't make any dynamic libraries?
6737     if test "$DISABLE_DYNLOADING" = ""; then
6738         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6739         cat > conftestlib1.cc <<_ACEOF
6740 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6741 struct S2: S1<int> { virtual ~S2(); };
6742 S2::~S2() {}
6743 _ACEOF
6744         cat > conftestlib2.cc <<_ACEOF
6745 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6746 struct S2: S1<int> { virtual ~S2(); };
6747 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6748 _ACEOF
6749         gccvisinlineshiddenok=yes
6750         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6751             gccvisinlineshiddenok=no
6752         else
6753             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6754             dnl known to not work with -z defs (unsetting which makes the test
6755             dnl moot, though):
6756             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6757             if test "$COM_IS_CLANG" = TRUE; then
6758                 for i in $CXX $CXXFLAGS; do
6759                     case $i in
6760                     -fsanitize=*)
6761                         my_linkflagsnoundefs=
6762                         break
6763                         ;;
6764                     esac
6765                 done
6766             fi
6767             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6768                 gccvisinlineshiddenok=no
6769             fi
6770         fi
6772         rm -fr libconftest*
6773         AC_MSG_RESULT([$gccvisinlineshiddenok])
6774         if test "$gccvisinlineshiddenok" = "no"; then
6775             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6776         fi
6777     fi
6779    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6780     cat >visibility.cxx <<_ACEOF
6781 #pragma GCC visibility push(hidden)
6782 struct __attribute__ ((visibility ("default"))) TestStruct {
6783   static void Init();
6785 __attribute__ ((visibility ("default"))) void TestFunc() {
6786   TestStruct::Init();
6788 _ACEOF
6789     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6790         gccvisbroken=yes
6791     else
6792         case "$host_cpu" in
6793         i?86|x86_64)
6794             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6795                 gccvisbroken=no
6796             else
6797                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6798                     gccvisbroken=no
6799                 else
6800                     gccvisbroken=yes
6801                 fi
6802             fi
6803             ;;
6804         *)
6805             gccvisbroken=no
6806             ;;
6807         esac
6808     fi
6809     rm -f visibility.s visibility.cxx
6811     AC_MSG_RESULT([$gccvisbroken])
6812     if test "$gccvisbroken" = "yes"; then
6813         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6814     fi
6816     CPPFLAGS="$save_CPPFLAGS"
6818     AC_LANG_POP([C++])
6821 dnl ===================================================================
6822 dnl  Clang++ tests
6823 dnl ===================================================================
6825 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6826 if test "$GCC" = "yes"; then
6827     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6828     AC_LANG_PUSH([C++])
6829     save_CXXFLAGS=$CXXFLAGS
6830     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6831     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6832     CXXFLAGS=$save_CXXFLAGS
6833     AC_LANG_POP([C++])
6834     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6835         AC_MSG_RESULT([yes])
6836     else
6837         AC_MSG_RESULT([no])
6838     fi
6840 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6842 dnl ===================================================================
6843 dnl Compiler plugins
6844 dnl ===================================================================
6846 COMPILER_PLUGINS=
6847 # currently only Clang
6849 if test "$COM_IS_CLANG" != "TRUE"; then
6850     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6851         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6852         enable_compiler_plugins=no
6853     fi
6856 if test "$COM_IS_CLANG" = "TRUE"; then
6857     if test -n "$enable_compiler_plugins"; then
6858         compiler_plugins="$enable_compiler_plugins"
6859     elif test -n "$ENABLE_DBGUTIL"; then
6860         compiler_plugins=test
6861     else
6862         compiler_plugins=no
6863     fi
6864     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 50002; then
6865         if test "$compiler_plugins" = yes; then
6866             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6867         else
6868             compiler_plugins=no
6869         fi
6870     fi
6871     if test "$compiler_plugins" != "no"; then
6872         dnl The prefix where Clang resides, override to where Clang resides if
6873         dnl using a source build:
6874         if test -z "$CLANGDIR"; then
6875             CLANGDIR=/usr
6876         fi
6877         AC_LANG_PUSH([C++])
6878         save_CPPFLAGS=$CPPFLAGS
6879         save_CXX=$CXX
6880         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6881         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6882         CXX=$COMPILER_PLUGINS_CXX
6883         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6884         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6885             [COMPILER_PLUGINS=TRUE],
6886             [
6887             if test "$compiler_plugins" = "yes"; then
6888                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6889             else
6890                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6891                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6892             fi
6893             ])
6894         CXX=$save_CXX
6895         CPPFLAGS=$save_CPPFLAGS
6896         AC_LANG_POP([C++])
6897     fi
6898 else
6899     if test "$enable_compiler_plugins" = "yes"; then
6900         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6901     fi
6903 AC_SUBST(COMPILER_PLUGINS)
6904 AC_SUBST(COMPILER_PLUGINS_CXX)
6905 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6906 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6907 AC_SUBST(CLANGDIR)
6908 AC_SUBST(CLANGLIBDIR)
6910 # Plugin to help linker.
6911 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6912 # This makes --enable-lto build with clang work.
6913 AC_SUBST(LD_PLUGIN)
6915 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6916 AC_SUBST(HAVE_POSIX_FALLOCATE)
6918 dnl ===================================================================
6919 dnl Custom build version
6920 dnl ===================================================================
6922 AC_MSG_CHECKING([whether to add custom build version])
6923 if test "$with_build_version" != ""; then
6924     BUILD_VER_STRING=$with_build_version
6925     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6926 else
6927     BUILD_VER_STRING=
6928     AC_MSG_RESULT([no])
6930 AC_SUBST(BUILD_VER_STRING)
6932 JITC_PROCESSOR_TYPE=""
6933 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6934     # IBMs JDK needs this...
6935     JITC_PROCESSOR_TYPE=6
6936     export JITC_PROCESSOR_TYPE
6938 AC_SUBST([JITC_PROCESSOR_TYPE])
6940 # Misc Windows Stuff
6941 AC_ARG_WITH(ucrt-dir,
6942     AS_HELP_STRING([--with-ucrt-dir],
6943         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6944         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6945         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6946             Windows6.1-KB2999226-x64.msu
6947             Windows6.1-KB2999226-x86.msu
6948             Windows8.1-KB2999226-x64.msu
6949             Windows8.1-KB2999226-x86.msu
6950             Windows8-RT-KB2999226-x64.msu
6951             Windows8-RT-KB2999226-x86.msu
6952         A zip archive including those files is available from Microsoft site:
6953         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6955 UCRT_REDISTDIR="$with_ucrt_dir"
6956 if test $_os = "WINNT"; then
6957     find_msvc_x64_dlls
6958     find_msms
6959     MSVC_DLL_PATH="$msvcdllpath"
6960     MSVC_DLLS="$msvcdlls"
6961     MSM_PATH="$msmdir"
6962     # MSVC 15.3 changed it to VC141
6963     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6964         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6965     else
6966         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6967     fi
6968     if test "$UCRT_REDISTDIR" = "no"; then
6969         dnl explicitly disabled
6970         UCRT_REDISTDIR=""
6971     else
6972         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6973                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6974                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6975                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6976                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6977                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6978             UCRT_REDISTDIR=""
6979             if test -n "$PKGFORMAT"; then
6980                for i in $PKGFORMAT; do
6981                    case "$i" in
6982                    msi)
6983                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6984                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6985                        ;;
6986                    esac
6987                done
6988             fi
6989         fi
6990     fi
6993 AC_SUBST(UCRT_REDISTDIR)
6994 AC_SUBST(MSVC_DLL_PATH)
6995 AC_SUBST(MSVC_DLLS)
6996 AC_SUBST(MSM_PATH)
6998 dnl ===================================================================
6999 dnl Checks for Java
7000 dnl ===================================================================
7001 if test "$ENABLE_JAVA" != ""; then
7003     # Windows-specific tests
7004     if test "$build_os" = "cygwin"; then
7005         if test "$BITNESS_OVERRIDE" = 64; then
7006             bitness=64
7007         else
7008             bitness=32
7009         fi
7011         if test -z "$with_jdk_home"; then
7012             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7013             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7014             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7015             if test -n "$regvalue"; then
7016                 ver=$regvalue
7017                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7018                 _jdk_home=$regvalue
7019             fi
7020             if test -z "$with_jdk_home"; then
7021                 for ver in 1.8 1.7 1.6; do
7022                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7023                     if test -n "$regvalue"; then
7024                         _jdk_home=$regvalue
7025                         break
7026                     fi
7027                 done
7028             fi
7029             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7030                 with_jdk_home="$_jdk_home"
7031                 howfound="found automatically"
7032             else
7033                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7034             fi
7035         else
7036             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7037             howfound="you passed"
7038         fi
7039     fi
7041     # 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.
7042     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7043     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7044         with_jdk_home=`/usr/libexec/java_home`
7045     fi
7047     JAVA_HOME=; export JAVA_HOME
7048     if test -z "$with_jdk_home"; then
7049         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7050     else
7051         _java_path="$with_jdk_home/bin/$with_java"
7052         dnl Check if there is a Java interpreter at all.
7053         if test -x "$_java_path"; then
7054             JAVAINTERPRETER=$_java_path
7055         else
7056             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7057         fi
7058     fi
7060     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7061     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7062     dnl loaded by java to run JunitTests:
7063     if test "$build_os" = "cygwin"; then
7064         shortjdkhome=`cygpath -d "$with_jdk_home"`
7065         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
7066             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7067             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7068         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
7069             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7070             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7071         fi
7073         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7074             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7075         fi
7076         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7077     elif test "$cross_compiling" != "yes"; then
7078         case $CPUNAME in
7079             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7080                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7081                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7082                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7083                 fi
7084                 ;;
7085             *) # assumption: everything else 32-bit
7086                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7087                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7088                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7089                 fi
7090                 ;;
7091         esac
7092     fi
7095 HAVE_JAVA9=
7096 dnl ===================================================================
7097 dnl Checks for JDK.
7098 dnl ===================================================================
7100 # Note that JAVA_HOME as for now always means the *build* platform's
7101 # JAVA_HOME. Whether all the complexity here actually is needed any
7102 # more or not, no idea.
7104 if test "$ENABLE_JAVA" != ""; then
7105     _gij_longver=0
7106     AC_MSG_CHECKING([the installed JDK])
7107     if test -n "$JAVAINTERPRETER"; then
7108         dnl java -version sends output to stderr!
7109         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7110             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7111         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7112             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7113         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7114             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7115         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7116             JDK=ibm
7118             dnl IBM JDK specific tests
7119             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7120             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7122             if test "$_jdk_ver" -lt 10600; then
7123                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
7124             fi
7126             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
7128             if test "$with_jdk_home" = ""; then
7129                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7130 you must use the "--with-jdk-home" configure option explicitly])
7131             fi
7133             JAVA_HOME=$with_jdk_home
7134         else
7135             JDK=sun
7137             dnl Sun JDK specific tests
7138             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7139             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7141             if test "$_jdk_ver" -lt 10600; then
7142                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
7143             fi
7144             if test "$_jdk_ver" -gt 10600; then
7145                 JAVA_CLASSPATH_NOT_SET=TRUE
7146             fi
7147             if test "$_jdk_ver" -ge 10900; then
7148                 HAVE_JAVA9=TRUE
7149             fi
7151             AC_MSG_RESULT([checked (JDK $_jdk)])
7152             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7153             if test "$_os" = "WINNT"; then
7154                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7155             fi
7157             # set to limit VM usage for JunitTests
7158             JAVAIFLAGS=-Xmx64M
7159             # set to limit VM usage for javac
7160             JAVAFLAGS=-J-Xmx128M
7161         fi
7162     else
7163         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7164     fi
7165 else
7166     dnl Java disabled
7167     JAVA_HOME=
7168     export JAVA_HOME
7171 dnl ===================================================================
7172 dnl Set target Java bytecode version
7173 dnl ===================================================================
7174 if test "$ENABLE_JAVA" != ""; then
7175     if test "$HAVE_JAVA9" = "TRUE"; then
7176         _java_target_ver="1.6"
7177     else
7178         _java_target_ver="1.5"
7179     fi
7180     JAVA_SOURCE_VER="$_java_target_ver"
7181     JAVA_TARGET_VER="$_java_target_ver"
7184 dnl ===================================================================
7185 dnl Checks for javac
7186 dnl ===================================================================
7187 if test "$ENABLE_JAVA" != ""; then
7188     javacompiler="javac"
7189     if test -z "$with_jdk_home"; then
7190         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7191     else
7192         _javac_path="$with_jdk_home/bin/$javacompiler"
7193         dnl Check if there is a Java compiler at all.
7194         if test -x "$_javac_path"; then
7195             JAVACOMPILER=$_javac_path
7196         fi
7197     fi
7198     if test -z "$JAVACOMPILER"; then
7199         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7200     fi
7201     if test "$build_os" = "cygwin"; then
7202         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7203             JAVACOMPILER="${JAVACOMPILER}.exe"
7204         fi
7205         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7206     fi
7209 dnl ===================================================================
7210 dnl Checks for javadoc
7211 dnl ===================================================================
7212 if test "$ENABLE_JAVA" != ""; then
7213     if test -z "$with_jdk_home"; then
7214         AC_PATH_PROG(JAVADOC, javadoc)
7215     else
7216         _javadoc_path="$with_jdk_home/bin/javadoc"
7217         dnl Check if there is a javadoc at all.
7218         if test -x "$_javadoc_path"; then
7219             JAVADOC=$_javadoc_path
7220         else
7221             AC_PATH_PROG(JAVADOC, javadoc)
7222         fi
7223     fi
7224     if test -z "$JAVADOC"; then
7225         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7226     fi
7227     if test "$build_os" = "cygwin"; then
7228         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7229             JAVADOC="${JAVADOC}.exe"
7230         fi
7231         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7232     fi
7234     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7235     JAVADOCISGJDOC="yes"
7236     fi
7238 AC_SUBST(JAVADOCISGJDOC)
7240 if test "$ENABLE_JAVA" != ""; then
7241     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7242     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7243         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7244            # try to recover first by looking whether we have a alternatives
7245            # system as in Debian or newer SuSEs where following /usr/bin/javac
7246            # over /etc/alternatives/javac leads to the right bindir where we
7247            # just need to strip a bit away to get a valid JAVA_HOME
7248            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7249         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7250             # maybe only one level of symlink (e.g. on Mac)
7251             JAVA_HOME=$(readlink $JAVACOMPILER)
7252             if test "$(dirname $JAVA_HOME)" = "."; then
7253                 # we've got no path to trim back
7254                 JAVA_HOME=""
7255             fi
7256         else
7257             # else warn
7258             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7259             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7260             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7261             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7262         fi
7263         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7264         if test "$JAVA_HOME" != "/usr"; then
7265             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7266                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7267                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7268                 dnl Tiger already returns a JDK path..
7269                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7270             else
7271                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7272                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7273                 dnl that checks which version to run
7274                 if test -f "$JAVA_HOME"; then
7275                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7276                 fi
7277             fi
7278         fi
7279     fi
7280     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7282     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7283     if test -z "$JAVA_HOME"; then
7284         if test "x$with_jdk_home" = "x"; then
7285             cat > findhome.java <<_ACEOF
7286 [import java.io.File;
7288 class findhome
7290     public static void main(String args[])
7291     {
7292         String jrelocation = System.getProperty("java.home");
7293         File jre = new File(jrelocation);
7294         System.out.println(jre.getParent());
7295     }
7297 _ACEOF
7298             AC_MSG_CHECKING([if javac works])
7299             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7300             AC_TRY_EVAL(javac_cmd)
7301             if test $? = 0 -a -f ./findhome.class; then
7302                 AC_MSG_RESULT([javac works])
7303             else
7304                 echo "configure: javac test failed" >&5
7305                 cat findhome.java >&5
7306                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7307             fi
7308             AC_MSG_CHECKING([if gij knows its java.home])
7309             JAVA_HOME=`$JAVAINTERPRETER findhome`
7310             if test $? = 0 -a "$JAVA_HOME" != ""; then
7311                 AC_MSG_RESULT([$JAVA_HOME])
7312             else
7313                 echo "configure: java test failed" >&5
7314                 cat findhome.java >&5
7315                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7316             fi
7317             # clean-up after ourselves
7318             rm -f ./findhome.java ./findhome.class
7319         else
7320             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7321         fi
7322     fi
7324     # now check if $JAVA_HOME is really valid
7325     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7326         case "${JAVA_HOME}" in
7327             /Library/Java/JavaVirtualMachines/*)
7328                 ;;
7329             *)
7330                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7331                 ;;
7332         esac
7333         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7334             JAVA_HOME_OK="NO"
7335         fi
7336     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7337         JAVA_HOME_OK="NO"
7338     fi
7339     if test "$JAVA_HOME_OK" = "NO"; then
7340         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7341         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7342         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7343         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7344         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7345         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7346     fi
7347     PathFormat "$JAVA_HOME"
7348     JAVA_HOME="$formatted_path"
7351 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7352     "$_os" != Darwin
7353 then
7354     AC_MSG_CHECKING([for JAWT lib])
7355     if test "$_os" = WINNT; then
7356         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7357         JAWTLIB=jawt.lib
7358     else
7359         case "$host_cpu" in
7360         arm*)
7361             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7362             JAVA_ARCH=$my_java_arch
7363             ;;
7364         i*86)
7365             my_java_arch=i386
7366             ;;
7367         m68k)
7368             my_java_arch=m68k
7369             ;;
7370         powerpc)
7371             my_java_arch=ppc
7372             ;;
7373         powerpc64)
7374             my_java_arch=ppc64
7375             ;;
7376         powerpc64le)
7377             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7378             JAVA_ARCH=$my_java_arch
7379             ;;
7380         sparc64)
7381             my_java_arch=sparcv9
7382             ;;
7383         x86_64)
7384             my_java_arch=amd64
7385             ;;
7386         *)
7387             my_java_arch=$host_cpu
7388             ;;
7389         esac
7390         # This is where JDK9 puts the library
7391         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7392             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7393         else
7394             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7395         fi
7396         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7397     fi
7398     AC_MSG_RESULT([$JAWTLIB])
7400 AC_SUBST(JAWTLIB)
7402 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7403     case "$host_os" in
7405     aix*)
7406         JAVAINC="-I$JAVA_HOME/include"
7407         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7408         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7409         ;;
7411     cygwin*)
7412         JAVAINC="-I$JAVA_HOME/include/win32"
7413         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7414         ;;
7416     darwin*)
7417         if test -d "$JAVA_HOME/include/darwin"; then
7418             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7419         else
7420             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7421         fi
7422         ;;
7424     dragonfly*)
7425         JAVAINC="-I$JAVA_HOME/include"
7426         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7427         ;;
7429     freebsd*)
7430         JAVAINC="-I$JAVA_HOME/include"
7431         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7432         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7433         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7434         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7435         ;;
7437     k*bsd*-gnu*)
7438         JAVAINC="-I$JAVA_HOME/include"
7439         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7440         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7441         ;;
7443     linux-gnu*)
7444         JAVAINC="-I$JAVA_HOME/include"
7445         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7446         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7447         ;;
7449     *netbsd*)
7450         JAVAINC="-I$JAVA_HOME/include"
7451         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7452         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7453        ;;
7455     openbsd*)
7456         JAVAINC="-I$JAVA_HOME/include"
7457         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7458         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7459         ;;
7461     solaris*)
7462         JAVAINC="-I$JAVA_HOME/include"
7463         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7464         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7465         ;;
7466     esac
7468 SOLARINC="$SOLARINC $JAVAINC"
7470 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER"; then
7471     url_check_unknown=0
7472     java_base="testurlcheck"
7473     java_src="${java_base}.java"
7474     java_cls="${java_base}.class"
7475     cat > "${java_src}" <<_ACEOF
7476 [import jdk.internal.loader.URLClassPath;
7477 import java.lang.reflect.Field;
7478 import java.net.URL;
7480 class ${java_base}
7482     public static void main(String args[])
7483     {
7484         try {
7485             URLClassPath cp = new URLClassPath(new URL[0], null);
7486             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7487             field.setAccessible(true);
7488             System.out.println(field.get(cp).toString());
7489         } catch(Exception e) {
7490             System.out.println("unknown");
7491         }
7492     }
7494 _ACEOF
7495     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7496     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7497     AC_TRY_EVAL(java_cmd)
7498     if test $? = 0 -a -f "./${java_cls}"; then
7499         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7500         if test $? = 0; then
7501             case "${java_res}" in
7502             true) AC_MSG_RESULT([yes]) ;;
7503             false)
7504                 rm -f "./${java_src}" "./${java_cls}"
7505                 AC_MSG_ERROR([no - Java unit tests will break!])
7506                 ;;
7507             *) url_check_unknown=1 ;;
7508             esac
7509         else
7510             url_check_unknown=1
7511         fi
7512     else
7513         url_check_unknown=1
7514     fi
7515     if test $url_check_unknown -eq 1; then
7516         AC_MSG_RESULT([unknown - assuming yes])
7517         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7518     fi
7519     rm -f "./${java_src}" "./${java_cls}"
7522 AC_SUBST(JAVACOMPILER)
7523 AC_SUBST(JAVADOC)
7524 AC_SUBST(JAVAINTERPRETER)
7525 AC_SUBST(JAVAIFLAGS)
7526 AC_SUBST(JAVAFLAGS)
7527 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7528 AC_SUBST(JAVA_HOME)
7529 AC_SUBST(JAVA_SOURCE_VER)
7530 AC_SUBST(JAVA_TARGET_VER)
7531 AC_SUBST(JDK)
7534 dnl ===================================================================
7535 dnl Export file validation
7536 dnl ===================================================================
7537 AC_MSG_CHECKING([whether to enable export file validation])
7538 if test "$with_export_validation" != "no"; then
7539     if test -z "$ENABLE_JAVA"; then
7540         if test "$with_export_validation" = "yes"; then
7541             AC_MSG_ERROR([requested, but Java is disabled])
7542         else
7543             AC_MSG_RESULT([no, as Java is disabled])
7544         fi
7545     elif test "$_jdk_ver" -lt 10800; then
7546         if test "$with_export_validation" = "yes"; then
7547             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7548         else
7549             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7550         fi
7551     else
7552         AC_MSG_RESULT([yes])
7553         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7555         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7556         if test -z "$ODFVALIDATOR"; then
7557             # remember to download the ODF toolkit with validator later
7558             AC_MSG_NOTICE([no odfvalidator found, will download it])
7559             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7560             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7562             # and fetch name of odfvalidator jar name from download.lst
7563             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7564             AC_SUBST(ODFVALIDATOR_JAR)
7566             if test -z "$ODFVALIDATOR_JAR"; then
7567                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7568             fi
7569         fi
7570         if test "$build_os" = "cygwin"; then
7571             # In case of Cygwin it will be executed from Windows,
7572             # so we need to run bash and absolute path to validator
7573             # so instead of "odfvalidator" it will be
7574             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7575             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7576         else
7577             ODFVALIDATOR="sh $ODFVALIDATOR"
7578         fi
7579         AC_SUBST(ODFVALIDATOR)
7582         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7583         if test -z "$OFFICEOTRON"; then
7584             # remember to download the officeotron with validator later
7585             AC_MSG_NOTICE([no officeotron found, will download it])
7586             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7587             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7589             # and fetch name of officeotron jar name from download.lst
7590             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7591             AC_SUBST(OFFICEOTRON_JAR)
7593             if test -z "$OFFICEOTRON_JAR"; then
7594                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7595             fi
7596         else
7597             # check version of existing officeotron
7598             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7599             if test 0"$OFFICEOTRON_VER" -lt 704; then
7600                 AC_MSG_ERROR([officeotron too old])
7601             fi
7602         fi
7603         if test "$build_os" = "cygwin"; then
7604             # In case of Cygwin it will be executed from Windows,
7605             # so we need to run bash and absolute path to validator
7606             # so instead of "odfvalidator" it will be
7607             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7608             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7609         else
7610             OFFICEOTRON="sh $OFFICEOTRON"
7611         fi
7612     fi
7613     AC_SUBST(OFFICEOTRON)
7614 else
7615     AC_MSG_RESULT([no])
7618 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7619 if test "$with_bffvalidator" != "no"; then
7620     AC_DEFINE(HAVE_BFFVALIDATOR)
7622     if test "$with_export_validation" = "no"; then
7623         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7624     fi
7626     if test "$with_bffvalidator" = "yes"; then
7627         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7628     else
7629         BFFVALIDATOR="$with_bffvalidator"
7630     fi
7632     if test "$build_os" = "cygwin"; then
7633         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7634             AC_MSG_RESULT($BFFVALIDATOR)
7635         else
7636             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7637         fi
7638     elif test -n "$BFFVALIDATOR"; then
7639         # We are not in Cygwin but need to run Windows binary with wine
7640         AC_PATH_PROGS(WINE, wine)
7642         # so swap in a shell wrapper that converts paths transparently
7643         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7644         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7645         AC_SUBST(BFFVALIDATOR_EXE)
7646         AC_MSG_RESULT($BFFVALIDATOR)
7647     else
7648         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7649     fi
7650     AC_SUBST(BFFVALIDATOR)
7651 else
7652     AC_MSG_RESULT([no])
7655 dnl ===================================================================
7656 dnl Check for C preprocessor to use
7657 dnl ===================================================================
7658 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7659 if test -n "$with_idlc_cpp"; then
7660     AC_MSG_RESULT([$with_idlc_cpp])
7661     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7662 else
7663     AC_MSG_RESULT([ucpp])
7664     AC_MSG_CHECKING([which ucpp tp use])
7665     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7666         AC_MSG_RESULT([external])
7667         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7668     else
7669         AC_MSG_RESULT([internal])
7670         BUILD_TYPE="$BUILD_TYPE UCPP"
7671     fi
7673 AC_SUBST(SYSTEM_UCPP)
7675 dnl ===================================================================
7676 dnl Check for epm (not needed for Windows)
7677 dnl ===================================================================
7678 AC_MSG_CHECKING([whether to enable EPM for packing])
7679 if test "$enable_epm" = "yes"; then
7680     AC_MSG_RESULT([yes])
7681     if test "$_os" != "WINNT"; then
7682         if test $_os = Darwin; then
7683             EPM=internal
7684         elif test -n "$with_epm"; then
7685             EPM=$with_epm
7686         else
7687             AC_PATH_PROG(EPM, epm, no)
7688         fi
7689         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7690             AC_MSG_NOTICE([EPM will be built.])
7691             BUILD_TYPE="$BUILD_TYPE EPM"
7692             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7693         else
7694             # Gentoo has some epm which is something different...
7695             AC_MSG_CHECKING([whether the found epm is the right epm])
7696             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7697                 AC_MSG_RESULT([yes])
7698             else
7699                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7700             fi
7701             AC_MSG_CHECKING([epm version])
7702             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7703             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7704                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7705                 AC_MSG_RESULT([OK, >= 3.7])
7706             else
7707                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7708                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7709             fi
7710         fi
7711     fi
7713     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7714         AC_MSG_CHECKING([for rpm])
7715         for a in "$RPM" rpmbuild rpm; do
7716             $a --usage >/dev/null 2> /dev/null
7717             if test $? -eq 0; then
7718                 RPM=$a
7719                 break
7720             else
7721                 $a --version >/dev/null 2> /dev/null
7722                 if test $? -eq 0; then
7723                     RPM=$a
7724                     break
7725                 fi
7726             fi
7727         done
7728         if test -z "$RPM"; then
7729             AC_MSG_ERROR([not found])
7730         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7731             RPM_PATH=`which $RPM`
7732             AC_MSG_RESULT([$RPM_PATH])
7733             SCPDEFS="$SCPDEFS -DWITH_RPM"
7734         else
7735             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7736         fi
7737     fi
7738     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7739         AC_PATH_PROG(DPKG, dpkg, no)
7740         if test "$DPKG" = "no"; then
7741             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7742         fi
7743     fi
7744     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7745        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7746         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7747             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7748                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7749                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7750                     AC_MSG_RESULT([yes])
7751                 else
7752                     AC_MSG_RESULT([no])
7753                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7754                         _pt="rpm"
7755                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7756                         add_warning "the rpms will need to be installed with --nodeps"
7757                     else
7758                         _pt="pkg"
7759                     fi
7760                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7761                     add_warning "the ${_pt}s will not be relocatable"
7762                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7763                                  relocation will work, you need to patch your epm with the
7764                                  patch in epm/epm-3.7.patch or build with
7765                                  --with-epm=internal which will build a suitable epm])
7766                 fi
7767             fi
7768         fi
7769     fi
7770     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7771         AC_PATH_PROG(PKGMK, pkgmk, no)
7772         if test "$PKGMK" = "no"; then
7773             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7774         fi
7775     fi
7776     AC_SUBST(RPM)
7777     AC_SUBST(DPKG)
7778     AC_SUBST(PKGMK)
7779 else
7780     for i in $PKGFORMAT; do
7781         case "$i" in
7782         aix | bsd | deb | pkg | rpm | native | portable)
7783             AC_MSG_ERROR(
7784                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7785             ;;
7786         esac
7787     done
7788     AC_MSG_RESULT([no])
7789     EPM=NO
7791 AC_SUBST(EPM)
7793 ENABLE_LWP=
7794 if test "$enable_lotuswordpro" = "yes"; then
7795     ENABLE_LWP="TRUE"
7797 AC_SUBST(ENABLE_LWP)
7799 dnl ===================================================================
7800 dnl Check for building ODK
7801 dnl ===================================================================
7802 if test "$enable_odk" = no; then
7803     unset DOXYGEN
7804 else
7805     if test "$with_doxygen" = no; then
7806         AC_MSG_CHECKING([for doxygen])
7807         unset DOXYGEN
7808         AC_MSG_RESULT([no])
7809     else
7810         if test "$with_doxygen" = yes; then
7811             AC_PATH_PROG([DOXYGEN], [doxygen])
7812             if test -z "$DOXYGEN"; then
7813                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7814             fi
7815             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7816                 if ! dot -V 2>/dev/null; then
7817                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7818                 fi
7819             fi
7820         else
7821             AC_MSG_CHECKING([for doxygen])
7822             DOXYGEN=$with_doxygen
7823             AC_MSG_RESULT([$DOXYGEN])
7824         fi
7825         if test -n "$DOXYGEN"; then
7826             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7827             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7828             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7829                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7830             fi
7831         fi
7832     fi
7834 AC_SUBST([DOXYGEN])
7836 AC_MSG_CHECKING([whether to build the ODK])
7837 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7838     AC_MSG_RESULT([yes])
7840     if test "$with_java" != "no"; then
7841         AC_MSG_CHECKING([whether to build unowinreg.dll])
7842         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7843             # build on Win by default
7844             enable_build_unowinreg=yes
7845         fi
7846         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7847             AC_MSG_RESULT([no])
7848             BUILD_UNOWINREG=
7849         else
7850             AC_MSG_RESULT([yes])
7851             BUILD_UNOWINREG=TRUE
7852         fi
7853         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7854             if test -z "$with_mingw_cross_compiler"; then
7855                 dnl Guess...
7856                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7857             elif test -x "$with_mingw_cross_compiler"; then
7858                  MINGWCXX="$with_mingw_cross_compiler"
7859             else
7860                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7861             fi
7863             if test "$MINGWCXX" = "false"; then
7864                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7865             fi
7867             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7868             if test -x "$mingwstrip_test"; then
7869                 MINGWSTRIP="$mingwstrip_test"
7870             else
7871                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7872             fi
7874             if test "$MINGWSTRIP" = "false"; then
7875                 AC_MSG_ERROR(MinGW32 binutils not found.)
7876             fi
7877         fi
7878     fi
7879     BUILD_TYPE="$BUILD_TYPE ODK"
7880 else
7881     AC_MSG_RESULT([no])
7882     BUILD_UNOWINREG=
7884 AC_SUBST(BUILD_UNOWINREG)
7885 AC_SUBST(MINGWCXX)
7886 AC_SUBST(MINGWSTRIP)
7888 dnl ===================================================================
7889 dnl Check for system zlib
7890 dnl ===================================================================
7891 if test "$with_system_zlib" = "auto"; then
7892     case "$_os" in
7893     WINNT)
7894         with_system_zlib="$with_system_libs"
7895         ;;
7896     *)
7897         if test "$enable_fuzzers" != "yes"; then
7898             with_system_zlib=yes
7899         else
7900             with_system_zlib=no
7901         fi
7902         ;;
7903     esac
7906 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
7907 dnl and has no pkg-config for it at least on some tinderboxes,
7908 dnl so leaving that out for now
7909 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7910 AC_MSG_CHECKING([which zlib to use])
7911 if test "$with_system_zlib" = "yes"; then
7912     AC_MSG_RESULT([external])
7913     SYSTEM_ZLIB=TRUE
7914     AC_CHECK_HEADER(zlib.h, [],
7915         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7916     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7917         [AC_MSG_ERROR(zlib not found or functional)], [])
7918 else
7919     AC_MSG_RESULT([internal])
7920     SYSTEM_ZLIB=
7921     BUILD_TYPE="$BUILD_TYPE ZLIB"
7922     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7923     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7925 AC_SUBST(ZLIB_CFLAGS)
7926 AC_SUBST(ZLIB_LIBS)
7927 AC_SUBST(SYSTEM_ZLIB)
7929 dnl ===================================================================
7930 dnl Check for system jpeg
7931 dnl ===================================================================
7932 AC_MSG_CHECKING([which libjpeg to use])
7933 if test "$with_system_jpeg" = "yes"; then
7934     AC_MSG_RESULT([external])
7935     SYSTEM_LIBJPEG=TRUE
7936     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7937         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7938     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7939         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7940 else
7941     SYSTEM_LIBJPEG=
7942     AC_MSG_RESULT([internal, libjpeg-turbo])
7943     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7944     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7945     if test "$COM" = "MSC"; then
7946         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7947     else
7948         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7949     fi
7951     case "$host_cpu" in
7952     x86_64 | amd64 | i*86 | x86 | ia32)
7953         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7954         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7955             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7956                 NASM="$LODE_HOME/opt/bin/nasm"
7957             elif test -x "/opt/lo/bin/nasm"; then
7958                 NASM="/opt/lo/bin/nasm"
7959             fi
7960         fi
7962         if test -n "$NASM"; then
7963             AC_MSG_CHECKING([for object file format of host system])
7964             case "$host_os" in
7965               cygwin* | mingw* | pw32* | interix*)
7966                 case "$host_cpu" in
7967                   x86_64)
7968                     objfmt='Win64-COFF'
7969                     ;;
7970                   *)
7971                     objfmt='Win32-COFF'
7972                     ;;
7973                 esac
7974               ;;
7975               msdosdjgpp* | go32*)
7976                 objfmt='COFF'
7977               ;;
7978               os2-emx*)                 # not tested
7979                 objfmt='MSOMF'          # obj
7980               ;;
7981               linux*coff* | linux*oldld*)
7982                 objfmt='COFF'           # ???
7983               ;;
7984               linux*aout*)
7985                 objfmt='a.out'
7986               ;;
7987               linux*)
7988                 case "$host_cpu" in
7989                   x86_64)
7990                     objfmt='ELF64'
7991                     ;;
7992                   *)
7993                     objfmt='ELF'
7994                     ;;
7995                 esac
7996               ;;
7997               kfreebsd* | freebsd* | netbsd* | openbsd*)
7998                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7999                   objfmt='BSD-a.out'
8000                 else
8001                   case "$host_cpu" in
8002                     x86_64 | amd64)
8003                       objfmt='ELF64'
8004                       ;;
8005                     *)
8006                       objfmt='ELF'
8007                       ;;
8008                   esac
8009                 fi
8010               ;;
8011               solaris* | sunos* | sysv* | sco*)
8012                 case "$host_cpu" in
8013                   x86_64)
8014                     objfmt='ELF64'
8015                     ;;
8016                   *)
8017                     objfmt='ELF'
8018                     ;;
8019                 esac
8020               ;;
8021               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8022                 case "$host_cpu" in
8023                   x86_64)
8024                     objfmt='Mach-O64'
8025                     ;;
8026                   *)
8027                     objfmt='Mach-O'
8028                     ;;
8029                 esac
8030               ;;
8031               *)
8032                 objfmt='ELF ?'
8033               ;;
8034             esac
8036             AC_MSG_RESULT([$objfmt])
8037             if test "$objfmt" = 'ELF ?'; then
8038               objfmt='ELF'
8039               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8040             fi
8042             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8043             case "$objfmt" in
8044               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8045               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8046               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8047               COFF)       NAFLAGS='-fcoff -DCOFF';;
8048               a.out)      NAFLAGS='-faout -DAOUT';;
8049               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8050               ELF)        NAFLAGS='-felf -DELF';;
8051               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8052               RDF)        NAFLAGS='-frdf -DRDF';;
8053               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8054               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8055             esac
8056             AC_MSG_RESULT([$NAFLAGS])
8058             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8059             cat > conftest.asm << EOF
8060             [%line __oline__ "configure"
8061                     section .text
8062                     global  _main,main
8063             _main:
8064             main:   xor     eax,eax
8065                     ret
8066             ]
8068             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8069             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8070               AC_MSG_RESULT(yes)
8071             else
8072               echo "configure: failed program was:" >&AC_FD_CC
8073               cat conftest.asm >&AC_FD_CC
8074               rm -rf conftest*
8075               AC_MSG_RESULT(no)
8076               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8077               NASM=""
8078             fi
8080         fi
8082         if test -z "$NASM"; then
8083 cat << _EOS
8084 ****************************************************************************
8085 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8086 To get one please:
8088 _EOS
8089             if test "$build_os" = "cygwin"; then
8090 cat << _EOS
8091 install a pre-compiled binary for Win32
8093 mkdir -p /opt/lo/bin
8094 cd /opt/lo/bin
8095 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8096 chmod +x nasm
8098 or get and install one from http://www.nasm.us/
8100 Then re-run autogen.sh
8102 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8103 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8105 _EOS
8106             else
8107 cat << _EOS
8108 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8110 _EOS
8111             fi
8112             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8113             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8114         fi
8115       ;;
8116     esac
8119 AC_SUBST(NASM)
8120 AC_SUBST(LIBJPEG_CFLAGS)
8121 AC_SUBST(LIBJPEG_LIBS)
8122 AC_SUBST(SYSTEM_LIBJPEG)
8124 dnl ===================================================================
8125 dnl Check for system clucene
8126 dnl ===================================================================
8127 dnl we should rather be using
8128 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8129 dnl but the contribs-lib check seems tricky
8130 AC_MSG_CHECKING([which clucene to use])
8131 if test "$with_system_clucene" = "yes"; then
8132     AC_MSG_RESULT([external])
8133     SYSTEM_CLUCENE=TRUE
8134     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8135     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8136     FilterLibs "${CLUCENE_LIBS}"
8137     CLUCENE_LIBS="${filteredlibs}"
8138     AC_LANG_PUSH([C++])
8139     save_CXXFLAGS=$CXXFLAGS
8140     save_CPPFLAGS=$CPPFLAGS
8141     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8142     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8143     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8144     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8145     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8146                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8147     CXXFLAGS=$save_CXXFLAGS
8148     CPPFLAGS=$save_CPPFLAGS
8149     AC_LANG_POP([C++])
8151     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8152 else
8153     AC_MSG_RESULT([internal])
8154     SYSTEM_CLUCENE=
8155     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8157 AC_SUBST(SYSTEM_CLUCENE)
8158 AC_SUBST(CLUCENE_CFLAGS)
8159 AC_SUBST(CLUCENE_LIBS)
8161 dnl ===================================================================
8162 dnl Check for system expat
8163 dnl ===================================================================
8164 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8166 dnl ===================================================================
8167 dnl Check for system xmlsec
8168 dnl ===================================================================
8169 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8171 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8172 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8173     ENABLE_EOT="TRUE"
8174     AC_DEFINE([ENABLE_EOT])
8175     AC_MSG_RESULT([yes])
8177     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8178 else
8179     ENABLE_EOT=
8180     AC_MSG_RESULT([no])
8182 AC_SUBST([ENABLE_EOT])
8184 dnl ===================================================================
8185 dnl Check for DLP libs
8186 dnl ===================================================================
8187 AS_IF([test "$COM" = "MSC"],
8188       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8189       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8191 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8193 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8195 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8197 AS_IF([test "$COM" = "MSC"],
8198       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8199       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8201 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8203 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8205 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8206 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8208 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8210 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8212 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8214 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8215 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8217 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8218 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8220 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8222 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8223 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8225 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8227 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8229 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8231 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8233 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8234 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8236 dnl ===================================================================
8237 dnl Check for system lcms2
8238 dnl ===================================================================
8239 if test "$with_system_lcms2" != "yes"; then
8240     SYSTEM_LCMS2=
8242 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8243 if test "$GCC" = "yes"; then
8244     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8246 if test "$COM" = "MSC"; then # override the above
8247     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8250 dnl ===================================================================
8251 dnl Check for system cppunit
8252 dnl ===================================================================
8253 if test "$_os" != "Android" ; then
8254     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8257 dnl ===================================================================
8258 dnl Check whether freetype is available
8259 dnl ===================================================================
8260 if test  "$test_freetype" = "yes"; then
8261     AC_MSG_CHECKING([whether freetype is available])
8262     # FreeType has 3 different kinds of versions
8263     # * release, like 2.4.10
8264     # * libtool, like 13.0.7 (this what pkg-config returns)
8265     # * soname
8266     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8267     #
8268     # 9.9.3 is 2.2.0
8269     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8270     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8271     FilterLibs "${FREETYPE_LIBS}"
8272     FREETYPE_LIBS="${filteredlibs}"
8273     SYSTEM_FREETYPE=TRUE
8274 else
8275     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8276     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8278 AC_SUBST(FREETYPE_CFLAGS)
8279 AC_SUBST(FREETYPE_LIBS)
8280 AC_SUBST([SYSTEM_FREETYPE])
8282 # ===================================================================
8283 # Check for system libxslt
8284 # to prevent incompatibilities between internal libxml2 and external libxslt,
8285 # or vice versa, use with_system_libxml here
8286 # ===================================================================
8287 if test "$with_system_libxml" = "auto"; then
8288     case "$_os" in
8289     WINNT|iOS|Android)
8290         with_system_libxml="$with_system_libs"
8291         ;;
8292     *)
8293         if test "$enable_fuzzers" != "yes"; then
8294             with_system_libxml=yes
8295         else
8296             with_system_libxml=no
8297         fi
8298         ;;
8299     esac
8302 AC_MSG_CHECKING([which libxslt to use])
8303 if test "$with_system_libxml" = "yes"; then
8304     AC_MSG_RESULT([external])
8305     SYSTEM_LIBXSLT=TRUE
8306     if test "$_os" = "Darwin"; then
8307         dnl make sure to use SDK path
8308         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8309         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8310         dnl omit -L/usr/lib
8311         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8312         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8313     else
8314         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8315         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8316         FilterLibs "${LIBXSLT_LIBS}"
8317         LIBXSLT_LIBS="${filteredlibs}"
8318         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8319         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8320         FilterLibs "${LIBEXSLT_LIBS}"
8321         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8322     fi
8324     dnl Check for xsltproc
8325     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8326     if test "$XSLTPROC" = "no"; then
8327         AC_MSG_ERROR([xsltproc is required])
8328     fi
8329 else
8330     AC_MSG_RESULT([internal])
8331     SYSTEM_LIBXSLT=
8332     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8334     if test "$cross_compiling" = "yes"; then
8335         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8336         if test "$XSLTPROC" = "no"; then
8337             AC_MSG_ERROR([xsltproc is required])
8338         fi
8339     fi
8341 AC_SUBST(SYSTEM_LIBXSLT)
8342 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8343     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8345 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8347 AC_SUBST(LIBEXSLT_CFLAGS)
8348 AC_SUBST(LIBEXSLT_LIBS)
8349 AC_SUBST(LIBXSLT_CFLAGS)
8350 AC_SUBST(LIBXSLT_LIBS)
8351 AC_SUBST(XSLTPROC)
8353 # ===================================================================
8354 # Check for system libxml
8355 # ===================================================================
8356 AC_MSG_CHECKING([which libxml to use])
8357 if test "$with_system_libxml" = "yes"; then
8358     AC_MSG_RESULT([external])
8359     SYSTEM_LIBXML=TRUE
8360     if test "$_os" = "Darwin"; then
8361         dnl make sure to use SDK path
8362         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8363         dnl omit -L/usr/lib
8364         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8365     elif test $_os = iOS; then
8366         dnl make sure to use SDK path
8367         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8368         LIBXML_CFLAGS="-I$usr/include/libxml2"
8369         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8370     else
8371         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8372         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8373         FilterLibs "${LIBXML_LIBS}"
8374         LIBXML_LIBS="${filteredlibs}"
8375     fi
8377     dnl Check for xmllint
8378     AC_PATH_PROG(XMLLINT, xmllint, no)
8379     if test "$XMLLINT" = "no"; then
8380         AC_MSG_ERROR([xmllint is required])
8381     fi
8382 else
8383     AC_MSG_RESULT([internal])
8384     SYSTEM_LIBXML=
8385     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8386     if test "$COM" = "MSC"; then
8387         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8388     fi
8389     if test "$COM" = "MSC"; then
8390         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8391     else
8392         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8393     fi
8394     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8396 AC_SUBST(SYSTEM_LIBXML)
8397 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8398     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8400 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8401 AC_SUBST(LIBXML_CFLAGS)
8402 AC_SUBST(LIBXML_LIBS)
8403 AC_SUBST(XMLLINT)
8405 # =====================================================================
8406 # Checking for a Python interpreter with version >= 2.7.
8407 # Build and runtime requires Python 3 compatible version (>= 2.7).
8408 # Optionally user can pass an option to configure, i. e.
8409 # ./configure PYTHON=/usr/bin/python
8410 # =====================================================================
8411 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8412     # This allows a lack of system python with no error, we use internal one in that case.
8413     AM_PATH_PYTHON([2.7],, [:])
8414     # Clean PYTHON_VERSION checked below if cross-compiling
8415     PYTHON_VERSION=""
8416     if test "$PYTHON" != ":"; then
8417         PYTHON_FOR_BUILD=$PYTHON
8418     fi
8420 AC_SUBST(PYTHON_FOR_BUILD)
8422 # Checks for Python to use for Pyuno
8423 AC_MSG_CHECKING([which Python to use for Pyuno])
8424 case "$enable_python" in
8425 no|disable)
8426     if test -z $PYTHON_FOR_BUILD; then
8427         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8428         # requirement from the choice whether to include Python stuff in the installer, but why
8429         # bother?
8430         AC_MSG_ERROR([Python is required at build time.])
8431     fi
8432     enable_python=no
8433     AC_MSG_RESULT([none])
8434     ;;
8435 ""|yes|auto)
8436     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8437         AC_MSG_RESULT([no, overridden by --disable-scripting])
8438         enable_python=no
8439     elif test $build_os = cygwin; then
8440         dnl When building on Windows we don't attempt to use any installed
8441         dnl "system"  Python.
8442         AC_MSG_RESULT([fully internal])
8443         enable_python=internal
8444     elif test "$cross_compiling" = yes; then
8445         AC_MSG_RESULT([system])
8446         enable_python=system
8447     else
8448         # Unset variables set by the above AM_PATH_PYTHON so that
8449         # we actually do check anew.
8450         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
8451         AM_PATH_PYTHON([3.3],, [:])
8452         if test "$PYTHON" = ":"; then
8453             if test -z "$PYTHON_FOR_BUILD"; then
8454                 AC_MSG_RESULT([fully internal])
8455             else
8456                 AC_MSG_RESULT([internal])
8457             fi
8458             enable_python=internal
8459         else
8460             AC_MSG_RESULT([system])
8461             enable_python=system
8462         fi
8463     fi
8464     ;;
8465 internal)
8466     AC_MSG_RESULT([internal])
8467     ;;
8468 fully-internal)
8469     AC_MSG_RESULT([fully internal])
8470     enable_python=internal
8471     ;;
8472 system)
8473     AC_MSG_RESULT([system])
8474     if test "$_os" = Darwin; then
8475         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])
8476     fi
8477     ;;
8479     AC_MSG_ERROR([Incorrect --enable-python option])
8480     ;;
8481 esac
8483 if test $enable_python != no; then
8484     BUILD_TYPE="$BUILD_TYPE PYUNO"
8487 if test $enable_python = system; then
8488     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8489         # Fallback: Accept these in the environment, or as set above
8490         # for MacOSX.
8491         :
8492     elif test "$cross_compiling" != yes; then
8493         # Unset variables set by the above AM_PATH_PYTHON so that
8494         # we actually do check anew.
8495         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
8496         # This causes an error if no python command is found
8497         AM_PATH_PYTHON([3.3])
8498         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8499         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8500         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8501         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8502         if test -z "$PKG_CONFIG"; then
8503             PYTHON_CFLAGS="-I$python_include"
8504             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8505         elif $PKG_CONFIG --exists python-$python_version; then
8506             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8507             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8508         else
8509             PYTHON_CFLAGS="-I$python_include"
8510             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8511         fi
8512         FilterLibs "${PYTHON_LIBS}"
8513         PYTHON_LIBS="${filteredlibs}"
8514     else
8515         dnl How to find out the cross-compilation Python installation path?
8516         AC_MSG_CHECKING([for python version])
8517         AS_IF([test -n "$PYTHON_VERSION"],
8518               [AC_MSG_RESULT([$PYTHON_VERSION])],
8519               [AC_MSG_RESULT([not found])
8520                AC_MSG_ERROR([no usable python found])])
8521         test -n "$PYTHON_CFLAGS" && break
8522     fi
8524     dnl Check if the headers really work
8525     save_CPPFLAGS="$CPPFLAGS"
8526     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8527     AC_CHECK_HEADER(Python.h)
8528     CPPFLAGS="$save_CPPFLAGS"
8530     # let the PYTHON_FOR_BUILD match the same python installation that
8531     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8532     # better for PythonTests.
8533     PYTHON_FOR_BUILD=$PYTHON
8536 if test "$with_lxml" != no; then
8537     if test -z "$PYTHON_FOR_BUILD"; then
8538         case $build_os in
8539             cygwin)
8540                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8541                 ;;
8542             *)
8543                 if test "$cross_compiling" != yes ; then
8544                     BUILD_TYPE="$BUILD_TYPE LXML"
8545                 fi
8546                 ;;
8547         esac
8548     else
8549         AC_MSG_CHECKING([for python lxml])
8550         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8551             AC_MSG_RESULT([yes])
8552         else
8553             case $build_os in
8554                 cygwin)
8555                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8556                     ;;
8557                 *)
8558                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8559                         BUILD_TYPE="$BUILD_TYPE LXML"
8560                         AC_MSG_RESULT([no, using internal lxml])
8561                     else
8562                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8563                     fi
8564                     ;;
8565             esac
8566         fi
8567     fi
8570 dnl By now enable_python should be "system", "internal" or "no"
8571 case $enable_python in
8572 system)
8573     SYSTEM_PYTHON=TRUE
8575     if test "x$ac_cv_header_Python_h" != "xyes"; then
8576        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8577     fi
8579     AC_LANG_PUSH(C)
8580     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8581     AC_MSG_CHECKING([for correct python library version])
8582        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8583 #include <Python.h>
8585 int main(int argc, char **argv) {
8586    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8587        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8588    else return 1;
8590        ]])],[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])])
8591     CFLAGS=$save_CFLAGS
8592     AC_LANG_POP(C)
8594     dnl FIXME Check if the Python library can be linked with, too?
8595     ;;
8597 internal)
8598     SYSTEM_PYTHON=
8599     PYTHON_VERSION_MAJOR=3
8600     PYTHON_VERSION_MINOR=5
8601     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.6
8602     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8603         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8604     fi
8605     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8606     BUILD_TYPE="$BUILD_TYPE PYTHON"
8607     # Embedded Python dies without Home set
8608     if test "$HOME" = ""; then
8609         export HOME=""
8610     fi
8611     ;;
8613     DISABLE_PYTHON=TRUE
8614     SYSTEM_PYTHON=
8615     ;;
8617     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8618     ;;
8619 esac
8621 AC_SUBST(DISABLE_PYTHON)
8622 AC_SUBST(SYSTEM_PYTHON)
8623 AC_SUBST(PYTHON_CFLAGS)
8624 AC_SUBST(PYTHON_LIBS)
8625 AC_SUBST(PYTHON_VERSION)
8626 AC_SUBST(PYTHON_VERSION_MAJOR)
8627 AC_SUBST(PYTHON_VERSION_MINOR)
8629 ENABLE_MARIADBC=TRUE
8630 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8631     ENABLE_MARIADBC=
8633 MARIADBC_MAJOR=1
8634 MARIADBC_MINOR=0
8635 MARIADBC_MICRO=2
8636 if test "$ENABLE_MARIADBC" = "TRUE"; then
8637     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8640 AC_SUBST(ENABLE_MARIADBC)
8641 AC_SUBST(MARIADBC_MAJOR)
8642 AC_SUBST(MARIADBC_MINOR)
8643 AC_SUBST(MARIADBC_MICRO)
8645 if test "$ENABLE_MARIADBC" = "TRUE"; then
8646     dnl ===================================================================
8647     dnl Check for system MariaDB
8648     dnl ===================================================================
8649     AC_MSG_CHECKING([which MariaDB to use])
8650     if test "$with_system_mariadb" = "yes"; then
8651         AC_MSG_RESULT([external])
8652         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8653         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8654         if test -z "$MARIADBCONFIG"; then
8655             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8656             if test -z "$MARIADBCONFIG"; then
8657                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8658                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8659             fi
8660         fi
8661         AC_MSG_CHECKING([MariaDB version])
8662         MARIADB_VERSION=`$MARIADBCONFIG --version`
8663         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8664         if test "$MARIADB_MAJOR" -ge "5"; then
8665             AC_MSG_RESULT([OK])
8666         else
8667             AC_MSG_ERROR([too old, use 5.0.x or later])
8668         fi
8669         AC_MSG_CHECKING([for MariaDB Client library])
8670         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8671         if test "$COM_IS_CLANG" = TRUE; then
8672             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8673         fi
8674         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8675         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8676         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8677         dnl linux32:
8678         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8679             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8680             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8681                 | sed -e 's|/lib64/|/lib/|')
8682         fi
8683         FilterLibs "${MARIADB_LIBS}"
8684         MARIADB_LIBS="${filteredlibs}"
8685         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8686         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8687         if test "$enable_bundle_mariadb" = "yes"; then
8688             AC_MSG_RESULT([yes])
8689             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8690             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8692 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8694 /g' | grep -E '(mysqlclient|mariadb)')
8695             if test "$_os" = "Darwin"; then
8696                 LIBMARIADB=${LIBMARIADB}.dylib
8697             elif test "$_os" = "WINNT"; then
8698                 LIBMARIADB=${LIBMARIADB}.dll
8699             else
8700                 LIBMARIADB=${LIBMARIADB}.so
8701             fi
8702             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8703             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8704             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8705                 AC_MSG_RESULT([found.])
8706                 PathFormat "$LIBMARIADB_PATH"
8707                 LIBMARIADB_PATH="$formatted_path"
8708             else
8709                 AC_MSG_ERROR([not found.])
8710             fi
8711         else
8712             AC_MSG_RESULT([no])
8713             BUNDLE_MARIADB_CONNECTOR_C=
8714         fi
8715     else
8716         AC_MSG_RESULT([internal])
8717         SYSTEM_MARIADB_CONNECTOR_C=
8718         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8719         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8720         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8721     fi
8723     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8724     AC_SUBST(MARIADB_CFLAGS)
8725     AC_SUBST(MARIADB_LIBS)
8726     AC_SUBST(LIBMARIADB)
8727     AC_SUBST(LIBMARIADB_PATH)
8728     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8731 dnl ===================================================================
8732 dnl Check for system hsqldb
8733 dnl ===================================================================
8734 if test "$with_java" != "no"; then
8735     HSQLDB_USE_JDBC_4_1=
8736     AC_MSG_CHECKING([which hsqldb to use])
8737     if test "$with_system_hsqldb" = "yes"; then
8738         AC_MSG_RESULT([external])
8739         SYSTEM_HSQLDB=TRUE
8740         if test -z $HSQLDB_JAR; then
8741             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8742         fi
8743         if ! test -f $HSQLDB_JAR; then
8744                AC_MSG_ERROR(hsqldb.jar not found.)
8745         fi
8746         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8747         export HSQLDB_JAR
8748         if $PERL -e \
8749            'use Archive::Zip;
8750             my $file = "$ENV{'HSQLDB_JAR'}";
8751             my $zip = Archive::Zip->new( $file );
8752             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8753             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8754             {
8755                 push @l, split(/\n/, $mf);
8756                 foreach my $line (@l)
8757                 {
8758                     if ($line =~ m/Specification-Version:/)
8759                     {
8760                         ($t, $version) = split (/:/,$line);
8761                         $version =~ s/^\s//;
8762                         ($a, $b, $c, $d) = split (/\./,$version);
8763                         if ($c == "0" && $d > "8")
8764                         {
8765                             exit 0;
8766                         }
8767                         else
8768                         {
8769                             exit 1;
8770                         }
8771                     }
8772                 }
8773             }
8774             else
8775             {
8776                 exit 1;
8777             }'; then
8778             AC_MSG_RESULT([yes])
8779         else
8780             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8781         fi
8782     else
8783         AC_MSG_RESULT([internal])
8784         SYSTEM_HSQLDB=
8785         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8786         NEED_ANT=TRUE
8787         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8788         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8789         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8790             AC_MSG_RESULT([yes])
8791             HSQLDB_USE_JDBC_4_1=TRUE
8792         else
8793             AC_MSG_RESULT([no])
8794         fi
8795     fi
8796     AC_SUBST(SYSTEM_HSQLDB)
8797     AC_SUBST(HSQLDB_JAR)
8798     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8801 dnl ===================================================================
8802 dnl Check for PostgreSQL stuff
8803 dnl ===================================================================
8804 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8805 if test "x$enable_postgresql_sdbc" != "xno"; then
8806     AC_MSG_RESULT([yes])
8807     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8809     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8810         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8811     fi
8812     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8813         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8814     fi
8816     postgres_interface=""
8817     if test "$with_system_postgresql" = "yes"; then
8818         postgres_interface="external PostgreSQL"
8819         SYSTEM_POSTGRESQL=TRUE
8820         if test "$_os" = Darwin; then
8821             supp_path=''
8822             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8823                 pg_supp_path="$P_SEP$d$pg_supp_path"
8824             done
8825         fi
8826         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8827         if test -z "$PGCONFIG"; then
8828             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8829         fi
8830         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8831         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8832         FilterLibs "${POSTGRESQL_LIB}"
8833         POSTGRESQL_LIB="${filteredlibs}"
8834     else
8835         # if/when anything else than PostgreSQL uses Kerberos,
8836         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8837         WITH_KRB5=
8838         WITH_GSSAPI=
8839         case "$_os" in
8840         Darwin)
8841             # macOS has system MIT Kerberos 5 since 10.4
8842             if test "$with_krb5" != "no"; then
8843                 WITH_KRB5=TRUE
8844                 save_LIBS=$LIBS
8845                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8846                 # that the libraries where these functions are located on macOS will change, is it?
8847                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8848                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8849                 KRB5_LIBS=$LIBS
8850                 LIBS=$save_LIBS
8851                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8852                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8853                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8854                 LIBS=$save_LIBS
8855             fi
8856             if test "$with_gssapi" != "no"; then
8857                 WITH_GSSAPI=TRUE
8858                 save_LIBS=$LIBS
8859                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8860                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8861                 GSSAPI_LIBS=$LIBS
8862                 LIBS=$save_LIBS
8863             fi
8864             ;;
8865         WINNT)
8866             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8867                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8868             fi
8869             ;;
8870         Linux|GNU|*BSD|DragonFly)
8871             if test "$with_krb5" != "no"; then
8872                 WITH_KRB5=TRUE
8873                 save_LIBS=$LIBS
8874                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8875                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8876                 KRB5_LIBS=$LIBS
8877                 LIBS=$save_LIBS
8878                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8879                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8880                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8881                 LIBS=$save_LIBS
8882             fi
8883             if test "$with_gssapi" != "no"; then
8884                 WITH_GSSAPI=TRUE
8885                 save_LIBS=$LIBS
8886                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8887                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8888                 GSSAPI_LIBS=$LIBS
8889                 LIBS=$save_LIBS
8890             fi
8891             ;;
8892         *)
8893             if test "$with_krb5" = "yes"; then
8894                 WITH_KRB5=TRUE
8895                 save_LIBS=$LIBS
8896                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8897                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8898                 KRB5_LIBS=$LIBS
8899                 LIBS=$save_LIBS
8900                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8901                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8902                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8903                 LIBS=$save_LIBS
8904             fi
8905             if test "$with_gssapi" = "yes"; then
8906                 WITH_GSSAPI=TRUE
8907                 save_LIBS=$LIBS
8908                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8909                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8910                 LIBS=$save_LIBS
8911                 GSSAPI_LIBS=$LIBS
8912             fi
8913         esac
8915         if test -n "$with_libpq_path"; then
8916             SYSTEM_POSTGRESQL=TRUE
8917             postgres_interface="external libpq"
8918             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8919             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8920         else
8921             SYSTEM_POSTGRESQL=
8922             postgres_interface="internal"
8923             POSTGRESQL_LIB=""
8924             POSTGRESQL_INC="%OVERRIDE_ME%"
8925             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8926         fi
8927     fi
8929     AC_MSG_CHECKING([PostgreSQL C interface])
8930     AC_MSG_RESULT([$postgres_interface])
8932     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8933         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8934         save_CFLAGS=$CFLAGS
8935         save_CPPFLAGS=$CPPFLAGS
8936         save_LIBS=$LIBS
8937         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8938         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8939         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8940         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8941             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8942         CFLAGS=$save_CFLAGS
8943         CPPFLAGS=$save_CPPFLAGS
8944         LIBS=$save_LIBS
8945     fi
8946     BUILD_POSTGRESQL_SDBC=TRUE
8947 else
8948     AC_MSG_RESULT([no])
8950 AC_SUBST(WITH_KRB5)
8951 AC_SUBST(WITH_GSSAPI)
8952 AC_SUBST(GSSAPI_LIBS)
8953 AC_SUBST(KRB5_LIBS)
8954 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8955 AC_SUBST(SYSTEM_POSTGRESQL)
8956 AC_SUBST(POSTGRESQL_INC)
8957 AC_SUBST(POSTGRESQL_LIB)
8959 dnl ===================================================================
8960 dnl Check for Firebird stuff
8961 dnl ===================================================================
8962 ENABLE_FIREBIRD_SDBC=
8963 if test "$enable_firebird_sdbc" = "yes" ; then
8964     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8966     dnl ===================================================================
8967     dnl Check for system Firebird
8968     dnl ===================================================================
8969     AC_MSG_CHECKING([which Firebird to use])
8970     if test "$with_system_firebird" = "yes"; then
8971         AC_MSG_RESULT([external])
8972         SYSTEM_FIREBIRD=TRUE
8973         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8974         if test -z "$FIREBIRDCONFIG"; then
8975             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8976             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8977                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8978             ])
8979             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8980         else
8981             AC_MSG_NOTICE([fb_config found])
8982             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8983             AC_MSG_CHECKING([for Firebird Client library])
8984             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8985             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8986             FilterLibs "${FIREBIRD_LIBS}"
8987             FIREBIRD_LIBS="${filteredlibs}"
8988         fi
8989         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8990         AC_MSG_CHECKING([Firebird version])
8991         if test -n "${FIREBIRD_VERSION}"; then
8992             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8993             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8994             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8995                 AC_MSG_RESULT([OK])
8996             else
8997                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8998             fi
8999         else
9000             __save_CFLAGS="${CFLAGS}"
9001             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9002             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9003 #if defined(FB_API_VER) && FB_API_VER == 30
9004 int fb_api_is_30(void) { return 0; }
9005 #else
9006 #error "Wrong Firebird API version"
9007 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9008             CFLAGS="${__save_CFLAGS}"
9009         fi
9010         ENABLE_FIREBIRD_SDBC=TRUE
9011         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9012     elif test "$enable_database_connectivity" != yes; then
9013         AC_MSG_RESULT([none])
9014     elif test "$cross_compiling" = "yes"; then
9015         AC_MSG_RESULT([none])
9016     else
9017         dnl Embedded Firebird has version 3.0
9018         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9019         dnl We need libatomic_ops for any non X86/X64 system
9020         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9021             dnl ===================================================================
9022             dnl Check for system libatomic_ops
9023             dnl ===================================================================
9024             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9025             if test "$with_system_libatomic_ops" = "yes"; then
9026                 SYSTEM_LIBATOMIC_OPS=TRUE
9027                 AC_CHECK_HEADERS(atomic_ops.h, [],
9028                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9029             else
9030                 SYSTEM_LIBATOMIC_OPS=
9031                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9032                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9033                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9034             fi
9035         fi
9037         AC_MSG_RESULT([internal])
9038         SYSTEM_FIREBIRD=
9039         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9040         FIREBIRD_LIBS="-lfbclient"
9042         if test "$with_system_libtommath" = "yes"; then
9043             SYSTEM_LIBTOMMATH=TRUE
9044             dnl check for tommath presence
9045             save_LIBS=$LIBS
9046             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9047             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9048             LIBS=$save_LIBS
9049         else
9050             SYSTEM_LIBTOMMATH=
9051             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9052             LIBTOMMATH_LIBS="-ltommath"
9053             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9054         fi
9056         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9057         ENABLE_FIREBIRD_SDBC=TRUE
9058         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9059     fi
9061 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9062 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9063 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9064 AC_SUBST(LIBATOMIC_OPS_LIBS)
9065 AC_SUBST(SYSTEM_FIREBIRD)
9066 AC_SUBST(FIREBIRD_CFLAGS)
9067 AC_SUBST(FIREBIRD_LIBS)
9068 AC_SUBST([TOMMATH_CFLAGS])
9069 AC_SUBST([TOMMATH_LIBS])
9071 dnl ===================================================================
9072 dnl Check for system curl
9073 dnl ===================================================================
9074 AC_MSG_CHECKING([which libcurl to use])
9075 if test "$with_system_curl" = "auto"; then
9076     with_system_curl="$with_system_libs"
9079 if test "$with_system_curl" = "yes"; then
9080     AC_MSG_RESULT([external])
9081     SYSTEM_CURL=TRUE
9083     # First try PKGCONFIG and then fall back
9084     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9086     if test -n "$CURL_PKG_ERRORS"; then
9087         AC_PATH_PROG(CURLCONFIG, curl-config)
9088         if test -z "$CURLCONFIG"; then
9089             AC_MSG_ERROR([curl development files not found])
9090         fi
9091         CURL_LIBS=`$CURLCONFIG --libs`
9092         FilterLibs "${CURL_LIBS}"
9093         CURL_LIBS="${filteredlibs}"
9094         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9095         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9097         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9098         case $curl_version in
9099         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9100         dnl so they need to be doubled to end up in the configure script
9101         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9102             AC_MSG_RESULT([yes])
9103             ;;
9104         *)
9105             AC_MSG_ERROR([no, you have $curl_version])
9106             ;;
9107         esac
9108     fi
9110     ENABLE_CURL=TRUE
9111 elif test $_os = iOS; then
9112     # Let's see if we need curl, I think not?
9113     AC_MSG_RESULT([none])
9114     ENABLE_CURL=
9115 else
9116     AC_MSG_RESULT([internal])
9117     SYSTEM_CURL=
9118     BUILD_TYPE="$BUILD_TYPE CURL"
9119     ENABLE_CURL=TRUE
9121 AC_SUBST(SYSTEM_CURL)
9122 AC_SUBST(CURL_CFLAGS)
9123 AC_SUBST(CURL_LIBS)
9124 AC_SUBST(ENABLE_CURL)
9126 dnl ===================================================================
9127 dnl Check for system boost
9128 dnl ===================================================================
9129 AC_MSG_CHECKING([which boost to use])
9130 if test "$with_system_boost" = "yes"; then
9131     AC_MSG_RESULT([external])
9132     SYSTEM_BOOST=TRUE
9133     AX_BOOST_BASE(1.47)
9134     AX_BOOST_DATE_TIME
9135     AX_BOOST_FILESYSTEM
9136     AX_BOOST_IOSTREAMS
9137     AX_BOOST_LOCALE
9138     AC_LANG_PUSH([C++])
9139     save_CXXFLAGS=$CXXFLAGS
9140     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9141     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9142        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9143     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9144        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9145     CXXFLAGS=$save_CXXFLAGS
9146     AC_LANG_POP([C++])
9147     # this is in m4/ax_boost_base.m4
9148     FilterLibs "${BOOST_LDFLAGS}"
9149     BOOST_LDFLAGS="${filteredlibs}"
9150 else
9151     AC_MSG_RESULT([internal])
9152     BUILD_TYPE="$BUILD_TYPE BOOST"
9153     SYSTEM_BOOST=
9154     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9155         # use warning-suppressing wrapper headers
9156         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9157     else
9158         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9159     fi
9161 AC_SUBST(SYSTEM_BOOST)
9163 dnl ===================================================================
9164 dnl Check for system mdds
9165 dnl ===================================================================
9166 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9168 dnl ===================================================================
9169 dnl Check for system glm
9170 dnl ===================================================================
9171 AC_MSG_CHECKING([which glm to use])
9172 if test "$with_system_glm" = "yes"; then
9173     AC_MSG_RESULT([external])
9174     SYSTEM_GLM=TRUE
9175     AC_LANG_PUSH([C++])
9176     AC_CHECK_HEADER([glm/glm.hpp], [],
9177        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9178     AC_LANG_POP([C++])
9179 else
9180     AC_MSG_RESULT([internal])
9181     BUILD_TYPE="$BUILD_TYPE GLM"
9182     SYSTEM_GLM=
9183     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9185 AC_SUBST([GLM_CFLAGS])
9186 AC_SUBST([SYSTEM_GLM])
9188 dnl ===================================================================
9189 dnl Check for system odbc
9190 dnl ===================================================================
9191 AC_MSG_CHECKING([which odbc headers to use])
9192 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
9193     AC_MSG_RESULT([external])
9194     SYSTEM_ODBC_HEADERS=TRUE
9196     if test "$build_os" = "cygwin"; then
9197         save_CPPFLAGS=$CPPFLAGS
9198         find_winsdk
9199         PathFormat "$winsdktest"
9200         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"
9201         AC_CHECK_HEADER(sqlext.h, [],
9202             [AC_MSG_ERROR(odbc not found. install odbc)],
9203             [#include <windows.h>])
9204         CPPFLAGS=$save_CPPFLAGS
9205     else
9206         AC_CHECK_HEADER(sqlext.h, [],
9207             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9208     fi
9209 elif test "$enable_database_connectivity" != yes; then
9210     AC_MSG_RESULT([none])
9211 else
9212     AC_MSG_RESULT([internal])
9213     SYSTEM_ODBC_HEADERS=
9215 AC_SUBST(SYSTEM_ODBC_HEADERS)
9218 dnl ===================================================================
9219 dnl Check for system openldap
9220 dnl ===================================================================
9222 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9223 AC_MSG_CHECKING([which openldap library to use])
9224 if test "$with_system_openldap" = "yes"; then
9225     AC_MSG_RESULT([external])
9226     SYSTEM_OPENLDAP=TRUE
9227     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9228     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9229     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9230 else
9231     AC_MSG_RESULT([internal])
9232     SYSTEM_OPENLDAP=
9233     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9236 AC_SUBST(SYSTEM_OPENLDAP)
9238 dnl ===================================================================
9239 dnl Check for system NSS
9240 dnl ===================================================================
9241 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9242     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9243     AC_DEFINE(HAVE_FEATURE_NSS)
9244     ENABLE_NSS="TRUE"
9245     AC_DEFINE(ENABLE_NSS)
9246 elif test $_os != iOS ; then
9247     with_tls=openssl
9249 AC_SUBST(ENABLE_NSS)
9251 dnl ===================================================================
9252 dnl Check for TLS/SSL and cryptographic implementation to use
9253 dnl ===================================================================
9254 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9255 if test -n "$with_tls"; then
9256     case $with_tls in
9257     openssl)
9258         AC_DEFINE(USE_TLS_OPENSSL)
9259         TLS=OPENSSL
9261         if test "$enable_openssl" != "yes"; then
9262             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9263         fi
9265         # warn that OpenSSL has been selected but not all TLS code has this option
9266         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9267         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9268         ;;
9269     nss)
9270         AC_DEFINE(USE_TLS_NSS)
9271         TLS=NSS
9272         ;;
9273     no)
9274         AC_MSG_WARN([Skipping TLS/SSL])
9275         ;;
9276     *)
9277         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9278 openssl - OpenSSL
9279 nss - Mozilla's Network Security Services (NSS)
9280     ])
9281         ;;
9282     esac
9283 else
9284     # default to using NSS, it results in smaller oox lib
9285     AC_DEFINE(USE_TLS_NSS)
9286     TLS=NSS
9288 AC_MSG_RESULT([$TLS])
9289 AC_SUBST(TLS)
9291 dnl ===================================================================
9292 dnl Check for system sane
9293 dnl ===================================================================
9294 AC_MSG_CHECKING([which sane header to use])
9295 if test "$with_system_sane" = "yes"; then
9296     AC_MSG_RESULT([external])
9297     AC_CHECK_HEADER(sane/sane.h, [],
9298       [AC_MSG_ERROR(sane not found. install sane)], [])
9299 else
9300     AC_MSG_RESULT([internal])
9301     BUILD_TYPE="$BUILD_TYPE SANE"
9304 dnl ===================================================================
9305 dnl Check for system icu
9306 dnl ===================================================================
9307 SYSTEM_GENBRK=
9308 SYSTEM_GENCCODE=
9309 SYSTEM_GENCMN=
9311 ICU_MAJOR=63
9312 ICU_MINOR=1
9313 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9314 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9315 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9316 AC_MSG_CHECKING([which icu to use])
9317 if test "$with_system_icu" = "yes"; then
9318     AC_MSG_RESULT([external])
9319     SYSTEM_ICU=TRUE
9320     AC_LANG_PUSH([C++])
9321     AC_MSG_CHECKING([for unicode/rbbi.h])
9322     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9323     AC_LANG_POP([C++])
9325     if test "$cross_compiling" != "yes"; then
9326         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9327         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9328         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9329         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9330     fi
9332     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9333         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9334         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9335         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9336         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9337         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9338             AC_MSG_RESULT([yes])
9339         else
9340             AC_MSG_RESULT([no])
9341             if test "$with_system_icu_for_build" != "force"; then
9342                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9343 You can use --with-system-icu-for-build=force to use it anyway.])
9344             fi
9345         fi
9346     fi
9348     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9349         # using the system icu tools can lead to version confusion, use the
9350         # ones from the build environment when cross-compiling
9351         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9352         if test -z "$SYSTEM_GENBRK"; then
9353             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9354         fi
9355         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9356         if test -z "$SYSTEM_GENCCODE"; then
9357             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9358         fi
9359         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9360         if test -z "$SYSTEM_GENCMN"; then
9361             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9362         fi
9363         if test "$ICU_MAJOR" -ge "49"; then
9364             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9365             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9366             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9367         else
9368             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9369             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9370             ICU_RECLASSIFIED_HEBREW_LETTER=
9371         fi
9372     fi
9374     if test "$cross_compiling" = "yes"; then
9375         if test "$ICU_MAJOR" -ge "50"; then
9376             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9377             ICU_MINOR=""
9378         fi
9379     fi
9380 else
9381     AC_MSG_RESULT([internal])
9382     SYSTEM_ICU=
9383     BUILD_TYPE="$BUILD_TYPE ICU"
9384     # surprisingly set these only for "internal" (to be used by various other
9385     # external libs): the system icu-config is quite unhelpful and spits out
9386     # dozens of weird flags and also default path -I/usr/include
9387     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9388     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9390 if test "$ICU_MAJOR" -ge "59"; then
9391     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9392     # with -std=c++11 but not all external libraries can be built with that,
9393     # for those use a bit-compatible typedef uint16_t UChar; see
9394     # icu/source/common/unicode/umachine.h
9395     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9396 else
9397     ICU_UCHAR_TYPE=""
9399 AC_SUBST(SYSTEM_ICU)
9400 AC_SUBST(SYSTEM_GENBRK)
9401 AC_SUBST(SYSTEM_GENCCODE)
9402 AC_SUBST(SYSTEM_GENCMN)
9403 AC_SUBST(ICU_MAJOR)
9404 AC_SUBST(ICU_MINOR)
9405 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9406 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9407 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9408 AC_SUBST(ICU_CFLAGS)
9409 AC_SUBST(ICU_LIBS)
9410 AC_SUBST(ICU_UCHAR_TYPE)
9412 dnl ==================================================================
9413 dnl Breakpad
9414 dnl ==================================================================
9415 AC_MSG_CHECKING([whether to enable breakpad])
9416 if test "$enable_breakpad" != yes; then
9417     AC_MSG_RESULT([no])
9418 else
9419     AC_MSG_RESULT([yes])
9420     ENABLE_BREAKPAD="TRUE"
9421     AC_DEFINE(ENABLE_BREAKPAD)
9422     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9423     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9425     AC_MSG_CHECKING([for crashreport config])
9426     if test "$with_symbol_config" = "no"; then
9427         BREAKPAD_SYMBOL_CONFIG="invalid"
9428         AC_MSG_RESULT([no])
9429     else
9430         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9431         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9432         AC_MSG_RESULT([yes])
9433     fi
9434     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9436 AC_SUBST(ENABLE_BREAKPAD)
9438 dnl ==================================================================
9439 dnl libfuzzer
9440 dnl ==================================================================
9441 AC_MSG_CHECKING([whether to enable fuzzers])
9442 if test "$enable_fuzzers" != yes; then
9443     AC_MSG_RESULT([no])
9444 else
9445     AC_MSG_RESULT([yes])
9446     ENABLE_FUZZERS="TRUE"
9447     AC_DEFINE([ENABLE_FUZZERS],1)
9448     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9450 AC_SUBST(ENABLE_FUZZERS)
9452 dnl ===================================================================
9453 dnl Orcus
9454 dnl ===================================================================
9455 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9456 if test "$with_system_orcus" != "yes"; then
9457     if test "$SYSTEM_BOOST" = "TRUE"; then
9458         # ===========================================================
9459         # Determine if we are going to need to link with Boost.System
9460         # ===========================================================
9461         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9462         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9463         dnl in documentation has no effect.
9464         AC_MSG_CHECKING([if we need to link with Boost.System])
9465         AC_LANG_PUSH([C++])
9466         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9467                 @%:@include <boost/version.hpp>
9468             ]],[[
9469                 #if BOOST_VERSION >= 105000
9470                 #   error yes, we need to link with Boost.System
9471                 #endif
9472             ]])],[
9473                 AC_MSG_RESULT([no])
9474             ],[
9475                 AC_MSG_RESULT([yes])
9476                 AX_BOOST_SYSTEM
9477         ])
9478         AC_LANG_POP([C++])
9479     fi
9481 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9482 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9483 AC_SUBST([BOOST_SYSTEM_LIB])
9484 AC_SUBST(SYSTEM_LIBORCUS)
9486 dnl ===================================================================
9487 dnl HarfBuzz
9488 dnl ===================================================================
9489 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9490                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9491                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9493 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9494                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9495                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9497 if test "$COM" = "MSC"; then # override the above
9498     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9499     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9502 if test "$with_system_harfbuzz" = "yes"; then
9503     if test "$with_system_graphite" = "no"; then
9504         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9505     fi
9506     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9507     _save_libs="$LIBS"
9508     _save_cflags="$CFLAGS"
9509     LIBS="$LIBS $HARFBUZZ_LIBS"
9510     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9511     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9512     LIBS="$_save_libs"
9513     CFLAGS="$_save_cflags"
9514 else
9515     if test "$with_system_graphite" = "yes"; then
9516         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9517     fi
9520 AC_MSG_CHECKING([whether to use X11])
9521 dnl ***************************************
9522 dnl testing for X libraries and includes...
9523 dnl ***************************************
9524 if test "$USING_X11" = TRUE; then
9525     AC_DEFINE(HAVE_FEATURE_X11)
9527 AC_MSG_RESULT([$USING_X11])
9529 if test "$USING_X11" = TRUE; then
9530     AC_PATH_X
9531     AC_PATH_XTRA
9532     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9534     if test -z "$x_includes"; then
9535         x_includes="default_x_includes"
9536     fi
9537     if test -z "$x_libraries"; then
9538         x_libraries="default_x_libraries"
9539     fi
9540     CFLAGS="$CFLAGS $X_CFLAGS"
9541     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9542     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9543 else
9544     x_includes="no_x_includes"
9545     x_libraries="no_x_libraries"
9548 if test "$USING_X11" = TRUE; then
9549     dnl ===================================================================
9550     dnl Check for extension headers
9551     dnl ===================================================================
9552     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9553      [#include <X11/extensions/shape.h>])
9555     # vcl needs ICE and SM
9556     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9557     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9558         [AC_MSG_ERROR(ICE library not found)])
9559     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9560     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9561         [AC_MSG_ERROR(SM library not found)])
9564 dnl ===================================================================
9565 dnl Check for system Xrender
9566 dnl ===================================================================
9567 AC_MSG_CHECKING([whether to use Xrender])
9568 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9569     AC_MSG_RESULT([yes])
9570     PKG_CHECK_MODULES(XRENDER, xrender)
9571     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9572     FilterLibs "${XRENDER_LIBS}"
9573     XRENDER_LIBS="${filteredlibs}"
9574     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9575       [AC_MSG_ERROR(libXrender not found or functional)], [])
9576     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9577       [AC_MSG_ERROR(Xrender not found. install X)], [])
9578 else
9579     AC_MSG_RESULT([no])
9581 AC_SUBST(XRENDER_CFLAGS)
9582 AC_SUBST(XRENDER_LIBS)
9584 dnl ===================================================================
9585 dnl Check for XRandr
9586 dnl ===================================================================
9587 AC_MSG_CHECKING([whether to enable RandR support])
9588 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9589     AC_MSG_RESULT([yes])
9590     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9591     if test "$ENABLE_RANDR" != "TRUE"; then
9592         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9593                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9594         XRANDR_CFLAGS=" "
9595         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9596           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9597         XRANDR_LIBS="-lXrandr "
9598         ENABLE_RANDR="TRUE"
9599     fi
9600     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9601     FilterLibs "${XRANDR_LIBS}"
9602     XRANDR_LIBS="${filteredlibs}"
9603 else
9604     ENABLE_RANDR=""
9605     AC_MSG_RESULT([no])
9607 AC_SUBST(XRANDR_CFLAGS)
9608 AC_SUBST(XRANDR_LIBS)
9609 AC_SUBST(ENABLE_RANDR)
9611 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9612     WITH_WEBDAV="serf"
9614 if test $_os = iOS -o $_os = Android; then
9615     WITH_WEBDAV="no"
9617 AC_MSG_CHECKING([for webdav library])
9618 case "$WITH_WEBDAV" in
9619 serf)
9620     AC_MSG_RESULT([serf])
9621     # Check for system apr-util
9622     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9623                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9624                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9625     if test "$COM" = "MSC"; then
9626         APR_LIB_DIR="LibR"
9627         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9628         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9629     fi
9631     # Check for system serf
9632     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9633                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9634     if test "$COM" = "MSC"; then
9635         SERF_LIB_DIR="Release"
9636         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9637         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9638     fi
9639     ;;
9640 neon)
9641     AC_MSG_RESULT([neon])
9642     # Check for system neon
9643     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9644     if test "$with_system_neon" = "yes"; then
9645         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9646     else
9647         NEON_VERSION=0295
9648     fi
9649     AC_SUBST(NEON_VERSION)
9650     ;;
9652     AC_MSG_RESULT([none, disabled])
9653     WITH_WEBDAV=""
9654     ;;
9655 esac
9656 AC_SUBST(WITH_WEBDAV)
9658 dnl ===================================================================
9659 dnl Check for disabling cve_tests
9660 dnl ===================================================================
9661 AC_MSG_CHECKING([whether to execute CVE tests])
9662 # If not explicitly enabled or disabled, default
9663 if test -z "$enable_cve_tests"; then
9664     case "$OS" in
9665     WNT)
9666         # Default cves off for windows with its wild and wonderful
9667         # varienty of AV software kicking in and panicking
9668         enable_cve_tests=no
9669         ;;
9670     *)
9671         # otherwise yes
9672         enable_cve_tests=yes
9673         ;;
9674     esac
9676 if test "$enable_cve_tests" = "no"; then
9677     AC_MSG_RESULT([no])
9678     DISABLE_CVE_TESTS=TRUE
9679     AC_SUBST(DISABLE_CVE_TESTS)
9680 else
9681     AC_MSG_RESULT([yes])
9684 dnl ===================================================================
9685 dnl Check for enabling chart XShape tests
9686 dnl ===================================================================
9687 AC_MSG_CHECKING([whether to execute chart XShape tests])
9688 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9689     AC_MSG_RESULT([yes])
9690     ENABLE_CHART_TESTS=TRUE
9691     AC_SUBST(ENABLE_CHART_TESTS)
9692 else
9693     AC_MSG_RESULT([no])
9696 dnl ===================================================================
9697 dnl Check for system openssl
9698 dnl ===================================================================
9699 DISABLE_OPENSSL=
9700 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9701 if test "$enable_openssl" = "yes"; then
9702     AC_MSG_RESULT([no])
9703     if test "$_os" = Darwin ; then
9704         # OpenSSL is deprecated when building for 10.7 or later.
9705         #
9706         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9707         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9709         with_system_openssl=no
9710         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9711     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9712             && test "$with_system_openssl" != "no"; then
9713         with_system_openssl=yes
9714         SYSTEM_OPENSSL=TRUE
9715         OPENSSL_CFLAGS=
9716         OPENSSL_LIBS="-lssl -lcrypto"
9717     else
9718         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9719     fi
9720     if test "$with_system_openssl" = "yes"; then
9721         AC_MSG_CHECKING([whether openssl supports SHA512])
9722         AC_LANG_PUSH([C])
9723         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9724             SHA512_CTX context;
9725 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9726         AC_LANG_POP(C)
9727     fi
9728 else
9729     AC_MSG_RESULT([yes])
9730     DISABLE_OPENSSL=TRUE
9732     # warn that although OpenSSL is disabled, system libraries may depend on it
9733     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9734     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9737 AC_SUBST([DISABLE_OPENSSL])
9739 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9740     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9741         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9742         enable_cipher_openssl_backend=no
9743     else
9744         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9745     fi
9747 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9748 ENABLE_CIPHER_OPENSSL_BACKEND=
9749 if test "$enable_cipher_openssl_backend" = yes; then
9750     AC_MSG_RESULT([yes])
9751     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9752 else
9753     AC_MSG_RESULT([no])
9755 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9757 dnl ===================================================================
9758 dnl Check for building gnutls
9759 dnl ===================================================================
9760 AC_MSG_CHECKING([whether to use gnutls])
9761 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9762     AC_MSG_RESULT([yes])
9763     AM_PATH_LIBGCRYPT()
9764     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9765         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9766                       available in the system to use as replacement.]]))
9767     FilterLibs "${LIBGCRYPT_LIBS}"
9768     LIBGCRYPT_LIBS="${filteredlibs}"
9769 else
9770     AC_MSG_RESULT([no])
9773 AC_SUBST([LIBGCRYPT_CFLAGS])
9774 AC_SUBST([LIBGCRYPT_LIBS])
9776 dnl ===================================================================
9777 dnl Check for system redland
9778 dnl ===================================================================
9779 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9780 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9781 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9782 if test "$with_system_redland" = "yes"; then
9783     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9784             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9785 else
9786     RAPTOR_MAJOR="0"
9787     RASQAL_MAJOR="3"
9788     REDLAND_MAJOR="0"
9790 AC_SUBST(RAPTOR_MAJOR)
9791 AC_SUBST(RASQAL_MAJOR)
9792 AC_SUBST(REDLAND_MAJOR)
9794 dnl ===================================================================
9795 dnl Check for system hunspell
9796 dnl ===================================================================
9797 AC_MSG_CHECKING([which libhunspell to use])
9798 if test "$with_system_hunspell" = "yes"; then
9799     AC_MSG_RESULT([external])
9800     SYSTEM_HUNSPELL=TRUE
9801     AC_LANG_PUSH([C++])
9802     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9803     if test "$HUNSPELL_PC" != "TRUE"; then
9804         AC_CHECK_HEADER(hunspell.hxx, [],
9805             [
9806             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9807             [AC_MSG_ERROR(hunspell headers not found.)], [])
9808             ], [])
9809         AC_CHECK_LIB([hunspell], [main], [:],
9810            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9811         HUNSPELL_LIBS=-lhunspell
9812     fi
9813     AC_LANG_POP([C++])
9814     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9815     FilterLibs "${HUNSPELL_LIBS}"
9816     HUNSPELL_LIBS="${filteredlibs}"
9817 else
9818     AC_MSG_RESULT([internal])
9819     SYSTEM_HUNSPELL=
9820     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9821     if test "$COM" = "MSC"; then
9822         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9823     else
9824         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9825     fi
9826     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9828 AC_SUBST(SYSTEM_HUNSPELL)
9829 AC_SUBST(HUNSPELL_CFLAGS)
9830 AC_SUBST(HUNSPELL_LIBS)
9832 dnl ===================================================================
9833 dnl Checking for altlinuxhyph
9834 dnl ===================================================================
9835 AC_MSG_CHECKING([which altlinuxhyph to use])
9836 if test "$with_system_altlinuxhyph" = "yes"; then
9837     AC_MSG_RESULT([external])
9838     SYSTEM_HYPH=TRUE
9839     AC_CHECK_HEADER(hyphen.h, [],
9840        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9841     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9842        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9843        [#include <hyphen.h>])
9844     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9845         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9846     if test -z "$HYPHEN_LIB"; then
9847         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9848            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9849     fi
9850     if test -z "$HYPHEN_LIB"; then
9851         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9852            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9853     fi
9854 else
9855     AC_MSG_RESULT([internal])
9856     SYSTEM_HYPH=
9857     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9858     if test "$COM" = "MSC"; then
9859         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9860     else
9861         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9862     fi
9864 AC_SUBST(SYSTEM_HYPH)
9865 AC_SUBST(HYPHEN_LIB)
9867 dnl ===================================================================
9868 dnl Checking for mythes
9869 dnl ===================================================================
9870 AC_MSG_CHECKING([which mythes to use])
9871 if test "$with_system_mythes" = "yes"; then
9872     AC_MSG_RESULT([external])
9873     SYSTEM_MYTHES=TRUE
9874     AC_LANG_PUSH([C++])
9875     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9876     if test "$MYTHES_PKGCONFIG" = "no"; then
9877         AC_CHECK_HEADER(mythes.hxx, [],
9878             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9879         AC_CHECK_LIB([mythes-1.2], [main], [:],
9880             [ MYTHES_FOUND=no], [])
9881     if test "$MYTHES_FOUND" = "no"; then
9882         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9883                 [ MYTHES_FOUND=no], [])
9884     fi
9885     if test "$MYTHES_FOUND" = "no"; then
9886         AC_MSG_ERROR([mythes library not found!.])
9887     fi
9888     fi
9889     AC_LANG_POP([C++])
9890     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9891     FilterLibs "${MYTHES_LIBS}"
9892     MYTHES_LIBS="${filteredlibs}"
9893 else
9894     AC_MSG_RESULT([internal])
9895     SYSTEM_MYTHES=
9896     BUILD_TYPE="$BUILD_TYPE MYTHES"
9897     if test "$COM" = "MSC"; then
9898         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9899     else
9900         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9901     fi
9903 AC_SUBST(SYSTEM_MYTHES)
9904 AC_SUBST(MYTHES_CFLAGS)
9905 AC_SUBST(MYTHES_LIBS)
9907 dnl ===================================================================
9908 dnl How should we build the linear programming solver ?
9909 dnl ===================================================================
9911 ENABLE_COINMP=
9912 AC_MSG_CHECKING([whether to build with CoinMP])
9913 if test "$enable_coinmp" != "no"; then
9914     ENABLE_COINMP=TRUE
9915     AC_MSG_RESULT([yes])
9916     if test "$with_system_coinmp" = "yes"; then
9917         SYSTEM_COINMP=TRUE
9918         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9919         FilterLibs "${COINMP_LIBS}"
9920         COINMP_LIBS="${filteredlibs}"
9921     else
9922         BUILD_TYPE="$BUILD_TYPE COINMP"
9923     fi
9924 else
9925     AC_MSG_RESULT([no])
9927 AC_SUBST(ENABLE_COINMP)
9928 AC_SUBST(SYSTEM_COINMP)
9929 AC_SUBST(COINMP_CFLAGS)
9930 AC_SUBST(COINMP_LIBS)
9932 ENABLE_LPSOLVE=
9933 AC_MSG_CHECKING([whether to build with lpsolve])
9934 if test "$enable_lpsolve" != "no"; then
9935     ENABLE_LPSOLVE=TRUE
9936     AC_MSG_RESULT([yes])
9937 else
9938     AC_MSG_RESULT([no])
9940 AC_SUBST(ENABLE_LPSOLVE)
9942 if test "$ENABLE_LPSOLVE" = TRUE; then
9943     AC_MSG_CHECKING([which lpsolve to use])
9944     if test "$with_system_lpsolve" = "yes"; then
9945         AC_MSG_RESULT([external])
9946         SYSTEM_LPSOLVE=TRUE
9947         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9948            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9949         save_LIBS=$LIBS
9950         # some systems need this. Like Ubuntu....
9951         AC_CHECK_LIB(m, floor)
9952         AC_CHECK_LIB(dl, dlopen)
9953         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9954             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9955         LIBS=$save_LIBS
9956     else
9957         AC_MSG_RESULT([internal])
9958         SYSTEM_LPSOLVE=
9959         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9960     fi
9962 AC_SUBST(SYSTEM_LPSOLVE)
9964 dnl ===================================================================
9965 dnl Checking for libexttextcat
9966 dnl ===================================================================
9967 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9968 if test "$with_system_libexttextcat" = "yes"; then
9969     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9971 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9973 dnl ===================================================================
9974 dnl Checking for libnumbertext
9975 dnl ===================================================================
9976 AC_MSG_CHECKING([whether to use libnumbertext])
9977 if test "$enable_libnumbertext" = "no"; then
9978     AC_MSG_RESULT([no])
9979     ENABLE_LIBNUMBERTEXT=
9980     SYSTEM_LIBNUMBERTEXT=
9981 else
9982     AC_MSG_RESULT([yes])
9983     ENABLE_LIBNUMBERTEXT=TRUE
9984     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9985     if test "$with_system_libnumbertext" = "yes"; then
9986         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9987         SYSTEM_LIBNUMBERTEXT=YES
9988     else
9989         SYSTEM_LIBNUMBERTEXT=
9990         AC_LANG_PUSH([C++])
9991         save_CPPFLAGS=$CPPFLAGS
9992         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9993         AC_CHECK_HEADERS([codecvt regex])
9994         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9995                 [ ENABLE_LIBNUMBERTEXT=''
9996                   LIBNUMBERTEXT_CFLAGS=''
9997                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9998                                Enable libnumbertext fallback (missing number to number name conversion).])
9999                 ])
10000         CPPFLAGS=$save_CPPFLAGS
10001         AC_LANG_POP([C++])
10002     fi
10003     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10004         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10005     fi
10007 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10008 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10009 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10010 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10012 dnl ***************************************
10013 dnl testing libc version for Linux...
10014 dnl ***************************************
10015 if test "$_os" = "Linux"; then
10016     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10017     exec 6>/dev/null # no output
10018     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10019     exec 6>&1 # output on again
10020     if test "$HAVE_LIBC"; then
10021         AC_MSG_RESULT([yes])
10022     else
10023         AC_MSG_ERROR([no, upgrade libc])
10024     fi
10027 dnl =========================================
10028 dnl Check for uuidgen
10029 dnl =========================================
10030 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10031     # presence is already tested above in the WINDOWS_SDK_HOME check
10032     UUIDGEN=uuidgen.exe
10033     AC_SUBST(UUIDGEN)
10034 else
10035     AC_PATH_PROG([UUIDGEN], [uuidgen])
10036     if test -z "$UUIDGEN"; then
10037         AC_MSG_WARN([uuid is needed for building installation sets])
10038     fi
10041 dnl ***************************************
10042 dnl Checking for bison and flex
10043 dnl ***************************************
10044 AC_PATH_PROG(BISON, bison)
10045 if test -z "$BISON"; then
10046     AC_MSG_ERROR([no bison found in \$PATH, install it])
10047 else
10048     AC_MSG_CHECKING([the bison version])
10049     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10050     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10051     # Accept newer than 2.0
10052     if test "$_bison_longver" -lt 2000; then
10053         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10054     fi
10057 AC_PATH_PROG(FLEX, flex)
10058 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10059     FLEX=`cygpath -m $FLEX`
10061 if test -z "$FLEX"; then
10062     AC_MSG_ERROR([no flex found in \$PATH, install it])
10063 else
10064     AC_MSG_CHECKING([the flex version])
10065     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10066     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10067         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10068     fi
10070 AC_SUBST([FLEX])
10071 dnl ***************************************
10072 dnl Checking for patch
10073 dnl ***************************************
10074 AC_PATH_PROG(PATCH, patch)
10075 if test -z "$PATCH"; then
10076     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10079 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10080 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10081     if test -z "$with_gnu_patch"; then
10082         GNUPATCH=$PATCH
10083     else
10084         if test -x "$with_gnu_patch"; then
10085             GNUPATCH=$with_gnu_patch
10086         else
10087             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10088         fi
10089     fi
10091     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10092     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10093         AC_MSG_RESULT([yes])
10094     else
10095         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10096     fi
10097 else
10098     GNUPATCH=$PATCH
10101 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10102     GNUPATCH=`cygpath -m $GNUPATCH`
10105 dnl We also need to check for --with-gnu-cp
10107 if test -z "$with_gnu_cp"; then
10108     # check the place where the good stuff is hidden on Solaris...
10109     if test -x /usr/gnu/bin/cp; then
10110         GNUCP=/usr/gnu/bin/cp
10111     else
10112         AC_PATH_PROGS(GNUCP, gnucp cp)
10113     fi
10114     if test -z $GNUCP; then
10115         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10116     fi
10117 else
10118     if test -x "$with_gnu_cp"; then
10119         GNUCP=$with_gnu_cp
10120     else
10121         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10122     fi
10125 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10126     GNUCP=`cygpath -m $GNUCP`
10129 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10130 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10131     AC_MSG_RESULT([yes])
10132 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10133     AC_MSG_RESULT([yes])
10134 else
10135     case "$build_os" in
10136     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10137         x_GNUCP=[\#]
10138         GNUCP=''
10139         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10140         ;;
10141     *)
10142         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10143         ;;
10144     esac
10147 AC_SUBST(GNUPATCH)
10148 AC_SUBST(GNUCP)
10149 AC_SUBST(x_GNUCP)
10151 dnl ***************************************
10152 dnl testing assembler path
10153 dnl ***************************************
10154 ML_EXE=""
10155 if test "$_os" = "WINNT"; then
10156     if test "$BITNESS_OVERRIDE" = ""; then
10157         assembler=ml.exe
10158         assembler_bin=$CL_DIR
10159     else
10160         assembler=ml64.exe
10161         assembler_bin=$CL_DIR
10162     fi
10164     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10165     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10166         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10167         AC_MSG_RESULT([found])
10168         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10169     else
10170         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10171     fi
10173     PathFormat "$ASM_HOME"
10174     ASM_HOME="$formatted_path"
10175 else
10176     ASM_HOME=""
10179 AC_SUBST(ML_EXE)
10181 dnl ===================================================================
10182 dnl We need zip and unzip
10183 dnl ===================================================================
10184 AC_PATH_PROG(ZIP, zip)
10185 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10186 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10187     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],,)
10190 AC_PATH_PROG(UNZIP, unzip)
10191 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10193 dnl ===================================================================
10194 dnl Zip must be a specific type for different build types.
10195 dnl ===================================================================
10196 if test $build_os = cygwin; then
10197     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10198         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10199     fi
10202 dnl ===================================================================
10203 dnl We need touch with -h option support.
10204 dnl ===================================================================
10205 AC_PATH_PROG(TOUCH, touch)
10206 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10207 touch warn
10208 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10209     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],,)
10212 dnl ===================================================================
10213 dnl Check for system epoxy
10214 dnl ===================================================================
10215 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10217 dnl ===================================================================
10218 dnl Set vcl option: coordinate device in double or sal_Int32
10219 dnl ===================================================================
10221 dnl disabled for now, we don't want subtle differences between OSs
10222 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10223 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10224 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10225 dnl     AC_MSG_RESULT([double])
10226 dnl else
10227 dnl     AC_MSG_RESULT([sal_Int32])
10228 dnl fi
10230 dnl ===================================================================
10231 dnl Test which vclplugs have to be built.
10232 dnl ===================================================================
10233 R=""
10234 if test "$USING_X11" != TRUE; then
10235     enable_gtk=no
10236     enable_gtk3=no
10238 GTK3_CFLAGS=""
10239 GTK3_LIBS=""
10240 ENABLE_GTK3=""
10241 if test "x$enable_gtk3" = "xyes"; then
10242     if test "$with_system_cairo" = no; then
10243         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10244     fi
10245     : ${with_system_cairo:=yes}
10246     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="")
10247     if test "x$ENABLE_GTK3" = "xTRUE"; then
10248         R="gtk3"
10249         dnl Avoid installed by unpackaged files for now.
10250         if test -z "$PKGFORMAT"; then
10251             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10252         fi
10253     else
10254         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10255     fi
10256     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10257     FilterLibs "${GTK3_LIBS}"
10258     GTK3_LIBS="${filteredlibs}"
10260     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10261     if test "$with_system_epoxy" != "yes"; then
10262         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10263         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10264                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10265     fi
10267 AC_SUBST(GTK3_LIBS)
10268 AC_SUBST(GTK3_CFLAGS)
10269 AC_SUBST(ENABLE_GTK3)
10271 ENABLE_GTK=""
10272 if test "x$enable_gtk" = "xyes"; then
10273     if test "$with_system_cairo" = no; then
10274         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10275     fi
10276     : ${with_system_cairo:=yes}
10277     ENABLE_GTK="TRUE"
10278     AC_DEFINE(ENABLE_GTK)
10279     R="gtk $R"
10281 AC_SUBST(ENABLE_GTK)
10283 ENABLE_QT5=""
10284 if test "x$enable_qt5" = "xyes"; then
10285     ENABLE_QT5="TRUE"
10286     AC_DEFINE(ENABLE_QT5)
10287     R="$R qt5"
10289 AC_SUBST(ENABLE_QT5)
10291 ENABLE_KDE5=""
10292 if test "x$enable_kde5" = "xyes"; then
10293     ENABLE_KDE5="TRUE"
10294     AC_DEFINE(ENABLE_KDE5)
10295     R="$R kde5"
10297 AC_SUBST(ENABLE_KDE5)
10299 ENABLE_GTK3_KDE5=""
10300 if test "x$enable_gtk3_kde5" = "xyes"; then
10301     ENABLE_GTK3_KDE5="TRUE"
10302     AC_DEFINE(ENABLE_GTK3_KDE5)
10303     R="$R gtk3_kde5"
10305 AC_SUBST(ENABLE_GTK3_KDE5)
10307 build_vcl_plugins="$R"
10308 if test -z "$build_vcl_plugins"; then
10309     build_vcl_plugins="none"
10311 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10313 dnl ===================================================================
10314 dnl check for dbus support
10315 dnl ===================================================================
10316 ENABLE_DBUS=""
10317 DBUS_CFLAGS=""
10318 DBUS_LIBS=""
10319 DBUS_GLIB_CFLAGS=""
10320 DBUS_GLIB_LIBS=""
10321 DBUS_HAVE_GLIB=""
10323 if test "$enable_dbus" = "no"; then
10324     test_dbus=no
10327 AC_MSG_CHECKING([whether to enable DBUS support])
10328 if test "$test_dbus" = "yes"; then
10329     ENABLE_DBUS="TRUE"
10330     AC_MSG_RESULT([yes])
10331     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10332     AC_DEFINE(ENABLE_DBUS)
10333     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10334     FilterLibs "${DBUS_LIBS}"
10335     DBUS_LIBS="${filteredlibs}"
10337     # Glib is needed for BluetoothServer
10338     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10339     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10340         [
10341             DBUS_HAVE_GLIB="TRUE"
10342             AC_DEFINE(DBUS_HAVE_GLIB,1)
10343         ],
10344         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10345     )
10346 else
10347     AC_MSG_RESULT([no])
10350 AC_SUBST(ENABLE_DBUS)
10351 AC_SUBST(DBUS_CFLAGS)
10352 AC_SUBST(DBUS_LIBS)
10353 AC_SUBST(DBUS_GLIB_CFLAGS)
10354 AC_SUBST(DBUS_GLIB_LIBS)
10355 AC_SUBST(DBUS_HAVE_GLIB)
10357 AC_MSG_CHECKING([whether to enable Impress remote control])
10358 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10359     AC_MSG_RESULT([yes])
10360     ENABLE_SDREMOTE=TRUE
10361     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10363     # If not explicitly enabled or disabled, default
10364     if test -z "$enable_sdremote_bluetooth"; then
10365         case "$OS" in
10366         LINUX|MACOSX|WNT)
10367             # Default to yes for these
10368             enable_sdremote_bluetooth=yes
10369             ;;
10370         *)
10371             # otherwise no
10372             enable_sdremote_bluetooth=no
10373             ;;
10374         esac
10375     fi
10376     # $enable_sdremote_bluetooth is guaranteed non-empty now
10378     if test "$enable_sdremote_bluetooth" != "no"; then
10379         if test "$OS" = "LINUX"; then
10380             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10381                 AC_MSG_RESULT([yes])
10382                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10383                 dnl ===================================================================
10384                 dnl Check for system bluez
10385                 dnl ===================================================================
10386                 AC_MSG_CHECKING([which Bluetooth header to use])
10387                 if test "$with_system_bluez" = "yes"; then
10388                     AC_MSG_RESULT([external])
10389                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10390                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10391                     SYSTEM_BLUEZ=TRUE
10392                 else
10393                     AC_MSG_RESULT([internal])
10394                     SYSTEM_BLUEZ=
10395                 fi
10396             else
10397                 AC_MSG_RESULT([no, dbus disabled])
10398                 ENABLE_SDREMOTE_BLUETOOTH=
10399                 SYSTEM_BLUEZ=
10400             fi
10401         else
10402             AC_MSG_RESULT([yes])
10403             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10404             SYSTEM_BLUEZ=
10405         fi
10406     else
10407         AC_MSG_RESULT([no])
10408         ENABLE_SDREMOTE_BLUETOOTH=
10409         SYSTEM_BLUEZ=
10410     fi
10411 else
10412     ENABLE_SDREMOTE=
10413     SYSTEM_BLUEZ=
10414     AC_MSG_RESULT([no])
10416 AC_SUBST(ENABLE_SDREMOTE)
10417 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10418 AC_SUBST(SYSTEM_BLUEZ)
10420 dnl ===================================================================
10421 dnl Check whether the gtk 2.0 libraries are available.
10422 dnl ===================================================================
10424 GTK_CFLAGS=""
10425 GTK_LIBS=""
10426 if test  "$test_gtk" = "yes"; then
10428     if test "$ENABLE_GTK" = "TRUE"; then
10429         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]))
10430         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10431         FilterLibs "${GTK_LIBS}"
10432         GTK_LIBS="${filteredlibs}"
10433         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]))
10434         BUILD_TYPE="$BUILD_TYPE GTK"
10435         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10436         FilterLibs "${GTHREAD_LIBS}"
10437         GTHREAD_LIBS="${filteredlibs}"
10439         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10440         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10441                           [ENABLE_GTK_PRINT="TRUE"],
10442                           [ENABLE_GTK_PRINT=""])
10443         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10444         FilterLibs "${GTK_PRINT_LIBS}"
10445         GTK_PRINT_LIBS="${filteredlibs}"
10446     fi
10448     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10449         AC_MSG_CHECKING([whether to enable GIO support])
10450         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10451             dnl Need at least 2.26 for the dbus support.
10452             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10453                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10454             if test "$ENABLE_GIO" = "TRUE"; then
10455                 AC_DEFINE(ENABLE_GIO)
10456                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10457                 FilterLibs "${GIO_LIBS}"
10458                 GIO_LIBS="${filteredlibs}"
10459             fi
10460         else
10461             AC_MSG_RESULT([no])
10462         fi
10463     fi
10465 AC_SUBST(ENABLE_GIO)
10466 AC_SUBST(GIO_CFLAGS)
10467 AC_SUBST(GIO_LIBS)
10468 AC_SUBST(GTK_CFLAGS)
10469 AC_SUBST(GTK_LIBS)
10470 AC_SUBST(GTHREAD_CFLAGS)
10471 AC_SUBST(GTHREAD_LIBS)
10472 AC_SUBST([ENABLE_GTK_PRINT])
10473 AC_SUBST([GTK_PRINT_CFLAGS])
10474 AC_SUBST([GTK_PRINT_LIBS])
10477 dnl ===================================================================
10479 SPLIT_APP_MODULES=""
10480 if test "$enable_split_app_modules" = "yes"; then
10481     SPLIT_APP_MODULES="TRUE"
10483 AC_SUBST(SPLIT_APP_MODULES)
10485 SPLIT_OPT_FEATURES=""
10486 if test "$enable_split_opt_features" = "yes"; then
10487     SPLIT_OPT_FEATURES="TRUE"
10489 AC_SUBST(SPLIT_OPT_FEATURES)
10491 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10492     if test "$enable_cairo_canvas" = yes; then
10493         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10494     fi
10495     enable_cairo_canvas=no
10496 elif test -z "$enable_cairo_canvas"; then
10497     enable_cairo_canvas=yes
10500 ENABLE_CAIRO_CANVAS=""
10501 if test "$enable_cairo_canvas" = "yes"; then
10502     test_cairo=yes
10503     ENABLE_CAIRO_CANVAS="TRUE"
10504     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10506 AC_SUBST(ENABLE_CAIRO_CANVAS)
10508 dnl ===================================================================
10509 dnl Check whether the GStreamer libraries are available.
10510 dnl It's possible to build avmedia with both GStreamer backends!
10511 dnl ===================================================================
10513 ENABLE_GSTREAMER_1_0=""
10515 if test "$build_gstreamer_1_0" = "yes"; then
10517     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10518     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10519         ENABLE_GSTREAMER_1_0="TRUE"
10520         AC_MSG_RESULT([yes])
10521         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10522         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10523         FilterLibs "${GSTREAMER_1_0_LIBS}"
10524         GSTREAMER_1_0_LIBS="${filteredlibs}"
10525     else
10526         AC_MSG_RESULT([no])
10527     fi
10529 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10530 AC_SUBST(GSTREAMER_1_0_LIBS)
10531 AC_SUBST(ENABLE_GSTREAMER_1_0)
10534 ENABLE_GSTREAMER_0_10=""
10535 if test "$build_gstreamer_0_10" = "yes"; then
10537     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10538     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10539         ENABLE_GSTREAMER_0_10="TRUE"
10540         AC_MSG_RESULT([yes])
10541         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10542             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10543         ])
10544         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10545         FilterLibs "${GSTREAMER_0_10_LIBS}"
10546         GSTREAMER_0_10_LIBS="${filteredlibs}"
10547     else
10548         AC_MSG_RESULT([no])
10549     fi
10552 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10553 AC_SUBST(GSTREAMER_0_10_LIBS)
10554 AC_SUBST(ENABLE_GSTREAMER_0_10)
10556 dnl ===================================================================
10557 dnl Check whether to build the VLC avmedia backend
10558 dnl ===================================================================
10560 ENABLE_VLC=""
10562 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10563 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10564     ENABLE_VLC="TRUE"
10565     AC_MSG_RESULT([yes])
10566 else
10567     AC_MSG_RESULT([no])
10569 AC_SUBST(ENABLE_VLC)
10571 ENABLE_OPENGL_TRANSITIONS=
10572 ENABLE_OPENGL_CANVAS=
10573 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10574    : # disable
10575 elif test "$_os" = "Darwin"; then
10576     # We use frameworks on macOS, no need for detail checks
10577     ENABLE_OPENGL_TRANSITIONS=TRUE
10578     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10579     ENABLE_OPENGL_CANVAS=TRUE
10580 elif test $_os = WINNT; then
10581     ENABLE_OPENGL_TRANSITIONS=TRUE
10582     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10583     ENABLE_OPENGL_CANVAS=TRUE
10584 else
10585     if test "$USING_X11" = TRUE; then
10586         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10587         ENABLE_OPENGL_TRANSITIONS=TRUE
10588         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10589         ENABLE_OPENGL_CANVAS=TRUE
10590     fi
10593 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10594 AC_SUBST(ENABLE_OPENGL_CANVAS)
10596 dnl =================================================
10597 dnl Check whether to build with OpenCL support.
10598 dnl =================================================
10600 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10601     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10602     # platform (optional at run-time, used through clew).
10603     BUILD_TYPE="$BUILD_TYPE OPENCL"
10604     AC_DEFINE(HAVE_FEATURE_OPENCL)
10607 dnl =================================================
10608 dnl Check whether to build with dconf support.
10609 dnl =================================================
10611 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10612     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10613         if test "$enable_dconf" = yes; then
10614             AC_MSG_ERROR([dconf not found])
10615         else
10616             enable_dconf=no
10617         fi])
10619 AC_MSG_CHECKING([whether to enable dconf])
10620 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10621     DCONF_CFLAGS=
10622     DCONF_LIBS=
10623     ENABLE_DCONF=
10624     AC_MSG_RESULT([no])
10625 else
10626     ENABLE_DCONF=TRUE
10627     AC_DEFINE(ENABLE_DCONF)
10628     AC_MSG_RESULT([yes])
10630 AC_SUBST([DCONF_CFLAGS])
10631 AC_SUBST([DCONF_LIBS])
10632 AC_SUBST([ENABLE_DCONF])
10634 # pdf import?
10635 AC_MSG_CHECKING([whether to build the PDF import feature])
10636 ENABLE_PDFIMPORT=
10637 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10638     AC_MSG_RESULT([yes])
10639     ENABLE_PDFIMPORT=TRUE
10640     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10642     dnl ===================================================================
10643     dnl Check for system poppler
10644     dnl ===================================================================
10645     AC_MSG_CHECKING([which PDF import backend to use])
10646     if test "$with_system_poppler" = "yes"; then
10647         AC_MSG_RESULT([external])
10648         SYSTEM_POPPLER=TRUE
10649         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10650         AC_LANG_PUSH([C++])
10651         save_CXXFLAGS=$CXXFLAGS
10652         save_CPPFLAGS=$CPPFLAGS
10653         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10654         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10655         AC_CHECK_HEADER([cpp/poppler-version.h],
10656             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10657             [])
10658         CXXFLAGS=$save_CXXFLAGS
10659         CPPFLAGS=$save_CPPFLAGS
10660         AC_LANG_POP([C++])
10661         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10663         FilterLibs "${POPPLER_LIBS}"
10664         POPPLER_LIBS="${filteredlibs}"
10665     else
10666         AC_MSG_RESULT([internal])
10667         SYSTEM_POPPLER=
10668         BUILD_TYPE="$BUILD_TYPE POPPLER"
10669         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10670     fi
10671     AC_DEFINE([ENABLE_PDFIMPORT],1)
10672 else
10673     AC_MSG_RESULT([no])
10675 AC_SUBST(ENABLE_PDFIMPORT)
10676 AC_SUBST(SYSTEM_POPPLER)
10677 AC_SUBST(POPPLER_CFLAGS)
10678 AC_SUBST(POPPLER_LIBS)
10680 # pdf import?
10681 AC_MSG_CHECKING([whether to build PDFium])
10682 ENABLE_PDFIUM=
10683 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10684     AC_MSG_RESULT([yes])
10685     ENABLE_PDFIUM=TRUE
10686     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10687     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10688 else
10689     AC_MSG_RESULT([no])
10691 AC_SUBST(ENABLE_PDFIUM)
10693 SYSTEM_GPGMEPP=
10695 if test "$build_for_ios" = "YES"; then
10696     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10697     AC_MSG_RESULT([yes])
10698 elif test "$enable_mpl_subset" = "yes"; then
10699     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10700     AC_MSG_RESULT([yes])
10701 elif test "$enable_fuzzers" = "yes"; then
10702     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10703     AC_MSG_RESULT([yes])
10704 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10705     dnl ===================================================================
10706     dnl Check for system gpgme
10707     dnl ===================================================================
10708     AC_MSG_CHECKING([which gpgmepp to use])
10709     if test "$with_system_gpgmepp" = "yes"; then
10710         AC_MSG_RESULT([external])
10711         SYSTEM_GPGMEPP=TRUE
10713         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10714         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10715             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10716         # progress_callback is the only func with plain C linkage
10717         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10718         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10719             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10720         AC_CHECK_HEADER(gpgme.h, [],
10721             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10722     else
10723         AC_MSG_RESULT([internal])
10724         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10725         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10727         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10728         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10729         if test "$_os" != "WINNT"; then
10730             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10731             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10732         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10733             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10734         fi
10735     fi
10736     ENABLE_GPGMEPP=TRUE
10737     AC_DEFINE([HAVE_FEATURE_GPGME])
10738     AC_PATH_PROG(GPG, gpg)
10739     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10740     # so let's exclude that manually for the moment
10741     if test -n "$GPG" -a "$_os" != "WINNT"; then
10742         # make sure we not only have a working gpgme, but a full working
10743         # gpg installation to run OpenPGP signature verification
10744         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10745     fi
10746     if test "$_os" = "Linux"; then
10747       uid=`id -u`
10748       AC_MSG_CHECKING([for /run/user/$uid])
10749       if test -d /run/user/$uid; then
10750         AC_MSG_RESULT([yes])
10751         AC_PATH_PROG(GPGCONF, gpgconf)
10753         # Older versions of gpgconf are not working as expected, since
10754         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10755         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10756         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10757         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10758         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10759         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10760         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10761           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10762           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10763           if $GPGCONF --dump-options > /dev/null ; then
10764             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10765               AC_MSG_RESULT([yes])
10766               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10767               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10768             else
10769               AC_MSG_RESULT([no])
10770             fi
10771           else
10772             AC_MSG_RESULT([no. missing or broken gpgconf?])
10773           fi
10774         else
10775           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10776         fi
10777       else
10778         AC_MSG_RESULT([no])
10779      fi
10780    fi
10782 AC_SUBST(ENABLE_GPGMEPP)
10783 AC_SUBST(SYSTEM_GPGMEPP)
10784 AC_SUBST(GPG_ERROR_CFLAGS)
10785 AC_SUBST(GPG_ERROR_LIBS)
10786 AC_SUBST(LIBASSUAN_CFLAGS)
10787 AC_SUBST(LIBASSUAN_LIBS)
10788 AC_SUBST(GPGMEPP_CFLAGS)
10789 AC_SUBST(GPGMEPP_LIBS)
10791 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10792 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10793     AC_MSG_RESULT([yes])
10794     ENABLE_MEDIAWIKI=TRUE
10795     BUILD_TYPE="$BUILD_TYPE XSLTML"
10796     if test  "x$with_java" = "xno"; then
10797         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10798     fi
10799 else
10800     AC_MSG_RESULT([no])
10801     ENABLE_MEDIAWIKI=
10802     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10804 AC_SUBST(ENABLE_MEDIAWIKI)
10806 AC_MSG_CHECKING([whether to build the Report Builder])
10807 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10808     AC_MSG_RESULT([yes])
10809     ENABLE_REPORTBUILDER=TRUE
10810     AC_MSG_CHECKING([which jfreereport libs to use])
10811     if test "$with_system_jfreereport" = "yes"; then
10812         SYSTEM_JFREEREPORT=TRUE
10813         AC_MSG_RESULT([external])
10814         if test -z $SAC_JAR; then
10815             SAC_JAR=/usr/share/java/sac.jar
10816         fi
10817         if ! test -f $SAC_JAR; then
10818              AC_MSG_ERROR(sac.jar not found.)
10819         fi
10821         if test -z $LIBXML_JAR; then
10822             if test -f /usr/share/java/libxml-1.0.0.jar; then
10823                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10824             elif test -f /usr/share/java/libxml.jar; then
10825                 LIBXML_JAR=/usr/share/java/libxml.jar
10826             else
10827                 AC_MSG_ERROR(libxml.jar replacement not found.)
10828             fi
10829         elif ! test -f $LIBXML_JAR; then
10830             AC_MSG_ERROR(libxml.jar not found.)
10831         fi
10833         if test -z $FLUTE_JAR; then
10834             if test -f/usr/share/java/flute-1.3.0.jar; then
10835                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10836             elif test -f /usr/share/java/flute.jar; then
10837                 FLUTE_JAR=/usr/share/java/flute.jar
10838             else
10839                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10840             fi
10841         elif ! test -f $FLUTE_JAR; then
10842             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10843         fi
10845         if test -z $JFREEREPORT_JAR; then
10846             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10847                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10848             elif test -f /usr/share/java/flow-engine.jar; then
10849                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10850             else
10851                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10852             fi
10853         elif ! test -f  $JFREEREPORT_JAR; then
10854                 AC_MSG_ERROR(jfreereport.jar not found.)
10855         fi
10857         if test -z $LIBLAYOUT_JAR; then
10858             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10859                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10860             elif test -f /usr/share/java/liblayout.jar; then
10861                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10862             else
10863                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10864             fi
10865         elif ! test -f $LIBLAYOUT_JAR; then
10866                 AC_MSG_ERROR(liblayout.jar not found.)
10867         fi
10869         if test -z $LIBLOADER_JAR; then
10870             if test -f /usr/share/java/libloader-1.0.0.jar; then
10871                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10872             elif test -f /usr/share/java/libloader.jar; then
10873                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10874             else
10875                 AC_MSG_ERROR(libloader.jar replacement not found.)
10876             fi
10877         elif ! test -f  $LIBLOADER_JAR; then
10878             AC_MSG_ERROR(libloader.jar not found.)
10879         fi
10881         if test -z $LIBFORMULA_JAR; then
10882             if test -f /usr/share/java/libformula-0.2.0.jar; then
10883                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10884             elif test -f /usr/share/java/libformula.jar; then
10885                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10886             else
10887                 AC_MSG_ERROR(libformula.jar replacement not found.)
10888             fi
10889         elif ! test -f $LIBFORMULA_JAR; then
10890                 AC_MSG_ERROR(libformula.jar not found.)
10891         fi
10893         if test -z $LIBREPOSITORY_JAR; then
10894             if test -f /usr/share/java/librepository-1.0.0.jar; then
10895                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10896             elif test -f /usr/share/java/librepository.jar; then
10897                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10898             else
10899                 AC_MSG_ERROR(librepository.jar replacement not found.)
10900             fi
10901         elif ! test -f $LIBREPOSITORY_JAR; then
10902             AC_MSG_ERROR(librepository.jar not found.)
10903         fi
10905         if test -z $LIBFONTS_JAR; then
10906             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10907                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10908             elif test -f /usr/share/java/libfonts.jar; then
10909                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10910             else
10911                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10912             fi
10913         elif ! test -f $LIBFONTS_JAR; then
10914                 AC_MSG_ERROR(libfonts.jar not found.)
10915         fi
10917         if test -z $LIBSERIALIZER_JAR; then
10918             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10919                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10920             elif test -f /usr/share/java/libserializer.jar; then
10921                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10922             else
10923                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10924             fi
10925         elif ! test -f $LIBSERIALIZER_JAR; then
10926                 AC_MSG_ERROR(libserializer.jar not found.)
10927         fi
10929         if test -z $LIBBASE_JAR; then
10930             if test -f /usr/share/java/libbase-1.0.0.jar; then
10931                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10932             elif test -f /usr/share/java/libbase.jar; then
10933                 LIBBASE_JAR=/usr/share/java/libbase.jar
10934             else
10935                 AC_MSG_ERROR(libbase.jar replacement not found.)
10936             fi
10937         elif ! test -f $LIBBASE_JAR; then
10938             AC_MSG_ERROR(libbase.jar not found.)
10939         fi
10941     else
10942         AC_MSG_RESULT([internal])
10943         SYSTEM_JFREEREPORT=
10944         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10945         NEED_ANT=TRUE
10946     fi
10947 else
10948     AC_MSG_RESULT([no])
10949     ENABLE_REPORTBUILDER=
10950     SYSTEM_JFREEREPORT=
10952 AC_SUBST(ENABLE_REPORTBUILDER)
10953 AC_SUBST(SYSTEM_JFREEREPORT)
10954 AC_SUBST(SAC_JAR)
10955 AC_SUBST(LIBXML_JAR)
10956 AC_SUBST(FLUTE_JAR)
10957 AC_SUBST(JFREEREPORT_JAR)
10958 AC_SUBST(LIBBASE_JAR)
10959 AC_SUBST(LIBLAYOUT_JAR)
10960 AC_SUBST(LIBLOADER_JAR)
10961 AC_SUBST(LIBFORMULA_JAR)
10962 AC_SUBST(LIBREPOSITORY_JAR)
10963 AC_SUBST(LIBFONTS_JAR)
10964 AC_SUBST(LIBSERIALIZER_JAR)
10966 # this has to be here because both the Wiki Publisher and the SRB use
10967 # commons-logging
10968 COMMONS_LOGGING_VERSION=1.2
10969 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10970     AC_MSG_CHECKING([which Apache commons-* libs to use])
10971     if test "$with_system_apache_commons" = "yes"; then
10972         SYSTEM_APACHE_COMMONS=TRUE
10973         AC_MSG_RESULT([external])
10974         if test -z $COMMONS_LOGGING_JAR; then
10975             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10976                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10977            elif test -f /usr/share/java/commons-logging.jar; then
10978                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10979             else
10980                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10981             fi
10982         elif ! test -f $COMMONS_LOGGING_JAR; then
10983             AC_MSG_ERROR(commons-logging.jar not found.)
10984         fi
10985     else
10986         AC_MSG_RESULT([internal])
10987         SYSTEM_APACHE_COMMONS=
10988         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10989         NEED_ANT=TRUE
10990     fi
10992 AC_SUBST(SYSTEM_APACHE_COMMONS)
10993 AC_SUBST(COMMONS_LOGGING_JAR)
10994 AC_SUBST(COMMONS_LOGGING_VERSION)
10996 # scripting provider for BeanShell?
10997 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10998 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10999     AC_MSG_RESULT([yes])
11000     ENABLE_SCRIPTING_BEANSHELL=TRUE
11002     dnl ===================================================================
11003     dnl Check for system beanshell
11004     dnl ===================================================================
11005     AC_MSG_CHECKING([which beanshell to use])
11006     if test "$with_system_beanshell" = "yes"; then
11007         AC_MSG_RESULT([external])
11008         SYSTEM_BSH=TRUE
11009         if test -z $BSH_JAR; then
11010             BSH_JAR=/usr/share/java/bsh.jar
11011         fi
11012         if ! test -f $BSH_JAR; then
11013             AC_MSG_ERROR(bsh.jar not found.)
11014         fi
11015     else
11016         AC_MSG_RESULT([internal])
11017         SYSTEM_BSH=
11018         BUILD_TYPE="$BUILD_TYPE BSH"
11019     fi
11020 else
11021     AC_MSG_RESULT([no])
11022     ENABLE_SCRIPTING_BEANSHELL=
11023     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11025 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11026 AC_SUBST(SYSTEM_BSH)
11027 AC_SUBST(BSH_JAR)
11029 # scripting provider for JavaScript?
11030 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11031 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11032     AC_MSG_RESULT([yes])
11033     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11035     dnl ===================================================================
11036     dnl Check for system rhino
11037     dnl ===================================================================
11038     AC_MSG_CHECKING([which rhino to use])
11039     if test "$with_system_rhino" = "yes"; then
11040         AC_MSG_RESULT([external])
11041         SYSTEM_RHINO=TRUE
11042         if test -z $RHINO_JAR; then
11043             RHINO_JAR=/usr/share/java/js.jar
11044         fi
11045         if ! test -f $RHINO_JAR; then
11046             AC_MSG_ERROR(js.jar not found.)
11047         fi
11048     else
11049         AC_MSG_RESULT([internal])
11050         SYSTEM_RHINO=
11051         BUILD_TYPE="$BUILD_TYPE RHINO"
11052         NEED_ANT=TRUE
11053     fi
11054 else
11055     AC_MSG_RESULT([no])
11056     ENABLE_SCRIPTING_JAVASCRIPT=
11057     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11059 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11060 AC_SUBST(SYSTEM_RHINO)
11061 AC_SUBST(RHINO_JAR)
11063 # This is only used in Qt5/KDE5 checks to determine if /usr/lib64
11064 # paths should be added to library search path. So lets put all 64-bit
11065 # platforms there.
11066 supports_multilib=
11067 case "$host_cpu" in
11068 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11069     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11070         supports_multilib="yes"
11071     fi
11072     ;;
11074     ;;
11075 esac
11077 dnl ===================================================================
11078 dnl QT5 Integration
11079 dnl ===================================================================
11081 QT5_CFLAGS=""
11082 QT5_LIBS=""
11083 QMAKE5="qmake"
11084 MOC5="moc"
11085 QT5_GLIB_CFLAGS=""
11086 QT5_GLIB_LIBS=""
11087 QT5_HAVE_GLIB=""
11088 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11089         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11090         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11091 then
11092     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11093     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11095     if test -n "$supports_multilib"; then
11096         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11097     fi
11099     qt5_test_include="QtWidgets/qapplication.h"
11100     qt5_test_library="libQt5Widgets.so"
11102     dnl Check for qmake5
11103     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11104     if test "$QMAKE5" = "no"; then
11105         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11106     else
11107         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11108         if test -z "$qmake5_test_ver"; then
11109             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11110         fi
11111         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11112         qt5_minimal_minor="6"
11113         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11114             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11115         else
11116             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11117         fi
11118     fi
11120     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11121     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11123     AC_MSG_CHECKING([for Qt5 headers])
11124     qt5_incdir="no"
11125     for inc_dir in $qt5_incdirs; do
11126         if test -r "$inc_dir/$qt5_test_include"; then
11127             qt5_incdir="$inc_dir"
11128             break
11129         fi
11130     done
11131     AC_MSG_RESULT([$qt5_incdir])
11132     if test "x$qt5_incdir" = "xno"; then
11133         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11134     fi
11136     AC_MSG_CHECKING([for Qt5 libraries])
11137     qt5_libdir="no"
11138     for lib_dir in $qt5_libdirs; do
11139         if test -r "$lib_dir/$qt5_test_library"; then
11140             qt5_libdir="$lib_dir"
11141             break
11142         fi
11143     done
11144     AC_MSG_RESULT([$qt5_libdir])
11145     if test "x$qt5_libdir" = "xno"; then
11146         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11147     fi
11149     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11150     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11151     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11153     dnl Check for Meta Object Compiler
11155     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11156     if test "$MOC5" = "no"; then
11157         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11158 the root of your Qt installation by exporting QT5DIR before running "configure".])
11159     fi
11161     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11162     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11163     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11164         [
11165             QT5_HAVE_GLIB=1
11166             AC_DEFINE(QT5_HAVE_GLIB,1)
11167         ],
11168         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11169     )
11171 AC_SUBST(QT5_CFLAGS)
11172 AC_SUBST(QT5_LIBS)
11173 AC_SUBST(MOC5)
11174 AC_SUBST(QT5_GLIB_CFLAGS)
11175 AC_SUBST(QT5_GLIB_LIBS)
11176 AC_SUBST(QT5_HAVE_GLIB)
11178 dnl ===================================================================
11179 dnl KDE5 Integration
11180 dnl ===================================================================
11182 KF5_CFLAGS=""
11183 KF5_LIBS=""
11184 KF5_CONFIG="kf5-config"
11185 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11186         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11187         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11188 then
11189     if test "$OS" = "HAIKU"; then
11190         haiku_arch="`echo $RTL_ARCH | tr X x`"
11191         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11192         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11193     fi
11195     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11196     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11197     if test -n "$supports_multilib"; then
11198         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11199     fi
11201     kf5_test_include="KF5/kcoreaddons_version.h"
11202     kf5_test_library="libKF5CoreAddons.so"
11203     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11205     dnl kf5 KDE4 support compatibility installed
11206     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11207     if test "$KF5_CONFIG" != "no"; then
11208         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11209         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11210     fi
11212     dnl Check for KF5 headers
11213     AC_MSG_CHECKING([for KF5 headers])
11214     kf5_incdir="no"
11215     for kf5_check in $kf5_incdirs; do
11216         if test -r "$kf5_check/$kf5_test_include"; then
11217             kf5_incdir="$kf5_check/KF5"
11218             break
11219         fi
11220     done
11221     AC_MSG_RESULT([$kf5_incdir])
11222     if test "x$kf5_incdir" = "xno"; then
11223         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11224     fi
11226     dnl Check for KF5 libraries
11227     AC_MSG_CHECKING([for KF5 libraries])
11228     kf5_libdir="no"
11229     for kf5_check in $kf5_libdirs; do
11230         if test -r "$kf5_check/$kf5_test_library"; then
11231             kf5_libdir="$kf5_check"
11232             break
11233         fi
11234     done
11236     AC_MSG_RESULT([$kf5_libdir])
11237     if test "x$kf5_libdir" = "xno"; then
11238         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11239     fi
11241     if test "$USING_X11" = TRUE; then
11242         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11243     fi
11245     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"
11246     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11247     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11249     if test "$USING_X11" = TRUE; then
11250         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11251     fi
11253     AC_LANG_PUSH([C++])
11254     save_CXXFLAGS=$CXXFLAGS
11255     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11256     AC_MSG_CHECKING([whether KDE is >= 5.0])
11257        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11258 #include <kcoreaddons_version.h>
11260 int main(int argc, char **argv) {
11261        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11262        else return 1;
11264        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11265     CXXFLAGS=$save_CXXFLAGS
11266     AC_LANG_POP([C++])
11268 AC_SUBST(KF5_CFLAGS)
11269 AC_SUBST(KF5_LIBS)
11271 dnl ===================================================================
11272 dnl Test whether to include Evolution 2 support
11273 dnl ===================================================================
11274 AC_MSG_CHECKING([whether to enable evolution 2 support])
11275 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11276     AC_MSG_RESULT([yes])
11277     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11278     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11279     FilterLibs "${GOBJECT_LIBS}"
11280     GOBJECT_LIBS="${filteredlibs}"
11281     ENABLE_EVOAB2="TRUE"
11282 else
11283     ENABLE_EVOAB2=""
11284     AC_MSG_RESULT([no])
11286 AC_SUBST(ENABLE_EVOAB2)
11287 AC_SUBST(GOBJECT_CFLAGS)
11288 AC_SUBST(GOBJECT_LIBS)
11290 dnl ===================================================================
11291 dnl Test which themes to include
11292 dnl ===================================================================
11293 AC_MSG_CHECKING([which themes to include])
11294 # if none given use default subset of available themes
11295 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11296     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_dark tango"
11299 WITH_THEMES=""
11300 if test "x$with_theme" != "xno"; then
11301     for theme in $with_theme; do
11302         case $theme in
11303         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11304         default) real_theme=colibre ;;
11305         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11306         esac
11307         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11308     done
11310 AC_MSG_RESULT([$WITH_THEMES])
11311 AC_SUBST([WITH_THEMES])
11312 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11313 for theme in $with_theme; do
11314     case $theme in
11315     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11316     *) ;;
11317     esac
11318 done
11320 dnl ===================================================================
11321 dnl Test whether to integrate helppacks into the product's installer
11322 dnl ===================================================================
11323 AC_MSG_CHECKING([for helppack integration])
11324 if test "$with_helppack_integration" = "no"; then
11325     AC_MSG_RESULT([no integration])
11326 else
11327     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11328     AC_MSG_RESULT([integration])
11331 ###############################################################################
11332 # Extensions checking
11333 ###############################################################################
11334 AC_MSG_CHECKING([for extensions integration])
11335 if test "x$enable_extension_integration" != "xno"; then
11336     WITH_EXTENSION_INTEGRATION=TRUE
11337     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11338     AC_MSG_RESULT([yes, use integration])
11339 else
11340     WITH_EXTENSION_INTEGRATION=
11341     AC_MSG_RESULT([no, do not integrate])
11343 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11345 dnl Should any extra extensions be included?
11346 dnl There are standalone tests for each of these below.
11347 WITH_EXTRA_EXTENSIONS=
11348 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11350 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11351 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11352 if test "x$with_java" != "xno"; then
11353     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11354     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11357 AC_MSG_CHECKING([whether to build opens___.ttf])
11358 if test "$enable_build_opensymbol" = "yes"; then
11359     AC_MSG_RESULT([yes])
11360     AC_PATH_PROG(FONTFORGE, fontforge)
11361     if test -z "$FONTFORGE"; then
11362         AC_MSG_ERROR([fontforge not installed])
11363     fi
11364 else
11365     AC_MSG_RESULT([no])
11366     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11367     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11369 AC_SUBST(OPENSYMBOL_TTF)
11370 AC_SUBST(FONTFORGE)
11372 dnl ===================================================================
11373 dnl Test whether to include fonts
11374 dnl ===================================================================
11375 AC_MSG_CHECKING([whether to include third-party fonts])
11376 if test "$with_fonts" != "no"; then
11377     AC_MSG_RESULT([yes])
11378     WITH_FONTS=TRUE
11379     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11380     AC_DEFINE(HAVE_MORE_FONTS)
11381 else
11382     AC_MSG_RESULT([no])
11383     WITH_FONTS=
11384     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11386 AC_SUBST(WITH_FONTS)
11389 dnl ===================================================================
11390 dnl Test whether to enable online update service
11391 dnl ===================================================================
11392 AC_MSG_CHECKING([whether to enable online update])
11393 ENABLE_ONLINE_UPDATE=
11394 ENABLE_ONLINE_UPDATE_MAR=
11395 UPDATE_CONFIG=
11396 if test "$enable_online_update" = ""; then
11397     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11398         AC_MSG_RESULT([yes])
11399         ENABLE_ONLINE_UPDATE="TRUE"
11400     else
11401         AC_MSG_RESULT([no])
11402     fi
11403 else
11404     if test "$enable_online_update" = "mar"; then
11405         AC_MSG_RESULT([yes - MAR-based online update])
11406         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11407         if test "$with_update_config" = ""; then
11408             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11409         fi
11410         UPDATE_CONFIG="$with_update_config"
11411         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11412     elif test "$enable_online_update" = "yes"; then
11413         AC_MSG_RESULT([yes])
11414         ENABLE_ONLINE_UPDATE="TRUE"
11415     else
11416         AC_MSG_RESULT([no])
11417     fi
11419 AC_SUBST(ENABLE_ONLINE_UPDATE)
11420 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11421 AC_SUBST(UPDATE_CONFIG)
11423 dnl ===================================================================
11424 dnl Test whether we need bzip2
11425 dnl ===================================================================
11426 SYSTEM_BZIP2=
11427 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11428     AC_MSG_CHECKING([whether to use system bzip2])
11429     if test "$with_system_bzip2" = yes; then
11430         SYSTEM_BZIP2=TRUE
11431         AC_MSG_RESULT([yes])
11432         PKG_CHECK_MODULES(BZIP2, bzip2)
11433         FilterLibs "${BZIP2_LIBS}"
11434         BZIP2_LIBS="${filteredlibs}"
11435     else
11436         AC_MSG_RESULT([no])
11437         BUILD_TYPE="$BUILD_TYPE BZIP2"
11438     fi
11440 AC_SUBST(SYSTEM_BZIP2)
11441 AC_SUBST(BZIP2_CFLAGS)
11442 AC_SUBST(BZIP2_LIBS)
11444 dnl ===================================================================
11445 dnl Test whether to enable extension update
11446 dnl ===================================================================
11447 AC_MSG_CHECKING([whether to enable extension update])
11448 ENABLE_EXTENSION_UPDATE=
11449 if test "x$enable_extension_update" = "xno"; then
11450     AC_MSG_RESULT([no])
11451 else
11452     AC_MSG_RESULT([yes])
11453     ENABLE_EXTENSION_UPDATE="TRUE"
11454     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11455     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11457 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11460 dnl ===================================================================
11461 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11462 dnl ===================================================================
11463 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11464 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11465     AC_MSG_RESULT([no])
11466     ENABLE_SILENT_MSI=
11467 else
11468     AC_MSG_RESULT([yes])
11469     ENABLE_SILENT_MSI=TRUE
11470     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11472 AC_SUBST(ENABLE_SILENT_MSI)
11474 AC_MSG_CHECKING([whether and how to use Xinerama])
11475 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11476     if test "$x_libraries" = "default_x_libraries"; then
11477         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11478         if test "x$XINERAMALIB" = x; then
11479            XINERAMALIB="/usr/lib"
11480         fi
11481     else
11482         XINERAMALIB="$x_libraries"
11483     fi
11484     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11485         # we have both versions, let the user decide but use the dynamic one
11486         # per default
11487         USE_XINERAMA=TRUE
11488         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11489             XINERAMA_LINK=dynamic
11490         else
11491             XINERAMA_LINK=static
11492         fi
11493     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11494         # we have only the dynamic version
11495         USE_XINERAMA=TRUE
11496         XINERAMA_LINK=dynamic
11497     elif test -e "$XINERAMALIB/libXinerama.a"; then
11498         # static version
11499         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11500             USE_XINERAMA=TRUE
11501             XINERAMA_LINK=static
11502         else
11503             USE_XINERAMA=
11504             XINERAMA_LINK=none
11505         fi
11506     else
11507         # no Xinerama
11508         USE_XINERAMA=
11509         XINERAMA_LINK=none
11510     fi
11511     if test "$USE_XINERAMA" = "TRUE"; then
11512         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11513         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11514             [AC_MSG_ERROR(Xinerama header not found.)], [])
11515         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11516         if test "x$XEXTLIB" = x; then
11517            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11518         fi
11519         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11520         if test "$_os" = "FreeBSD"; then
11521             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11522         fi
11523         if test "$_os" = "Linux"; then
11524             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11525         fi
11526         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11527             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11528     else
11529         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11530     fi
11531 else
11532     USE_XINERAMA=
11533     XINERAMA_LINK=none
11534     AC_MSG_RESULT([no])
11536 AC_SUBST(USE_XINERAMA)
11537 AC_SUBST(XINERAMA_LINK)
11539 dnl ===================================================================
11540 dnl Test whether to build cairo or rely on the system version
11541 dnl ===================================================================
11543 if test "$USING_X11" = TRUE; then
11544     # Used in vcl/Library_vclplug_gen.mk
11545     test_cairo=yes
11548 if test "$test_cairo" = "yes"; then
11549     AC_MSG_CHECKING([whether to use the system cairo])
11551     : ${with_system_cairo:=$with_system_libs}
11552     if test "$with_system_cairo" = "yes"; then
11553         SYSTEM_CAIRO=TRUE
11554         AC_MSG_RESULT([yes])
11556         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11557         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11558         FilterLibs "${CAIRO_LIBS}"
11559         CAIRO_LIBS="${filteredlibs}"
11561         if test "$test_xrender" = "yes"; then
11562             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11563             AC_LANG_PUSH([C])
11564             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11565 #ifdef PictStandardA8
11566 #else
11567       return fail;
11568 #endif
11569 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11571             AC_LANG_POP([C])
11572         fi
11573     else
11574         SYSTEM_CAIRO=
11575         AC_MSG_RESULT([no])
11577         BUILD_TYPE="$BUILD_TYPE CAIRO"
11578     fi
11581 AC_SUBST(SYSTEM_CAIRO)
11582 AC_SUBST(CAIRO_CFLAGS)
11583 AC_SUBST(CAIRO_LIBS)
11585 dnl ===================================================================
11586 dnl Test whether to use avahi
11587 dnl ===================================================================
11588 if test "$_os" = "WINNT"; then
11589     # Windows uses bundled mDNSResponder
11590     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11591 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11592     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11593                       [ENABLE_AVAHI="TRUE"])
11594     AC_DEFINE(HAVE_FEATURE_AVAHI)
11595     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11596     FilterLibs "${AVAHI_LIBS}"
11597     AVAHI_LIBS="${filteredlibs}"
11600 AC_SUBST(ENABLE_AVAHI)
11601 AC_SUBST(AVAHI_CFLAGS)
11602 AC_SUBST(AVAHI_LIBS)
11604 dnl ===================================================================
11605 dnl Test whether to use liblangtag
11606 dnl ===================================================================
11607 SYSTEM_LIBLANGTAG=
11608 AC_MSG_CHECKING([whether to use system liblangtag])
11609 if test "$with_system_liblangtag" = yes; then
11610     SYSTEM_LIBLANGTAG=TRUE
11611     AC_MSG_RESULT([yes])
11612     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11613     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11614     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11615     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11616     FilterLibs "${LIBLANGTAG_LIBS}"
11617     LIBLANGTAG_LIBS="${filteredlibs}"
11618 else
11619     SYSTEM_LIBLANGTAG=
11620     AC_MSG_RESULT([no])
11621     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11622     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11623     if test "$COM" = "MSC"; then
11624         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11625     else
11626         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11627     fi
11629 AC_SUBST(SYSTEM_LIBLANGTAG)
11630 AC_SUBST(LIBLANGTAG_CFLAGS)
11631 AC_SUBST(LIBLANGTAG_LIBS)
11633 dnl ===================================================================
11634 dnl Test whether to build libpng or rely on the system version
11635 dnl ===================================================================
11637 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11639 dnl ===================================================================
11640 dnl Check for runtime JVM search path
11641 dnl ===================================================================
11642 if test "$ENABLE_JAVA" != ""; then
11643     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11644     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11645         AC_MSG_RESULT([yes])
11646         if ! test -d "$with_jvm_path"; then
11647             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11648         fi
11649         if ! test -d "$with_jvm_path"jvm; then
11650             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11651         fi
11652         JVM_ONE_PATH_CHECK="$with_jvm_path"
11653         AC_SUBST(JVM_ONE_PATH_CHECK)
11654     else
11655         AC_MSG_RESULT([no])
11656     fi
11659 dnl ===================================================================
11660 dnl Test for the presence of Ant and that it works
11661 dnl ===================================================================
11663 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11664     ANT_HOME=; export ANT_HOME
11665     WITH_ANT_HOME=; export WITH_ANT_HOME
11666     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11667         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11668             if test "$_os" = "WINNT"; then
11669                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11670             else
11671                 with_ant_home="$LODE_HOME/opt/ant"
11672             fi
11673         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11674             with_ant_home="$LODE_HOME/opt/ant"
11675         fi
11676     fi
11677     if test -z "$with_ant_home"; then
11678         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11679     else
11680         if test "$_os" = "WINNT"; then
11681             # AC_PATH_PROGS needs unix path
11682             with_ant_home=`cygpath -u "$with_ant_home"`
11683         fi
11684         AbsolutePath "$with_ant_home"
11685         with_ant_home=$absolute_path
11686         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11687         WITH_ANT_HOME=$with_ant_home
11688         ANT_HOME=$with_ant_home
11689     fi
11691     if test -z "$ANT"; then
11692         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11693     else
11694         # resolve relative or absolute symlink
11695         while test -h "$ANT"; do
11696             a_cwd=`pwd`
11697             a_basename=`basename "$ANT"`
11698             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11699             cd "`dirname "$ANT"`"
11700             cd "`dirname "$a_script"`"
11701             ANT="`pwd`"/"`basename "$a_script"`"
11702             cd "$a_cwd"
11703         done
11705         AC_MSG_CHECKING([if $ANT works])
11706         mkdir -p conftest.dir
11707         a_cwd=$(pwd)
11708         cd conftest.dir
11709         cat > conftest.java << EOF
11710         public class conftest {
11711             int testmethod(int a, int b) {
11712                     return a + b;
11713             }
11714         }
11717         cat > conftest.xml << EOF
11718         <project name="conftest" default="conftest">
11719         <target name="conftest">
11720             <javac srcdir="." includes="conftest.java">
11721             </javac>
11722         </target>
11723         </project>
11726         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11727         if test $? = 0 -a -f ./conftest.class; then
11728             AC_MSG_RESULT([Ant works])
11729             if test -z "$WITH_ANT_HOME"; then
11730                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11731                 if test -z "$ANT_HOME"; then
11732                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11733                 fi
11734             else
11735                 ANT_HOME="$WITH_ANT_HOME"
11736             fi
11737         else
11738             echo "configure: Ant test failed" >&5
11739             cat conftest.java >&5
11740             cat conftest.xml >&5
11741             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11742         fi
11743         cd "$a_cwd"
11744         rm -fr conftest.dir
11745     fi
11746     if test -z "$ANT_HOME"; then
11747         ANT_HOME="NO_ANT_HOME"
11748     else
11749         PathFormat "$ANT_HOME"
11750         ANT_HOME="$formatted_path"
11751         PathFormat "$ANT"
11752         ANT="$formatted_path"
11753     fi
11754     AC_SUBST(ANT_HOME)
11755     AC_SUBST(ANT)
11757     dnl Checking for ant.jar
11758     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11759         AC_MSG_CHECKING([Ant lib directory])
11760         if test -f $ANT_HOME/lib/ant.jar; then
11761             ANT_LIB="$ANT_HOME/lib"
11762         else
11763             if test -f $ANT_HOME/ant.jar; then
11764                 ANT_LIB="$ANT_HOME"
11765             else
11766                 if test -f /usr/share/java/ant.jar; then
11767                     ANT_LIB=/usr/share/java
11768                 else
11769                     if test -f /usr/share/ant-core/lib/ant.jar; then
11770                         ANT_LIB=/usr/share/ant-core/lib
11771                     else
11772                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11773                             ANT_LIB="$ANT_HOME/lib/ant"
11774                         else
11775                             if test -f /usr/share/lib/ant/ant.jar; then
11776                                 ANT_LIB=/usr/share/lib/ant
11777                             else
11778                                 AC_MSG_ERROR([Ant libraries not found!])
11779                             fi
11780                         fi
11781                     fi
11782                 fi
11783             fi
11784         fi
11785         PathFormat "$ANT_LIB"
11786         ANT_LIB="$formatted_path"
11787         AC_MSG_RESULT([Ant lib directory found.])
11788     fi
11789     AC_SUBST(ANT_LIB)
11791     ant_minver=1.6.0
11792     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11794     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11795     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11796     ant_version_major=`echo $ant_version | cut -d. -f1`
11797     ant_version_minor=`echo $ant_version | cut -d. -f2`
11798     echo "configure: ant_version $ant_version " >&5
11799     echo "configure: ant_version_major $ant_version_major " >&5
11800     echo "configure: ant_version_minor $ant_version_minor " >&5
11801     if test "$ant_version_major" -ge "2"; then
11802         AC_MSG_RESULT([yes, $ant_version])
11803     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11804         AC_MSG_RESULT([yes, $ant_version])
11805     else
11806         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11807     fi
11809     rm -f conftest* core core.* *.core
11812 OOO_JUNIT_JAR=
11813 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11814     AC_MSG_CHECKING([for JUnit 4])
11815     if test "$with_junit" = "yes"; then
11816         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11817             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11818         elif test -e /usr/share/java/junit4.jar; then
11819             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11820         else
11821            if test -e /usr/share/lib/java/junit.jar; then
11822               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11823            else
11824               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11825            fi
11826         fi
11827     else
11828         OOO_JUNIT_JAR=$with_junit
11829     fi
11830     if test "$_os" = "WINNT"; then
11831         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11832     fi
11833     printf 'import org.junit.Before;' > conftest.java
11834     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11835         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11836     else
11837         AC_MSG_ERROR(
11838 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11839  specify its pathname via --with-junit=..., or disable it via --without-junit])
11840     fi
11841     rm -f conftest.class conftest.java
11842     if test $OOO_JUNIT_JAR != ""; then
11843     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11844     fi
11846 AC_SUBST(OOO_JUNIT_JAR)
11848 HAMCREST_JAR=
11849 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11850     AC_MSG_CHECKING([for included Hamcrest])
11851     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11852     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11853         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11854     else
11855         AC_MSG_RESULT([Not included])
11856         AC_MSG_CHECKING([for standalone hamcrest jar.])
11857         if test "$with_hamcrest" = "yes"; then
11858             if test -e /usr/share/lib/java/hamcrest.jar; then
11859                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11860             elif test -e /usr/share/java/hamcrest/core.jar; then
11861                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11862             else
11863                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11864             fi
11865         else
11866             HAMCREST_JAR=$with_hamcrest
11867         fi
11868         if test "$_os" = "WINNT"; then
11869             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11870         fi
11871         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11872             AC_MSG_RESULT([$HAMCREST_JAR])
11873         else
11874             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),
11875                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11876         fi
11877     fi
11878     rm -f conftest.class conftest.java
11880 AC_SUBST(HAMCREST_JAR)
11883 AC_SUBST(SCPDEFS)
11886 # check for wget and curl
11888 WGET=
11889 CURL=
11891 if test "$enable_fetch_external" != "no"; then
11893 CURL=`which curl 2>/dev/null`
11895 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11896     # wget new enough?
11897     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11898     if test $? -eq 0; then
11899         WGET=$i
11900         break
11901     fi
11902 done
11904 if test -z "$WGET" -a -z "$CURL"; then
11905     AC_MSG_ERROR([neither wget nor curl found!])
11910 AC_SUBST(WGET)
11911 AC_SUBST(CURL)
11914 # check for sha256sum
11916 SHA256SUM=
11918 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11919     eval "$i -a 256 --version" > /dev/null 2>&1
11920     ret=$?
11921     if test $ret -eq 0; then
11922         SHA256SUM="$i -a 256"
11923         break
11924     fi
11925 done
11927 if test -z "$SHA256SUM"; then
11928     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11929         eval "$i --version" > /dev/null 2>&1
11930         ret=$?
11931         if test $ret -eq 0; then
11932             SHA256SUM=$i
11933             break
11934         fi
11935     done
11938 if test -z "$SHA256SUM"; then
11939     AC_MSG_ERROR([no sha256sum found!])
11942 AC_SUBST(SHA256SUM)
11944 dnl ===================================================================
11945 dnl Dealing with l10n options
11946 dnl ===================================================================
11947 AC_MSG_CHECKING([which languages to be built])
11948 # get list of all languages
11949 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11950 # the sed command does the following:
11951 #   + if a line ends with a backslash, append the next line to it
11952 #   + adds " on the beginning of the value (after =)
11953 #   + adds " at the end of the value
11954 #   + removes en-US; we want to put it on the beginning
11955 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11956 [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)]
11957 ALL_LANGS="en-US $completelangiso"
11958 # check the configured localizations
11959 WITH_LANG="$with_lang"
11961 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11962 # (Norwegian is "nb" and "nn".)
11963 if test "$WITH_LANG" = "no"; then
11964     WITH_LANG=
11967 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11968     AC_MSG_RESULT([en-US])
11969 else
11970     AC_MSG_RESULT([$WITH_LANG])
11971     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11972     if test -z "$MSGFMT"; then
11973         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11974             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11975         elif test -x "/opt/lo/bin/msgfmt"; then
11976             MSGFMT="/opt/lo/bin/msgfmt"
11977         else
11978             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11979             if test -z "$MSGFMT"; then
11980                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11981             fi
11982         fi
11983     fi
11984     if test -z "$MSGUNIQ"; then
11985         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11986             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11987         elif test -x "/opt/lo/bin/msguniq"; then
11988             MSGUNIQ="/opt/lo/bin/msguniq"
11989         else
11990             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11991             if test -z "$MSGUNIQ"; then
11992                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11993             fi
11994         fi
11995     fi
11997 AC_SUBST(MSGFMT)
11998 AC_SUBST(MSGUNIQ)
11999 # check that the list is valid
12000 for lang in $WITH_LANG; do
12001     test "$lang" = "ALL" && continue
12002     # need to check for the exact string, so add space before and after the list of all languages
12003     for vl in $ALL_LANGS; do
12004         if test "$vl" = "$lang"; then
12005            break
12006         fi
12007     done
12008     if test "$vl" != "$lang"; then
12009         # if you're reading this - you prolly quoted your languages remove the quotes ...
12010         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12011     fi
12012 done
12013 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12014     echo $WITH_LANG | grep -q en-US
12015     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12017 # list with substituted ALL
12018 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12019 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12020 test "$WITH_LANG" = "en-US" && WITH_LANG=
12021 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12022     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12023     ALL_LANGS=`echo $ALL_LANGS qtz`
12025 AC_SUBST(ALL_LANGS)
12026 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12027 AC_SUBST(WITH_LANG)
12028 AC_SUBST(WITH_LANG_LIST)
12029 AC_SUBST(GIT_NEEDED_SUBMODULES)
12031 WITH_POOR_HELP_LOCALIZATIONS=
12032 if test -d "$SRC_ROOT/translations/source"; then
12033     for l in `ls -1 $SRC_ROOT/translations/source`; do
12034         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12035             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12036         fi
12037     done
12039 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12041 if test -n "$with_locales"; then
12042     WITH_LOCALES="$with_locales"
12044     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12045     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12046     # config_host/config_locales.h.in
12047     for locale in $WITH_LOCALES; do
12048         lang=${locale%_*}
12050         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12052         case $lang in
12053         hi|mr*ne)
12054             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12055             ;;
12056         bg|ru)
12057             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12058             ;;
12059         esac
12060     done
12061 else
12062     AC_DEFINE(WITH_LOCALE_ALL)
12064 AC_SUBST(WITH_LOCALES)
12066 dnl git submodule update --reference
12067 dnl ===================================================================
12068 if test -n "${GIT_REFERENCE_SRC}"; then
12069     for repo in ${GIT_NEEDED_SUBMODULES}; do
12070         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12071             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12072         fi
12073     done
12075 AC_SUBST(GIT_REFERENCE_SRC)
12077 dnl git submodules linked dirs
12078 dnl ===================================================================
12079 if test -n "${GIT_LINK_SRC}"; then
12080     for repo in ${GIT_NEEDED_SUBMODULES}; do
12081         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12082             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12083         fi
12084     done
12086 AC_SUBST(GIT_LINK_SRC)
12088 dnl branding
12089 dnl ===================================================================
12090 AC_MSG_CHECKING([for alternative branding images directory])
12091 # initialize mapped arrays
12092 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12093 brand_files="$BRAND_INTRO_IMAGES about.svg"
12095 if test -z "$with_branding" -o "$with_branding" = "no"; then
12096     AC_MSG_RESULT([none])
12097     DEFAULT_BRAND_IMAGES="$brand_files"
12098 else
12099     if ! test -d $with_branding ; then
12100         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12101     else
12102         AC_MSG_RESULT([$with_branding])
12103         CUSTOM_BRAND_DIR="$with_branding"
12104         for lfile in $brand_files
12105         do
12106             if ! test -f $with_branding/$lfile ; then
12107                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12108                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12109             else
12110                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12111             fi
12112         done
12113         check_for_progress="yes"
12114     fi
12116 AC_SUBST([BRAND_INTRO_IMAGES])
12117 AC_SUBST([CUSTOM_BRAND_DIR])
12118 AC_SUBST([CUSTOM_BRAND_IMAGES])
12119 AC_SUBST([DEFAULT_BRAND_IMAGES])
12122 AC_MSG_CHECKING([for 'intro' progress settings])
12123 PROGRESSBARCOLOR=
12124 PROGRESSSIZE=
12125 PROGRESSPOSITION=
12126 PROGRESSFRAMECOLOR=
12127 PROGRESSTEXTCOLOR=
12128 PROGRESSTEXTBASELINE=
12130 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12131     source "$with_branding/progress.conf"
12132     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12133 else
12134     AC_MSG_RESULT([none])
12137 AC_SUBST(PROGRESSBARCOLOR)
12138 AC_SUBST(PROGRESSSIZE)
12139 AC_SUBST(PROGRESSPOSITION)
12140 AC_SUBST(PROGRESSFRAMECOLOR)
12141 AC_SUBST(PROGRESSTEXTCOLOR)
12142 AC_SUBST(PROGRESSTEXTBASELINE)
12145 AC_MSG_CHECKING([for extra build ID])
12146 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12147     EXTRA_BUILDID="$with_extra_buildid"
12149 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12150 if test -n "$EXTRA_BUILDID" ; then
12151     AC_MSG_RESULT([$EXTRA_BUILDID])
12152 else
12153     AC_MSG_RESULT([not set])
12155 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12157 OOO_VENDOR=
12158 AC_MSG_CHECKING([for vendor])
12159 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12160     OOO_VENDOR="$USERNAME"
12162     if test -z "$OOO_VENDOR"; then
12163         OOO_VENDOR="$USER"
12164     fi
12166     if test -z "$OOO_VENDOR"; then
12167         OOO_VENDOR="`id -u -n`"
12168     fi
12170     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12171 else
12172     OOO_VENDOR="$with_vendor"
12173     AC_MSG_RESULT([$OOO_VENDOR])
12175 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12176 AC_SUBST(OOO_VENDOR)
12178 if test "$_os" = "Android" ; then
12179     ANDROID_PACKAGE_NAME=
12180     AC_MSG_CHECKING([for Android package name])
12181     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12182         if test -n "$ENABLE_DEBUG"; then
12183             # Default to the package name that makes ndk-gdb happy.
12184             ANDROID_PACKAGE_NAME="org.libreoffice"
12185         else
12186             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12187         fi
12189         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12190     else
12191         ANDROID_PACKAGE_NAME="$with_android_package_name"
12192         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12193     fi
12194     AC_SUBST(ANDROID_PACKAGE_NAME)
12197 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12198 if test "$with_compat_oowrappers" = "yes"; then
12199     WITH_COMPAT_OOWRAPPERS=TRUE
12200     AC_MSG_RESULT(yes)
12201 else
12202     WITH_COMPAT_OOWRAPPERS=
12203     AC_MSG_RESULT(no)
12205 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12207 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12208 AC_MSG_CHECKING([for install dirname])
12209 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12210     INSTALLDIRNAME="$with_install_dirname"
12212 AC_MSG_RESULT([$INSTALLDIRNAME])
12213 AC_SUBST(INSTALLDIRNAME)
12215 AC_MSG_CHECKING([for prefix])
12216 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12217 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12218 PREFIXDIR="$prefix"
12219 AC_MSG_RESULT([$PREFIXDIR])
12220 AC_SUBST(PREFIXDIR)
12222 LIBDIR=[$(eval echo $(eval echo $libdir))]
12223 AC_SUBST(LIBDIR)
12225 DATADIR=[$(eval echo $(eval echo $datadir))]
12226 AC_SUBST(DATADIR)
12228 MANDIR=[$(eval echo $(eval echo $mandir))]
12229 AC_SUBST(MANDIR)
12231 DOCDIR=[$(eval echo $(eval echo $docdir))]
12232 AC_SUBST(DOCDIR)
12234 BINDIR=[$(eval echo $(eval echo $bindir))]
12235 AC_SUBST(BINDIR)
12237 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12238 AC_SUBST(INSTALLDIR)
12240 TESTINSTALLDIR="${BUILDDIR}/test-install"
12241 AC_SUBST(TESTINSTALLDIR)
12244 # ===================================================================
12245 # OAuth2 id and secrets
12246 # ===================================================================
12248 AC_MSG_CHECKING([for Google Drive client id and secret])
12249 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12250     AC_MSG_RESULT([not set])
12251     GDRIVE_CLIENT_ID="\"\""
12252     GDRIVE_CLIENT_SECRET="\"\""
12253 else
12254     AC_MSG_RESULT([set])
12255     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12256     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12258 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12259 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12261 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12262 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12263     AC_MSG_RESULT([not set])
12264     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12265     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12266 else
12267     AC_MSG_RESULT([set])
12268     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12269     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12271 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12272 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12274 AC_MSG_CHECKING([for OneDrive client id and secret])
12275 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12276     AC_MSG_RESULT([not set])
12277     ONEDRIVE_CLIENT_ID="\"\""
12278     ONEDRIVE_CLIENT_SECRET="\"\""
12279 else
12280     AC_MSG_RESULT([set])
12281     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12282     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12284 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12285 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12288 dnl ===================================================================
12289 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12290 dnl --enable-dependency-tracking configure option
12291 dnl ===================================================================
12292 AC_MSG_CHECKING([whether to enable dependency tracking])
12293 if test "$enable_dependency_tracking" = "no"; then
12294     nodep=TRUE
12295     AC_MSG_RESULT([no])
12296 else
12297     AC_MSG_RESULT([yes])
12299 AC_SUBST(nodep)
12301 dnl ===================================================================
12302 dnl Number of CPUs to use during the build
12303 dnl ===================================================================
12304 AC_MSG_CHECKING([for number of processors to use])
12305 # plain --with-parallelism is just the default
12306 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12307     if test "$with_parallelism" = "no"; then
12308         PARALLELISM=0
12309     else
12310         PARALLELISM=$with_parallelism
12311     fi
12312 else
12313     if test "$enable_icecream" = "yes"; then
12314         PARALLELISM="10"
12315     else
12316         case `uname -s` in
12318         Darwin|FreeBSD|NetBSD|OpenBSD)
12319             PARALLELISM=`sysctl -n hw.ncpu`
12320             ;;
12322         Linux)
12323             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12324         ;;
12325         # what else than above does profit here *and* has /proc?
12326         *)
12327             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12328             ;;
12329         esac
12331         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12332         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12333     fi
12336 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12337     if test -z "$with_parallelism"; then
12338             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12339             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12340             PARALLELISM="1"
12341     else
12342         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."
12343     fi
12346 if test $PARALLELISM -eq 0; then
12347     AC_MSG_RESULT([explicit make -j option needed])
12348 else
12349     AC_MSG_RESULT([$PARALLELISM])
12351 AC_SUBST(PARALLELISM)
12353 IWYU_PATH="$with_iwyu"
12354 AC_SUBST(IWYU_PATH)
12355 if test ! -z "$IWYU_PATH"; then
12356     if test ! -f "$IWYU_PATH"; then
12357         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12358     fi
12362 # Set up ILIB for MSVC build
12364 ILIB1=
12365 if test "$build_os" = "cygwin"; then
12366     ILIB="."
12367     if test -n "$JAVA_HOME"; then
12368         ILIB="$ILIB;$JAVA_HOME/lib"
12369     fi
12370     ILIB1=-link
12371     if test "$BITNESS_OVERRIDE" = 64; then
12372         ILIB="$ILIB;$COMPATH/lib/x64"
12373         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12374         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12375         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12376         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12377             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12378             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12379         fi
12380         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12381         ucrtlibpath_formatted=$formatted_path
12382         ILIB="$ILIB;$ucrtlibpath_formatted"
12383         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12384     else
12385         ILIB="$ILIB;$COMPATH/lib/x86"
12386         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12387         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12388         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12389         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12390             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12391             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12392         fi
12393         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12394         ucrtlibpath_formatted=$formatted_path
12395         ILIB="$ILIB;$ucrtlibpath_formatted"
12396         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12397     fi
12398     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12399         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12400     else
12401         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12402     fi
12404     AC_SUBST(ILIB)
12407 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12408 AC_MSG_CHECKING([that $CXX supports inline variables])
12409 AC_LANG_PUSH([C++])
12410 save_CXXFLAGS=$CXXFLAGS
12411 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12412 if test "$build_os" = cygwin; then
12413     save_LIB=$LIB
12414     export LIB=$ILIB
12416 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12417         #if !defined __cpp_inline_variables
12418         // This tests for one specific aspect of inline variables that is actually used by
12419         // ORegistry::ROOT (registry/source/regimpl.cxx):
12420         struct S { constexpr S() {} };
12421         struct T { static constexpr S s{}; };
12422         S const * f() { return &T::s; }
12423         #endif
12424     ]])],
12425     AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required inline variable support]))
12426 CXXFLAGS=$save_CXXFLAGS
12427 if test "$build_os" = cygwin; then
12428     LIB=$save_LIB
12430 AC_LANG_POP([C++])
12432 dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
12433 AC_MSG_CHECKING(
12434     [that C++11 use of const_iterator in standard containers is not broken])
12435 save_CXXFLAGS=$CXXFLAGS
12436 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12437 AC_LANG_PUSH([C++])
12438 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12439     #include <list>
12440     ]],[[
12441         std::list<int> l;
12442         l.erase(l.cbegin());
12443     ]])],
12444     AC_MSG_RESULT([yes]),
12445     AC_MSG_ERROR([C++11 use of const_iterator in standard containers must not broken]))
12446 AC_LANG_POP([C++])
12447 CXXFLAGS=$save_CXXFLAGS
12449 # ===================================================================
12450 # Creating bigger shared library to link against
12451 # ===================================================================
12452 AC_MSG_CHECKING([whether to create huge library])
12453 MERGELIBS=
12455 if test $_os = iOS -o $_os = Android; then
12456     # Never any point in mergelibs for these as we build just static
12457     # libraries anyway...
12458     enable_mergelibs=no
12461 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12462     if test $_os != Linux -a $_os != WINNT; then
12463         add_warning "--enable-mergelibs is not tested for this platform"
12464     fi
12465     MERGELIBS="TRUE"
12466     AC_MSG_RESULT([yes])
12467 else
12468     AC_MSG_RESULT([no])
12470 AC_SUBST([MERGELIBS])
12472 dnl ===================================================================
12473 dnl icerun is a wrapper that stops us spawning tens of processes
12474 dnl locally - for tools that can't be executed on the compile cluster
12475 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12476 dnl ===================================================================
12477 AC_MSG_CHECKING([whether to use icerun wrapper])
12478 ICECREAM_RUN=
12479 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12480     ICECREAM_RUN=icerun
12481     AC_MSG_RESULT([yes])
12482 else
12483     AC_MSG_RESULT([no])
12485 AC_SUBST(ICECREAM_RUN)
12487 dnl ===================================================================
12488 dnl Setup the ICECC_VERSION for the build the same way it was set for
12489 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12490 dnl ===================================================================
12491 x_ICECC_VERSION=[\#]
12492 if test -n "$ICECC_VERSION" ; then
12493     x_ICECC_VERSION=
12495 AC_SUBST(x_ICECC_VERSION)
12496 AC_SUBST(ICECC_VERSION)
12498 dnl ===================================================================
12500 AC_MSG_CHECKING([MPL subset])
12501 MPL_SUBSET=
12503 if test "$enable_mpl_subset" = "yes"; then
12504     warn_report=false
12505     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12506         warn_report=true
12507     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12508         warn_report=true
12509     fi
12510     if test "$warn_report" = "true"; then
12511         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12512     fi
12513     if test "x$enable_postgresql_sdbc" != "xno"; then
12514         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12515     fi
12516     if test "$enable_lotuswordpro" = "yes"; then
12517         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12518     fi
12519     if test "$WITH_WEBDAV" = "neon"; then
12520         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12521     fi
12522     if test -n "$ENABLE_PDFIMPORT"; then
12523         if test "x$SYSTEM_POPPLER" = "x"; then
12524             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12525         fi
12526     fi
12527     # cf. m4/libo_check_extension.m4
12528     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12529         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12530     fi
12531     for theme in $WITH_THEMES; do
12532         case $theme in
12533         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12534             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12535         *) : ;;
12536         esac
12537     done
12539     ENABLE_OPENGL_TRANSITIONS=
12541     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12542         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12543     fi
12545     MPL_SUBSET="TRUE"
12546     AC_DEFINE(MPL_HAVE_SUBSET)
12547     AC_MSG_RESULT([only])
12548 else
12549     AC_MSG_RESULT([no restrictions])
12551 AC_SUBST(MPL_SUBSET)
12553 dnl ===================================================================
12555 AC_MSG_CHECKING([formula logger])
12556 ENABLE_FORMULA_LOGGER=
12558 if test "x$enable_formula_logger" = "xyes"; then
12559     AC_MSG_RESULT([yes])
12560     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12561     ENABLE_FORMULA_LOGGER=TRUE
12562 elif test -n "$ENABLE_DBGUTIL" ; then
12563     AC_MSG_RESULT([yes])
12564     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12565     ENABLE_FORMULA_LOGGER=TRUE
12566 else
12567     AC_MSG_RESULT([no])
12570 AC_SUBST(ENABLE_FORMULA_LOGGER)
12572 dnl ===================================================================
12573 dnl Setting up the environment.
12574 dnl ===================================================================
12575 AC_MSG_NOTICE([setting up the build environment variables...])
12577 AC_SUBST(COMPATH)
12579 if test "$build_os" = "cygwin"; then
12580     if test -d "$COMPATH/atlmfc/lib"; then
12581         ATL_LIB="$COMPATH/atlmfc/lib"
12582         ATL_INCLUDE="$COMPATH/atlmfc/include"
12583     else
12584         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12585         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12586     fi
12587     if test "$BITNESS_OVERRIDE" = 64; then
12588         if test $VCVER = "150"; then
12589             ATL_LIB="$ATL_LIB/x64"
12590         else
12591             ATL_LIB="$ATL_LIB/amd64"
12592         fi
12593     else
12594         if test $VCVER = "150"; then
12595             ATL_LIB="$ATL_LIB/x86"
12596         fi
12597     fi
12598     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12599     PathFormat "/usr/bin/find.exe"
12600     FIND="$formatted_path"
12601     PathFormat "/usr/bin/sort.exe"
12602     SORT="$formatted_path"
12603     PathFormat "/usr/bin/grep.exe"
12604     WIN_GREP="$formatted_path"
12605     PathFormat "/usr/bin/ls.exe"
12606     WIN_LS="$formatted_path"
12607     PathFormat "/usr/bin/touch.exe"
12608     WIN_TOUCH="$formatted_path"
12609 else
12610     FIND=find
12611     SORT=sort
12614 AC_SUBST(ATL_INCLUDE)
12615 AC_SUBST(ATL_LIB)
12616 AC_SUBST(FIND)
12617 AC_SUBST(SORT)
12618 AC_SUBST(WIN_GREP)
12619 AC_SUBST(WIN_LS)
12620 AC_SUBST(WIN_TOUCH)
12622 AC_SUBST(BUILD_TYPE)
12624 AC_SUBST(SOLARINC)
12626 PathFormat "$PERL"
12627 PERL="$formatted_path"
12628 AC_SUBST(PERL)
12630 if test -n "$TMPDIR"; then
12631     TEMP_DIRECTORY="$TMPDIR"
12632 else
12633     TEMP_DIRECTORY="/tmp"
12635 if test "$build_os" = "cygwin"; then
12636     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12638 AC_SUBST(TEMP_DIRECTORY)
12640 # setup the PATH for the environment
12641 if test -n "$LO_PATH_FOR_BUILD"; then
12642     LO_PATH="$LO_PATH_FOR_BUILD"
12643 else
12644     LO_PATH="$PATH"
12646     case "$host_os" in
12648     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12649         if test "$ENABLE_JAVA" != ""; then
12650             pathmunge "$JAVA_HOME/bin" "after"
12651         fi
12652         ;;
12654     cygwin*)
12655         # Win32 make needs native paths
12656         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12657             LO_PATH=`cygpath -p -m "$PATH"`
12658         fi
12659         if test "$BITNESS_OVERRIDE" = 64; then
12660             # needed for msi packaging
12661             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12662         fi
12663         # .NET 4.6 and higher don't have bin directory
12664         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12665             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12666         fi
12667         pathmunge "$ASM_HOME" "before"
12668         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12669         pathmunge "$CSC_PATH" "before"
12670         pathmunge "$MIDL_PATH" "before"
12671         pathmunge "$AL_PATH" "before"
12672         pathmunge "$MSPDB_PATH" "before"
12673         if test -n "$MSBUILD_PATH" ; then
12674             pathmunge "$MSBUILD_PATH" "before"
12675         fi
12676         if test "$BITNESS_OVERRIDE" = 64; then
12677             pathmunge "$COMPATH/bin/amd64" "before"
12678             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12679         else
12680             pathmunge "$COMPATH/bin" "before"
12681             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12682         fi
12683         if test "$ENABLE_JAVA" != ""; then
12684             if test -d "$JAVA_HOME/jre/bin/client"; then
12685                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12686             fi
12687             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12688                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12689             fi
12690             pathmunge "$JAVA_HOME/bin" "before"
12691         fi
12692         ;;
12694     solaris*)
12695         pathmunge "/usr/css/bin" "before"
12696         if test "$ENABLE_JAVA" != ""; then
12697             pathmunge "$JAVA_HOME/bin" "after"
12698         fi
12699         ;;
12700     esac
12703 AC_SUBST(LO_PATH)
12705 libo_FUZZ_SUMMARY
12707 # Generate a configuration sha256 we can use for deps
12708 if test -f config_host.mk; then
12709     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12711 if test -f config_host_lang.mk; then
12712     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12715 CFLAGS=$my_original_CFLAGS
12716 CXXFLAGS=$my_original_CXXFLAGS
12717 CPPFLAGS=$my_original_CPPFLAGS
12719 AC_CONFIG_FILES([config_host.mk
12720                  config_host_lang.mk
12721                  Makefile
12722                  bin/bffvalidator.sh
12723                  bin/odfvalidator.sh
12724                  bin/officeotron.sh
12725                  instsetoo_native/util/openoffice.lst
12726                  sysui/desktop/macosx/Info.plist])
12727 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12728 AC_CONFIG_HEADERS([config_host/config_clang.h])
12729 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12730 AC_CONFIG_HEADERS([config_host/config_eot.h])
12731 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12732 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12733 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12734 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12735 AC_CONFIG_HEADERS([config_host/config_features.h])
12736 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12737 AC_CONFIG_HEADERS([config_host/config_folders.h])
12738 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12739 AC_CONFIG_HEADERS([config_host/config_gio.h])
12740 AC_CONFIG_HEADERS([config_host/config_global.h])
12741 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12742 AC_CONFIG_HEADERS([config_host/config_java.h])
12743 AC_CONFIG_HEADERS([config_host/config_langs.h])
12744 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12745 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12746 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12747 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12748 AC_CONFIG_HEADERS([config_host/config_locales.h])
12749 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12750 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12751 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12752 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12753 AC_CONFIG_HEADERS([config_host/config_oox.h])
12754 AC_CONFIG_HEADERS([config_host/config_options.h])
12755 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12756 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12757 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12758 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12759 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12760 AC_CONFIG_HEADERS([config_host/config_version.h])
12761 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12762 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12763 AC_CONFIG_HEADERS([config_host/config_python.h])
12764 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12765 AC_OUTPUT
12767 if test "$CROSS_COMPILING" = TRUE; then
12768     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12771 # touch the config timestamp file
12772 if test ! -f config_host.mk.stamp; then
12773     echo > config_host.mk.stamp
12774 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12775     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12776 else
12777     echo > config_host.mk.stamp
12780 # touch the config lang timestamp file
12781 if test ! -f config_host_lang.mk.stamp; then
12782     echo > config_host_lang.mk.stamp
12783 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12784     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12785 else
12786     echo > config_host_lang.mk.stamp
12790 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12792 cat << _EOS
12793 ****************************************************************************
12794 WARNING:
12795 Your make version is known to be horribly slow, and hard to debug
12796 problems with. To get a reasonably functional make please do:
12798 to install a pre-compiled binary make for Win32
12800  mkdir -p /opt/lo/bin
12801  cd /opt/lo/bin
12802  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12803  cp make-4.2.1-msvc.exe make
12804  chmod +x make
12806 to install from source:
12807 place yourself in a working directory of you choice.
12809  git clone git://git.savannah.gnu.org/make.git
12811  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12812  set PATH=%PATH%;C:\Cygwin\bin
12813  [or Cygwin64, if that is what you have]
12814  cd path-to-make-repo-you-cloned-above
12815  build_w32.bat --without-guile
12817 should result in a WinRel/gnumake.exe.
12818 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12820 Then re-run autogen.sh
12822 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12823 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12825 _EOS
12828 cat << _EOF
12829 ****************************************************************************
12831 To build, run:
12832 $GNUMAKE
12834 To view some help, run:
12835 $GNUMAKE help
12837 _EOF
12839 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12840     cat << _EOF
12841 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12842 _EOF
12844     if test $_os = Darwin; then
12845         echo open instdir/$PRODUCTNAME.app
12846     else
12847         echo instdir/program/soffice
12848     fi
12849     cat << _EOF
12851 If you want to run the smoketest, run:
12852 $GNUMAKE check
12854 _EOF
12857 if test -f warn; then
12858     cat warn
12859     rm warn
12862 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: