tdf#126268: Add support for negative decimal
[LibreOffice.git] / configure.ac
blob1a46666725a2d176cbf04339ff275da3895e7bf9
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
337 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
338     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
341 # need sed in os checks...
342 AC_PATH_PROGS(SED, sed)
343 if test -z "$SED"; then
344     AC_MSG_ERROR([install sed to run this script])
347 # Set the ENABLE_LTO variable
348 # ===================================================================
349 AC_MSG_CHECKING([whether to use link-time optimization])
350 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
351     ENABLE_LTO="TRUE"
352     AC_MSG_RESULT([yes])
353     AC_DEFINE(STATIC_LINKING)
354 else
355     ENABLE_LTO=""
356     AC_MSG_RESULT([no])
358 AC_SUBST(ENABLE_LTO)
360 AC_ARG_ENABLE(fuzz-options,
361     AS_HELP_STRING([--enable-fuzz-options],
362         [Randomly enable or disable each of those configurable options
363          that are supposed to be freely selectable without interdependencies,
364          or where bad interaction from interdependencies is automatically avoided.])
367 dnl ===================================================================
368 dnl When building for Android, --with-android-ndk,
369 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
370 dnl mandatory
371 dnl ===================================================================
373 AC_ARG_WITH(android-ndk,
374     AS_HELP_STRING([--with-android-ndk],
375         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
378 AC_ARG_WITH(android-ndk-toolchain-version,
379     AS_HELP_STRING([--with-android-ndk-toolchain-version],
380         [Specify which toolchain version to use, of those present in the
381         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
382         with_android_ndk_toolchain_version=clang5.0)
384 AC_ARG_WITH(android-sdk,
385     AS_HELP_STRING([--with-android-sdk],
386         [Specify location of the Android SDK. Mandatory when building for Android.]),
389 ANDROID_NDK_HOME=
390 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
391     with_android_ndk="$SRC_ROOT/external/android-ndk"
393 if test -n "$with_android_ndk"; then
394     ANDROID_NDK_HOME=$with_android_ndk
396     # Set up a lot of pre-canned defaults
398     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
399         if test ! -f $ANDROID_NDK_HOME/source.properties; then
400             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
401         fi
402         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
403     else
404         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
405     fi
406     if test -z "$ANDROID_NDK_VERSION";  then
407         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
408     fi
409     case $ANDROID_NDK_VERSION in
410     r9*|r10*)
411         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
412         ;;
413     11.1.*|12.1.*|13.1.*|14.1.*)
414         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
415         ;;
416     16.*)
417         ;;
418     *)
419         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
420         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
421         ;;
422     esac
424     ANDROID_API_LEVEL=14
425     android_cpu=$host_cpu
426     ANDROID_ARCH=$android_cpu
427     if test $host_cpu = arm; then
428         android_platform_prefix=$android_cpu-linux-androideabi
429         android_gnu_prefix=$android_platform_prefix
430         LLVM_TRIPLE=armv7-none-linux-androideabi
431         ANDROID_APP_ABI=armeabi-v7a
432         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
433     elif test $host_cpu = aarch64; then
434         android_platform_prefix=$android_cpu-linux-android
435         android_gnu_prefix=$android_platform_prefix
436         LLVM_TRIPLE=aarch64-none-linux-android
437         # minimum android version that supports aarch64
438         ANDROID_API_LEVEL=21
439         ANDROID_APP_ABI=arm64-v8a
440         ANDROID_ARCH=arm64
441     elif test $host_cpu = mips; then
442         android_platform_prefix=mipsel-linux-android
443         android_gnu_prefix=$android_platform_prefix
444         LLVM_TRIPLE=mipsel-none-linux-android
445         ANDROID_APP_ABI=mips
446     else
447         # host_cpu is something like "i386" or "i686" I guess, NDK uses
448         # "x86" in some contexts
449         android_cpu=x86
450         android_platform_prefix=$android_cpu
451         android_gnu_prefix=i686-linux-android
452         LLVM_TRIPLE=i686-none-linux-android
453         ANDROID_APP_ABI=x86
454         ANDROID_ARCH=$android_cpu
455         ANDROIDCFLAGS="-march=atom"
456     fi
458     case "$with_android_ndk_toolchain_version" in
459     clang5.0)
460         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
461         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
462         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
463         ;;
464     *)
465         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
466     esac
468     if test ! -d $ANDROID_BINUTILS_DIR; then
469         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
470     elif test ! -d $ANDROID_COMPILER_DIR; then
471         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
472     fi
474     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
475     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
476     # manage to link the (app-specific) single huge .so that is built for the app in
477     # android/source/ if there is debug information in a significant part of the object files.
478     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
479     # all objects have been built with debug information.)
480     case $build_os in
481     linux-gnu*)
482         ndk_build_os=linux
483         ;;
484     darwin*)
485         ndk_build_os=darwin
486         ;;
487     *)
488         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
489         ;;
490     esac
491     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
492     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
493     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
495     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
496     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
497     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
498     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
499     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
500     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
502     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
503     # android is using different sysroots for compilation and linking, but as
504     # there is no full separation in configure and elsewhere, use isystem for
505     # compilation stuff and sysroot for linking
506     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
507     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
508     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
569 test_gdb_index=no
570 test_split_debug=no
572 # Default values, as such probably valid just for Linux, set
573 # differently below just for Mac OSX, but at least better than
574 # hardcoding these as we used to do. Much of this is duplicated also
575 # in solenv for old build system and for gbuild, ideally we should
576 # perhaps define stuff like this only here in configure.ac?
578 LINKFLAGSSHL="-shared"
579 PICSWITCH="-fpic"
580 DLLPOST=".so"
582 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
584 INSTROOTBASESUFFIX=
585 INSTROOTCONTENTSUFFIX=
586 SDKDIRNAME=sdk
588 case "$host_os" in
590 solaris*)
591     test_gtk=yes
592     build_gstreamer_1_0=yes
593     test_freetype=yes
594     _os=SunOS
596     dnl ===========================================================
597     dnl Check whether we're using Solaris 10 - SPARC or Intel.
598     dnl ===========================================================
599     AC_MSG_CHECKING([the Solaris operating system release])
600     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
601     if test "$_os_release" -lt "10"; then
602         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
603     else
604         AC_MSG_RESULT([ok ($_os_release)])
605     fi
607     dnl Check whether we're using a SPARC or i386 processor
608     AC_MSG_CHECKING([the processor type])
609     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
610         AC_MSG_RESULT([ok ($host_cpu)])
611     else
612         AC_MSG_ERROR([only SPARC and i386 processors are supported])
613     fi
614     ;;
616 linux-gnu*|k*bsd*-gnu*)
617     test_gtk=yes
618     build_gstreamer_1_0=yes
619     test_kde5=yes
620     test_gtk3_kde5=yes
621     test_gdb_index=yes
622     test_split_debug=yes
623     if test "$enable_fuzzers" != yes; then
624         test_freetype=yes
625         test_fontconfig=yes
626     else
627         test_freetype=no
628         test_fontconfig=no
629         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
630     fi
631     _os=Linux
632     ;;
634 gnu)
635     test_randr=no
636     test_xrender=no
637     _os=GNU
638      ;;
640 cygwin*|interix*)
642     # When building on Windows normally with MSVC under Cygwin,
643     # configure thinks that the host platform (the platform the
644     # built code will run on) is Cygwin, even if it obviously is
645     # Windows, which in Autoconf terminology is called
646     # "mingw32". (Which is misleading as MinGW is the name of the
647     # tool-chain, not an operating system.)
649     # Somewhat confusing, yes. But this configure script doesn't
650     # look at $host etc that much, it mostly uses its own $_os
651     # variable, set here in this case statement.
653     test_cups=no
654     test_dbus=no
655     test_randr=no
656     test_xrender=no
657     test_freetype=no
658     test_fontconfig=no
659     _os=WINNT
661     DLLPOST=".dll"
662     LINKFLAGSNOUNDEFS=
663     ;;
665 darwin*) # macOS or iOS
666     test_gtk=yes
667     test_randr=no
668     test_xrender=no
669     test_freetype=no
670     test_fontconfig=no
671     test_dbus=no
672     if test -n "$LODE_HOME" ; then
673         mac_sanitize_path
674         AC_MSG_NOTICE([sanitized the PATH to $PATH])
675     fi
676     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
677         build_for_ios=YES
678         _os=iOS
679         test_gtk=no
680         test_cups=no
681         enable_mpl_subset=yes
682         enable_lotuswordpro=no
683         enable_coinmp=no
684         enable_lpsolve=no
685         enable_postgresql_sdbc=no
686         enable_extension_integration=no
687         enable_report_builder=no
688         with_ppds=no
689         if test "$enable_ios_simulator" = "yes"; then
690             host=x86_64-apple-darwin
691         fi
692     else
693         _os=Darwin
694         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
695         INSTROOTCONTENTSUFFIX=/Contents
696         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
697     fi
698     # See comment above the case "$host_os"
699     LINKFLAGSSHL="-dynamiclib -single_module"
701     # -fPIC is default
702     PICSWITCH=""
704     DLLPOST=".dylib"
706     # -undefined error is the default
707     LINKFLAGSNOUNDEFS=""
710 freebsd*)
711     test_gtk=yes
712     build_gstreamer_1_0=yes
713     test_kde5=yes
714     test_gtk3_kde5=yes
715     test_freetype=yes
716     AC_MSG_CHECKING([the FreeBSD operating system release])
717     if test -n "$with_os_version"; then
718         OSVERSION="$with_os_version"
719     else
720         OSVERSION=`/sbin/sysctl -n kern.osreldate`
721     fi
722     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
723     AC_MSG_CHECKING([which thread library to use])
724     if test "$OSVERSION" -lt "500016"; then
725         PTHREAD_CFLAGS="-D_THREAD_SAFE"
726         PTHREAD_LIBS="-pthread"
727     elif test "$OSVERSION" -lt "502102"; then
728         PTHREAD_CFLAGS="-D_THREAD_SAFE"
729         PTHREAD_LIBS="-lc_r"
730     else
731         PTHREAD_CFLAGS=""
732         PTHREAD_LIBS="-pthread"
733     fi
734     AC_MSG_RESULT([$PTHREAD_LIBS])
735     _os=FreeBSD
736     ;;
738 *netbsd*)
739     test_gtk=yes
740     build_gstreamer_1_0=yes
741     test_kde5=yes
742     test_gtk3_kde5=yes
743     test_freetype=yes
744     PTHREAD_LIBS="-pthread -lpthread"
745     _os=NetBSD
746     ;;
748 aix*)
749     test_randr=no
750     test_freetype=yes
751     PTHREAD_LIBS=-pthread
752     _os=AIX
753     ;;
755 openbsd*)
756     test_gtk=yes
757     test_freetype=yes
758     PTHREAD_CFLAGS="-D_THREAD_SAFE"
759     PTHREAD_LIBS="-pthread"
760     _os=OpenBSD
761     ;;
763 dragonfly*)
764     test_gtk=yes
765     build_gstreamer_1_0=yes
766     test_kde5=yes
767     test_gtk3_kde5=yes
768     test_freetype=yes
769     PTHREAD_LIBS="-pthread"
770     _os=DragonFly
771     ;;
773 linux-android*)
774     build_gstreamer_1_0=no
775     enable_lotuswordpro=no
776     enable_mpl_subset=yes
777     enable_coinmp=yes
778     enable_lpsolve=no
779     enable_report_builder=no
780     enable_odk=no
781     enable_postgresql_sdbc=no
782     enable_python=no
783     test_cups=no
784     test_dbus=no
785     test_fontconfig=no
786     test_freetype=no
787     test_gtk=no
788     test_kde5=no
789     test_gtk3_kde5=no
790     test_randr=no
791     test_xrender=no
792     _os=Android
794     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
795     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
796     ;;
798 haiku*)
799     test_cups=no
800     test_dbus=no
801     test_randr=no
802     test_xrender=no
803     test_freetype=yes
804     enable_odk=no
805     enable_gstreamer_1_0=no
806     enable_vlc=no
807     enable_coinmp=no
808     enable_pdfium=no
809     enable_sdremote=no
810     enable_postgresql_sdbc=no
811     enable_firebird_sdbc=no
812     _os=Haiku
813     ;;
816     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
817     ;;
818 esac
820 if test "$_os" = "Android" ; then
821     # Verify that the NDK and SDK options are proper
822     if test -z "$with_android_ndk"; then
823         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
824     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
825         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
826     fi
828     if test -z "$ANDROID_SDK_HOME"; then
829         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
830     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
831         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
832     fi
834     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
835     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
836         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
837                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
838                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
839         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
840         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
841         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
842     fi
843     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
844         AC_MSG_WARN([android support repository not found - install with
845                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
846                      to allow the build to download the specified version of the android support libraries])
847         add_warning "android support repository not found - install with"
848         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
849         add_warning "to allow the build to download the specified version of the android support libraries"
850     fi
853 if test "$_os" = "AIX"; then
854     AC_PATH_PROG(GAWK, gawk)
855     if test -z "$GAWK"; then
856         AC_MSG_ERROR([gawk not found in \$PATH])
857     fi
860 AC_SUBST(SDKDIRNAME)
862 AC_SUBST(PTHREAD_CFLAGS)
863 AC_SUBST(PTHREAD_LIBS)
865 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
866 # By default use the ones specified by our build system,
867 # but explicit override is possible.
868 AC_MSG_CHECKING(for explicit AFLAGS)
869 if test -n "$AFLAGS"; then
870     AC_MSG_RESULT([$AFLAGS])
871     x_AFLAGS=
872 else
873     AC_MSG_RESULT(no)
874     x_AFLAGS=[\#]
876 AC_MSG_CHECKING(for explicit CFLAGS)
877 if test -n "$CFLAGS"; then
878     AC_MSG_RESULT([$CFLAGS])
879     x_CFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_CFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit CXXFLAGS)
885 if test -n "$CXXFLAGS"; then
886     AC_MSG_RESULT([$CXXFLAGS])
887     x_CXXFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_CXXFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit OBJCFLAGS)
893 if test -n "$OBJCFLAGS"; then
894     AC_MSG_RESULT([$OBJCFLAGS])
895     x_OBJCFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_OBJCFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
901 if test -n "$OBJCXXFLAGS"; then
902     AC_MSG_RESULT([$OBJCXXFLAGS])
903     x_OBJCXXFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_OBJCXXFLAGS=[\#]
908 AC_MSG_CHECKING(for explicit LDFLAGS)
909 if test -n "$LDFLAGS"; then
910     AC_MSG_RESULT([$LDFLAGS])
911     x_LDFLAGS=
912 else
913     AC_MSG_RESULT(no)
914     x_LDFLAGS=[\#]
916 AC_SUBST(AFLAGS)
917 AC_SUBST(CFLAGS)
918 AC_SUBST(CXXFLAGS)
919 AC_SUBST(OBJCFLAGS)
920 AC_SUBST(OBJCXXFLAGS)
921 AC_SUBST(LDFLAGS)
922 AC_SUBST(x_AFLAGS)
923 AC_SUBST(x_CFLAGS)
924 AC_SUBST(x_CXXFLAGS)
925 AC_SUBST(x_OBJCFLAGS)
926 AC_SUBST(x_OBJCXXFLAGS)
927 AC_SUBST(x_LDFLAGS)
929 dnl These are potentially set for MSVC, in the code checking for UCRT below:
930 my_original_CFLAGS=$CFLAGS
931 my_original_CXXFLAGS=$CXXFLAGS
932 my_original_CPPFLAGS=$CPPFLAGS
934 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
935 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
936 dnl AC_PROG_CC internally.
937 if test "$_os" != "WINNT"; then
938     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
939     save_CFLAGS=$CFLAGS
940     AC_PROG_CC
941     CFLAGS=$save_CFLAGS
942     if test -z "$CC_BASE"; then
943         CC_BASE=`first_arg_basename "$CC"`
944     fi
947 if test "$_os" != "WINNT"; then
948     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
949 else
950     ENDIANNESS=little
952 AC_SUBST(ENDIANNESS)
954 if test $_os != "WINNT"; then
955     save_LIBS="$LIBS"
956     AC_SEARCH_LIBS([dlsym], [dl],
957         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
958         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
959     LIBS="$save_LIBS"
961 AC_SUBST(DLOPEN_LIBS)
963 AC_ARG_ENABLE(ios-simulator,
964     AS_HELP_STRING([--enable-ios-simulator],
965         [build i386 or x86_64 for ios simulator])
968 AC_ARG_ENABLE(ios-libreofficelight-app,
969     AS_HELP_STRING([--enable-ios-libreofficelight-app],
970         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
971          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
972          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
975 ENABLE_IOS_LIBREOFFICELIGHT_APP=
976 if test "$enable_ios_libreofficelight_app" = yes; then
977     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
979 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
981 ###############################################################################
982 # Extensions switches --enable/--disable
983 ###############################################################################
984 # By default these should be enabled unless having extra dependencies.
985 # If there is extra dependency over configure options then the enable should
986 # be automagic based on whether the requiring feature is enabled or not.
987 # All this options change anything only with --enable-extension-integration.
989 # The name of this option and its help string makes it sound as if
990 # extensions are built anyway, just not integrated in the installer,
991 # if you use --disable-extension-integration. Is that really the
992 # case?
994 libo_FUZZ_ARG_ENABLE(extension-integration,
995     AS_HELP_STRING([--disable-extension-integration],
996         [Disable integration of the built extensions in the installer of the
997          product. Use this switch to disable the integration.])
1000 AC_ARG_ENABLE(avmedia,
1001     AS_HELP_STRING([--disable-avmedia],
1002         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1005 AC_ARG_ENABLE(database-connectivity,
1006     AS_HELP_STRING([--disable-database-connectivity],
1007         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1010 # This doesn't mean not building (or "integrating") extensions
1011 # (although it probably should; i.e. it should imply
1012 # --disable-extension-integration I guess), it means not supporting
1013 # any extension mechanism at all
1014 libo_FUZZ_ARG_ENABLE(extensions,
1015     AS_HELP_STRING([--disable-extensions],
1016         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1019 AC_ARG_ENABLE(scripting,
1020     AS_HELP_STRING([--disable-scripting],
1021         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1024 # This is mainly for Android and iOS, but could potentially be used in some
1025 # special case otherwise, too, so factored out as a separate setting
1027 AC_ARG_ENABLE(dynamic-loading,
1028     AS_HELP_STRING([--disable-dynamic-loading],
1029         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1032 libo_FUZZ_ARG_ENABLE(report-builder,
1033     AS_HELP_STRING([--disable-report-builder],
1034         [Disable the Report Builder.])
1037 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1038     AS_HELP_STRING([--enable-ext-wiki-publisher],
1039         [Enable the Wiki Publisher extension.])
1042 libo_FUZZ_ARG_ENABLE(lpsolve,
1043     AS_HELP_STRING([--disable-lpsolve],
1044         [Disable compilation of the lp solve solver ])
1046 libo_FUZZ_ARG_ENABLE(coinmp,
1047     AS_HELP_STRING([--disable-coinmp],
1048         [Disable compilation of the CoinMP solver ])
1051 libo_FUZZ_ARG_ENABLE(pdfimport,
1052     AS_HELP_STRING([--disable-pdfimport],
1053         [Disable building the PDF import feature.])
1056 libo_FUZZ_ARG_ENABLE(pdfium,
1057     AS_HELP_STRING([--disable-pdfium],
1058         [Disable building PDFium.])
1061 ###############################################################################
1063 dnl ---------- *** ----------
1065 libo_FUZZ_ARG_ENABLE(mergelibs,
1066     AS_HELP_STRING([--enable-mergelibs],
1067         [Merge several of the smaller libraries into one big, "merged", one.])
1070 libo_FUZZ_ARG_ENABLE(breakpad,
1071     AS_HELP_STRING([--enable-breakpad],
1072         [Enables breakpad for crash reporting.])
1075 AC_ARG_ENABLE(fetch-external,
1076     AS_HELP_STRING([--disable-fetch-external],
1077         [Disables fetching external tarballs from web sources.])
1080 AC_ARG_ENABLE(fuzzers,
1081     AS_HELP_STRING([--enable-fuzzers],
1082         [Enables building libfuzzer targets for fuzz testing.])
1085 libo_FUZZ_ARG_ENABLE(pch,
1086     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1087         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1088          Using 'system' will include only external headers, 'base' will add also headers
1089          from base modules, 'normal' will also add all headers except from the module built,
1090          'full' will use all suitable headers even from a module itself.])
1093 libo_FUZZ_ARG_ENABLE(epm,
1094     AS_HELP_STRING([--enable-epm],
1095         [LibreOffice includes self-packaging code, that requires epm, however epm is
1096          useless for large scale package building.])
1099 libo_FUZZ_ARG_ENABLE(odk,
1100     AS_HELP_STRING([--disable-odk],
1101         [LibreOffice includes an ODK, office development kit which some packagers may
1102          wish to build without.])
1105 AC_ARG_ENABLE(mpl-subset,
1106     AS_HELP_STRING([--enable-mpl-subset],
1107         [Don't compile any pieces which are not MPL or more liberally licensed])
1110 libo_FUZZ_ARG_ENABLE(evolution2,
1111     AS_HELP_STRING([--enable-evolution2],
1112         [Allows the built-in evolution 2 addressbook connectivity build to be
1113          enabled.])
1116 AC_ARG_ENABLE(avahi,
1117     AS_HELP_STRING([--enable-avahi],
1118         [Determines whether to use Avahi to advertise Impress to remote controls.])
1121 libo_FUZZ_ARG_ENABLE(werror,
1122     AS_HELP_STRING([--enable-werror],
1123         [Turn warnings to errors. (Has no effect in modules where the treating
1124          of warnings as errors is disabled explicitly.)]),
1127 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1128     AS_HELP_STRING([--enable-assert-always-abort],
1129         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1132 libo_FUZZ_ARG_ENABLE(dbgutil,
1133     AS_HELP_STRING([--enable-dbgutil],
1134         [Provide debugging support from --enable-debug and include additional debugging
1135          utilities such as object counting or more expensive checks.
1136          This is the recommended option for developers.
1137          Note that this makes the build ABI incompatible, it is not possible to mix object
1138          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1140 libo_FUZZ_ARG_ENABLE(debug,
1141     AS_HELP_STRING([--enable-debug],
1142         [Include debugging information, disable compiler optimization and inlining plus
1143          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1145 libo_FUZZ_ARG_ENABLE(split-debug,
1146     AS_HELP_STRING([--disable-split-debug],
1147         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1148          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1150 libo_FUZZ_ARG_ENABLE(gdb-index,
1151     AS_HELP_STRING([--disable-gdb-index],
1152         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1153          The feature requires the gold or lld linker.]))
1155 libo_FUZZ_ARG_ENABLE(sal-log,
1156     AS_HELP_STRING([--enable-sal-log],
1157         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1159 libo_FUZZ_ARG_ENABLE(symbols,
1160     AS_HELP_STRING([--enable-symbols],
1161         [Generate debug information.
1162          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1163          otherwise. It is possible to explicitly specify gbuild build targets
1164          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1165          everything in the directory; there is no ordering, more specific overrides
1166          more general, and disabling takes precedence).
1167          Example: --enable-symbols="all -sw/ -Library_sc".]))
1169 libo_FUZZ_ARG_ENABLE(optimized,
1170     AS_HELP_STRING([--disable-optimized],
1171         [Whether to compile with optimization flags.
1172          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1173          otherwise.]))
1175 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1176     AS_HELP_STRING([--disable-runtime-optimizations],
1177         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1178          JVM JIT) that are known to interact badly with certain dynamic analysis
1179          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1180          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1181          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1183 AC_ARG_WITH(valgrind,
1184     AS_HELP_STRING([--with-valgrind],
1185         [Make availability of Valgrind headers a hard requirement.]))
1187 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1188     AS_HELP_STRING([--enable-compiler-plugins],
1189         [Enable compiler plugins that will perform additional checks during
1190          building. Enabled automatically by --enable-dbgutil.
1191          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1192 COMPILER_PLUGINS_DEBUG=
1193 if test "$enable_compiler_plugins" = debug; then
1194     enable_compiler_plugins=yes
1195     COMPILER_PLUGINS_DEBUG=TRUE
1198 libo_FUZZ_ARG_ENABLE(ooenv,
1199     AS_HELP_STRING([--disable-ooenv],
1200         [Disable ooenv for the instdir installation.]))
1202 libo_FUZZ_ARG_ENABLE(libnumbertext,
1203     AS_HELP_STRING([--disable-libnumbertext],
1204         [Disable use of numbertext external library.]))
1206 AC_ARG_ENABLE(lto,
1207     AS_HELP_STRING([--enable-lto],
1208         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1209          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1210          linker. For MSVC, this option is broken at the moment. This is experimental work
1211          in progress that shouldn't be used unless you are working on it.)]))
1213 AC_ARG_ENABLE(python,
1214     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1215         [Enables or disables Python support at run-time.
1216          Also specifies what Python to use. 'auto' is the default.
1217          'fully-internal' even forces the internal version for uses of Python
1218          during the build.]))
1220 libo_FUZZ_ARG_ENABLE(gtk,
1221     AS_HELP_STRING([--disable-gtk],
1222         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1223 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1225 libo_FUZZ_ARG_ENABLE(gtk3,
1226     AS_HELP_STRING([--disable-gtk3],
1227         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1228 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1230 AC_ARG_ENABLE(split-app-modules,
1231     AS_HELP_STRING([--enable-split-app-modules],
1232         [Split file lists for app modules, e.g. base, calc.
1233          Has effect only with make distro-pack-install]),
1236 AC_ARG_ENABLE(split-opt-features,
1237     AS_HELP_STRING([--enable-split-opt-features],
1238         [Split file lists for some optional features, e.g. pyuno, testtool.
1239          Has effect only with make distro-pack-install]),
1242 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1243     AS_HELP_STRING([--disable-cairo-canvas],
1244         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1247 libo_FUZZ_ARG_ENABLE(dbus,
1248     AS_HELP_STRING([--disable-dbus],
1249         [Determines whether to enable features that depend on dbus.
1250          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1251 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1253 libo_FUZZ_ARG_ENABLE(sdremote,
1254     AS_HELP_STRING([--disable-sdremote],
1255         [Determines whether to enable Impress remote control (i.e. the server component).]),
1256 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1258 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1259     AS_HELP_STRING([--disable-sdremote-bluetooth],
1260         [Determines whether to build sdremote with bluetooth support.
1261          Requires dbus on Linux.]))
1263 libo_FUZZ_ARG_ENABLE(gio,
1264     AS_HELP_STRING([--disable-gio],
1265         [Determines whether to use the GIO support.]),
1266 ,test "${enable_gio+set}" = set || enable_gio=yes)
1268 AC_ARG_ENABLE(qt5,
1269     AS_HELP_STRING([--enable-qt5],
1270         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1271          available.]),
1274 AC_ARG_ENABLE(kde5,
1275     AS_HELP_STRING([--enable-kde5],
1276         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1277          KF5 are available.]),
1280 AC_ARG_ENABLE(gtk3_kde5,
1281     AS_HELP_STRING([--enable-gtk3-kde5],
1282         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1283          platforms where Gtk3, Qt5 and Plasma is available.]),
1286 AC_ARG_ENABLE(gui,
1287     AS_HELP_STRING([--disable-gui],
1288         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1289          command-line option. Not related to LibreOffice Online functionality. Don't use
1290          unless you are certain you need to. Nobody will help you if you insist on trying
1291          this and run into problems.]),
1292 ,enable_gui=yes)
1294 libo_FUZZ_ARG_ENABLE(randr,
1295     AS_HELP_STRING([--disable-randr],
1296         [Disable RandR support in the vcl project.]),
1297 ,test "${enable_randr+set}" = set || enable_randr=yes)
1299 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1300     AS_HELP_STRING([--disable-gstreamer-1-0],
1301         [Disable building with the gstreamer 1.0 avmedia backend.]),
1302 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1304 libo_FUZZ_ARG_ENABLE(vlc,
1305     AS_HELP_STRING([--enable-vlc],
1306         [Enable building with the (experimental) VLC avmedia backend.]),
1307 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1309 libo_FUZZ_ARG_ENABLE(neon,
1310     AS_HELP_STRING([--disable-neon],
1311         [Disable neon and the compilation of webdav binding.]),
1314 libo_FUZZ_ARG_ENABLE([eot],
1315     [AS_HELP_STRING([--enable-eot],
1316         [Enable support for Embedded OpenType fonts.])],
1317 ,test "${enable_eot+set}" = set || enable_eot=no)
1319 libo_FUZZ_ARG_ENABLE(cve-tests,
1320     AS_HELP_STRING([--disable-cve-tests],
1321         [Prevent CVE tests to be executed]),
1324 libo_FUZZ_ARG_ENABLE(chart-tests,
1325     AS_HELP_STRING([--enable-chart-tests],
1326         [Executes chart XShape tests. In a perfect world these tests would be
1327          stable and everyone could run them, in reality it is best to run them
1328          only on a few machines that are known to work and maintained by people
1329          who can judge if a test failure is a regression or not.]),
1332 AC_ARG_ENABLE(build-unowinreg,
1333     AS_HELP_STRING([--enable-build-unowinreg],
1334         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1335          compiler is needed on Linux.]),
1338 AC_ARG_ENABLE(build-opensymbol,
1339     AS_HELP_STRING([--enable-build-opensymbol],
1340         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1341          fontforge installed.]),
1344 AC_ARG_ENABLE(dependency-tracking,
1345     AS_HELP_STRING([--enable-dependency-tracking],
1346         [Do not reject slow dependency extractors.])[
1347   --disable-dependency-tracking
1348                           Disables generation of dependency information.
1349                           Speed up one-time builds.],
1352 AC_ARG_ENABLE(icecream,
1353     AS_HELP_STRING([--enable-icecream],
1354         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1355          It defaults to /opt/icecream for the location of the icecream gcc/g++
1356          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1359 AC_ARG_ENABLE(ld,
1360     AS_HELP_STRING([--enable-ld=<linker>],
1361         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1362          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1365 libo_FUZZ_ARG_ENABLE(cups,
1366     AS_HELP_STRING([--disable-cups],
1367         [Do not build cups support.])
1370 AC_ARG_ENABLE(ccache,
1371     AS_HELP_STRING([--disable-ccache],
1372         [Do not try to use ccache automatically.
1373          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1374          CC/CXX are not yet set, and --enable-icecream is not given, we
1375          attempt to use ccache. --disable-ccache disables ccache completely.
1376          Additionally ccache's depend mode is enabled if possible,
1377          use --enable-ccache=nodepend to enable ccache without depend mode.
1381 AC_ARG_ENABLE(64-bit,
1382     AS_HELP_STRING([--enable-64-bit],
1383         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1384          At the moment meaningful only for Windows.]), ,)
1386 libo_FUZZ_ARG_ENABLE(online-update,
1387     AS_HELP_STRING([--enable-online-update],
1388         [Enable the online update service that will check for new versions of
1389          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1390          If the value is "mar", the experimental Mozilla-like update will be
1391          enabled instead of the traditional update mechanism.]),
1394 AC_ARG_WITH(update-config,
1395     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1396                    [Path to the update config ini file]))
1398 libo_FUZZ_ARG_ENABLE(extension-update,
1399     AS_HELP_STRING([--disable-extension-update],
1400         [Disable possibility to update installed extensions.]),
1403 libo_FUZZ_ARG_ENABLE(release-build,
1404     AS_HELP_STRING([--enable-release-build],
1405         [Enable release build. Note that the "release build" choice is orthogonal to
1406          whether symbols are present, debug info is generated, or optimization
1407          is done.
1408          See http://wiki.documentfoundation.org/Development/DevBuild]),
1411 AC_ARG_ENABLE(windows-build-signing,
1412     AS_HELP_STRING([--enable-windows-build-signing],
1413         [Enable signing of windows binaries (*.exe, *.dll)]),
1416 AC_ARG_ENABLE(silent-msi,
1417     AS_HELP_STRING([--enable-silent-msi],
1418         [Enable MSI with LIMITUI=1 (silent install).]),
1421 AC_ARG_ENABLE(macosx-code-signing,
1422     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1423         [Sign executables, dylibs, frameworks and the app bundle. If you
1424          don't provide an identity the first suitable certificate
1425          in your keychain is used.]),
1428 AC_ARG_ENABLE(macosx-package-signing,
1429     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1430         [Create a .pkg suitable for uploading to the Mac App Store and sign
1431          it. If you don't provide an identity the first suitable certificate
1432          in your keychain is used.]),
1435 AC_ARG_ENABLE(macosx-sandbox,
1436     AS_HELP_STRING([--enable-macosx-sandbox],
1437         [Make the app bundle run in a sandbox. Requires code signing.
1438          Is required by apps distributed in the Mac App Store, and implies
1439          adherence to App Store rules.]),
1442 AC_ARG_WITH(macosx-bundle-identifier,
1443     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1444         [Define the macOS bundle identifier. Default is the somewhat weird
1445          org.libreoffice.script ("script", huh?).]),
1446 ,with_macosx_bundle_identifier=org.libreoffice.script)
1448 AC_ARG_WITH(product-name,
1449     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1450         [Define the product name. Default is AC_PACKAGE_NAME.]),
1451 ,with_product_name=$PRODUCTNAME)
1453 AC_ARG_WITH(package-version,
1454     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1455         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1458 libo_FUZZ_ARG_ENABLE(readonly-installset,
1459     AS_HELP_STRING([--enable-readonly-installset],
1460         [Prevents any attempts by LibreOffice to write into its installation. That means
1461          at least that no "system-wide" extensions can be added. Partly experimental work in
1462          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1465 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1466     AS_HELP_STRING([--disable-postgresql-sdbc],
1467         [Disable the build of the PostgreSQL-SDBC driver.])
1470 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1471     AS_HELP_STRING([--disable-lotuswordpro],
1472         [Disable the build of the Lotus Word Pro filter.]),
1473 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1475 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1476     AS_HELP_STRING([--disable-firebird-sdbc],
1477         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1478 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1480 AC_ARG_ENABLE(bogus-pkg-config,
1481     AS_HELP_STRING([--enable-bogus-pkg-config],
1482         [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.]),
1485 AC_ARG_ENABLE(openssl,
1486     AS_HELP_STRING([--disable-openssl],
1487         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1488          components will either use GNUTLS or NSS. Work in progress,
1489          use only if you are hacking on it.]),
1490 ,enable_openssl=yes)
1492 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1493     AS_HELP_STRING([--enable-cipher-openssl-backend],
1494         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1495          Requires --enable-openssl.]))
1497 AC_ARG_ENABLE(library-bin-tar,
1498     AS_HELP_STRING([--enable-library-bin-tar],
1499         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1500         Some libraries can save their build result in a tarball
1501         stored in TARFILE_LOCATION. That binary tarball is
1502         uniquely identified by the source tarball,
1503         the content of the config_host.mk file and the content
1504         of the top-level directory in core for that library
1505         If this option is enabled, then if such a tarfile exist, it will be untarred
1506         instead of the source tarfile, and the build step will be skipped for that
1507         library.
1508         If a proper tarfile does not exist, then the normal source-based
1509         build is done for that library and a proper binary tarfile is created
1510         for the next time.]),
1513 AC_ARG_ENABLE(dconf,
1514     AS_HELP_STRING([--disable-dconf],
1515         [Disable the dconf configuration backend (enabled by default where
1516          available).]))
1518 libo_FUZZ_ARG_ENABLE(formula-logger,
1519     AS_HELP_STRING(
1520         [--enable-formula-logger],
1521         [Enable formula logger for logging formula calculation flow in Calc.]
1522     )
1525 AC_ARG_ENABLE(ldap,
1526     AS_HELP_STRING([--disable-ldap],
1527         [Disable LDAP support.]),
1528 ,enable_ldap=yes)
1530 dnl ===================================================================
1531 dnl Optional Packages (--with/without-)
1532 dnl ===================================================================
1534 AC_ARG_WITH(gcc-home,
1535     AS_HELP_STRING([--with-gcc-home],
1536         [Specify the location of gcc/g++ manually. This can be used in conjunction
1537          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1538          non-default path.]),
1541 AC_ARG_WITH(gnu-patch,
1542     AS_HELP_STRING([--with-gnu-patch],
1543         [Specify location of GNU patch on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(build-platform-configure-options,
1547     AS_HELP_STRING([--with-build-platform-configure-options],
1548         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1551 AC_ARG_WITH(gnu-cp,
1552     AS_HELP_STRING([--with-gnu-cp],
1553         [Specify location of GNU cp on Solaris or FreeBSD.]),
1556 AC_ARG_WITH(external-tar,
1557     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1558         [Specify an absolute path of where to find (and store) tarfiles.]),
1559     TARFILE_LOCATION=$withval ,
1562 AC_ARG_WITH(referenced-git,
1563     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1564         [Specify another checkout directory to reference. This makes use of
1565                  git submodule update --reference, and saves a lot of diskspace
1566                  when having multiple trees side-by-side.]),
1567     GIT_REFERENCE_SRC=$withval ,
1570 AC_ARG_WITH(linked-git,
1571     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1572         [Specify a directory where the repositories of submodules are located.
1573          This uses a method similar to git-new-workdir to get submodules.]),
1574     GIT_LINK_SRC=$withval ,
1577 AC_ARG_WITH(galleries,
1578     AS_HELP_STRING([--with-galleries],
1579         [Specify how galleries should be built. It is possible either to
1580          build these internally from source ("build"),
1581          or to disable them ("no")]),
1584 AC_ARG_WITH(theme,
1585     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1586         [Choose which themes to include. By default those themes with an '*' are included.
1587          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1588          *elementary_svg, *karasa_jaga, *sifr, *sif_svg, *sifr_dark, *tango.]),
1591 libo_FUZZ_ARG_WITH(helppack-integration,
1592     AS_HELP_STRING([--without-helppack-integration],
1593         [It will not integrate the helppacks to the installer
1594          of the product. Please use this switch to use the online help
1595          or separate help packages.]),
1598 libo_FUZZ_ARG_WITH(fonts,
1599     AS_HELP_STRING([--without-fonts],
1600         [LibreOffice includes some third-party fonts to provide a reliable basis for
1601          help content, templates, samples, etc. When these fonts are already
1602          known to be available on the system then you should use this option.]),
1605 AC_ARG_WITH(epm,
1606     AS_HELP_STRING([--with-epm],
1607         [Decides which epm to use. Default is to use the one from the system if
1608          one is built. When either this is not there or you say =internal epm
1609          will be built.]),
1612 AC_ARG_WITH(package-format,
1613     AS_HELP_STRING([--with-package-format],
1614         [Specify package format(s) for LibreOffice installation sets. The
1615          implicit --without-package-format leads to no installation sets being
1616          generated. Possible values: aix, archive, bsd, deb, dmg,
1617          installed, msi, pkg, and rpm.
1618          Example: --with-package-format='deb rpm']),
1621 AC_ARG_WITH(tls,
1622     AS_HELP_STRING([--with-tls],
1623         [Decides which TLS/SSL and cryptographic implementations to use for
1624          LibreOffice's code. Notice that this doesn't apply for depending
1625          libraries like "neon", for example. Default is to use OpenSSL
1626          although NSS is also possible. Notice that selecting NSS restricts
1627          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1628          restrict by now the usage of NSS in LO's code. Possible values:
1629          openssl, nss. Example: --with-tls="nss"]),
1632 AC_ARG_WITH(system-libs,
1633     AS_HELP_STRING([--with-system-libs],
1634         [Use libraries already on system -- enables all --with-system-* flags.]),
1637 AC_ARG_WITH(system-bzip2,
1638     AS_HELP_STRING([--with-system-bzip2],
1639         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1640     [with_system_bzip2="$with_system_libs"])
1642 AC_ARG_WITH(system-headers,
1643     AS_HELP_STRING([--with-system-headers],
1644         [Use headers already on system -- enables all --with-system-* flags for
1645          external packages whose headers are the only entities used i.e.
1646          boost/odbc/sane-header(s).]),,
1647     [with_system_headers="$with_system_libs"])
1649 AC_ARG_WITH(system-jars,
1650     AS_HELP_STRING([--without-system-jars],
1651         [When building with --with-system-libs, also the needed jars are expected
1652          on the system. Use this to disable that]),,
1653     [with_system_jars="$with_system_libs"])
1655 AC_ARG_WITH(system-cairo,
1656     AS_HELP_STRING([--with-system-cairo],
1657         [Use cairo libraries already on system.  Happens automatically for
1658          (implicit) --enable-gtk and for --enable-gtk3.]))
1660 AC_ARG_WITH(system-epoxy,
1661     AS_HELP_STRING([--with-system-epoxy],
1662         [Use epoxy libraries already on system.  Happens automatically for
1663          --enable-gtk3.]),,
1664        [with_system_epoxy="$with_system_libs"])
1666 AC_ARG_WITH(myspell-dicts,
1667     AS_HELP_STRING([--with-myspell-dicts],
1668         [Adds myspell dictionaries to the LibreOffice installation set]),
1671 AC_ARG_WITH(system-dicts,
1672     AS_HELP_STRING([--without-system-dicts],
1673         [Do not use dictionaries from system paths.]),
1676 AC_ARG_WITH(external-dict-dir,
1677     AS_HELP_STRING([--with-external-dict-dir],
1678         [Specify external dictionary dir.]),
1681 AC_ARG_WITH(external-hyph-dir,
1682     AS_HELP_STRING([--with-external-hyph-dir],
1683         [Specify external hyphenation pattern dir.]),
1686 AC_ARG_WITH(external-thes-dir,
1687     AS_HELP_STRING([--with-external-thes-dir],
1688         [Specify external thesaurus dir.]),
1691 AC_ARG_WITH(system-zlib,
1692     AS_HELP_STRING([--with-system-zlib],
1693         [Use zlib already on system.]),,
1694     [with_system_zlib=auto])
1696 AC_ARG_WITH(system-jpeg,
1697     AS_HELP_STRING([--with-system-jpeg],
1698         [Use jpeg already on system.]),,
1699     [with_system_jpeg="$with_system_libs"])
1701 AC_ARG_WITH(system-clucene,
1702     AS_HELP_STRING([--with-system-clucene],
1703         [Use clucene already on system.]),,
1704     [with_system_clucene="$with_system_libs"])
1706 AC_ARG_WITH(system-expat,
1707     AS_HELP_STRING([--with-system-expat],
1708         [Use expat already on system.]),,
1709     [with_system_expat="$with_system_libs"])
1711 AC_ARG_WITH(system-libxml,
1712     AS_HELP_STRING([--with-system-libxml],
1713         [Use libxml/libxslt already on system.]),,
1714     [with_system_libxml=auto])
1716 AC_ARG_WITH(system-icu,
1717     AS_HELP_STRING([--with-system-icu],
1718         [Use icu already on system.]),,
1719     [with_system_icu="$with_system_libs"])
1721 AC_ARG_WITH(system-ucpp,
1722     AS_HELP_STRING([--with-system-ucpp],
1723         [Use ucpp already on system.]),,
1724     [])
1726 AC_ARG_WITH(system-openldap,
1727     AS_HELP_STRING([--with-system-openldap],
1728         [Use the OpenLDAP LDAP SDK already on system.]),,
1729     [with_system_openldap="$with_system_libs"])
1731 libo_FUZZ_ARG_ENABLE(poppler,
1732     AS_HELP_STRING([--disable-poppler],
1733         [Disable building Poppler.])
1736 AC_ARG_WITH(system-poppler,
1737     AS_HELP_STRING([--with-system-poppler],
1738         [Use system poppler (only needed for PDF import).]),,
1739     [with_system_poppler="$with_system_libs"])
1741 AC_ARG_WITH(system-gpgmepp,
1742     AS_HELP_STRING([--with-system-gpgmepp],
1743         [Use gpgmepp already on system]),,
1744     [with_system_gpgmepp="$with_system_libs"])
1746 AC_ARG_WITH(system-apache-commons,
1747     AS_HELP_STRING([--with-system-apache-commons],
1748         [Use Apache commons libraries already on system.]),,
1749     [with_system_apache_commons="$with_system_jars"])
1751 AC_ARG_WITH(system-mariadb,
1752     AS_HELP_STRING([--with-system-mariadb],
1753         [Use MariaDB/MySQL libraries already on system.]),,
1754     [with_system_mariadb="$with_system_libs"])
1756 AC_ARG_ENABLE(bundle-mariadb,
1757     AS_HELP_STRING([--enable-bundle-mariadb],
1758         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1761 AC_ARG_WITH(system-postgresql,
1762     AS_HELP_STRING([--with-system-postgresql],
1763         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1764          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1765     [with_system_postgresql="$with_system_libs"])
1767 AC_ARG_WITH(libpq-path,
1768     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1769         [Use this PostgreSQL C interface (libpq) installation for building
1770          the PostgreSQL-SDBC extension.]),
1773 AC_ARG_WITH(system-firebird,
1774     AS_HELP_STRING([--with-system-firebird],
1775         [Use Firebird libraries already on system, for building the Firebird-SDBC
1776          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1777     [with_system_firebird="$with_system_libs"])
1779 AC_ARG_WITH(system-libtommath,
1780             AS_HELP_STRING([--with-system-libtommath],
1781                            [Use libtommath already on system]),,
1782             [with_system_libtommath="$with_system_libs"])
1784 AC_ARG_WITH(system-hsqldb,
1785     AS_HELP_STRING([--with-system-hsqldb],
1786         [Use hsqldb already on system.]))
1788 AC_ARG_WITH(hsqldb-jar,
1789     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1790         [Specify path to jarfile manually.]),
1791     HSQLDB_JAR=$withval)
1793 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1794     AS_HELP_STRING([--disable-scripting-beanshell],
1795         [Disable support for scripts in BeanShell.]),
1799 AC_ARG_WITH(system-beanshell,
1800     AS_HELP_STRING([--with-system-beanshell],
1801         [Use beanshell already on system.]),,
1802     [with_system_beanshell="$with_system_jars"])
1804 AC_ARG_WITH(beanshell-jar,
1805     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1806         [Specify path to jarfile manually.]),
1807     BSH_JAR=$withval)
1809 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1810     AS_HELP_STRING([--disable-scripting-javascript],
1811         [Disable support for scripts in JavaScript.]),
1815 AC_ARG_WITH(system-rhino,
1816     AS_HELP_STRING([--with-system-rhino],
1817         [Use rhino already on system.]),,)
1818 #    [with_system_rhino="$with_system_jars"])
1819 # Above is not used as we have different debug interface
1820 # patched into internal rhino. This code needs to be fixed
1821 # before we can enable it by default.
1823 AC_ARG_WITH(rhino-jar,
1824     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1825         [Specify path to jarfile manually.]),
1826     RHINO_JAR=$withval)
1828 AC_ARG_WITH(commons-logging-jar,
1829     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     COMMONS_LOGGING_JAR=$withval)
1833 AC_ARG_WITH(system-jfreereport,
1834     AS_HELP_STRING([--with-system-jfreereport],
1835         [Use JFreeReport already on system.]),,
1836     [with_system_jfreereport="$with_system_jars"])
1838 AC_ARG_WITH(sac-jar,
1839     AS_HELP_STRING([--with-sac-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     SAC_JAR=$withval)
1843 AC_ARG_WITH(libxml-jar,
1844     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1845         [Specify path to jarfile manually.]),
1846     LIBXML_JAR=$withval)
1848 AC_ARG_WITH(flute-jar,
1849     AS_HELP_STRING([--with-flute-jar=JARFILE],
1850         [Specify path to jarfile manually.]),
1851     FLUTE_JAR=$withval)
1853 AC_ARG_WITH(jfreereport-jar,
1854     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     JFREEREPORT_JAR=$withval)
1858 AC_ARG_WITH(liblayout-jar,
1859     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     LIBLAYOUT_JAR=$withval)
1863 AC_ARG_WITH(libloader-jar,
1864     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     LIBLOADER_JAR=$withval)
1868 AC_ARG_WITH(libformula-jar,
1869     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     LIBFORMULA_JAR=$withval)
1873 AC_ARG_WITH(librepository-jar,
1874     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBREPOSITORY_JAR=$withval)
1878 AC_ARG_WITH(libfonts-jar,
1879     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBFONTS_JAR=$withval)
1883 AC_ARG_WITH(libserializer-jar,
1884     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1885         [Specify path to jarfile manually.]),
1886     LIBSERIALIZER_JAR=$withval)
1888 AC_ARG_WITH(libbase-jar,
1889     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1890         [Specify path to jarfile manually.]),
1891     LIBBASE_JAR=$withval)
1893 AC_ARG_WITH(system-odbc,
1894     AS_HELP_STRING([--with-system-odbc],
1895         [Use the odbc headers already on system.]),,
1896     [with_system_odbc="auto"])
1898 AC_ARG_WITH(system-sane,
1899     AS_HELP_STRING([--with-system-sane],
1900         [Use sane.h already on system.]),,
1901     [with_system_sane="$with_system_headers"])
1903 AC_ARG_WITH(system-bluez,
1904     AS_HELP_STRING([--with-system-bluez],
1905         [Use bluetooth.h already on system.]),,
1906     [with_system_bluez="$with_system_headers"])
1908 AC_ARG_WITH(system-curl,
1909     AS_HELP_STRING([--with-system-curl],
1910         [Use curl already on system.]),,
1911     [with_system_curl=auto])
1913 AC_ARG_WITH(system-boost,
1914     AS_HELP_STRING([--with-system-boost],
1915         [Use boost already on system.]),,
1916     [with_system_boost="$with_system_headers"])
1918 AC_ARG_WITH(system-glm,
1919     AS_HELP_STRING([--with-system-glm],
1920         [Use glm already on system.]),,
1921     [with_system_glm="$with_system_headers"])
1923 AC_ARG_WITH(system-hunspell,
1924     AS_HELP_STRING([--with-system-hunspell],
1925         [Use libhunspell already on system.]),,
1926     [with_system_hunspell="$with_system_libs"])
1928 AC_ARG_WITH(system-qrcodegen,
1929     AS_HELP_STRING([--with-system-qrcodegen],
1930         [Use libqrcodegen already on system.]),,
1931     [with_system_qrcodegen="$with_system_libs"])
1933 AC_ARG_WITH(system-mythes,
1934     AS_HELP_STRING([--with-system-mythes],
1935         [Use mythes already on system.]),,
1936     [with_system_mythes="$with_system_libs"])
1938 AC_ARG_WITH(system-altlinuxhyph,
1939     AS_HELP_STRING([--with-system-altlinuxhyph],
1940         [Use ALTLinuxhyph already on system.]),,
1941     [with_system_altlinuxhyph="$with_system_libs"])
1943 AC_ARG_WITH(system-lpsolve,
1944     AS_HELP_STRING([--with-system-lpsolve],
1945         [Use lpsolve already on system.]),,
1946     [with_system_lpsolve="$with_system_libs"])
1948 AC_ARG_WITH(system-coinmp,
1949     AS_HELP_STRING([--with-system-coinmp],
1950         [Use CoinMP already on system.]),,
1951     [with_system_coinmp="$with_system_libs"])
1953 AC_ARG_WITH(system-liblangtag,
1954     AS_HELP_STRING([--with-system-liblangtag],
1955         [Use liblangtag library already on system.]),,
1956     [with_system_liblangtag="$with_system_libs"])
1958 AC_ARG_WITH(webdav,
1959     AS_HELP_STRING([--with-webdav],
1960         [Specify which library to use for webdav implementation.
1961          Possible values: "neon", "serf", "no". The default value is "neon".
1962          Example: --with-webdav="serf"]),
1963     WITH_WEBDAV=$withval,
1964     WITH_WEBDAV="neon")
1966 AC_ARG_WITH(linker-hash-style,
1967     AS_HELP_STRING([--with-linker-hash-style],
1968         [Use linker with --hash-style=<style> when linking shared objects.
1969          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1970          if supported on the build system, and "sysv" otherwise.]))
1972 AC_ARG_WITH(jdk-home,
1973     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1974         [If you have installed JDK 1.6 or later on your system please supply the
1975          path here. Note that this is not the location of the java command but the
1976          location of the entire distribution.]),
1979 AC_ARG_WITH(help,
1980     AS_HELP_STRING([--with-help],
1981         [Enable the build of help. There is a special parameter "common" that
1982          can be used to bundle only the common part, .e.g help-specific icons.
1983          This is useful when you build the helpcontent separately.])
1984     [
1985                           Usage:     --with-help    build the old local help
1986                                  --without-help     no local help (default)
1987                                  --with-help=html   build the new HTML local help
1988                                  --with-help=online build the new HTML online help
1989     ],
1992 libo_FUZZ_ARG_WITH(java,
1993     AS_HELP_STRING([--with-java=<java command>],
1994         [Specify the name of the Java interpreter command. Typically "java"
1995          which is the default.
1997          To build without support for Java components, applets, accessibility
1998          or the XML filters written in Java, use --without-java or --with-java=no.]),
1999     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2000     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2003 AC_ARG_WITH(jvm-path,
2004     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2005         [Use a specific JVM search path at runtime.
2006          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2009 AC_ARG_WITH(ant-home,
2010     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2011         [If you have installed Apache Ant on your system, please supply the path here.
2012          Note that this is not the location of the Ant binary but the location
2013          of the entire distribution.]),
2016 AC_ARG_WITH(symbol-config,
2017     AS_HELP_STRING([--with-symbol-config],
2018         [Configuration for the crashreport symbol upload]),
2019         [],
2020         [with_symbol_config=no])
2022 AC_ARG_WITH(export-validation,
2023     AS_HELP_STRING([--without-export-validation],
2024         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2025 ,with_export_validation=auto)
2027 AC_ARG_WITH(bffvalidator,
2028     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2029         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2030          Requires installed Microsoft Office Binary File Format Validator.
2031          Note: export-validation (--with-export-validation) is required to be turned on.
2032          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2033 ,with_bffvalidator=no)
2035 libo_FUZZ_ARG_WITH(junit,
2036     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2037         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2038          --without-junit disables those tests. Not relevant in the --without-java case.]),
2039 ,with_junit=yes)
2041 AC_ARG_WITH(hamcrest,
2042     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2043         [Specifies the hamcrest jar file to use for JUnit-based tests.
2044          --without-junit disables those tests. Not relevant in the --without-java case.]),
2045 ,with_hamcrest=yes)
2047 AC_ARG_WITH(perl-home,
2048     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2049         [If you have installed Perl 5 Distribution, on your system, please
2050          supply the path here. Note that this is not the location of the Perl
2051          binary but the location of the entire distribution.]),
2054 libo_FUZZ_ARG_WITH(doxygen,
2055     AS_HELP_STRING(
2056         [--with-doxygen=<absolute path to doxygen executable>],
2057         [Specifies the doxygen executable to use when generating ODK C/C++
2058          documentation. --without-doxygen disables generation of ODK C/C++
2059          documentation. Not relevant in the --disable-odk case.]),
2060 ,with_doxygen=yes)
2062 AC_ARG_WITH(visual-studio,
2063     AS_HELP_STRING([--with-visual-studio=<2017>],
2064         [Specify which Visual Studio version to use in case several are
2065          installed. Currently only 2017 is supported.]),
2068 AC_ARG_WITH(windows-sdk,
2069     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2070         [Specify which Windows SDK, or "Windows Kit", version to use
2071          in case the one that came with the selected Visual Studio
2072          is not what you want for some reason. Note that not all compiler/SDK
2073          combinations are supported. The intent is that this option should not
2074          be needed.]),
2077 AC_ARG_WITH(lang,
2078     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2079         [Use this option to build LibreOffice with additional UI language support.
2080          English (US) is always included by default.
2081          Separate multiple languages with space.
2082          For all languages, use --with-lang=ALL.]),
2085 AC_ARG_WITH(locales,
2086     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2087         [Use this option to limit the locale information built in.
2088          Separate multiple locales with space.
2089          Very experimental and might well break stuff.
2090          Just a desperate measure to shrink code and data size.
2091          By default all the locales available is included.
2092          This option is completely unrelated to --with-lang.])
2093     [
2094                           Affects also our character encoding conversion
2095                           tables for encodings mainly targeted for a
2096                           particular locale, like EUC-CN and EUC-TW for
2097                           zh, ISO-2022-JP for ja.
2099                           Affects also our add-on break iterator data for
2100                           some languages.
2102                           For the default, all locales, don't use this switch at all.
2103                           Specifying just the language part of a locale means all matching
2104                           locales will be included.
2105     ],
2108 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2109 libo_FUZZ_ARG_WITH(krb5,
2110     AS_HELP_STRING([--with-krb5],
2111         [Enable MIT Kerberos 5 support in modules that support it.
2112          By default automatically enabled on platforms
2113          where a good system Kerberos 5 is available.]),
2116 libo_FUZZ_ARG_WITH(gssapi,
2117     AS_HELP_STRING([--with-gssapi],
2118         [Enable GSSAPI support in modules that support it.
2119          By default automatically enabled on platforms
2120          where a good system GSSAPI is available.]),
2123 AC_ARG_WITH(iwyu,
2124     AS_HELP_STRING([--with-iwyu],
2125         [Use given IWYU binary path to check unneeded includes instead of building.
2126          Use only if you are hacking on it.]),
2129 libo_FUZZ_ARG_WITH(lxml,
2130     AS_HELP_STRING([--without-lxml],
2131         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2132          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2133          report widget classes and ids.]),
2136 dnl ===================================================================
2137 dnl Branding
2138 dnl ===================================================================
2140 AC_ARG_WITH(branding,
2141     AS_HELP_STRING([--with-branding=/path/to/images],
2142         [Use given path to retrieve branding images set.])
2143     [
2144                           Search for intro.png about.svg and flat_logo.svg.
2145                           If any is missing, default ones will be used instead.
2147                           Search also progress.conf for progress
2148                           settings on intro screen :
2150                           PROGRESSBARCOLOR="255,255,255" Set color of
2151                           progress bar. Comma separated RGB decimal values.
2152                           PROGRESSSIZE="407,6" Set size of progress bar.
2153                           Comma separated decimal values (width, height).
2154                           PROGRESSPOSITION="61,317" Set position of progress
2155                           bar from left,top. Comma separated decimal values.
2156                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2157                           bar frame. Comma separated RGB decimal values.
2158                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2159                           bar text. Comma separated RGB decimal values.
2160                           PROGRESSTEXTBASELINE="287" Set vertical position of
2161                           progress bar text from top. Decimal value.
2163                           Default values will be used if not found.
2164     ],
2168 AC_ARG_WITH(extra-buildid,
2169     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2170         [Show addition build identification in about dialog.]),
2174 AC_ARG_WITH(vendor,
2175     AS_HELP_STRING([--with-vendor="John the Builder"],
2176         [Set vendor of the build.]),
2179 AC_ARG_WITH(android-package-name,
2180     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2181         [Set Android package name of the build.]),
2184 AC_ARG_WITH(compat-oowrappers,
2185     AS_HELP_STRING([--with-compat-oowrappers],
2186         [Install oo* wrappers in parallel with
2187          lo* ones to keep backward compatibility.
2188          Has effect only with make distro-pack-install]),
2191 AC_ARG_WITH(os-version,
2192     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2193         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2196 AC_ARG_WITH(mingw-cross-compiler,
2197     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2198         [Specify the MinGW cross-compiler to use.
2199          When building on the ODK on Unix and building unowinreg.dll,
2200          specify the MinGW C++ cross-compiler.]),
2203 AC_ARG_WITH(idlc-cpp,
2204     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2205         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2208 AC_ARG_WITH(build-version,
2209     AS_HELP_STRING([--with-build-version="Built by Jim"],
2210         [Allows the builder to add a custom version tag that will appear in the
2211          Help/About box for QA purposes.]),
2212 with_build_version=$withval,
2215 AC_ARG_WITH(parallelism,
2216     AS_HELP_STRING([--with-parallelism],
2217         [Number of jobs to run simultaneously during build. Parallel builds can
2218         save a lot of time on multi-cpu machines. Defaults to the number of
2219         CPUs on the machine, unless you configure --enable-icecream - then to
2220         40.]),
2223 AC_ARG_WITH(all-tarballs,
2224     AS_HELP_STRING([--with-all-tarballs],
2225         [Download all external tarballs unconditionally]))
2227 AC_ARG_WITH(gdrive-client-id,
2228     AS_HELP_STRING([--with-gdrive-client-id],
2229         [Provides the client id of the application for OAuth2 authentication
2230         on Google Drive. If either this or --with-gdrive-client-secret is
2231         empty, the feature will be disabled]),
2234 AC_ARG_WITH(gdrive-client-secret,
2235     AS_HELP_STRING([--with-gdrive-client-secret],
2236         [Provides the client secret of the application for OAuth2
2237         authentication on Google Drive. If either this or
2238         --with-gdrive-client-id is empty, the feature will be disabled]),
2241 AC_ARG_WITH(alfresco-cloud-client-id,
2242     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2243         [Provides the client id of the application for OAuth2 authentication
2244         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2245         empty, the feature will be disabled]),
2248 AC_ARG_WITH(alfresco-cloud-client-secret,
2249     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2250         [Provides the client secret of the application for OAuth2
2251         authentication on Alfresco Cloud. If either this or
2252         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2255 AC_ARG_WITH(onedrive-client-id,
2256     AS_HELP_STRING([--with-onedrive-client-id],
2257         [Provides the client id of the application for OAuth2 authentication
2258         on OneDrive. If either this or --with-onedrive-client-secret is
2259         empty, the feature will be disabled]),
2262 AC_ARG_WITH(onedrive-client-secret,
2263     AS_HELP_STRING([--with-onedrive-client-secret],
2264         [Provides the client secret of the application for OAuth2
2265         authentication on OneDrive. If either this or
2266         --with-onedrive-client-id is empty, the feature will be disabled]),
2268 dnl ===================================================================
2269 dnl Do we want to use pre-build binary tarball for recompile
2270 dnl ===================================================================
2272 if test "$enable_library_bin_tar" = "yes" ; then
2273     USE_LIBRARY_BIN_TAR=TRUE
2274 else
2275     USE_LIBRARY_BIN_TAR=
2277 AC_SUBST(USE_LIBRARY_BIN_TAR)
2279 dnl ===================================================================
2280 dnl Test whether build target is Release Build
2281 dnl ===================================================================
2282 AC_MSG_CHECKING([whether build target is Release Build])
2283 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2284     AC_MSG_RESULT([no])
2285     ENABLE_RELEASE_BUILD=
2286 else
2287     AC_MSG_RESULT([yes])
2288     ENABLE_RELEASE_BUILD=TRUE
2290 AC_SUBST(ENABLE_RELEASE_BUILD)
2292 dnl ===================================================================
2293 dnl Test whether to sign Windows Build
2294 dnl ===================================================================
2295 AC_MSG_CHECKING([whether to sign windows build])
2296 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2297     AC_MSG_RESULT([yes])
2298     WINDOWS_BUILD_SIGNING="TRUE"
2299 else
2300     AC_MSG_RESULT([no])
2301     WINDOWS_BUILD_SIGNING="FALSE"
2303 AC_SUBST(WINDOWS_BUILD_SIGNING)
2305 dnl ===================================================================
2306 dnl MacOSX build and runtime environment options
2307 dnl ===================================================================
2309 AC_ARG_WITH(macosx-sdk,
2310     AS_HELP_STRING([--with-macosx-sdk=<version>],
2311         [Prefer a specific SDK for building.])
2312     [
2313                           If the requested SDK is not available, a search for the oldest one will be done.
2314                           With current Xcode versions, only the latest SDK is included, so this option is
2315                           not terribly useful. It works fine to build with a new SDK and run the result
2316                           on an older OS.
2318                           e. g.: --with-macosx-sdk=10.10
2320                           there are 3 options to control the MacOSX build:
2321                           --with-macosx-sdk (referred as 'sdk' below)
2322                           --with-macosx-version-min-required (referred as 'min' below)
2323                           --with-macosx-version-max-allowed (referred as 'max' below)
2325                           the connection between these value and the default they take is as follow:
2326                           ( ? means not specified on the command line, s means the SDK version found,
2327                           constraint: 8 <= x <= y <= z)
2329                           ==========================================
2330                            command line      || config result
2331                           ==========================================
2332                           min  | max  | sdk  || min   | max  | sdk  |
2333                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2334                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2335                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2336                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2337                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2338                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2339                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2340                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2343                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2344                           for a detailed technical explanation of these variables
2346                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2347     ],
2350 AC_ARG_WITH(macosx-version-min-required,
2351     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2352         [set the minimum OS version needed to run the built LibreOffice])
2353     [
2354                           e. g.: --with-macos-version-min-required=10.10
2355                           see --with-macosx-sdk for more info
2356     ],
2359 AC_ARG_WITH(macosx-version-max-allowed,
2360     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2361         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2362     [
2363                           e. g.: --with-macos-version-max-allowed=10.10
2364                           see --with-macosx-sdk for more info
2365     ],
2369 dnl ===================================================================
2370 dnl options for stuff used during cross-compilation build
2371 dnl Not quite superseded by --with-build-platform-configure-options.
2372 dnl TODO: check, if the "force" option is still needed anywhere.
2373 dnl ===================================================================
2375 AC_ARG_WITH(system-icu-for-build,
2376     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2377         [Use icu already on system for build tools (cross-compilation only).]))
2380 dnl ===================================================================
2381 dnl Check for incompatible options set by fuzzing, and reset those
2382 dnl automatically to working combinations
2383 dnl ===================================================================
2385 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2386         "$enable_dbus" != "$enable_avahi"; then
2387     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2388     enable_avahi=$enable_dbus
2391 add_lopath_after ()
2393     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2394         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2395     fi
2398 add_lopath_before ()
2400     local IFS=${P_SEP}
2401     local path_cleanup
2402     local dir
2403     for dir in $LO_PATH ; do
2404         if test "$dir" != "$1" ; then
2405             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2406         fi
2407     done
2408     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2411 dnl ===================================================================
2412 dnl check for required programs (grep, awk, sed, bash)
2413 dnl ===================================================================
2415 pathmunge ()
2417     if test -n "$1"; then
2418         if test "$build_os" = "cygwin"; then
2419             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2420                 PathFormat "$1"
2421                 new_path=`cygpath -sm "$formatted_path"`
2422             else
2423                 PathFormat "$1"
2424                 new_path=`cygpath -u "$formatted_path"`
2425             fi
2426         else
2427             new_path="$1"
2428         fi
2429         if test "$2" = "after"; then
2430             add_lopath_after "$new_path"
2431         else
2432             add_lopath_before "$new_path"
2433         fi
2434         unset new_path
2435     fi
2438 AC_PROG_AWK
2439 AC_PATH_PROG( AWK, $AWK)
2440 if test -z "$AWK"; then
2441     AC_MSG_ERROR([install awk to run this script])
2444 AC_PATH_PROG(BASH, bash)
2445 if test -z "$BASH"; then
2446     AC_MSG_ERROR([bash not found in \$PATH])
2448 AC_SUBST(BASH)
2450 AC_MSG_CHECKING([for GNU or BSD tar])
2451 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2452     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2453     if test $? -eq 0;  then
2454         GNUTAR=$a
2455         break
2456     fi
2457 done
2458 AC_MSG_RESULT($GNUTAR)
2459 if test -z "$GNUTAR"; then
2460     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2462 AC_SUBST(GNUTAR)
2464 AC_MSG_CHECKING([for tar's option to strip components])
2465 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2466 if test $? -eq 0; then
2467     STRIP_COMPONENTS="--strip-components"
2468 else
2469     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2470     if test $? -eq 0; then
2471         STRIP_COMPONENTS="--strip-path"
2472     else
2473         STRIP_COMPONENTS="unsupported"
2474     fi
2476 AC_MSG_RESULT($STRIP_COMPONENTS)
2477 if test x$STRIP_COMPONENTS = xunsupported; then
2478     AC_MSG_ERROR([you need a tar that is able to strip components.])
2480 AC_SUBST(STRIP_COMPONENTS)
2482 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2483 dnl desktop OSes from "mobile" ones.
2485 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2486 dnl In other words, that when building for an OS that is not a
2487 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2489 dnl Note the direction of the implication; there is no assumption that
2490 dnl cross-compiling would imply a non-desktop OS.
2492 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2493     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2494     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2495     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2498 # Whether to build "avmedia" functionality or not.
2500 if test -z "$enable_avmedia"; then
2501     enable_avmedia=yes
2504 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2505 if test "$enable_avmedia" = yes; then
2506     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2507 else
2508     USE_AVMEDIA_DUMMY='TRUE'
2510 AC_SUBST(USE_AVMEDIA_DUMMY)
2512 # Decide whether to build database connectivity stuff (including
2513 # Base) or not. We probably don't want to on non-desktop OSes.
2514 if test -z "$enable_database_connectivity"; then
2515     # --disable-database-connectivity is unfinished work in progress
2516     # and the iOS test app doesn't link if we actually try to use it.
2517     # if test $_os != iOS -a $_os != Android; then
2518     if test $_os != iOS; then
2519         enable_database_connectivity=yes
2520     fi
2523 if test "$enable_database_connectivity" = yes; then
2524     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2525     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2528 if test -z "$enable_extensions"; then
2529     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2530     if test $_os != iOS -a $_os != Android; then
2531         enable_extensions=yes
2532     fi
2535 if test "$enable_extensions" = yes; then
2536     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2537     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2540 if test -z "$enable_scripting"; then
2541     # Disable scripting for iOS unless specifically overridden
2542     # with --enable-scripting.
2543     if test $_os != iOS; then
2544         enable_scripting=yes
2545     fi
2548 DISABLE_SCRIPTING=''
2549 if test "$enable_scripting" = yes; then
2550     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2551     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2552 else
2553     DISABLE_SCRIPTING='TRUE'
2554     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2557 if test $_os = iOS -o $_os = Android; then
2558     # Disable dynamic_loading always for iOS and Android
2559     enable_dynamic_loading=no
2560 elif test -z "$enable_dynamic_loading"; then
2561     # Otherwise enable it unless specifically disabled
2562     enable_dynamic_loading=yes
2565 DISABLE_DYNLOADING=''
2566 if test "$enable_dynamic_loading" = yes; then
2567     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2568 else
2569     DISABLE_DYNLOADING='TRUE'
2571 AC_SUBST(DISABLE_DYNLOADING)
2573 # remember SYSBASE value
2574 AC_SUBST(SYSBASE)
2576 dnl ===================================================================
2577 dnl  Sort out various gallery compilation options
2578 dnl ===================================================================
2579 AC_MSG_CHECKING([how to build and package galleries])
2580 if test -n "${with_galleries}"; then
2581     if test "$with_galleries" = "build"; then
2582         WITH_GALLERY_BUILD=TRUE
2583         AC_MSG_RESULT([build from source images internally])
2584     elif test "$with_galleries" = "no"; then
2585         WITH_GALLERY_BUILD=
2586         AC_MSG_RESULT([disable non-internal gallery build])
2587     else
2588         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2589     fi
2590 else
2591     if test $_os != iOS -a $_os != Android; then
2592         WITH_GALLERY_BUILD=TRUE
2593         AC_MSG_RESULT([internal src images for desktop])
2594     else
2595         WITH_GALLERY_BUILD=
2596         AC_MSG_RESULT([disable src image build])
2597     fi
2599 AC_SUBST(WITH_GALLERY_BUILD)
2601 dnl ===================================================================
2602 dnl  Checks if ccache is available
2603 dnl ===================================================================
2604 CCACHE_DEPEND_MODE=
2605 if test "$_os" = "WINNT"; then
2606     # on windows/VC build do not use ccache
2607     CCACHE=""
2608 elif test "$enable_ccache" = "no"; then
2609     CCACHE=""
2610 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2611     case "%$CC%$CXX%" in
2612     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2613     # assume that's good then
2614     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2615         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2616         CCACHE_DEPEND_MODE=1
2617         ;;
2618     *)
2619         AC_PATH_PROG([CCACHE],[ccache],[not found])
2620         if test "$CCACHE" = "not found"; then
2621             CCACHE=""
2622         else
2623             CCACHE_DEPEND_MODE=1
2624             # Need to check for ccache version: otherwise prevents
2625             # caching of the results (like "-x objective-c++" for Mac)
2626             if test $_os = Darwin -o $_os = iOS; then
2627                 # Check ccache version
2628                 AC_MSG_CHECKING([whether version of ccache is suitable])
2629                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2630                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2631                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2632                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2633                 else
2634                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2635                     CCACHE=""
2636                     CCACHE_DEPEND_MODE=
2637                 fi
2638             fi
2639         fi
2640         ;;
2641     esac
2642 else
2643     CCACHE=""
2645 if test "$enable_ccache" = "nodepend"; then
2646     CCACHE_DEPEND_MODE=""
2648 AC_SUBST(CCACHE_DEPEND_MODE)
2650 if test "$CCACHE" != ""; then
2651     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2652     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2653     if test "$ccache_size" = ""; then
2654         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2655         if test "$ccache_size" = ""; then
2656             ccache_size=0
2657         fi
2658         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2659         if test $ccache_size -lt 1024; then
2660             CCACHE=""
2661             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2662             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2663         else
2664             # warn that ccache may be too small for debug build
2665             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2666             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2667         fi
2668     else
2669         if test $ccache_size -lt 5; then
2670             #warn that ccache may be too small for debug build
2671             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2672             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2673         fi
2674     fi
2677 dnl ===================================================================
2678 dnl  Checks for C compiler,
2679 dnl  The check for the C++ compiler is later on.
2680 dnl ===================================================================
2681 if test "$_os" != "WINNT"; then
2682     GCC_HOME_SET="true"
2683     AC_MSG_CHECKING([gcc home])
2684     if test -z "$with_gcc_home"; then
2685         if test "$enable_icecream" = "yes"; then
2686             if test -d "/usr/lib/icecc/bin"; then
2687                 GCC_HOME="/usr/lib/icecc/"
2688             elif test -d "/usr/libexec/icecc/bin"; then
2689                 GCC_HOME="/usr/libexec/icecc/"
2690             elif test -d "/opt/icecream/bin"; then
2691                 GCC_HOME="/opt/icecream/"
2692             else
2693                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2695             fi
2696         else
2697             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2698             GCC_HOME_SET="false"
2699         fi
2700     else
2701         GCC_HOME="$with_gcc_home"
2702     fi
2703     AC_MSG_RESULT($GCC_HOME)
2704     AC_SUBST(GCC_HOME)
2706     if test "$GCC_HOME_SET" = "true"; then
2707         if test -z "$CC"; then
2708             CC="$GCC_HOME/bin/gcc"
2709             CC_BASE="gcc"
2710         fi
2711         if test -z "$CXX"; then
2712             CXX="$GCC_HOME/bin/g++"
2713             CXX_BASE="g++"
2714         fi
2715     fi
2718 COMPATH=`dirname "$CC"`
2719 if test "$COMPATH" = "."; then
2720     AC_PATH_PROGS(COMPATH, $CC)
2721     dnl double square bracket to get single because of M4 quote...
2722     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2724 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2726 dnl ===================================================================
2727 dnl Java support
2728 dnl ===================================================================
2729 AC_MSG_CHECKING([whether to build with Java support])
2730 if test "$with_java" != "no"; then
2731     if test "$DISABLE_SCRIPTING" = TRUE; then
2732         AC_MSG_RESULT([no, overridden by --disable-scripting])
2733         ENABLE_JAVA=""
2734         with_java=no
2735     else
2736         AC_MSG_RESULT([yes])
2737         ENABLE_JAVA="TRUE"
2738         AC_DEFINE(HAVE_FEATURE_JAVA)
2739     fi
2740 else
2741     AC_MSG_RESULT([no])
2742     ENABLE_JAVA=""
2745 AC_SUBST(ENABLE_JAVA)
2747 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2749 dnl ENABLE_JAVA="" indicate no Java support at all
2751 dnl ===================================================================
2752 dnl Check macOS SDK and compiler
2753 dnl ===================================================================
2755 if test $_os = Darwin -o $_os = iOS; then
2757     # If no --with-macosx-sdk option is given, look for one
2759     # The intent is that for "most" Mac-based developers, a suitable
2760     # SDK will be found automatically without any configure options.
2762     # For developers with a current Xcode, the lowest-numbered SDK
2763     # higher than or equal to the minimum required should be found.
2765     AC_MSG_CHECKING([what macOS SDK to use])
2766     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2767         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2768         if test -d "$MACOSX_SDK_PATH"; then
2769             with_macosx_sdk="${_macosx_sdk}"
2770             break
2771         else
2772             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2773             if test -d "$MACOSX_SDK_PATH"; then
2774                 with_macosx_sdk="${_macosx_sdk}"
2775                 break
2776             fi
2777         fi
2778     done
2779     if test ! -d "$MACOSX_SDK_PATH"; then
2780         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2781     fi
2783     if test $_os = iOS; then
2784         if test "$enable_ios_simulator" = "yes"; then
2785             useos=iphonesimulator
2786         else
2787             useos=iphoneos
2788         fi
2789         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2790     fi
2791     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2794     case $with_macosx_sdk in
2795     10.12)
2796         MACOSX_SDK_VERSION=101200
2797         ;;
2798     10.13)
2799         MACOSX_SDK_VERSION=101300
2800         ;;
2801     10.14)
2802         MACOSX_SDK_VERSION=101400
2803         ;;
2804     10.15)
2805         MACOSX_SDK_VERSION=101500
2806         ;;
2807     *)
2808         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2809         ;;
2810     esac
2812     if test "$with_macosx_version_min_required" = "" ; then
2813         with_macosx_version_min_required="10.10";
2814     fi
2816     if test "$with_macosx_version_max_allowed" = "" ; then
2817         with_macosx_version_max_allowed="$with_macosx_sdk"
2818     fi
2820     # export this so that "xcrun" invocations later return matching values
2821     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2822     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2823     export DEVELOPER_DIR
2824     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2825     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2827     AC_MSG_CHECKING([whether Xcode is new enough])
2828     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2829     my_xcode_ver2=${my_xcode_ver1#Xcode }
2830     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2831     if test "$my_xcode_ver3" -ge 903; then
2832         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2833     else
2834         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2835     fi
2837     case "$with_macosx_version_min_required" in
2838     10.10)
2839         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2840         ;;
2841     10.11)
2842         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2843         ;;
2844     10.12)
2845         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2846         ;;
2847     10.13)
2848         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2849         ;;
2850     10.14)
2851         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2852         ;;
2853     10.15)
2854         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2855         ;;
2856     *)
2857         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2858         ;;
2859     esac
2860     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2862     LIBTOOL=/usr/bin/libtool
2863     INSTALL_NAME_TOOL=install_name_tool
2864     if test -z "$save_CC"; then
2865         stdlib=-stdlib=libc++
2866         if test "$ENABLE_LTO" = TRUE; then
2867             lto=-flto
2868         fi
2870         AC_MSG_CHECKING([what C compiler to use])
2871         CC="`xcrun -find clang`"
2872         CC_BASE=`first_arg_basename "$CC"`
2873         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2874         AC_MSG_RESULT([$CC])
2876         AC_MSG_CHECKING([what C++ compiler to use])
2877         CXX="`xcrun -find clang++`"
2878         CXX_BASE=`first_arg_basename "$CXX"`
2879         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2880         AC_MSG_RESULT([$CXX])
2882         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2883         AR=`xcrun -find ar`
2884         NM=`xcrun -find nm`
2885         STRIP=`xcrun -find strip`
2886         LIBTOOL=`xcrun -find libtool`
2887         RANLIB=`xcrun -find ranlib`
2888     fi
2890     case "$with_macosx_version_max_allowed" in
2891     10.10)
2892         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2893         ;;
2894     10.11)
2895         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2896         ;;
2897     10.12)
2898         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2899         ;;
2900     10.13)
2901         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2902         ;;
2903     10.14)
2904         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2905         ;;
2906     10.15)
2907         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2908         ;;
2909     *)
2910         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2911         ;;
2912     esac
2914     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2915     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2916         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])
2917     else
2918         AC_MSG_RESULT([ok])
2919     fi
2921     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2922     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2923         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2924     else
2925         AC_MSG_RESULT([ok])
2926     fi
2927     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2928     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2930     AC_MSG_CHECKING([whether to do code signing])
2932     if test "$enable_macosx_code_signing" = yes; then
2933         # By default use the first suitable certificate (?).
2935         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2936         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2937         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2938         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2939         # "Developer ID Application" one.
2941         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2942         if test -n "$identity"; then
2943             MACOSX_CODESIGNING_IDENTITY=$identity
2944             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2945             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2946         else
2947             AC_MSG_ERROR([cannot determine identity to use])
2948         fi
2949     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2950         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2951         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2952         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2953     else
2954         AC_MSG_RESULT([no])
2955     fi
2957     AC_MSG_CHECKING([whether to create a Mac App Store package])
2959     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2960         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2961     elif test "$enable_macosx_package_signing" = yes; then
2962         # By default use the first suitable certificate.
2963         # It should be a "3rd Party Mac Developer Installer" one
2965         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2966         if test -n "$identity"; then
2967             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2968             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2969             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2970         else
2971             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2972         fi
2973     elif test -n "$enable_macosx_package_signing"; then
2974         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2975         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2976         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2977     else
2978         AC_MSG_RESULT([no])
2979     fi
2981     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2982         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2983     fi
2985     AC_MSG_CHECKING([whether to sandbox the application])
2987     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2988         AC_MSG_ERROR([macOS sandboxing requires code signing])
2989     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2990         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2991     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2992         ENABLE_MACOSX_SANDBOX=TRUE
2993         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2994         AC_MSG_RESULT([yes])
2995     else
2996         AC_MSG_RESULT([no])
2997     fi
2999     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3000     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3001     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3003 AC_SUBST(MACOSX_SDK_PATH)
3004 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3005 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3006 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3007 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3008 AC_SUBST(INSTALL_NAME_TOOL)
3009 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3010 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3011 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3012 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3013 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3015 dnl ===================================================================
3016 dnl Check iOS SDK and compiler
3017 dnl ===================================================================
3019 if test $_os = iOS; then
3020     AC_MSG_CHECKING([what iOS SDK to use])
3021     current_sdk_ver=12.2
3022     older_sdk_vers="13.0 12.1 12.0 11.4"
3023     if test "$enable_ios_simulator" = "yes"; then
3024         platform=iPhoneSimulator
3025         versionmin=-mios-simulator-version-min=11.0
3026     else
3027         platform=iPhoneOS
3028         versionmin=-miphoneos-version-min=11.0
3029     fi
3030     xcode_developer=`xcode-select -print-path`
3032     for sdkver in $current_sdk_ver $older_sdk_vers; do
3033         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3034         if test -d $t; then
3035             sysroot=$t
3036             break
3037         fi
3038     done
3040     if test -z "$sysroot"; then
3041         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3042     fi
3044     AC_MSG_RESULT($sysroot)
3046     # LTO is not really recommended for iOS builds,
3047     # the link time will be astronomical
3048     if test "$ENABLE_LTO" = TRUE; then
3049         lto=-flto
3050     fi
3052     stdlib="-stdlib=libc++"
3054     AC_MSG_CHECKING([what C compiler to use])
3055     CC="`xcrun -find clang`"
3056     CC_BASE=`first_arg_basename "$CC"`
3057     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3058     AC_MSG_RESULT([$CC])
3060     AC_MSG_CHECKING([what C++ compiler to use])
3061     CXX="`xcrun -find clang++`"
3062     CXX_BASE=`first_arg_basename "$CXX"`
3063     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3064     AC_MSG_RESULT([$CXX])
3066     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3067     AR=`xcrun -find ar`
3068     NM=`xcrun -find nm`
3069     STRIP=`xcrun -find strip`
3070     LIBTOOL=`xcrun -find libtool`
3071     RANLIB=`xcrun -find ranlib`
3074 AC_MSG_CHECKING([whether to treat the installation as read-only])
3076 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3077         "$enable_extensions" != yes; then
3078     enable_readonly_installset=yes
3080 if test "$enable_readonly_installset" = yes; then
3081     AC_MSG_RESULT([yes])
3082     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3083 else
3084     AC_MSG_RESULT([no])
3087 dnl ===================================================================
3088 dnl Structure of install set
3089 dnl ===================================================================
3091 if test $_os = Darwin; then
3092     LIBO_BIN_FOLDER=MacOS
3093     LIBO_ETC_FOLDER=Resources
3094     LIBO_LIBEXEC_FOLDER=MacOS
3095     LIBO_LIB_FOLDER=Frameworks
3096     LIBO_LIB_PYUNO_FOLDER=Resources
3097     LIBO_SHARE_FOLDER=Resources
3098     LIBO_SHARE_HELP_FOLDER=Resources/help
3099     LIBO_SHARE_JAVA_FOLDER=Resources/java
3100     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3101     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3102     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3103     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3104     LIBO_URE_BIN_FOLDER=MacOS
3105     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3106     LIBO_URE_LIB_FOLDER=Frameworks
3107     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3108     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3109 elif test $_os = WINNT; then
3110     LIBO_BIN_FOLDER=program
3111     LIBO_ETC_FOLDER=program
3112     LIBO_LIBEXEC_FOLDER=program
3113     LIBO_LIB_FOLDER=program
3114     LIBO_LIB_PYUNO_FOLDER=program
3115     LIBO_SHARE_FOLDER=share
3116     LIBO_SHARE_HELP_FOLDER=help
3117     LIBO_SHARE_JAVA_FOLDER=program/classes
3118     LIBO_SHARE_PRESETS_FOLDER=presets
3119     LIBO_SHARE_READMES_FOLDER=readmes
3120     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3121     LIBO_SHARE_SHELL_FOLDER=program/shell
3122     LIBO_URE_BIN_FOLDER=program
3123     LIBO_URE_ETC_FOLDER=program
3124     LIBO_URE_LIB_FOLDER=program
3125     LIBO_URE_MISC_FOLDER=program
3126     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3127 else
3128     LIBO_BIN_FOLDER=program
3129     LIBO_ETC_FOLDER=program
3130     LIBO_LIBEXEC_FOLDER=program
3131     LIBO_LIB_FOLDER=program
3132     LIBO_LIB_PYUNO_FOLDER=program
3133     LIBO_SHARE_FOLDER=share
3134     LIBO_SHARE_HELP_FOLDER=help
3135     LIBO_SHARE_JAVA_FOLDER=program/classes
3136     LIBO_SHARE_PRESETS_FOLDER=presets
3137     LIBO_SHARE_READMES_FOLDER=readmes
3138     if test "$enable_fuzzers" != yes; then
3139         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3140     else
3141         LIBO_SHARE_RESOURCE_FOLDER=resource
3142     fi
3143     LIBO_SHARE_SHELL_FOLDER=program/shell
3144     LIBO_URE_BIN_FOLDER=program
3145     LIBO_URE_ETC_FOLDER=program
3146     LIBO_URE_LIB_FOLDER=program
3147     LIBO_URE_MISC_FOLDER=program
3148     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3150 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3151 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3154 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3155 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3156 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3157 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3158 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3159 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3160 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3161 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3167 # Not all of them needed in config_host.mk, add more if need arises
3168 AC_SUBST(LIBO_BIN_FOLDER)
3169 AC_SUBST(LIBO_ETC_FOLDER)
3170 AC_SUBST(LIBO_LIB_FOLDER)
3171 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3172 AC_SUBST(LIBO_SHARE_FOLDER)
3173 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3174 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3175 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3176 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3177 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3178 AC_SUBST(LIBO_URE_BIN_FOLDER)
3179 AC_SUBST(LIBO_URE_ETC_FOLDER)
3180 AC_SUBST(LIBO_URE_LIB_FOLDER)
3181 AC_SUBST(LIBO_URE_MISC_FOLDER)
3182 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3184 dnl ===================================================================
3185 dnl Windows specific tests and stuff
3186 dnl ===================================================================
3188 reg_get_value()
3190     # Return value: $regvalue
3191     unset regvalue
3193     local _regentry="/proc/registry${1}/${2}"
3194     if test -f "$_regentry"; then
3195         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3196         # Registry keys read via /proc/registry* are always \0 terminated!
3197         local _regvalue=$(tr -d '\0' < "$_regentry")
3198         if test $? -eq 0; then
3199             regvalue=$_regvalue
3200         fi
3201     fi
3204 # Get a value from the 32-bit side of the Registry
3205 reg_get_value_32()
3207     reg_get_value "32" "$1"
3210 # Get a value from the 64-bit side of the Registry
3211 reg_get_value_64()
3213     reg_get_value "64" "$1"
3216 if test "$_os" = "WINNT"; then
3217     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3218     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3219         AC_MSG_RESULT([no])
3220         WINDOWS_SDK_ARCH="x86"
3221     else
3222         AC_MSG_RESULT([yes])
3223         WINDOWS_SDK_ARCH="x64"
3224         BITNESS_OVERRIDE=64
3225     fi
3227 if test "$_os" = "iOS"; then
3228     cross_compiling="yes"
3231 if test "$cross_compiling" = "yes"; then
3232     export CROSS_COMPILING=TRUE
3233 else
3234     CROSS_COMPILING=
3235     BUILD_TYPE="$BUILD_TYPE NATIVE"
3237 AC_SUBST(CROSS_COMPILING)
3239 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3240 # NOTE: must _not_ be used for bundled external libraries!
3241 ISYSTEM=
3242 if test "$GCC" = "yes"; then
3243     AC_MSG_CHECKING( for -isystem )
3244     save_CFLAGS=$CFLAGS
3245     CFLAGS="$CFLAGS -Werror"
3246     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3247     CFLAGS=$save_CFLAGS
3248     if test -n "$ISYSTEM"; then
3249         AC_MSG_RESULT(yes)
3250     else
3251         AC_MSG_RESULT(no)
3252     fi
3254 if test -z "$ISYSTEM"; then
3255     # fall back to using -I
3256     ISYSTEM=-I
3258 AC_SUBST(ISYSTEM)
3260 dnl ===================================================================
3261 dnl  Check which Visual Studio compiler is used
3262 dnl ===================================================================
3264 map_vs_year_to_version()
3266     # Return value: $vsversion
3268     unset vsversion
3270     case $1 in
3271     2017)
3272         vsversion=15;;
3273     2019)
3274         vsversion=16;;
3275     *)
3276         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3277     esac
3280 vs_versions_to_check()
3282     # Args: $1 (optional) : versions to check, in the order of preference
3283     # Return value: $vsversions
3285     unset vsversions
3287     if test -n "$1"; then
3288         map_vs_year_to_version "$1"
3289         vsversions=$vsversion
3290     else
3291         # We accept only 2017
3292         vsversions="15"
3293     fi
3296 win_get_env_from_vsvars32bat()
3298     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3299     # Also seems to be located in another directory under the same name: vsvars32.bat
3300     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3301     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3302     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3303     chmod +x $WRAPPERBATCHFILEPATH
3304     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3305     rm -f $WRAPPERBATCHFILEPATH
3306     printf '%s' "$_win_get_env_from_vsvars32bat"
3309 find_ucrt()
3311     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3312     if test -n "$regvalue"; then
3313         PathFormat "$regvalue"
3314         UCRTSDKDIR=$formatted_path
3315         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3316         UCRTVERSION=$regvalue
3317         # Rest if not exist
3318         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3319           UCRTSDKDIR=
3320         fi
3321     fi
3322     if test -z "$UCRTSDKDIR"; then
3323         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3324         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3325         if test -f "$ide_env_file"; then
3326             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3327             UCRTSDKDIR=$formatted_path
3328             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3329             dnl Hack needed at least by tml:
3330             if test "$UCRTVERSION" = 10.0.15063.0 \
3331                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3332                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3333             then
3334                 UCRTVERSION=10.0.14393.0
3335             fi
3336         else
3337           AC_MSG_ERROR([No UCRT found])
3338         fi
3339     fi
3342 find_msvc()
3344     # Find Visual C++ 2017/2019
3345     # Args: $1 (optional) : The VS version year
3346     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3348     unset vctest vcnum vcnumwithdot vcbuildnumber
3350     vs_versions_to_check "$1"
3351     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3352     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3353     PathFormat "$vswhere"
3354     vswhere=$formatted_path
3355     for ver in $vsversions; do
3356         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3357         if test -n "$vswhereoutput"; then
3358             PathFormat "$vswhereoutput"
3359             vctest=$formatted_path
3360             break
3361         fi
3362     done
3364     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3365     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3366     # should be removed when upgrading baseline.
3367     if ! test -n "$vctest"; then
3368         for ver in $vsversions; do
3369             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3370             if test -n "$regvalue"; then
3371                 vctest=$regvalue
3372                 break
3373             fi
3374             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3375             if test -n "$regvalue"; then
3376                 AC_MSG_RESULT([found: $regvalue])
3377                 PathFormat "$regvalue"
3378                 vctest=$formatted_path
3379                 break
3380             fi
3381         done
3382     fi
3384     if test -n "$vctest"; then
3385         vcnumwithdot="$ver.0"
3386         case "$vcnumwithdot" in
3387         15.0)
3388             vcyear=2017
3389             vcnum=150
3390             ;;
3391         16.0)
3392             vcyear=2019
3393             vcnum=160
3394             ;;
3395         esac
3396         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3398     fi
3401 SOLARINC=
3402 MSBUILD_PATH=
3403 DEVENV=
3404 if test "$_os" = "WINNT"; then
3405     AC_MSG_CHECKING([Visual C++])
3406     find_msvc "$with_visual_studio"
3407     if test -z "$vctest"; then
3408         if test -n "$with_visual_studio"; then
3409             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3410         else
3411             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3412         fi
3413     fi
3415     if test "$BITNESS_OVERRIDE" = ""; then
3416         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3417             VC_PRODUCT_DIR=$vctest/VC
3418         else
3419             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3420         fi
3421     else
3422         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3423             VC_PRODUCT_DIR=$vctest/VC
3424         else
3425             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3426         fi
3427     fi
3428     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3430     AC_MSG_CHECKING([for short pathname of VC product directory])
3431     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3432     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3434     UCRTSDKDIR=
3435     UCRTVERSION=
3437     AC_MSG_CHECKING([for UCRT location])
3438     find_ucrt
3439     # find_ucrt errors out if it doesn't find it
3440     AC_MSG_RESULT([found])
3441     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3442     ucrtincpath_formatted=$formatted_path
3443     # SOLARINC is used for external modules and must be set too.
3444     # And no, it's not sufficient to set SOLARINC only, as configure
3445     # itself doesn't honour it.
3446     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3447     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3448     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3449     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3451     AC_SUBST(UCRTSDKDIR)
3452     AC_SUBST(UCRTVERSION)
3454     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3455     # Find the proper version of MSBuild.exe to use based on the VS version
3456     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3457     if test -n "$regvalue" ; then
3458         AC_MSG_RESULT([found: $regvalue])
3459         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3460     else
3461         if test "$vcnumwithdot" = "16.0"; then
3462             if test "$BITNESS_OVERRIDE" = ""; then
3463                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3464             else
3465                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3466             fi
3467         else
3468             if test "$BITNESS_OVERRIDE" = ""; then
3469                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3470             else
3471                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3472             fi
3473         fi
3474         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3475         AC_MSG_RESULT([$regvalue])
3476     fi
3478     # Find the version of devenv.exe
3479     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3480     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3481     if test ! -e "$DEVENV"; then
3482         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3483     fi
3485     dnl ===========================================================
3486     dnl  Check for the corresponding mspdb*.dll
3487     dnl ===========================================================
3489     VC_HOST_DIR=
3490     MSPDB_PATH=
3491     CL_PATH=
3493     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3494         VC_HOST_DIR="HostX64"
3495         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3496     else
3497         VC_HOST_DIR="HostX86"
3498         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3499     fi
3501     if test "$BITNESS_OVERRIDE" = ""; then
3502         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3503     else
3504         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3505     fi
3507     # MSVC 15.0 has libraries from 14.0?
3508     mspdbnum="140"
3510     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3511         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3512     fi
3514     dnl The path needs to be added before cl is called
3515     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3516     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3518     AC_MSG_CHECKING([cl.exe])
3520     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3521     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3522     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3523     # is not enough?
3525     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3526     dnl needed when building CLR code:
3527     if test -z "$MSVC_CXX"; then
3528         if test -f "$CL_PATH/cl.exe"; then
3529             MSVC_CXX="$CL_PATH/cl.exe"
3530         fi
3532         # This gives us a posix path with 8.3 filename restrictions
3533         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3534         CXX_BASE=`first_arg_basename "$MSVC_CXX"`
3535     fi
3537     if test -z "$CC"; then
3538         CC=$MSVC_CXX
3539         CC_BASE=`first_arg_basename "$CC"`
3540     fi
3541     if test "$BITNESS_OVERRIDE" = ""; then
3542         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3543         MSVC_CXX="$MSVC_CXX -arch:SSE"
3544     fi
3546     if test -n "$CC"; then
3547         # Remove /cl.exe from CC case insensitive
3548         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3549         if test "$BITNESS_OVERRIDE" = ""; then
3550            COMPATH="$VC_PRODUCT_DIR"
3551         else
3552             if test -n "$VC_PRODUCT_DIR"; then
3553                 COMPATH=$VC_PRODUCT_DIR
3554             fi
3555         fi
3556         if test "$BITNESS_OVERRIDE" = ""; then
3557             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3558             CC="$CC -arch:SSE"
3559         fi
3561         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3563         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3565         PathFormat "$COMPATH"
3566         COMPATH=`win_short_path_for_make "$formatted_path"`
3568         VCVER=$vcnum
3569         MSVSVER=$vcyear
3571         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3572         # are always "better", we list them in reverse chronological order.
3574         case "$vcnum" in
3575         150|160)
3576             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3577             ;;
3578         esac
3580         # The expectation is that --with-windows-sdk should not need to be used
3581         if test -n "$with_windows_sdk"; then
3582             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3583             *" "$with_windows_sdk" "*)
3584                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3585                 ;;
3586             *)
3587                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3588                 ;;
3589             esac
3590         fi
3592         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3593         ac_objext=obj
3594         ac_exeext=exe
3596     else
3597         AC_MSG_ERROR([Visual C++ not found after all, huh])
3598     fi
3600     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3601     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3602         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3603         // between Visual Studio versions and _MSC_VER:
3604         #if _MSC_VER < 1914
3605         #error
3606         #endif
3607     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3609     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3610     # version of the Explorer extension (and maybe other small
3611     # bits, too) needed when installing a 32-bit LibreOffice on a
3612     # 64-bit OS. The 64-bit Explorer extension is a feature that
3613     # has been present since long in OOo. Don't confuse it with
3614     # building LibreOffice itself as 64-bit code.
3616     BUILD_X64=
3617     CXX_X64_BINARY=
3619     if test "$BITNESS_OVERRIDE" = ""; then
3620         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3621         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3622              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3623             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3624                 BUILD_X64=TRUE
3625                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3626             fi
3627         fi
3628         if test "$BUILD_X64" = TRUE; then
3629             AC_MSG_RESULT([found])
3630         else
3631             AC_MSG_RESULT([not found])
3632             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3633         fi
3634     else
3635         CXX_X64_BINARY=$MSVC_CXX
3636     fi
3637     AC_SUBST(BUILD_X64)
3639     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3640     AC_SUBST(CXX_X64_BINARY)
3642     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3643     # needed to support TWAIN scan on both 32- and 64-bit systems
3645     BUILD_X86=
3647     if test "$BITNESS_OVERRIDE" = "64"; then
3648         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3649         if test -n "$CXX_X86_BINARY"; then
3650             BUILD_X86=TRUE
3651             AC_MSG_RESULT([preset])
3652         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3653             BUILD_X86=TRUE
3654             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3655             CXX_X86_BINARY+=" /arch:SSE"
3656             AC_MSG_RESULT([found])
3657         else
3658             CXX_X86_BINARY=
3659             AC_MSG_RESULT([not found])
3660             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3661         fi
3662     else
3663         BUILD_X86=TRUE
3664         CXX_X86_BINARY=$MSVC_CXX
3665     fi
3666     AC_SUBST(BUILD_X86)
3667     AC_SUBST(CXX_X86_BINARY)
3669 AC_SUBST(VCVER)
3670 AC_SUBST(DEVENV)
3671 AC_SUBST(MSVC_CXX)
3674 # unowinreg.dll
3676 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3677 AC_SUBST(UNOWINREG_DLL)
3679 COM_IS_CLANG=
3680 AC_MSG_CHECKING([whether the compiler is actually Clang])
3681 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3682     #ifndef __clang__
3683     you lose
3684     #endif
3685     int foo=42;
3686     ]])],
3687     [AC_MSG_RESULT([yes])
3688      COM_IS_CLANG=TRUE],
3689     [AC_MSG_RESULT([no])])
3690 AC_SUBST(COM_IS_CLANG)
3692 CC_PLAIN=$CC
3693 CLANGVER=
3694 if test "$COM_IS_CLANG" = TRUE; then
3695     AC_MSG_CHECKING([whether Clang is new enough])
3696     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3697         #if !defined __apple_build_version__
3698         #error
3699         #endif
3700         ]])],
3701         [my_apple_clang=yes],[my_apple_clang=])
3702     if test "$my_apple_clang" = yes; then
3703         AC_MSG_RESULT([assumed yes (Apple Clang)])
3704     else
3705         if test "$_os" = WINNT; then
3706             dnl In which case, assume clang-cl:
3707             my_args="/EP /TC"
3708             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3709             dnl clang-cl:
3710             CC_PLAIN=
3711             for i in $CC; do
3712                 case $i in
3713                 -FIIntrin.h)
3714                     ;;
3715                 *)
3716                     CC_PLAIN="$CC_PLAIN $i"
3717                     ;;
3718                 esac
3719             done
3720         else
3721             my_args="-E -P"
3722         fi
3723         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3724         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3725         CLANGVER=`echo $clang_version \
3726             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3727         if test "$CLANGVER" -ge 50002; then
3728             AC_MSG_RESULT([yes ($clang_version)])
3729         else
3730             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3731         fi
3732         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3733         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3734     fi
3737 SHOWINCLUDES_PREFIX=
3738 if test "$_os" = WINNT; then
3739     dnl We need to guess the prefix of the -showIncludes output, it can be
3740     dnl localized
3741     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3742     echo "#include <stdlib.h>" > conftest.c
3743     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3744         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3745     rm -f conftest.c conftest.obj
3746     if test -z "$SHOWINCLUDES_PREFIX"; then
3747         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3748     else
3749         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3750     fi
3752 AC_SUBST(SHOWINCLUDES_PREFIX)
3755 # prefix C with ccache if needed
3757 if test "$CCACHE" != ""; then
3758     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3760     AC_LANG_PUSH([C])
3761     save_CFLAGS=$CFLAGS
3762     CFLAGS="$CFLAGS --ccache-skip -O2"
3763     dnl an empty program will do, we're checking the compiler flags
3764     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3765                       [use_ccache=yes], [use_ccache=no])
3766     if test $use_ccache = yes; then
3767         AC_MSG_RESULT([yes])
3768     else
3769         CC="$CCACHE $CC"
3770         CC_BASE="ccache $CC_BASE"
3771         AC_MSG_RESULT([no])
3772     fi
3773     CFLAGS=$save_CFLAGS
3774     AC_LANG_POP([C])
3777 # ===================================================================
3778 # check various GCC options that Clang does not support now but maybe
3779 # will somewhen in the future, check them even for GCC, so that the
3780 # flags are set
3781 # ===================================================================
3783 HAVE_GCC_GGDB2=
3784 if test "$GCC" = "yes"; then
3785     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3786     save_CFLAGS=$CFLAGS
3787     CFLAGS="$CFLAGS -Werror -ggdb2"
3788     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3789     CFLAGS=$save_CFLAGS
3790     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3791         AC_MSG_RESULT([yes])
3792     else
3793         AC_MSG_RESULT([no])
3794     fi
3796     if test "$host_cpu" = "m68k"; then
3797         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3798         save_CFLAGS=$CFLAGS
3799         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3800         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3801         CFLAGS=$save_CFLAGS
3802         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3803             AC_MSG_RESULT([yes])
3804         else
3805             AC_MSG_ERROR([no])
3806         fi
3807     fi
3809 AC_SUBST(HAVE_GCC_GGDB2)
3811 dnl ===================================================================
3812 dnl  Test the gcc version
3813 dnl ===================================================================
3814 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3815     AC_MSG_CHECKING([the GCC version])
3816     _gcc_version=`$CC -dumpversion`
3817     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3818         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3819     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3821     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3823     if test "$gcc_full_version" -lt 70000; then
3824         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3825     fi
3826 else
3827     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3828     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3829     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3830     # (which reports itself as GCC 4.2.1).
3831     GCC_VERSION=
3833 AC_SUBST(GCC_VERSION)
3835 dnl Set the ENABLE_DBGUTIL variable
3836 dnl ===================================================================
3837 AC_MSG_CHECKING([whether to build with additional debug utilities])
3838 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3839     ENABLE_DBGUTIL="TRUE"
3840     # this is an extra var so it can have different default on different MSVC
3841     # versions (in case there are version specific problems with it)
3842     MSVC_USE_DEBUG_RUNTIME="TRUE"
3844     AC_MSG_RESULT([yes])
3845     # cppunit and graphite expose STL in public headers
3846     if test "$with_system_cppunit" = "yes"; then
3847         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3848     else
3849         with_system_cppunit=no
3850     fi
3851     if test "$with_system_graphite" = "yes"; then
3852         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3853     else
3854         with_system_graphite=no
3855     fi
3856     if test "$with_system_orcus" = "yes"; then
3857         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3858     else
3859         with_system_orcus=no
3860     fi
3861     if test "$with_system_libcmis" = "yes"; then
3862         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3863     else
3864         with_system_libcmis=no
3865     fi
3866     if test "$with_system_hunspell" = "yes"; then
3867         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3868     else
3869         with_system_hunspell=no
3870     fi
3871     if test "$with_system_gpgmepp" = "yes"; then
3872         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3873     else
3874         with_system_gpgmepp=no
3875     fi
3876     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3877     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3878     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3879     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3880     # of those two is using the system variant:
3881     if test "$with_system_libnumbertext" = "yes"; then
3882         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3883     else
3884         with_system_libnumbertext=no
3885     fi
3886     if test "$with_system_libwps" = "yes"; then
3887         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3888     else
3889         with_system_libwps=no
3890     fi
3891 else
3892     ENABLE_DBGUTIL=""
3893     MSVC_USE_DEBUG_RUNTIME=""
3894     AC_MSG_RESULT([no])
3896 AC_SUBST(ENABLE_DBGUTIL)
3897 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3899 dnl Set the ENABLE_DEBUG variable.
3900 dnl ===================================================================
3901 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3902     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3904 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3905     if test -z "$libo_fuzzed_enable_debug"; then
3906         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3907     else
3908         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3909         enable_debug=yes
3910     fi
3913 AC_MSG_CHECKING([whether to do a debug build])
3914 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3915     ENABLE_DEBUG="TRUE"
3916     if test -n "$ENABLE_DBGUTIL" ; then
3917         AC_MSG_RESULT([yes (dbgutil)])
3918     else
3919         AC_MSG_RESULT([yes])
3920     fi
3921 else
3922     ENABLE_DEBUG=""
3923     AC_MSG_RESULT([no])
3925 AC_SUBST(ENABLE_DEBUG)
3927 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3928 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3929 dnl Clang 9 is known fixed since
3930 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3931 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3932 if test "$COM_IS_CLANG" = TRUE -a "$_os" = Linux; then
3933     if test "$CLANGVER" -lt 90000; then
3934         for i in $CC; do
3935             case $i in
3936             -fsanitize=*)
3937                 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3938                 break
3939                 ;;
3940             esac
3941         done
3942     fi
3944 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3945     AC_MSG_RESULT([yes])
3946 else
3947     AC_MSG_RESULT([no])
3949 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3951 dnl ===================================================================
3952 dnl Select the linker to use (gold/lld/ld.bfd).
3953 dnl This is done only after compiler checks (need to know if Clang is
3954 dnl used, for different defaults) and after checking if a debug build
3955 dnl is wanted (non-debug builds get the default linker if not explicitly
3956 dnl specified otherwise).
3957 dnl All checks for linker features/options should come after this.
3958 dnl ===================================================================
3959 check_use_ld()
3961     use_ld=$1
3962     use_ld_fail_if_error=$2
3963     use_ld_ok=
3964     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3965     use_ld_ldflags_save="$LDFLAGS"
3966     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3967     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3968 #include <stdio.h>
3969         ],[
3970 printf ("hello world\n");
3971         ])], USE_LD=$use_ld, [])
3972     if test -n "$USE_LD"; then
3973         AC_MSG_RESULT( yes )
3974         use_ld_ok=yes
3975         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3976         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3977         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3978             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3979             use_ld_ldflags_save_2="$LDFLAGS"
3980             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3981             use_ld_has_cpp_typeinfo=
3982             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3983 #include <stdio.h>
3984                 ],[
3985 printf ("hello world\n");
3986                 ])], use_ld_has_cpp_typeinfo=yes, [])
3987             LDFLAGS="$use_ld_ldflags_save_2"
3988             if test -n "$use_ld_has_cpp_typeinfo"; then
3989                 AC_MSG_RESULT( yes )
3990             else
3991                 if test -n "$use_ld_fail_if_error"; then
3992                     AC_MSG_ERROR( no )
3993                 else
3994                     AC_MSG_RESULT( no )
3995                 fi
3996                 use_ld_ok=
3997             fi
3998         fi
3999     else
4000         if test -n "$use_ld_fail_if_error"; then
4001             AC_MSG_ERROR( no )
4002         else
4003             AC_MSG_RESULT( no )
4004         fi
4005     fi
4006     if test -n "$use_ld_ok"; then
4007         dnl keep the value of LDFLAGS
4008         return 0
4009     fi
4010     LDFLAGS="$use_ld_ldflags_save"
4011     return 1
4013 USE_LD=
4014 if test "$enable_ld" != "no"; then
4015     if test "$GCC" = "yes"; then
4016         if test -n "$enable_ld"; then
4017             check_use_ld "$enable_ld" fail_if_error
4018         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4019             dnl non-debug builds default to the default linker
4020             true
4021         elif test -n "$COM_IS_CLANG"; then
4022             check_use_ld lld
4023             if test $? -ne 0; then
4024                 check_use_ld gold
4025             fi
4026         else
4027             # For gcc first try gold, new versions also support lld.
4028             check_use_ld gold
4029             if test $? -ne 0; then
4030                 check_use_ld lld
4031             fi
4032         fi
4033         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4034         rm conftest.out
4035         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4036         if test -z "$ld_used"; then
4037             ld_used="unknown"
4038         fi
4039         AC_MSG_CHECKING([for linker that is used])
4040         AC_MSG_RESULT([$ld_used])
4041         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4042             if echo "$ld_used" | grep -q "^GNU ld"; then
4043                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4044                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4045             fi
4046         fi
4047     else
4048         if test "$enable_ld" = "yes"; then
4049             AC_MSG_ERROR([--enable-ld not supported])
4050         fi
4051     fi
4053 AC_SUBST(USE_LD)
4055 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4056 if test "$GCC" = "yes"; then
4057     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4058     bsymbolic_functions_ldflags_save=$LDFLAGS
4059     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4060     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4061 #include <stdio.h>
4062         ],[
4063 printf ("hello world\n");
4064         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4065     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4066         AC_MSG_RESULT( found )
4067     else
4068         AC_MSG_RESULT( not found )
4069     fi
4070     LDFLAGS=$bsymbolic_functions_ldflags_save
4072 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4075 HAVE_GSPLIT_DWARF=
4076 if test "$enable_split_debug" != no; then
4077     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4078     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4079         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4080         save_CFLAGS=$CFLAGS
4081         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4082         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4083         CFLAGS=$save_CFLAGS
4084         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4085             AC_MSG_RESULT([yes])
4086         else
4087             if test "$enable_split_debug" = yes; then
4088                 AC_MSG_ERROR([no])
4089             else
4090                 AC_MSG_RESULT([no])
4091             fi
4092         fi
4093     fi
4094     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4095         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4096         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4097     fi
4099 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4101 ENABLE_GDB_INDEX=
4102 if test "$enable_gdb_index" != "no"; then
4103     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4104     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4105         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4106         save_CFLAGS=$CFLAGS
4107         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4108         have_ggnu_pubnames=
4109         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4110         if test "$have_ggnu_pubnames" != "TRUE"; then
4111             if test "$enable_gdb_index" = "yes"; then
4112                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4113             else
4114                 AC_MSG_RESULT( no )
4115             fi
4116         else
4117             AC_MSG_RESULT( yes )
4118             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4119             ldflags_save=$LDFLAGS
4120             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4121             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4122 #include <stdio.h>
4123                 ],[
4124 printf ("hello world\n");
4125                 ])], ENABLE_GDB_INDEX=TRUE, [])
4126             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4127                 AC_MSG_RESULT( yes )
4128             else
4129                 if test "$enable_gdb_index" = "yes"; then
4130                     AC_MSG_ERROR( no )
4131                 else
4132                     AC_MSG_RESULT( no )
4133                 fi
4134             fi
4135             LDFLAGS=$ldflags_save
4136         fi
4137         CFLAGS=$save_CFLAGS
4138         fi
4139     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4140         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4141         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4142     fi
4144 AC_SUBST(ENABLE_GDB_INDEX)
4146 if test "$enable_sal_log" = yes; then
4147     ENABLE_SAL_LOG=TRUE
4149 AC_SUBST(ENABLE_SAL_LOG)
4151 dnl Check for enable symbols option
4152 dnl ===================================================================
4153 AC_MSG_CHECKING([whether to generate debug information])
4154 if test -z "$enable_symbols"; then
4155     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4156         enable_symbols=yes
4157     else
4158         enable_symbols=no
4159     fi
4161 if test "$enable_symbols" = yes; then
4162     ENABLE_SYMBOLS_FOR=all
4163     AC_MSG_RESULT([yes])
4164 elif test "$enable_symbols" = no; then
4165     ENABLE_SYMBOLS_FOR=
4166     AC_MSG_RESULT([no])
4167 else
4168     # Selective debuginfo.
4169     ENABLE_SYMBOLS_FOR="$enable_symbols"
4170     AC_MSG_RESULT([for "$enable_symbols"])
4172 AC_SUBST(ENABLE_SYMBOLS_FOR)
4174 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4175     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4176     AC_MSG_CHECKING([whether enough memory is available for linking])
4177     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4178     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4179     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4180         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4181     else
4182         AC_MSG_RESULT([yes])
4183     fi
4186 AC_MSG_CHECKING([whether to compile with optimization flags])
4187 if test -z "$enable_optimized"; then
4188     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4189         enable_optimized=no
4190     else
4191         enable_optimized=yes
4192     fi
4194 if test "$enable_optimized" != no; then
4195     ENABLE_OPTIMIZED=TRUE
4196     AC_MSG_RESULT([yes])
4197 else
4198     ENABLE_OPTIMIZED=
4199     AC_MSG_RESULT([no])
4201 AC_SUBST(ENABLE_OPTIMIZED)
4204 # determine CPUNAME, OS, ...
4205 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4207 case "$host_os" in
4209 aix*)
4210     COM=GCC
4211     CPUNAME=POWERPC
4212     USING_X11=TRUE
4213     OS=AIX
4214     RTL_OS=AIX
4215     RTL_ARCH=PowerPC
4216     PLATFORMID=aix_powerpc
4217     P_SEP=:
4218     ;;
4220 cygwin*)
4221     COM=MSC
4222     USING_X11=
4223     OS=WNT
4224     RTL_OS=Windows
4225     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4226         P_SEP=";"
4227     else
4228         P_SEP=:
4229     fi
4230     case "$host_cpu" in
4231     i*86|x86_64)
4232         if test "$BITNESS_OVERRIDE" = 64; then
4233             CPUNAME=X86_64
4234             RTL_ARCH=X86_64
4235             PLATFORMID=windows_x86_64
4236             WINDOWS_X64=1
4237             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4238         else
4239             CPUNAME=INTEL
4240             RTL_ARCH=x86
4241             PLATFORMID=windows_x86
4242         fi
4243         ;;
4244     *)
4245         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4246         ;;
4247     esac
4248     SCPDEFS="$SCPDEFS -D_MSC_VER"
4249     ;;
4251 darwin*)
4252     COM=GCC
4253     USING_X11=
4254     OS=MACOSX
4255     RTL_OS=MacOSX
4256     P_SEP=:
4258     case "$host_cpu" in
4259     arm)
4260         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4261         ;;
4262     arm64)
4263         OS=iOS
4264         if test "$enable_ios_simulator" = "yes"; then
4265             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4266         else
4267             CPUNAME=ARM64
4268             RTL_ARCH=ARM_EABI
4269             PLATFORMID=ios_arm64
4270         fi
4271         ;;
4272     i*86)
4273         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4274         ;;
4275     x86_64)
4276         if test "$enable_ios_simulator" = "yes"; then
4277             OS=iOS
4278         fi
4279         CPUNAME=X86_64
4280         RTL_ARCH=X86_64
4281         PLATFORMID=macosx_x86_64
4282         ;;
4283     *)
4284         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4285         ;;
4286     esac
4287     ;;
4289 dragonfly*)
4290     COM=GCC
4291     USING_X11=TRUE
4292     OS=DRAGONFLY
4293     RTL_OS=DragonFly
4294     P_SEP=:
4296     case "$host_cpu" in
4297     i*86)
4298         CPUNAME=INTEL
4299         RTL_ARCH=x86
4300         PLATFORMID=dragonfly_x86
4301         ;;
4302     x86_64)
4303         CPUNAME=X86_64
4304         RTL_ARCH=X86_64
4305         PLATFORMID=dragonfly_x86_64
4306         ;;
4307     *)
4308         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4309         ;;
4310     esac
4311     ;;
4313 freebsd*)
4314     COM=GCC
4315     USING_X11=TRUE
4316     RTL_OS=FreeBSD
4317     OS=FREEBSD
4318     P_SEP=:
4320     case "$host_cpu" in
4321     i*86)
4322         CPUNAME=INTEL
4323         RTL_ARCH=x86
4324         PLATFORMID=freebsd_x86
4325         ;;
4326     x86_64|amd64)
4327         CPUNAME=X86_64
4328         RTL_ARCH=X86_64
4329         PLATFORMID=freebsd_x86_64
4330         ;;
4331     *)
4332         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4333         ;;
4334     esac
4335     ;;
4337 haiku*)
4338     COM=GCC
4339     USING_X11=
4340     GUIBASE=haiku
4341     RTL_OS=Haiku
4342     OS=HAIKU
4343     P_SEP=:
4345     case "$host_cpu" in
4346     i*86)
4347         CPUNAME=INTEL
4348         RTL_ARCH=x86
4349         PLATFORMID=haiku_x86
4350         ;;
4351     x86_64|amd64)
4352         CPUNAME=X86_64
4353         RTL_ARCH=X86_64
4354         PLATFORMID=haiku_x86_64
4355         ;;
4356     *)
4357         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4358         ;;
4359     esac
4360     ;;
4362 kfreebsd*)
4363     COM=GCC
4364     USING_X11=TRUE
4365     OS=LINUX
4366     RTL_OS=kFreeBSD
4367     P_SEP=:
4369     case "$host_cpu" in
4371     i*86)
4372         CPUNAME=INTEL
4373         RTL_ARCH=x86
4374         PLATFORMID=kfreebsd_x86
4375         ;;
4376     x86_64)
4377         CPUNAME=X86_64
4378         RTL_ARCH=X86_64
4379         PLATFORMID=kfreebsd_x86_64
4380         ;;
4381     *)
4382         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4383         ;;
4384     esac
4385     ;;
4387 linux-gnu*)
4388     COM=GCC
4389     USING_X11=TRUE
4390     OS=LINUX
4391     RTL_OS=Linux
4392     P_SEP=:
4394     case "$host_cpu" in
4396     aarch64)
4397         CPUNAME=AARCH64
4398         PLATFORMID=linux_aarch64
4399         RTL_ARCH=AARCH64
4400         ;;
4401     alpha)
4402         CPUNAME=AXP
4403         RTL_ARCH=ALPHA
4404         PLATFORMID=linux_alpha
4405         ;;
4406     arm*)
4407         CPUNAME=ARM
4408         EPM_FLAGS="-a arm"
4409         RTL_ARCH=ARM_EABI
4410         PLATFORMID=linux_arm_eabi
4411         case "$host_cpu" in
4412         arm*-linux)
4413             RTL_ARCH=ARM_OABI
4414             PLATFORMID=linux_arm_oabi
4415             ;;
4416         esac
4417         ;;
4418     hppa)
4419         CPUNAME=HPPA
4420         RTL_ARCH=HPPA
4421         EPM_FLAGS="-a hppa"
4422         PLATFORMID=linux_hppa
4423         ;;
4424     i*86)
4425         CPUNAME=INTEL
4426         RTL_ARCH=x86
4427         PLATFORMID=linux_x86
4428         ;;
4429     ia64)
4430         CPUNAME=IA64
4431         RTL_ARCH=IA64
4432         PLATFORMID=linux_ia64
4433         ;;
4434     mips)
4435         CPUNAME=GODSON
4436         RTL_ARCH=MIPS_EB
4437         EPM_FLAGS="-a mips"
4438         PLATFORMID=linux_mips_eb
4439         ;;
4440     mips64)
4441         CPUNAME=GODSON64
4442         RTL_ARCH=MIPS64_EB
4443         EPM_FLAGS="-a mips64"
4444         PLATFORMID=linux_mips64_eb
4445         ;;
4446     mips64el)
4447         CPUNAME=GODSON64
4448         RTL_ARCH=MIPS64_EL
4449         EPM_FLAGS="-a mips64el"
4450         PLATFORMID=linux_mips64_el
4451         ;;
4452     mipsel)
4453         CPUNAME=GODSON
4454         RTL_ARCH=MIPS_EL
4455         EPM_FLAGS="-a mipsel"
4456         PLATFORMID=linux_mips_el
4457         ;;
4458     m68k)
4459         CPUNAME=M68K
4460         RTL_ARCH=M68K
4461         PLATFORMID=linux_m68k
4462         ;;
4463     powerpc)
4464         CPUNAME=POWERPC
4465         RTL_ARCH=PowerPC
4466         PLATFORMID=linux_powerpc
4467         ;;
4468     powerpc64)
4469         CPUNAME=POWERPC64
4470         RTL_ARCH=PowerPC_64
4471         PLATFORMID=linux_powerpc64
4472         ;;
4473     powerpc64le)
4474         CPUNAME=POWERPC64
4475         RTL_ARCH=PowerPC_64_LE
4476         PLATFORMID=linux_powerpc64_le
4477         ;;
4478     sparc)
4479         CPUNAME=SPARC
4480         RTL_ARCH=SPARC
4481         PLATFORMID=linux_sparc
4482         ;;
4483     sparc64)
4484         CPUNAME=SPARC64
4485         RTL_ARCH=SPARC64
4486         PLATFORMID=linux_sparc64
4487         ;;
4488     s390)
4489         CPUNAME=S390
4490         RTL_ARCH=S390
4491         PLATFORMID=linux_s390
4492         ;;
4493     s390x)
4494         CPUNAME=S390X
4495         RTL_ARCH=S390x
4496         PLATFORMID=linux_s390x
4497         ;;
4498     x86_64)
4499         CPUNAME=X86_64
4500         RTL_ARCH=X86_64
4501         PLATFORMID=linux_x86_64
4502         ;;
4503     *)
4504         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4505         ;;
4506     esac
4507     ;;
4509 linux-android*)
4510     COM=GCC
4511     USING_X11=
4512     OS=ANDROID
4513     RTL_OS=Android
4514     P_SEP=:
4516     case "$host_cpu" in
4518     arm|armel)
4519         CPUNAME=ARM
4520         RTL_ARCH=ARM_EABI
4521         PLATFORMID=android_arm_eabi
4522         ;;
4523     aarch64)
4524         CPUNAME=AARCH64
4525         RTL_ARCH=AARCH64
4526         PLATFORMID=android_aarch64
4527         ;;
4528     mips|mipsel)
4529         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4530         RTL_ARCH=MIPS_EL
4531         PLATFORMID=android_mips_el
4532         ;;
4533     i*86)
4534         CPUNAME=INTEL
4535         RTL_ARCH=x86
4536         PLATFORMID=android_x86
4537         ;;
4538     *)
4539         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4540         ;;
4541     esac
4542     ;;
4544 *netbsd*)
4545     COM=GCC
4546     USING_X11=TRUE
4547     OS=NETBSD
4548     RTL_OS=NetBSD
4549     P_SEP=:
4551     case "$host_cpu" in
4552     i*86)
4553         CPUNAME=INTEL
4554         RTL_ARCH=x86
4555         PLATFORMID=netbsd_x86
4556         ;;
4557     powerpc)
4558         CPUNAME=POWERPC
4559         RTL_ARCH=PowerPC
4560         PLATFORMID=netbsd_powerpc
4561         ;;
4562     sparc)
4563         CPUNAME=SPARC
4564         RTL_ARCH=SPARC
4565         PLATFORMID=netbsd_sparc
4566         ;;
4567     x86_64)
4568         CPUNAME=X86_64
4569         RTL_ARCH=X86_64
4570         PLATFORMID=netbsd_x86_64
4571         ;;
4572     *)
4573         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4574         ;;
4575     esac
4576     ;;
4578 openbsd*)
4579     COM=GCC
4580     USING_X11=TRUE
4581     OS=OPENBSD
4582     RTL_OS=OpenBSD
4583     P_SEP=:
4585     case "$host_cpu" in
4586     i*86)
4587         CPUNAME=INTEL
4588         RTL_ARCH=x86
4589         PLATFORMID=openbsd_x86
4590         ;;
4591     x86_64)
4592         CPUNAME=X86_64
4593         RTL_ARCH=X86_64
4594         PLATFORMID=openbsd_x86_64
4595         ;;
4596     *)
4597         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4598         ;;
4599     esac
4600     SOLARINC="$SOLARINC -I/usr/local/include"
4601     ;;
4603 solaris*)
4604     COM=GCC
4605     USING_X11=TRUE
4606     OS=SOLARIS
4607     RTL_OS=Solaris
4608     P_SEP=:
4610     case "$host_cpu" in
4611     i*86)
4612         CPUNAME=INTEL
4613         RTL_ARCH=x86
4614         PLATFORMID=solaris_x86
4615         ;;
4616     sparc)
4617         CPUNAME=SPARC
4618         RTL_ARCH=SPARC
4619         PLATFORMID=solaris_sparc
4620         ;;
4621     sparc64)
4622         CPUNAME=SPARC64
4623         RTL_ARCH=SPARC64
4624         PLATFORMID=solaris_sparc64
4625         ;;
4626     *)
4627         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4628         ;;
4629     esac
4630     SOLARINC="$SOLARINC -I/usr/local/include"
4631     ;;
4634     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4635     ;;
4636 esac
4638 if test "$with_x" = "no"; then
4639     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4642 DISABLE_GUI=""
4643 if test "$enable_gui" = "no"; then
4644     if test "$USING_X11" != TRUE; then
4645         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4646     fi
4647     USING_X11=
4648     DISABLE_GUI=TRUE
4649     AC_DEFINE(HAVE_FEATURE_UI,0)
4650     test_cairo=yes
4652 AC_SUBST(DISABLE_GUI)
4654 WORKDIR="${BUILDDIR}/workdir"
4655 INSTDIR="${BUILDDIR}/instdir"
4656 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4657 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4658 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4659 AC_SUBST(COM)
4660 AC_SUBST(CPUNAME)
4661 AC_SUBST(RTL_OS)
4662 AC_SUBST(RTL_ARCH)
4663 AC_SUBST(EPM_FLAGS)
4664 AC_SUBST(USING_X11)
4665 AC_SUBST([INSTDIR])
4666 AC_SUBST([INSTROOT])
4667 AC_SUBST([INSTROOTBASE])
4668 AC_SUBST(OS)
4669 AC_SUBST(P_SEP)
4670 AC_SUBST(WORKDIR)
4671 AC_SUBST(PLATFORMID)
4672 AC_SUBST(WINDOWS_X64)
4673 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4675 dnl ===================================================================
4676 dnl Test which package format to use
4677 dnl ===================================================================
4678 AC_MSG_CHECKING([which package format to use])
4679 if test -n "$with_package_format" -a "$with_package_format" != no; then
4680     for i in $with_package_format; do
4681         case "$i" in
4682         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4683             ;;
4684         *)
4685             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4686 aix - AIX software distribution
4687 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4688 deb - Debian software distribution
4689 pkg - Solaris software distribution
4690 rpm - RedHat software distribution
4692 LibreOffice additionally supports:
4693 archive - .tar.gz or .zip
4694 dmg - macOS .dmg
4695 installed - installation tree
4696 msi - Windows .msi
4697         ])
4698             ;;
4699         esac
4700     done
4701     # fakeroot is needed to ensure correct file ownerships/permissions
4702     # inside deb packages and tar archives created on Linux and Solaris.
4703     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4704         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4705         if test "$FAKEROOT" = "no"; then
4706             AC_MSG_ERROR(
4707                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4708         fi
4709     fi
4710     PKGFORMAT="$with_package_format"
4711     AC_MSG_RESULT([$PKGFORMAT])
4712 else
4713     PKGFORMAT=
4714     AC_MSG_RESULT([none])
4716 AC_SUBST(PKGFORMAT)
4718 dnl ===================================================================
4719 dnl Set up a different compiler to produce tools to run on the build
4720 dnl machine when doing cross-compilation
4721 dnl ===================================================================
4723 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4724 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4725 if test "$cross_compiling" = "yes"; then
4726     AC_MSG_CHECKING([for BUILD platform configuration])
4727     echo
4728     rm -rf CONF-FOR-BUILD config_build.mk
4729     mkdir CONF-FOR-BUILD
4730     # Here must be listed all files needed when running the configure script. In particular, also
4731     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4732     # keep them in the same order as there.
4733     (cd $SRC_ROOT && tar cf - \
4734         config.guess \
4735         bin/get_config_variables \
4736         solenv/bin/getcompver.awk \
4737         solenv/inc/langlist.mk \
4738         download.lst \
4739         config_host.mk.in \
4740         config_host_lang.mk.in \
4741         Makefile.in \
4742         bin/bffvalidator.sh.in \
4743         bin/odfvalidator.sh.in \
4744         bin/officeotron.sh.in \
4745         instsetoo_native/util/openoffice.lst.in \
4746         config_host/*.in \
4747         sysui/desktop/macosx/Info.plist.in) \
4748     | (cd CONF-FOR-BUILD && tar xf -)
4749     cp configure CONF-FOR-BUILD
4750     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4751     (
4752     unset COM USING_X11 OS CPUNAME
4753     unset CC CXX SYSBASE CFLAGS
4754     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4755     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4756     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4757     if test -n "$CC_FOR_BUILD"; then
4758         export CC="$CC_FOR_BUILD"
4759         CC_BASE=`first_arg_basename "$CC"`
4760     fi
4761     if test -n "$CXX_FOR_BUILD"; then
4762         export CXX="$CXX_FOR_BUILD"
4763         CXX_BASE=`first_arg_basename "$CXX"`
4764     fi
4765     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4766     cd CONF-FOR-BUILD
4767     sub_conf_opts=""
4768     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4769     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4770     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4771     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4772     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4773     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4774     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4775     # Don't bother having configure look for stuff not needed for the build platform anyway
4776     ./configure \
4777         --disable-cups \
4778         --disable-gstreamer-1-0 \
4779         --disable-gtk \
4780         --disable-gtk3 \
4781         --disable-pdfimport \
4782         --disable-postgresql-sdbc \
4783         --with-parallelism="$with_parallelism" \
4784         --without-doxygen \
4785         --without-java \
4786         $sub_conf_opts \
4787         --srcdir=$srcdir \
4788         2>&1 | sed -e 's/^/    /'
4789     test -f ./config_host.mk 2>/dev/null || exit
4790     cp config_host.mk ../config_build.mk
4791     cp config_host_lang.mk ../config_build_lang.mk
4792     mv config.log ../config.Build.log
4793     mkdir -p ../config_build
4794     mv config_host/*.h ../config_build
4795     . ./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
4797     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
4798         VV='$'$V
4799         VV=`eval "echo $VV"`
4800         if test -n "$VV"; then
4801             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4802             echo "$line" >>build-config
4803         fi
4804     done
4806     for V in INSTDIR INSTROOT WORKDIR; do
4807         VV='$'$V
4808         VV=`eval "echo $VV"`
4809         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4810         if test -n "$VV"; then
4811             line="${V}_FOR_BUILD='$VV'"
4812             echo "$line" >>build-config
4813         fi
4814     done
4816     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4817     echo "$line" >>build-config
4819     )
4820     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4821     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])
4822     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4823              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4825     eval `cat CONF-FOR-BUILD/build-config`
4827     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4829     rm -rf CONF-FOR-BUILD
4830 else
4831     OS_FOR_BUILD="$OS"
4832     CC_FOR_BUILD="$CC"
4833     CXX_FOR_BUILD="$CXX"
4834     INSTDIR_FOR_BUILD="$INSTDIR"
4835     INSTROOT_FOR_BUILD="$INSTROOT"
4836     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4837     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4838     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4839     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4840     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4841     WORKDIR_FOR_BUILD="$WORKDIR"
4843 AC_SUBST(OS_FOR_BUILD)
4844 AC_SUBST(INSTDIR_FOR_BUILD)
4845 AC_SUBST(INSTROOT_FOR_BUILD)
4846 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4847 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4848 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4849 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4850 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4851 AC_SUBST(WORKDIR_FOR_BUILD)
4853 dnl ===================================================================
4854 dnl Check for syslog header
4855 dnl ===================================================================
4856 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4858 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4859 dnl ===================================================================
4860 AC_MSG_CHECKING([whether to turn warnings to errors])
4861 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4862     ENABLE_WERROR="TRUE"
4863     AC_MSG_RESULT([yes])
4864 else
4865     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4866         ENABLE_WERROR="TRUE"
4867         AC_MSG_RESULT([yes])
4868     else
4869         AC_MSG_RESULT([no])
4870     fi
4872 AC_SUBST(ENABLE_WERROR)
4874 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4875 dnl ===================================================================
4876 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4877 if test -z "$enable_assert_always_abort"; then
4878    if test "$ENABLE_DEBUG" = TRUE; then
4879        enable_assert_always_abort=yes
4880    else
4881        enable_assert_always_abort=no
4882    fi
4884 if test "$enable_assert_always_abort" = "yes"; then
4885     ASSERT_ALWAYS_ABORT="TRUE"
4886     AC_MSG_RESULT([yes])
4887 else
4888     ASSERT_ALWAYS_ABORT="FALSE"
4889     AC_MSG_RESULT([no])
4891 AC_SUBST(ASSERT_ALWAYS_ABORT)
4893 # Determine whether to use ooenv for the instdir installation
4894 # ===================================================================
4895 if test $_os != "WINNT" -a $_os != "Darwin"; then
4896     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4897     if test "$enable_ooenv" = "no"; then
4898         AC_MSG_RESULT([no])
4899     else
4900         ENABLE_OOENV="TRUE"
4901         AC_MSG_RESULT([yes])
4902     fi
4904 AC_SUBST(ENABLE_OOENV)
4906 if test "$USING_X11" != TRUE; then
4907     # be sure to do not mess with unneeded stuff
4908     test_randr=no
4909     test_xrender=no
4910     test_cups=no
4911     test_dbus=no
4912     test_gtk=no
4913     build_gstreamer_1_0=no
4914     test_kde5=no
4915     test_qt5=no
4916     test_gtk3_kde5=no
4917     enable_cairo_canvas=no
4920 if test "$OS" = "HAIKU"; then
4921     enable_cairo_canvas=yes
4922     test_kde5=yes
4925 if test "$test_kde5" = "yes"; then
4926     test_qt5=yes
4929 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4930     if test "$enable_qt5" = "no"; then
4931         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4932     else
4933         enable_qt5=yes
4934     fi
4937 dnl ===================================================================
4938 dnl check for cups support
4939 dnl ===================================================================
4940 ENABLE_CUPS=""
4942 if test "$enable_cups" = "no"; then
4943     test_cups=no
4946 AC_MSG_CHECKING([whether to enable CUPS support])
4947 if test "$test_cups" = "yes"; then
4948     ENABLE_CUPS="TRUE"
4949     AC_MSG_RESULT([yes])
4951     AC_MSG_CHECKING([whether cups support is present])
4952     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4953     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4954     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4955         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4956     fi
4958 else
4959     AC_MSG_RESULT([no])
4962 AC_SUBST(ENABLE_CUPS)
4964 # fontconfig checks
4965 if test "$test_fontconfig" = "yes"; then
4966     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4967     SYSTEM_FONTCONFIG=TRUE
4968     FilterLibs "${FONTCONFIG_LIBS}"
4969     FONTCONFIG_LIBS="${filteredlibs}"
4971 AC_SUBST(FONTCONFIG_CFLAGS)
4972 AC_SUBST(FONTCONFIG_LIBS)
4973 AC_SUBST([SYSTEM_FONTCONFIG])
4975 dnl whether to find & fetch external tarballs?
4976 dnl ===================================================================
4977 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4978    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4979        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4980    else
4981        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4982    fi
4984 if test -z "$TARFILE_LOCATION"; then
4985     if test -d "$SRC_ROOT/src" ; then
4986         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4987         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4988     fi
4989     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4990 else
4991     AbsolutePath "$TARFILE_LOCATION"
4992     PathFormat "${absolute_path}"
4993     TARFILE_LOCATION="${formatted_path}"
4995 AC_SUBST(TARFILE_LOCATION)
4997 AC_MSG_CHECKING([whether we want to fetch tarballs])
4998 if test "$enable_fetch_external" != "no"; then
4999     if test "$with_all_tarballs" = "yes"; then
5000         AC_MSG_RESULT([yes, all of them])
5001         DO_FETCH_TARBALLS="ALL"
5002     else
5003         AC_MSG_RESULT([yes, if we use them])
5004         DO_FETCH_TARBALLS="TRUE"
5005     fi
5006 else
5007     AC_MSG_RESULT([no])
5008     DO_FETCH_TARBALLS=
5010 AC_SUBST(DO_FETCH_TARBALLS)
5012 AC_MSG_CHECKING([whether to build help])
5013 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5014     BUILD_TYPE="$BUILD_TYPE HELP"
5015     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5016     case "$with_help" in
5017     "html")
5018         ENABLE_HTMLHELP=TRUE
5019         SCPDEFS="$SCPDEFS -DWITH_HELP"
5020         AC_MSG_RESULT([HTML])
5021         ;;
5022     "online")
5023         ENABLE_HTMLHELP=TRUE
5024         HELP_ONLINE=TRUE
5025         AC_MSG_RESULT([HTML])
5026         ;;
5027     yes)
5028         SCPDEFS="$SCPDEFS -DWITH_HELP"
5029         AC_MSG_RESULT([yes])
5030         ;;
5031     *)
5032         AC_MSG_ERROR([Unknown --with-help=$with_help])
5033         ;;
5034     esac
5035 else
5036     AC_MSG_RESULT([no])
5038 AC_SUBST([ENABLE_HTMLHELP])
5039 AC_SUBST([HELP_ONLINE])
5041 dnl Test whether to include MySpell dictionaries
5042 dnl ===================================================================
5043 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5044 if test "$with_myspell_dicts" = "yes"; then
5045     AC_MSG_RESULT([yes])
5046     WITH_MYSPELL_DICTS=TRUE
5047     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5048     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5049 else
5050     AC_MSG_RESULT([no])
5051     WITH_MYSPELL_DICTS=
5053 AC_SUBST(WITH_MYSPELL_DICTS)
5055 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5056 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5057     if test "$with_system_dicts" = yes; then
5058         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5059     fi
5060     with_system_dicts=no
5063 AC_MSG_CHECKING([whether to use dicts from external paths])
5064 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5065     AC_MSG_RESULT([yes])
5066     SYSTEM_DICTS=TRUE
5067     AC_MSG_CHECKING([for spelling dictionary directory])
5068     if test -n "$with_external_dict_dir"; then
5069         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5070     else
5071         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5072         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5073             DICT_SYSTEM_DIR=file:///usr/share/myspell
5074         fi
5075     fi
5076     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5077     AC_MSG_CHECKING([for hyphenation patterns directory])
5078     if test -n "$with_external_hyph_dir"; then
5079         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5080     else
5081         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5082     fi
5083     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5084     AC_MSG_CHECKING([for thesaurus directory])
5085     if test -n "$with_external_thes_dir"; then
5086         THES_SYSTEM_DIR=file://$with_external_thes_dir
5087     else
5088         THES_SYSTEM_DIR=file:///usr/share/mythes
5089     fi
5090     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5091 else
5092     AC_MSG_RESULT([no])
5093     SYSTEM_DICTS=
5095 AC_SUBST(SYSTEM_DICTS)
5096 AC_SUBST(DICT_SYSTEM_DIR)
5097 AC_SUBST(HYPH_SYSTEM_DIR)
5098 AC_SUBST(THES_SYSTEM_DIR)
5100 dnl ===================================================================
5101 dnl Precompiled headers.
5102 ENABLE_PCH=""
5103 AC_MSG_CHECKING([whether to enable pch feature])
5104 if test -z "$enable_pch"; then
5105     if test "$_os" = "WINNT"; then
5106         # Enabled by default on Windows.
5107         enable_pch=yes
5108     else
5109         enable_pch=no
5110     fi
5112 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5113     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5115 if test "$enable_pch" = "system"; then
5116     ENABLE_PCH="1"
5117     AC_MSG_RESULT([yes (system headers)])
5118 elif test "$enable_pch" = "base"; then
5119     ENABLE_PCH="2"
5120     AC_MSG_RESULT([yes (system and base headers)])
5121 elif test "$enable_pch" = "normal"; then
5122     ENABLE_PCH="3"
5123     AC_MSG_RESULT([yes (normal)])
5124 elif test "$enable_pch" = "full"; then
5125     ENABLE_PCH="4"
5126     AC_MSG_RESULT([yes (full)])
5127 elif test "$enable_pch" = "yes"; then
5128     # Pick a suitable default.
5129     if test "$GCC" = "yes"; then
5130         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5131         # while making the PCHs larger and rebuilds more likely.
5132         ENABLE_PCH="2"
5133         AC_MSG_RESULT([yes (system and base headers)])
5134     else
5135         # With MSVC the highest level makes a significant difference,
5136         # and it was the default when there used to be no PCH levels.
5137         ENABLE_PCH="4"
5138         AC_MSG_RESULT([yes (full)])
5139     fi
5140 elif test "$enable_pch" = "no"; then
5141     AC_MSG_RESULT([no])
5142 else
5143     AC_MSG_ERROR([Unknown value for --enable-pch])
5145 AC_SUBST(ENABLE_PCH)
5146 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5147 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5148     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5149     if test "$CCACHE_BIN" != "not found"; then
5150         AC_MSG_CHECKING([ccache version])
5151         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5152         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5153         AC_MSG_RESULT([$CCACHE_VERSION])
5154         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5155         if test "$CCACHE_NUMVER" -gt "030701"; then
5156             AC_MSG_RESULT([yes])
5157         else
5158             AC_MSG_RESULT([no (not newer than 3.7.1)])
5159             CCACHE_DEPEND_MODE=
5160         fi
5161     fi
5164 TAB=`printf '\t'`
5166 AC_MSG_CHECKING([the GNU Make version])
5167 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5168 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5169 if test "$_make_longver" -ge "038200"; then
5170     AC_MSG_RESULT([$GNUMAKE $_make_version])
5172 elif test "$_make_longver" -ge "038100"; then
5173     if test "$build_os" = "cygwin"; then
5174         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5175     fi
5176     AC_MSG_RESULT([$GNUMAKE $_make_version])
5178     dnl ===================================================================
5179     dnl Search all the common names for sha1sum
5180     dnl ===================================================================
5181     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5182     if test -z "$SHA1SUM"; then
5183         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5184     elif test "$SHA1SUM" = "openssl"; then
5185         SHA1SUM="openssl sha1"
5186     fi
5187     AC_MSG_CHECKING([for GNU Make bug 20033])
5188     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5189     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5190 A := \$(wildcard *.a)
5192 .PHONY: all
5193 all: \$(A:.a=.b)
5194 <TAB>@echo survived bug20033.
5196 .PHONY: setup
5197 setup:
5198 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5200 define d1
5201 @echo lala \$(1)
5202 @sleep 1
5203 endef
5205 define d2
5206 @echo tyty \$(1)
5207 @sleep 1
5208 endef
5210 %.b : %.a
5211 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5212 <TAB>\$(call d1,\$(CHECKSUM)),\
5213 <TAB>\$(call d2,\$(CHECKSUM)))
5215     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5216         no_parallelism_make="YES"
5217         AC_MSG_RESULT([yes, disable parallelism])
5218     else
5219         AC_MSG_RESULT([no, keep parallelism enabled])
5220     fi
5221     rm -rf $TESTGMAKEBUG20033
5222 else
5223     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5226 # find if gnumake support file function
5227 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5228 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5229 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5230     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5232 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5233 \$(file >test.txt,Success )
5235 .PHONY: all
5236 all:
5237 <TAB>@cat test.txt
5240 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5241 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5242     HAVE_GNUMAKE_FILE_FUNC=TRUE
5243     AC_MSG_RESULT([yes])
5244 else
5245     AC_MSG_RESULT([no])
5247 rm -rf $TESTGMAKEFILEFUNC
5248 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5249 AC_SUBST(GNUMAKE_WIN_NATIVE)
5251 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5252 STALE_MAKE=
5253 if test "$_make_ver_check" = ""; then
5254    STALE_MAKE=TRUE
5257 HAVE_LD_HASH_STYLE=FALSE
5258 WITH_LINKER_HASH_STYLE=
5259 AC_MSG_CHECKING([for --hash-style gcc linker support])
5260 if test "$GCC" = "yes"; then
5261     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5262         hash_styles="gnu sysv"
5263     elif test "$with_linker_hash_style" = "no"; then
5264         hash_styles=
5265     else
5266         hash_styles="$with_linker_hash_style"
5267     fi
5269     for hash_style in $hash_styles; do
5270         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5271         hash_style_ldflags_save=$LDFLAGS
5272         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5274         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5275             [
5276 #include <stdio.h>
5277             ],[
5278 printf ("");
5279             ])],
5280             [
5281                   HAVE_LD_HASH_STYLE=TRUE
5282                   WITH_LINKER_HASH_STYLE=$hash_style
5283             ],
5284             [HAVE_LD_HASH_STYLE=FALSE],
5285             [HAVE_LD_HASH_STYLE=FALSE])
5286         LDFLAGS=$hash_style_ldflags_save
5287     done
5289     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5290         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5291     else
5292         AC_MSG_RESULT( no )
5293     fi
5294     LDFLAGS=$hash_style_ldflags_save
5295 else
5296     AC_MSG_RESULT( no )
5298 AC_SUBST(HAVE_LD_HASH_STYLE)
5299 AC_SUBST(WITH_LINKER_HASH_STYLE)
5301 dnl ===================================================================
5302 dnl Check whether there's a Perl version available.
5303 dnl ===================================================================
5304 if test -z "$with_perl_home"; then
5305     AC_PATH_PROG(PERL, perl)
5306 else
5307     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5308     _perl_path="$with_perl_home/bin/perl"
5309     if test -x "$_perl_path"; then
5310         PERL=$_perl_path
5311     else
5312         AC_MSG_ERROR([$_perl_path not found])
5313     fi
5316 dnl ===================================================================
5317 dnl Testing for Perl version 5 or greater.
5318 dnl $] is the Perl version variable, it is returned as an integer
5319 dnl ===================================================================
5320 if test "$PERL"; then
5321     AC_MSG_CHECKING([the Perl version])
5322     ${PERL} -e "exit($]);"
5323     _perl_version=$?
5324     if test "$_perl_version" -lt 5; then
5325         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5326     fi
5327     AC_MSG_RESULT([Perl $_perl_version])
5328 else
5329     AC_MSG_ERROR([Perl not found, install Perl 5])
5332 dnl ===================================================================
5333 dnl Testing for required Perl modules
5334 dnl ===================================================================
5336 AC_MSG_CHECKING([for required Perl modules])
5337 perl_use_string="use Cwd ; use Digest::MD5"
5338 if test "$_os" = "WINNT"; then
5339     if test -n "$PKGFORMAT"; then
5340         for i in $PKGFORMAT; do
5341             case "$i" in
5342             msi)
5343                 # for getting fonts versions to use in MSI
5344                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5345                 ;;
5346             esac
5347         done
5348     fi
5350 if test "$with_system_hsqldb" = "yes"; then
5351     perl_use_string="$perl_use_string ; use Archive::Zip"
5353 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5354     AC_MSG_RESULT([all modules found])
5355 else
5356     AC_MSG_RESULT([failed to find some modules])
5357     # Find out which modules are missing.
5358     for i in $perl_use_string; do
5359         if test "$i" != "use" -a "$i" != ";"; then
5360             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5361                 missing_perl_modules="$missing_perl_modules $i"
5362             fi
5363         fi
5364     done
5365     AC_MSG_ERROR([
5366     The missing Perl modules are: $missing_perl_modules
5367     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5370 dnl ===================================================================
5371 dnl Check for pkg-config
5372 dnl ===================================================================
5373 if test "$_os" != "WINNT"; then
5374     PKG_PROG_PKG_CONFIG
5377 if test "$_os" != "WINNT"; then
5379     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5380     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5381     # explicitly. Or put /path/to/compiler in PATH yourself.
5383     # Use wrappers for LTO
5384     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5385         AC_CHECK_TOOL(AR,gcc-ar)
5386         AC_CHECK_TOOL(NM,gcc-nm)
5387         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5388     else
5389         AC_CHECK_TOOL(AR,ar)
5390         AC_CHECK_TOOL(NM,nm)
5391         AC_CHECK_TOOL(RANLIB,ranlib)
5392     fi
5393     AC_CHECK_TOOL(OBJDUMP,objdump)
5394     AC_CHECK_TOOL(READELF,readelf)
5395     AC_CHECK_TOOL(STRIP,strip)
5396     if test "$_os" = "WINNT"; then
5397         AC_CHECK_TOOL(DLLTOOL,dlltool)
5398         AC_CHECK_TOOL(WINDRES,windres)
5399     fi
5401 AC_SUBST(AR)
5402 AC_SUBST(DLLTOOL)
5403 AC_SUBST(NM)
5404 AC_SUBST(OBJDUMP)
5405 AC_SUBST(PKG_CONFIG)
5406 AC_SUBST(RANLIB)
5407 AC_SUBST(READELF)
5408 AC_SUBST(STRIP)
5409 AC_SUBST(WINDRES)
5411 dnl ===================================================================
5412 dnl pkg-config checks on macOS
5413 dnl ===================================================================
5415 if test $_os = Darwin; then
5416     AC_MSG_CHECKING([for bogus pkg-config])
5417     if test -n "$PKG_CONFIG"; then
5418         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5419             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5420         else
5421             if test "$enable_bogus_pkg_config" = "yes"; then
5422                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5423             else
5424                 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.])
5425             fi
5426         fi
5427     else
5428         AC_MSG_RESULT([no, good])
5429     fi
5432 find_csc()
5434     # Return value: $csctest
5436     unset csctest
5438     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5439     if test -n "$regvalue"; then
5440         csctest=$regvalue
5441         return
5442     fi
5445 find_al()
5447     # Return value: $altest
5449     unset altest
5451     # We need this check to detect 4.6.1 or above.
5452     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5453         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5454         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5455             altest=$regvalue
5456             return
5457         fi
5458     done
5460     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5461         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5462         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5463             altest=$regvalue
5464             return
5465         fi
5466     done
5471 find_dotnetsdk46()
5473     unset frametest
5475     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5476         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5477         if test -n "$regvalue"; then
5478             frametest=$regvalue
5479             return
5480         fi
5481     done
5484 find_winsdk_version()
5486     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5487     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5489     unset winsdktest winsdkbinsubdir winsdklibsubdir
5491     case "$1" in
5492     8.0|8.0A)
5493         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5494         if test -n "$regvalue"; then
5495             winsdktest=$regvalue
5496             winsdklibsubdir=win8
5497             return
5498         fi
5499         ;;
5500     8.1|8.1A)
5501         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5502         if test -n "$regvalue"; then
5503             winsdktest=$regvalue
5504             winsdklibsubdir=winv6.3
5505             return
5506         fi
5507         ;;
5508     10.0)
5509         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5510         if test -n "$regvalue"; then
5511             winsdktest=$regvalue
5512             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5513             if test -n "$regvalue"; then
5514                 winsdkbinsubdir="$regvalue".0
5515                 winsdklibsubdir=$winsdkbinsubdir
5516                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5517                 # test exist the SDK path
5518                 if test -d "$tmppath"; then
5519                    # when path is convertible to a short path then path is okay
5520                    cygpath -d "$tmppath" >/dev/null 2>&1
5521                    if test $? -ne 0; then
5522                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5523                    fi
5524                 else
5525                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5526                 fi
5527             fi
5528             return
5529         fi
5530         ;;
5531     esac
5534 find_winsdk()
5536     # Return value: From find_winsdk_version
5538     unset winsdktest
5540     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5541         find_winsdk_version $ver
5542         if test -n "$winsdktest"; then
5543             return
5544         fi
5545     done
5548 find_msms()
5550     AC_MSG_CHECKING([for MSVC merge modules directory])
5551     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5552     case "$VCVER" in
5553         150|160)
5554         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5555         ;;
5556     esac
5557     for f in $my_msm_files; do
5558         echo "$as_me:$LINENO: searching for $f" >&5
5559     done
5561     msmdir=
5562     for ver in 14.0 15.0; do
5563         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5564         if test -n "$regvalue"; then
5565             for f in ${my_msm_files}; do
5566                 if test -e "$regvalue/${f}"; then
5567                     msmdir=$regvalue
5568                     break
5569                 fi
5570             done
5571         fi
5572     done
5573     dnl Is the following fallback really necessary, or was it added in response
5574     dnl to never having started Visual Studio on a given machine, so the
5575     dnl registry keys checked above had presumably not yet been created?
5576     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5577     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5578     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5579     dnl expanding to "C:\Program Files\Common Files"), which would need
5580     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5581     dnl obtain its value from cygwin:
5582     if test -z "$msmdir"; then
5583         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5584         for f in ${my_msm_files}; do
5585             if test -e "$my_msm_dir/${f}"; then
5586                 msmdir=$my_msm_dir
5587             fi
5588         done
5589     fi
5591     dnl Starting from MSVC 15.0, merge modules are located in different directory
5592     case "$VCVER" in
5593     150|160)
5594         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5595             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5596             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5597             for f in ${my_msm_files}; do
5598                 if test -e "$my_msm_dir/${f}"; then
5599                     msmdir=$my_msm_dir
5600                     break
5601                 fi
5602             done
5603         done
5604         ;;
5605     esac
5607     if test -n "$msmdir"; then
5608         msmdir=`cygpath -m "$msmdir"`
5609         AC_MSG_RESULT([$msmdir])
5610     else
5611         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5612             AC_MSG_FAILURE([not found])
5613         else
5614             AC_MSG_WARN([not found (check config.log)])
5615             add_warning "MSM none of ${my_msm_files} found"
5616         fi
5617     fi
5620 find_msvc_x64_dlls()
5622     AC_MSG_CHECKING([for MSVC x64 DLL path])
5623     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5624     case "$VCVER" in
5625     150|160)
5626         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5627             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5628             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5629                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5630                 break
5631             fi
5632             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5633             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5634                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5635                 break
5636             fi
5637             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5638             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5639                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5640                 break
5641             fi
5642         done
5643         ;;
5644     esac
5645     AC_MSG_RESULT([$msvcdllpath])
5646     AC_MSG_CHECKING([for MSVC x64 DLLs])
5647     msvcdlls="msvcp140.dll vcruntime140.dll"
5648     for dll in $msvcdlls; do
5649         if ! test -f "$msvcdllpath/$dll"; then
5650             AC_MSG_FAILURE([missing $dll])
5651         fi
5652     done
5653     AC_MSG_RESULT([found all ($msvcdlls)])
5656 dnl =========================================
5657 dnl Check for the Windows  SDK.
5658 dnl =========================================
5659 if test "$_os" = "WINNT"; then
5660     AC_MSG_CHECKING([for Windows SDK])
5661     if test "$build_os" = "cygwin"; then
5662         find_winsdk
5663         WINDOWS_SDK_HOME=$winsdktest
5665         # normalize if found
5666         if test -n "$WINDOWS_SDK_HOME"; then
5667             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5668             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5669         fi
5671         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5672     fi
5674     if test -n "$WINDOWS_SDK_HOME"; then
5675         # Remove a possible trailing backslash
5676         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5678         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5679              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5680              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5681             have_windows_sdk_headers=yes
5682         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5683              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5684              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5685             have_windows_sdk_headers=yes
5686         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5687              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5688              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5689             have_windows_sdk_headers=yes
5690         else
5691             have_windows_sdk_headers=no
5692         fi
5694         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5695             have_windows_sdk_libs=yes
5696         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5697             have_windows_sdk_libs=yes
5698         else
5699             have_windows_sdk_libs=no
5700         fi
5702         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5703             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5704 the  Windows SDK are installed.])
5705         fi
5706     fi
5708     if test -z "$WINDOWS_SDK_HOME"; then
5709         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5710     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5711         WINDOWS_SDK_VERSION=80
5712         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5713     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5714         WINDOWS_SDK_VERSION=81
5715         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5716     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5717         WINDOWS_SDK_VERSION=10
5718         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5719     else
5720         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5721     fi
5722     PathFormat "$WINDOWS_SDK_HOME"
5723     WINDOWS_SDK_HOME="$formatted_path"
5724     if test "$build_os" = "cygwin"; then
5725         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5726         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5727             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5728         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5729             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5730         fi
5731     fi
5733     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5734     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5735     dnl but not in v8.0), so allow this to be overridden with a
5736     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5737     dnl and configuration error if no WiLangId.vbs is found would arguably be
5738     dnl better, but I do not know under which conditions exactly it is needed by
5739     dnl msiglobal.pm:
5740     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5741         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5742         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5743             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5744         fi
5745         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5746             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5747         fi
5748         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5749             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5750         fi
5751     fi
5752     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5753         if test -n "$with_package_format" -a "$with_package_format" != no; then
5754             for i in "$with_package_format"; do
5755                 if test "$i" = "msi"; then
5756                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5757                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5758                     fi
5759                 fi
5760             done
5761         fi
5762     fi
5764 AC_SUBST(WINDOWS_SDK_HOME)
5765 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5766 AC_SUBST(WINDOWS_SDK_VERSION)
5767 AC_SUBST(WINDOWS_SDK_WILANGID)
5769 if test "$build_os" = "cygwin"; then
5770     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5771     dnl dir, it also determines that dir's path w/o an arch segment if any,
5772     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5773     AC_MSG_CHECKING([for midl.exe])
5775     find_winsdk
5776     if test -n "$winsdkbinsubdir" \
5777         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5778     then
5779         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5780         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5781     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5782         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5783         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5784     elif test -f "$winsdktest/Bin/midl.exe"; then
5785         MIDL_PATH=$winsdktest/Bin
5786         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5787     fi
5788     if test ! -f "$MIDL_PATH/midl.exe"; then
5789         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5790     else
5791         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5792     fi
5794     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5795     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5797     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5798          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5799          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5800          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5801     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5802          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5803          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5804          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5805     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5806          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5807          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5808          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5809     else
5810         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5811     fi
5813     dnl Check csc.exe
5814     AC_MSG_CHECKING([for csc.exe])
5815     find_csc
5816     if test -f "$csctest/csc.exe"; then
5817         CSC_PATH="$csctest"
5818     fi
5819     if test ! -f "$CSC_PATH/csc.exe"; then
5820         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5821     else
5822         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5823     fi
5825     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5827     dnl Check al.exe
5828     AC_MSG_CHECKING([for al.exe])
5829     find_winsdk
5830     if test -n "$winsdkbinsubdir" \
5831         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5832     then
5833         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5834     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5835         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5836     elif test -f "$winsdktest/Bin/al.exe"; then
5837         AL_PATH="$winsdktest/Bin"
5838     fi
5840     if test -z "$AL_PATH"; then
5841         find_al
5842         if test -f "$altest/bin/al.exe"; then
5843             AL_PATH="$altest/bin"
5844         elif test -f "$altest/al.exe"; then
5845             AL_PATH="$altest"
5846         fi
5847     fi
5848     if test ! -f "$AL_PATH/al.exe"; then
5849         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5850     else
5851         AC_MSG_RESULT([$AL_PATH/al.exe])
5852     fi
5854     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5856     dnl Check mscoree.lib / .NET Framework dir
5857     AC_MSG_CHECKING(.NET Framework)
5858     find_dotnetsdk46
5859     PathFormat "$frametest"
5860     frametest="$formatted_path"
5861     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5862         DOTNET_FRAMEWORK_HOME="$frametest"
5863     else
5864         find_winsdk
5865         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5866             DOTNET_FRAMEWORK_HOME="$winsdktest"
5867         fi
5868     fi
5869     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
5870         AC_MSG_ERROR([mscoree.lib not found])
5871     fi
5872     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5874     PathFormat "$MIDL_PATH"
5875     MIDL_PATH="$formatted_path"
5877     PathFormat "$AL_PATH"
5878     AL_PATH="$formatted_path"
5880     PathFormat "$DOTNET_FRAMEWORK_HOME"
5881     DOTNET_FRAMEWORK_HOME="$formatted_path"
5883     PathFormat "$CSC_PATH"
5884     CSC_PATH="$formatted_path"
5887 dnl ===================================================================
5888 dnl Check if stdc headers are available excluding MSVC.
5889 dnl ===================================================================
5890 if test "$_os" != "WINNT"; then
5891     AC_HEADER_STDC
5894 dnl ===================================================================
5895 dnl Testing for C++ compiler and version...
5896 dnl ===================================================================
5898 if test "$_os" != "WINNT"; then
5899     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5900     save_CXXFLAGS=$CXXFLAGS
5901     AC_PROG_CXX
5902     CXXFLAGS=$save_CXXFLAGS
5903     if test -z "$CXX_BASE"; then
5904         CXX_BASE=`first_arg_basename "$CXX"`
5905     fi
5906 else
5907     if test -n "$CC" -a -z "$CXX"; then
5908         CXX="$CC"
5909         CXX_BASE="$CC_BASE"
5910     fi
5913 dnl check for GNU C++ compiler version
5914 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5915     AC_MSG_CHECKING([the GNU C++ compiler version])
5917     _gpp_version=`$CXX -dumpversion`
5918     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5920     if test "$_gpp_majmin" -lt "700"; then
5921         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5922     else
5923         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5924     fi
5926     dnl see https://code.google.com/p/android/issues/detail?id=41770
5927         glibcxx_threads=no
5928         AC_LANG_PUSH([C++])
5929         AC_REQUIRE_CPP
5930         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5931         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5932             #include <bits/c++config.h>]],[[
5933             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5934             && !defined(_GLIBCXX__PTHREADS) \
5935             && !defined(_GLIBCXX_HAS_GTHREADS)
5936             choke me
5937             #endif
5938         ]])],[AC_MSG_RESULT([yes])
5939         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5940         AC_LANG_POP([C++])
5941         if test $glibcxx_threads = yes; then
5942             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5943         fi
5945 AC_SUBST(BOOST_CXXFLAGS)
5948 # prefx CXX with ccache if needed
5950 if test "$CCACHE" != ""; then
5951     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5952     AC_LANG_PUSH([C++])
5953     save_CXXFLAGS=$CXXFLAGS
5954     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5955     dnl an empty program will do, we're checking the compiler flags
5956     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5957                       [use_ccache=yes], [use_ccache=no])
5958     if test $use_ccache = yes; then
5959         AC_MSG_RESULT([yes])
5960     else
5961         CXX="$CCACHE $CXX"
5962         CXX_BASE="ccache $CXX_BASE"
5963         AC_MSG_RESULT([no])
5964     fi
5965     CXXFLAGS=$save_CXXFLAGS
5966     AC_LANG_POP([C++])
5969 dnl ===================================================================
5970 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5971 dnl ===================================================================
5973 if test "$_os" != "WINNT"; then
5974     AC_PROG_CXXCPP
5976     dnl Check whether there's a C pre-processor.
5977     AC_PROG_CPP
5981 dnl ===================================================================
5982 dnl Find integral type sizes and alignments
5983 dnl ===================================================================
5985 if test "$_os" != "WINNT"; then
5987 if test "$_os" == "iOS"; then
5988     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5989     ac_cv_sizeof_long=8
5990     ac_cv_sizeof_short=2
5991     ac_cv_sizeof_int=4
5992     ac_cv_sizeof_long_long=8
5993     ac_cv_sizeof_double=8
5994     ac_cv_sizeof_voidp=8
5995 else
5996     AC_CHECK_SIZEOF(long)
5997     AC_CHECK_SIZEOF(short)
5998     AC_CHECK_SIZEOF(int)
5999     AC_CHECK_SIZEOF(long long)
6000     AC_CHECK_SIZEOF(double)
6001     AC_CHECK_SIZEOF(void*)
6004     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6005     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6006     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6007     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6008     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6010     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6011     m4_pattern_allow([AC_CHECK_ALIGNOF])
6012     m4_ifdef([AC_CHECK_ALIGNOF],
6013         [
6014             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6015             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6016             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6017             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6018         ],
6019         [
6020             case "$_os-$host_cpu" in
6021             Linux-i686)
6022                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6023                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6024                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6025                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6026                 ;;
6027             Linux-x86_64)
6028                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6029                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6030                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6031                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6032                 ;;
6033             *)
6034                 if test -z "$ac_cv_alignof_short" -o \
6035                         -z "$ac_cv_alignof_int" -o \
6036                         -z "$ac_cv_alignof_long" -o \
6037                         -z "$ac_cv_alignof_double"; then
6038                    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.])
6039                 fi
6040                 ;;
6041             esac
6042         ])
6044     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6045     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6046     if test $ac_cv_sizeof_long -eq 8; then
6047         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6048     elif test $ac_cv_sizeof_double -eq 8; then
6049         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6050     else
6051         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6052     fi
6054     dnl Check for large file support
6055     AC_SYS_LARGEFILE
6056     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6057         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6058     fi
6059     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6060         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6061     fi
6062 else
6063     # Hardcode for MSVC
6064     SAL_TYPES_SIZEOFSHORT=2
6065     SAL_TYPES_SIZEOFINT=4
6066     SAL_TYPES_SIZEOFLONG=4
6067     SAL_TYPES_SIZEOFLONGLONG=8
6068     if test "$BITNESS_OVERRIDE" = ""; then
6069         SAL_TYPES_SIZEOFPOINTER=4
6070     else
6071         SAL_TYPES_SIZEOFPOINTER=8
6072     fi
6073     SAL_TYPES_ALIGNMENT2=2
6074     SAL_TYPES_ALIGNMENT4=4
6075     SAL_TYPES_ALIGNMENT8=8
6076     LFS_CFLAGS=''
6078 AC_SUBST(LFS_CFLAGS)
6080 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6081 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6082 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6083 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6084 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6085 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6086 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6087 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6089 dnl ===================================================================
6090 dnl Check whether to enable runtime optimizations
6091 dnl ===================================================================
6092 ENABLE_RUNTIME_OPTIMIZATIONS=
6093 AC_MSG_CHECKING([whether to enable runtime optimizations])
6094 if test -z "$enable_runtime_optimizations"; then
6095     for i in $CC; do
6096         case $i in
6097         -fsanitize=*)
6098             enable_runtime_optimizations=no
6099             break
6100             ;;
6101         esac
6102     done
6104 if test "$enable_runtime_optimizations" != no; then
6105     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6106     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6107     AC_MSG_RESULT([yes])
6108 else
6109     AC_MSG_RESULT([no])
6111 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6113 dnl ===================================================================
6114 dnl Check if valgrind headers are available
6115 dnl ===================================================================
6116 ENABLE_VALGRIND=
6117 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6118     prev_cppflags=$CPPFLAGS
6119     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6120     # or where does it come from?
6121     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6122     AC_CHECK_HEADER([valgrind/valgrind.h],
6123         [ENABLE_VALGRIND=TRUE])
6124     CPPFLAGS=$prev_cppflags
6126 AC_SUBST([ENABLE_VALGRIND])
6127 if test -z "$ENABLE_VALGRIND"; then
6128     if test "$with_valgrind" = yes; then
6129         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6130     fi
6131     VALGRIND_CFLAGS=
6133 AC_SUBST([VALGRIND_CFLAGS])
6136 dnl ===================================================================
6137 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6138 dnl ===================================================================
6140 # We need at least the sys/sdt.h include header.
6141 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6142 if test "$SDT_H_FOUND" = "TRUE"; then
6143     # Found sys/sdt.h header, now make sure the c++ compiler works.
6144     # Old g++ versions had problems with probes in constructors/destructors.
6145     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6146     AC_LANG_PUSH([C++])
6147     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6148     #include <sys/sdt.h>
6149     class ProbeClass
6150     {
6151     private:
6152       int& ref;
6153       const char *name;
6155     public:
6156       ProbeClass(int& v, const char *n) : ref(v), name(n)
6157       {
6158         DTRACE_PROBE2(_test_, cons, name, ref);
6159       }
6161       void method(int min)
6162       {
6163         DTRACE_PROBE3(_test_, meth, name, ref, min);
6164         ref -= min;
6165       }
6167       ~ProbeClass()
6168       {
6169         DTRACE_PROBE2(_test_, dest, name, ref);
6170       }
6171     };
6172     ]],[[
6173     int i = 64;
6174     DTRACE_PROBE1(_test_, call, i);
6175     ProbeClass inst = ProbeClass(i, "call");
6176     inst.method(24);
6177     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6178           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6179     AC_LANG_POP([C++])
6181 AC_CONFIG_HEADERS([config_host/config_probes.h])
6183 dnl ===================================================================
6184 dnl GCC features
6185 dnl ===================================================================
6186 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6187     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6188     save_CFLAGS=$CFLAGS
6189     CFLAGS="$CFLAGS -Werror -mno-avx"
6190     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6191     CFLAGS=$save_CFLAGS
6192     if test "$HAVE_GCC_AVX" = "TRUE"; then
6193         AC_MSG_RESULT([yes])
6194     else
6195         AC_MSG_RESULT([no])
6196     fi
6198     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-protector-strong])
6199     save_CFLAGS=$CFLAGS
6200     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6201     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6202     CFLAGS=$save_CFLAGS
6203     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6204         AC_MSG_RESULT([yes])
6205     else
6206         AC_MSG_RESULT([no])
6207     fi
6209     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6210     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6211     int v = 0;
6212     if (__sync_add_and_fetch(&v, 1) != 1 ||
6213         __sync_sub_and_fetch(&v, 1) != 0)
6214         return 1;
6215     __sync_synchronize();
6216     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6217         v != 1)
6218         return 1;
6219     return 0;
6220 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6221     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6222         AC_MSG_RESULT([yes])
6223         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6224     else
6225         AC_MSG_RESULT([no])
6226     fi
6228     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6229     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6230     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6231         AC_MSG_RESULT([yes])
6232         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6233     else
6234         AC_MSG_RESULT([no])
6235     fi
6237     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6238     save_CFLAGS=$CFLAGS
6239     CFLAGS="$CFLAGS -Werror"
6240     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6241             __attribute__((deprecated("test"))) void f();
6242         ])], [
6243             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6244             AC_MSG_RESULT([yes])
6245         ], [AC_MSG_RESULT([no])])
6246     CFLAGS=$save_CFLAGS
6248     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6249     AC_LANG_PUSH([C++])
6250     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6251             #include <cstddef>
6252             #include <cxxabi.h>
6253             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6254         ])], [
6255             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6256             AC_MSG_RESULT([yes])
6257         ], [AC_MSG_RESULT([no])])
6258     AC_LANG_POP([C++])
6260     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6261     AC_LANG_PUSH([C++])
6262     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6263             #include <cstddef>
6264             #include <cxxabi.h>
6265             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6266         ])], [
6267             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6268             AC_MSG_RESULT([yes])
6269         ], [AC_MSG_RESULT([no])])
6270     AC_LANG_POP([C++])
6272     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6273     AC_LANG_PUSH([C++])
6274     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6275             #include <cxxabi.h>
6276             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6277         ])], [
6278             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6279             AC_MSG_RESULT([yes])
6280         ], [AC_MSG_RESULT([no])])
6281     AC_LANG_POP([C++])
6283     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6284     AC_LANG_PUSH([C++])
6285     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6286             #include <cstddef>
6287             #include <cxxabi.h>
6288             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6289         ])], [
6290             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6291             AC_MSG_RESULT([yes])
6292         ], [AC_MSG_RESULT([no])])
6293     AC_LANG_POP([C++])
6295     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6296     AC_LANG_PUSH([C++])
6297     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6298             #include <cstddef>
6299             #include <cxxabi.h>
6300             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6301         ])], [
6302             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6303             AC_MSG_RESULT([yes])
6304         ], [AC_MSG_RESULT([no])])
6305     AC_LANG_POP([C++])
6307     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6308     AC_LANG_PUSH([C++])
6309     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6310             #include <cxxabi.h>
6311             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6312         ])], [
6313             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6314             AC_MSG_RESULT([yes])
6315         ], [AC_MSG_RESULT([no])])
6316     AC_LANG_POP([C++])
6318     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6319     AC_LANG_PUSH([C++])
6320     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6321             #include <cxxabi.h>
6322             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6323         ])], [
6324             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6325             AC_MSG_RESULT([yes])
6326         ], [AC_MSG_RESULT([no])])
6327     AC_LANG_POP([C++])
6329     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6330     AC_LANG_PUSH([C++])
6331     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6332             #include <cxxabi.h>
6333             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6334         ])], [
6335             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6336             AC_MSG_RESULT([yes])
6337         ], [AC_MSG_RESULT([no])])
6338     AC_LANG_POP([C++])
6340     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6341     AC_LANG_PUSH([C++])
6342     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6343             #include <cstddef>
6344             #include <cxxabi.h>
6345             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6346         ])], [
6347             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6348             AC_MSG_RESULT([yes])
6349         ], [AC_MSG_RESULT([no])])
6350     AC_LANG_POP([C++])
6352     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6353     AC_LANG_PUSH([C++])
6354     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6355             #include <cstddef>
6356             #include <cxxabi.h>
6357             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6358         ])], [
6359             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6360             AC_MSG_RESULT([yes])
6361         ], [AC_MSG_RESULT([no])])
6362     AC_LANG_POP([C++])
6364     dnl Available in GCC 4.9 and at least since Clang 3.4:
6365     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6366     AC_LANG_PUSH([C++])
6367     save_CXXFLAGS=$CXXFLAGS
6368     CXXFLAGS="$CXXFLAGS -Werror"
6369     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6370             struct __attribute__((warn_unused)) dummy {};
6371         ])], [
6372             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6373             AC_MSG_RESULT([yes])
6374         ], [AC_MSG_RESULT([no])])
6375     CXXFLAGS=$save_CXXFLAGS
6376 AC_LANG_POP([C++])
6379 AC_SUBST(HAVE_GCC_AVX)
6380 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6381 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6382 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6384 dnl ===================================================================
6385 dnl Identify the C++ library
6386 dnl ===================================================================
6388 AC_MSG_CHECKING([what the C++ library is])
6389 AC_LANG_PUSH([C++])
6390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6391 #include <utility>
6392 #ifndef __GLIBCXX__
6393 foo bar
6394 #endif
6395 ]])],
6396     [CPP_LIBRARY=GLIBCXX
6397      cpp_library_name="GNU libstdc++"
6398     ],
6399     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6400 #include <utility>
6401 #ifndef _LIBCPP_VERSION
6402 foo bar
6403 #endif
6404 ]])],
6405     [CPP_LIBRARY=LIBCPP
6406      cpp_library_name="LLVM libc++"
6407      AC_DEFINE([HAVE_LIBCXX])
6408     ],
6409     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6410 #include <utility>
6411 #ifndef _MSC_VER
6412 foo bar
6413 #endif
6414 ]])],
6415     [CPP_LIBRARY=MSVCRT
6416      cpp_library_name="Microsoft"
6417     ],
6418     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6419 AC_MSG_RESULT([$cpp_library_name])
6420 AC_LANG_POP([C++])
6422 dnl ===================================================================
6423 dnl Check for gperf
6424 dnl ===================================================================
6425 AC_PATH_PROG(GPERF, gperf)
6426 if test -z "$GPERF"; then
6427     AC_MSG_ERROR([gperf not found but needed. Install it.])
6429 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6430     GPERF=`cygpath -m $GPERF`
6432 AC_MSG_CHECKING([whether gperf is new enough])
6433 my_gperf_ver1=$($GPERF --version | head -n 1)
6434 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6435 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6436 if test "$my_gperf_ver3" -ge 301; then
6437     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6438 else
6439     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6441 AC_SUBST(GPERF)
6443 dnl ===================================================================
6444 dnl Check for system libcmis
6445 dnl ===================================================================
6446 # libcmis requires curl and we can't build curl for iOS
6447 if test $_os != iOS; then
6448     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6449     ENABLE_LIBCMIS=TRUE
6450 else
6451     ENABLE_LIBCMIS=
6453 AC_SUBST(ENABLE_LIBCMIS)
6455 dnl ===================================================================
6456 dnl C++11
6457 dnl ===================================================================
6459 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6460 CXXFLAGS_CXX11=
6461 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6462     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6463 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6464     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6465     for flag in $my_flags; do
6466         if test "$COM" = MSC; then
6467             flag="-Xclang $flag"
6468         fi
6469         save_CXXFLAGS=$CXXFLAGS
6470         CXXFLAGS="$CXXFLAGS $flag -Werror"
6471         if test "$SYSTEM_LIBCMIS" = TRUE; then
6472             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6473         fi
6474         AC_LANG_PUSH([C++])
6475         dnl Clang 3.9 supports __float128 since
6476         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6477         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6478         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6479         dnl $flag is supported below, so check this first):
6480         my_float128hack=
6481         my_float128hack_impl=-D__float128=void
6482         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6483             #include <vector>
6484             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6485             // (__float128)
6486             ]])
6487         ],,[
6488             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6489             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6490             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6491             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6492             dnl place where __float128 is used is in a template specialization, -D__float128=void
6493             dnl will avoid the problem there while still causing a problem if somebody actually uses
6494             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6495             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6496             dnl "fixed" with this hack):
6497             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6498             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6499                 #include <vector>
6500                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6501                 // (__float128)
6502                 ]])
6503             ],[my_float128hack=$my_float128hack_impl])
6504         ])
6505         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6506             #include <algorithm>
6507             #include <cmath>
6508             #include <functional>
6509             #include <vector>
6511             #if defined SYSTEM_LIBCMIS
6512             // See ucb/source/ucp/cmis/auth_provider.hxx:
6513             #if !defined __clang__
6514             #pragma GCC diagnostic push
6515             #pragma GCC diagnostic ignored "-Wdeprecated"
6516             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6517             #endif
6518             #include <libcmis/libcmis.hxx>
6519             #if !defined __clang__
6520             #pragma GCC diagnostic pop
6521             #endif
6522             #endif
6524             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6525                 std::sort(v.begin(), v.end(), fn);
6526             }
6528             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6529             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6530             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6531             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6532             // needed by sc/source/core/tool/math.cxx):
6533             int g() { return math_errhandling; }
6534             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6535         AC_LANG_POP([C++])
6536         CXXFLAGS=$save_CXXFLAGS
6537         if test -n "$CXXFLAGS_CXX11"; then
6538             break
6539         fi
6540     done
6542 if test -n "$CXXFLAGS_CXX11"; then
6543     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6544 else
6545     AC_MSG_ERROR(no)
6547 AC_SUBST(CXXFLAGS_CXX11)
6549 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6550 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6551 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6552 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6553 dnl again towards 4.7.2:
6554 if test $CPP_LIBRARY = GLIBCXX; then
6555     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6556     AC_LANG_PUSH([C++])
6557     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6558 #include <list>
6559 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6560     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6561     //   GCC 4.7.0: 20120322
6562     //   GCC 4.7.1: 20120614
6563     // and using a range check is not possible as the mapping between
6564     // __GLIBCXX__ values and GCC versions is not monotonic
6565 /* ok */
6566 #else
6567 abi broken
6568 #endif
6569         ]])], [AC_MSG_RESULT(no, ok)],
6570         [AC_MSG_ERROR(yes)])
6571     AC_LANG_POP([C++])
6574 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6575 save_CXXFLAGS=$CXXFLAGS
6576 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6577 AC_LANG_PUSH([C++])
6579 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6580 #include <stddef.h>
6582 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6584 namespace
6586         struct b
6587         {
6588                 int i;
6589                 int j;
6590         };
6592 ]], [[
6593 struct a
6595         int i;
6596         int j;
6598 a thinga[]={{0,0}, {1,1}};
6599 b thingb[]={{0,0}, {1,1}};
6600 size_t i = sizeof(sal_n_array_size(thinga));
6601 size_t j = sizeof(sal_n_array_size(thingb));
6602 return !(i != 0 && j != 0);
6604     ], [ AC_MSG_RESULT(yes) ],
6605     [ AC_MSG_ERROR(no)])
6606 AC_LANG_POP([C++])
6607 CXXFLAGS=$save_CXXFLAGS
6609 dnl _Pragma support (may require C++11)
6610 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6611     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6612     AC_LANG_PUSH([C++])
6613     save_CXXFLAGS=$CXXFLAGS
6614     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6615     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6616             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6617         ])], [
6618             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6619             AC_MSG_RESULT([yes])
6620         ], [AC_MSG_RESULT([no])])
6621     AC_LANG_POP([C++])
6622     CXXFLAGS=$save_CXXFLAGS
6625 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6626 if test "$GCC" = yes; then
6627     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6628     AC_LANG_PUSH([C++])
6629     save_CXXFLAGS=$CXXFLAGS
6630     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6631     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6632     CXXFLAGS=$save_CXXFLAGS
6633     AC_LANG_POP([C++])
6634     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6635         AC_MSG_RESULT([yes])
6636     else
6637         AC_MSG_RESULT([no])
6638     fi
6640 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6642 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6643 AC_LANG_PUSH([C++])
6644 save_CXXFLAGS=$CXXFLAGS
6645 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6646 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6647         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6648         // supporting it:
6649         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6650         struct S {
6651         private:
6652             S(S const &);
6653         public:
6654             S();
6655             ~S();
6656         };
6657         S copy();
6658         void f() { S c(copy()); }
6659         #endif
6660     ])], [
6661         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6662         AC_MSG_RESULT([yes])
6663     ], [AC_MSG_RESULT([no])])
6664 CXXFLAGS=$save_CXXFLAGS
6665 AC_LANG_POP([C++])
6667 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6668 AC_LANG_PUSH([C++])
6669 save_CXXFLAGS=$CXXFLAGS
6670 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6672         struct S1 { S1(S1 &&); };
6673         struct S2: S1 {};
6674         S1 f(S2 s) { return s; }
6675     ])], [
6676         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6677         AC_MSG_RESULT([yes])
6678     ], [AC_MSG_RESULT([no])])
6679 CXXFLAGS=$save_CXXFLAGS
6680 AC_LANG_POP([C++])
6682 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6683 dnl uninitialized warning for code like
6685 dnl   OString f();
6686 dnl   boost::optional<OString> * g(bool b) {
6687 dnl       boost::optional<OString> o;
6688 dnl       if (b) o = f();
6689 dnl       return new boost::optional<OString>(o);
6690 dnl   }
6692 dnl (as is e.g. present, in a slightly more elaborate form, in
6693 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6694 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6695 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6696 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6697     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6698     AC_LANG_PUSH([C++])
6699     save_CXXFLAGS=$CXXFLAGS
6700     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6701     if test "$ENABLE_OPTIMIZED" = TRUE; then
6702         CXXFLAGS="$CXXFLAGS -O2"
6703     else
6704         CXXFLAGS="$CXXFLAGS -O0"
6705     fi
6706     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6707             #include <new>
6708             void f1(int);
6709             struct S1 {
6710                 ~S1() { f1(n); }
6711                 int n = 0;
6712             };
6713             struct S2 {
6714                 S2() {}
6715                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6716                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6717                 void set(S1 s) {
6718                     new (stg) S1(s);
6719                     init = true;
6720                 }
6721                 bool init = false;
6722                 char stg[sizeof (S1)];
6723             } ;
6724             S1 f2();
6725             S2 * f3(bool b) {
6726                 S2 o;
6727                 if (b) o.set(f2());
6728                 return new S2(o);
6729             }
6730         ]])], [AC_MSG_RESULT([no])], [
6731             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6732             AC_MSG_RESULT([yes])
6733         ])
6734     CXXFLAGS=$save_CXXFLAGS
6735     AC_LANG_POP([C++])
6737 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6739 dnl ===================================================================
6740 dnl CPU Intrinsics support - SSE, AVX
6741 dnl ===================================================================
6743 INTRINSICS_CXXFLAGS=""
6745 if test "$GCC" = "yes"; then
6746     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6747     AC_LANG_PUSH([C++])
6748     save_CXXFLAGS=$CXXFLAGS
6749     CXXFLAGS="$CXXFLAGS -msse2"
6750     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6751         #include <emmintrin.h>
6752         int main () {
6753             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6754             c = _mm_xor_si128 (a, b);
6755             return 0;
6756         }
6757         ])],
6758         [can_compile_sse2=yes],
6759         [can_compile_sse2=no])
6760     AC_LANG_POP([C++])
6761     CXXFLAGS=$save_CXXFLAGS
6762     AC_MSG_RESULT([${can_compile_sse2}])
6763     if test "${can_compile_sse2}" = "yes" ; then
6764         INTRINSICS_CXXFLAGS="-msse2"
6765     else
6766         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6767     fi
6769     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6770     AC_LANG_PUSH([C++])
6771     save_CXXFLAGS=$CXXFLAGS
6772     CXXFLAGS="$CXXFLAGS -mssse3"
6773     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6774         #include <tmmintrin.h>
6775         int main () {
6776             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6777             c = _mm_maddubs_epi16 (a, b);
6778             return 0;
6779         }
6780         ])],
6781         [can_compile_ssse3=yes],
6782         [can_compile_ssse3=no])
6783     AC_LANG_POP([C++])
6784     CXXFLAGS=$save_CXXFLAGS
6785     AC_MSG_RESULT([${can_compile_ssse3}])
6786     if test "${can_compile_ssse3}" = "yes" ; then
6787         INTRINSICS_CXXFLAGS="-mssse3"
6788     else
6789         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6790     fi
6792     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6793     AC_LANG_PUSH([C++])
6794     save_CXXFLAGS=$CXXFLAGS
6795     CXXFLAGS="$CXXFLAGS -mavx"
6796     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6797         #include <immintrin.h>
6798         int main () {
6799             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6800             c = _mm256_xor_ps(a, b);
6801             return 0;
6802         }
6803         ])],
6804         [can_compile_avx=yes],
6805         [can_compile_avx=no])
6806     AC_LANG_POP([C++])
6807     CXXFLAGS=$save_CXXFLAGS
6808     AC_MSG_RESULT([${can_compile_avx}])
6809     if test "${can_compile_avx}" = "yes" ; then
6810         INTRINSICS_CXXFLAGS="-mavx"
6811     else
6812         AC_MSG_WARN([cannot compile AVX intrinsics])
6813     fi
6815     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6816     AC_LANG_PUSH([C++])
6817     save_CXXFLAGS=$CXXFLAGS
6818     CXXFLAGS="$CXXFLAGS -mavx2"
6819     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6820         #include <immintrin.h>
6821         int main () {
6822             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6823             c = _mm256_maddubs_epi16(a, b);
6824             return 0;
6825         }
6826         ])],
6827         [can_compile_avx2=yes],
6828         [can_compile_avx2=no])
6829     AC_LANG_POP([C++])
6830     CXXFLAGS=$save_CXXFLAGS
6831     AC_MSG_RESULT([${can_compile_avx2}])
6832     if test "${can_compile_avx2}" = "yes" ; then
6833         INTRINSICS_CXXFLAGS="-mavx2"
6834     else
6835         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6836     fi
6839 AC_SUBST([INTRINSICS_CXXFLAGS])
6841 dnl ===================================================================
6842 dnl system stl sanity tests
6843 dnl ===================================================================
6844 if test "$_os" != "WINNT"; then
6846     AC_LANG_PUSH([C++])
6848     save_CPPFLAGS="$CPPFLAGS"
6849     if test -n "$MACOSX_SDK_PATH"; then
6850         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6851     fi
6853     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6854     # only.
6855     if test "$CPP_LIBRARY" = GLIBCXX; then
6856         dnl gcc#19664, gcc#22482, rhbz#162935
6857         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6858         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6859         AC_MSG_RESULT([$stlvisok])
6860         if test "$stlvisok" = "no"; then
6861             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6862         fi
6863     fi
6865     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6866     # when we don't make any dynamic libraries?
6867     if test "$DISABLE_DYNLOADING" = ""; then
6868         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6869         cat > conftestlib1.cc <<_ACEOF
6870 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6871 struct S2: S1<int> { virtual ~S2(); };
6872 S2::~S2() {}
6873 _ACEOF
6874         cat > conftestlib2.cc <<_ACEOF
6875 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6876 struct S2: S1<int> { virtual ~S2(); };
6877 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6878 _ACEOF
6879         gccvisinlineshiddenok=yes
6880         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6881             gccvisinlineshiddenok=no
6882         else
6883             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6884             dnl known to not work with -z defs (unsetting which makes the test
6885             dnl moot, though):
6886             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6887             if test "$COM_IS_CLANG" = TRUE; then
6888                 for i in $CXX $CXXFLAGS; do
6889                     case $i in
6890                     -fsanitize=*)
6891                         my_linkflagsnoundefs=
6892                         break
6893                         ;;
6894                     esac
6895                 done
6896             fi
6897             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6898                 gccvisinlineshiddenok=no
6899             fi
6900         fi
6902         rm -fr libconftest*
6903         AC_MSG_RESULT([$gccvisinlineshiddenok])
6904         if test "$gccvisinlineshiddenok" = "no"; then
6905             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6906         fi
6907     fi
6909    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6910     cat >visibility.cxx <<_ACEOF
6911 #pragma GCC visibility push(hidden)
6912 struct __attribute__ ((visibility ("default"))) TestStruct {
6913   static void Init();
6915 __attribute__ ((visibility ("default"))) void TestFunc() {
6916   TestStruct::Init();
6918 _ACEOF
6919     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6920         gccvisbroken=yes
6921     else
6922         case "$host_cpu" in
6923         i?86|x86_64)
6924             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6925                 gccvisbroken=no
6926             else
6927                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6928                     gccvisbroken=no
6929                 else
6930                     gccvisbroken=yes
6931                 fi
6932             fi
6933             ;;
6934         *)
6935             gccvisbroken=no
6936             ;;
6937         esac
6938     fi
6939     rm -f visibility.s visibility.cxx
6941     AC_MSG_RESULT([$gccvisbroken])
6942     if test "$gccvisbroken" = "yes"; then
6943         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6944     fi
6946     CPPFLAGS="$save_CPPFLAGS"
6948     AC_LANG_POP([C++])
6951 dnl ===================================================================
6952 dnl  Clang++ tests
6953 dnl ===================================================================
6955 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6956 if test "$GCC" = "yes"; then
6957     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6958     AC_LANG_PUSH([C++])
6959     save_CXXFLAGS=$CXXFLAGS
6960     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6961     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6962     CXXFLAGS=$save_CXXFLAGS
6963     AC_LANG_POP([C++])
6964     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6965         AC_MSG_RESULT([yes])
6966     else
6967         AC_MSG_RESULT([no])
6968     fi
6970 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6972 dnl ===================================================================
6973 dnl Compiler plugins
6974 dnl ===================================================================
6976 COMPILER_PLUGINS=
6977 # currently only Clang
6979 if test "$COM_IS_CLANG" != "TRUE"; then
6980     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6981         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6982         enable_compiler_plugins=no
6983     fi
6986 if test "$COM_IS_CLANG" = "TRUE"; then
6987     if test -n "$enable_compiler_plugins"; then
6988         compiler_plugins="$enable_compiler_plugins"
6989     elif test -n "$ENABLE_DBGUTIL"; then
6990         compiler_plugins=test
6991     else
6992         compiler_plugins=no
6993     fi
6994     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
6995         if test "$CLANGVER" -lt 50002; then
6996             if test "$compiler_plugins" = yes; then
6997                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6998             else
6999                 compiler_plugins=no
7000             fi
7001         fi
7002     fi
7003     if test "$compiler_plugins" != "no"; then
7004         dnl The prefix where Clang resides, override to where Clang resides if
7005         dnl using a source build:
7006         if test -z "$CLANGDIR"; then
7007             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7008         fi
7009         AC_LANG_PUSH([C++])
7010         save_CPPFLAGS=$CPPFLAGS
7011         save_CXX=$CXX
7012         save_CXXCPP=$CXXCPP
7013         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
7014         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
7015         CXX=$COMPILER_PLUGINS_CXX
7016         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7017         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
7018         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
7019             [COMPILER_PLUGINS=TRUE],
7020             [
7021             if test "$compiler_plugins" = "yes"; then
7022                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7023             else
7024                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7025                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7026             fi
7027             ])
7028         CXX=$save_CXX
7029         CXXCPP=$save_CXXCPP
7030         CPPFLAGS=$save_CPPFLAGS
7031         AC_LANG_POP([C++])
7032     fi
7033 else
7034     if test "$enable_compiler_plugins" = "yes"; then
7035         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7036     fi
7038 AC_SUBST(COMPILER_PLUGINS)
7039 AC_SUBST(COMPILER_PLUGINS_CXX)
7040 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7041 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7042 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7043 AC_SUBST(CLANGDIR)
7044 AC_SUBST(CLANGLIBDIR)
7046 # Plugin to help linker.
7047 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7048 # This makes --enable-lto build with clang work.
7049 AC_SUBST(LD_PLUGIN)
7051 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7052 AC_SUBST(HAVE_POSIX_FALLOCATE)
7054 dnl ===================================================================
7055 dnl Custom build version
7056 dnl ===================================================================
7058 AC_MSG_CHECKING([whether to add custom build version])
7059 if test "$with_build_version" != ""; then
7060     BUILD_VER_STRING=$with_build_version
7061     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7062 else
7063     BUILD_VER_STRING=
7064     AC_MSG_RESULT([no])
7066 AC_SUBST(BUILD_VER_STRING)
7068 JITC_PROCESSOR_TYPE=""
7069 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7070     # IBMs JDK needs this...
7071     JITC_PROCESSOR_TYPE=6
7072     export JITC_PROCESSOR_TYPE
7074 AC_SUBST([JITC_PROCESSOR_TYPE])
7076 # Misc Windows Stuff
7077 AC_ARG_WITH(ucrt-dir,
7078     AS_HELP_STRING([--with-ucrt-dir],
7079         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7080         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7081         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7082             Windows6.1-KB2999226-x64.msu
7083             Windows6.1-KB2999226-x86.msu
7084             Windows8.1-KB2999226-x64.msu
7085             Windows8.1-KB2999226-x86.msu
7086             Windows8-RT-KB2999226-x64.msu
7087             Windows8-RT-KB2999226-x86.msu
7088         A zip archive including those files is available from Microsoft site:
7089         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7091 UCRT_REDISTDIR="$with_ucrt_dir"
7092 if test $_os = "WINNT"; then
7093     find_msvc_x64_dlls
7094     find_msms
7095     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7096     MSVC_DLLS="$msvcdlls"
7097     MSM_PATH=`win_short_path_for_make "$msmdir"`
7098     # MSVC 15.3 changed it to VC141
7099     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7100         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7101     else
7102         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7103     fi
7105     if test "$UCRT_REDISTDIR" = "no"; then
7106         dnl explicitly disabled
7107         UCRT_REDISTDIR=""
7108     else
7109         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7110                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7111                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7112                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7113                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7114                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7115             UCRT_REDISTDIR=""
7116             if test -n "$PKGFORMAT"; then
7117                for i in $PKGFORMAT; do
7118                    case "$i" in
7119                    msi)
7120                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7121                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7122                        ;;
7123                    esac
7124                done
7125             fi
7126         fi
7127     fi
7130 AC_SUBST(UCRT_REDISTDIR)
7131 AC_SUBST(MSVC_DLL_PATH)
7132 AC_SUBST(MSVC_DLLS)
7133 AC_SUBST(MSM_PATH)
7135 dnl ===================================================================
7136 dnl Checks for Java
7137 dnl ===================================================================
7138 if test "$ENABLE_JAVA" != ""; then
7140     # Windows-specific tests
7141     if test "$build_os" = "cygwin"; then
7142         if test "$BITNESS_OVERRIDE" = 64; then
7143             bitness=64
7144         else
7145             bitness=32
7146         fi
7148         if test -z "$with_jdk_home"; then
7149             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7150             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7151             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7152             if test -n "$regvalue"; then
7153                 ver=$regvalue
7154                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7155                 _jdk_home=$regvalue
7156             fi
7157             if test -z "$with_jdk_home"; then
7158                 for ver in 1.8 1.7 1.6; do
7159                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7160                     if test -n "$regvalue"; then
7161                         _jdk_home=$regvalue
7162                         break
7163                     fi
7164                 done
7165             fi
7166             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7167                 with_jdk_home="$_jdk_home"
7168                 howfound="found automatically"
7169             else
7170                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7171             fi
7172         else
7173             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7174             howfound="you passed"
7175         fi
7176     fi
7178     # 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.
7179     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7180     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7181         with_jdk_home=`/usr/libexec/java_home`
7182     fi
7184     JAVA_HOME=; export JAVA_HOME
7185     if test -z "$with_jdk_home"; then
7186         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7187     else
7188         _java_path="$with_jdk_home/bin/$with_java"
7189         dnl Check if there is a Java interpreter at all.
7190         if test -x "$_java_path"; then
7191             JAVAINTERPRETER=$_java_path
7192         else
7193             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7194         fi
7195     fi
7197     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7198     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7199     dnl loaded by java to run JunitTests:
7200     if test "$build_os" = "cygwin"; then
7201         shortjdkhome=`cygpath -d "$with_jdk_home"`
7202         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
7203             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7204             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7205         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
7206             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7207             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7208         fi
7210         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7211             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7212         fi
7213         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7214     elif test "$cross_compiling" != "yes"; then
7215         case $CPUNAME in
7216             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7217                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7218                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7219                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7220                 fi
7221                 ;;
7222             *) # assumption: everything else 32-bit
7223                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7224                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7225                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7226                 fi
7227                 ;;
7228         esac
7229     fi
7232 dnl ===================================================================
7233 dnl Checks for JDK.
7234 dnl ===================================================================
7236 # Note that JAVA_HOME as for now always means the *build* platform's
7237 # JAVA_HOME. Whether all the complexity here actually is needed any
7238 # more or not, no idea.
7240 if test "$ENABLE_JAVA" != ""; then
7241     _gij_longver=0
7242     AC_MSG_CHECKING([the installed JDK])
7243     if test -n "$JAVAINTERPRETER"; then
7244         dnl java -version sends output to stderr!
7245         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7246             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7247         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7248             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7249         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7250             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7251         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7252             JDK=ibm
7254             dnl IBM JDK specific tests
7255             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7256             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7258             if test "$_jdk_ver" -lt 10600; then
7259                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
7260             fi
7262             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7264             if test "$with_jdk_home" = ""; then
7265                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7266 you must use the "--with-jdk-home" configure option explicitly])
7267             fi
7269             JAVA_HOME=$with_jdk_home
7270         else
7271             JDK=sun
7273             dnl Sun JDK specific tests
7274             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7275             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7277             if test "$_jdk_ver" -lt 10600; then
7278                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
7279             fi
7280             if test "$_jdk_ver" -gt 10600; then
7281                 JAVA_CLASSPATH_NOT_SET=TRUE
7282             fi
7284             AC_MSG_RESULT([found (JDK $_jdk)])
7285             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7286             if test "$_os" = "WINNT"; then
7287                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7288             fi
7290             # set to limit VM usage for JunitTests
7291             JAVAIFLAGS=-Xmx64M
7292             # set to limit VM usage for javac
7293             JAVAFLAGS=-J-Xmx128M
7294         fi
7295     else
7296         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7297     fi
7298 else
7299     dnl Java disabled
7300     JAVA_HOME=
7301     export JAVA_HOME
7304 dnl ===================================================================
7305 dnl Checks for javac
7306 dnl ===================================================================
7307 if test "$ENABLE_JAVA" != ""; then
7308     javacompiler="javac"
7309     : ${JAVA_SOURCE_VER=1.6}
7310     : ${JAVA_TARGET_VER=1.6}
7311     if test -z "$with_jdk_home"; then
7312         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7313     else
7314         _javac_path="$with_jdk_home/bin/$javacompiler"
7315         dnl Check if there is a Java compiler at all.
7316         if test -x "$_javac_path"; then
7317             JAVACOMPILER=$_javac_path
7318         fi
7319     fi
7320     if test -z "$JAVACOMPILER"; then
7321         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7322     fi
7323     if test "$build_os" = "cygwin"; then
7324         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7325             JAVACOMPILER="${JAVACOMPILER}.exe"
7326         fi
7327         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7328     fi
7331 dnl ===================================================================
7332 dnl Checks for javadoc
7333 dnl ===================================================================
7334 if test "$ENABLE_JAVA" != ""; then
7335     if test -z "$with_jdk_home"; then
7336         AC_PATH_PROG(JAVADOC, javadoc)
7337     else
7338         _javadoc_path="$with_jdk_home/bin/javadoc"
7339         dnl Check if there is a javadoc at all.
7340         if test -x "$_javadoc_path"; then
7341             JAVADOC=$_javadoc_path
7342         else
7343             AC_PATH_PROG(JAVADOC, javadoc)
7344         fi
7345     fi
7346     if test -z "$JAVADOC"; then
7347         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7348     fi
7349     if test "$build_os" = "cygwin"; then
7350         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7351             JAVADOC="${JAVADOC}.exe"
7352         fi
7353         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7354     fi
7356     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7357     JAVADOCISGJDOC="yes"
7358     fi
7360 AC_SUBST(JAVADOCISGJDOC)
7362 if test "$ENABLE_JAVA" != ""; then
7363     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7364     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7365         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7366            # try to recover first by looking whether we have an alternative
7367            # system as in Debian or newer SuSEs where following /usr/bin/javac
7368            # over /etc/alternatives/javac leads to the right bindir where we
7369            # just need to strip a bit away to get a valid JAVA_HOME
7370            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7371         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7372             # maybe only one level of symlink (e.g. on Mac)
7373             JAVA_HOME=$(readlink $JAVACOMPILER)
7374             if test "$(dirname $JAVA_HOME)" = "."; then
7375                 # we've got no path to trim back
7376                 JAVA_HOME=""
7377             fi
7378         else
7379             # else warn
7380             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7381             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7382             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7383             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7384         fi
7385         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7386         if test "$JAVA_HOME" != "/usr"; then
7387             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7388                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7389                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7390                 dnl Tiger already returns a JDK path..
7391                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7392             else
7393                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7394                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7395                 dnl that checks which version to run
7396                 if test -f "$JAVA_HOME"; then
7397                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7398                 fi
7399             fi
7400         fi
7401     fi
7402     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7404     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7405     if test -z "$JAVA_HOME"; then
7406         if test "x$with_jdk_home" = "x"; then
7407             cat > findhome.java <<_ACEOF
7408 [import java.io.File;
7410 class findhome
7412     public static void main(String args[])
7413     {
7414         String jrelocation = System.getProperty("java.home");
7415         File jre = new File(jrelocation);
7416         System.out.println(jre.getParent());
7417     }
7419 _ACEOF
7420             AC_MSG_CHECKING([if javac works])
7421             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7422             AC_TRY_EVAL(javac_cmd)
7423             if test $? = 0 -a -f ./findhome.class; then
7424                 AC_MSG_RESULT([javac works])
7425             else
7426                 echo "configure: javac test failed" >&5
7427                 cat findhome.java >&5
7428                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7429             fi
7430             AC_MSG_CHECKING([if gij knows its java.home])
7431             JAVA_HOME=`$JAVAINTERPRETER findhome`
7432             if test $? = 0 -a "$JAVA_HOME" != ""; then
7433                 AC_MSG_RESULT([$JAVA_HOME])
7434             else
7435                 echo "configure: java test failed" >&5
7436                 cat findhome.java >&5
7437                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7438             fi
7439             # clean-up after ourselves
7440             rm -f ./findhome.java ./findhome.class
7441         else
7442             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7443         fi
7444     fi
7446     # now check if $JAVA_HOME is really valid
7447     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7448         case "${JAVA_HOME}" in
7449             /Library/Java/JavaVirtualMachines/*)
7450                 ;;
7451             *)
7452                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7453                 ;;
7454         esac
7455         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7456             JAVA_HOME_OK="NO"
7457         fi
7458     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7459         JAVA_HOME_OK="NO"
7460     fi
7461     if test "$JAVA_HOME_OK" = "NO"; then
7462         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7463         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7464         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7465         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7466         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7467         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7468     fi
7469     PathFormat "$JAVA_HOME"
7470     JAVA_HOME="$formatted_path"
7473 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7474     "$_os" != Darwin
7475 then
7476     AC_MSG_CHECKING([for JAWT lib])
7477     if test "$_os" = WINNT; then
7478         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7479         JAWTLIB=jawt.lib
7480     else
7481         case "$host_cpu" in
7482         arm*)
7483             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7484             JAVA_ARCH=$my_java_arch
7485             ;;
7486         i*86)
7487             my_java_arch=i386
7488             ;;
7489         m68k)
7490             my_java_arch=m68k
7491             ;;
7492         powerpc)
7493             my_java_arch=ppc
7494             ;;
7495         powerpc64)
7496             my_java_arch=ppc64
7497             ;;
7498         powerpc64le)
7499             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7500             JAVA_ARCH=$my_java_arch
7501             ;;
7502         sparc64)
7503             my_java_arch=sparcv9
7504             ;;
7505         x86_64)
7506             my_java_arch=amd64
7507             ;;
7508         *)
7509             my_java_arch=$host_cpu
7510             ;;
7511         esac
7512         # This is where JDK9 puts the library
7513         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7514             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7515         else
7516             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7517         fi
7518         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7519     fi
7520     AC_MSG_RESULT([$JAWTLIB])
7522 AC_SUBST(JAWTLIB)
7524 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7525     case "$host_os" in
7527     aix*)
7528         JAVAINC="-I$JAVA_HOME/include"
7529         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7530         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7531         ;;
7533     cygwin*)
7534         JAVAINC="-I$JAVA_HOME/include/win32"
7535         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7536         ;;
7538     darwin*)
7539         if test -d "$JAVA_HOME/include/darwin"; then
7540             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7541         else
7542             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7543         fi
7544         ;;
7546     dragonfly*)
7547         JAVAINC="-I$JAVA_HOME/include"
7548         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7549         ;;
7551     freebsd*)
7552         JAVAINC="-I$JAVA_HOME/include"
7553         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7554         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7555         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7556         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7557         ;;
7559     k*bsd*-gnu*)
7560         JAVAINC="-I$JAVA_HOME/include"
7561         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7562         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7563         ;;
7565     linux-gnu*)
7566         JAVAINC="-I$JAVA_HOME/include"
7567         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7568         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7569         ;;
7571     *netbsd*)
7572         JAVAINC="-I$JAVA_HOME/include"
7573         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7574         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7575        ;;
7577     openbsd*)
7578         JAVAINC="-I$JAVA_HOME/include"
7579         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7580         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7581         ;;
7583     solaris*)
7584         JAVAINC="-I$JAVA_HOME/include"
7585         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7586         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7587         ;;
7588     esac
7590 SOLARINC="$SOLARINC $JAVAINC"
7592 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7593     url_check_unknown=0
7594     java_base="testurlcheck"
7595     java_src="${java_base}.java"
7596     java_cls="${java_base}.class"
7597     cat > "${java_src}" <<_ACEOF
7598 [import jdk.internal.loader.URLClassPath;
7599 import java.lang.reflect.Field;
7600 import java.net.URL;
7602 class ${java_base}
7604     public static void main(String args[])
7605     {
7606         try {
7607             URLClassPath cp = new URLClassPath(new URL[0], null);
7608             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7609             field.setAccessible(true);
7610             System.out.println(field.get(cp).toString());
7611         } catch(Exception e) {
7612             System.out.println("unknown");
7613         }
7614     }
7616 _ACEOF
7617     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7618     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7619     AC_TRY_EVAL(java_cmd)
7620     if test $? = 0 -a -f "./${java_cls}"; then
7621         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7622         if test $? = 0; then
7623             case "${java_res}" in
7624             true) AC_MSG_RESULT([yes]) ;;
7625             false)
7626                 rm -f "./${java_src}" "./${java_cls}"
7627                 AC_MSG_ERROR([no - Java unit tests will break!])
7628                 ;;
7629             *) url_check_unknown=1 ;;
7630             esac
7631         else
7632             url_check_unknown=1
7633         fi
7634     else
7635         url_check_unknown=1
7636     fi
7637     if test $url_check_unknown -eq 1; then
7638         AC_MSG_RESULT([unknown - assuming yes])
7639         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7640     fi
7641     rm -f "./${java_src}" "./${java_cls}"
7644 AC_SUBST(JAVACOMPILER)
7645 AC_SUBST(JAVADOC)
7646 AC_SUBST(JAVAINTERPRETER)
7647 AC_SUBST(JAVAIFLAGS)
7648 AC_SUBST(JAVAFLAGS)
7649 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7650 AC_SUBST(JAVA_HOME)
7651 AC_SUBST(JAVA_SOURCE_VER)
7652 AC_SUBST(JAVA_TARGET_VER)
7653 AC_SUBST(JDK)
7656 dnl ===================================================================
7657 dnl Export file validation
7658 dnl ===================================================================
7659 AC_MSG_CHECKING([whether to enable export file validation])
7660 if test "$with_export_validation" != "no"; then
7661     if test -z "$ENABLE_JAVA"; then
7662         if test "$with_export_validation" = "yes"; then
7663             AC_MSG_ERROR([requested, but Java is disabled])
7664         else
7665             AC_MSG_RESULT([no, as Java is disabled])
7666         fi
7667     elif test "$_jdk_ver" -lt 10800; then
7668         if test "$with_export_validation" = "yes"; then
7669             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7670         else
7671             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7672         fi
7673     else
7674         AC_MSG_RESULT([yes])
7675         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7677         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7678         if test -z "$ODFVALIDATOR"; then
7679             # remember to download the ODF toolkit with validator later
7680             AC_MSG_NOTICE([no odfvalidator found, will download it])
7681             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7682             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7684             # and fetch name of odfvalidator jar name from download.lst
7685             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7686             AC_SUBST(ODFVALIDATOR_JAR)
7688             if test -z "$ODFVALIDATOR_JAR"; then
7689                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7690             fi
7691         fi
7692         if test "$build_os" = "cygwin"; then
7693             # In case of Cygwin it will be executed from Windows,
7694             # so we need to run bash and absolute path to validator
7695             # so instead of "odfvalidator" it will be
7696             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7697             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7698         else
7699             ODFVALIDATOR="sh $ODFVALIDATOR"
7700         fi
7701         AC_SUBST(ODFVALIDATOR)
7704         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7705         if test -z "$OFFICEOTRON"; then
7706             # remember to download the officeotron with validator later
7707             AC_MSG_NOTICE([no officeotron found, will download it])
7708             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7709             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7711             # and fetch name of officeotron jar name from download.lst
7712             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7713             AC_SUBST(OFFICEOTRON_JAR)
7715             if test -z "$OFFICEOTRON_JAR"; then
7716                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7717             fi
7718         else
7719             # check version of existing officeotron
7720             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7721             if test 0"$OFFICEOTRON_VER" -lt 704; then
7722                 AC_MSG_ERROR([officeotron too old])
7723             fi
7724         fi
7725         if test "$build_os" = "cygwin"; then
7726             # In case of Cygwin it will be executed from Windows,
7727             # so we need to run bash and absolute path to validator
7728             # so instead of "odfvalidator" it will be
7729             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7730             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7731         else
7732             OFFICEOTRON="sh $OFFICEOTRON"
7733         fi
7734     fi
7735     AC_SUBST(OFFICEOTRON)
7736 else
7737     AC_MSG_RESULT([no])
7740 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7741 if test "$with_bffvalidator" != "no"; then
7742     AC_DEFINE(HAVE_BFFVALIDATOR)
7744     if test "$with_export_validation" = "no"; then
7745         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7746     fi
7748     if test "$with_bffvalidator" = "yes"; then
7749         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7750     else
7751         BFFVALIDATOR="$with_bffvalidator"
7752     fi
7754     if test "$build_os" = "cygwin"; then
7755         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7756             AC_MSG_RESULT($BFFVALIDATOR)
7757         else
7758             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7759         fi
7760     elif test -n "$BFFVALIDATOR"; then
7761         # We are not in Cygwin but need to run Windows binary with wine
7762         AC_PATH_PROGS(WINE, wine)
7764         # so swap in a shell wrapper that converts paths transparently
7765         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7766         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7767         AC_SUBST(BFFVALIDATOR_EXE)
7768         AC_MSG_RESULT($BFFVALIDATOR)
7769     else
7770         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7771     fi
7772     AC_SUBST(BFFVALIDATOR)
7773 else
7774     AC_MSG_RESULT([no])
7777 dnl ===================================================================
7778 dnl Check for C preprocessor to use
7779 dnl ===================================================================
7780 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7781 if test -n "$with_idlc_cpp"; then
7782     AC_MSG_RESULT([$with_idlc_cpp])
7783     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7784 else
7785     AC_MSG_RESULT([ucpp])
7786     AC_MSG_CHECKING([which ucpp tp use])
7787     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7788         AC_MSG_RESULT([external])
7789         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7790     else
7791         AC_MSG_RESULT([internal])
7792         BUILD_TYPE="$BUILD_TYPE UCPP"
7793     fi
7795 AC_SUBST(SYSTEM_UCPP)
7797 dnl ===================================================================
7798 dnl Check for epm (not needed for Windows)
7799 dnl ===================================================================
7800 AC_MSG_CHECKING([whether to enable EPM for packing])
7801 if test "$enable_epm" = "yes"; then
7802     AC_MSG_RESULT([yes])
7803     if test "$_os" != "WINNT"; then
7804         if test $_os = Darwin; then
7805             EPM=internal
7806         elif test -n "$with_epm"; then
7807             EPM=$with_epm
7808         else
7809             AC_PATH_PROG(EPM, epm, no)
7810         fi
7811         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7812             AC_MSG_NOTICE([EPM will be built.])
7813             BUILD_TYPE="$BUILD_TYPE EPM"
7814             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7815         else
7816             # Gentoo has some epm which is something different...
7817             AC_MSG_CHECKING([whether the found epm is the right epm])
7818             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7819                 AC_MSG_RESULT([yes])
7820             else
7821                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7822             fi
7823             AC_MSG_CHECKING([epm version])
7824             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7825             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7826                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7827                 AC_MSG_RESULT([OK, >= 3.7])
7828             else
7829                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7830                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7831             fi
7832         fi
7833     fi
7835     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7836         AC_MSG_CHECKING([for rpm])
7837         for a in "$RPM" rpmbuild rpm; do
7838             $a --usage >/dev/null 2> /dev/null
7839             if test $? -eq 0; then
7840                 RPM=$a
7841                 break
7842             else
7843                 $a --version >/dev/null 2> /dev/null
7844                 if test $? -eq 0; then
7845                     RPM=$a
7846                     break
7847                 fi
7848             fi
7849         done
7850         if test -z "$RPM"; then
7851             AC_MSG_ERROR([not found])
7852         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7853             RPM_PATH=`which $RPM`
7854             AC_MSG_RESULT([$RPM_PATH])
7855             SCPDEFS="$SCPDEFS -DWITH_RPM"
7856         else
7857             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7858         fi
7859     fi
7860     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7861         AC_PATH_PROG(DPKG, dpkg, no)
7862         if test "$DPKG" = "no"; then
7863             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7864         fi
7865     fi
7866     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7867        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7868         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7869             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7870                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7871                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7872                     AC_MSG_RESULT([yes])
7873                 else
7874                     AC_MSG_RESULT([no])
7875                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7876                         _pt="rpm"
7877                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7878                         add_warning "the rpms will need to be installed with --nodeps"
7879                     else
7880                         _pt="pkg"
7881                     fi
7882                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7883                     add_warning "the ${_pt}s will not be relocatable"
7884                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7885                                  relocation will work, you need to patch your epm with the
7886                                  patch in epm/epm-3.7.patch or build with
7887                                  --with-epm=internal which will build a suitable epm])
7888                 fi
7889             fi
7890         fi
7891     fi
7892     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7893         AC_PATH_PROG(PKGMK, pkgmk, no)
7894         if test "$PKGMK" = "no"; then
7895             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7896         fi
7897     fi
7898     AC_SUBST(RPM)
7899     AC_SUBST(DPKG)
7900     AC_SUBST(PKGMK)
7901 else
7902     for i in $PKGFORMAT; do
7903         case "$i" in
7904         aix | bsd | deb | pkg | rpm | native | portable)
7905             AC_MSG_ERROR(
7906                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7907             ;;
7908         esac
7909     done
7910     AC_MSG_RESULT([no])
7911     EPM=NO
7913 AC_SUBST(EPM)
7915 ENABLE_LWP=
7916 if test "$enable_lotuswordpro" = "yes"; then
7917     ENABLE_LWP="TRUE"
7919 AC_SUBST(ENABLE_LWP)
7921 dnl ===================================================================
7922 dnl Check for building ODK
7923 dnl ===================================================================
7924 if test "$enable_odk" = no; then
7925     unset DOXYGEN
7926 else
7927     if test "$with_doxygen" = no; then
7928         AC_MSG_CHECKING([for doxygen])
7929         unset DOXYGEN
7930         AC_MSG_RESULT([no])
7931     else
7932         if test "$with_doxygen" = yes; then
7933             AC_PATH_PROG([DOXYGEN], [doxygen])
7934             if test -z "$DOXYGEN"; then
7935                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7936             fi
7937             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7938                 if ! dot -V 2>/dev/null; then
7939                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7940                 fi
7941             fi
7942         else
7943             AC_MSG_CHECKING([for doxygen])
7944             DOXYGEN=$with_doxygen
7945             AC_MSG_RESULT([$DOXYGEN])
7946         fi
7947         if test -n "$DOXYGEN"; then
7948             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7949             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7950             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7951                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7952             fi
7953         fi
7954     fi
7956 AC_SUBST([DOXYGEN])
7958 AC_MSG_CHECKING([whether to build the ODK])
7959 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7960     AC_MSG_RESULT([yes])
7962     if test "$with_java" != "no"; then
7963         AC_MSG_CHECKING([whether to build unowinreg.dll])
7964         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7965             # build on Win by default
7966             enable_build_unowinreg=yes
7967         fi
7968         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7969             AC_MSG_RESULT([no])
7970             BUILD_UNOWINREG=
7971         else
7972             AC_MSG_RESULT([yes])
7973             BUILD_UNOWINREG=TRUE
7974         fi
7975         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7976             if test -z "$with_mingw_cross_compiler"; then
7977                 dnl Guess...
7978                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7979             elif test -x "$with_mingw_cross_compiler"; then
7980                  MINGWCXX="$with_mingw_cross_compiler"
7981             else
7982                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7983             fi
7985             if test "$MINGWCXX" = "false"; then
7986                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7987             fi
7989             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7990             if test -x "$mingwstrip_test"; then
7991                 MINGWSTRIP="$mingwstrip_test"
7992             else
7993                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7994             fi
7996             if test "$MINGWSTRIP" = "false"; then
7997                 AC_MSG_ERROR(MinGW32 binutils not found.)
7998             fi
7999         fi
8000     fi
8001     BUILD_TYPE="$BUILD_TYPE ODK"
8002 else
8003     AC_MSG_RESULT([no])
8004     BUILD_UNOWINREG=
8006 AC_SUBST(BUILD_UNOWINREG)
8007 AC_SUBST(MINGWCXX)
8008 AC_SUBST(MINGWSTRIP)
8010 dnl ===================================================================
8011 dnl Check for system zlib
8012 dnl ===================================================================
8013 if test "$with_system_zlib" = "auto"; then
8014     case "$_os" in
8015     WINNT)
8016         with_system_zlib="$with_system_libs"
8017         ;;
8018     *)
8019         if test "$enable_fuzzers" != "yes"; then
8020             with_system_zlib=yes
8021         else
8022             with_system_zlib=no
8023         fi
8024         ;;
8025     esac
8028 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8029 dnl and has no pkg-config for it at least on some tinderboxes,
8030 dnl so leaving that out for now
8031 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8032 AC_MSG_CHECKING([which zlib to use])
8033 if test "$with_system_zlib" = "yes"; then
8034     AC_MSG_RESULT([external])
8035     SYSTEM_ZLIB=TRUE
8036     AC_CHECK_HEADER(zlib.h, [],
8037         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8038     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8039         [AC_MSG_ERROR(zlib not found or functional)], [])
8040 else
8041     AC_MSG_RESULT([internal])
8042     SYSTEM_ZLIB=
8043     BUILD_TYPE="$BUILD_TYPE ZLIB"
8044     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8045     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8047 AC_SUBST(ZLIB_CFLAGS)
8048 AC_SUBST(ZLIB_LIBS)
8049 AC_SUBST(SYSTEM_ZLIB)
8051 dnl ===================================================================
8052 dnl Check for system jpeg
8053 dnl ===================================================================
8054 AC_MSG_CHECKING([which libjpeg to use])
8055 if test "$with_system_jpeg" = "yes"; then
8056     AC_MSG_RESULT([external])
8057     SYSTEM_LIBJPEG=TRUE
8058     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8059         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8060     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8061         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8062 else
8063     SYSTEM_LIBJPEG=
8064     AC_MSG_RESULT([internal, libjpeg-turbo])
8065     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8066     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8067     if test "$COM" = "MSC"; then
8068         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8069     else
8070         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8071     fi
8073     case "$host_cpu" in
8074     x86_64 | amd64 | i*86 | x86 | ia32)
8075         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8076         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8077             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8078                 NASM="$LODE_HOME/opt/bin/nasm"
8079             elif test -x "/opt/lo/bin/nasm"; then
8080                 NASM="/opt/lo/bin/nasm"
8081             fi
8082         fi
8084         if test -n "$NASM"; then
8085             AC_MSG_CHECKING([for object file format of host system])
8086             case "$host_os" in
8087               cygwin* | mingw* | pw32* | interix*)
8088                 case "$host_cpu" in
8089                   x86_64)
8090                     objfmt='Win64-COFF'
8091                     ;;
8092                   *)
8093                     objfmt='Win32-COFF'
8094                     ;;
8095                 esac
8096               ;;
8097               msdosdjgpp* | go32*)
8098                 objfmt='COFF'
8099               ;;
8100               os2-emx*) # not tested
8101                 objfmt='MSOMF' # obj
8102               ;;
8103               linux*coff* | linux*oldld*)
8104                 objfmt='COFF' # ???
8105               ;;
8106               linux*aout*)
8107                 objfmt='a.out'
8108               ;;
8109               linux*)
8110                 case "$host_cpu" in
8111                   x86_64)
8112                     objfmt='ELF64'
8113                     ;;
8114                   *)
8115                     objfmt='ELF'
8116                     ;;
8117                 esac
8118               ;;
8119               kfreebsd* | freebsd* | netbsd* | openbsd*)
8120                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8121                   objfmt='BSD-a.out'
8122                 else
8123                   case "$host_cpu" in
8124                     x86_64 | amd64)
8125                       objfmt='ELF64'
8126                       ;;
8127                     *)
8128                       objfmt='ELF'
8129                       ;;
8130                   esac
8131                 fi
8132               ;;
8133               solaris* | sunos* | sysv* | sco*)
8134                 case "$host_cpu" in
8135                   x86_64)
8136                     objfmt='ELF64'
8137                     ;;
8138                   *)
8139                     objfmt='ELF'
8140                     ;;
8141                 esac
8142               ;;
8143               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8144                 case "$host_cpu" in
8145                   x86_64)
8146                     objfmt='Mach-O64'
8147                     ;;
8148                   *)
8149                     objfmt='Mach-O'
8150                     ;;
8151                 esac
8152               ;;
8153               *)
8154                 objfmt='ELF ?'
8155               ;;
8156             esac
8158             AC_MSG_RESULT([$objfmt])
8159             if test "$objfmt" = 'ELF ?'; then
8160               objfmt='ELF'
8161               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8162             fi
8164             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8165             case "$objfmt" in
8166               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8167               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8168               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8169               COFF)       NAFLAGS='-fcoff -DCOFF';;
8170               a.out)      NAFLAGS='-faout -DAOUT';;
8171               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8172               ELF)        NAFLAGS='-felf -DELF';;
8173               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8174               RDF)        NAFLAGS='-frdf -DRDF';;
8175               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8176               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8177             esac
8178             AC_MSG_RESULT([$NAFLAGS])
8180             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8181             cat > conftest.asm << EOF
8182             [%line __oline__ "configure"
8183                     section .text
8184                     global  _main,main
8185             _main:
8186             main:   xor     eax,eax
8187                     ret
8188             ]
8190             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8191             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8192               AC_MSG_RESULT(yes)
8193             else
8194               echo "configure: failed program was:" >&AC_FD_CC
8195               cat conftest.asm >&AC_FD_CC
8196               rm -rf conftest*
8197               AC_MSG_RESULT(no)
8198               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8199               NASM=""
8200             fi
8202         fi
8204         if test -z "$NASM"; then
8205 cat << _EOS
8206 ****************************************************************************
8207 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8208 To get one please:
8210 _EOS
8211             if test "$build_os" = "cygwin"; then
8212 cat << _EOS
8213 install a pre-compiled binary for Win32
8215 mkdir -p /opt/lo/bin
8216 cd /opt/lo/bin
8217 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8218 chmod +x nasm
8220 or get and install one from http://www.nasm.us/
8222 Then re-run autogen.sh
8224 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8225 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8227 _EOS
8228             else
8229 cat << _EOS
8230 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8232 _EOS
8233             fi
8234             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8235             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8236         fi
8237       ;;
8238     esac
8241 AC_SUBST(NASM)
8242 AC_SUBST(LIBJPEG_CFLAGS)
8243 AC_SUBST(LIBJPEG_LIBS)
8244 AC_SUBST(SYSTEM_LIBJPEG)
8246 dnl ===================================================================
8247 dnl Check for system clucene
8248 dnl ===================================================================
8249 dnl we should rather be using
8250 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8251 dnl but the contribs-lib check seems tricky
8252 AC_MSG_CHECKING([which clucene to use])
8253 if test "$with_system_clucene" = "yes"; then
8254     AC_MSG_RESULT([external])
8255     SYSTEM_CLUCENE=TRUE
8256     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8257     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8258     FilterLibs "${CLUCENE_LIBS}"
8259     CLUCENE_LIBS="${filteredlibs}"
8260     AC_LANG_PUSH([C++])
8261     save_CXXFLAGS=$CXXFLAGS
8262     save_CPPFLAGS=$CPPFLAGS
8263     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8264     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8265     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8266     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8267     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8268                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8269     CXXFLAGS=$save_CXXFLAGS
8270     CPPFLAGS=$save_CPPFLAGS
8271     AC_LANG_POP([C++])
8273     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8274 else
8275     AC_MSG_RESULT([internal])
8276     SYSTEM_CLUCENE=
8277     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8279 AC_SUBST(SYSTEM_CLUCENE)
8280 AC_SUBST(CLUCENE_CFLAGS)
8281 AC_SUBST(CLUCENE_LIBS)
8283 dnl ===================================================================
8284 dnl Check for system expat
8285 dnl ===================================================================
8286 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8288 dnl ===================================================================
8289 dnl Check for system xmlsec
8290 dnl ===================================================================
8291 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
8293 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8294 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8295     ENABLE_EOT="TRUE"
8296     AC_DEFINE([ENABLE_EOT])
8297     AC_MSG_RESULT([yes])
8299     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8300 else
8301     ENABLE_EOT=
8302     AC_MSG_RESULT([no])
8304 AC_SUBST([ENABLE_EOT])
8306 dnl ===================================================================
8307 dnl Check for DLP libs
8308 dnl ===================================================================
8309 AS_IF([test "$COM" = "MSC"],
8310       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8311       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8313 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8315 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8317 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8319 AS_IF([test "$COM" = "MSC"],
8320       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8321       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8323 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8325 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8327 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8328 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8330 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8332 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8334 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8336 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8337 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8339 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8340 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8342 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8344 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8345 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8347 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8349 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8351 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8353 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8355 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8356 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8358 dnl ===================================================================
8359 dnl Check for system lcms2
8360 dnl ===================================================================
8361 if test "$with_system_lcms2" != "yes"; then
8362     SYSTEM_LCMS2=
8364 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8365 if test "$GCC" = "yes"; then
8366     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8368 if test "$COM" = "MSC"; then # override the above
8369     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8372 dnl ===================================================================
8373 dnl Check for system cppunit
8374 dnl ===================================================================
8375 if test "$_os" != "Android" ; then
8376     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8379 dnl ===================================================================
8380 dnl Check whether freetype is available
8381 dnl ===================================================================
8382 if test  "$test_freetype" = "yes"; then
8383     AC_MSG_CHECKING([whether freetype is available])
8384     # FreeType has 3 different kinds of versions
8385     # * release, like 2.4.10
8386     # * libtool, like 13.0.7 (this what pkg-config returns)
8387     # * soname
8388     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8389     #
8390     # 9.9.3 is 2.2.0
8391     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8392     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8393     FilterLibs "${FREETYPE_LIBS}"
8394     FREETYPE_LIBS="${filteredlibs}"
8395     SYSTEM_FREETYPE=TRUE
8396 else
8397     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8398     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8400 AC_SUBST(FREETYPE_CFLAGS)
8401 AC_SUBST(FREETYPE_LIBS)
8402 AC_SUBST([SYSTEM_FREETYPE])
8404 # ===================================================================
8405 # Check for system libxslt
8406 # to prevent incompatibilities between internal libxml2 and external libxslt,
8407 # or vice versa, use with_system_libxml here
8408 # ===================================================================
8409 if test "$with_system_libxml" = "auto"; then
8410     case "$_os" in
8411     WINNT|iOS|Android)
8412         with_system_libxml="$with_system_libs"
8413         ;;
8414     *)
8415         if test "$enable_fuzzers" != "yes"; then
8416             with_system_libxml=yes
8417         else
8418             with_system_libxml=no
8419         fi
8420         ;;
8421     esac
8424 AC_MSG_CHECKING([which libxslt to use])
8425 if test "$with_system_libxml" = "yes"; then
8426     AC_MSG_RESULT([external])
8427     SYSTEM_LIBXSLT=TRUE
8428     if test "$_os" = "Darwin"; then
8429         dnl make sure to use SDK path
8430         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8431         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8432         dnl omit -L/usr/lib
8433         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8434         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8435     else
8436         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8437         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8438         FilterLibs "${LIBXSLT_LIBS}"
8439         LIBXSLT_LIBS="${filteredlibs}"
8440         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8441         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8442         FilterLibs "${LIBEXSLT_LIBS}"
8443         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8444     fi
8446     dnl Check for xsltproc
8447     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8448     if test "$XSLTPROC" = "no"; then
8449         AC_MSG_ERROR([xsltproc is required])
8450     fi
8451 else
8452     AC_MSG_RESULT([internal])
8453     SYSTEM_LIBXSLT=
8454     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8456     if test "$cross_compiling" = "yes"; then
8457         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8458         if test "$XSLTPROC" = "no"; then
8459             AC_MSG_ERROR([xsltproc is required])
8460         fi
8461     fi
8463 AC_SUBST(SYSTEM_LIBXSLT)
8464 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8465     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8467 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8469 AC_SUBST(LIBEXSLT_CFLAGS)
8470 AC_SUBST(LIBEXSLT_LIBS)
8471 AC_SUBST(LIBXSLT_CFLAGS)
8472 AC_SUBST(LIBXSLT_LIBS)
8473 AC_SUBST(XSLTPROC)
8475 # ===================================================================
8476 # Check for system libxml
8477 # ===================================================================
8478 AC_MSG_CHECKING([which libxml to use])
8479 if test "$with_system_libxml" = "yes"; then
8480     AC_MSG_RESULT([external])
8481     SYSTEM_LIBXML=TRUE
8482     if test "$_os" = "Darwin"; then
8483         dnl make sure to use SDK path
8484         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8485         dnl omit -L/usr/lib
8486         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8487     elif test $_os = iOS; then
8488         dnl make sure to use SDK path
8489         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8490         LIBXML_CFLAGS="-I$usr/include/libxml2"
8491         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8492     else
8493         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8494         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8495         FilterLibs "${LIBXML_LIBS}"
8496         LIBXML_LIBS="${filteredlibs}"
8497     fi
8499     dnl Check for xmllint
8500     AC_PATH_PROG(XMLLINT, xmllint, no)
8501     if test "$XMLLINT" = "no"; then
8502         AC_MSG_ERROR([xmllint is required])
8503     fi
8504 else
8505     AC_MSG_RESULT([internal])
8506     SYSTEM_LIBXML=
8507     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8508     if test "$COM" = "MSC"; then
8509         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8510     fi
8511     if test "$COM" = "MSC"; then
8512         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8513     else
8514         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8515     fi
8516     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8518 AC_SUBST(SYSTEM_LIBXML)
8519 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8520     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8522 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8523 AC_SUBST(LIBXML_CFLAGS)
8524 AC_SUBST(LIBXML_LIBS)
8525 AC_SUBST(XMLLINT)
8527 # =====================================================================
8528 # Checking for a Python interpreter with version >= 2.7.
8529 # Build and runtime requires Python 3 compatible version (>= 2.7).
8530 # Optionally user can pass an option to configure, i. e.
8531 # ./configure PYTHON=/usr/bin/python
8532 # =====================================================================
8533 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8534     if test -n "$PYTHON"; then
8535         PYTHON_FOR_BUILD=$PYTHON
8536     else
8537         # This allows a lack of system python with no error, we use internal one in that case.
8538         AM_PATH_PYTHON([2.7],, [:])
8539         # Clean PYTHON_VERSION checked below if cross-compiling
8540         PYTHON_VERSION=""
8541         if test "$PYTHON" != ":"; then
8542             PYTHON_FOR_BUILD=$PYTHON
8543         fi
8544     fi
8546 AC_SUBST(PYTHON_FOR_BUILD)
8548 # Checks for Python to use for Pyuno
8549 AC_MSG_CHECKING([which Python to use for Pyuno])
8550 case "$enable_python" in
8551 no|disable)
8552     if test -z $PYTHON_FOR_BUILD; then
8553         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8554         # requirement from the choice whether to include Python stuff in the installer, but why
8555         # bother?
8556         AC_MSG_ERROR([Python is required at build time.])
8557     fi
8558     enable_python=no
8559     AC_MSG_RESULT([none])
8560     ;;
8561 ""|yes|auto)
8562     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8563         AC_MSG_RESULT([no, overridden by --disable-scripting])
8564         enable_python=no
8565     elif test $build_os = cygwin; then
8566         dnl When building on Windows we don't attempt to use any installed
8567         dnl "system"  Python.
8568         AC_MSG_RESULT([fully internal])
8569         enable_python=internal
8570     elif test "$cross_compiling" = yes; then
8571         AC_MSG_RESULT([system])
8572         enable_python=system
8573     else
8574         # Unset variables set by the above AM_PATH_PYTHON so that
8575         # we actually do check anew.
8576         AC_MSG_RESULT([])
8577         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
8578         AM_PATH_PYTHON([3.3],, [:])
8579         AC_MSG_CHECKING([which Python to use for Pyuno])
8580         if test "$PYTHON" = ":"; then
8581             if test -z "$PYTHON_FOR_BUILD"; then
8582                 AC_MSG_RESULT([fully internal])
8583             else
8584                 AC_MSG_RESULT([internal])
8585             fi
8586             enable_python=internal
8587         else
8588             AC_MSG_RESULT([system])
8589             enable_python=system
8590         fi
8591     fi
8592     ;;
8593 internal)
8594     AC_MSG_RESULT([internal])
8595     ;;
8596 fully-internal)
8597     AC_MSG_RESULT([fully internal])
8598     enable_python=internal
8599     ;;
8600 system)
8601     AC_MSG_RESULT([system])
8602     if test "$_os" = Darwin; then
8603         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])
8604     fi
8605     ;;
8607     AC_MSG_ERROR([Incorrect --enable-python option])
8608     ;;
8609 esac
8611 if test $enable_python != no; then
8612     BUILD_TYPE="$BUILD_TYPE PYUNO"
8615 if test $enable_python = system; then
8616     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8617         # Fallback: Accept these in the environment, or as set above
8618         # for MacOSX.
8619         :
8620     elif test "$cross_compiling" != yes; then
8621         # Unset variables set by the above AM_PATH_PYTHON so that
8622         # we actually do check anew.
8623         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
8624         # This causes an error if no python command is found
8625         AM_PATH_PYTHON([3.3])
8626         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8627         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8628         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8629         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8630         if test -z "$PKG_CONFIG"; then
8631             PYTHON_CFLAGS="-I$python_include"
8632             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8633         elif $PKG_CONFIG --exists python-$python_version-embed; then
8634             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8635             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8636         elif $PKG_CONFIG --exists python-$python_version; then
8637             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8638             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8639         else
8640             PYTHON_CFLAGS="-I$python_include"
8641             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8642         fi
8643         FilterLibs "${PYTHON_LIBS}"
8644         PYTHON_LIBS="${filteredlibs}"
8645     else
8646         dnl How to find out the cross-compilation Python installation path?
8647         AC_MSG_CHECKING([for python version])
8648         AS_IF([test -n "$PYTHON_VERSION"],
8649               [AC_MSG_RESULT([$PYTHON_VERSION])],
8650               [AC_MSG_RESULT([not found])
8651                AC_MSG_ERROR([no usable python found])])
8652         test -n "$PYTHON_CFLAGS" && break
8653     fi
8655     dnl Check if the headers really work
8656     save_CPPFLAGS="$CPPFLAGS"
8657     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8658     AC_CHECK_HEADER(Python.h)
8659     CPPFLAGS="$save_CPPFLAGS"
8661     # let the PYTHON_FOR_BUILD match the same python installation that
8662     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8663     # better for PythonTests.
8664     PYTHON_FOR_BUILD=$PYTHON
8667 if test "$with_lxml" != no; then
8668     if test -z "$PYTHON_FOR_BUILD"; then
8669         case $build_os in
8670             cygwin)
8671                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8672                 ;;
8673             *)
8674                 if test "$cross_compiling" != yes ; then
8675                     BUILD_TYPE="$BUILD_TYPE LXML"
8676                 fi
8677                 ;;
8678         esac
8679     else
8680         AC_MSG_CHECKING([for python lxml])
8681         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8682             AC_MSG_RESULT([yes])
8683         else
8684             case $build_os in
8685                 cygwin)
8686                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8687                     ;;
8688                 *)
8689                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8690                         BUILD_TYPE="$BUILD_TYPE LXML"
8691                         AC_MSG_RESULT([no, using internal lxml])
8692                     else
8693                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8694                     fi
8695                     ;;
8696             esac
8697         fi
8698     fi
8701 dnl By now enable_python should be "system", "internal" or "no"
8702 case $enable_python in
8703 system)
8704     SYSTEM_PYTHON=TRUE
8706     if test "x$ac_cv_header_Python_h" != "xyes"; then
8707        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8708     fi
8710     AC_LANG_PUSH(C)
8711     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8712     AC_MSG_CHECKING([for correct python library version])
8713        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8714 #include <Python.h>
8716 int main(int argc, char **argv) {
8717    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8718        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8719    else return 1;
8721        ]])],[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])])
8722     CFLAGS=$save_CFLAGS
8723     AC_LANG_POP(C)
8725     dnl FIXME Check if the Python library can be linked with, too?
8726     ;;
8728 internal)
8729     SYSTEM_PYTHON=
8730     PYTHON_VERSION_MAJOR=3
8731     PYTHON_VERSION_MINOR=5
8732     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8733     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8734         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8735     fi
8736     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8737     BUILD_TYPE="$BUILD_TYPE PYTHON"
8738     # Embedded Python dies without Home set
8739     if test "$HOME" = ""; then
8740         export HOME=""
8741     fi
8742     ;;
8744     DISABLE_PYTHON=TRUE
8745     SYSTEM_PYTHON=
8746     ;;
8748     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8749     ;;
8750 esac
8752 AC_SUBST(DISABLE_PYTHON)
8753 AC_SUBST(SYSTEM_PYTHON)
8754 AC_SUBST(PYTHON_CFLAGS)
8755 AC_SUBST(PYTHON_LIBS)
8756 AC_SUBST(PYTHON_VERSION)
8757 AC_SUBST(PYTHON_VERSION_MAJOR)
8758 AC_SUBST(PYTHON_VERSION_MINOR)
8760 ENABLE_MARIADBC=TRUE
8761 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8762     ENABLE_MARIADBC=
8764 MARIADBC_MAJOR=1
8765 MARIADBC_MINOR=0
8766 MARIADBC_MICRO=2
8767 if test "$ENABLE_MARIADBC" = "TRUE"; then
8768     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8771 AC_SUBST(ENABLE_MARIADBC)
8772 AC_SUBST(MARIADBC_MAJOR)
8773 AC_SUBST(MARIADBC_MINOR)
8774 AC_SUBST(MARIADBC_MICRO)
8776 if test "$ENABLE_MARIADBC" = "TRUE"; then
8777     dnl ===================================================================
8778     dnl Check for system MariaDB
8779     dnl ===================================================================
8780     AC_MSG_CHECKING([which MariaDB to use])
8781     if test "$with_system_mariadb" = "yes"; then
8782         AC_MSG_RESULT([external])
8783         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8784         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8785         if test -z "$MARIADBCONFIG"; then
8786             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8787             if test -z "$MARIADBCONFIG"; then
8788                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8789                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8790             fi
8791         fi
8792         AC_MSG_CHECKING([MariaDB version])
8793         MARIADB_VERSION=`$MARIADBCONFIG --version`
8794         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8795         if test "$MARIADB_MAJOR" -ge "5"; then
8796             AC_MSG_RESULT([OK])
8797         else
8798             AC_MSG_ERROR([too old, use 5.0.x or later])
8799         fi
8800         AC_MSG_CHECKING([for MariaDB Client library])
8801         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8802         if test "$COM_IS_CLANG" = TRUE; then
8803             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8804         fi
8805         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8806         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8807         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8808         dnl linux32:
8809         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8810             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8811             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8812                 | sed -e 's|/lib64/|/lib/|')
8813         fi
8814         FilterLibs "${MARIADB_LIBS}"
8815         MARIADB_LIBS="${filteredlibs}"
8816         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8817         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8818         if test "$enable_bundle_mariadb" = "yes"; then
8819             AC_MSG_RESULT([yes])
8820             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8821             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8823 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8825 /g' | grep -E '(mysqlclient|mariadb)')
8826             if test "$_os" = "Darwin"; then
8827                 LIBMARIADB=${LIBMARIADB}.dylib
8828             elif test "$_os" = "WINNT"; then
8829                 LIBMARIADB=${LIBMARIADB}.dll
8830             else
8831                 LIBMARIADB=${LIBMARIADB}.so
8832             fi
8833             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8834             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8835             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8836                 AC_MSG_RESULT([found.])
8837                 PathFormat "$LIBMARIADB_PATH"
8838                 LIBMARIADB_PATH="$formatted_path"
8839             else
8840                 AC_MSG_ERROR([not found.])
8841             fi
8842         else
8843             AC_MSG_RESULT([no])
8844             BUNDLE_MARIADB_CONNECTOR_C=
8845         fi
8846     else
8847         AC_MSG_RESULT([internal])
8848         SYSTEM_MARIADB_CONNECTOR_C=
8849         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8850         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8851         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8852     fi
8854     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8855     AC_SUBST(MARIADB_CFLAGS)
8856     AC_SUBST(MARIADB_LIBS)
8857     AC_SUBST(LIBMARIADB)
8858     AC_SUBST(LIBMARIADB_PATH)
8859     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8862 dnl ===================================================================
8863 dnl Check for system hsqldb
8864 dnl ===================================================================
8865 if test "$with_java" != "no"; then
8866     HSQLDB_USE_JDBC_4_1=
8867     AC_MSG_CHECKING([which hsqldb to use])
8868     if test "$with_system_hsqldb" = "yes"; then
8869         AC_MSG_RESULT([external])
8870         SYSTEM_HSQLDB=TRUE
8871         if test -z $HSQLDB_JAR; then
8872             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8873         fi
8874         if ! test -f $HSQLDB_JAR; then
8875                AC_MSG_ERROR(hsqldb.jar not found.)
8876         fi
8877         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8878         export HSQLDB_JAR
8879         if $PERL -e \
8880            'use Archive::Zip;
8881             my $file = "$ENV{'HSQLDB_JAR'}";
8882             my $zip = Archive::Zip->new( $file );
8883             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8884             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8885             {
8886                 push @l, split(/\n/, $mf);
8887                 foreach my $line (@l)
8888                 {
8889                     if ($line =~ m/Specification-Version:/)
8890                     {
8891                         ($t, $version) = split (/:/,$line);
8892                         $version =~ s/^\s//;
8893                         ($a, $b, $c, $d) = split (/\./,$version);
8894                         if ($c == "0" && $d > "8")
8895                         {
8896                             exit 0;
8897                         }
8898                         else
8899                         {
8900                             exit 1;
8901                         }
8902                     }
8903                 }
8904             }
8905             else
8906             {
8907                 exit 1;
8908             }'; then
8909             AC_MSG_RESULT([yes])
8910         else
8911             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8912         fi
8913     else
8914         AC_MSG_RESULT([internal])
8915         SYSTEM_HSQLDB=
8916         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8917         NEED_ANT=TRUE
8918         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8919         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8920         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8921             AC_MSG_RESULT([yes])
8922             HSQLDB_USE_JDBC_4_1=TRUE
8923         else
8924             AC_MSG_RESULT([no])
8925         fi
8926     fi
8927     AC_SUBST(SYSTEM_HSQLDB)
8928     AC_SUBST(HSQLDB_JAR)
8929     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8932 dnl ===================================================================
8933 dnl Check for PostgreSQL stuff
8934 dnl ===================================================================
8935 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8936 if test "x$enable_postgresql_sdbc" != "xno"; then
8937     AC_MSG_RESULT([yes])
8938     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8940     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8941         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8942     fi
8943     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8944         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8945     fi
8947     postgres_interface=""
8948     if test "$with_system_postgresql" = "yes"; then
8949         postgres_interface="external PostgreSQL"
8950         SYSTEM_POSTGRESQL=TRUE
8951         if test "$_os" = Darwin; then
8952             supp_path=''
8953             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8954                 pg_supp_path="$P_SEP$d$pg_supp_path"
8955             done
8956         fi
8957         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8958         if test -n "$PGCONFIG"; then
8959             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8960             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8961         else
8962             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8963               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8964               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8965             ],[
8966               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8967             ])
8968         fi
8969         FilterLibs "${POSTGRESQL_LIB}"
8970         POSTGRESQL_LIB="${filteredlibs}"
8971     else
8972         # if/when anything else than PostgreSQL uses Kerberos,
8973         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8974         WITH_KRB5=
8975         WITH_GSSAPI=
8976         case "$_os" in
8977         Darwin)
8978             # macOS has system MIT Kerberos 5 since 10.4
8979             if test "$with_krb5" != "no"; then
8980                 WITH_KRB5=TRUE
8981                 save_LIBS=$LIBS
8982                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8983                 # that the libraries where these functions are located on macOS will change, is it?
8984                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8985                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8986                 KRB5_LIBS=$LIBS
8987                 LIBS=$save_LIBS
8988                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8989                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8990                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8991                 LIBS=$save_LIBS
8992             fi
8993             if test "$with_gssapi" != "no"; then
8994                 WITH_GSSAPI=TRUE
8995                 save_LIBS=$LIBS
8996                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8997                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8998                 GSSAPI_LIBS=$LIBS
8999                 LIBS=$save_LIBS
9000             fi
9001             ;;
9002         WINNT)
9003             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9004                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9005             fi
9006             ;;
9007         Linux|GNU|*BSD|DragonFly)
9008             if test "$with_krb5" != "no"; then
9009                 WITH_KRB5=TRUE
9010                 save_LIBS=$LIBS
9011                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9012                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9013                 KRB5_LIBS=$LIBS
9014                 LIBS=$save_LIBS
9015                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9016                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9017                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9018                 LIBS=$save_LIBS
9019             fi
9020             if test "$with_gssapi" != "no"; then
9021                 WITH_GSSAPI=TRUE
9022                 save_LIBS=$LIBS
9023                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9024                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9025                 GSSAPI_LIBS=$LIBS
9026                 LIBS=$save_LIBS
9027             fi
9028             ;;
9029         *)
9030             if test "$with_krb5" = "yes"; then
9031                 WITH_KRB5=TRUE
9032                 save_LIBS=$LIBS
9033                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9034                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9035                 KRB5_LIBS=$LIBS
9036                 LIBS=$save_LIBS
9037                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9038                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9039                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9040                 LIBS=$save_LIBS
9041             fi
9042             if test "$with_gssapi" = "yes"; then
9043                 WITH_GSSAPI=TRUE
9044                 save_LIBS=$LIBS
9045                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9046                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9047                 LIBS=$save_LIBS
9048                 GSSAPI_LIBS=$LIBS
9049             fi
9050         esac
9052         if test -n "$with_libpq_path"; then
9053             SYSTEM_POSTGRESQL=TRUE
9054             postgres_interface="external libpq"
9055             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9056             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9057         else
9058             SYSTEM_POSTGRESQL=
9059             postgres_interface="internal"
9060             POSTGRESQL_LIB=""
9061             POSTGRESQL_INC="%OVERRIDE_ME%"
9062             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9063         fi
9064     fi
9066     AC_MSG_CHECKING([PostgreSQL C interface])
9067     AC_MSG_RESULT([$postgres_interface])
9069     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9070         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9071         save_CFLAGS=$CFLAGS
9072         save_CPPFLAGS=$CPPFLAGS
9073         save_LIBS=$LIBS
9074         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9075         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9076         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9077         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9078             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9079         CFLAGS=$save_CFLAGS
9080         CPPFLAGS=$save_CPPFLAGS
9081         LIBS=$save_LIBS
9082     fi
9083     BUILD_POSTGRESQL_SDBC=TRUE
9084 else
9085     AC_MSG_RESULT([no])
9087 AC_SUBST(WITH_KRB5)
9088 AC_SUBST(WITH_GSSAPI)
9089 AC_SUBST(GSSAPI_LIBS)
9090 AC_SUBST(KRB5_LIBS)
9091 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9092 AC_SUBST(SYSTEM_POSTGRESQL)
9093 AC_SUBST(POSTGRESQL_INC)
9094 AC_SUBST(POSTGRESQL_LIB)
9096 dnl ===================================================================
9097 dnl Check for Firebird stuff
9098 dnl ===================================================================
9099 ENABLE_FIREBIRD_SDBC=
9100 if test "$enable_firebird_sdbc" = "yes" ; then
9101     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9103     dnl ===================================================================
9104     dnl Check for system Firebird
9105     dnl ===================================================================
9106     AC_MSG_CHECKING([which Firebird to use])
9107     if test "$with_system_firebird" = "yes"; then
9108         AC_MSG_RESULT([external])
9109         SYSTEM_FIREBIRD=TRUE
9110         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9111         if test -z "$FIREBIRDCONFIG"; then
9112             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9113             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9114                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9115             ])
9116             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9117         else
9118             AC_MSG_NOTICE([fb_config found])
9119             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9120             AC_MSG_CHECKING([for Firebird Client library])
9121             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9122             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9123             FilterLibs "${FIREBIRD_LIBS}"
9124             FIREBIRD_LIBS="${filteredlibs}"
9125         fi
9126         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9127         AC_MSG_CHECKING([Firebird version])
9128         if test -n "${FIREBIRD_VERSION}"; then
9129             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9130             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9131             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9132                 AC_MSG_RESULT([OK])
9133             else
9134                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9135             fi
9136         else
9137             __save_CFLAGS="${CFLAGS}"
9138             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9139             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9140 #if defined(FB_API_VER) && FB_API_VER == 30
9141 int fb_api_is_30(void) { return 0; }
9142 #else
9143 #error "Wrong Firebird API version"
9144 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9145             CFLAGS="${__save_CFLAGS}"
9146         fi
9147         ENABLE_FIREBIRD_SDBC=TRUE
9148         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9149     elif test "$enable_database_connectivity" != yes; then
9150         AC_MSG_RESULT([none])
9151     elif test "$cross_compiling" = "yes"; then
9152         AC_MSG_RESULT([none])
9153     else
9154         dnl Embedded Firebird has version 3.0
9155         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9156         dnl We need libatomic_ops for any non X86/X64 system
9157         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9158             dnl ===================================================================
9159             dnl Check for system libatomic_ops
9160             dnl ===================================================================
9161             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9162             if test "$with_system_libatomic_ops" = "yes"; then
9163                 SYSTEM_LIBATOMIC_OPS=TRUE
9164                 AC_CHECK_HEADERS(atomic_ops.h, [],
9165                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9166             else
9167                 SYSTEM_LIBATOMIC_OPS=
9168                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9169                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9170                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9171             fi
9172         fi
9174         AC_MSG_RESULT([internal])
9175         SYSTEM_FIREBIRD=
9176         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9177         FIREBIRD_LIBS="-lfbclient"
9179         if test "$with_system_libtommath" = "yes"; then
9180             SYSTEM_LIBTOMMATH=TRUE
9181             dnl check for tommath presence
9182             save_LIBS=$LIBS
9183             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9184             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9185             LIBS=$save_LIBS
9186         else
9187             SYSTEM_LIBTOMMATH=
9188             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9189             LIBTOMMATH_LIBS="-ltommath"
9190             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9191         fi
9193         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9194         ENABLE_FIREBIRD_SDBC=TRUE
9195         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9196     fi
9198 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9199 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9200 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9201 AC_SUBST(LIBATOMIC_OPS_LIBS)
9202 AC_SUBST(SYSTEM_FIREBIRD)
9203 AC_SUBST(FIREBIRD_CFLAGS)
9204 AC_SUBST(FIREBIRD_LIBS)
9205 AC_SUBST([TOMMATH_CFLAGS])
9206 AC_SUBST([TOMMATH_LIBS])
9208 dnl ===================================================================
9209 dnl Check for system curl
9210 dnl ===================================================================
9211 AC_MSG_CHECKING([which libcurl to use])
9212 if test "$with_system_curl" = "auto"; then
9213     with_system_curl="$with_system_libs"
9216 if test "$with_system_curl" = "yes"; then
9217     AC_MSG_RESULT([external])
9218     SYSTEM_CURL=TRUE
9220     # First try PKGCONFIG and then fall back
9221     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9223     if test -n "$CURL_PKG_ERRORS"; then
9224         AC_PATH_PROG(CURLCONFIG, curl-config)
9225         if test -z "$CURLCONFIG"; then
9226             AC_MSG_ERROR([curl development files not found])
9227         fi
9228         CURL_LIBS=`$CURLCONFIG --libs`
9229         FilterLibs "${CURL_LIBS}"
9230         CURL_LIBS="${filteredlibs}"
9231         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9232         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9234         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9235         case $curl_version in
9236         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9237         dnl so they need to be doubled to end up in the configure script
9238         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9239             AC_MSG_RESULT([yes])
9240             ;;
9241         *)
9242             AC_MSG_ERROR([no, you have $curl_version])
9243             ;;
9244         esac
9245     fi
9247     ENABLE_CURL=TRUE
9248 elif test $_os = iOS; then
9249     # Let's see if we need curl, I think not?
9250     AC_MSG_RESULT([none])
9251     ENABLE_CURL=
9252 else
9253     AC_MSG_RESULT([internal])
9254     SYSTEM_CURL=
9255     BUILD_TYPE="$BUILD_TYPE CURL"
9256     ENABLE_CURL=TRUE
9258 AC_SUBST(SYSTEM_CURL)
9259 AC_SUBST(CURL_CFLAGS)
9260 AC_SUBST(CURL_LIBS)
9261 AC_SUBST(ENABLE_CURL)
9263 dnl ===================================================================
9264 dnl Check for system boost
9265 dnl ===================================================================
9266 AC_MSG_CHECKING([which boost to use])
9267 if test "$with_system_boost" = "yes"; then
9268     AC_MSG_RESULT([external])
9269     SYSTEM_BOOST=TRUE
9270     AX_BOOST_BASE(1.47)
9271     AX_BOOST_DATE_TIME
9272     AX_BOOST_FILESYSTEM
9273     AX_BOOST_IOSTREAMS
9274     AX_BOOST_LOCALE
9275     AC_LANG_PUSH([C++])
9276     save_CXXFLAGS=$CXXFLAGS
9277     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9278     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9279        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9280     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9281        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9282     CXXFLAGS=$save_CXXFLAGS
9283     AC_LANG_POP([C++])
9284     # this is in m4/ax_boost_base.m4
9285     FilterLibs "${BOOST_LDFLAGS}"
9286     BOOST_LDFLAGS="${filteredlibs}"
9287 else
9288     AC_MSG_RESULT([internal])
9289     BUILD_TYPE="$BUILD_TYPE BOOST"
9290     SYSTEM_BOOST=
9291     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9292         # use warning-suppressing wrapper headers
9293         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9294     else
9295         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9296     fi
9298 AC_SUBST(SYSTEM_BOOST)
9300 dnl ===================================================================
9301 dnl Check for system mdds
9302 dnl ===================================================================
9303 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9305 dnl ===================================================================
9306 dnl Check for system glm
9307 dnl ===================================================================
9308 AC_MSG_CHECKING([which glm to use])
9309 if test "$with_system_glm" = "yes"; then
9310     AC_MSG_RESULT([external])
9311     SYSTEM_GLM=TRUE
9312     AC_LANG_PUSH([C++])
9313     AC_CHECK_HEADER([glm/glm.hpp], [],
9314        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9315     AC_LANG_POP([C++])
9316 else
9317     AC_MSG_RESULT([internal])
9318     BUILD_TYPE="$BUILD_TYPE GLM"
9319     SYSTEM_GLM=
9320     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9322 AC_SUBST([GLM_CFLAGS])
9323 AC_SUBST([SYSTEM_GLM])
9325 dnl ===================================================================
9326 dnl Check for system odbc
9327 dnl ===================================================================
9328 AC_MSG_CHECKING([which odbc headers to use])
9329 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
9330     AC_MSG_RESULT([external])
9331     SYSTEM_ODBC_HEADERS=TRUE
9333     if test "$build_os" = "cygwin"; then
9334         save_CPPFLAGS=$CPPFLAGS
9335         find_winsdk
9336         PathFormat "$winsdktest"
9337         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"
9338         AC_CHECK_HEADER(sqlext.h, [],
9339             [AC_MSG_ERROR(odbc not found. install odbc)],
9340             [#include <windows.h>])
9341         CPPFLAGS=$save_CPPFLAGS
9342     else
9343         AC_CHECK_HEADER(sqlext.h, [],
9344             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9345     fi
9346 elif test "$enable_database_connectivity" != yes; then
9347     AC_MSG_RESULT([none])
9348 else
9349     AC_MSG_RESULT([internal])
9350     SYSTEM_ODBC_HEADERS=
9352 AC_SUBST(SYSTEM_ODBC_HEADERS)
9354 dnl ===================================================================
9355 dnl Enable LDAP support
9356 dnl ===================================================================
9358 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9359 AC_MSG_CHECKING([whether to enable LDAP support])
9360     if test "$enable_ldap" != "yes"; then
9361         AC_MSG_RESULT([no])
9362         ENABLE_LDAP=""
9363         enable_ldap=no
9364     else
9365         AC_MSG_RESULT([yes])
9366         ENABLE_LDAP="TRUE"
9367         AC_DEFINE(HAVE_FEATURE_LDAP)
9368     fi
9370 AC_SUBST(ENABLE_LDAP)
9372 dnl ===================================================================
9373 dnl Check for system openldap
9374 dnl ===================================================================
9376 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9377 AC_MSG_CHECKING([which openldap library to use])
9378 if test "$with_system_openldap" = "yes"; then
9379     AC_MSG_RESULT([external])
9380     SYSTEM_OPENLDAP=TRUE
9381     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9382     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9383     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9384 else
9385     AC_MSG_RESULT([internal])
9386     SYSTEM_OPENLDAP=
9387     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9390 AC_SUBST(SYSTEM_OPENLDAP)
9392 dnl ===================================================================
9393 dnl Check for system NSS
9394 dnl ===================================================================
9395 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9396     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9397     AC_DEFINE(HAVE_FEATURE_NSS)
9398     ENABLE_NSS="TRUE"
9399     AC_DEFINE(ENABLE_NSS)
9400 elif test $_os != iOS ; then
9401     with_tls=openssl
9403 AC_SUBST(ENABLE_NSS)
9405 dnl ===================================================================
9406 dnl Check for TLS/SSL and cryptographic implementation to use
9407 dnl ===================================================================
9408 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9409 if test -n "$with_tls"; then
9410     case $with_tls in
9411     openssl)
9412         AC_DEFINE(USE_TLS_OPENSSL)
9413         TLS=OPENSSL
9415         if test "$enable_openssl" != "yes"; then
9416             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9417         fi
9419         # warn that OpenSSL has been selected but not all TLS code has this option
9420         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9421         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9422         ;;
9423     nss)
9424         AC_DEFINE(USE_TLS_NSS)
9425         TLS=NSS
9426         ;;
9427     no)
9428         AC_MSG_WARN([Skipping TLS/SSL])
9429         ;;
9430     *)
9431         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9432 openssl - OpenSSL
9433 nss - Mozilla's Network Security Services (NSS)
9434     ])
9435         ;;
9436     esac
9437 else
9438     # default to using NSS, it results in smaller oox lib
9439     AC_DEFINE(USE_TLS_NSS)
9440     TLS=NSS
9442 AC_MSG_RESULT([$TLS])
9443 AC_SUBST(TLS)
9445 dnl ===================================================================
9446 dnl Check for system sane
9447 dnl ===================================================================
9448 AC_MSG_CHECKING([which sane header to use])
9449 if test "$with_system_sane" = "yes"; then
9450     AC_MSG_RESULT([external])
9451     AC_CHECK_HEADER(sane/sane.h, [],
9452       [AC_MSG_ERROR(sane not found. install sane)], [])
9453 else
9454     AC_MSG_RESULT([internal])
9455     BUILD_TYPE="$BUILD_TYPE SANE"
9458 dnl ===================================================================
9459 dnl Check for system icu
9460 dnl ===================================================================
9461 SYSTEM_GENBRK=
9462 SYSTEM_GENCCODE=
9463 SYSTEM_GENCMN=
9465 ICU_MAJOR=63
9466 ICU_MINOR=1
9467 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9468 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9469 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9470 AC_MSG_CHECKING([which icu to use])
9471 if test "$with_system_icu" = "yes"; then
9472     AC_MSG_RESULT([external])
9473     SYSTEM_ICU=TRUE
9474     AC_LANG_PUSH([C++])
9475     AC_MSG_CHECKING([for unicode/rbbi.h])
9476     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9477     AC_LANG_POP([C++])
9479     if test "$cross_compiling" != "yes"; then
9480         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9481         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9482         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9483         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9484     fi
9486     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9487         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9488         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9489         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9490         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9491         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9492             AC_MSG_RESULT([yes])
9493         else
9494             AC_MSG_RESULT([no])
9495             if test "$with_system_icu_for_build" != "force"; then
9496                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9497 You can use --with-system-icu-for-build=force to use it anyway.])
9498             fi
9499         fi
9500     fi
9502     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9503         # using the system icu tools can lead to version confusion, use the
9504         # ones from the build environment when cross-compiling
9505         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9506         if test -z "$SYSTEM_GENBRK"; then
9507             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9508         fi
9509         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9510         if test -z "$SYSTEM_GENCCODE"; then
9511             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9512         fi
9513         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9514         if test -z "$SYSTEM_GENCMN"; then
9515             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9516         fi
9517         if test "$ICU_MAJOR" -ge "49"; then
9518             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9519             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9520             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9521         else
9522             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9523             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9524             ICU_RECLASSIFIED_HEBREW_LETTER=
9525         fi
9526     fi
9528     if test "$cross_compiling" = "yes"; then
9529         if test "$ICU_MAJOR" -ge "50"; then
9530             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9531             ICU_MINOR=""
9532         fi
9533     fi
9534 else
9535     AC_MSG_RESULT([internal])
9536     SYSTEM_ICU=
9537     BUILD_TYPE="$BUILD_TYPE ICU"
9538     # surprisingly set these only for "internal" (to be used by various other
9539     # external libs): the system icu-config is quite unhelpful and spits out
9540     # dozens of weird flags and also default path -I/usr/include
9541     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9542     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9544 if test "$ICU_MAJOR" -ge "59"; then
9545     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9546     # with -std=c++11 but not all external libraries can be built with that,
9547     # for those use a bit-compatible typedef uint16_t UChar; see
9548     # icu/source/common/unicode/umachine.h
9549     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9550 else
9551     ICU_UCHAR_TYPE=""
9553 AC_SUBST(SYSTEM_ICU)
9554 AC_SUBST(SYSTEM_GENBRK)
9555 AC_SUBST(SYSTEM_GENCCODE)
9556 AC_SUBST(SYSTEM_GENCMN)
9557 AC_SUBST(ICU_MAJOR)
9558 AC_SUBST(ICU_MINOR)
9559 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9560 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9561 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9562 AC_SUBST(ICU_CFLAGS)
9563 AC_SUBST(ICU_LIBS)
9564 AC_SUBST(ICU_UCHAR_TYPE)
9566 dnl ==================================================================
9567 dnl Breakpad
9568 dnl ==================================================================
9569 AC_MSG_CHECKING([whether to enable breakpad])
9570 if test "$enable_breakpad" != yes; then
9571     AC_MSG_RESULT([no])
9572 else
9573     AC_MSG_RESULT([yes])
9574     ENABLE_BREAKPAD="TRUE"
9575     AC_DEFINE(ENABLE_BREAKPAD)
9576     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9577     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9579     AC_MSG_CHECKING([for crashreport config])
9580     if test "$with_symbol_config" = "no"; then
9581         BREAKPAD_SYMBOL_CONFIG="invalid"
9582         AC_MSG_RESULT([no])
9583     else
9584         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9585         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9586         AC_MSG_RESULT([yes])
9587     fi
9588     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9590 AC_SUBST(ENABLE_BREAKPAD)
9592 dnl ==================================================================
9593 dnl libfuzzer
9594 dnl ==================================================================
9595 AC_MSG_CHECKING([whether to enable fuzzers])
9596 if test "$enable_fuzzers" != yes; then
9597     AC_MSG_RESULT([no])
9598 else
9599     AC_MSG_RESULT([yes])
9600     ENABLE_FUZZERS="TRUE"
9601     AC_DEFINE([ENABLE_FUZZERS],1)
9602     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9604 AC_SUBST(ENABLE_FUZZERS)
9606 dnl ===================================================================
9607 dnl Orcus
9608 dnl ===================================================================
9609 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9610 if test "$with_system_orcus" != "yes"; then
9611     if test "$SYSTEM_BOOST" = "TRUE"; then
9612         # ===========================================================
9613         # Determine if we are going to need to link with Boost.System
9614         # ===========================================================
9615         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9616         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9617         dnl in documentation has no effect.
9618         AC_MSG_CHECKING([if we need to link with Boost.System])
9619         AC_LANG_PUSH([C++])
9620         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9621                 @%:@include <boost/version.hpp>
9622             ]],[[
9623                 #if BOOST_VERSION >= 105000
9624                 #   error yes, we need to link with Boost.System
9625                 #endif
9626             ]])],[
9627                 AC_MSG_RESULT([no])
9628             ],[
9629                 AC_MSG_RESULT([yes])
9630                 AX_BOOST_SYSTEM
9631         ])
9632         AC_LANG_POP([C++])
9633     fi
9635 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9636 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9637 AC_SUBST([BOOST_SYSTEM_LIB])
9638 AC_SUBST(SYSTEM_LIBORCUS)
9640 dnl ===================================================================
9641 dnl HarfBuzz
9642 dnl ===================================================================
9643 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9644                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9645                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9647 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9648                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9649                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9651 if test "$COM" = "MSC"; then # override the above
9652     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9653     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9656 if test "$with_system_harfbuzz" = "yes"; then
9657     if test "$with_system_graphite" = "no"; then
9658         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9659     fi
9660     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9661     _save_libs="$LIBS"
9662     _save_cflags="$CFLAGS"
9663     LIBS="$LIBS $HARFBUZZ_LIBS"
9664     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9665     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9666     LIBS="$_save_libs"
9667     CFLAGS="$_save_cflags"
9668 else
9669     if test "$with_system_graphite" = "yes"; then
9670         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9671     fi
9674 AC_MSG_CHECKING([whether to use X11])
9675 dnl ***************************************
9676 dnl testing for X libraries and includes...
9677 dnl ***************************************
9678 if test "$USING_X11" = TRUE; then
9679     AC_DEFINE(HAVE_FEATURE_X11)
9681 AC_MSG_RESULT([$USING_X11])
9683 if test "$USING_X11" = TRUE; then
9684     AC_PATH_X
9685     AC_PATH_XTRA
9686     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9688     if test -z "$x_includes"; then
9689         x_includes="default_x_includes"
9690     fi
9691     if test -z "$x_libraries"; then
9692         x_libraries="default_x_libraries"
9693     fi
9694     CFLAGS="$CFLAGS $X_CFLAGS"
9695     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9696     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9697 else
9698     x_includes="no_x_includes"
9699     x_libraries="no_x_libraries"
9702 if test "$USING_X11" = TRUE; then
9703     dnl ===================================================================
9704     dnl Check for extension headers
9705     dnl ===================================================================
9706     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9707      [#include <X11/extensions/shape.h>])
9709     # vcl needs ICE and SM
9710     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9711     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9712         [AC_MSG_ERROR(ICE library not found)])
9713     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9714     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9715         [AC_MSG_ERROR(SM library not found)])
9718 dnl ===================================================================
9719 dnl Check for system Xrender
9720 dnl ===================================================================
9721 AC_MSG_CHECKING([whether to use Xrender])
9722 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9723     AC_MSG_RESULT([yes])
9724     PKG_CHECK_MODULES(XRENDER, xrender)
9725     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9726     FilterLibs "${XRENDER_LIBS}"
9727     XRENDER_LIBS="${filteredlibs}"
9728     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9729       [AC_MSG_ERROR(libXrender not found or functional)], [])
9730     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9731       [AC_MSG_ERROR(Xrender not found. install X)], [])
9732 else
9733     AC_MSG_RESULT([no])
9735 AC_SUBST(XRENDER_CFLAGS)
9736 AC_SUBST(XRENDER_LIBS)
9738 dnl ===================================================================
9739 dnl Check for XRandr
9740 dnl ===================================================================
9741 AC_MSG_CHECKING([whether to enable RandR support])
9742 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9743     AC_MSG_RESULT([yes])
9744     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9745     if test "$ENABLE_RANDR" != "TRUE"; then
9746         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9747                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9748         XRANDR_CFLAGS=" "
9749         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9750           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9751         XRANDR_LIBS="-lXrandr "
9752         ENABLE_RANDR="TRUE"
9753     fi
9754     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9755     FilterLibs "${XRANDR_LIBS}"
9756     XRANDR_LIBS="${filteredlibs}"
9757 else
9758     ENABLE_RANDR=""
9759     AC_MSG_RESULT([no])
9761 AC_SUBST(XRANDR_CFLAGS)
9762 AC_SUBST(XRANDR_LIBS)
9763 AC_SUBST(ENABLE_RANDR)
9765 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9766     WITH_WEBDAV="serf"
9768 if test $_os = iOS -o $_os = Android; then
9769     WITH_WEBDAV="no"
9771 AC_MSG_CHECKING([for webdav library])
9772 case "$WITH_WEBDAV" in
9773 serf)
9774     AC_MSG_RESULT([serf])
9775     # Check for system apr-util
9776     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9777                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9778                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9779     if test "$COM" = "MSC"; then
9780         APR_LIB_DIR="LibR"
9781         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9782         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9783     fi
9785     # Check for system serf
9786     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9787                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9788     if test "$COM" = "MSC"; then
9789         SERF_LIB_DIR="Release"
9790         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9791         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9792     fi
9793     ;;
9794 neon)
9795     AC_MSG_RESULT([neon])
9796     # Check for system neon
9797     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9798     if test "$with_system_neon" = "yes"; then
9799         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9800     else
9801         NEON_VERSION=0295
9802     fi
9803     AC_SUBST(NEON_VERSION)
9804     ;;
9806     AC_MSG_RESULT([none, disabled])
9807     WITH_WEBDAV=""
9808     ;;
9809 esac
9810 AC_SUBST(WITH_WEBDAV)
9812 dnl ===================================================================
9813 dnl Check for disabling cve_tests
9814 dnl ===================================================================
9815 AC_MSG_CHECKING([whether to execute CVE tests])
9816 # If not explicitly enabled or disabled, default
9817 if test -z "$enable_cve_tests"; then
9818     case "$OS" in
9819     WNT)
9820         # Default cves off for Windows with its wild and wonderful
9821         # variety of AV software kicking in and panicking
9822         enable_cve_tests=no
9823         ;;
9824     *)
9825         # otherwise yes
9826         enable_cve_tests=yes
9827         ;;
9828     esac
9830 if test "$enable_cve_tests" = "no"; then
9831     AC_MSG_RESULT([no])
9832     DISABLE_CVE_TESTS=TRUE
9833     AC_SUBST(DISABLE_CVE_TESTS)
9834 else
9835     AC_MSG_RESULT([yes])
9838 dnl ===================================================================
9839 dnl Check for enabling chart XShape tests
9840 dnl ===================================================================
9841 AC_MSG_CHECKING([whether to execute chart XShape tests])
9842 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9843     AC_MSG_RESULT([yes])
9844     ENABLE_CHART_TESTS=TRUE
9845     AC_SUBST(ENABLE_CHART_TESTS)
9846 else
9847     AC_MSG_RESULT([no])
9850 dnl ===================================================================
9851 dnl Check for system openssl
9852 dnl ===================================================================
9853 DISABLE_OPENSSL=
9854 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9855 if test "$enable_openssl" = "yes"; then
9856     AC_MSG_RESULT([no])
9857     if test "$_os" = Darwin ; then
9858         # OpenSSL is deprecated when building for 10.7 or later.
9859         #
9860         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9861         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9863         with_system_openssl=no
9864         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9865     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9866             && test "$with_system_openssl" != "no"; then
9867         with_system_openssl=yes
9868         SYSTEM_OPENSSL=TRUE
9869         OPENSSL_CFLAGS=
9870         OPENSSL_LIBS="-lssl -lcrypto"
9871     else
9872         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9873     fi
9874     if test "$with_system_openssl" = "yes"; then
9875         AC_MSG_CHECKING([whether openssl supports SHA512])
9876         AC_LANG_PUSH([C])
9877         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9878             SHA512_CTX context;
9879 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9880         AC_LANG_POP(C)
9881     fi
9882 else
9883     AC_MSG_RESULT([yes])
9884     DISABLE_OPENSSL=TRUE
9886     # warn that although OpenSSL is disabled, system libraries may depend on it
9887     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies])
9888     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system libraries may create indirect dependencies"
9891 AC_SUBST([DISABLE_OPENSSL])
9893 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9894     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9895         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9896         enable_cipher_openssl_backend=no
9897     else
9898         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9899     fi
9901 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9902 ENABLE_CIPHER_OPENSSL_BACKEND=
9903 if test "$enable_cipher_openssl_backend" = yes; then
9904     AC_MSG_RESULT([yes])
9905     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9906 else
9907     AC_MSG_RESULT([no])
9909 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9911 dnl ===================================================================
9912 dnl Check for building gnutls
9913 dnl ===================================================================
9914 AC_MSG_CHECKING([whether to use gnutls])
9915 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9916     AC_MSG_RESULT([yes])
9917     AM_PATH_LIBGCRYPT()
9918     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9919         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9920                       available in the system to use as replacement.]]))
9921     FilterLibs "${LIBGCRYPT_LIBS}"
9922     LIBGCRYPT_LIBS="${filteredlibs}"
9923 else
9924     AC_MSG_RESULT([no])
9927 AC_SUBST([LIBGCRYPT_CFLAGS])
9928 AC_SUBST([LIBGCRYPT_LIBS])
9930 dnl ===================================================================
9931 dnl Check for system redland
9932 dnl ===================================================================
9933 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9934 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9935 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9936 if test "$with_system_redland" = "yes"; then
9937     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9938             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9939 else
9940     RAPTOR_MAJOR="0"
9941     RASQAL_MAJOR="3"
9942     REDLAND_MAJOR="0"
9944 AC_SUBST(RAPTOR_MAJOR)
9945 AC_SUBST(RASQAL_MAJOR)
9946 AC_SUBST(REDLAND_MAJOR)
9948 dnl ===================================================================
9949 dnl Check for system hunspell
9950 dnl ===================================================================
9951 AC_MSG_CHECKING([which libhunspell to use])
9952 if test "$with_system_hunspell" = "yes"; then
9953     AC_MSG_RESULT([external])
9954     SYSTEM_HUNSPELL=TRUE
9955     AC_LANG_PUSH([C++])
9956     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9957     if test "$HUNSPELL_PC" != "TRUE"; then
9958         AC_CHECK_HEADER(hunspell.hxx, [],
9959             [
9960             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9961             [AC_MSG_ERROR(hunspell headers not found.)], [])
9962             ], [])
9963         AC_CHECK_LIB([hunspell], [main], [:],
9964            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9965         HUNSPELL_LIBS=-lhunspell
9966     fi
9967     AC_LANG_POP([C++])
9968     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9969     FilterLibs "${HUNSPELL_LIBS}"
9970     HUNSPELL_LIBS="${filteredlibs}"
9971 else
9972     AC_MSG_RESULT([internal])
9973     SYSTEM_HUNSPELL=
9974     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9975     if test "$COM" = "MSC"; then
9976         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9977     else
9978         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9979     fi
9980     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9982 AC_SUBST(SYSTEM_HUNSPELL)
9983 AC_SUBST(HUNSPELL_CFLAGS)
9984 AC_SUBST(HUNSPELL_LIBS)
9986 dnl ===================================================================
9987 dnl Check for system qrcodegen
9988 dnl ===================================================================
9989 AC_MSG_CHECKING([which libqrcodegen to use])
9990 if test "$with_system_qrcodegen" = "yes"; then
9991     AC_MSG_RESULT([external])
9992     SYSTEM_QRCODEGEN=TRUE
9993     AC_LANG_PUSH([C++])
9994     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
9995         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
9996     AC_CHECK_LIB([qrcodegencpp], [main], [:],
9997         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
9998     QRCODEGEN_LIBS=-lqrcodegencpp
9999     AC_LANG_POP([C++])
10000     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10001     FilterLibs "${QRCODEGEN_LIBS}"
10002     QRCODEGEN_LIBS="${filteredlibs}"
10003 else
10004     AC_MSG_RESULT([internal])
10005     SYSTEM_QRCODEGEN=
10006     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10008 AC_SUBST(SYSTEM_QRCODEGEN)
10009 AC_SUBST(QRCODEGEN_CFLAGS)
10010 AC_SUBST(QRCODEGEN_LIBS)
10012 dnl ===================================================================
10013 dnl Checking for altlinuxhyph
10014 dnl ===================================================================
10015 AC_MSG_CHECKING([which altlinuxhyph to use])
10016 if test "$with_system_altlinuxhyph" = "yes"; then
10017     AC_MSG_RESULT([external])
10018     SYSTEM_HYPH=TRUE
10019     AC_CHECK_HEADER(hyphen.h, [],
10020        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10021     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10022        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10023        [#include <hyphen.h>])
10024     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10025         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10026     if test -z "$HYPHEN_LIB"; then
10027         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10028            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10029     fi
10030     if test -z "$HYPHEN_LIB"; then
10031         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10032            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10033     fi
10034 else
10035     AC_MSG_RESULT([internal])
10036     SYSTEM_HYPH=
10037     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10038     if test "$COM" = "MSC"; then
10039         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10040     else
10041         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10042     fi
10044 AC_SUBST(SYSTEM_HYPH)
10045 AC_SUBST(HYPHEN_LIB)
10047 dnl ===================================================================
10048 dnl Checking for mythes
10049 dnl ===================================================================
10050 AC_MSG_CHECKING([which mythes to use])
10051 if test "$with_system_mythes" = "yes"; then
10052     AC_MSG_RESULT([external])
10053     SYSTEM_MYTHES=TRUE
10054     AC_LANG_PUSH([C++])
10055     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10056     if test "$MYTHES_PKGCONFIG" = "no"; then
10057         AC_CHECK_HEADER(mythes.hxx, [],
10058             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10059         AC_CHECK_LIB([mythes-1.2], [main], [:],
10060             [ MYTHES_FOUND=no], [])
10061     if test "$MYTHES_FOUND" = "no"; then
10062         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10063                 [ MYTHES_FOUND=no], [])
10064     fi
10065     if test "$MYTHES_FOUND" = "no"; then
10066         AC_MSG_ERROR([mythes library not found!.])
10067     fi
10068     fi
10069     AC_LANG_POP([C++])
10070     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10071     FilterLibs "${MYTHES_LIBS}"
10072     MYTHES_LIBS="${filteredlibs}"
10073 else
10074     AC_MSG_RESULT([internal])
10075     SYSTEM_MYTHES=
10076     BUILD_TYPE="$BUILD_TYPE MYTHES"
10077     if test "$COM" = "MSC"; then
10078         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10079     else
10080         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10081     fi
10083 AC_SUBST(SYSTEM_MYTHES)
10084 AC_SUBST(MYTHES_CFLAGS)
10085 AC_SUBST(MYTHES_LIBS)
10087 dnl ===================================================================
10088 dnl How should we build the linear programming solver ?
10089 dnl ===================================================================
10091 ENABLE_COINMP=
10092 AC_MSG_CHECKING([whether to build with CoinMP])
10093 if test "$enable_coinmp" != "no"; then
10094     ENABLE_COINMP=TRUE
10095     AC_MSG_RESULT([yes])
10096     if test "$with_system_coinmp" = "yes"; then
10097         SYSTEM_COINMP=TRUE
10098         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10099         FilterLibs "${COINMP_LIBS}"
10100         COINMP_LIBS="${filteredlibs}"
10101     else
10102         BUILD_TYPE="$BUILD_TYPE COINMP"
10103     fi
10104 else
10105     AC_MSG_RESULT([no])
10107 AC_SUBST(ENABLE_COINMP)
10108 AC_SUBST(SYSTEM_COINMP)
10109 AC_SUBST(COINMP_CFLAGS)
10110 AC_SUBST(COINMP_LIBS)
10112 ENABLE_LPSOLVE=
10113 AC_MSG_CHECKING([whether to build with lpsolve])
10114 if test "$enable_lpsolve" != "no"; then
10115     ENABLE_LPSOLVE=TRUE
10116     AC_MSG_RESULT([yes])
10117 else
10118     AC_MSG_RESULT([no])
10120 AC_SUBST(ENABLE_LPSOLVE)
10122 if test "$ENABLE_LPSOLVE" = TRUE; then
10123     AC_MSG_CHECKING([which lpsolve to use])
10124     if test "$with_system_lpsolve" = "yes"; then
10125         AC_MSG_RESULT([external])
10126         SYSTEM_LPSOLVE=TRUE
10127         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10128            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10129         save_LIBS=$LIBS
10130         # some systems need this. Like Ubuntu....
10131         AC_CHECK_LIB(m, floor)
10132         AC_CHECK_LIB(dl, dlopen)
10133         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10134             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10135         LIBS=$save_LIBS
10136     else
10137         AC_MSG_RESULT([internal])
10138         SYSTEM_LPSOLVE=
10139         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10140     fi
10142 AC_SUBST(SYSTEM_LPSOLVE)
10144 dnl ===================================================================
10145 dnl Checking for libexttextcat
10146 dnl ===================================================================
10147 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10148 if test "$with_system_libexttextcat" = "yes"; then
10149     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10151 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10153 dnl ===================================================================
10154 dnl Checking for libnumbertext
10155 dnl ===================================================================
10156 AC_MSG_CHECKING([whether to use libnumbertext])
10157 if test "$enable_libnumbertext" = "no"; then
10158     AC_MSG_RESULT([no])
10159     ENABLE_LIBNUMBERTEXT=
10160     SYSTEM_LIBNUMBERTEXT=
10161 else
10162     AC_MSG_RESULT([yes])
10163     ENABLE_LIBNUMBERTEXT=TRUE
10164     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10165     if test "$with_system_libnumbertext" = "yes"; then
10166         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10167         SYSTEM_LIBNUMBERTEXT=YES
10168     else
10169         SYSTEM_LIBNUMBERTEXT=
10170         AC_LANG_PUSH([C++])
10171         save_CPPFLAGS=$CPPFLAGS
10172         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10173         AC_CHECK_HEADERS([codecvt regex])
10174         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10175                 [ ENABLE_LIBNUMBERTEXT=''
10176                   LIBNUMBERTEXT_CFLAGS=''
10177                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10178                                Enable libnumbertext fallback (missing number to number name conversion).])
10179                 ])
10180         CPPFLAGS=$save_CPPFLAGS
10181         AC_LANG_POP([C++])
10182     fi
10183     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10184         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10185     fi
10187 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10188 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10189 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10190 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10192 dnl ***************************************
10193 dnl testing libc version for Linux...
10194 dnl ***************************************
10195 if test "$_os" = "Linux"; then
10196     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10197     exec 6>/dev/null # no output
10198     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10199     exec 6>&1 # output on again
10200     if test "$HAVE_LIBC"; then
10201         AC_MSG_RESULT([yes])
10202     else
10203         AC_MSG_ERROR([no, upgrade libc])
10204     fi
10207 dnl =========================================
10208 dnl Check for uuidgen
10209 dnl =========================================
10210 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10211     # presence is already tested above in the WINDOWS_SDK_HOME check
10212     UUIDGEN=uuidgen.exe
10213     AC_SUBST(UUIDGEN)
10214 else
10215     AC_PATH_PROG([UUIDGEN], [uuidgen])
10216     if test -z "$UUIDGEN"; then
10217         AC_MSG_WARN([uuid is needed for building installation sets])
10218     fi
10221 dnl ***************************************
10222 dnl Checking for bison and flex
10223 dnl ***************************************
10224 AC_PATH_PROG(BISON, bison)
10225 if test -z "$BISON"; then
10226     AC_MSG_ERROR([no bison found in \$PATH, install it])
10227 else
10228     AC_MSG_CHECKING([the bison version])
10229     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10230     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10231     # Accept newer than 2.0
10232     if test "$_bison_longver" -lt 2000; then
10233         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10234     fi
10237 AC_PATH_PROG(FLEX, flex)
10238 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10239     FLEX=`cygpath -m $FLEX`
10241 if test -z "$FLEX"; then
10242     AC_MSG_ERROR([no flex found in \$PATH, install it])
10243 else
10244     AC_MSG_CHECKING([the flex version])
10245     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10246     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10247         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10248     fi
10250 AC_SUBST([FLEX])
10251 dnl ***************************************
10252 dnl Checking for patch
10253 dnl ***************************************
10254 AC_PATH_PROG(PATCH, patch)
10255 if test -z "$PATCH"; then
10256     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10259 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10260 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10261     if test -z "$with_gnu_patch"; then
10262         GNUPATCH=$PATCH
10263     else
10264         if test -x "$with_gnu_patch"; then
10265             GNUPATCH=$with_gnu_patch
10266         else
10267             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10268         fi
10269     fi
10271     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10272     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10273         AC_MSG_RESULT([yes])
10274     else
10275         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10276     fi
10277 else
10278     GNUPATCH=$PATCH
10281 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10282     GNUPATCH=`cygpath -m $GNUPATCH`
10285 dnl We also need to check for --with-gnu-cp
10287 if test -z "$with_gnu_cp"; then
10288     # check the place where the good stuff is hidden on Solaris...
10289     if test -x /usr/gnu/bin/cp; then
10290         GNUCP=/usr/gnu/bin/cp
10291     else
10292         AC_PATH_PROGS(GNUCP, gnucp cp)
10293     fi
10294     if test -z $GNUCP; then
10295         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10296     fi
10297 else
10298     if test -x "$with_gnu_cp"; then
10299         GNUCP=$with_gnu_cp
10300     else
10301         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10302     fi
10305 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10306     GNUCP=`cygpath -m $GNUCP`
10309 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10310 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10311     AC_MSG_RESULT([yes])
10312 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10313     AC_MSG_RESULT([yes])
10314 else
10315     case "$build_os" in
10316     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10317         x_GNUCP=[\#]
10318         GNUCP=''
10319         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10320         ;;
10321     *)
10322         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10323         ;;
10324     esac
10327 AC_SUBST(GNUPATCH)
10328 AC_SUBST(GNUCP)
10329 AC_SUBST(x_GNUCP)
10331 dnl ***************************************
10332 dnl testing assembler path
10333 dnl ***************************************
10334 ML_EXE=""
10335 if test "$_os" = "WINNT"; then
10336     if test "$BITNESS_OVERRIDE" = ""; then
10337         assembler=ml.exe
10338     else
10339         assembler=ml64.exe
10340     fi
10342     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10343     if test -f "$CL_PATH/$assembler"; then
10344         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10345         AC_MSG_RESULT([$ML_EXE])
10346     else
10347         AC_MSG_ERROR([not found])
10348     fi
10351 AC_SUBST(ML_EXE)
10353 dnl ===================================================================
10354 dnl We need zip and unzip
10355 dnl ===================================================================
10356 AC_PATH_PROG(ZIP, zip)
10357 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10358 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10359     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],,)
10362 AC_PATH_PROG(UNZIP, unzip)
10363 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10365 dnl ===================================================================
10366 dnl Zip must be a specific type for different build types.
10367 dnl ===================================================================
10368 if test $build_os = cygwin; then
10369     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10370         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10371     fi
10374 dnl ===================================================================
10375 dnl We need touch with -h option support.
10376 dnl ===================================================================
10377 AC_PATH_PROG(TOUCH, touch)
10378 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10379 touch warn
10380 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10381     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],,)
10384 dnl ===================================================================
10385 dnl Check for system epoxy
10386 dnl ===================================================================
10387 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10389 dnl ===================================================================
10390 dnl Set vcl option: coordinate device in double or sal_Int32
10391 dnl ===================================================================
10393 dnl disabled for now, we don't want subtle differences between OSs
10394 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10395 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10396 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10397 dnl     AC_MSG_RESULT([double])
10398 dnl else
10399 dnl     AC_MSG_RESULT([sal_Int32])
10400 dnl fi
10402 dnl ===================================================================
10403 dnl Test which vclplugs have to be built.
10404 dnl ===================================================================
10405 R=""
10406 if test "$USING_X11" != TRUE; then
10407     enable_gtk=no
10408     enable_gtk3=no
10410 GTK3_CFLAGS=""
10411 GTK3_LIBS=""
10412 ENABLE_GTK3=""
10413 if test "x$enable_gtk3" = "xyes"; then
10414     if test "$with_system_cairo" = no; then
10415         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10416     fi
10417     : ${with_system_cairo:=yes}
10418     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="")
10419     if test "x$ENABLE_GTK3" = "xTRUE"; then
10420         AC_DEFINE(ENABLE_GTK3)
10421         R="gtk3"
10422         dnl Avoid installed by unpackaged files for now.
10423         if test -z "$PKGFORMAT"; then
10424             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10425         fi
10426     else
10427         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10428     fi
10429     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10430     FilterLibs "${GTK3_LIBS}"
10431     GTK3_LIBS="${filteredlibs}"
10433     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10434     if test "$with_system_epoxy" != "yes"; then
10435         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10436         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10437                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10438     fi
10440 AC_SUBST(GTK3_LIBS)
10441 AC_SUBST(GTK3_CFLAGS)
10442 AC_SUBST(ENABLE_GTK3)
10444 ENABLE_GTK=""
10445 if test "x$enable_gtk" = "xyes"; then
10446     if test "$with_system_cairo" = no; then
10447         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10448     fi
10449     : ${with_system_cairo:=yes}
10450     ENABLE_GTK="TRUE"
10451     AC_DEFINE(ENABLE_GTK)
10452     R="gtk $R"
10454 AC_SUBST(ENABLE_GTK)
10456 ENABLE_QT5=""
10457 if test "x$enable_qt5" = "xyes"; then
10458     ENABLE_QT5="TRUE"
10459     AC_DEFINE(ENABLE_QT5)
10460     R="$R qt5"
10462 AC_SUBST(ENABLE_QT5)
10464 ENABLE_KDE5=""
10465 if test "x$enable_kde5" = "xyes"; then
10466     ENABLE_KDE5="TRUE"
10467     AC_DEFINE(ENABLE_KDE5)
10468     R="$R kde5"
10470 AC_SUBST(ENABLE_KDE5)
10472 ENABLE_GTK3_KDE5=""
10473 if test "x$enable_gtk3_kde5" = "xyes"; then
10474     ENABLE_GTK3_KDE5="TRUE"
10475     AC_DEFINE(ENABLE_GTK3_KDE5)
10476     R="$R gtk3_kde5"
10478 AC_SUBST(ENABLE_GTK3_KDE5)
10480 if test "$_os" = "WINNT"; then
10481     R="$R win"
10482 elif test "$_os" = "Darwin"; then
10483     R="$R osx"
10484 elif test "$_os" = "iOS"; then
10485     R="ios (builtin)"
10488 build_vcl_plugins="$R"
10489 if test -z "$build_vcl_plugins"; then
10490     build_vcl_plugins="none"
10492 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10494 dnl ===================================================================
10495 dnl check for dbus support
10496 dnl ===================================================================
10497 ENABLE_DBUS=""
10498 DBUS_CFLAGS=""
10499 DBUS_LIBS=""
10500 DBUS_GLIB_CFLAGS=""
10501 DBUS_GLIB_LIBS=""
10502 DBUS_HAVE_GLIB=""
10504 if test "$enable_dbus" = "no"; then
10505     test_dbus=no
10508 AC_MSG_CHECKING([whether to enable DBUS support])
10509 if test "$test_dbus" = "yes"; then
10510     ENABLE_DBUS="TRUE"
10511     AC_MSG_RESULT([yes])
10512     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10513     AC_DEFINE(ENABLE_DBUS)
10514     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10515     FilterLibs "${DBUS_LIBS}"
10516     DBUS_LIBS="${filteredlibs}"
10518     # Glib is needed for BluetoothServer
10519     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10520     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10521         [
10522             DBUS_HAVE_GLIB="TRUE"
10523             AC_DEFINE(DBUS_HAVE_GLIB,1)
10524         ],
10525         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10526     )
10527 else
10528     AC_MSG_RESULT([no])
10531 AC_SUBST(ENABLE_DBUS)
10532 AC_SUBST(DBUS_CFLAGS)
10533 AC_SUBST(DBUS_LIBS)
10534 AC_SUBST(DBUS_GLIB_CFLAGS)
10535 AC_SUBST(DBUS_GLIB_LIBS)
10536 AC_SUBST(DBUS_HAVE_GLIB)
10538 AC_MSG_CHECKING([whether to enable Impress remote control])
10539 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10540     AC_MSG_RESULT([yes])
10541     ENABLE_SDREMOTE=TRUE
10542     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10544     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10545         # The Bluetooth code doesn't compile with macOS SDK 10.15
10546         enable_sdremote_bluetooth=no
10547     fi
10548     # If not explicitly enabled or disabled, default
10549     if test -z "$enable_sdremote_bluetooth"; then
10550         case "$OS" in
10551         LINUX|MACOSX|WNT)
10552             # Default to yes for these
10553             enable_sdremote_bluetooth=yes
10554             ;;
10555         *)
10556             # otherwise no
10557             enable_sdremote_bluetooth=no
10558             ;;
10559         esac
10560     fi
10561     # $enable_sdremote_bluetooth is guaranteed non-empty now
10563     if test "$enable_sdremote_bluetooth" != "no"; then
10564         if test "$OS" = "LINUX"; then
10565             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10566                 AC_MSG_RESULT([yes])
10567                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10568                 dnl ===================================================================
10569                 dnl Check for system bluez
10570                 dnl ===================================================================
10571                 AC_MSG_CHECKING([which Bluetooth header to use])
10572                 if test "$with_system_bluez" = "yes"; then
10573                     AC_MSG_RESULT([external])
10574                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10575                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10576                     SYSTEM_BLUEZ=TRUE
10577                 else
10578                     AC_MSG_RESULT([internal])
10579                     SYSTEM_BLUEZ=
10580                 fi
10581             else
10582                 AC_MSG_RESULT([no, dbus disabled])
10583                 ENABLE_SDREMOTE_BLUETOOTH=
10584                 SYSTEM_BLUEZ=
10585             fi
10586         else
10587             AC_MSG_RESULT([yes])
10588             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10589             SYSTEM_BLUEZ=
10590         fi
10591     else
10592         AC_MSG_RESULT([no])
10593         ENABLE_SDREMOTE_BLUETOOTH=
10594         SYSTEM_BLUEZ=
10595     fi
10596 else
10597     ENABLE_SDREMOTE=
10598     SYSTEM_BLUEZ=
10599     AC_MSG_RESULT([no])
10601 AC_SUBST(ENABLE_SDREMOTE)
10602 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10603 AC_SUBST(SYSTEM_BLUEZ)
10605 dnl ===================================================================
10606 dnl Check whether the gtk 2.0 libraries are available.
10607 dnl ===================================================================
10609 GTK_CFLAGS=""
10610 GTK_LIBS=""
10611 if test  "$test_gtk" = "yes"; then
10613     if test "$ENABLE_GTK" = "TRUE"; then
10614         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]))
10615         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10616         FilterLibs "${GTK_LIBS}"
10617         GTK_LIBS="${filteredlibs}"
10618         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]))
10619         BUILD_TYPE="$BUILD_TYPE GTK"
10620         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10621         FilterLibs "${GTHREAD_LIBS}"
10622         GTHREAD_LIBS="${filteredlibs}"
10624         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10625         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10626                           [ENABLE_GTK_PRINT="TRUE"],
10627                           [ENABLE_GTK_PRINT=""])
10628         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10629         FilterLibs "${GTK_PRINT_LIBS}"
10630         GTK_PRINT_LIBS="${filteredlibs}"
10631     fi
10633     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10634         AC_MSG_CHECKING([whether to enable GIO support])
10635         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10636             dnl Need at least 2.26 for the dbus support.
10637             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10638                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10639             if test "$ENABLE_GIO" = "TRUE"; then
10640                 AC_DEFINE(ENABLE_GIO)
10641                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10642                 FilterLibs "${GIO_LIBS}"
10643                 GIO_LIBS="${filteredlibs}"
10644             fi
10645         else
10646             AC_MSG_RESULT([no])
10647         fi
10648     fi
10650 AC_SUBST(ENABLE_GIO)
10651 AC_SUBST(GIO_CFLAGS)
10652 AC_SUBST(GIO_LIBS)
10653 AC_SUBST(GTK_CFLAGS)
10654 AC_SUBST(GTK_LIBS)
10655 AC_SUBST(GTHREAD_CFLAGS)
10656 AC_SUBST(GTHREAD_LIBS)
10657 AC_SUBST([ENABLE_GTK_PRINT])
10658 AC_SUBST([GTK_PRINT_CFLAGS])
10659 AC_SUBST([GTK_PRINT_LIBS])
10662 dnl ===================================================================
10664 SPLIT_APP_MODULES=""
10665 if test "$enable_split_app_modules" = "yes"; then
10666     SPLIT_APP_MODULES="TRUE"
10668 AC_SUBST(SPLIT_APP_MODULES)
10670 SPLIT_OPT_FEATURES=""
10671 if test "$enable_split_opt_features" = "yes"; then
10672     SPLIT_OPT_FEATURES="TRUE"
10674 AC_SUBST(SPLIT_OPT_FEATURES)
10676 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10677     if test "$enable_cairo_canvas" = yes; then
10678         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10679     fi
10680     enable_cairo_canvas=no
10681 elif test -z "$enable_cairo_canvas"; then
10682     enable_cairo_canvas=yes
10685 ENABLE_CAIRO_CANVAS=""
10686 if test "$enable_cairo_canvas" = "yes"; then
10687     test_cairo=yes
10688     ENABLE_CAIRO_CANVAS="TRUE"
10689     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10691 AC_SUBST(ENABLE_CAIRO_CANVAS)
10693 dnl ===================================================================
10694 dnl Check whether the GStreamer libraries are available.
10695 dnl ===================================================================
10697 ENABLE_GSTREAMER_1_0=""
10699 if test "$build_gstreamer_1_0" = "yes"; then
10701     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10702     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10703         ENABLE_GSTREAMER_1_0="TRUE"
10704         AC_MSG_RESULT([yes])
10705         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10706         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10707         FilterLibs "${GSTREAMER_1_0_LIBS}"
10708         GSTREAMER_1_0_LIBS="${filteredlibs}"
10709         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10710     else
10711         AC_MSG_RESULT([no])
10712     fi
10714 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10715 AC_SUBST(GSTREAMER_1_0_LIBS)
10716 AC_SUBST(ENABLE_GSTREAMER_1_0)
10718 dnl ===================================================================
10719 dnl Check whether to build the VLC avmedia backend
10720 dnl ===================================================================
10722 ENABLE_VLC=""
10724 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10725 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10726     ENABLE_VLC="TRUE"
10727     AC_MSG_RESULT([yes])
10728 else
10729     AC_MSG_RESULT([no])
10731 AC_SUBST(ENABLE_VLC)
10733 ENABLE_OPENGL_TRANSITIONS=
10734 ENABLE_OPENGL_CANVAS=
10735 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10736    : # disable
10737 elif test "$_os" = "Darwin"; then
10738     # We use frameworks on macOS, no need for detail checks
10739     ENABLE_OPENGL_TRANSITIONS=TRUE
10740     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10741     ENABLE_OPENGL_CANVAS=TRUE
10742 elif test $_os = WINNT; then
10743     ENABLE_OPENGL_TRANSITIONS=TRUE
10744     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10745     ENABLE_OPENGL_CANVAS=TRUE
10746 else
10747     if test "$USING_X11" = TRUE; then
10748         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10749         ENABLE_OPENGL_TRANSITIONS=TRUE
10750         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10751         ENABLE_OPENGL_CANVAS=TRUE
10752     fi
10755 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10756 AC_SUBST(ENABLE_OPENGL_CANVAS)
10758 dnl =================================================
10759 dnl Check whether to build with OpenCL support.
10760 dnl =================================================
10762 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10763     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10764     # platform (optional at run-time, used through clew).
10765     BUILD_TYPE="$BUILD_TYPE OPENCL"
10766     AC_DEFINE(HAVE_FEATURE_OPENCL)
10769 dnl =================================================
10770 dnl Check whether to build with dconf support.
10771 dnl =================================================
10773 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10774     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10775         if test "$enable_dconf" = yes; then
10776             AC_MSG_ERROR([dconf not found])
10777         else
10778             enable_dconf=no
10779         fi])
10781 AC_MSG_CHECKING([whether to enable dconf])
10782 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10783     DCONF_CFLAGS=
10784     DCONF_LIBS=
10785     ENABLE_DCONF=
10786     AC_MSG_RESULT([no])
10787 else
10788     ENABLE_DCONF=TRUE
10789     AC_DEFINE(ENABLE_DCONF)
10790     AC_MSG_RESULT([yes])
10792 AC_SUBST([DCONF_CFLAGS])
10793 AC_SUBST([DCONF_LIBS])
10794 AC_SUBST([ENABLE_DCONF])
10796 # pdf import?
10797 AC_MSG_CHECKING([whether to build the PDF import feature])
10798 ENABLE_PDFIMPORT=
10799 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10800     AC_MSG_RESULT([yes])
10801     ENABLE_PDFIMPORT=TRUE
10802     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10803 else
10804     AC_MSG_RESULT([no])
10807 # Pdfium?
10808 AC_MSG_CHECKING([whether to build PDFium])
10809 ENABLE_PDFIUM=
10810 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10811     AC_MSG_RESULT([yes])
10812     ENABLE_PDFIUM=TRUE
10813     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10814     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10815 else
10816     AC_MSG_RESULT([no])
10818 AC_SUBST(ENABLE_PDFIUM)
10820 dnl ===================================================================
10821 dnl Check for poppler
10822 dnl ===================================================================
10823 ENABLE_POPPLER=
10824 AC_MSG_CHECKING([whether to build Poppler])
10825 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10826     AC_MSG_RESULT([yes])
10827     ENABLE_POPPLER=TRUE
10828     AC_DEFINE(HAVE_FEATURE_POPPLER)
10829 else
10830     AC_MSG_RESULT([no])
10832 AC_SUBST(ENABLE_POPPLER)
10834 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10835     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10838 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10839     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10842 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10843     dnl ===================================================================
10844     dnl Check for system poppler
10845     dnl ===================================================================
10846     AC_MSG_CHECKING([which PDF import poppler to use])
10847     if test "$with_system_poppler" = "yes"; then
10848         AC_MSG_RESULT([external])
10849         SYSTEM_POPPLER=TRUE
10850         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10851         AC_LANG_PUSH([C++])
10852         save_CXXFLAGS=$CXXFLAGS
10853         save_CPPFLAGS=$CPPFLAGS
10854         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10855         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10856         AC_CHECK_HEADER([cpp/poppler-version.h],
10857             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10858             [])
10859         CXXFLAGS=$save_CXXFLAGS
10860         CPPFLAGS=$save_CPPFLAGS
10861         AC_LANG_POP([C++])
10862         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10864         FilterLibs "${POPPLER_LIBS}"
10865         POPPLER_LIBS="${filteredlibs}"
10866     else
10867         AC_MSG_RESULT([internal])
10868         SYSTEM_POPPLER=
10869         BUILD_TYPE="$BUILD_TYPE POPPLER"
10870         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10871     fi
10872     AC_DEFINE([ENABLE_PDFIMPORT],1)
10874 AC_SUBST(ENABLE_PDFIMPORT)
10875 AC_SUBST(SYSTEM_POPPLER)
10876 AC_SUBST(POPPLER_CFLAGS)
10877 AC_SUBST(POPPLER_LIBS)
10879 SYSTEM_GPGMEPP=
10881 if test "$build_for_ios" = "YES"; then
10882     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10883     AC_MSG_RESULT([yes])
10884 elif test "$enable_mpl_subset" = "yes"; then
10885     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10886     AC_MSG_RESULT([yes])
10887 elif test "$enable_fuzzers" = "yes"; then
10888     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10889     AC_MSG_RESULT([yes])
10890 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10891     dnl ===================================================================
10892     dnl Check for system gpgme
10893     dnl ===================================================================
10894     AC_MSG_CHECKING([which gpgmepp to use])
10895     if test "$with_system_gpgmepp" = "yes"; then
10896         AC_MSG_RESULT([external])
10897         SYSTEM_GPGMEPP=TRUE
10899         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10900         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10901             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10902         # progress_callback is the only func with plain C linkage
10903         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10904         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10905             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10906         AC_CHECK_HEADER(gpgme.h, [],
10907             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10908     else
10909         AC_MSG_RESULT([internal])
10910         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10911         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10913         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10914         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10915         if test "$_os" != "WINNT"; then
10916             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10917             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10918         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10919             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10920         fi
10921     fi
10922     ENABLE_GPGMEPP=TRUE
10923     AC_DEFINE([HAVE_FEATURE_GPGME])
10924     AC_PATH_PROG(GPG, gpg)
10925     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10926     # so let's exclude that manually for the moment
10927     if test -n "$GPG" -a "$_os" != "WINNT"; then
10928         # make sure we not only have a working gpgme, but a full working
10929         # gpg installation to run OpenPGP signature verification
10930         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10931     fi
10932     if test "$_os" = "Linux"; then
10933       uid=`id -u`
10934       AC_MSG_CHECKING([for /run/user/$uid])
10935       if test -d /run/user/$uid; then
10936         AC_MSG_RESULT([yes])
10937         AC_PATH_PROG(GPGCONF, gpgconf)
10939         # Older versions of gpgconf are not working as expected, since
10940         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10941         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10942         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10943         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10944         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10945         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10946         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10947           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10948           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10949           if $GPGCONF --dump-options > /dev/null ; then
10950             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10951               AC_MSG_RESULT([yes])
10952               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10953               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10954             else
10955               AC_MSG_RESULT([no])
10956             fi
10957           else
10958             AC_MSG_RESULT([no. missing or broken gpgconf?])
10959           fi
10960         else
10961           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10962         fi
10963       else
10964         AC_MSG_RESULT([no])
10965      fi
10966    fi
10968 AC_SUBST(ENABLE_GPGMEPP)
10969 AC_SUBST(SYSTEM_GPGMEPP)
10970 AC_SUBST(GPG_ERROR_CFLAGS)
10971 AC_SUBST(GPG_ERROR_LIBS)
10972 AC_SUBST(LIBASSUAN_CFLAGS)
10973 AC_SUBST(LIBASSUAN_LIBS)
10974 AC_SUBST(GPGMEPP_CFLAGS)
10975 AC_SUBST(GPGMEPP_LIBS)
10977 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10978 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10979     AC_MSG_RESULT([yes])
10980     ENABLE_MEDIAWIKI=TRUE
10981     BUILD_TYPE="$BUILD_TYPE XSLTML"
10982     if test  "x$with_java" = "xno"; then
10983         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10984     fi
10985 else
10986     AC_MSG_RESULT([no])
10987     ENABLE_MEDIAWIKI=
10988     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10990 AC_SUBST(ENABLE_MEDIAWIKI)
10992 AC_MSG_CHECKING([whether to build the Report Builder])
10993 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10994     AC_MSG_RESULT([yes])
10995     ENABLE_REPORTBUILDER=TRUE
10996     AC_MSG_CHECKING([which jfreereport libs to use])
10997     if test "$with_system_jfreereport" = "yes"; then
10998         SYSTEM_JFREEREPORT=TRUE
10999         AC_MSG_RESULT([external])
11000         if test -z $SAC_JAR; then
11001             SAC_JAR=/usr/share/java/sac.jar
11002         fi
11003         if ! test -f $SAC_JAR; then
11004              AC_MSG_ERROR(sac.jar not found.)
11005         fi
11007         if test -z $LIBXML_JAR; then
11008             if test -f /usr/share/java/libxml-1.0.0.jar; then
11009                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11010             elif test -f /usr/share/java/libxml.jar; then
11011                 LIBXML_JAR=/usr/share/java/libxml.jar
11012             else
11013                 AC_MSG_ERROR(libxml.jar replacement not found.)
11014             fi
11015         elif ! test -f $LIBXML_JAR; then
11016             AC_MSG_ERROR(libxml.jar not found.)
11017         fi
11019         if test -z $FLUTE_JAR; then
11020             if test -f/usr/share/java/flute-1.3.0.jar; then
11021                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11022             elif test -f /usr/share/java/flute.jar; then
11023                 FLUTE_JAR=/usr/share/java/flute.jar
11024             else
11025                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11026             fi
11027         elif ! test -f $FLUTE_JAR; then
11028             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11029         fi
11031         if test -z $JFREEREPORT_JAR; then
11032             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11033                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11034             elif test -f /usr/share/java/flow-engine.jar; then
11035                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11036             else
11037                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11038             fi
11039         elif ! test -f  $JFREEREPORT_JAR; then
11040                 AC_MSG_ERROR(jfreereport.jar not found.)
11041         fi
11043         if test -z $LIBLAYOUT_JAR; then
11044             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11045                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11046             elif test -f /usr/share/java/liblayout.jar; then
11047                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11048             else
11049                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11050             fi
11051         elif ! test -f $LIBLAYOUT_JAR; then
11052                 AC_MSG_ERROR(liblayout.jar not found.)
11053         fi
11055         if test -z $LIBLOADER_JAR; then
11056             if test -f /usr/share/java/libloader-1.0.0.jar; then
11057                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11058             elif test -f /usr/share/java/libloader.jar; then
11059                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11060             else
11061                 AC_MSG_ERROR(libloader.jar replacement not found.)
11062             fi
11063         elif ! test -f  $LIBLOADER_JAR; then
11064             AC_MSG_ERROR(libloader.jar not found.)
11065         fi
11067         if test -z $LIBFORMULA_JAR; then
11068             if test -f /usr/share/java/libformula-0.2.0.jar; then
11069                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11070             elif test -f /usr/share/java/libformula.jar; then
11071                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11072             else
11073                 AC_MSG_ERROR(libformula.jar replacement not found.)
11074             fi
11075         elif ! test -f $LIBFORMULA_JAR; then
11076                 AC_MSG_ERROR(libformula.jar not found.)
11077         fi
11079         if test -z $LIBREPOSITORY_JAR; then
11080             if test -f /usr/share/java/librepository-1.0.0.jar; then
11081                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11082             elif test -f /usr/share/java/librepository.jar; then
11083                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11084             else
11085                 AC_MSG_ERROR(librepository.jar replacement not found.)
11086             fi
11087         elif ! test -f $LIBREPOSITORY_JAR; then
11088             AC_MSG_ERROR(librepository.jar not found.)
11089         fi
11091         if test -z $LIBFONTS_JAR; then
11092             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11093                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11094             elif test -f /usr/share/java/libfonts.jar; then
11095                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11096             else
11097                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11098             fi
11099         elif ! test -f $LIBFONTS_JAR; then
11100                 AC_MSG_ERROR(libfonts.jar not found.)
11101         fi
11103         if test -z $LIBSERIALIZER_JAR; then
11104             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11105                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11106             elif test -f /usr/share/java/libserializer.jar; then
11107                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11108             else
11109                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11110             fi
11111         elif ! test -f $LIBSERIALIZER_JAR; then
11112                 AC_MSG_ERROR(libserializer.jar not found.)
11113         fi
11115         if test -z $LIBBASE_JAR; then
11116             if test -f /usr/share/java/libbase-1.0.0.jar; then
11117                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11118             elif test -f /usr/share/java/libbase.jar; then
11119                 LIBBASE_JAR=/usr/share/java/libbase.jar
11120             else
11121                 AC_MSG_ERROR(libbase.jar replacement not found.)
11122             fi
11123         elif ! test -f $LIBBASE_JAR; then
11124             AC_MSG_ERROR(libbase.jar not found.)
11125         fi
11127     else
11128         AC_MSG_RESULT([internal])
11129         SYSTEM_JFREEREPORT=
11130         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11131         NEED_ANT=TRUE
11132     fi
11133 else
11134     AC_MSG_RESULT([no])
11135     ENABLE_REPORTBUILDER=
11136     SYSTEM_JFREEREPORT=
11138 AC_SUBST(ENABLE_REPORTBUILDER)
11139 AC_SUBST(SYSTEM_JFREEREPORT)
11140 AC_SUBST(SAC_JAR)
11141 AC_SUBST(LIBXML_JAR)
11142 AC_SUBST(FLUTE_JAR)
11143 AC_SUBST(JFREEREPORT_JAR)
11144 AC_SUBST(LIBBASE_JAR)
11145 AC_SUBST(LIBLAYOUT_JAR)
11146 AC_SUBST(LIBLOADER_JAR)
11147 AC_SUBST(LIBFORMULA_JAR)
11148 AC_SUBST(LIBREPOSITORY_JAR)
11149 AC_SUBST(LIBFONTS_JAR)
11150 AC_SUBST(LIBSERIALIZER_JAR)
11152 # this has to be here because both the Wiki Publisher and the SRB use
11153 # commons-logging
11154 COMMONS_LOGGING_VERSION=1.2
11155 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11156     AC_MSG_CHECKING([which Apache commons-* libs to use])
11157     if test "$with_system_apache_commons" = "yes"; then
11158         SYSTEM_APACHE_COMMONS=TRUE
11159         AC_MSG_RESULT([external])
11160         if test -z $COMMONS_LOGGING_JAR; then
11161             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11162                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11163            elif test -f /usr/share/java/commons-logging.jar; then
11164                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11165             else
11166                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11167             fi
11168         elif ! test -f $COMMONS_LOGGING_JAR; then
11169             AC_MSG_ERROR(commons-logging.jar not found.)
11170         fi
11171     else
11172         AC_MSG_RESULT([internal])
11173         SYSTEM_APACHE_COMMONS=
11174         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11175         NEED_ANT=TRUE
11176     fi
11178 AC_SUBST(SYSTEM_APACHE_COMMONS)
11179 AC_SUBST(COMMONS_LOGGING_JAR)
11180 AC_SUBST(COMMONS_LOGGING_VERSION)
11182 # scripting provider for BeanShell?
11183 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11184 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11185     AC_MSG_RESULT([yes])
11186     ENABLE_SCRIPTING_BEANSHELL=TRUE
11188     dnl ===================================================================
11189     dnl Check for system beanshell
11190     dnl ===================================================================
11191     AC_MSG_CHECKING([which beanshell to use])
11192     if test "$with_system_beanshell" = "yes"; then
11193         AC_MSG_RESULT([external])
11194         SYSTEM_BSH=TRUE
11195         if test -z $BSH_JAR; then
11196             BSH_JAR=/usr/share/java/bsh.jar
11197         fi
11198         if ! test -f $BSH_JAR; then
11199             AC_MSG_ERROR(bsh.jar not found.)
11200         fi
11201     else
11202         AC_MSG_RESULT([internal])
11203         SYSTEM_BSH=
11204         BUILD_TYPE="$BUILD_TYPE BSH"
11205     fi
11206 else
11207     AC_MSG_RESULT([no])
11208     ENABLE_SCRIPTING_BEANSHELL=
11209     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11211 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11212 AC_SUBST(SYSTEM_BSH)
11213 AC_SUBST(BSH_JAR)
11215 # scripting provider for JavaScript?
11216 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11217 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11218     AC_MSG_RESULT([yes])
11219     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11221     dnl ===================================================================
11222     dnl Check for system rhino
11223     dnl ===================================================================
11224     AC_MSG_CHECKING([which rhino to use])
11225     if test "$with_system_rhino" = "yes"; then
11226         AC_MSG_RESULT([external])
11227         SYSTEM_RHINO=TRUE
11228         if test -z $RHINO_JAR; then
11229             RHINO_JAR=/usr/share/java/js.jar
11230         fi
11231         if ! test -f $RHINO_JAR; then
11232             AC_MSG_ERROR(js.jar not found.)
11233         fi
11234     else
11235         AC_MSG_RESULT([internal])
11236         SYSTEM_RHINO=
11237         BUILD_TYPE="$BUILD_TYPE RHINO"
11238         NEED_ANT=TRUE
11239     fi
11240 else
11241     AC_MSG_RESULT([no])
11242     ENABLE_SCRIPTING_JAVASCRIPT=
11243     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11245 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11246 AC_SUBST(SYSTEM_RHINO)
11247 AC_SUBST(RHINO_JAR)
11249 # This is only used in Qt5/KDE5 checks to determine if /usr/lib64
11250 # paths should be added to library search path. So lets put all 64-bit
11251 # platforms there.
11252 supports_multilib=
11253 case "$host_cpu" in
11254 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11255     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11256         supports_multilib="yes"
11257     fi
11258     ;;
11260     ;;
11261 esac
11263 dnl ===================================================================
11264 dnl QT5 Integration
11265 dnl ===================================================================
11267 QT5_CFLAGS=""
11268 QT5_LIBS=""
11269 QMAKE5="qmake"
11270 MOC5="moc"
11271 QT5_GOBJECT_CFLAGS=""
11272 QT5_GOBJECT_LIBS=""
11273 QT5_HAVE_GOBJECT=""
11274 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11275         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11276         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11277 then
11278     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11279     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11281     if test -n "$supports_multilib"; then
11282         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11283     fi
11285     qt5_test_include="QtWidgets/qapplication.h"
11286     qt5_test_library="libQt5Widgets.so"
11288     dnl Check for qmake5
11289     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11290     if test "$QMAKE5" = "no"; then
11291         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11292     else
11293         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11294         if test -z "$qmake5_test_ver"; then
11295             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11296         fi
11297         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11298         qt5_minimal_minor="6"
11299         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11300             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11301         else
11302             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11303         fi
11304     fi
11306     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11307     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11309     AC_MSG_CHECKING([for Qt5 headers])
11310     qt5_incdir="no"
11311     for inc_dir in $qt5_incdirs; do
11312         if test -r "$inc_dir/$qt5_test_include"; then
11313             qt5_incdir="$inc_dir"
11314             break
11315         fi
11316     done
11317     AC_MSG_RESULT([$qt5_incdir])
11318     if test "x$qt5_incdir" = "xno"; then
11319         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11320     fi
11322     AC_MSG_CHECKING([for Qt5 libraries])
11323     qt5_libdir="no"
11324     for lib_dir in $qt5_libdirs; do
11325         if test -r "$lib_dir/$qt5_test_library"; then
11326             qt5_libdir="$lib_dir"
11327             break
11328         fi
11329     done
11330     AC_MSG_RESULT([$qt5_libdir])
11331     if test "x$qt5_libdir" = "xno"; then
11332         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11333     fi
11335     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11336     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11337     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11339     if test "$USING_X11" = TRUE; then
11340         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11341         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11342         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11343         QT5_USING_X11=1
11344         AC_DEFINE(QT5_USING_X11)
11345     fi
11347     dnl Check for Meta Object Compiler
11349     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11350     if test "$MOC5" = "no"; then
11351         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11352 the root of your Qt installation by exporting QT5DIR before running "configure".])
11353     fi
11355     if test "$build_gstreamer_1_0" = "yes"; then
11356         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11357                 QT5_HAVE_GOBJECT=1
11358                 AC_DEFINE(QT5_HAVE_GOBJECT)
11359             ],
11360             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11361         )
11362     fi
11364 AC_SUBST(QT5_CFLAGS)
11365 AC_SUBST(QT5_LIBS)
11366 AC_SUBST(MOC5)
11367 AC_SUBST(QT5_GOBJECT_CFLAGS)
11368 AC_SUBST(QT5_GOBJECT_LIBS)
11369 AC_SUBST(QT5_HAVE_GOBJECT)
11371 dnl ===================================================================
11372 dnl KDE5 Integration
11373 dnl ===================================================================
11375 KF5_CFLAGS=""
11376 KF5_LIBS=""
11377 KF5_CONFIG="kf5-config"
11378 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11379         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11380         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11381 then
11382     if test "$OS" = "HAIKU"; then
11383         haiku_arch="`echo $RTL_ARCH | tr X x`"
11384         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11385         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11386     fi
11388     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11389     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11390     if test -n "$supports_multilib"; then
11391         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11392     fi
11394     kf5_test_include="KF5/kcoreaddons_version.h"
11395     kf5_test_library="libKF5CoreAddons.so"
11396     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11398     dnl kf5 KDE4 support compatibility installed
11399     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11400     if test "$KF5_CONFIG" != "no"; then
11401         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11402         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11403     fi
11405     dnl Check for KF5 headers
11406     AC_MSG_CHECKING([for KF5 headers])
11407     kf5_incdir="no"
11408     for kf5_check in $kf5_incdirs; do
11409         if test -r "$kf5_check/$kf5_test_include"; then
11410             kf5_incdir="$kf5_check/KF5"
11411             break
11412         fi
11413     done
11414     AC_MSG_RESULT([$kf5_incdir])
11415     if test "x$kf5_incdir" = "xno"; then
11416         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11417     fi
11419     dnl Check for KF5 libraries
11420     AC_MSG_CHECKING([for KF5 libraries])
11421     kf5_libdir="no"
11422     for kf5_check in $kf5_libdirs; do
11423         if test -r "$kf5_check/$kf5_test_library"; then
11424             kf5_libdir="$kf5_check"
11425             break
11426         fi
11427     done
11429     AC_MSG_RESULT([$kf5_libdir])
11430     if test "x$kf5_libdir" = "xno"; then
11431         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11432     fi
11434     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11435     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11436     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11438     if test "$USING_X11" = TRUE; then
11439         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11440     fi
11442     AC_LANG_PUSH([C++])
11443     save_CXXFLAGS=$CXXFLAGS
11444     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11445     AC_MSG_CHECKING([whether KDE is >= 5.0])
11446        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11447 #include <kcoreaddons_version.h>
11449 int main(int argc, char **argv) {
11450        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11451        else return 1;
11453        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11454     CXXFLAGS=$save_CXXFLAGS
11455     AC_LANG_POP([C++])
11457 AC_SUBST(KF5_CFLAGS)
11458 AC_SUBST(KF5_LIBS)
11460 dnl ===================================================================
11461 dnl Test whether to include Evolution 2 support
11462 dnl ===================================================================
11463 AC_MSG_CHECKING([whether to enable evolution 2 support])
11464 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11465     AC_MSG_RESULT([yes])
11466     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11467     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11468     FilterLibs "${GOBJECT_LIBS}"
11469     GOBJECT_LIBS="${filteredlibs}"
11470     ENABLE_EVOAB2="TRUE"
11471 else
11472     ENABLE_EVOAB2=""
11473     AC_MSG_RESULT([no])
11475 AC_SUBST(ENABLE_EVOAB2)
11476 AC_SUBST(GOBJECT_CFLAGS)
11477 AC_SUBST(GOBJECT_LIBS)
11479 dnl ===================================================================
11480 dnl Test which themes to include
11481 dnl ===================================================================
11482 AC_MSG_CHECKING([which themes to include])
11483 # if none given use default subset of available themes
11484 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11485     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_svg sifr_dark tango"
11488 WITH_THEMES=""
11489 if test "x$with_theme" != "xno"; then
11490     for theme in $with_theme; do
11491         case $theme in
11492         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11493         default) real_theme=colibre ;;
11494         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11495         esac
11496         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11497     done
11499 AC_MSG_RESULT([$WITH_THEMES])
11500 AC_SUBST([WITH_THEMES])
11501 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11502 for theme in $with_theme; do
11503     case $theme in
11504     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11505     *) ;;
11506     esac
11507 done
11509 dnl ===================================================================
11510 dnl Test whether to integrate helppacks into the product's installer
11511 dnl ===================================================================
11512 AC_MSG_CHECKING([for helppack integration])
11513 if test "$with_helppack_integration" = "no"; then
11514     AC_MSG_RESULT([no integration])
11515 else
11516     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11517     AC_MSG_RESULT([integration])
11520 ###############################################################################
11521 # Extensions checking
11522 ###############################################################################
11523 AC_MSG_CHECKING([for extensions integration])
11524 if test "x$enable_extension_integration" != "xno"; then
11525     WITH_EXTENSION_INTEGRATION=TRUE
11526     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11527     AC_MSG_RESULT([yes, use integration])
11528 else
11529     WITH_EXTENSION_INTEGRATION=
11530     AC_MSG_RESULT([no, do not integrate])
11532 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11534 dnl Should any extra extensions be included?
11535 dnl There are standalone tests for each of these below.
11536 WITH_EXTRA_EXTENSIONS=
11537 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11539 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11540 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11541 if test "x$with_java" != "xno"; then
11542     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11543     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11546 AC_MSG_CHECKING([whether to build opens___.ttf])
11547 if test "$enable_build_opensymbol" = "yes"; then
11548     AC_MSG_RESULT([yes])
11549     AC_PATH_PROG(FONTFORGE, fontforge)
11550     if test -z "$FONTFORGE"; then
11551         AC_MSG_ERROR([fontforge not installed])
11552     fi
11553 else
11554     AC_MSG_RESULT([no])
11555     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11556     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11558 AC_SUBST(OPENSYMBOL_TTF)
11559 AC_SUBST(FONTFORGE)
11561 dnl ===================================================================
11562 dnl Test whether to include fonts
11563 dnl ===================================================================
11564 AC_MSG_CHECKING([whether to include third-party fonts])
11565 if test "$with_fonts" != "no"; then
11566     AC_MSG_RESULT([yes])
11567     WITH_FONTS=TRUE
11568     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11569     AC_DEFINE(HAVE_MORE_FONTS)
11570 else
11571     AC_MSG_RESULT([no])
11572     WITH_FONTS=
11573     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11575 AC_SUBST(WITH_FONTS)
11578 dnl ===================================================================
11579 dnl Test whether to enable online update service
11580 dnl ===================================================================
11581 AC_MSG_CHECKING([whether to enable online update])
11582 ENABLE_ONLINE_UPDATE=
11583 ENABLE_ONLINE_UPDATE_MAR=
11584 UPDATE_CONFIG=
11585 if test "$enable_online_update" = ""; then
11586     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11587         AC_MSG_RESULT([yes])
11588         ENABLE_ONLINE_UPDATE="TRUE"
11589     else
11590         AC_MSG_RESULT([no])
11591     fi
11592 else
11593     if test "$enable_online_update" = "mar"; then
11594         AC_MSG_RESULT([yes - MAR-based online update])
11595         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11596         if test "$with_update_config" = ""; then
11597             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11598         fi
11599         UPDATE_CONFIG="$with_update_config"
11600         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11601     elif test "$enable_online_update" = "yes"; then
11602         AC_MSG_RESULT([yes])
11603         ENABLE_ONLINE_UPDATE="TRUE"
11604     else
11605         AC_MSG_RESULT([no])
11606     fi
11608 AC_SUBST(ENABLE_ONLINE_UPDATE)
11609 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11610 AC_SUBST(UPDATE_CONFIG)
11612 dnl ===================================================================
11613 dnl Test whether we need bzip2
11614 dnl ===================================================================
11615 SYSTEM_BZIP2=
11616 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11617     AC_MSG_CHECKING([whether to use system bzip2])
11618     if test "$with_system_bzip2" = yes; then
11619         SYSTEM_BZIP2=TRUE
11620         AC_MSG_RESULT([yes])
11621         PKG_CHECK_MODULES(BZIP2, bzip2)
11622         FilterLibs "${BZIP2_LIBS}"
11623         BZIP2_LIBS="${filteredlibs}"
11624     else
11625         AC_MSG_RESULT([no])
11626         BUILD_TYPE="$BUILD_TYPE BZIP2"
11627     fi
11629 AC_SUBST(SYSTEM_BZIP2)
11630 AC_SUBST(BZIP2_CFLAGS)
11631 AC_SUBST(BZIP2_LIBS)
11633 dnl ===================================================================
11634 dnl Test whether to enable extension update
11635 dnl ===================================================================
11636 AC_MSG_CHECKING([whether to enable extension update])
11637 ENABLE_EXTENSION_UPDATE=
11638 if test "x$enable_extension_update" = "xno"; then
11639     AC_MSG_RESULT([no])
11640 else
11641     AC_MSG_RESULT([yes])
11642     ENABLE_EXTENSION_UPDATE="TRUE"
11643     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11644     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11646 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11649 dnl ===================================================================
11650 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11651 dnl ===================================================================
11652 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11653 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11654     AC_MSG_RESULT([no])
11655     ENABLE_SILENT_MSI=
11656 else
11657     AC_MSG_RESULT([yes])
11658     ENABLE_SILENT_MSI=TRUE
11659     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11661 AC_SUBST(ENABLE_SILENT_MSI)
11663 AC_MSG_CHECKING([whether and how to use Xinerama])
11664 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11665     if test "$x_libraries" = "default_x_libraries"; then
11666         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11667         if test "x$XINERAMALIB" = x; then
11668            XINERAMALIB="/usr/lib"
11669         fi
11670     else
11671         XINERAMALIB="$x_libraries"
11672     fi
11673     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11674         # we have both versions, let the user decide but use the dynamic one
11675         # per default
11676         USE_XINERAMA=TRUE
11677         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11678             XINERAMA_LINK=dynamic
11679         else
11680             XINERAMA_LINK=static
11681         fi
11682     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11683         # we have only the dynamic version
11684         USE_XINERAMA=TRUE
11685         XINERAMA_LINK=dynamic
11686     elif test -e "$XINERAMALIB/libXinerama.a"; then
11687         # static version
11688         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11689             USE_XINERAMA=TRUE
11690             XINERAMA_LINK=static
11691         else
11692             USE_XINERAMA=
11693             XINERAMA_LINK=none
11694         fi
11695     else
11696         # no Xinerama
11697         USE_XINERAMA=
11698         XINERAMA_LINK=none
11699     fi
11700     if test "$USE_XINERAMA" = "TRUE"; then
11701         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11702         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11703             [AC_MSG_ERROR(Xinerama header not found.)], [])
11704         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11705         if test "x$XEXTLIB" = x; then
11706            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11707         fi
11708         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11709         if test "$_os" = "FreeBSD"; then
11710             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11711         fi
11712         if test "$_os" = "Linux"; then
11713             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11714         fi
11715         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11716             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11717     else
11718         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11719     fi
11720 else
11721     USE_XINERAMA=
11722     XINERAMA_LINK=none
11723     AC_MSG_RESULT([no])
11725 AC_SUBST(USE_XINERAMA)
11726 AC_SUBST(XINERAMA_LINK)
11728 dnl ===================================================================
11729 dnl Test whether to build cairo or rely on the system version
11730 dnl ===================================================================
11732 if test "$USING_X11" = TRUE; then
11733     # Used in vcl/Library_vclplug_gen.mk
11734     test_cairo=yes
11737 if test "$test_cairo" = "yes"; then
11738     AC_MSG_CHECKING([whether to use the system cairo])
11740     : ${with_system_cairo:=$with_system_libs}
11741     if test "$with_system_cairo" = "yes"; then
11742         SYSTEM_CAIRO=TRUE
11743         AC_MSG_RESULT([yes])
11745         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11746         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11747         FilterLibs "${CAIRO_LIBS}"
11748         CAIRO_LIBS="${filteredlibs}"
11750         if test "$test_xrender" = "yes"; then
11751             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11752             AC_LANG_PUSH([C])
11753             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11754 #ifdef PictStandardA8
11755 #else
11756       return fail;
11757 #endif
11758 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11760             AC_LANG_POP([C])
11761         fi
11762     else
11763         SYSTEM_CAIRO=
11764         AC_MSG_RESULT([no])
11766         BUILD_TYPE="$BUILD_TYPE CAIRO"
11767     fi
11770 AC_SUBST(SYSTEM_CAIRO)
11771 AC_SUBST(CAIRO_CFLAGS)
11772 AC_SUBST(CAIRO_LIBS)
11774 dnl ===================================================================
11775 dnl Test whether to use avahi
11776 dnl ===================================================================
11777 if test "$_os" = "WINNT"; then
11778     # Windows uses bundled mDNSResponder
11779     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11780 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11781     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11782                       [ENABLE_AVAHI="TRUE"])
11783     AC_DEFINE(HAVE_FEATURE_AVAHI)
11784     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11785     FilterLibs "${AVAHI_LIBS}"
11786     AVAHI_LIBS="${filteredlibs}"
11789 AC_SUBST(ENABLE_AVAHI)
11790 AC_SUBST(AVAHI_CFLAGS)
11791 AC_SUBST(AVAHI_LIBS)
11793 dnl ===================================================================
11794 dnl Test whether to use liblangtag
11795 dnl ===================================================================
11796 SYSTEM_LIBLANGTAG=
11797 AC_MSG_CHECKING([whether to use system liblangtag])
11798 if test "$with_system_liblangtag" = yes; then
11799     SYSTEM_LIBLANGTAG=TRUE
11800     AC_MSG_RESULT([yes])
11801     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11802     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11803     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11804     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11805     FilterLibs "${LIBLANGTAG_LIBS}"
11806     LIBLANGTAG_LIBS="${filteredlibs}"
11807 else
11808     SYSTEM_LIBLANGTAG=
11809     AC_MSG_RESULT([no])
11810     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11811     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11812     if test "$COM" = "MSC"; then
11813         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11814     else
11815         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11816     fi
11818 AC_SUBST(SYSTEM_LIBLANGTAG)
11819 AC_SUBST(LIBLANGTAG_CFLAGS)
11820 AC_SUBST(LIBLANGTAG_LIBS)
11822 dnl ===================================================================
11823 dnl Test whether to build libpng or rely on the system version
11824 dnl ===================================================================
11826 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11828 dnl ===================================================================
11829 dnl Check for runtime JVM search path
11830 dnl ===================================================================
11831 if test "$ENABLE_JAVA" != ""; then
11832     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11833     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11834         AC_MSG_RESULT([yes])
11835         if ! test -d "$with_jvm_path"; then
11836             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11837         fi
11838         if ! test -d "$with_jvm_path"jvm; then
11839             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11840         fi
11841         JVM_ONE_PATH_CHECK="$with_jvm_path"
11842         AC_SUBST(JVM_ONE_PATH_CHECK)
11843     else
11844         AC_MSG_RESULT([no])
11845     fi
11848 dnl ===================================================================
11849 dnl Test for the presence of Ant and that it works
11850 dnl ===================================================================
11852 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11853     ANT_HOME=; export ANT_HOME
11854     WITH_ANT_HOME=; export WITH_ANT_HOME
11855     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11856         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11857             if test "$_os" = "WINNT"; then
11858                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11859             else
11860                 with_ant_home="$LODE_HOME/opt/ant"
11861             fi
11862         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11863             with_ant_home="$LODE_HOME/opt/ant"
11864         fi
11865     fi
11866     if test -z "$with_ant_home"; then
11867         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11868     else
11869         if test "$_os" = "WINNT"; then
11870             # AC_PATH_PROGS needs unix path
11871             with_ant_home=`cygpath -u "$with_ant_home"`
11872         fi
11873         AbsolutePath "$with_ant_home"
11874         with_ant_home=$absolute_path
11875         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11876         WITH_ANT_HOME=$with_ant_home
11877         ANT_HOME=$with_ant_home
11878     fi
11880     if test -z "$ANT"; then
11881         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11882     else
11883         # resolve relative or absolute symlink
11884         while test -h "$ANT"; do
11885             a_cwd=`pwd`
11886             a_basename=`basename "$ANT"`
11887             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11888             cd "`dirname "$ANT"`"
11889             cd "`dirname "$a_script"`"
11890             ANT="`pwd`"/"`basename "$a_script"`"
11891             cd "$a_cwd"
11892         done
11894         AC_MSG_CHECKING([if $ANT works])
11895         mkdir -p conftest.dir
11896         a_cwd=$(pwd)
11897         cd conftest.dir
11898         cat > conftest.java << EOF
11899         public class conftest {
11900             int testmethod(int a, int b) {
11901                     return a + b;
11902             }
11903         }
11906         cat > conftest.xml << EOF
11907         <project name="conftest" default="conftest">
11908         <target name="conftest">
11909             <javac srcdir="." includes="conftest.java">
11910             </javac>
11911         </target>
11912         </project>
11915         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11916         if test $? = 0 -a -f ./conftest.class; then
11917             AC_MSG_RESULT([Ant works])
11918             if test -z "$WITH_ANT_HOME"; then
11919                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11920                 if test -z "$ANT_HOME"; then
11921                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11922                 fi
11923             else
11924                 ANT_HOME="$WITH_ANT_HOME"
11925             fi
11926         else
11927             echo "configure: Ant test failed" >&5
11928             cat conftest.java >&5
11929             cat conftest.xml >&5
11930             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11931         fi
11932         cd "$a_cwd"
11933         rm -fr conftest.dir
11934     fi
11935     if test -z "$ANT_HOME"; then
11936         ANT_HOME="NO_ANT_HOME"
11937     else
11938         PathFormat "$ANT_HOME"
11939         ANT_HOME="$formatted_path"
11940         PathFormat "$ANT"
11941         ANT="$formatted_path"
11942     fi
11943     AC_SUBST(ANT_HOME)
11944     AC_SUBST(ANT)
11946     dnl Checking for ant.jar
11947     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11948         AC_MSG_CHECKING([Ant lib directory])
11949         if test -f $ANT_HOME/lib/ant.jar; then
11950             ANT_LIB="$ANT_HOME/lib"
11951         else
11952             if test -f $ANT_HOME/ant.jar; then
11953                 ANT_LIB="$ANT_HOME"
11954             else
11955                 if test -f /usr/share/java/ant.jar; then
11956                     ANT_LIB=/usr/share/java
11957                 else
11958                     if test -f /usr/share/ant-core/lib/ant.jar; then
11959                         ANT_LIB=/usr/share/ant-core/lib
11960                     else
11961                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11962                             ANT_LIB="$ANT_HOME/lib/ant"
11963                         else
11964                             if test -f /usr/share/lib/ant/ant.jar; then
11965                                 ANT_LIB=/usr/share/lib/ant
11966                             else
11967                                 AC_MSG_ERROR([Ant libraries not found!])
11968                             fi
11969                         fi
11970                     fi
11971                 fi
11972             fi
11973         fi
11974         PathFormat "$ANT_LIB"
11975         ANT_LIB="$formatted_path"
11976         AC_MSG_RESULT([Ant lib directory found.])
11977     fi
11978     AC_SUBST(ANT_LIB)
11980     ant_minver=1.6.0
11981     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11983     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11984     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11985     ant_version_major=`echo $ant_version | cut -d. -f1`
11986     ant_version_minor=`echo $ant_version | cut -d. -f2`
11987     echo "configure: ant_version $ant_version " >&5
11988     echo "configure: ant_version_major $ant_version_major " >&5
11989     echo "configure: ant_version_minor $ant_version_minor " >&5
11990     if test "$ant_version_major" -ge "2"; then
11991         AC_MSG_RESULT([yes, $ant_version])
11992     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11993         AC_MSG_RESULT([yes, $ant_version])
11994     else
11995         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11996     fi
11998     rm -f conftest* core core.* *.core
12001 OOO_JUNIT_JAR=
12002 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12003     AC_MSG_CHECKING([for JUnit 4])
12004     if test "$with_junit" = "yes"; then
12005         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12006             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12007         elif test -e /usr/share/java/junit4.jar; then
12008             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12009         else
12010            if test -e /usr/share/lib/java/junit.jar; then
12011               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12012            else
12013               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12014            fi
12015         fi
12016     else
12017         OOO_JUNIT_JAR=$with_junit
12018     fi
12019     if test "$_os" = "WINNT"; then
12020         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12021     fi
12022     printf 'import org.junit.Before;' > conftest.java
12023     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12024         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12025     else
12026         AC_MSG_ERROR(
12027 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12028  specify its pathname via --with-junit=..., or disable it via --without-junit])
12029     fi
12030     rm -f conftest.class conftest.java
12031     if test $OOO_JUNIT_JAR != ""; then
12032     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12033     fi
12035 AC_SUBST(OOO_JUNIT_JAR)
12037 HAMCREST_JAR=
12038 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12039     AC_MSG_CHECKING([for included Hamcrest])
12040     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12041     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12042         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12043     else
12044         AC_MSG_RESULT([Not included])
12045         AC_MSG_CHECKING([for standalone hamcrest jar.])
12046         if test "$with_hamcrest" = "yes"; then
12047             if test -e /usr/share/lib/java/hamcrest.jar; then
12048                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12049             elif test -e /usr/share/java/hamcrest/core.jar; then
12050                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12051             else
12052                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12053             fi
12054         else
12055             HAMCREST_JAR=$with_hamcrest
12056         fi
12057         if test "$_os" = "WINNT"; then
12058             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12059         fi
12060         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12061             AC_MSG_RESULT([$HAMCREST_JAR])
12062         else
12063             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),
12064                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12065         fi
12066     fi
12067     rm -f conftest.class conftest.java
12069 AC_SUBST(HAMCREST_JAR)
12072 AC_SUBST(SCPDEFS)
12075 # check for wget and curl
12077 WGET=
12078 CURL=
12080 if test "$enable_fetch_external" != "no"; then
12082 CURL=`which curl 2>/dev/null`
12084 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12085     # wget new enough?
12086     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12087     if test $? -eq 0; then
12088         WGET=$i
12089         break
12090     fi
12091 done
12093 if test -z "$WGET" -a -z "$CURL"; then
12094     AC_MSG_ERROR([neither wget nor curl found!])
12099 AC_SUBST(WGET)
12100 AC_SUBST(CURL)
12103 # check for sha256sum
12105 SHA256SUM=
12107 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12108     eval "$i -a 256 --version" > /dev/null 2>&1
12109     ret=$?
12110     if test $ret -eq 0; then
12111         SHA256SUM="$i -a 256"
12112         break
12113     fi
12114 done
12116 if test -z "$SHA256SUM"; then
12117     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12118         eval "$i --version" > /dev/null 2>&1
12119         ret=$?
12120         if test $ret -eq 0; then
12121             SHA256SUM=$i
12122             break
12123         fi
12124     done
12127 if test -z "$SHA256SUM"; then
12128     AC_MSG_ERROR([no sha256sum found!])
12131 AC_SUBST(SHA256SUM)
12133 dnl ===================================================================
12134 dnl Dealing with l10n options
12135 dnl ===================================================================
12136 AC_MSG_CHECKING([which languages to be built])
12137 # get list of all languages
12138 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12139 # the sed command does the following:
12140 #   + if a line ends with a backslash, append the next line to it
12141 #   + adds " on the beginning of the value (after =)
12142 #   + adds " at the end of the value
12143 #   + removes en-US; we want to put it on the beginning
12144 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12145 [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)]
12146 ALL_LANGS="en-US $completelangiso"
12147 # check the configured localizations
12148 WITH_LANG="$with_lang"
12150 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12151 # (Norwegian is "nb" and "nn".)
12152 if test "$WITH_LANG" = "no"; then
12153     WITH_LANG=
12156 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12157     AC_MSG_RESULT([en-US])
12158 else
12159     AC_MSG_RESULT([$WITH_LANG])
12160     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12161     if test -z "$MSGFMT"; then
12162         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12163             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12164         elif test -x "/opt/lo/bin/msgfmt"; then
12165             MSGFMT="/opt/lo/bin/msgfmt"
12166         else
12167             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12168             if test -z "$MSGFMT"; then
12169                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12170             fi
12171         fi
12172     fi
12173     if test -z "$MSGUNIQ"; then
12174         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12175             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12176         elif test -x "/opt/lo/bin/msguniq"; then
12177             MSGUNIQ="/opt/lo/bin/msguniq"
12178         else
12179             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12180             if test -z "$MSGUNIQ"; then
12181                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12182             fi
12183         fi
12184     fi
12186 AC_SUBST(MSGFMT)
12187 AC_SUBST(MSGUNIQ)
12188 # check that the list is valid
12189 for lang in $WITH_LANG; do
12190     test "$lang" = "ALL" && continue
12191     # need to check for the exact string, so add space before and after the list of all languages
12192     for vl in $ALL_LANGS; do
12193         if test "$vl" = "$lang"; then
12194            break
12195         fi
12196     done
12197     if test "$vl" != "$lang"; then
12198         # if you're reading this - you prolly quoted your languages remove the quotes ...
12199         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12200     fi
12201 done
12202 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12203     echo $WITH_LANG | grep -q en-US
12204     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12206 # list with substituted ALL
12207 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12208 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12209 test "$WITH_LANG" = "en-US" && WITH_LANG=
12210 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12211     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12212     ALL_LANGS=`echo $ALL_LANGS qtz`
12214 AC_SUBST(ALL_LANGS)
12215 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12216 AC_SUBST(WITH_LANG)
12217 AC_SUBST(WITH_LANG_LIST)
12218 AC_SUBST(GIT_NEEDED_SUBMODULES)
12220 WITH_POOR_HELP_LOCALIZATIONS=
12221 if test -d "$SRC_ROOT/translations/source"; then
12222     for l in `ls -1 $SRC_ROOT/translations/source`; do
12223         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12224             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12225         fi
12226     done
12228 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12230 if test -n "$with_locales"; then
12231     WITH_LOCALES="$with_locales"
12233     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12234     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12235     # config_host/config_locales.h.in
12236     for locale in $WITH_LOCALES; do
12237         lang=${locale%_*}
12239         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12241         case $lang in
12242         hi|mr*ne)
12243             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12244             ;;
12245         bg|ru)
12246             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12247             ;;
12248         esac
12249     done
12250 else
12251     AC_DEFINE(WITH_LOCALE_ALL)
12253 AC_SUBST(WITH_LOCALES)
12255 dnl git submodule update --reference
12256 dnl ===================================================================
12257 if test -n "${GIT_REFERENCE_SRC}"; then
12258     for repo in ${GIT_NEEDED_SUBMODULES}; do
12259         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12260             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12261         fi
12262     done
12264 AC_SUBST(GIT_REFERENCE_SRC)
12266 dnl git submodules linked dirs
12267 dnl ===================================================================
12268 if test -n "${GIT_LINK_SRC}"; then
12269     for repo in ${GIT_NEEDED_SUBMODULES}; do
12270         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12271             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12272         fi
12273     done
12275 AC_SUBST(GIT_LINK_SRC)
12277 dnl branding
12278 dnl ===================================================================
12279 AC_MSG_CHECKING([for alternative branding images directory])
12280 # initialize mapped arrays
12281 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12282 brand_files="$BRAND_INTRO_IMAGES about.svg"
12284 if test -z "$with_branding" -o "$with_branding" = "no"; then
12285     AC_MSG_RESULT([none])
12286     DEFAULT_BRAND_IMAGES="$brand_files"
12287 else
12288     if ! test -d $with_branding ; then
12289         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12290     else
12291         AC_MSG_RESULT([$with_branding])
12292         CUSTOM_BRAND_DIR="$with_branding"
12293         for lfile in $brand_files
12294         do
12295             if ! test -f $with_branding/$lfile ; then
12296                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12297                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12298             else
12299                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12300             fi
12301         done
12302         check_for_progress="yes"
12303     fi
12305 AC_SUBST([BRAND_INTRO_IMAGES])
12306 AC_SUBST([CUSTOM_BRAND_DIR])
12307 AC_SUBST([CUSTOM_BRAND_IMAGES])
12308 AC_SUBST([DEFAULT_BRAND_IMAGES])
12311 AC_MSG_CHECKING([for 'intro' progress settings])
12312 PROGRESSBARCOLOR=
12313 PROGRESSSIZE=
12314 PROGRESSPOSITION=
12315 PROGRESSFRAMECOLOR=
12316 PROGRESSTEXTCOLOR=
12317 PROGRESSTEXTBASELINE=
12319 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12320     source "$with_branding/progress.conf"
12321     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12322 else
12323     AC_MSG_RESULT([none])
12326 AC_SUBST(PROGRESSBARCOLOR)
12327 AC_SUBST(PROGRESSSIZE)
12328 AC_SUBST(PROGRESSPOSITION)
12329 AC_SUBST(PROGRESSFRAMECOLOR)
12330 AC_SUBST(PROGRESSTEXTCOLOR)
12331 AC_SUBST(PROGRESSTEXTBASELINE)
12334 AC_MSG_CHECKING([for extra build ID])
12335 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12336     EXTRA_BUILDID="$with_extra_buildid"
12338 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12339 if test -n "$EXTRA_BUILDID" ; then
12340     AC_MSG_RESULT([$EXTRA_BUILDID])
12341 else
12342     AC_MSG_RESULT([not set])
12344 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12346 OOO_VENDOR=
12347 AC_MSG_CHECKING([for vendor])
12348 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12349     OOO_VENDOR="$USERNAME"
12351     if test -z "$OOO_VENDOR"; then
12352         OOO_VENDOR="$USER"
12353     fi
12355     if test -z "$OOO_VENDOR"; then
12356         OOO_VENDOR="`id -u -n`"
12357     fi
12359     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12360 else
12361     OOO_VENDOR="$with_vendor"
12362     AC_MSG_RESULT([$OOO_VENDOR])
12364 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12365 AC_SUBST(OOO_VENDOR)
12367 if test "$_os" = "Android" ; then
12368     ANDROID_PACKAGE_NAME=
12369     AC_MSG_CHECKING([for Android package name])
12370     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12371         if test -n "$ENABLE_DEBUG"; then
12372             # Default to the package name that makes ndk-gdb happy.
12373             ANDROID_PACKAGE_NAME="org.libreoffice"
12374         else
12375             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12376         fi
12378         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12379     else
12380         ANDROID_PACKAGE_NAME="$with_android_package_name"
12381         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12382     fi
12383     AC_SUBST(ANDROID_PACKAGE_NAME)
12386 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12387 if test "$with_compat_oowrappers" = "yes"; then
12388     WITH_COMPAT_OOWRAPPERS=TRUE
12389     AC_MSG_RESULT(yes)
12390 else
12391     WITH_COMPAT_OOWRAPPERS=
12392     AC_MSG_RESULT(no)
12394 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12396 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12397 AC_MSG_CHECKING([for install dirname])
12398 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12399     INSTALLDIRNAME="$with_install_dirname"
12401 AC_MSG_RESULT([$INSTALLDIRNAME])
12402 AC_SUBST(INSTALLDIRNAME)
12404 AC_MSG_CHECKING([for prefix])
12405 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12406 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12407 PREFIXDIR="$prefix"
12408 AC_MSG_RESULT([$PREFIXDIR])
12409 AC_SUBST(PREFIXDIR)
12411 LIBDIR=[$(eval echo $(eval echo $libdir))]
12412 AC_SUBST(LIBDIR)
12414 DATADIR=[$(eval echo $(eval echo $datadir))]
12415 AC_SUBST(DATADIR)
12417 MANDIR=[$(eval echo $(eval echo $mandir))]
12418 AC_SUBST(MANDIR)
12420 DOCDIR=[$(eval echo $(eval echo $docdir))]
12421 AC_SUBST(DOCDIR)
12423 BINDIR=[$(eval echo $(eval echo $bindir))]
12424 AC_SUBST(BINDIR)
12426 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12427 AC_SUBST(INSTALLDIR)
12429 TESTINSTALLDIR="${BUILDDIR}/test-install"
12430 AC_SUBST(TESTINSTALLDIR)
12433 # ===================================================================
12434 # OAuth2 id and secrets
12435 # ===================================================================
12437 AC_MSG_CHECKING([for Google Drive client id and secret])
12438 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12439     AC_MSG_RESULT([not set])
12440     GDRIVE_CLIENT_ID="\"\""
12441     GDRIVE_CLIENT_SECRET="\"\""
12442 else
12443     AC_MSG_RESULT([set])
12444     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12445     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12447 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12448 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12450 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12451 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12452     AC_MSG_RESULT([not set])
12453     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12454     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12455 else
12456     AC_MSG_RESULT([set])
12457     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12458     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12460 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12461 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12463 AC_MSG_CHECKING([for OneDrive client id and secret])
12464 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12465     AC_MSG_RESULT([not set])
12466     ONEDRIVE_CLIENT_ID="\"\""
12467     ONEDRIVE_CLIENT_SECRET="\"\""
12468 else
12469     AC_MSG_RESULT([set])
12470     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12471     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12473 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12474 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12477 dnl ===================================================================
12478 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12479 dnl --enable-dependency-tracking configure option
12480 dnl ===================================================================
12481 AC_MSG_CHECKING([whether to enable dependency tracking])
12482 if test "$enable_dependency_tracking" = "no"; then
12483     nodep=TRUE
12484     AC_MSG_RESULT([no])
12485 else
12486     AC_MSG_RESULT([yes])
12488 AC_SUBST(nodep)
12490 dnl ===================================================================
12491 dnl Number of CPUs to use during the build
12492 dnl ===================================================================
12493 AC_MSG_CHECKING([for number of processors to use])
12494 # plain --with-parallelism is just the default
12495 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12496     if test "$with_parallelism" = "no"; then
12497         PARALLELISM=0
12498     else
12499         PARALLELISM=$with_parallelism
12500     fi
12501 else
12502     if test "$enable_icecream" = "yes"; then
12503         PARALLELISM="40"
12504     else
12505         case `uname -s` in
12507         Darwin|FreeBSD|NetBSD|OpenBSD)
12508             PARALLELISM=`sysctl -n hw.ncpu`
12509             ;;
12511         Linux)
12512             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12513         ;;
12514         # what else than above does profit here *and* has /proc?
12515         *)
12516             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12517             ;;
12518         esac
12520         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12521         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12522     fi
12525 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12526     if test -z "$with_parallelism"; then
12527             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12528             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12529             PARALLELISM="1"
12530     else
12531         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."
12532     fi
12535 if test $PARALLELISM -eq 0; then
12536     AC_MSG_RESULT([explicit make -j option needed])
12537 else
12538     AC_MSG_RESULT([$PARALLELISM])
12540 AC_SUBST(PARALLELISM)
12542 IWYU_PATH="$with_iwyu"
12543 AC_SUBST(IWYU_PATH)
12544 if test ! -z "$IWYU_PATH"; then
12545     if test ! -f "$IWYU_PATH"; then
12546         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12547     fi
12551 # Set up ILIB for MSVC build
12553 ILIB1=
12554 if test "$build_os" = "cygwin"; then
12555     ILIB="."
12556     if test -n "$JAVA_HOME"; then
12557         ILIB="$ILIB;$JAVA_HOME/lib"
12558     fi
12559     ILIB1=-link
12560     if test "$BITNESS_OVERRIDE" = 64; then
12561         ILIB="$ILIB;$COMPATH/lib/x64"
12562         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12563         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12564         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12565         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12566             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12567             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12568         fi
12569         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12570         ucrtlibpath_formatted=$formatted_path
12571         ILIB="$ILIB;$ucrtlibpath_formatted"
12572         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12573     else
12574         ILIB="$ILIB;$COMPATH/lib/x86"
12575         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12576         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12577         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12578         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12579             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12580             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12581         fi
12582         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12583         ucrtlibpath_formatted=$formatted_path
12584         ILIB="$ILIB;$ucrtlibpath_formatted"
12585         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12586     fi
12587     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12588         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12589     else
12590         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12591     fi
12593     AC_SUBST(ILIB)
12596 # ===================================================================
12597 # Creating bigger shared library to link against
12598 # ===================================================================
12599 AC_MSG_CHECKING([whether to create huge library])
12600 MERGELIBS=
12602 if test $_os = iOS -o $_os = Android; then
12603     # Never any point in mergelibs for these as we build just static
12604     # libraries anyway...
12605     enable_mergelibs=no
12608 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12609     if test $_os != Linux -a $_os != WINNT; then
12610         add_warning "--enable-mergelibs is not tested for this platform"
12611     fi
12612     MERGELIBS="TRUE"
12613     AC_MSG_RESULT([yes])
12614 else
12615     AC_MSG_RESULT([no])
12617 AC_SUBST([MERGELIBS])
12619 dnl ===================================================================
12620 dnl icerun is a wrapper that stops us spawning tens of processes
12621 dnl locally - for tools that can't be executed on the compile cluster
12622 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12623 dnl ===================================================================
12624 AC_MSG_CHECKING([whether to use icerun wrapper])
12625 ICECREAM_RUN=
12626 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12627     ICECREAM_RUN=icerun
12628     AC_MSG_RESULT([yes])
12629 else
12630     AC_MSG_RESULT([no])
12632 AC_SUBST(ICECREAM_RUN)
12634 dnl ===================================================================
12635 dnl Setup the ICECC_VERSION for the build the same way it was set for
12636 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12637 dnl ===================================================================
12638 x_ICECC_VERSION=[\#]
12639 if test -n "$ICECC_VERSION" ; then
12640     x_ICECC_VERSION=
12642 AC_SUBST(x_ICECC_VERSION)
12643 AC_SUBST(ICECC_VERSION)
12645 dnl ===================================================================
12647 AC_MSG_CHECKING([MPL subset])
12648 MPL_SUBSET=
12650 if test "$enable_mpl_subset" = "yes"; then
12651     warn_report=false
12652     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12653         warn_report=true
12654     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12655         warn_report=true
12656     fi
12657     if test "$warn_report" = "true"; then
12658         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12659     fi
12660     if test "x$enable_postgresql_sdbc" != "xno"; then
12661         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12662     fi
12663     if test "$enable_lotuswordpro" = "yes"; then
12664         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12665     fi
12666     if test "$WITH_WEBDAV" = "neon"; then
12667         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12668     fi
12669     if test -n "$ENABLE_POPPLER"; then
12670         if test "x$SYSTEM_POPPLER" = "x"; then
12671             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12672         fi
12673     fi
12674     # cf. m4/libo_check_extension.m4
12675     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12676         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12677     fi
12678     for theme in $WITH_THEMES; do
12679         case $theme in
12680         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12681             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12682         *) : ;;
12683         esac
12684     done
12686     ENABLE_OPENGL_TRANSITIONS=
12688     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12689         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12690     fi
12692     MPL_SUBSET="TRUE"
12693     AC_DEFINE(MPL_HAVE_SUBSET)
12694     AC_MSG_RESULT([only])
12695 else
12696     AC_MSG_RESULT([no restrictions])
12698 AC_SUBST(MPL_SUBSET)
12700 dnl ===================================================================
12702 AC_MSG_CHECKING([formula logger])
12703 ENABLE_FORMULA_LOGGER=
12705 if test "x$enable_formula_logger" = "xyes"; then
12706     AC_MSG_RESULT([yes])
12707     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12708     ENABLE_FORMULA_LOGGER=TRUE
12709 elif test -n "$ENABLE_DBGUTIL" ; then
12710     AC_MSG_RESULT([yes])
12711     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12712     ENABLE_FORMULA_LOGGER=TRUE
12713 else
12714     AC_MSG_RESULT([no])
12717 AC_SUBST(ENABLE_FORMULA_LOGGER)
12719 dnl ===================================================================
12720 dnl Setting up the environment.
12721 dnl ===================================================================
12722 AC_MSG_NOTICE([setting up the build environment variables...])
12724 AC_SUBST(COMPATH)
12726 if test "$build_os" = "cygwin"; then
12727     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12728         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12729         ATL_INCLUDE="$COMPATH/atlmfc/include"
12730     elif test -d "$COMPATH/atlmfc/lib"; then
12731         ATL_LIB="$COMPATH/atlmfc/lib"
12732         ATL_INCLUDE="$COMPATH/atlmfc/include"
12733     else
12734         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12735         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12736     fi
12737     if test "$BITNESS_OVERRIDE" = 64; then
12738         ATL_LIB="$ATL_LIB/x64"
12739     else
12740         ATL_LIB="$ATL_LIB/x86"
12741     fi
12742     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12743     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12745     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12746     PathFormat "/usr/bin/find.exe"
12747     FIND="$formatted_path"
12748     PathFormat "/usr/bin/sort.exe"
12749     SORT="$formatted_path"
12750     PathFormat "/usr/bin/grep.exe"
12751     WIN_GREP="$formatted_path"
12752     PathFormat "/usr/bin/ls.exe"
12753     WIN_LS="$formatted_path"
12754     PathFormat "/usr/bin/touch.exe"
12755     WIN_TOUCH="$formatted_path"
12756 else
12757     FIND=find
12758     SORT=sort
12761 AC_SUBST(ATL_INCLUDE)
12762 AC_SUBST(ATL_LIB)
12763 AC_SUBST(FIND)
12764 AC_SUBST(SORT)
12765 AC_SUBST(WIN_GREP)
12766 AC_SUBST(WIN_LS)
12767 AC_SUBST(WIN_TOUCH)
12769 AC_SUBST(BUILD_TYPE)
12771 AC_SUBST(SOLARINC)
12773 PathFormat "$PERL"
12774 PERL="$formatted_path"
12775 AC_SUBST(PERL)
12777 if test -n "$TMPDIR"; then
12778     TEMP_DIRECTORY="$TMPDIR"
12779 else
12780     TEMP_DIRECTORY="/tmp"
12782 if test "$build_os" = "cygwin"; then
12783     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12785 AC_SUBST(TEMP_DIRECTORY)
12787 # setup the PATH for the environment
12788 if test -n "$LO_PATH_FOR_BUILD"; then
12789     LO_PATH="$LO_PATH_FOR_BUILD"
12790 else
12791     LO_PATH="$PATH"
12793     case "$host_os" in
12795     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12796         if test "$ENABLE_JAVA" != ""; then
12797             pathmunge "$JAVA_HOME/bin" "after"
12798         fi
12799         ;;
12801     cygwin*)
12802         # Win32 make needs native paths
12803         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12804             LO_PATH=`cygpath -p -m "$PATH"`
12805         fi
12806         if test "$BITNESS_OVERRIDE" = 64; then
12807             # needed for msi packaging
12808             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12809         fi
12810         # .NET 4.6 and higher don't have bin directory
12811         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12812             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12813         fi
12814         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12815         pathmunge "$CSC_PATH" "before"
12816         pathmunge "$MIDL_PATH" "before"
12817         pathmunge "$AL_PATH" "before"
12818         pathmunge "$MSPDB_PATH" "before"
12819         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12820             pathmunge "$CL_PATH" "before"
12821         fi
12822         if test -n "$MSBUILD_PATH" ; then
12823             pathmunge "$MSBUILD_PATH" "before"
12824         fi
12825         if test "$BITNESS_OVERRIDE" = 64; then
12826             pathmunge "$COMPATH/bin/amd64" "before"
12827             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12828         else
12829             pathmunge "$COMPATH/bin" "before"
12830             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12831         fi
12832         if test "$ENABLE_JAVA" != ""; then
12833             if test -d "$JAVA_HOME/jre/bin/client"; then
12834                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12835             fi
12836             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12837                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12838             fi
12839             pathmunge "$JAVA_HOME/bin" "before"
12840         fi
12841         ;;
12843     solaris*)
12844         pathmunge "/usr/css/bin" "before"
12845         if test "$ENABLE_JAVA" != ""; then
12846             pathmunge "$JAVA_HOME/bin" "after"
12847         fi
12848         ;;
12849     esac
12852 AC_SUBST(LO_PATH)
12854 libo_FUZZ_SUMMARY
12856 # Generate a configuration sha256 we can use for deps
12857 if test -f config_host.mk; then
12858     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12860 if test -f config_host_lang.mk; then
12861     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12864 CFLAGS=$my_original_CFLAGS
12865 CXXFLAGS=$my_original_CXXFLAGS
12866 CPPFLAGS=$my_original_CPPFLAGS
12868 AC_CONFIG_FILES([config_host.mk
12869                  config_host_lang.mk
12870                  Makefile
12871                  bin/bffvalidator.sh
12872                  bin/odfvalidator.sh
12873                  bin/officeotron.sh
12874                  instsetoo_native/util/openoffice.lst
12875                  sysui/desktop/macosx/Info.plist])
12876 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12877 AC_CONFIG_HEADERS([config_host/config_clang.h])
12878 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12879 AC_CONFIG_HEADERS([config_host/config_eot.h])
12880 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12881 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12882 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12883 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12884 AC_CONFIG_HEADERS([config_host/config_features.h])
12885 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12886 AC_CONFIG_HEADERS([config_host/config_folders.h])
12887 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12888 AC_CONFIG_HEADERS([config_host/config_gio.h])
12889 AC_CONFIG_HEADERS([config_host/config_global.h])
12890 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12891 AC_CONFIG_HEADERS([config_host/config_java.h])
12892 AC_CONFIG_HEADERS([config_host/config_langs.h])
12893 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12894 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12895 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12896 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12897 AC_CONFIG_HEADERS([config_host/config_locales.h])
12898 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12899 AC_CONFIG_HEADERS([config_host/config_oox.h])
12900 AC_CONFIG_HEADERS([config_host/config_options.h])
12901 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12902 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12903 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12904 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12905 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12906 AC_CONFIG_HEADERS([config_host/config_version.h])
12907 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12908 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12909 AC_CONFIG_HEADERS([config_host/config_python.h])
12910 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12911 AC_OUTPUT
12913 if test "$CROSS_COMPILING" = TRUE; then
12914     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12917 # touch the config timestamp file
12918 if test ! -f config_host.mk.stamp; then
12919     echo > config_host.mk.stamp
12920 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12921     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12922 else
12923     echo > config_host.mk.stamp
12926 # touch the config lang timestamp file
12927 if test ! -f config_host_lang.mk.stamp; then
12928     echo > config_host_lang.mk.stamp
12929 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12930     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12931 else
12932     echo > config_host_lang.mk.stamp
12936 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12937         -a "$build_os" = "cygwin"; then
12939 cat << _EOS
12940 ****************************************************************************
12941 WARNING:
12942 Your make version is known to be horribly slow, and hard to debug
12943 problems with. To get a reasonably functional make please do:
12945 to install a pre-compiled binary make for Win32
12947  mkdir -p /opt/lo/bin
12948  cd /opt/lo/bin
12949  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12950  cp make-4.2.1-msvc.exe make
12951  chmod +x make
12953 to install from source:
12954 place yourself in a working directory of you choice.
12956  git clone git://git.savannah.gnu.org/make.git
12958  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12959  set PATH=%PATH%;C:\Cygwin\bin
12960  [or Cygwin64, if that is what you have]
12961  cd path-to-make-repo-you-cloned-above
12962  build_w32.bat --without-guile
12964 should result in a WinRel/gnumake.exe.
12965 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12967 Then re-run autogen.sh
12969 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12970 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12972 _EOS
12973 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12974     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12979 cat << _EOF
12980 ****************************************************************************
12982 To build, run:
12983 $GNUMAKE
12985 To view some help, run:
12986 $GNUMAKE help
12988 _EOF
12990 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12991     cat << _EOF
12992 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12993 _EOF
12995     if test $_os = Darwin; then
12996         echo open instdir/$PRODUCTNAME.app
12997     else
12998         echo instdir/program/soffice
12999     fi
13000     cat << _EOF
13002 If you want to run the smoketest, run:
13003 $GNUMAKE check
13005 _EOF
13008 if test -f warn; then
13009     cat warn
13010     rm warn
13013 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: