tdf#134183 PPTX: improve import of transparency in multi-step gradients
[LibreOffice.git] / configure.ac
blob6350e9c6282b690dab170d031334edf730e455e8
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([Collabora Office],[6.4.10.2],[],[],[https://collaboraoffice.com/])
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"
188     PRODUCTNAME=AC_PACKAGE_NAME
190 AC_MSG_RESULT([$PRODUCTNAME])
191 AC_SUBST(PRODUCTNAME)
192 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
193 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
195 dnl ===================================================================
196 dnl Our version is defined by the AC_INIT() at the top of this script.
197 dnl ===================================================================
199 AC_MSG_CHECKING([for package version])
200 if test -n "$with_package_version" -a "$with_package_version" != no; then
201     PACKAGE_VERSION="$with_package_version"
203 AC_MSG_RESULT([$PACKAGE_VERSION])
205 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
207 LIBO_VERSION_MAJOR=$1
208 LIBO_VERSION_MINOR=$2
209 LIBO_VERSION_MICRO=$3
210 LIBO_VERSION_PATCH=$4
212 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
213 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
214 # no way to encode that into an integer in general.
215 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
217 LIBO_VERSION_SUFFIX=$5
218 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
219 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
220 # they get undoubled before actually passed to sed.
221 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
222 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
223 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
224 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
226 AC_SUBST(LIBO_VERSION_MAJOR)
227 AC_SUBST(LIBO_VERSION_MINOR)
228 AC_SUBST(LIBO_VERSION_MICRO)
229 AC_SUBST(LIBO_VERSION_PATCH)
230 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
231 AC_SUBST(LIBO_VERSION_SUFFIX)
232 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
237 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
239 LIBO_THIS_YEAR=`date +%Y`
240 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
242 dnl ===================================================================
243 dnl Product version
244 dnl ===================================================================
245 AC_MSG_CHECKING([for product version])
246 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
247 AC_MSG_RESULT([$PRODUCTVERSION])
248 AC_SUBST(PRODUCTVERSION)
250 AC_PROG_EGREP
251 # AC_PROG_EGREP doesn't set GREP on all systems as well
252 AC_PATH_PROG(GREP, grep)
254 BUILDDIR=`pwd`
255 cd $srcdir
256 SRC_ROOT=`pwd`
257 cd $BUILDDIR
258 x_Cygwin=[\#]
260 dnl ======================================
261 dnl Required GObject introspection version
262 dnl ======================================
263 INTROSPECTION_REQUIRED_VERSION=1.32.0
265 dnl ===================================================================
266 dnl Search all the common names for GNU Make
267 dnl ===================================================================
268 AC_MSG_CHECKING([for GNU Make])
270 # try to use our own make if it is available and GNUMAKE was not already defined
271 if test -z "$GNUMAKE"; then
272     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
273         GNUMAKE="$LODE_HOME/opt/bin/make"
274     elif test -x "/opt/lo/bin/make"; then
275         GNUMAKE="/opt/lo/bin/make"
276     fi
279 GNUMAKE_WIN_NATIVE=
280 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
281     if test -n "$a"; then
282         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
283         if test $? -eq 0;  then
284             if test "$build_os" = "cygwin"; then
285                 if test -n "$($a -v | grep 'Built for Windows')" ; then
286                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
287                     GNUMAKE_WIN_NATIVE="TRUE"
288                 else
289                     GNUMAKE=`which $a`
290                 fi
291             else
292                 GNUMAKE=`which $a`
293             fi
294             break
295         fi
296     fi
297 done
298 AC_MSG_RESULT($GNUMAKE)
299 if test -z "$GNUMAKE"; then
300     AC_MSG_ERROR([not found. install GNU Make.])
301 else
302     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
303         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
304     fi
307 win_short_path_for_make()
309     local_short_path="$1"
310     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
311         cygpath -sm "$local_short_path"
312     else
313         cygpath -u "$(cygpath -d "$local_short_path")"
314     fi
318 if test "$build_os" = "cygwin"; then
319     PathFormat "$SRC_ROOT"
320     SRC_ROOT="$formatted_path"
321     PathFormat "$BUILDDIR"
322     BUILDDIR="$formatted_path"
323     x_Cygwin=
324     AC_MSG_CHECKING(for explicit COMSPEC)
325     if test -z "$COMSPEC"; then
326         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
327     else
328         AC_MSG_RESULT([found: $COMSPEC])
329     fi
332 AC_SUBST(SRC_ROOT)
333 AC_SUBST(BUILDDIR)
334 AC_SUBST(x_Cygwin)
335 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
337 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
339 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
340     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
343 # need sed in os checks...
344 AC_PATH_PROGS(SED, sed)
345 if test -z "$SED"; then
346     AC_MSG_ERROR([install sed to run this script])
349 # Set the ENABLE_LTO variable
350 # ===================================================================
351 AC_MSG_CHECKING([whether to use link-time optimization])
352 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
353     ENABLE_LTO="TRUE"
354     AC_MSG_RESULT([yes])
355     AC_DEFINE(STATIC_LINKING)
356 else
357     ENABLE_LTO=""
358     AC_MSG_RESULT([no])
360 AC_SUBST(ENABLE_LTO)
362 AC_ARG_ENABLE(fuzz-options,
363     AS_HELP_STRING([--enable-fuzz-options],
364         [Randomly enable or disable each of those configurable options
365          that are supposed to be freely selectable without interdependencies,
366          or where bad interaction from interdependencies is automatically avoided.])
369 dnl ===================================================================
370 dnl When building for Android, --with-android-ndk,
371 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
372 dnl mandatory
373 dnl ===================================================================
375 AC_ARG_WITH(android-ndk,
376     AS_HELP_STRING([--with-android-ndk],
377         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
380 AC_ARG_WITH(android-ndk-toolchain-version,
381     AS_HELP_STRING([--with-android-ndk-toolchain-version],
382         [Specify which toolchain version to use, of those present in the
383         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
384         with_android_ndk_toolchain_version=clang5.0)
386 AC_ARG_WITH(android-sdk,
387     AS_HELP_STRING([--with-android-sdk],
388         [Specify location of the Android SDK. Mandatory when building for Android.]),
391 AC_ARG_WITH(android-api-level,
392     AS_HELP_STRING([--with-android-api-level],
393         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
396 ANDROID_NDK_HOME=
397 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
398     with_android_ndk="$SRC_ROOT/external/android-ndk"
400 if test -n "$with_android_ndk"; then
401     eval ANDROID_NDK_HOME=$with_android_ndk
403     # Set up a lot of pre-canned defaults
405     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
406         if test ! -f $ANDROID_NDK_HOME/source.properties; then
407             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
408         fi
409         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
410     else
411         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
412     fi
413     if test -z "$ANDROID_NDK_VERSION";  then
414         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
415     fi
416     case $ANDROID_NDK_VERSION in
417     r9*|r10*)
418         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
419         ;;
420     11.1.*|12.1.*|13.1.*|14.1.*)
421         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
422         ;;
423     16.*|17.*|18.*|19.*|20.*)
424         ;;
425     *)
426         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
427         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
428         ;;
429     esac
431     ANDROID_API_LEVEL=16
432     if test -n "$with_android_api_level" ; then
433         ANDROID_API_LEVEL="$with_android_api_level"
434     fi
436     android_cpu=$host_cpu
437     if test $host_cpu = arm; then
438         android_platform_prefix=arm-linux-androideabi
439         android_gnu_prefix=$android_platform_prefix
440         LLVM_TRIPLE=armv7a-linux-androideabi
441         ANDROID_APP_ABI=armeabi-v7a
442         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
443     elif test $host_cpu = aarch64; then
444         android_platform_prefix=aarch64-linux-android
445         android_gnu_prefix=$android_platform_prefix
446         LLVM_TRIPLE=$android_platform_prefix
447         # minimum android version that supports aarch64
448         if test "$ANDROID_API_LEVEL" -lt "21" ; then
449             ANDROID_API_LEVEL=21
450         fi
451         ANDROID_APP_ABI=arm64-v8a
452     elif test $host_cpu = x86_64; then
453         android_platform_prefix=x86_64-linux-android
454         android_gnu_prefix=$android_platform_prefix
455         LLVM_TRIPLE=$android_platform_prefix
456         # minimum android version that supports x86_64
457         ANDROID_API_LEVEL=21
458         ANDROID_APP_ABI=x86_64
459     else
460         # host_cpu is something like "i386" or "i686" I guess, NDK uses
461         # "x86" in some contexts
462         android_cpu=x86
463         android_platform_prefix=$android_cpu
464         android_gnu_prefix=i686-linux-android
465         LLVM_TRIPLE=$android_gnu_prefix
466         ANDROID_APP_ABI=x86
467     fi
469     case "$with_android_ndk_toolchain_version" in
470     clang5.0)
471         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
472         ;;
473     *)
474         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
475     esac
477     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
479     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
480     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
481     # manage to link the (app-specific) single huge .so that is built for the app in
482     # android/source/ if there is debug information in a significant part of the object files.
483     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
484     # all objects have been built with debug information.)
485     case $build_os in
486     linux-gnu*)
487         android_HOST_TAG=linux-x86_64
488         ;;
489     darwin*)
490         android_HOST_TAG=darwin-x86_64
491         ;;
492     *)
493         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
494         # ndk would also support windows and windows-x86_64
495         ;;
496     esac
497     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
498     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
499     dnl TODO: NSS build uses it...
500     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
501     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
503     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
504     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
505     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
506     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
507     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
511     if test "$ENABLE_LTO" = TRUE; then
512         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
513         # $CC and $CXX when building external libraries
514         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
515     fi
517     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
519     if test -z "$CC"; then
520         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
521         CC_BASE="clang"
522     fi
523     if test -z "$CXX"; then
524         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
525         CXX_BASE="clang++"
526     fi
528     # remember to download the ownCloud Android library later
529     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
531 AC_SUBST(ANDROID_NDK_HOME)
532 AC_SUBST(ANDROID_APP_ABI)
533 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
535 dnl ===================================================================
536 dnl --with-android-sdk
537 dnl ===================================================================
538 ANDROID_SDK_HOME=
539 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
540     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
542 if test -n "$with_android_sdk"; then
543     eval ANDROID_SDK_HOME=$with_android_sdk
544     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
546 AC_SUBST(ANDROID_SDK_HOME)
548 AC_ARG_ENABLE([android-lok],
549     AS_HELP_STRING([--enable-android-lok],
550         [The Android app from the android/ subdir needs several tweaks all
551          over the place that break the LOK when used in the Online-based
552          Android app.  This switch indicates that the intent of this build is
553          actually the Online-based, non-modified LOK.])
555 ENABLE_ANDROID_LOK=
556 if test -n "$ANDROID_NDK_HOME" ; then
557     if test "$enable_android_lok" = yes; then
558         ENABLE_ANDROID_LOK=TRUE
559         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
560         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
561     else
562         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
563     fi
565 AC_SUBST([ENABLE_ANDROID_LOK])
567 libo_FUZZ_ARG_ENABLE([android-editing],
568     AS_HELP_STRING([--enable-android-editing],
569         [Enable the experimental editing feature on Android.])
571 ENABLE_ANDROID_EDITING=
572 if test "$enable_android_editing" = yes; then
573     ENABLE_ANDROID_EDITING=TRUE
575 AC_SUBST([ENABLE_ANDROID_EDITING])
577 dnl ===================================================================
578 dnl The following is a list of supported systems.
579 dnl Sequential to keep the logic very simple
580 dnl These values may be checked and reset later.
581 dnl ===================================================================
582 #defaults unless the os test overrides this:
583 test_randr=yes
584 test_xrender=yes
585 test_cups=yes
586 test_dbus=yes
587 test_fontconfig=yes
588 test_cairo=no
589 test_gdb_index=no
590 test_split_debug=no
592 # Default values, as such probably valid just for Linux, set
593 # differently below just for Mac OSX, but at least better than
594 # hardcoding these as we used to do. Much of this is duplicated also
595 # in solenv for old build system and for gbuild, ideally we should
596 # perhaps define stuff like this only here in configure.ac?
598 LINKFLAGSSHL="-shared"
599 PICSWITCH="-fpic"
600 DLLPOST=".so"
602 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
604 INSTROOTBASESUFFIX=
605 INSTROOTCONTENTSUFFIX=
606 SDKDIRNAME=sdk
608 case "$host_os" in
610 solaris*)
611     build_gstreamer_1_0=yes
612     test_freetype=yes
613     _os=SunOS
615     dnl ===========================================================
616     dnl Check whether we're using Solaris 10 - SPARC or Intel.
617     dnl ===========================================================
618     AC_MSG_CHECKING([the Solaris operating system release])
619     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
620     if test "$_os_release" -lt "10"; then
621         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
622     else
623         AC_MSG_RESULT([ok ($_os_release)])
624     fi
626     dnl Check whether we're using a SPARC or i386 processor
627     AC_MSG_CHECKING([the processor type])
628     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
629         AC_MSG_RESULT([ok ($host_cpu)])
630     else
631         AC_MSG_ERROR([only SPARC and i386 processors are supported])
632     fi
633     ;;
635 linux-gnu*|k*bsd*-gnu*)
636     build_gstreamer_1_0=yes
637     test_kf5=yes
638     test_gtk3_kde5=yes
639     test_gdb_index=yes
640     test_split_debug=yes
641     if test "$enable_fuzzers" != yes; then
642         test_freetype=yes
643         test_fontconfig=yes
644     else
645         test_freetype=no
646         test_fontconfig=no
647         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
648     fi
649     _os=Linux
650     ;;
652 gnu)
653     test_randr=no
654     test_xrender=no
655     _os=GNU
656      ;;
658 cygwin*|interix*)
660     # When building on Windows normally with MSVC under Cygwin,
661     # configure thinks that the host platform (the platform the
662     # built code will run on) is Cygwin, even if it obviously is
663     # Windows, which in Autoconf terminology is called
664     # "mingw32". (Which is misleading as MinGW is the name of the
665     # tool-chain, not an operating system.)
667     # Somewhat confusing, yes. But this configure script doesn't
668     # look at $host etc that much, it mostly uses its own $_os
669     # variable, set here in this case statement.
671     test_cups=no
672     test_dbus=no
673     test_randr=no
674     test_xrender=no
675     test_freetype=no
676     test_fontconfig=no
677     _os=WINNT
679     DLLPOST=".dll"
680     LINKFLAGSNOUNDEFS=
681     ;;
683 darwin*) # macOS or iOS
684     test_randr=no
685     test_xrender=no
686     test_freetype=no
687     test_fontconfig=no
688     test_dbus=no
689     if test -n "$LODE_HOME" ; then
690         mac_sanitize_path
691         AC_MSG_NOTICE([sanitized the PATH to $PATH])
692     fi
693     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
694         build_for_ios=YES
695         _os=iOS
696         test_cups=no
697         enable_mpl_subset=yes
698         enable_lotuswordpro=no
699         enable_coinmp=no
700         enable_lpsolve=no
701         enable_postgresql_sdbc=no
702         enable_extension_integration=no
703         enable_report_builder=no
704         with_ppds=no
705         if test "$enable_ios_simulator" = "yes"; then
706             host=x86_64-apple-darwin
707         fi
708     else
709         _os=Darwin
710         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
711         INSTROOTCONTENTSUFFIX=/Contents
712         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
713     fi
714     # See comment above the case "$host_os"
715     LINKFLAGSSHL="-dynamiclib -single_module"
717     # -fPIC is default
718     PICSWITCH=""
720     DLLPOST=".dylib"
722     # -undefined error is the default
723     LINKFLAGSNOUNDEFS=""
726 freebsd*)
727     build_gstreamer_1_0=yes
728     test_kf5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     AC_MSG_CHECKING([the FreeBSD operating system release])
732     if test -n "$with_os_version"; then
733         OSVERSION="$with_os_version"
734     else
735         OSVERSION=`/sbin/sysctl -n kern.osreldate`
736     fi
737     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
738     AC_MSG_CHECKING([which thread library to use])
739     if test "$OSVERSION" -lt "500016"; then
740         PTHREAD_CFLAGS="-D_THREAD_SAFE"
741         PTHREAD_LIBS="-pthread"
742     elif test "$OSVERSION" -lt "502102"; then
743         PTHREAD_CFLAGS="-D_THREAD_SAFE"
744         PTHREAD_LIBS="-lc_r"
745     else
746         PTHREAD_CFLAGS=""
747         PTHREAD_LIBS="-pthread"
748     fi
749     AC_MSG_RESULT([$PTHREAD_LIBS])
750     _os=FreeBSD
751     ;;
753 *netbsd*)
754     build_gstreamer_1_0=yes
755     test_kf5=yes
756     test_gtk3_kde5=yes
757     test_freetype=yes
758     PTHREAD_LIBS="-pthread -lpthread"
759     _os=NetBSD
760     ;;
762 aix*)
763     test_randr=no
764     test_freetype=yes
765     PTHREAD_LIBS=-pthread
766     _os=AIX
767     ;;
769 openbsd*)
770     test_freetype=yes
771     PTHREAD_CFLAGS="-D_THREAD_SAFE"
772     PTHREAD_LIBS="-pthread"
773     _os=OpenBSD
774     ;;
776 dragonfly*)
777     build_gstreamer_1_0=yes
778     test_kf5=yes
779     test_gtk3_kde5=yes
780     test_freetype=yes
781     PTHREAD_LIBS="-pthread"
782     _os=DragonFly
783     ;;
785 linux-android*)
786     build_gstreamer_1_0=no
787     enable_lotuswordpro=no
788     enable_mpl_subset=yes
789     enable_coinmp=yes
790     enable_lpsolve=no
791     enable_report_builder=no
792     enable_odk=no
793     enable_postgresql_sdbc=no
794     enable_python=no
795     test_cups=no
796     test_dbus=no
797     test_fontconfig=no
798     test_freetype=no
799     test_kf5=no
800     test_qt5=no
801     test_gtk3_kde5=no
802     test_randr=no
803     test_xrender=no
804     _os=Android
806     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
807     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
808     ;;
810 haiku*)
811     test_cups=no
812     test_dbus=no
813     test_randr=no
814     test_xrender=no
815     test_freetype=yes
816     enable_odk=no
817     enable_gstreamer_1_0=no
818     enable_vlc=no
819     enable_coinmp=no
820     enable_pdfium=no
821     enable_sdremote=no
822     enable_postgresql_sdbc=no
823     enable_firebird_sdbc=no
824     _os=Haiku
825     ;;
828     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
829     ;;
830 esac
832 if test "$_os" = "Android" ; then
833     # Verify that the NDK and SDK options are proper
834     if test -z "$with_android_ndk"; then
835         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
836     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
837         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
838     fi
840     if test -z "$ANDROID_SDK_HOME"; then
841         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
842     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
843         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
844     fi
846     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
847     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
848         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
849                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
850                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
851         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
852         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
853         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
854     fi
855     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
856         AC_MSG_WARN([android support repository not found - install with
857                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
858                      to allow the build to download the specified version of the android support libraries])
859         add_warning "android support repository not found - install with"
860         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
861         add_warning "to allow the build to download the specified version of the android support libraries"
862     fi
865 if test "$_os" = "AIX"; then
866     AC_PATH_PROG(GAWK, gawk)
867     if test -z "$GAWK"; then
868         AC_MSG_ERROR([gawk not found in \$PATH])
869     fi
872 AC_SUBST(SDKDIRNAME)
874 AC_SUBST(PTHREAD_CFLAGS)
875 AC_SUBST(PTHREAD_LIBS)
877 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
878 # By default use the ones specified by our build system,
879 # but explicit override is possible.
880 AC_MSG_CHECKING(for explicit AFLAGS)
881 if test -n "$AFLAGS"; then
882     AC_MSG_RESULT([$AFLAGS])
883     x_AFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_AFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit CFLAGS)
889 if test -n "$CFLAGS"; then
890     AC_MSG_RESULT([$CFLAGS])
891     x_CFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_CFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit CXXFLAGS)
897 if test -n "$CXXFLAGS"; then
898     AC_MSG_RESULT([$CXXFLAGS])
899     x_CXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_CXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit OBJCFLAGS)
905 if test -n "$OBJCFLAGS"; then
906     AC_MSG_RESULT([$OBJCFLAGS])
907     x_OBJCFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_OBJCFLAGS=[\#]
912 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
913 if test -n "$OBJCXXFLAGS"; then
914     AC_MSG_RESULT([$OBJCXXFLAGS])
915     x_OBJCXXFLAGS=
916 else
917     AC_MSG_RESULT(no)
918     x_OBJCXXFLAGS=[\#]
920 AC_MSG_CHECKING(for explicit LDFLAGS)
921 if test -n "$LDFLAGS"; then
922     AC_MSG_RESULT([$LDFLAGS])
923     x_LDFLAGS=
924 else
925     AC_MSG_RESULT(no)
926     x_LDFLAGS=[\#]
928 AC_SUBST(AFLAGS)
929 AC_SUBST(CFLAGS)
930 AC_SUBST(CXXFLAGS)
931 AC_SUBST(OBJCFLAGS)
932 AC_SUBST(OBJCXXFLAGS)
933 AC_SUBST(LDFLAGS)
934 AC_SUBST(x_AFLAGS)
935 AC_SUBST(x_CFLAGS)
936 AC_SUBST(x_CXXFLAGS)
937 AC_SUBST(x_OBJCFLAGS)
938 AC_SUBST(x_OBJCXXFLAGS)
939 AC_SUBST(x_LDFLAGS)
941 dnl These are potentially set for MSVC, in the code checking for UCRT below:
942 my_original_CFLAGS=$CFLAGS
943 my_original_CXXFLAGS=$CXXFLAGS
944 my_original_CPPFLAGS=$CPPFLAGS
946 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
947 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
948 dnl AC_PROG_CC internally.
949 if test "$_os" != "WINNT"; then
950     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
951     save_CFLAGS=$CFLAGS
952     AC_PROG_CC
953     CFLAGS=$save_CFLAGS
954     if test -z "$CC_BASE"; then
955         CC_BASE=`first_arg_basename "$CC"`
956     fi
959 if test "$_os" != "WINNT"; then
960     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
961 else
962     ENDIANNESS=little
964 AC_SUBST(ENDIANNESS)
966 if test $_os != "WINNT"; then
967     save_LIBS="$LIBS"
968     AC_SEARCH_LIBS([dlsym], [dl],
969         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
970         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
971     LIBS="$save_LIBS"
973 AC_SUBST(DLOPEN_LIBS)
975 AC_ARG_ENABLE(ios-simulator,
976     AS_HELP_STRING([--enable-ios-simulator],
977         [build i386 or x86_64 for ios simulator])
980 AC_ARG_ENABLE(ios-libreofficelight-app,
981     AS_HELP_STRING([--enable-ios-libreofficelight-app],
982         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
983          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
984          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
987 ENABLE_IOS_LIBREOFFICELIGHT_APP=
988 if test "$enable_ios_libreofficelight_app" = yes; then
989     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
991 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
993 ###############################################################################
994 # Extensions switches --enable/--disable
995 ###############################################################################
996 # By default these should be enabled unless having extra dependencies.
997 # If there is extra dependency over configure options then the enable should
998 # be automagic based on whether the requiring feature is enabled or not.
999 # All this options change anything only with --enable-extension-integration.
1001 # The name of this option and its help string makes it sound as if
1002 # extensions are built anyway, just not integrated in the installer,
1003 # if you use --disable-extension-integration. Is that really the
1004 # case?
1006 libo_FUZZ_ARG_ENABLE(extension-integration,
1007     AS_HELP_STRING([--disable-extension-integration],
1008         [Disable integration of the built extensions in the installer of the
1009          product. Use this switch to disable the integration.])
1012 AC_ARG_ENABLE(avmedia,
1013     AS_HELP_STRING([--disable-avmedia],
1014         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1017 AC_ARG_ENABLE(database-connectivity,
1018     AS_HELP_STRING([--disable-database-connectivity],
1019         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1022 # This doesn't mean not building (or "integrating") extensions
1023 # (although it probably should; i.e. it should imply
1024 # --disable-extension-integration I guess), it means not supporting
1025 # any extension mechanism at all
1026 libo_FUZZ_ARG_ENABLE(extensions,
1027     AS_HELP_STRING([--disable-extensions],
1028         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1031 AC_ARG_ENABLE(scripting,
1032     AS_HELP_STRING([--disable-scripting],
1033         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1036 # This is mainly for Android and iOS, but could potentially be used in some
1037 # special case otherwise, too, so factored out as a separate setting
1039 AC_ARG_ENABLE(dynamic-loading,
1040     AS_HELP_STRING([--disable-dynamic-loading],
1041         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1044 libo_FUZZ_ARG_ENABLE(report-builder,
1045     AS_HELP_STRING([--disable-report-builder],
1046         [Disable the Report Builder.])
1049 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1050     AS_HELP_STRING([--enable-ext-wiki-publisher],
1051         [Enable the Wiki Publisher extension.])
1054 libo_FUZZ_ARG_ENABLE(lpsolve,
1055     AS_HELP_STRING([--disable-lpsolve],
1056         [Disable compilation of the lp solve solver ])
1058 libo_FUZZ_ARG_ENABLE(coinmp,
1059     AS_HELP_STRING([--disable-coinmp],
1060         [Disable compilation of the CoinMP solver ])
1063 libo_FUZZ_ARG_ENABLE(pdfimport,
1064     AS_HELP_STRING([--disable-pdfimport],
1065         [Disable building the PDF import feature.])
1068 libo_FUZZ_ARG_ENABLE(pdfium,
1069     AS_HELP_STRING([--disable-pdfium],
1070         [Disable building PDFium.])
1073 ###############################################################################
1075 dnl ---------- *** ----------
1077 libo_FUZZ_ARG_ENABLE(mergelibs,
1078     AS_HELP_STRING([--enable-mergelibs],
1079         [Merge several of the smaller libraries into one big, "merged", one.])
1082 libo_FUZZ_ARG_ENABLE(breakpad,
1083     AS_HELP_STRING([--enable-breakpad],
1084         [Enables breakpad for crash reporting.])
1087 libo_FUZZ_ARG_ENABLE(crashdump,
1088     AS_HELP_STRING([--disable-crashdump],
1089         [Disable dump.ini and dump-file, when --enable-breakpad])
1092 AC_ARG_ENABLE(fetch-external,
1093     AS_HELP_STRING([--disable-fetch-external],
1094         [Disables fetching external tarballs from web sources.])
1097 AC_ARG_ENABLE(fuzzers,
1098     AS_HELP_STRING([--enable-fuzzers],
1099         [Enables building libfuzzer targets for fuzz testing.])
1102 libo_FUZZ_ARG_ENABLE(pch,
1103     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1104         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1105          Using 'system' will include only external headers, 'base' will add also headers
1106          from base modules, 'normal' will also add all headers except from the module built,
1107          'full' will use all suitable headers even from a module itself.])
1110 libo_FUZZ_ARG_ENABLE(epm,
1111     AS_HELP_STRING([--enable-epm],
1112         [LibreOffice includes self-packaging code, that requires epm, however epm is
1113          useless for large scale package building.])
1116 libo_FUZZ_ARG_ENABLE(odk,
1117     AS_HELP_STRING([--disable-odk],
1118         [LibreOffice includes an ODK, office development kit which some packagers may
1119          wish to build without.])
1122 AC_ARG_ENABLE(mpl-subset,
1123     AS_HELP_STRING([--enable-mpl-subset],
1124         [Don't compile any pieces which are not MPL or more liberally licensed])
1127 libo_FUZZ_ARG_ENABLE(evolution2,
1128     AS_HELP_STRING([--enable-evolution2],
1129         [Allows the built-in evolution 2 addressbook connectivity build to be
1130          enabled.])
1133 AC_ARG_ENABLE(avahi,
1134     AS_HELP_STRING([--enable-avahi],
1135         [Determines whether to use Avahi to advertise Impress to remote controls.])
1138 libo_FUZZ_ARG_ENABLE(werror,
1139     AS_HELP_STRING([--enable-werror],
1140         [Turn warnings to errors. (Has no effect in modules where the treating
1141          of warnings as errors is disabled explicitly.)]),
1144 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1145     AS_HELP_STRING([--enable-assert-always-abort],
1146         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1149 libo_FUZZ_ARG_ENABLE(dbgutil,
1150     AS_HELP_STRING([--enable-dbgutil],
1151         [Provide debugging support from --enable-debug and include additional debugging
1152          utilities such as object counting or more expensive checks.
1153          This is the recommended option for developers.
1154          Note that this makes the build ABI incompatible, it is not possible to mix object
1155          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1157 libo_FUZZ_ARG_ENABLE(debug,
1158     AS_HELP_STRING([--enable-debug],
1159         [Include debugging information, disable compiler optimization and inlining plus
1160          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1162 libo_FUZZ_ARG_ENABLE(split-debug,
1163     AS_HELP_STRING([--disable-split-debug],
1164         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1165          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1167 libo_FUZZ_ARG_ENABLE(gdb-index,
1168     AS_HELP_STRING([--disable-gdb-index],
1169         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1170          The feature requires the gold or lld linker.]))
1172 libo_FUZZ_ARG_ENABLE(sal-log,
1173     AS_HELP_STRING([--enable-sal-log],
1174         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1176 libo_FUZZ_ARG_ENABLE(symbols,
1177     AS_HELP_STRING([--enable-symbols],
1178         [Generate debug information.
1179          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1180          otherwise. It is possible to explicitly specify gbuild build targets
1181          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1182          everything in the directory; there is no ordering, more specific overrides
1183          more general, and disabling takes precedence).
1184          Example: --enable-symbols="all -sw/ -Library_sc".]))
1186 libo_FUZZ_ARG_ENABLE(optimized,
1187     AS_HELP_STRING([--disable-optimized],
1188         [Whether to compile with optimization flags.
1189          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1190          otherwise.]))
1192 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1193     AS_HELP_STRING([--disable-runtime-optimizations],
1194         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1195          JVM JIT) that are known to interact badly with certain dynamic analysis
1196          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1197          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1198          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1200 AC_ARG_WITH(valgrind,
1201     AS_HELP_STRING([--with-valgrind],
1202         [Make availability of Valgrind headers a hard requirement.]))
1204 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1205     AS_HELP_STRING([--enable-compiler-plugins],
1206         [Enable compiler plugins that will perform additional checks during
1207          building. Enabled automatically by --enable-dbgutil.
1208          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1209 COMPILER_PLUGINS_DEBUG=
1210 if test "$enable_compiler_plugins" = debug; then
1211     enable_compiler_plugins=yes
1212     COMPILER_PLUGINS_DEBUG=TRUE
1215 libo_FUZZ_ARG_ENABLE(ooenv,
1216     AS_HELP_STRING([--disable-ooenv],
1217         [Disable ooenv for the instdir installation.]))
1219 libo_FUZZ_ARG_ENABLE(libnumbertext,
1220     AS_HELP_STRING([--disable-libnumbertext],
1221         [Disable use of numbertext external library.]))
1223 AC_ARG_ENABLE(lto,
1224     AS_HELP_STRING([--enable-lto],
1225         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1226          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1227          linker. For MSVC, this option is broken at the moment. This is experimental work
1228          in progress that shouldn't be used unless you are working on it.)]))
1230 AC_ARG_ENABLE(python,
1231     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1232         [Enables or disables Python support at run-time.
1233          Also specifies what Python to use. 'auto' is the default.
1234          'fully-internal' even forces the internal version for uses of Python
1235          during the build.]))
1237 libo_FUZZ_ARG_ENABLE(gtk3,
1238     AS_HELP_STRING([--disable-gtk3],
1239         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1240 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1242 AC_ARG_ENABLE(introspection,
1243     AS_HELP_STRING([--enable-introspection],
1244         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1245          Linux distributions.)]))
1247 AC_ARG_ENABLE(split-app-modules,
1248     AS_HELP_STRING([--enable-split-app-modules],
1249         [Split file lists for app modules, e.g. base, calc.
1250          Has effect only with make distro-pack-install]),
1253 AC_ARG_ENABLE(split-opt-features,
1254     AS_HELP_STRING([--enable-split-opt-features],
1255         [Split file lists for some optional features, e.g. pyuno, testtool.
1256          Has effect only with make distro-pack-install]),
1259 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1260     AS_HELP_STRING([--disable-cairo-canvas],
1261         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1264 libo_FUZZ_ARG_ENABLE(dbus,
1265     AS_HELP_STRING([--disable-dbus],
1266         [Determines whether to enable features that depend on dbus.
1267          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1268 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1270 libo_FUZZ_ARG_ENABLE(sdremote,
1271     AS_HELP_STRING([--disable-sdremote],
1272         [Determines whether to enable Impress remote control (i.e. the server component).]),
1273 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1275 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1276     AS_HELP_STRING([--disable-sdremote-bluetooth],
1277         [Determines whether to build sdremote with bluetooth support.
1278          Requires dbus on Linux.]))
1280 libo_FUZZ_ARG_ENABLE(gio,
1281     AS_HELP_STRING([--disable-gio],
1282         [Determines whether to use the GIO support.]),
1283 ,test "${enable_gio+set}" = set || enable_gio=yes)
1285 AC_ARG_ENABLE(qt5,
1286     AS_HELP_STRING([--enable-qt5],
1287         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1288          available.]),
1291 AC_ARG_ENABLE(kf5,
1292     AS_HELP_STRING([--enable-kf5],
1293         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1294          KF5 are available.]),
1297 AC_ARG_ENABLE(kde5,
1298     AS_HELP_STRING([--enable-kde5],
1299         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1302 AC_ARG_ENABLE(gtk3_kde5,
1303     AS_HELP_STRING([--enable-gtk3-kde5],
1304         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1305          platforms where Gtk3, Qt5 and Plasma is available.]),
1308 AC_ARG_ENABLE(gui,
1309     AS_HELP_STRING([--disable-gui],
1310         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1311 ,enable_gui=yes)
1313 libo_FUZZ_ARG_ENABLE(randr,
1314     AS_HELP_STRING([--disable-randr],
1315         [Disable RandR support in the vcl project.]),
1316 ,test "${enable_randr+set}" = set || enable_randr=yes)
1318 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1319     AS_HELP_STRING([--disable-gstreamer-1-0],
1320         [Disable building with the gstreamer 1.0 avmedia backend.]),
1321 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1323 libo_FUZZ_ARG_ENABLE(vlc,
1324     AS_HELP_STRING([--enable-vlc],
1325         [Enable building with the (experimental) VLC avmedia backend.]),
1326 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1328 libo_FUZZ_ARG_ENABLE(neon,
1329     AS_HELP_STRING([--disable-neon],
1330         [Disable neon and the compilation of webdav binding.]),
1333 libo_FUZZ_ARG_ENABLE([eot],
1334     [AS_HELP_STRING([--enable-eot],
1335         [Enable support for Embedded OpenType fonts.])],
1336 ,test "${enable_eot+set}" = set || enable_eot=no)
1338 libo_FUZZ_ARG_ENABLE(cve-tests,
1339     AS_HELP_STRING([--disable-cve-tests],
1340         [Prevent CVE tests to be executed]),
1343 libo_FUZZ_ARG_ENABLE(chart-tests,
1344     AS_HELP_STRING([--enable-chart-tests],
1345         [Executes chart XShape tests. In a perfect world these tests would be
1346          stable and everyone could run them, in reality it is best to run them
1347          only on a few machines that are known to work and maintained by people
1348          who can judge if a test failure is a regression or not.]),
1351 AC_ARG_ENABLE(build-unowinreg,
1352     AS_HELP_STRING([--enable-build-unowinreg],
1353         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1354          compiler is needed on Linux.]),
1357 AC_ARG_ENABLE(build-opensymbol,
1358     AS_HELP_STRING([--enable-build-opensymbol],
1359         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1360          fontforge installed.]),
1363 AC_ARG_ENABLE(dependency-tracking,
1364     AS_HELP_STRING([--enable-dependency-tracking],
1365         [Do not reject slow dependency extractors.])[
1366   --disable-dependency-tracking
1367                           Disables generation of dependency information.
1368                           Speed up one-time builds.],
1371 AC_ARG_ENABLE(icecream,
1372     AS_HELP_STRING([--enable-icecream],
1373         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1374          It defaults to /opt/icecream for the location of the icecream gcc/g++
1375          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1378 AC_ARG_ENABLE(ld,
1379     AS_HELP_STRING([--enable-ld=<linker>],
1380         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1381          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1384 libo_FUZZ_ARG_ENABLE(cups,
1385     AS_HELP_STRING([--disable-cups],
1386         [Do not build cups support.])
1389 AC_ARG_ENABLE(ccache,
1390     AS_HELP_STRING([--disable-ccache],
1391         [Do not try to use ccache automatically.
1392          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1393          CC/CXX are not yet set, and --enable-icecream is not given, we
1394          attempt to use ccache. --disable-ccache disables ccache completely.
1395          Additionally ccache's depend mode is enabled if possible,
1396          use --enable-ccache=nodepend to enable ccache without depend mode.
1400 AC_ARG_ENABLE(64-bit,
1401     AS_HELP_STRING([--enable-64-bit],
1402         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1403          At the moment meaningful only for Windows.]), ,)
1405 libo_FUZZ_ARG_ENABLE(online-update,
1406     AS_HELP_STRING([--enable-online-update],
1407         [Enable the online update service that will check for new versions of
1408          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1409          If the value is "mar", the experimental Mozilla-like update will be
1410          enabled instead of the traditional update mechanism.]),
1413 AC_ARG_WITH(update-config,
1414     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1415                    [Path to the update config ini file]))
1417 libo_FUZZ_ARG_ENABLE(extension-update,
1418     AS_HELP_STRING([--disable-extension-update],
1419         [Disable possibility to update installed extensions.]),
1422 libo_FUZZ_ARG_ENABLE(release-build,
1423     AS_HELP_STRING([--enable-release-build],
1424         [Enable release build. Note that the "release build" choice is orthogonal to
1425          whether symbols are present, debug info is generated, or optimization
1426          is done.
1427          See http://wiki.documentfoundation.org/Development/DevBuild]),
1430 AC_ARG_ENABLE(windows-build-signing,
1431     AS_HELP_STRING([--enable-windows-build-signing],
1432         [Enable signing of windows binaries (*.exe, *.dll)]),
1435 AC_ARG_ENABLE(silent-msi,
1436     AS_HELP_STRING([--enable-silent-msi],
1437         [Enable MSI with LIMITUI=1 (silent install).]),
1440 AC_ARG_ENABLE(macosx-code-signing,
1441     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1442         [Sign executables, dylibs, frameworks and the app bundle. If you
1443          don't provide an identity the first suitable certificate
1444          in your keychain is used.]),
1447 AC_ARG_ENABLE(macosx-package-signing,
1448     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1449         [Create a .pkg suitable for uploading to the Mac App Store and sign
1450          it. If you don't provide an identity the first suitable certificate
1451          in your keychain is used.]),
1454 AC_ARG_ENABLE(macosx-sandbox,
1455     AS_HELP_STRING([--enable-macosx-sandbox],
1456         [Make the app bundle run in a sandbox. Requires code signing.
1457          Is required by apps distributed in the Mac App Store, and implies
1458          adherence to App Store rules.]),
1461 AC_ARG_WITH(macosx-bundle-identifier,
1462     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1463         [Define the macOS bundle identifier. Default is the somewhat weird
1464          org.libreoffice.script ("script", huh?).]),
1465 ,with_macosx_bundle_identifier=org.libreoffice.script)
1467 AC_ARG_WITH(product-name,
1468     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1469         [Define the product name. Default is AC_PACKAGE_NAME.]),
1470 ,with_product_name=$PRODUCTNAME)
1472 AC_ARG_WITH(package-version,
1473     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1474         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1477 libo_FUZZ_ARG_ENABLE(readonly-installset,
1478     AS_HELP_STRING([--enable-readonly-installset],
1479         [Prevents any attempts by LibreOffice to write into its installation. That means
1480          at least that no "system-wide" extensions can be added. Partly experimental work in
1481          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1484 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1485     AS_HELP_STRING([--disable-postgresql-sdbc],
1486         [Disable the build of the PostgreSQL-SDBC driver.])
1489 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1490     AS_HELP_STRING([--disable-lotuswordpro],
1491         [Disable the build of the Lotus Word Pro filter.]),
1492 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1494 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1495     AS_HELP_STRING([--disable-firebird-sdbc],
1496         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1497 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1499 AC_ARG_ENABLE(bogus-pkg-config,
1500     AS_HELP_STRING([--enable-bogus-pkg-config],
1501         [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.]),
1504 AC_ARG_ENABLE(openssl,
1505     AS_HELP_STRING([--disable-openssl],
1506         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1507          components will either use GNUTLS or NSS. Work in progress,
1508          use only if you are hacking on it.]),
1509 ,enable_openssl=yes)
1511 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1512     AS_HELP_STRING([--enable-cipher-openssl-backend],
1513         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1514          Requires --enable-openssl.]))
1516 AC_ARG_ENABLE(library-bin-tar,
1517     AS_HELP_STRING([--enable-library-bin-tar],
1518         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1519         Some libraries can save their build result in a tarball
1520         stored in TARFILE_LOCATION. That binary tarball is
1521         uniquely identified by the source tarball,
1522         the content of the config_host.mk file and the content
1523         of the top-level directory in core for that library
1524         If this option is enabled, then if such a tarfile exist, it will be untarred
1525         instead of the source tarfile, and the build step will be skipped for that
1526         library.
1527         If a proper tarfile does not exist, then the normal source-based
1528         build is done for that library and a proper binary tarfile is created
1529         for the next time.]),
1532 AC_ARG_ENABLE(dconf,
1533     AS_HELP_STRING([--disable-dconf],
1534         [Disable the dconf configuration backend (enabled by default where
1535          available).]))
1537 libo_FUZZ_ARG_ENABLE(formula-logger,
1538     AS_HELP_STRING(
1539         [--enable-formula-logger],
1540         [Enable formula logger for logging formula calculation flow in Calc.]
1541     )
1544 AC_ARG_ENABLE(ldap,
1545     AS_HELP_STRING([--disable-ldap],
1546         [Disable LDAP support.]),
1547 ,enable_ldap=yes)
1549 dnl ===================================================================
1550 dnl Optional Packages (--with/without-)
1551 dnl ===================================================================
1553 AC_ARG_WITH(gcc-home,
1554     AS_HELP_STRING([--with-gcc-home],
1555         [Specify the location of gcc/g++ manually. This can be used in conjunction
1556          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1557          non-default path.]),
1560 AC_ARG_WITH(gnu-patch,
1561     AS_HELP_STRING([--with-gnu-patch],
1562         [Specify location of GNU patch on Solaris or FreeBSD.]),
1565 AC_ARG_WITH(build-platform-configure-options,
1566     AS_HELP_STRING([--with-build-platform-configure-options],
1567         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1570 AC_ARG_WITH(gnu-cp,
1571     AS_HELP_STRING([--with-gnu-cp],
1572         [Specify location of GNU cp on Solaris or FreeBSD.]),
1575 AC_ARG_WITH(external-tar,
1576     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1577         [Specify an absolute path of where to find (and store) tarfiles.]),
1578     TARFILE_LOCATION=$withval ,
1581 AC_ARG_WITH(referenced-git,
1582     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1583         [Specify another checkout directory to reference. This makes use of
1584                  git submodule update --reference, and saves a lot of diskspace
1585                  when having multiple trees side-by-side.]),
1586     GIT_REFERENCE_SRC=$withval ,
1589 AC_ARG_WITH(linked-git,
1590     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1591         [Specify a directory where the repositories of submodules are located.
1592          This uses a method similar to git-new-workdir to get submodules.]),
1593     GIT_LINK_SRC=$withval ,
1596 AC_ARG_WITH(galleries,
1597     AS_HELP_STRING([--with-galleries],
1598         [Specify how galleries should be built. It is possible either to
1599          build these internally from source ("build"),
1600          or to disable them ("no")]),
1603 AC_ARG_WITH(theme,
1604     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1605         [Choose which themes to include. By default those themes with an '*' are included.
1606          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1607          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1610 libo_FUZZ_ARG_WITH(helppack-integration,
1611     AS_HELP_STRING([--without-helppack-integration],
1612         [It will not integrate the helppacks to the installer
1613          of the product. Please use this switch to use the online help
1614          or separate help packages.]),
1617 libo_FUZZ_ARG_WITH(fonts,
1618     AS_HELP_STRING([--without-fonts],
1619         [LibreOffice includes some third-party fonts to provide a reliable basis for
1620          help content, templates, samples, etc. When these fonts are already
1621          known to be available on the system then you should use this option.]),
1624 AC_ARG_ENABLE(noto-font,
1625     AS_HELP_STRING([--enable-noto-font],
1626         [Add more Google Noto fonts.]),
1629 AC_ARG_WITH(epm,
1630     AS_HELP_STRING([--with-epm],
1631         [Decides which epm to use. Default is to use the one from the system if
1632          one is built. When either this is not there or you say =internal epm
1633          will be built.]),
1636 AC_ARG_WITH(package-format,
1637     AS_HELP_STRING([--with-package-format],
1638         [Specify package format(s) for LibreOffice installation sets. The
1639          implicit --without-package-format leads to no installation sets being
1640          generated. Possible values: aix, archive, bsd, deb, dmg,
1641          installed, msi, pkg, and rpm.
1642          Example: --with-package-format='deb rpm']),
1645 AC_ARG_WITH(tls,
1646     AS_HELP_STRING([--with-tls],
1647         [Decides which TLS/SSL and cryptographic implementations to use for
1648          LibreOffice's code. Notice that this doesn't apply for depending
1649          libraries like "neon", for example. Default is to use OpenSSL
1650          although NSS is also possible. Notice that selecting NSS restricts
1651          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1652          restrict by now the usage of NSS in LO's code. Possible values:
1653          openssl, nss. Example: --with-tls="nss"]),
1656 AC_ARG_WITH(system-libs,
1657     AS_HELP_STRING([--with-system-libs],
1658         [Use libraries already on system -- enables all --with-system-* flags.]),
1661 AC_ARG_WITH(system-bzip2,
1662     AS_HELP_STRING([--with-system-bzip2],
1663         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1664     [with_system_bzip2="$with_system_libs"])
1666 AC_ARG_WITH(system-headers,
1667     AS_HELP_STRING([--with-system-headers],
1668         [Use headers already on system -- enables all --with-system-* flags for
1669          external packages whose headers are the only entities used i.e.
1670          boost/odbc/sane-header(s).]),,
1671     [with_system_headers="$with_system_libs"])
1673 AC_ARG_WITH(system-jars,
1674     AS_HELP_STRING([--without-system-jars],
1675         [When building with --with-system-libs, also the needed jars are expected
1676          on the system. Use this to disable that]),,
1677     [with_system_jars="$with_system_libs"])
1679 AC_ARG_WITH(system-cairo,
1680     AS_HELP_STRING([--with-system-cairo],
1681         [Use cairo libraries already on system.  Happens automatically for
1682          (implicit) --enable-gtk3.]))
1684 AC_ARG_WITH(system-epoxy,
1685     AS_HELP_STRING([--with-system-epoxy],
1686         [Use epoxy libraries already on system.  Happens automatically for
1687          (implicit) --enable-gtk3.]),,
1688        [with_system_epoxy="$with_system_libs"])
1690 AC_ARG_WITH(myspell-dicts,
1691     AS_HELP_STRING([--with-myspell-dicts],
1692         [Adds myspell dictionaries to the LibreOffice installation set]),
1695 AC_ARG_WITH(system-dicts,
1696     AS_HELP_STRING([--without-system-dicts],
1697         [Do not use dictionaries from system paths.]),
1700 AC_ARG_WITH(external-dict-dir,
1701     AS_HELP_STRING([--with-external-dict-dir],
1702         [Specify external dictionary dir.]),
1705 AC_ARG_WITH(external-hyph-dir,
1706     AS_HELP_STRING([--with-external-hyph-dir],
1707         [Specify external hyphenation pattern dir.]),
1710 AC_ARG_WITH(external-thes-dir,
1711     AS_HELP_STRING([--with-external-thes-dir],
1712         [Specify external thesaurus dir.]),
1715 AC_ARG_WITH(system-zlib,
1716     AS_HELP_STRING([--with-system-zlib],
1717         [Use zlib already on system.]),,
1718     [with_system_zlib=auto])
1720 AC_ARG_WITH(system-jpeg,
1721     AS_HELP_STRING([--with-system-jpeg],
1722         [Use jpeg already on system.]),,
1723     [with_system_jpeg="$with_system_libs"])
1725 AC_ARG_WITH(system-clucene,
1726     AS_HELP_STRING([--with-system-clucene],
1727         [Use clucene already on system.]),,
1728     [with_system_clucene="$with_system_libs"])
1730 AC_ARG_WITH(system-expat,
1731     AS_HELP_STRING([--with-system-expat],
1732         [Use expat already on system.]),,
1733     [with_system_expat="$with_system_libs"])
1735 AC_ARG_WITH(system-libxml,
1736     AS_HELP_STRING([--with-system-libxml],
1737         [Use libxml/libxslt already on system.]),,
1738     [with_system_libxml=auto])
1740 AC_ARG_WITH(system-icu,
1741     AS_HELP_STRING([--with-system-icu],
1742         [Use icu already on system.]),,
1743     [with_system_icu="$with_system_libs"])
1745 AC_ARG_WITH(system-ucpp,
1746     AS_HELP_STRING([--with-system-ucpp],
1747         [Use ucpp already on system.]),,
1748     [])
1750 AC_ARG_WITH(system-openldap,
1751     AS_HELP_STRING([--with-system-openldap],
1752         [Use the OpenLDAP LDAP SDK already on system.]),,
1753     [with_system_openldap="$with_system_libs"])
1755 libo_FUZZ_ARG_ENABLE(poppler,
1756     AS_HELP_STRING([--disable-poppler],
1757         [Disable building Poppler.])
1760 AC_ARG_WITH(system-poppler,
1761     AS_HELP_STRING([--with-system-poppler],
1762         [Use system poppler (only needed for PDF import).]),,
1763     [with_system_poppler="$with_system_libs"])
1765 AC_ARG_WITH(system-gpgmepp,
1766     AS_HELP_STRING([--with-system-gpgmepp],
1767         [Use gpgmepp already on system]),,
1768     [with_system_gpgmepp="$with_system_libs"])
1770 AC_ARG_WITH(system-apache-commons,
1771     AS_HELP_STRING([--with-system-apache-commons],
1772         [Use Apache commons libraries already on system.]),,
1773     [with_system_apache_commons="$with_system_jars"])
1775 AC_ARG_WITH(system-mariadb,
1776     AS_HELP_STRING([--with-system-mariadb],
1777         [Use MariaDB/MySQL libraries already on system.]),,
1778     [with_system_mariadb="$with_system_libs"])
1780 AC_ARG_ENABLE(bundle-mariadb,
1781     AS_HELP_STRING([--enable-bundle-mariadb],
1782         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1785 AC_ARG_WITH(system-postgresql,
1786     AS_HELP_STRING([--with-system-postgresql],
1787         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1788          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1789     [with_system_postgresql="$with_system_libs"])
1791 AC_ARG_WITH(libpq-path,
1792     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1793         [Use this PostgreSQL C interface (libpq) installation for building
1794          the PostgreSQL-SDBC extension.]),
1797 AC_ARG_WITH(system-firebird,
1798     AS_HELP_STRING([--with-system-firebird],
1799         [Use Firebird libraries already on system, for building the Firebird-SDBC
1800          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1801     [with_system_firebird="$with_system_libs"])
1803 AC_ARG_WITH(system-libtommath,
1804             AS_HELP_STRING([--with-system-libtommath],
1805                            [Use libtommath already on system]),,
1806             [with_system_libtommath="$with_system_libs"])
1808 AC_ARG_WITH(system-hsqldb,
1809     AS_HELP_STRING([--with-system-hsqldb],
1810         [Use hsqldb already on system.]))
1812 AC_ARG_WITH(hsqldb-jar,
1813     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1814         [Specify path to jarfile manually.]),
1815     HSQLDB_JAR=$withval)
1817 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1818     AS_HELP_STRING([--disable-scripting-beanshell],
1819         [Disable support for scripts in BeanShell.]),
1823 AC_ARG_WITH(system-beanshell,
1824     AS_HELP_STRING([--with-system-beanshell],
1825         [Use beanshell already on system.]),,
1826     [with_system_beanshell="$with_system_jars"])
1828 AC_ARG_WITH(beanshell-jar,
1829     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     BSH_JAR=$withval)
1833 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1834     AS_HELP_STRING([--disable-scripting-javascript],
1835         [Disable support for scripts in JavaScript.]),
1839 AC_ARG_WITH(system-rhino,
1840     AS_HELP_STRING([--with-system-rhino],
1841         [Use rhino already on system.]),,)
1842 #    [with_system_rhino="$with_system_jars"])
1843 # Above is not used as we have different debug interface
1844 # patched into internal rhino. This code needs to be fixed
1845 # before we can enable it by default.
1847 AC_ARG_WITH(rhino-jar,
1848     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     RHINO_JAR=$withval)
1852 AC_ARG_WITH(commons-logging-jar,
1853     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     COMMONS_LOGGING_JAR=$withval)
1857 AC_ARG_WITH(system-jfreereport,
1858     AS_HELP_STRING([--with-system-jfreereport],
1859         [Use JFreeReport already on system.]),,
1860     [with_system_jfreereport="$with_system_jars"])
1862 AC_ARG_WITH(sac-jar,
1863     AS_HELP_STRING([--with-sac-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     SAC_JAR=$withval)
1867 AC_ARG_WITH(libxml-jar,
1868     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBXML_JAR=$withval)
1872 AC_ARG_WITH(flute-jar,
1873     AS_HELP_STRING([--with-flute-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     FLUTE_JAR=$withval)
1877 AC_ARG_WITH(jfreereport-jar,
1878     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     JFREEREPORT_JAR=$withval)
1882 AC_ARG_WITH(liblayout-jar,
1883     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBLAYOUT_JAR=$withval)
1887 AC_ARG_WITH(libloader-jar,
1888     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBLOADER_JAR=$withval)
1892 AC_ARG_WITH(libformula-jar,
1893     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBFORMULA_JAR=$withval)
1897 AC_ARG_WITH(librepository-jar,
1898     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBREPOSITORY_JAR=$withval)
1902 AC_ARG_WITH(libfonts-jar,
1903     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBFONTS_JAR=$withval)
1907 AC_ARG_WITH(libserializer-jar,
1908     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBSERIALIZER_JAR=$withval)
1912 AC_ARG_WITH(libbase-jar,
1913     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBBASE_JAR=$withval)
1917 AC_ARG_WITH(system-odbc,
1918     AS_HELP_STRING([--with-system-odbc],
1919         [Use the odbc headers already on system.]),,
1920     [with_system_odbc="auto"])
1922 AC_ARG_WITH(system-sane,
1923     AS_HELP_STRING([--with-system-sane],
1924         [Use sane.h already on system.]),,
1925     [with_system_sane="$with_system_headers"])
1927 AC_ARG_WITH(system-bluez,
1928     AS_HELP_STRING([--with-system-bluez],
1929         [Use bluetooth.h already on system.]),,
1930     [with_system_bluez="$with_system_headers"])
1932 AC_ARG_WITH(system-curl,
1933     AS_HELP_STRING([--with-system-curl],
1934         [Use curl already on system.]),,
1935     [with_system_curl=auto])
1937 AC_ARG_WITH(system-boost,
1938     AS_HELP_STRING([--with-system-boost],
1939         [Use boost already on system.]),,
1940     [with_system_boost="$with_system_headers"])
1942 AC_ARG_WITH(system-glm,
1943     AS_HELP_STRING([--with-system-glm],
1944         [Use glm already on system.]),,
1945     [with_system_glm="$with_system_headers"])
1947 AC_ARG_WITH(system-hunspell,
1948     AS_HELP_STRING([--with-system-hunspell],
1949         [Use libhunspell already on system.]),,
1950     [with_system_hunspell="$with_system_libs"])
1952 AC_ARG_WITH(system-qrcodegen,
1953     AS_HELP_STRING([--with-system-qrcodegen],
1954         [Use libqrcodegen already on system.]),,
1955     [with_system_qrcodegen="$with_system_libs"])
1957 AC_ARG_WITH(system-mythes,
1958     AS_HELP_STRING([--with-system-mythes],
1959         [Use mythes already on system.]),,
1960     [with_system_mythes="$with_system_libs"])
1962 AC_ARG_WITH(system-altlinuxhyph,
1963     AS_HELP_STRING([--with-system-altlinuxhyph],
1964         [Use ALTLinuxhyph already on system.]),,
1965     [with_system_altlinuxhyph="$with_system_libs"])
1967 AC_ARG_WITH(system-lpsolve,
1968     AS_HELP_STRING([--with-system-lpsolve],
1969         [Use lpsolve already on system.]),,
1970     [with_system_lpsolve="$with_system_libs"])
1972 AC_ARG_WITH(system-coinmp,
1973     AS_HELP_STRING([--with-system-coinmp],
1974         [Use CoinMP already on system.]),,
1975     [with_system_coinmp="$with_system_libs"])
1977 AC_ARG_WITH(system-liblangtag,
1978     AS_HELP_STRING([--with-system-liblangtag],
1979         [Use liblangtag library already on system.]),,
1980     [with_system_liblangtag="$with_system_libs"])
1982 AC_ARG_WITH(webdav,
1983     AS_HELP_STRING([--with-webdav],
1984         [Specify which library to use for webdav implementation.
1985          Possible values: "neon", "serf", "no". The default value is "neon".
1986          Example: --with-webdav="serf"]),
1987     WITH_WEBDAV=$withval,
1988     WITH_WEBDAV="neon")
1990 AC_ARG_WITH(linker-hash-style,
1991     AS_HELP_STRING([--with-linker-hash-style],
1992         [Use linker with --hash-style=<style> when linking shared objects.
1993          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1994          if supported on the build system, and "sysv" otherwise.]))
1996 AC_ARG_WITH(jdk-home,
1997     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1998         [If you have installed JDK 8 or later on your system please supply the
1999          path here. Note that this is not the location of the java command but the
2000          location of the entire distribution.]),
2003 AC_ARG_WITH(help,
2004     AS_HELP_STRING([--with-help],
2005         [Enable the build of help. There is a special parameter "common" that
2006          can be used to bundle only the common part, .e.g help-specific icons.
2007          This is useful when you build the helpcontent separately.])
2008     [
2009                           Usage:     --with-help    build the old local help
2010                                  --without-help     no local help (default)
2011                                  --with-help=html   build the new HTML local help
2012                                  --with-help=online build the new HTML online help
2013     ],
2016 AC_ARG_WITH(omindex,
2017    AS_HELP_STRING([--with-omindex],
2018         [Enable the support of xapian-omega index for online help.])
2019    [
2020                          Usage: --with-omindex=server prepare the pages for omindex
2021                                 but let xapian-omega be built in server.
2022                                 --with-omindex=noxap do not prepare online pages
2023                                 for xapian-omega
2024   ],
2027 libo_FUZZ_ARG_WITH(java,
2028     AS_HELP_STRING([--with-java=<java command>],
2029         [Specify the name of the Java interpreter command. Typically "java"
2030          which is the default.
2032          To build without support for Java components, applets, accessibility
2033          or the XML filters written in Java, use --without-java or --with-java=no.]),
2034     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2035     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2038 AC_ARG_WITH(jvm-path,
2039     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2040         [Use a specific JVM search path at runtime.
2041          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2044 AC_ARG_WITH(ant-home,
2045     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2046         [If you have installed Apache Ant on your system, please supply the path here.
2047          Note that this is not the location of the Ant binary but the location
2048          of the entire distribution.]),
2051 AC_ARG_WITH(symbol-config,
2052     AS_HELP_STRING([--with-symbol-config],
2053         [Configuration for the crashreport symbol upload]),
2054         [],
2055         [with_symbol_config=no])
2057 AC_ARG_WITH(export-validation,
2058     AS_HELP_STRING([--without-export-validation],
2059         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2060 ,with_export_validation=auto)
2062 AC_ARG_WITH(bffvalidator,
2063     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2064         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2065          Requires installed Microsoft Office Binary File Format Validator.
2066          Note: export-validation (--with-export-validation) is required to be turned on.
2067          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2068 ,with_bffvalidator=no)
2070 libo_FUZZ_ARG_WITH(junit,
2071     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2072         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2073          --without-junit disables those tests. Not relevant in the --without-java case.]),
2074 ,with_junit=yes)
2076 AC_ARG_WITH(hamcrest,
2077     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2078         [Specifies the hamcrest jar file to use for JUnit-based tests.
2079          --without-junit disables those tests. Not relevant in the --without-java case.]),
2080 ,with_hamcrest=yes)
2082 AC_ARG_WITH(perl-home,
2083     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2084         [If you have installed Perl 5 Distribution, on your system, please
2085          supply the path here. Note that this is not the location of the Perl
2086          binary but the location of the entire distribution.]),
2089 libo_FUZZ_ARG_WITH(doxygen,
2090     AS_HELP_STRING(
2091         [--with-doxygen=<absolute path to doxygen executable>],
2092         [Specifies the doxygen executable to use when generating ODK C/C++
2093          documentation. --without-doxygen disables generation of ODK C/C++
2094          documentation. Not relevant in the --disable-odk case.]),
2095 ,with_doxygen=yes)
2097 AC_ARG_WITH(visual-studio,
2098     AS_HELP_STRING([--with-visual-studio=<2017>],
2099         [Specify which Visual Studio version to use in case several are
2100          installed. Currently only 2017 is supported.]),
2103 AC_ARG_WITH(windows-sdk,
2104     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2105         [Specify which Windows SDK, or "Windows Kit", version to use
2106          in case the one that came with the selected Visual Studio
2107          is not what you want for some reason. Note that not all compiler/SDK
2108          combinations are supported. The intent is that this option should not
2109          be needed.]),
2112 AC_ARG_WITH(lang,
2113     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2114         [Use this option to build LibreOffice with additional UI language support.
2115          English (US) is always included by default.
2116          Separate multiple languages with space.
2117          For all languages, use --with-lang=ALL.]),
2120 AC_ARG_WITH(locales,
2121     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2122         [Use this option to limit the locale information built in.
2123          Separate multiple locales with space.
2124          Very experimental and might well break stuff.
2125          Just a desperate measure to shrink code and data size.
2126          By default all the locales available is included.
2127          This option is completely unrelated to --with-lang.])
2128     [
2129                           Affects also our character encoding conversion
2130                           tables for encodings mainly targeted for a
2131                           particular locale, like EUC-CN and EUC-TW for
2132                           zh, ISO-2022-JP for ja.
2134                           Affects also our add-on break iterator data for
2135                           some languages.
2137                           For the default, all locales, don't use this switch at all.
2138                           Specifying just the language part of a locale means all matching
2139                           locales will be included.
2140     ],
2143 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2144 libo_FUZZ_ARG_WITH(krb5,
2145     AS_HELP_STRING([--with-krb5],
2146         [Enable MIT Kerberos 5 support in modules that support it.
2147          By default automatically enabled on platforms
2148          where a good system Kerberos 5 is available.]),
2151 libo_FUZZ_ARG_WITH(gssapi,
2152     AS_HELP_STRING([--with-gssapi],
2153         [Enable GSSAPI support in modules that support it.
2154          By default automatically enabled on platforms
2155          where a good system GSSAPI is available.]),
2158 AC_ARG_WITH(iwyu,
2159     AS_HELP_STRING([--with-iwyu],
2160         [Use given IWYU binary path to check unneeded includes instead of building.
2161          Use only if you are hacking on it.]),
2164 libo_FUZZ_ARG_WITH(lxml,
2165     AS_HELP_STRING([--without-lxml],
2166         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2167          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2168          report widget classes and ids.]),
2171 libo_FUZZ_ARG_WITH(latest-c++,
2172     AS_HELP_STRING([--with-latest-c++],
2173         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2174          published standard.]),,
2175         [with_latest_c__=no])
2177 dnl ===================================================================
2178 dnl Branding
2179 dnl ===================================================================
2181 AC_ARG_WITH(branding,
2182     AS_HELP_STRING([--with-branding=/path/to/images],
2183         [Use given path to retrieve branding images set.])
2184     [
2185                           Search for intro.png about.svg and flat_logo.svg.
2186                           If any is missing, default ones will be used instead.
2188                           Search also progress.conf for progress
2189                           settings on intro screen :
2191                           PROGRESSBARCOLOR="255,255,255" Set color of
2192                           progress bar. Comma separated RGB decimal values.
2193                           PROGRESSSIZE="407,6" Set size of progress bar.
2194                           Comma separated decimal values (width, height).
2195                           PROGRESSPOSITION="61,317" Set position of progress
2196                           bar from left,top. Comma separated decimal values.
2197                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2198                           bar frame. Comma separated RGB decimal values.
2199                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2200                           bar text. Comma separated RGB decimal values.
2201                           PROGRESSTEXTBASELINE="287" Set vertical position of
2202                           progress bar text from top. Decimal value.
2204                           Default values will be used if not found.
2205     ],
2209 AC_ARG_WITH(extra-buildid,
2210     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2211         [Show addition build identification in about dialog.]),
2215 AC_ARG_WITH(vendor,
2216     AS_HELP_STRING([--with-vendor="John the Builder"],
2217         [Set vendor of the build.]),
2220 AC_ARG_WITH(android-package-name,
2221     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2222         [Set Android package name of the build.]),
2225 AC_ARG_WITH(compat-oowrappers,
2226     AS_HELP_STRING([--with-compat-oowrappers],
2227         [Install oo* wrappers in parallel with
2228          lo* ones to keep backward compatibility.
2229          Has effect only with make distro-pack-install]),
2232 AC_ARG_WITH(os-version,
2233     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2234         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2237 AC_ARG_WITH(mingw-cross-compiler,
2238     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2239         [Specify the MinGW cross-compiler to use.
2240          When building on the ODK on Unix and building unowinreg.dll,
2241          specify the MinGW C++ cross-compiler.]),
2244 AC_ARG_WITH(idlc-cpp,
2245     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2246         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2249 AC_ARG_WITH(build-version,
2250     AS_HELP_STRING([--with-build-version="Built by Jim"],
2251         [Allows the builder to add a custom version tag that will appear in the
2252          Help/About box for QA purposes.]),
2253 with_build_version=$withval,
2256 AC_ARG_WITH(parallelism,
2257     AS_HELP_STRING([--with-parallelism],
2258         [Number of jobs to run simultaneously during build. Parallel builds can
2259         save a lot of time on multi-cpu machines. Defaults to the number of
2260         CPUs on the machine, unless you configure --enable-icecream - then to
2261         40.]),
2264 AC_ARG_WITH(all-tarballs,
2265     AS_HELP_STRING([--with-all-tarballs],
2266         [Download all external tarballs unconditionally]))
2268 AC_ARG_WITH(gdrive-client-id,
2269     AS_HELP_STRING([--with-gdrive-client-id],
2270         [Provides the client id of the application for OAuth2 authentication
2271         on Google Drive. If either this or --with-gdrive-client-secret is
2272         empty, the feature will be disabled]),
2275 AC_ARG_WITH(gdrive-client-secret,
2276     AS_HELP_STRING([--with-gdrive-client-secret],
2277         [Provides the client secret of the application for OAuth2
2278         authentication on Google Drive. If either this or
2279         --with-gdrive-client-id is empty, the feature will be disabled]),
2282 AC_ARG_WITH(alfresco-cloud-client-id,
2283     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2284         [Provides the client id of the application for OAuth2 authentication
2285         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2286         empty, the feature will be disabled]),
2289 AC_ARG_WITH(alfresco-cloud-client-secret,
2290     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2291         [Provides the client secret of the application for OAuth2
2292         authentication on Alfresco Cloud. If either this or
2293         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2296 AC_ARG_WITH(onedrive-client-id,
2297     AS_HELP_STRING([--with-onedrive-client-id],
2298         [Provides the client id of the application for OAuth2 authentication
2299         on OneDrive. If either this or --with-onedrive-client-secret is
2300         empty, the feature will be disabled]),
2303 AC_ARG_WITH(onedrive-client-secret,
2304     AS_HELP_STRING([--with-onedrive-client-secret],
2305         [Provides the client secret of the application for OAuth2
2306         authentication on OneDrive. If either this or
2307         --with-onedrive-client-id is empty, the feature will be disabled]),
2309 dnl ===================================================================
2310 dnl Do we want to use pre-build binary tarball for recompile
2311 dnl ===================================================================
2313 if test "$enable_library_bin_tar" = "yes" ; then
2314     USE_LIBRARY_BIN_TAR=TRUE
2315 else
2316     USE_LIBRARY_BIN_TAR=
2318 AC_SUBST(USE_LIBRARY_BIN_TAR)
2320 dnl ===================================================================
2321 dnl Test whether build target is Release Build
2322 dnl ===================================================================
2323 AC_MSG_CHECKING([whether build target is Release Build])
2324 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2325     AC_MSG_RESULT([no])
2326     ENABLE_RELEASE_BUILD=
2327 else
2328     AC_MSG_RESULT([yes])
2329     ENABLE_RELEASE_BUILD=TRUE
2331 AC_SUBST(ENABLE_RELEASE_BUILD)
2333 dnl ===================================================================
2334 dnl Test whether to sign Windows Build
2335 dnl ===================================================================
2336 AC_MSG_CHECKING([whether to sign windows build])
2337 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2338     AC_MSG_RESULT([yes])
2339     WINDOWS_BUILD_SIGNING="TRUE"
2340 else
2341     AC_MSG_RESULT([no])
2342     WINDOWS_BUILD_SIGNING="FALSE"
2344 AC_SUBST(WINDOWS_BUILD_SIGNING)
2346 dnl ===================================================================
2347 dnl MacOSX build and runtime environment options
2348 dnl ===================================================================
2350 AC_ARG_WITH(macosx-sdk,
2351     AS_HELP_STRING([--with-macosx-sdk=<version>],
2352         [Prefer a specific SDK for building.])
2353     [
2354                           If the requested SDK is not available, a search for the oldest one will be done.
2355                           With current Xcode versions, only the latest SDK is included, so this option is
2356                           not terribly useful. It works fine to build with a new SDK and run the result
2357                           on an older OS.
2359                           e. g.: --with-macosx-sdk=10.10
2361                           there are 3 options to control the MacOSX build:
2362                           --with-macosx-sdk (referred as 'sdk' below)
2363                           --with-macosx-version-min-required (referred as 'min' below)
2364                           --with-macosx-version-max-allowed (referred as 'max' below)
2366                           the connection between these value and the default they take is as follow:
2367                           ( ? means not specified on the command line, s means the SDK version found,
2368                           constraint: 8 <= x <= y <= z)
2370                           ==========================================
2371                            command line      || config result
2372                           ==========================================
2373                           min  | max  | sdk  || min   | max  | sdk  |
2374                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2375                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2376                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2377                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2378                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2379                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2380                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2381                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2384                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2385                           for a detailed technical explanation of these variables
2387                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2388     ],
2391 AC_ARG_WITH(macosx-version-min-required,
2392     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2393         [set the minimum OS version needed to run the built LibreOffice])
2394     [
2395                           e. g.: --with-macos-version-min-required=10.10
2396                           see --with-macosx-sdk for more info
2397     ],
2400 AC_ARG_WITH(macosx-version-max-allowed,
2401     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2402         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2403     [
2404                           e. g.: --with-macos-version-max-allowed=10.10
2405                           see --with-macosx-sdk for more info
2406     ],
2410 dnl ===================================================================
2411 dnl options for stuff used during cross-compilation build
2412 dnl Not quite superseded by --with-build-platform-configure-options.
2413 dnl TODO: check, if the "force" option is still needed anywhere.
2414 dnl ===================================================================
2416 AC_ARG_WITH(system-icu-for-build,
2417     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2418         [Use icu already on system for build tools (cross-compilation only).]))
2421 dnl ===================================================================
2422 dnl Check for incompatible options set by fuzzing, and reset those
2423 dnl automatically to working combinations
2424 dnl ===================================================================
2426 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2427         "$enable_dbus" != "$enable_avahi"; then
2428     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2429     enable_avahi=$enable_dbus
2432 add_lopath_after ()
2434     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2435         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2436     fi
2439 add_lopath_before ()
2441     local IFS=${P_SEP}
2442     local path_cleanup
2443     local dir
2444     for dir in $LO_PATH ; do
2445         if test "$dir" != "$1" ; then
2446             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2447         fi
2448     done
2449     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2452 dnl ===================================================================
2453 dnl check for required programs (grep, awk, sed, bash)
2454 dnl ===================================================================
2456 pathmunge ()
2458     if test -n "$1"; then
2459         if test "$build_os" = "cygwin"; then
2460             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2461                 PathFormat "$1"
2462                 new_path=`cygpath -sm "$formatted_path"`
2463             else
2464                 PathFormat "$1"
2465                 new_path=`cygpath -u "$formatted_path"`
2466             fi
2467         else
2468             new_path="$1"
2469         fi
2470         if test "$2" = "after"; then
2471             add_lopath_after "$new_path"
2472         else
2473             add_lopath_before "$new_path"
2474         fi
2475         unset new_path
2476     fi
2479 AC_PROG_AWK
2480 AC_PATH_PROG( AWK, $AWK)
2481 if test -z "$AWK"; then
2482     AC_MSG_ERROR([install awk to run this script])
2485 AC_PATH_PROG(BASH, bash)
2486 if test -z "$BASH"; then
2487     AC_MSG_ERROR([bash not found in \$PATH])
2489 AC_SUBST(BASH)
2491 AC_MSG_CHECKING([for GNU or BSD tar])
2492 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2493     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2494     if test $? -eq 0;  then
2495         GNUTAR=$a
2496         break
2497     fi
2498 done
2499 AC_MSG_RESULT($GNUTAR)
2500 if test -z "$GNUTAR"; then
2501     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2503 AC_SUBST(GNUTAR)
2505 AC_MSG_CHECKING([for tar's option to strip components])
2506 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2507 if test $? -eq 0; then
2508     STRIP_COMPONENTS="--strip-components"
2509 else
2510     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2511     if test $? -eq 0; then
2512         STRIP_COMPONENTS="--strip-path"
2513     else
2514         STRIP_COMPONENTS="unsupported"
2515     fi
2517 AC_MSG_RESULT($STRIP_COMPONENTS)
2518 if test x$STRIP_COMPONENTS = xunsupported; then
2519     AC_MSG_ERROR([you need a tar that is able to strip components.])
2521 AC_SUBST(STRIP_COMPONENTS)
2523 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2524 dnl desktop OSes from "mobile" ones.
2526 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2527 dnl In other words, that when building for an OS that is not a
2528 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2530 dnl Note the direction of the implication; there is no assumption that
2531 dnl cross-compiling would imply a non-desktop OS.
2533 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2534     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2535     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2536     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2539 # Whether to build "avmedia" functionality or not.
2541 if test -z "$enable_avmedia"; then
2542     enable_avmedia=yes
2545 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2546 if test "$enable_avmedia" = yes; then
2547     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2548 else
2549     USE_AVMEDIA_DUMMY='TRUE'
2551 AC_SUBST(USE_AVMEDIA_DUMMY)
2553 # Decide whether to build database connectivity stuff (including
2554 # Base) or not. We probably don't want to on non-desktop OSes.
2555 if test -z "$enable_database_connectivity"; then
2556     # --disable-database-connectivity is unfinished work in progress
2557     # and the iOS test app doesn't link if we actually try to use it.
2558     # if test $_os != iOS -a $_os != Android; then
2559     if test $_os != iOS; then
2560         enable_database_connectivity=yes
2561     fi
2564 if test "$enable_database_connectivity" = yes; then
2565     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2566     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2569 if test -z "$enable_extensions"; then
2570     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2571     if test $_os != iOS; then
2572         enable_extensions=yes
2573     fi
2576 if test "$enable_extensions" = yes; then
2577     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2578     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2581 if test -z "$enable_scripting"; then
2582     # Disable scripting for iOS unless specifically overridden
2583     # with --enable-scripting.
2584     if test $_os != iOS; then
2585         enable_scripting=yes
2586     fi
2589 DISABLE_SCRIPTING=''
2590 if test "$enable_scripting" = yes; then
2591     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2592     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2593 else
2594     DISABLE_SCRIPTING='TRUE'
2595     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2598 if test $_os = iOS -o $_os = Android; then
2599     # Disable dynamic_loading always for iOS and Android
2600     enable_dynamic_loading=no
2601 elif test -z "$enable_dynamic_loading"; then
2602     # Otherwise enable it unless specifically disabled
2603     enable_dynamic_loading=yes
2606 DISABLE_DYNLOADING=''
2607 if test "$enable_dynamic_loading" = yes; then
2608     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2609 else
2610     DISABLE_DYNLOADING='TRUE'
2612 AC_SUBST(DISABLE_DYNLOADING)
2614 # remember SYSBASE value
2615 AC_SUBST(SYSBASE)
2617 dnl ===================================================================
2618 dnl  Sort out various gallery compilation options
2619 dnl ===================================================================
2620 AC_MSG_CHECKING([how to build and package galleries])
2621 if test -n "${with_galleries}"; then
2622     if test "$with_galleries" = "build"; then
2623         WITH_GALLERY_BUILD=TRUE
2624         AC_MSG_RESULT([build from source images internally])
2625     elif test "$with_galleries" = "no"; then
2626         WITH_GALLERY_BUILD=
2627         AC_MSG_RESULT([disable non-internal gallery build])
2628     else
2629         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2630     fi
2631 else
2632     if test $_os != iOS -a $_os != Android; then
2633         WITH_GALLERY_BUILD=TRUE
2634         AC_MSG_RESULT([internal src images for desktop])
2635     else
2636         WITH_GALLERY_BUILD=
2637         AC_MSG_RESULT([disable src image build])
2638     fi
2640 AC_SUBST(WITH_GALLERY_BUILD)
2642 dnl ===================================================================
2643 dnl  Checks if ccache is available
2644 dnl ===================================================================
2645 CCACHE_DEPEND_MODE=
2646 if test "$_os" = "WINNT"; then
2647     # on windows/VC build do not use ccache
2648     CCACHE=""
2649 elif test "$enable_ccache" = "no"; then
2650     CCACHE=""
2651 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2652     case "%$CC%$CXX%" in
2653     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2654     # assume that's good then
2655     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2656         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2657         CCACHE_DEPEND_MODE=1
2658         ;;
2659     *)
2660         AC_PATH_PROG([CCACHE],[ccache],[not found])
2661         if test "$CCACHE" = "not found"; then
2662             CCACHE=""
2663         else
2664             CCACHE_DEPEND_MODE=1
2665             # Need to check for ccache version: otherwise prevents
2666             # caching of the results (like "-x objective-c++" for Mac)
2667             if test $_os = Darwin -o $_os = iOS; then
2668                 # Check ccache version
2669                 AC_MSG_CHECKING([whether version of ccache is suitable])
2670                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2671                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2672                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2673                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2674                 else
2675                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2676                     CCACHE=""
2677                     CCACHE_DEPEND_MODE=
2678                 fi
2679             fi
2680         fi
2681         ;;
2682     esac
2683 else
2684     CCACHE=""
2686 if test "$enable_ccache" = "nodepend"; then
2687     CCACHE_DEPEND_MODE=""
2689 AC_SUBST(CCACHE_DEPEND_MODE)
2691 if test "$CCACHE" != ""; then
2692     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2693     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2694     if test "$ccache_size" = ""; then
2695         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2696         if test "$ccache_size" = ""; then
2697             ccache_size=0
2698         fi
2699         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2700         if test $ccache_size -lt 1024; then
2701             CCACHE=""
2702             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2703             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2704         else
2705             # warn that ccache may be too small for debug build
2706             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2707             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2708         fi
2709     else
2710         if test $ccache_size -lt 5; then
2711             #warn that ccache may be too small for debug build
2712             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2713             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2714         fi
2715     fi
2718 dnl ===================================================================
2719 dnl  Checks for C compiler,
2720 dnl  The check for the C++ compiler is later on.
2721 dnl ===================================================================
2722 if test "$_os" != "WINNT"; then
2723     GCC_HOME_SET="true"
2724     AC_MSG_CHECKING([gcc home])
2725     if test -z "$with_gcc_home"; then
2726         if test "$enable_icecream" = "yes"; then
2727             if test -d "/usr/lib/icecc/bin"; then
2728                 GCC_HOME="/usr/lib/icecc/"
2729             elif test -d "/usr/libexec/icecc/bin"; then
2730                 GCC_HOME="/usr/libexec/icecc/"
2731             elif test -d "/opt/icecream/bin"; then
2732                 GCC_HOME="/opt/icecream/"
2733             else
2734                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2736             fi
2737         else
2738             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2739             GCC_HOME_SET="false"
2740         fi
2741     else
2742         GCC_HOME="$with_gcc_home"
2743     fi
2744     AC_MSG_RESULT($GCC_HOME)
2745     AC_SUBST(GCC_HOME)
2747     if test "$GCC_HOME_SET" = "true"; then
2748         if test -z "$CC"; then
2749             CC="$GCC_HOME/bin/gcc"
2750             CC_BASE="gcc"
2751         fi
2752         if test -z "$CXX"; then
2753             CXX="$GCC_HOME/bin/g++"
2754             CXX_BASE="g++"
2755         fi
2756     fi
2759 COMPATH=`dirname "$CC"`
2760 if test "$COMPATH" = "."; then
2761     AC_PATH_PROGS(COMPATH, $CC)
2762     dnl double square bracket to get single because of M4 quote...
2763     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2765 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2767 dnl ===================================================================
2768 dnl Java support
2769 dnl ===================================================================
2770 AC_MSG_CHECKING([whether to build with Java support])
2771 if test "$with_java" != "no"; then
2772     if test "$DISABLE_SCRIPTING" = TRUE; then
2773         AC_MSG_RESULT([no, overridden by --disable-scripting])
2774         ENABLE_JAVA=""
2775         with_java=no
2776     else
2777         AC_MSG_RESULT([yes])
2778         ENABLE_JAVA="TRUE"
2779         AC_DEFINE(HAVE_FEATURE_JAVA)
2780     fi
2781 else
2782     AC_MSG_RESULT([no])
2783     ENABLE_JAVA=""
2786 AC_SUBST(ENABLE_JAVA)
2788 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2790 dnl ENABLE_JAVA="" indicate no Java support at all
2792 dnl ===================================================================
2793 dnl Check macOS SDK and compiler
2794 dnl ===================================================================
2796 HAVE_MACOS_LD_PLATFORMVERSION=
2797 if test $_os = Darwin; then
2799     # If no --with-macosx-sdk option is given, look for one
2801     # The intent is that for "most" Mac-based developers, a suitable
2802     # SDK will be found automatically without any configure options.
2804     # For developers with a current Xcode, the lowest-numbered SDK
2805     # higher than or equal to the minimum required should be found.
2807     AC_MSG_CHECKING([what macOS SDK to use])
2808     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2809         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2810         if test -d "$MACOSX_SDK_PATH"; then
2811             with_macosx_sdk="${_macosx_sdk}"
2812             break
2813         else
2814             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2815             if test -d "$MACOSX_SDK_PATH"; then
2816                 with_macosx_sdk="${_macosx_sdk}"
2817                 break
2818             fi
2819         fi
2820     done
2821     if test ! -d "$MACOSX_SDK_PATH"; then
2822         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2823     fi
2825     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2827     case $with_macosx_sdk in
2828     10.12)
2829         MACOSX_SDK_VERSION=101200
2830         ;;
2831     10.13)
2832         MACOSX_SDK_VERSION=101300
2833         ;;
2834     10.14)
2835         MACOSX_SDK_VERSION=101400
2836         ;;
2837     10.15)
2838         MACOSX_SDK_VERSION=101500
2839         ;;
2840     *)
2841         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2842         ;;
2843     esac
2845     if test "$with_macosx_version_min_required" = "" ; then
2846         with_macosx_version_min_required="10.10";
2847     fi
2849     if test "$with_macosx_version_max_allowed" = "" ; then
2850         with_macosx_version_max_allowed="$with_macosx_sdk"
2851     fi
2853     # export this so that "xcrun" invocations later return matching values
2854     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2855     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2856     export DEVELOPER_DIR
2857     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2858     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2860     AC_MSG_CHECKING([whether Xcode is new enough])
2861     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2862     my_xcode_ver2=${my_xcode_ver1#Xcode }
2863     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2864     if test "$my_xcode_ver3" -ge 903; then
2865         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2866     else
2867         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2868     fi
2870     case "$with_macosx_version_min_required" in
2871     10.10)
2872         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2873         ;;
2874     10.11)
2875         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2876         ;;
2877     10.12)
2878         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2879         ;;
2880     10.13)
2881         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2882         ;;
2883     10.14)
2884         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2885         ;;
2886     10.15)
2887         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2888         ;;
2889     *)
2890         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2891         ;;
2892     esac
2893     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2895     LIBTOOL=/usr/bin/libtool
2896     INSTALL_NAME_TOOL=install_name_tool
2897     if test -z "$save_CC"; then
2898         stdlib=-stdlib=libc++
2899         if test "$ENABLE_LTO" = TRUE; then
2900             lto=-flto
2901         fi
2903         AC_MSG_CHECKING([what C compiler to use])
2904         CC="`xcrun -find clang`"
2905         CC_BASE=`first_arg_basename "$CC"`
2906         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2907         AC_MSG_RESULT([$CC])
2909         AC_MSG_CHECKING([what C++ compiler to use])
2910         CXX="`xcrun -find clang++`"
2911         CXX_BASE=`first_arg_basename "$CXX"`
2912         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2913         AC_MSG_RESULT([$CXX])
2915         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2916         AR=`xcrun -find ar`
2917         NM=`xcrun -find nm`
2918         STRIP=`xcrun -find strip`
2919         LIBTOOL=`xcrun -find libtool`
2920         RANLIB=`xcrun -find ranlib`
2921     fi
2923     case "$with_macosx_version_max_allowed" in
2924     10.10)
2925         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2926         ;;
2927     10.11)
2928         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2929         ;;
2930     10.12)
2931         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2932         ;;
2933     10.13)
2934         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2935         ;;
2936     10.14)
2937         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2938         ;;
2939     10.15)
2940         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2941         ;;
2942     *)
2943         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2944         ;;
2945     esac
2947     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2948     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2949         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])
2950     else
2951         AC_MSG_RESULT([ok])
2952     fi
2954     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2955     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2956         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2957     else
2958         AC_MSG_RESULT([ok])
2959     fi
2960     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2961     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2963     AC_MSG_CHECKING([whether to do code signing])
2965     if test "$enable_macosx_code_signing" = yes; then
2966         # By default use the first suitable certificate (?).
2968         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2969         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2970         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2971         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2972         # "Developer ID Application" one.
2974         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2975         if test -n "$identity"; then
2976             MACOSX_CODESIGNING_IDENTITY=$identity
2977             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2978             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2979         else
2980             AC_MSG_ERROR([cannot determine identity to use])
2981         fi
2982     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2983         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2984         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2985         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2986     else
2987         AC_MSG_RESULT([no])
2988     fi
2990     AC_MSG_CHECKING([whether to create a Mac App Store package])
2992     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2993         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2994     elif test "$enable_macosx_package_signing" = yes; then
2995         # By default use the first suitable certificate.
2996         # It should be a "3rd Party Mac Developer Installer" one
2998         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2999         if test -n "$identity"; then
3000             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3001             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3002             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3003         else
3004             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3005         fi
3006     elif test -n "$enable_macosx_package_signing"; then
3007         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3008         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3009         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3010     else
3011         AC_MSG_RESULT([no])
3012     fi
3014     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3015         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3016     fi
3018     AC_MSG_CHECKING([whether to sandbox the application])
3020     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3021         AC_MSG_ERROR([macOS sandboxing requires code signing])
3022     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3023         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3024     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3025         ENABLE_MACOSX_SANDBOX=TRUE
3026         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3027         AC_MSG_RESULT([yes])
3028     else
3029         AC_MSG_RESULT([no])
3030     fi
3032     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3033     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3034     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3036     AC_MSG_CHECKING([whether the linker supports -platform_version])
3037     save_LDFLAGS=$LDFLAGS
3038     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3039         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3040     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3041         [AC_MSG_RESULT([yes])
3042          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3043         [AC_MSG_RESULT([no])])
3044     LDFLAGS=$save_LDFLAGS
3046 AC_SUBST(MACOSX_SDK_PATH)
3047 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3048 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3049 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3050 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3051 AC_SUBST(INSTALL_NAME_TOOL)
3052 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3053 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3054 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3055 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3056 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3057 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3059 dnl ===================================================================
3060 dnl Check iOS SDK and compiler
3061 dnl ===================================================================
3063 if test $_os = iOS; then
3064     AC_MSG_CHECKING([what iOS SDK to use])
3065     current_sdk_ver=13.6
3066     older_sdk_vers="13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3067     if test "$enable_ios_simulator" = "yes"; then
3068         platform=iPhoneSimulator
3069         versionmin=-mios-simulator-version-min=12.2
3070     else
3071         platform=iPhoneOS
3072         versionmin=-miphoneos-version-min=12.2
3073     fi
3074     xcode_developer=`xcode-select -print-path`
3076     for sdkver in $current_sdk_ver $older_sdk_vers; do
3077         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3078         if test -d $t; then
3079             sysroot=$t
3080             break
3081         fi
3082     done
3084     if test -z "$sysroot"; then
3085         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3086     fi
3088     AC_MSG_RESULT($sysroot)
3090     # LTO is not really recommended for iOS builds,
3091     # the link time will be astronomical
3092     if test "$ENABLE_LTO" = TRUE; then
3093         lto=-flto
3094     fi
3096     stdlib="-stdlib=libc++"
3098     AC_MSG_CHECKING([what C compiler to use])
3099     CC="`xcrun -find clang`"
3100     CC_BASE=`first_arg_basename "$CC"`
3101     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3102     AC_MSG_RESULT([$CC])
3104     AC_MSG_CHECKING([what C++ compiler to use])
3105     CXX="`xcrun -find clang++`"
3106     CXX_BASE=`first_arg_basename "$CXX"`
3107     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3108     AC_MSG_RESULT([$CXX])
3110     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3111     AR=`xcrun -find ar`
3112     NM=`xcrun -find nm`
3113     STRIP=`xcrun -find strip`
3114     LIBTOOL=`xcrun -find libtool`
3115     RANLIB=`xcrun -find ranlib`
3118 AC_MSG_CHECKING([whether to treat the installation as read-only])
3120 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3121         "$enable_extensions" != yes; then
3122     enable_readonly_installset=yes
3124 if test "$enable_readonly_installset" = yes; then
3125     AC_MSG_RESULT([yes])
3126     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3127 else
3128     AC_MSG_RESULT([no])
3131 dnl ===================================================================
3132 dnl Structure of install set
3133 dnl ===================================================================
3135 if test $_os = Darwin; then
3136     LIBO_BIN_FOLDER=MacOS
3137     LIBO_ETC_FOLDER=Resources
3138     LIBO_LIBEXEC_FOLDER=MacOS
3139     LIBO_LIB_FOLDER=Frameworks
3140     LIBO_LIB_PYUNO_FOLDER=Resources
3141     LIBO_SHARE_FOLDER=Resources
3142     LIBO_SHARE_HELP_FOLDER=Resources/help
3143     LIBO_SHARE_JAVA_FOLDER=Resources/java
3144     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3145     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3146     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3147     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3148     LIBO_URE_BIN_FOLDER=MacOS
3149     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3150     LIBO_URE_LIB_FOLDER=Frameworks
3151     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3152     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3153 elif test $_os = WINNT; then
3154     LIBO_BIN_FOLDER=program
3155     LIBO_ETC_FOLDER=program
3156     LIBO_LIBEXEC_FOLDER=program
3157     LIBO_LIB_FOLDER=program
3158     LIBO_LIB_PYUNO_FOLDER=program
3159     LIBO_SHARE_FOLDER=share
3160     LIBO_SHARE_HELP_FOLDER=help
3161     LIBO_SHARE_JAVA_FOLDER=program/classes
3162     LIBO_SHARE_PRESETS_FOLDER=presets
3163     LIBO_SHARE_READMES_FOLDER=readmes
3164     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3165     LIBO_SHARE_SHELL_FOLDER=program/shell
3166     LIBO_URE_BIN_FOLDER=program
3167     LIBO_URE_ETC_FOLDER=program
3168     LIBO_URE_LIB_FOLDER=program
3169     LIBO_URE_MISC_FOLDER=program
3170     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3171 else
3172     LIBO_BIN_FOLDER=program
3173     LIBO_ETC_FOLDER=program
3174     LIBO_LIBEXEC_FOLDER=program
3175     LIBO_LIB_FOLDER=program
3176     LIBO_LIB_PYUNO_FOLDER=program
3177     LIBO_SHARE_FOLDER=share
3178     LIBO_SHARE_HELP_FOLDER=help
3179     LIBO_SHARE_JAVA_FOLDER=program/classes
3180     LIBO_SHARE_PRESETS_FOLDER=presets
3181     LIBO_SHARE_READMES_FOLDER=readmes
3182     if test "$enable_fuzzers" != yes; then
3183         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3184     else
3185         LIBO_SHARE_RESOURCE_FOLDER=resource
3186     fi
3187     LIBO_SHARE_SHELL_FOLDER=program/shell
3188     LIBO_URE_BIN_FOLDER=program
3189     LIBO_URE_ETC_FOLDER=program
3190     LIBO_URE_LIB_FOLDER=program
3191     LIBO_URE_MISC_FOLDER=program
3192     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3194 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3197 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3198 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3199 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3200 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3201 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3207 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3208 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3209 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3211 # Not all of them needed in config_host.mk, add more if need arises
3212 AC_SUBST(LIBO_BIN_FOLDER)
3213 AC_SUBST(LIBO_ETC_FOLDER)
3214 AC_SUBST(LIBO_LIB_FOLDER)
3215 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3216 AC_SUBST(LIBO_SHARE_FOLDER)
3217 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3218 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3219 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3220 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3221 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3222 AC_SUBST(LIBO_URE_BIN_FOLDER)
3223 AC_SUBST(LIBO_URE_ETC_FOLDER)
3224 AC_SUBST(LIBO_URE_LIB_FOLDER)
3225 AC_SUBST(LIBO_URE_MISC_FOLDER)
3226 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3228 dnl ===================================================================
3229 dnl Windows specific tests and stuff
3230 dnl ===================================================================
3232 reg_get_value()
3234     # Return value: $regvalue
3235     unset regvalue
3237     local _regentry="/proc/registry${1}/${2}"
3238     if test -f "$_regentry"; then
3239         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3240         # Registry keys read via /proc/registry* are always \0 terminated!
3241         local _regvalue=$(tr -d '\0' < "$_regentry")
3242         if test $? -eq 0; then
3243             regvalue=$_regvalue
3244         fi
3245     fi
3248 # Get a value from the 32-bit side of the Registry
3249 reg_get_value_32()
3251     reg_get_value "32" "$1"
3254 # Get a value from the 64-bit side of the Registry
3255 reg_get_value_64()
3257     reg_get_value "64" "$1"
3260 if test "$_os" = "WINNT"; then
3261     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3262     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3263         AC_MSG_RESULT([no])
3264         WINDOWS_SDK_ARCH="x86"
3265     else
3266         AC_MSG_RESULT([yes])
3267         WINDOWS_SDK_ARCH="x64"
3268         BITNESS_OVERRIDE=64
3269     fi
3271 if test "$_os" = "iOS"; then
3272     cross_compiling="yes"
3275 if test "$cross_compiling" = "yes"; then
3276     export CROSS_COMPILING=TRUE
3277 else
3278     CROSS_COMPILING=
3279     BUILD_TYPE="$BUILD_TYPE NATIVE"
3281 AC_SUBST(CROSS_COMPILING)
3283 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3284 # NOTE: must _not_ be used for bundled external libraries!
3285 ISYSTEM=
3286 if test "$GCC" = "yes"; then
3287     AC_MSG_CHECKING( for -isystem )
3288     save_CFLAGS=$CFLAGS
3289     CFLAGS="$CFLAGS -Werror"
3290     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3291     CFLAGS=$save_CFLAGS
3292     if test -n "$ISYSTEM"; then
3293         AC_MSG_RESULT(yes)
3294     else
3295         AC_MSG_RESULT(no)
3296     fi
3298 if test -z "$ISYSTEM"; then
3299     # fall back to using -I
3300     ISYSTEM=-I
3302 AC_SUBST(ISYSTEM)
3304 dnl ===================================================================
3305 dnl  Check which Visual Studio compiler is used
3306 dnl ===================================================================
3308 map_vs_year_to_version()
3310     # Return value: $vsversion
3312     unset vsversion
3314     case $1 in
3315     2017)
3316         vsversion=15;;
3317     2019)
3318         vsversion=16;;
3319     *)
3320         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3321     esac
3324 vs_versions_to_check()
3326     # Args: $1 (optional) : versions to check, in the order of preference
3327     # Return value: $vsversions
3329     unset vsversions
3331     if test -n "$1"; then
3332         map_vs_year_to_version "$1"
3333         vsversions=$vsversion
3334     else
3335         # We accept only 2017
3336         vsversions="15"
3337     fi
3340 win_get_env_from_vsvars32bat()
3342     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3343     # Also seems to be located in another directory under the same name: vsvars32.bat
3344     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3345     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3346     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3347     chmod +x $WRAPPERBATCHFILEPATH
3348     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3349     rm -f $WRAPPERBATCHFILEPATH
3350     printf '%s' "$_win_get_env_from_vsvars32bat"
3353 find_ucrt()
3355     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3356     if test -n "$regvalue"; then
3357         PathFormat "$regvalue"
3358         UCRTSDKDIR=$formatted_path
3359         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3360         UCRTVERSION=$regvalue
3361         # Rest if not exist
3362         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3363           UCRTSDKDIR=
3364         fi
3365     fi
3366     if test -z "$UCRTSDKDIR"; then
3367         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3368         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3369         if test -f "$ide_env_file"; then
3370             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3371             UCRTSDKDIR=$formatted_path
3372             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3373             dnl Hack needed at least by tml:
3374             if test "$UCRTVERSION" = 10.0.15063.0 \
3375                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3376                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3377             then
3378                 UCRTVERSION=10.0.14393.0
3379             fi
3380         else
3381           AC_MSG_ERROR([No UCRT found])
3382         fi
3383     fi
3386 find_msvc()
3388     # Find Visual C++ 2017/2019
3389     # Args: $1 (optional) : The VS version year
3390     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3392     unset vctest vcnum vcnumwithdot vcbuildnumber
3394     vs_versions_to_check "$1"
3395     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3396     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3397     PathFormat "$vswhere"
3398     vswhere=$formatted_path
3399     for ver in $vsversions; do
3400         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3401         if test -n "$vswhereoutput"; then
3402             PathFormat "$vswhereoutput"
3403             vctest=$formatted_path
3404             break
3405         fi
3406     done
3408     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3409     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3410     # should be removed when upgrading baseline.
3411     if ! test -n "$vctest"; then
3412         for ver in $vsversions; do
3413             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3414             if test -n "$regvalue"; then
3415                 vctest=$regvalue
3416                 break
3417             fi
3418             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3419             if test -n "$regvalue"; then
3420                 AC_MSG_RESULT([found: $regvalue])
3421                 PathFormat "$regvalue"
3422                 vctest=$formatted_path
3423                 break
3424             fi
3425         done
3426     fi
3428     if test -n "$vctest"; then
3429         vcnumwithdot="$ver.0"
3430         case "$vcnumwithdot" in
3431         15.0)
3432             vcyear=2017
3433             vcnum=150
3434             ;;
3435         16.0)
3436             vcyear=2019
3437             vcnum=160
3438             ;;
3439         esac
3440         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3442     fi
3445 SOLARINC=
3446 MSBUILD_PATH=
3447 DEVENV=
3448 if test "$_os" = "WINNT"; then
3449     AC_MSG_CHECKING([Visual C++])
3450     find_msvc "$with_visual_studio"
3451     if test -z "$vctest"; then
3452         if test -n "$with_visual_studio"; then
3453             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3454         else
3455             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3456         fi
3457     fi
3459     if test "$BITNESS_OVERRIDE" = ""; then
3460         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3461             VC_PRODUCT_DIR=$vctest/VC
3462         else
3463             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3464         fi
3465     else
3466         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3467             VC_PRODUCT_DIR=$vctest/VC
3468         else
3469             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3470         fi
3471     fi
3472     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3474     AC_MSG_CHECKING([for short pathname of VC product directory])
3475     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3476     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3478     UCRTSDKDIR=
3479     UCRTVERSION=
3481     AC_MSG_CHECKING([for UCRT location])
3482     find_ucrt
3483     # find_ucrt errors out if it doesn't find it
3484     AC_MSG_RESULT([found])
3485     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3486     ucrtincpath_formatted=$formatted_path
3487     # SOLARINC is used for external modules and must be set too.
3488     # And no, it's not sufficient to set SOLARINC only, as configure
3489     # itself doesn't honour it.
3490     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3491     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3492     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3493     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3495     AC_SUBST(UCRTSDKDIR)
3496     AC_SUBST(UCRTVERSION)
3498     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3499     # Find the proper version of MSBuild.exe to use based on the VS version
3500     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3501     if test -n "$regvalue" ; then
3502         AC_MSG_RESULT([found: $regvalue])
3503         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3504     else
3505         if test "$vcnumwithdot" = "16.0"; then
3506             if test "$BITNESS_OVERRIDE" = ""; then
3507                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3508             else
3509                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3510             fi
3511         else
3512             if test "$BITNESS_OVERRIDE" = ""; then
3513                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3514             else
3515                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3516             fi
3517         fi
3518         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3519         AC_MSG_RESULT([$regvalue])
3520     fi
3522     # Find the version of devenv.exe
3523     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3524     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3525     if test ! -e "$DEVENV"; then
3526         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3527     fi
3529     dnl ===========================================================
3530     dnl  Check for the corresponding mspdb*.dll
3531     dnl ===========================================================
3533     VC_HOST_DIR=
3534     MSPDB_PATH=
3535     CL_PATH=
3537     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3538         VC_HOST_DIR="HostX64"
3539         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3540     else
3541         VC_HOST_DIR="HostX86"
3542         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3543     fi
3545     if test "$BITNESS_OVERRIDE" = ""; then
3546         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3547     else
3548         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3549     fi
3551     # MSVC 15.0 has libraries from 14.0?
3552     mspdbnum="140"
3554     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3555         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3556     fi
3558     dnl The path needs to be added before cl is called
3559     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3560     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3562     AC_MSG_CHECKING([cl.exe])
3564     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3565     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3566     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3567     # is not enough?
3569     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3570     dnl needed when building CLR code:
3571     if test -z "$MSVC_CXX"; then
3572         if test -f "$CL_PATH/cl.exe"; then
3573             MSVC_CXX="$CL_PATH/cl.exe"
3574         fi
3576         # This gives us a posix path with 8.3 filename restrictions
3577         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3578     fi
3580     if test -z "$CC"; then
3581         CC=$MSVC_CXX
3582         CC_BASE=`first_arg_basename "$CC"`
3583     fi
3584     if test "$BITNESS_OVERRIDE" = ""; then
3585         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3586         MSVC_CXX="$MSVC_CXX -arch:SSE"
3587     fi
3588     if test -z "$CXX"; then
3589         CXX=$MSVC_CXX
3590         CXX_BASE=`first_arg_basename "$CXX"`
3591     fi
3593     if test -n "$CC"; then
3594         # Remove /cl.exe from CC case insensitive
3595         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3596         if test "$BITNESS_OVERRIDE" = ""; then
3597            COMPATH="$VC_PRODUCT_DIR"
3598         else
3599             if test -n "$VC_PRODUCT_DIR"; then
3600                 COMPATH=$VC_PRODUCT_DIR
3601             fi
3602         fi
3603         if test "$BITNESS_OVERRIDE" = ""; then
3604             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3605             CC="$CC -arch:SSE"
3606         fi
3608         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3610         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3612         PathFormat "$COMPATH"
3613         COMPATH=`win_short_path_for_make "$formatted_path"`
3615         VCVER=$vcnum
3616         MSVSVER=$vcyear
3618         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3619         # are always "better", we list them in reverse chronological order.
3621         case "$vcnum" in
3622         150|160)
3623             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3624             ;;
3625         esac
3627         # The expectation is that --with-windows-sdk should not need to be used
3628         if test -n "$with_windows_sdk"; then
3629             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3630             *" "$with_windows_sdk" "*)
3631                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3632                 ;;
3633             *)
3634                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3635                 ;;
3636             esac
3637         fi
3639         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3640         ac_objext=obj
3641         ac_exeext=exe
3643     else
3644         AC_MSG_ERROR([Visual C++ not found after all, huh])
3645     fi
3647     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3648     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3649         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3650         // between Visual Studio versions and _MSC_VER:
3651         #if _MSC_VER < 1914
3652         #error
3653         #endif
3654     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3656     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3657     # version of the Explorer extension (and maybe other small
3658     # bits, too) needed when installing a 32-bit LibreOffice on a
3659     # 64-bit OS. The 64-bit Explorer extension is a feature that
3660     # has been present since long in OOo. Don't confuse it with
3661     # building LibreOffice itself as 64-bit code.
3663     BUILD_X64=
3664     CXX_X64_BINARY=
3666     if test "$BITNESS_OVERRIDE" = ""; then
3667         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3668         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3669              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3670             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3671                 BUILD_X64=TRUE
3672                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3673             fi
3674         fi
3675         if test "$BUILD_X64" = TRUE; then
3676             AC_MSG_RESULT([found])
3677         else
3678             AC_MSG_RESULT([not found])
3679             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3680         fi
3681     else
3682         CXX_X64_BINARY=$CXX
3683     fi
3684     AC_SUBST(BUILD_X64)
3686     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3687     AC_SUBST(CXX_X64_BINARY)
3689     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3690     # needed to support TWAIN scan on both 32- and 64-bit systems
3692     BUILD_X86=
3694     if test "$BITNESS_OVERRIDE" = "64"; then
3695         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3696         if test -n "$CXX_X86_BINARY"; then
3697             BUILD_X86=TRUE
3698             AC_MSG_RESULT([preset])
3699         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3700             BUILD_X86=TRUE
3701             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3702             CXX_X86_BINARY+=" /arch:SSE"
3703             AC_MSG_RESULT([found])
3704         else
3705             CXX_X86_BINARY=
3706             AC_MSG_RESULT([not found])
3707             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3708         fi
3709     else
3710         BUILD_X86=TRUE
3711         CXX_X86_BINARY=$MSVC_CXX
3712     fi
3713     AC_SUBST(BUILD_X86)
3714     AC_SUBST(CXX_X86_BINARY)
3716 AC_SUBST(VCVER)
3717 AC_SUBST(DEVENV)
3718 AC_SUBST(MSVC_CXX)
3721 # unowinreg.dll
3723 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3724 AC_SUBST(UNOWINREG_DLL)
3726 COM_IS_CLANG=
3727 AC_MSG_CHECKING([whether the compiler is actually Clang])
3728 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3729     #ifndef __clang__
3730     you lose
3731     #endif
3732     int foo=42;
3733     ]])],
3734     [AC_MSG_RESULT([yes])
3735      COM_IS_CLANG=TRUE],
3736     [AC_MSG_RESULT([no])])
3737 AC_SUBST(COM_IS_CLANG)
3739 CC_PLAIN=$CC
3740 CLANGVER=
3741 if test "$COM_IS_CLANG" = TRUE; then
3742     AC_MSG_CHECKING([whether Clang is new enough])
3743     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3744         #if !defined __apple_build_version__
3745         #error
3746         #endif
3747         ]])],
3748         [my_apple_clang=yes],[my_apple_clang=])
3749     if test "$my_apple_clang" = yes; then
3750         AC_MSG_RESULT([assumed yes (Apple Clang)])
3751     else
3752         if test "$_os" = WINNT; then
3753             dnl In which case, assume clang-cl:
3754             my_args="/EP /TC"
3755             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3756             dnl clang-cl:
3757             CC_PLAIN=
3758             for i in $CC; do
3759                 case $i in
3760                 -FIIntrin.h)
3761                     ;;
3762                 *)
3763                     CC_PLAIN="$CC_PLAIN $i"
3764                     ;;
3765                 esac
3766             done
3767         else
3768             my_args="-E -P"
3769         fi
3770         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3771         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3772         CLANGVER=`echo $clang_version \
3773             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3774         if test "$CLANGVER" -ge 50002; then
3775             AC_MSG_RESULT([yes ($clang_version)])
3776         else
3777             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3778         fi
3779         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3780         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3781     fi
3784 SHOWINCLUDES_PREFIX=
3785 if test "$_os" = WINNT; then
3786     dnl We need to guess the prefix of the -showIncludes output, it can be
3787     dnl localized
3788     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3789     echo "#include <stdlib.h>" > conftest.c
3790     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3791         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3792     rm -f conftest.c conftest.obj
3793     if test -z "$SHOWINCLUDES_PREFIX"; then
3794         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3795     else
3796         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3797     fi
3799 AC_SUBST(SHOWINCLUDES_PREFIX)
3802 # prefix C with ccache if needed
3804 if test "$CCACHE" != ""; then
3805     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3807     AC_LANG_PUSH([C])
3808     save_CFLAGS=$CFLAGS
3809     CFLAGS="$CFLAGS --ccache-skip -O2"
3810     dnl an empty program will do, we're checking the compiler flags
3811     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3812                       [use_ccache=yes], [use_ccache=no])
3813     if test $use_ccache = yes; then
3814         AC_MSG_RESULT([yes])
3815     else
3816         CC="$CCACHE $CC"
3817         CC_BASE="ccache $CC_BASE"
3818         AC_MSG_RESULT([no])
3819     fi
3820     CFLAGS=$save_CFLAGS
3821     AC_LANG_POP([C])
3824 # ===================================================================
3825 # check various GCC options that Clang does not support now but maybe
3826 # will somewhen in the future, check them even for GCC, so that the
3827 # flags are set
3828 # ===================================================================
3830 HAVE_GCC_GGDB2=
3831 if test "$GCC" = "yes"; then
3832     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3833     save_CFLAGS=$CFLAGS
3834     CFLAGS="$CFLAGS -Werror -ggdb2"
3835     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3836     CFLAGS=$save_CFLAGS
3837     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3838         AC_MSG_RESULT([yes])
3839     else
3840         AC_MSG_RESULT([no])
3841     fi
3843     if test "$host_cpu" = "m68k"; then
3844         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3845         save_CFLAGS=$CFLAGS
3846         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3847         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3848         CFLAGS=$save_CFLAGS
3849         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3850             AC_MSG_RESULT([yes])
3851         else
3852             AC_MSG_ERROR([no])
3853         fi
3854     fi
3856 AC_SUBST(HAVE_GCC_GGDB2)
3858 dnl ===================================================================
3859 dnl  Test the gcc version
3860 dnl ===================================================================
3861 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3862     AC_MSG_CHECKING([the GCC version])
3863     _gcc_version=`$CC -dumpversion`
3864     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3865         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3866     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3868     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3870     if test "$gcc_full_version" -lt 70000; then
3871         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3872     fi
3873 else
3874     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3875     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3876     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3877     # (which reports itself as GCC 4.2.1).
3878     GCC_VERSION=
3880 AC_SUBST(GCC_VERSION)
3882 dnl Set the ENABLE_DBGUTIL variable
3883 dnl ===================================================================
3884 AC_MSG_CHECKING([whether to build with additional debug utilities])
3885 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3886     ENABLE_DBGUTIL="TRUE"
3887     # this is an extra var so it can have different default on different MSVC
3888     # versions (in case there are version specific problems with it)
3889     MSVC_USE_DEBUG_RUNTIME="TRUE"
3891     AC_MSG_RESULT([yes])
3892     # cppunit and graphite expose STL in public headers
3893     if test "$with_system_cppunit" = "yes"; then
3894         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3895     else
3896         with_system_cppunit=no
3897     fi
3898     if test "$with_system_graphite" = "yes"; then
3899         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3900     else
3901         with_system_graphite=no
3902     fi
3903     if test "$with_system_orcus" = "yes"; then
3904         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3905     else
3906         with_system_orcus=no
3907     fi
3908     if test "$with_system_libcmis" = "yes"; then
3909         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3910     else
3911         with_system_libcmis=no
3912     fi
3913     if test "$with_system_hunspell" = "yes"; then
3914         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3915     else
3916         with_system_hunspell=no
3917     fi
3918     if test "$with_system_gpgmepp" = "yes"; then
3919         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3920     else
3921         with_system_gpgmepp=no
3922     fi
3923     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3924     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3925     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3926     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3927     # of those two is using the system variant:
3928     if test "$with_system_libnumbertext" = "yes"; then
3929         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3930     else
3931         with_system_libnumbertext=no
3932     fi
3933     if test "$with_system_libwps" = "yes"; then
3934         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3935     else
3936         with_system_libwps=no
3937     fi
3938 else
3939     ENABLE_DBGUTIL=""
3940     MSVC_USE_DEBUG_RUNTIME=""
3941     AC_MSG_RESULT([no])
3943 AC_SUBST(ENABLE_DBGUTIL)
3944 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3946 dnl Set the ENABLE_DEBUG variable.
3947 dnl ===================================================================
3948 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3949     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3951 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3952     if test -z "$libo_fuzzed_enable_debug"; then
3953         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3954     else
3955         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3956         enable_debug=yes
3957     fi
3960 AC_MSG_CHECKING([whether to do a debug build])
3961 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3962     ENABLE_DEBUG="TRUE"
3963     if test -n "$ENABLE_DBGUTIL" ; then
3964         AC_MSG_RESULT([yes (dbgutil)])
3965     else
3966         AC_MSG_RESULT([yes])
3967     fi
3968 else
3969     ENABLE_DEBUG=""
3970     AC_MSG_RESULT([no])
3972 AC_SUBST(ENABLE_DEBUG)
3974 dnl ===================================================================
3975 dnl Select the linker to use (gold/lld/ld.bfd).
3976 dnl This is done only after compiler checks (need to know if Clang is
3977 dnl used, for different defaults) and after checking if a debug build
3978 dnl is wanted (non-debug builds get the default linker if not explicitly
3979 dnl specified otherwise).
3980 dnl All checks for linker features/options should come after this.
3981 dnl ===================================================================
3982 check_use_ld()
3984     use_ld=$1
3985     use_ld_fail_if_error=$2
3986     use_ld_ok=
3987     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3988     use_ld_ldflags_save="$LDFLAGS"
3989     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3990     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3991 #include <stdio.h>
3992         ],[
3993 printf ("hello world\n");
3994         ])], USE_LD=$use_ld, [])
3995     if test -n "$USE_LD"; then
3996         AC_MSG_RESULT( yes )
3997         use_ld_ok=yes
3998     else
3999         if test -n "$use_ld_fail_if_error"; then
4000             AC_MSG_ERROR( no )
4001         else
4002             AC_MSG_RESULT( no )
4003         fi
4004     fi
4005     if test -n "$use_ld_ok"; then
4006         dnl keep the value of LDFLAGS
4007         return 0
4008     fi
4009     LDFLAGS="$use_ld_ldflags_save"
4010     return 1
4012 USE_LD=
4013 if test "$enable_ld" != "no"; then
4014     if test "$GCC" = "yes"; then
4015         if test -n "$enable_ld"; then
4016             check_use_ld "$enable_ld" fail_if_error
4017         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4018             dnl non-debug builds default to the default linker
4019             true
4020         elif test -n "$COM_IS_CLANG"; then
4021             check_use_ld lld
4022             if test $? -ne 0; then
4023                 check_use_ld gold
4024             fi
4025         else
4026             # For gcc first try gold, new versions also support lld.
4027             check_use_ld gold
4028             if test $? -ne 0; then
4029                 check_use_ld lld
4030             fi
4031         fi
4032         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4033         rm conftest.out
4034         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4035         if test -z "$ld_used"; then
4036             ld_used="unknown"
4037         fi
4038         AC_MSG_CHECKING([for linker that is used])
4039         AC_MSG_RESULT([$ld_used])
4040         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4041             if echo "$ld_used" | grep -q "^GNU ld"; then
4042                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4043                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4044             fi
4045         fi
4046     else
4047         if test "$enable_ld" = "yes"; then
4048             AC_MSG_ERROR([--enable-ld not supported])
4049         fi
4050     fi
4052 AC_SUBST(USE_LD)
4054 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4055 if test "$GCC" = "yes"; then
4056     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4057     bsymbolic_functions_ldflags_save=$LDFLAGS
4058     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4059     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4060 #include <stdio.h>
4061         ],[
4062 printf ("hello world\n");
4063         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4064     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4065         AC_MSG_RESULT( found )
4066     else
4067         AC_MSG_RESULT( not found )
4068     fi
4069     LDFLAGS=$bsymbolic_functions_ldflags_save
4071 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4074 HAVE_GSPLIT_DWARF=
4075 if test "$enable_split_debug" != no; then
4076     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4077     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4078         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4079         save_CFLAGS=$CFLAGS
4080         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4081         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4082         CFLAGS=$save_CFLAGS
4083         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4084             AC_MSG_RESULT([yes])
4085         else
4086             if test "$enable_split_debug" = yes; then
4087                 AC_MSG_ERROR([no])
4088             else
4089                 AC_MSG_RESULT([no])
4090             fi
4091         fi
4092     fi
4093     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4094         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4095         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4096     fi
4098 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4100 ENABLE_GDB_INDEX=
4101 if test "$enable_gdb_index" != "no"; then
4102     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4103     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4104         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4105         save_CFLAGS=$CFLAGS
4106         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4107         have_ggnu_pubnames=
4108         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4109         if test "$have_ggnu_pubnames" != "TRUE"; then
4110             if test "$enable_gdb_index" = "yes"; then
4111                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4112             else
4113                 AC_MSG_RESULT( no )
4114             fi
4115         else
4116             AC_MSG_RESULT( yes )
4117             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4118             ldflags_save=$LDFLAGS
4119             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4120             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4121 #include <stdio.h>
4122                 ],[
4123 printf ("hello world\n");
4124                 ])], ENABLE_GDB_INDEX=TRUE, [])
4125             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4126                 AC_MSG_RESULT( yes )
4127             else
4128                 if test "$enable_gdb_index" = "yes"; then
4129                     AC_MSG_ERROR( no )
4130                 else
4131                     AC_MSG_RESULT( no )
4132                 fi
4133             fi
4134             LDFLAGS=$ldflags_save
4135         fi
4136         CFLAGS=$save_CFLAGS
4137         fi
4138     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4139         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4140         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4141     fi
4143 AC_SUBST(ENABLE_GDB_INDEX)
4145 if test "$enable_sal_log" = yes; then
4146     ENABLE_SAL_LOG=TRUE
4148 AC_SUBST(ENABLE_SAL_LOG)
4150 dnl Check for enable symbols option
4151 dnl ===================================================================
4152 AC_MSG_CHECKING([whether to generate debug information])
4153 if test -z "$enable_symbols"; then
4154     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4155         enable_symbols=yes
4156     else
4157         enable_symbols=no
4158     fi
4160 if test "$enable_symbols" = yes; then
4161     ENABLE_SYMBOLS_FOR=all
4162     AC_MSG_RESULT([yes])
4163 elif test "$enable_symbols" = no; then
4164     ENABLE_SYMBOLS_FOR=
4165     AC_MSG_RESULT([no])
4166 else
4167     # Selective debuginfo.
4168     ENABLE_SYMBOLS_FOR="$enable_symbols"
4169     AC_MSG_RESULT([for "$enable_symbols"])
4171 AC_SUBST(ENABLE_SYMBOLS_FOR)
4173 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4174     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4175     AC_MSG_CHECKING([whether enough memory is available for linking])
4176     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4177     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4178     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4179         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4180     else
4181         AC_MSG_RESULT([yes])
4182     fi
4185 AC_MSG_CHECKING([whether to compile with optimization flags])
4186 if test -z "$enable_optimized"; then
4187     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4188         enable_optimized=no
4189     else
4190         enable_optimized=yes
4191     fi
4193 if test "$enable_optimized" != no; then
4194     ENABLE_OPTIMIZED=TRUE
4195     AC_MSG_RESULT([yes])
4196 else
4197     ENABLE_OPTIMIZED=
4198     AC_MSG_RESULT([no])
4200 AC_SUBST(ENABLE_OPTIMIZED)
4203 # determine CPUNAME, OS, ...
4204 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4206 case "$host_os" in
4208 aix*)
4209     COM=GCC
4210     CPUNAME=POWERPC
4211     USING_X11=TRUE
4212     OS=AIX
4213     RTL_OS=AIX
4214     RTL_ARCH=PowerPC
4215     PLATFORMID=aix_powerpc
4216     P_SEP=:
4217     ;;
4219 cygwin*)
4220     COM=MSC
4221     USING_X11=
4222     OS=WNT
4223     RTL_OS=Windows
4224     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4225         P_SEP=";"
4226     else
4227         P_SEP=:
4228     fi
4229     case "$host_cpu" in
4230     i*86|x86_64)
4231         if test "$BITNESS_OVERRIDE" = 64; then
4232             CPUNAME=X86_64
4233             RTL_ARCH=X86_64
4234             PLATFORMID=windows_x86_64
4235             WINDOWS_X64=1
4236             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4237         else
4238             CPUNAME=INTEL
4239             RTL_ARCH=x86
4240             PLATFORMID=windows_x86
4241         fi
4242         ;;
4243     *)
4244         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4245         ;;
4246     esac
4247     SCPDEFS="$SCPDEFS -D_MSC_VER"
4248     ;;
4250 darwin*)
4251     COM=GCC
4252     USING_X11=
4253     OS=MACOSX
4254     RTL_OS=MacOSX
4255     P_SEP=:
4257     case "$host_cpu" in
4258     arm)
4259         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4260         ;;
4261     arm64)
4262         OS=iOS
4263         RTL_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     i*86)
4529         CPUNAME=INTEL
4530         RTL_ARCH=x86
4531         PLATFORMID=android_x86
4532         ;;
4533     x86_64)
4534         CPUNAME=X86_64
4535         RTL_ARCH=X86_64
4536         PLATFORMID=android_x86_64
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-gtk3 \
4780         --disable-pdfimport \
4781         --disable-postgresql-sdbc \
4782         --enable-icecream="$enable_icecream" \
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     build_gstreamer_1_0=no
4913     test_kf5=no
4914     test_qt5=no
4915     test_gtk3_kde5=no
4916     enable_cairo_canvas=no
4919 if test "$OS" = "HAIKU"; then
4920     enable_cairo_canvas=yes
4921     test_kf5=yes
4924 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4925     AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!])
4926     add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!"
4927     enable_kf5=yes
4930 if test "$test_kf5" = "yes"; then
4931     test_qt5=yes
4934 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4935     if test "$enable_qt5" = "no"; then
4936         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4937     else
4938         enable_qt5=yes
4939     fi
4942 dnl ===================================================================
4943 dnl check for cups support
4944 dnl ===================================================================
4945 ENABLE_CUPS=""
4947 if test "$enable_cups" = "no"; then
4948     test_cups=no
4951 AC_MSG_CHECKING([whether to enable CUPS support])
4952 if test "$test_cups" = "yes"; then
4953     ENABLE_CUPS="TRUE"
4954     AC_MSG_RESULT([yes])
4956     AC_MSG_CHECKING([whether cups support is present])
4957     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4958     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4959     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4960         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4961     fi
4963 else
4964     AC_MSG_RESULT([no])
4967 AC_SUBST(ENABLE_CUPS)
4969 # fontconfig checks
4970 if test "$test_fontconfig" = "yes"; then
4971     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4972     SYSTEM_FONTCONFIG=TRUE
4973     FilterLibs "${FONTCONFIG_LIBS}"
4974     FONTCONFIG_LIBS="${filteredlibs}"
4976 AC_SUBST(FONTCONFIG_CFLAGS)
4977 AC_SUBST(FONTCONFIG_LIBS)
4978 AC_SUBST([SYSTEM_FONTCONFIG])
4980 dnl whether to find & fetch external tarballs?
4981 dnl ===================================================================
4982 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4983    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4984        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4985    else
4986        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4987    fi
4989 if test -z "$TARFILE_LOCATION"; then
4990     if test -d "$SRC_ROOT/src" ; then
4991         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4992         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4993     fi
4994     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4995 else
4996     AbsolutePath "$TARFILE_LOCATION"
4997     PathFormat "${absolute_path}"
4998     TARFILE_LOCATION="${formatted_path}"
5000 AC_SUBST(TARFILE_LOCATION)
5002 AC_MSG_CHECKING([whether we want to fetch tarballs])
5003 if test "$enable_fetch_external" != "no"; then
5004     if test "$with_all_tarballs" = "yes"; then
5005         AC_MSG_RESULT([yes, all of them])
5006         DO_FETCH_TARBALLS="ALL"
5007     else
5008         AC_MSG_RESULT([yes, if we use them])
5009         DO_FETCH_TARBALLS="TRUE"
5010     fi
5011 else
5012     AC_MSG_RESULT([no])
5013     DO_FETCH_TARBALLS=
5015 AC_SUBST(DO_FETCH_TARBALLS)
5017 AC_MSG_CHECKING([whether to build help])
5018 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5019     BUILD_TYPE="$BUILD_TYPE HELP"
5020     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5021     case "$with_help" in
5022     "html")
5023         ENABLE_HTMLHELP=TRUE
5024         SCPDEFS="$SCPDEFS -DWITH_HELP"
5025         AC_MSG_RESULT([HTML])
5026         ;;
5027     "online")
5028         ENABLE_HTMLHELP=TRUE
5029         HELP_ONLINE=TRUE
5030         AC_MSG_RESULT([HTML])
5031         ;;
5032     yes)
5033         SCPDEFS="$SCPDEFS -DWITH_HELP"
5034         AC_MSG_RESULT([yes])
5035         ;;
5036     *)
5037         AC_MSG_ERROR([Unknown --with-help=$with_help])
5038         ;;
5039     esac
5040 else
5041     AC_MSG_RESULT([no])
5043 AC_SUBST([ENABLE_HTMLHELP])
5044 AC_SUBST([HELP_ONLINE])
5046 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5047 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5048     BUILD_TYPE="$BUILD_TYPE HELP"
5049     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5050     case "$with_omindex" in
5051     "server")
5052         ENABLE_HTMLHELP=TRUE
5053         HELP_ONLINE=TRUE
5054         HELP_OMINDEX_PAGE=TRUE
5055         AC_MSG_RESULT([SERVER])
5056         ;;
5057     "noxap")
5058         ENABLE_HTMLHELP=TRUE
5059         HELP_ONLINE=TRUE
5060         HELP_OMINDEX_PAGE=FALSE
5061         AC_MSG_RESULT([NOXAP])
5062         ;;
5063     *)
5064         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5065         ;;
5066     esac
5067 else
5068     HELP_OMINDEX_PAGE=FALSE
5069     AC_MSG_RESULT([no])
5071 AC_SUBST([ENABLE_HTMLHELP])
5072 AC_SUBST([HELP_OMINDEX_PAGE])
5073 AC_SUBST([HELP_ONLINE])
5076 dnl Test whether to include MySpell dictionaries
5077 dnl ===================================================================
5078 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5079 if test "$with_myspell_dicts" = "yes"; then
5080     AC_MSG_RESULT([yes])
5081     WITH_MYSPELL_DICTS=TRUE
5082     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5083     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5084 else
5085     AC_MSG_RESULT([no])
5086     WITH_MYSPELL_DICTS=
5088 AC_SUBST(WITH_MYSPELL_DICTS)
5090 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5091 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5092     if test "$with_system_dicts" = yes; then
5093         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5094     fi
5095     with_system_dicts=no
5098 AC_MSG_CHECKING([whether to use dicts from external paths])
5099 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5100     AC_MSG_RESULT([yes])
5101     SYSTEM_DICTS=TRUE
5102     AC_MSG_CHECKING([for spelling dictionary directory])
5103     if test -n "$with_external_dict_dir"; then
5104         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5105     else
5106         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5107         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5108             DICT_SYSTEM_DIR=file:///usr/share/myspell
5109         fi
5110     fi
5111     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5112     AC_MSG_CHECKING([for hyphenation patterns directory])
5113     if test -n "$with_external_hyph_dir"; then
5114         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5115     else
5116         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5117     fi
5118     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5119     AC_MSG_CHECKING([for thesaurus directory])
5120     if test -n "$with_external_thes_dir"; then
5121         THES_SYSTEM_DIR=file://$with_external_thes_dir
5122     else
5123         THES_SYSTEM_DIR=file:///usr/share/mythes
5124     fi
5125     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5126 else
5127     AC_MSG_RESULT([no])
5128     SYSTEM_DICTS=
5130 AC_SUBST(SYSTEM_DICTS)
5131 AC_SUBST(DICT_SYSTEM_DIR)
5132 AC_SUBST(HYPH_SYSTEM_DIR)
5133 AC_SUBST(THES_SYSTEM_DIR)
5135 dnl ===================================================================
5136 dnl Precompiled headers.
5137 ENABLE_PCH=""
5138 AC_MSG_CHECKING([whether to enable pch feature])
5139 if test -z "$enable_pch"; then
5140     if test "$_os" = "WINNT"; then
5141         # Enabled by default on Windows.
5142         enable_pch=yes
5143     else
5144         enable_pch=no
5145     fi
5147 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5148     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5150 if test "$enable_pch" = "system"; then
5151     ENABLE_PCH="1"
5152     AC_MSG_RESULT([yes (system headers)])
5153 elif test "$enable_pch" = "base"; then
5154     ENABLE_PCH="2"
5155     AC_MSG_RESULT([yes (system and base headers)])
5156 elif test "$enable_pch" = "normal"; then
5157     ENABLE_PCH="3"
5158     AC_MSG_RESULT([yes (normal)])
5159 elif test "$enable_pch" = "full"; then
5160     ENABLE_PCH="4"
5161     AC_MSG_RESULT([yes (full)])
5162 elif test "$enable_pch" = "yes"; then
5163     # Pick a suitable default.
5164     if test "$GCC" = "yes"; then
5165         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5166         # while making the PCHs larger and rebuilds more likely.
5167         ENABLE_PCH="2"
5168         AC_MSG_RESULT([yes (system and base headers)])
5169     else
5170         # With MSVC the highest level makes a significant difference,
5171         # and it was the default when there used to be no PCH levels.
5172         ENABLE_PCH="4"
5173         AC_MSG_RESULT([yes (full)])
5174     fi
5175 elif test "$enable_pch" = "no"; then
5176     AC_MSG_RESULT([no])
5177 else
5178     AC_MSG_ERROR([Unknown value for --enable-pch])
5180 AC_SUBST(ENABLE_PCH)
5181 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5182 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5183     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5184     if test "$CCACHE_BIN" != "not found"; then
5185         AC_MSG_CHECKING([ccache version])
5186         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5187         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5188         AC_MSG_RESULT([$CCACHE_VERSION])
5189         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5190         if test "$CCACHE_NUMVER" -gt "030701"; then
5191             AC_MSG_RESULT([yes])
5192         else
5193             AC_MSG_RESULT([no (not newer than 3.7.1)])
5194             CCACHE_DEPEND_MODE=
5195         fi
5196     fi
5199 TAB=`printf '\t'`
5201 AC_MSG_CHECKING([the GNU Make version])
5202 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5203 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5204 if test "$_make_longver" -ge "038200"; then
5205     AC_MSG_RESULT([$GNUMAKE $_make_version])
5207 elif test "$_make_longver" -ge "038100"; then
5208     if test "$build_os" = "cygwin"; then
5209         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5210     fi
5211     AC_MSG_RESULT([$GNUMAKE $_make_version])
5213     dnl ===================================================================
5214     dnl Search all the common names for sha1sum
5215     dnl ===================================================================
5216     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5217     if test -z "$SHA1SUM"; then
5218         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5219     elif test "$SHA1SUM" = "openssl"; then
5220         SHA1SUM="openssl sha1"
5221     fi
5222     AC_MSG_CHECKING([for GNU Make bug 20033])
5223     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5224     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5225 A := \$(wildcard *.a)
5227 .PHONY: all
5228 all: \$(A:.a=.b)
5229 <TAB>@echo survived bug20033.
5231 .PHONY: setup
5232 setup:
5233 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5235 define d1
5236 @echo lala \$(1)
5237 @sleep 1
5238 endef
5240 define d2
5241 @echo tyty \$(1)
5242 @sleep 1
5243 endef
5245 %.b : %.a
5246 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5247 <TAB>\$(call d1,\$(CHECKSUM)),\
5248 <TAB>\$(call d2,\$(CHECKSUM)))
5250     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5251         no_parallelism_make="YES"
5252         AC_MSG_RESULT([yes, disable parallelism])
5253     else
5254         AC_MSG_RESULT([no, keep parallelism enabled])
5255     fi
5256     rm -rf $TESTGMAKEBUG20033
5257 else
5258     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5261 # find if gnumake support file function
5262 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5263 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5264 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5265     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5267 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5268 \$(file >test.txt,Success )
5270 .PHONY: all
5271 all:
5272 <TAB>@cat test.txt
5275 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5276 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5277     HAVE_GNUMAKE_FILE_FUNC=TRUE
5278     AC_MSG_RESULT([yes])
5279 else
5280     AC_MSG_RESULT([no])
5282 rm -rf $TESTGMAKEFILEFUNC
5283 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5284 AC_SUBST(GNUMAKE_WIN_NATIVE)
5286 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5287 STALE_MAKE=
5288 if test "$_make_ver_check" = ""; then
5289    STALE_MAKE=TRUE
5292 HAVE_LD_HASH_STYLE=FALSE
5293 WITH_LINKER_HASH_STYLE=
5294 AC_MSG_CHECKING([for --hash-style gcc linker support])
5295 if test "$GCC" = "yes"; then
5296     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5297         hash_styles="gnu sysv"
5298     elif test "$with_linker_hash_style" = "no"; then
5299         hash_styles=
5300     else
5301         hash_styles="$with_linker_hash_style"
5302     fi
5304     for hash_style in $hash_styles; do
5305         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5306         hash_style_ldflags_save=$LDFLAGS
5307         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5309         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5310             [
5311 #include <stdio.h>
5312             ],[
5313 printf ("");
5314             ])],
5315             [
5316                   HAVE_LD_HASH_STYLE=TRUE
5317                   WITH_LINKER_HASH_STYLE=$hash_style
5318             ],
5319             [HAVE_LD_HASH_STYLE=FALSE],
5320             [HAVE_LD_HASH_STYLE=FALSE])
5321         LDFLAGS=$hash_style_ldflags_save
5322     done
5324     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5325         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5326     else
5327         AC_MSG_RESULT( no )
5328     fi
5329     LDFLAGS=$hash_style_ldflags_save
5330 else
5331     AC_MSG_RESULT( no )
5333 AC_SUBST(HAVE_LD_HASH_STYLE)
5334 AC_SUBST(WITH_LINKER_HASH_STYLE)
5336 dnl ===================================================================
5337 dnl Check whether there's a Perl version available.
5338 dnl ===================================================================
5339 if test -z "$with_perl_home"; then
5340     AC_PATH_PROG(PERL, perl)
5341 else
5342     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5343     _perl_path="$with_perl_home/bin/perl"
5344     if test -x "$_perl_path"; then
5345         PERL=$_perl_path
5346     else
5347         AC_MSG_ERROR([$_perl_path not found])
5348     fi
5351 dnl ===================================================================
5352 dnl Testing for Perl version 5 or greater.
5353 dnl $] is the Perl version variable, it is returned as an integer
5354 dnl ===================================================================
5355 if test "$PERL"; then
5356     AC_MSG_CHECKING([the Perl version])
5357     ${PERL} -e "exit($]);"
5358     _perl_version=$?
5359     if test "$_perl_version" -lt 5; then
5360         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5361     fi
5362     AC_MSG_RESULT([Perl $_perl_version])
5363 else
5364     AC_MSG_ERROR([Perl not found, install Perl 5])
5367 dnl ===================================================================
5368 dnl Testing for required Perl modules
5369 dnl ===================================================================
5371 AC_MSG_CHECKING([for required Perl modules])
5372 perl_use_string="use Cwd ; use Digest::MD5"
5373 if test "$_os" = "WINNT"; then
5374     if test -n "$PKGFORMAT"; then
5375         for i in $PKGFORMAT; do
5376             case "$i" in
5377             msi)
5378                 # for getting fonts versions to use in MSI
5379                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5380                 ;;
5381             esac
5382         done
5383     fi
5385 if test "$with_system_hsqldb" = "yes"; then
5386     perl_use_string="$perl_use_string ; use Archive::Zip"
5388 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5389     AC_MSG_RESULT([all modules found])
5390 else
5391     AC_MSG_RESULT([failed to find some modules])
5392     # Find out which modules are missing.
5393     for i in $perl_use_string; do
5394         if test "$i" != "use" -a "$i" != ";"; then
5395             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5396                 missing_perl_modules="$missing_perl_modules $i"
5397             fi
5398         fi
5399     done
5400     AC_MSG_ERROR([
5401     The missing Perl modules are: $missing_perl_modules
5402     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5405 dnl ===================================================================
5406 dnl Check for pkg-config
5407 dnl ===================================================================
5408 if test "$_os" != "WINNT"; then
5409     PKG_PROG_PKG_CONFIG
5412 if test "$_os" != "WINNT"; then
5414     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5415     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5416     # explicitly. Or put /path/to/compiler in PATH yourself.
5418     # Use wrappers for LTO
5419     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5420         AC_CHECK_TOOL(AR,gcc-ar)
5421         AC_CHECK_TOOL(NM,gcc-nm)
5422         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5423     else
5424         AC_CHECK_TOOL(AR,ar)
5425         AC_CHECK_TOOL(NM,nm)
5426         AC_CHECK_TOOL(RANLIB,ranlib)
5427     fi
5428     AC_CHECK_TOOL(OBJDUMP,objdump)
5429     AC_CHECK_TOOL(READELF,readelf)
5430     AC_CHECK_TOOL(STRIP,strip)
5431     if test "$_os" = "WINNT"; then
5432         AC_CHECK_TOOL(DLLTOOL,dlltool)
5433         AC_CHECK_TOOL(WINDRES,windres)
5434     fi
5436 AC_SUBST(AR)
5437 AC_SUBST(DLLTOOL)
5438 AC_SUBST(NM)
5439 AC_SUBST(OBJDUMP)
5440 AC_SUBST(PKG_CONFIG)
5441 AC_SUBST(RANLIB)
5442 AC_SUBST(READELF)
5443 AC_SUBST(STRIP)
5444 AC_SUBST(WINDRES)
5446 dnl ===================================================================
5447 dnl pkg-config checks on macOS
5448 dnl ===================================================================
5450 if test $_os = Darwin; then
5451     AC_MSG_CHECKING([for bogus pkg-config])
5452     if test -n "$PKG_CONFIG"; then
5453         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5454             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5455         else
5456             if test "$enable_bogus_pkg_config" = "yes"; then
5457                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5458             else
5459                 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.])
5460             fi
5461         fi
5462     else
5463         AC_MSG_RESULT([no, good])
5464     fi
5467 find_csc()
5469     # Return value: $csctest
5471     unset csctest
5473     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5474     if test -n "$regvalue"; then
5475         csctest=$regvalue
5476         return
5477     fi
5480 find_al()
5482     # Return value: $altest
5484     unset altest
5486     # We need this check to detect 4.6.1 or above.
5487     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5488         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5489         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5490             altest=$regvalue
5491             return
5492         fi
5493     done
5495     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5496         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5497         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5498             altest=$regvalue
5499             return
5500         fi
5501     done
5506 find_dotnetsdk46()
5508     unset frametest
5510     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5511         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5512         if test -n "$regvalue"; then
5513             frametest=$regvalue
5514             return
5515         fi
5516     done
5519 find_winsdk_version()
5521     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5522     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5524     unset winsdktest winsdkbinsubdir winsdklibsubdir
5526     case "$1" in
5527     8.0|8.0A)
5528         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5529         if test -n "$regvalue"; then
5530             winsdktest=$regvalue
5531             winsdklibsubdir=win8
5532             return
5533         fi
5534         ;;
5535     8.1|8.1A)
5536         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5537         if test -n "$regvalue"; then
5538             winsdktest=$regvalue
5539             winsdklibsubdir=winv6.3
5540             return
5541         fi
5542         ;;
5543     10.0)
5544         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5545         if test -n "$regvalue"; then
5546             winsdktest=$regvalue
5547             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5548             if test -n "$regvalue"; then
5549                 winsdkbinsubdir="$regvalue".0
5550                 winsdklibsubdir=$winsdkbinsubdir
5551                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5552                 # test exist the SDK path
5553                 if test -d "$tmppath"; then
5554                    # when path is convertible to a short path then path is okay
5555                    cygpath -d "$tmppath" >/dev/null 2>&1
5556                    if test $? -ne 0; then
5557                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5558                    fi
5559                 else
5560                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5561                 fi
5562             fi
5563             return
5564         fi
5565         ;;
5566     esac
5569 find_winsdk()
5571     # Return value: From find_winsdk_version
5573     unset winsdktest
5575     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5576         find_winsdk_version $ver
5577         if test -n "$winsdktest"; then
5578             return
5579         fi
5580     done
5583 find_msms()
5585     AC_MSG_CHECKING([for MSVC merge modules directory])
5586     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5587     case "$VCVER" in
5588         150|160)
5589         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5590         ;;
5591     esac
5592     for f in $my_msm_files; do
5593         echo "$as_me:$LINENO: searching for $f" >&5
5594     done
5596     msmdir=
5597     for ver in 14.0 15.0; do
5598         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5599         if test -n "$regvalue"; then
5600             for f in ${my_msm_files}; do
5601                 if test -e "$regvalue/${f}"; then
5602                     msmdir=$regvalue
5603                     break
5604                 fi
5605             done
5606         fi
5607     done
5608     dnl Is the following fallback really necessary, or was it added in response
5609     dnl to never having started Visual Studio on a given machine, so the
5610     dnl registry keys checked above had presumably not yet been created?
5611     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5612     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5613     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5614     dnl expanding to "C:\Program Files\Common Files"), which would need
5615     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5616     dnl obtain its value from cygwin:
5617     if test -z "$msmdir"; then
5618         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5619         for f in ${my_msm_files}; do
5620             if test -e "$my_msm_dir/${f}"; then
5621                 msmdir=$my_msm_dir
5622             fi
5623         done
5624     fi
5626     dnl Starting from MSVC 15.0, merge modules are located in different directory
5627     case "$VCVER" in
5628     150|160)
5629         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5630             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5631             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5632             for f in ${my_msm_files}; do
5633                 if test -e "$my_msm_dir/${f}"; then
5634                     msmdir=$my_msm_dir
5635                     break
5636                 fi
5637             done
5638         done
5639         ;;
5640     esac
5642     if test -n "$msmdir"; then
5643         msmdir=`cygpath -m "$msmdir"`
5644         AC_MSG_RESULT([$msmdir])
5645     else
5646         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5647             AC_MSG_FAILURE([not found])
5648         else
5649             AC_MSG_WARN([not found (check config.log)])
5650             add_warning "MSM none of ${my_msm_files} found"
5651         fi
5652     fi
5655 find_msvc_x64_dlls()
5657     AC_MSG_CHECKING([for MSVC x64 DLL path])
5658     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5659     case "$VCVER" in
5660     150|160)
5661         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5662             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5663             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5664                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5665                 break
5666             fi
5667             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5668             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5669                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5670                 break
5671             fi
5672             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5673             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5674                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5675                 break
5676             fi
5677         done
5678         ;;
5679     esac
5680     AC_MSG_RESULT([$msvcdllpath])
5681     AC_MSG_CHECKING([for MSVC x64 DLLs])
5682     msvcdlls="msvcp140.dll vcruntime140.dll"
5683     for dll in $msvcdlls; do
5684         if ! test -f "$msvcdllpath/$dll"; then
5685             AC_MSG_FAILURE([missing $dll])
5686         fi
5687     done
5688     AC_MSG_RESULT([found all ($msvcdlls)])
5691 dnl =========================================
5692 dnl Check for the Windows  SDK.
5693 dnl =========================================
5694 if test "$_os" = "WINNT"; then
5695     AC_MSG_CHECKING([for Windows SDK])
5696     if test "$build_os" = "cygwin"; then
5697         find_winsdk
5698         WINDOWS_SDK_HOME=$winsdktest
5700         # normalize if found
5701         if test -n "$WINDOWS_SDK_HOME"; then
5702             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5703             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5704         fi
5706         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5707     fi
5709     if test -n "$WINDOWS_SDK_HOME"; then
5710         # Remove a possible trailing backslash
5711         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5713         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5714              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5715              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5716             have_windows_sdk_headers=yes
5717         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5718              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5719              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5720             have_windows_sdk_headers=yes
5721         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5722              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5723              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5724             have_windows_sdk_headers=yes
5725         else
5726             have_windows_sdk_headers=no
5727         fi
5729         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5730             have_windows_sdk_libs=yes
5731         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5732             have_windows_sdk_libs=yes
5733         else
5734             have_windows_sdk_libs=no
5735         fi
5737         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5738             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5739 the  Windows SDK are installed.])
5740         fi
5741     fi
5743     if test -z "$WINDOWS_SDK_HOME"; then
5744         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5745     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5746         WINDOWS_SDK_VERSION=80
5747         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5748     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5749         WINDOWS_SDK_VERSION=81
5750         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5751     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5752         WINDOWS_SDK_VERSION=10
5753         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5754     else
5755         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5756     fi
5757     PathFormat "$WINDOWS_SDK_HOME"
5758     WINDOWS_SDK_HOME="$formatted_path"
5759     if test "$build_os" = "cygwin"; then
5760         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5761         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5762             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5763         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5764             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5765         fi
5766     fi
5768     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5769     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5770     dnl but not in v8.0), so allow this to be overridden with a
5771     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5772     dnl and configuration error if no WiLangId.vbs is found would arguably be
5773     dnl better, but I do not know under which conditions exactly it is needed by
5774     dnl msiglobal.pm:
5775     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5776         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5777         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5778             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5779         fi
5780         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5781             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5782         fi
5783         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5784             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5785         fi
5786     fi
5787     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5788         if test -n "$with_package_format" -a "$with_package_format" != no; then
5789             for i in "$with_package_format"; do
5790                 if test "$i" = "msi"; then
5791                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5792                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5793                     fi
5794                 fi
5795             done
5796         fi
5797     fi
5799 AC_SUBST(WINDOWS_SDK_HOME)
5800 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5801 AC_SUBST(WINDOWS_SDK_VERSION)
5802 AC_SUBST(WINDOWS_SDK_WILANGID)
5804 if test "$build_os" = "cygwin"; then
5805     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5806     dnl dir, it also determines that dir's path w/o an arch segment if any,
5807     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5808     AC_MSG_CHECKING([for midl.exe])
5810     find_winsdk
5811     if test -n "$winsdkbinsubdir" \
5812         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5813     then
5814         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5815         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5816     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5817         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5818         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5819     elif test -f "$winsdktest/Bin/midl.exe"; then
5820         MIDL_PATH=$winsdktest/Bin
5821         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5822     fi
5823     if test ! -f "$MIDL_PATH/midl.exe"; then
5824         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5825     else
5826         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5827     fi
5829     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5830     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5832     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5833          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5834          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5835          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5836     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5837          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5838          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5839          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5840     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5841          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5842          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5843          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5844     else
5845         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5846     fi
5848     dnl Check csc.exe
5849     AC_MSG_CHECKING([for csc.exe])
5850     find_csc
5851     if test -f "$csctest/csc.exe"; then
5852         CSC_PATH="$csctest"
5853     fi
5854     if test ! -f "$CSC_PATH/csc.exe"; then
5855         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5856     else
5857         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5858     fi
5860     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5862     dnl Check al.exe
5863     AC_MSG_CHECKING([for al.exe])
5864     find_winsdk
5865     if test -n "$winsdkbinsubdir" \
5866         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5867     then
5868         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5869     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5870         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5871     elif test -f "$winsdktest/Bin/al.exe"; then
5872         AL_PATH="$winsdktest/Bin"
5873     fi
5875     if test -z "$AL_PATH"; then
5876         find_al
5877         if test -f "$altest/bin/al.exe"; then
5878             AL_PATH="$altest/bin"
5879         elif test -f "$altest/al.exe"; then
5880             AL_PATH="$altest"
5881         fi
5882     fi
5883     if test ! -f "$AL_PATH/al.exe"; then
5884         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5885     else
5886         AC_MSG_RESULT([$AL_PATH/al.exe])
5887     fi
5889     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5891     dnl Check mscoree.lib / .NET Framework dir
5892     AC_MSG_CHECKING(.NET Framework)
5893     find_dotnetsdk46
5894     PathFormat "$frametest"
5895     frametest="$formatted_path"
5896     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5897         DOTNET_FRAMEWORK_HOME="$frametest"
5898     else
5899         find_winsdk
5900         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5901             DOTNET_FRAMEWORK_HOME="$winsdktest"
5902         fi
5903     fi
5904     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
5905         AC_MSG_ERROR([mscoree.lib not found])
5906     fi
5907     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5909     PathFormat "$MIDL_PATH"
5910     MIDL_PATH="$formatted_path"
5912     PathFormat "$AL_PATH"
5913     AL_PATH="$formatted_path"
5915     PathFormat "$DOTNET_FRAMEWORK_HOME"
5916     DOTNET_FRAMEWORK_HOME="$formatted_path"
5918     PathFormat "$CSC_PATH"
5919     CSC_PATH="$formatted_path"
5922 dnl ===================================================================
5923 dnl Check if stdc headers are available excluding MSVC.
5924 dnl ===================================================================
5925 if test "$_os" != "WINNT"; then
5926     AC_HEADER_STDC
5929 dnl ===================================================================
5930 dnl Testing for C++ compiler and version...
5931 dnl ===================================================================
5933 if test "$_os" != "WINNT"; then
5934     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5935     save_CXXFLAGS=$CXXFLAGS
5936     AC_PROG_CXX
5937     CXXFLAGS=$save_CXXFLAGS
5938     if test -z "$CXX_BASE"; then
5939         CXX_BASE=`first_arg_basename "$CXX"`
5940     fi
5943 dnl check for GNU C++ compiler version
5944 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5945     AC_MSG_CHECKING([the GNU C++ compiler version])
5947     _gpp_version=`$CXX -dumpversion`
5948     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5950     if test "$_gpp_majmin" -lt "700"; then
5951         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5952     else
5953         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5954     fi
5956     dnl see https://code.google.com/p/android/issues/detail?id=41770
5957         glibcxx_threads=no
5958         AC_LANG_PUSH([C++])
5959         AC_REQUIRE_CPP
5960         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5961         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5962             #include <bits/c++config.h>]],[[
5963             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5964             && !defined(_GLIBCXX__PTHREADS) \
5965             && !defined(_GLIBCXX_HAS_GTHREADS)
5966             choke me
5967             #endif
5968         ]])],[AC_MSG_RESULT([yes])
5969         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5970         AC_LANG_POP([C++])
5971         if test $glibcxx_threads = yes; then
5972             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5973         fi
5975 AC_SUBST(BOOST_CXXFLAGS)
5978 # prefx CXX with ccache if needed
5980 if test "$CCACHE" != ""; then
5981     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5982     AC_LANG_PUSH([C++])
5983     save_CXXFLAGS=$CXXFLAGS
5984     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5985     dnl an empty program will do, we're checking the compiler flags
5986     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5987                       [use_ccache=yes], [use_ccache=no])
5988     if test $use_ccache = yes; then
5989         AC_MSG_RESULT([yes])
5990     else
5991         CXX="$CCACHE $CXX"
5992         CXX_BASE="ccache $CXX_BASE"
5993         AC_MSG_RESULT([no])
5994     fi
5995     CXXFLAGS=$save_CXXFLAGS
5996     AC_LANG_POP([C++])
5999 dnl ===================================================================
6000 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6001 dnl ===================================================================
6003 if test "$_os" != "WINNT"; then
6004     AC_PROG_CXXCPP
6006     dnl Check whether there's a C pre-processor.
6007     AC_PROG_CPP
6011 dnl ===================================================================
6012 dnl Find integral type sizes and alignments
6013 dnl ===================================================================
6015 if test "$_os" != "WINNT"; then
6017 if test "$_os" = "iOS"; then
6018     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6019     ac_cv_sizeof_long=8
6020     ac_cv_sizeof_short=2
6021     ac_cv_sizeof_int=4
6022     ac_cv_sizeof_long_long=8
6023     ac_cv_sizeof_double=8
6024     ac_cv_sizeof_voidp=8
6025 else
6026     AC_CHECK_SIZEOF(long)
6027     AC_CHECK_SIZEOF(short)
6028     AC_CHECK_SIZEOF(int)
6029     AC_CHECK_SIZEOF(long long)
6030     AC_CHECK_SIZEOF(double)
6031     AC_CHECK_SIZEOF(void*)
6034     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6035     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6036     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6037     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6038     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6040     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6041     m4_pattern_allow([AC_CHECK_ALIGNOF])
6042     m4_ifdef([AC_CHECK_ALIGNOF],
6043         [
6044             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6045             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6046             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6047             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6048         ],
6049         [
6050             case "$_os-$host_cpu" in
6051             Linux-i686)
6052                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6053                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6054                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6055                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6056                 ;;
6057             Linux-x86_64)
6058                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6059                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6060                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6061                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6062                 ;;
6063             *)
6064                 if test -z "$ac_cv_alignof_short" -o \
6065                         -z "$ac_cv_alignof_int" -o \
6066                         -z "$ac_cv_alignof_long" -o \
6067                         -z "$ac_cv_alignof_double"; then
6068                    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.])
6069                 fi
6070                 ;;
6071             esac
6072         ])
6074     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6075     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6076     if test $ac_cv_sizeof_long -eq 8; then
6077         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6078     elif test $ac_cv_sizeof_double -eq 8; then
6079         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6080     else
6081         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6082     fi
6084     dnl Check for large file support
6085     AC_SYS_LARGEFILE
6086     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6087         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6088     fi
6089     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6090         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6091     fi
6092 else
6093     # Hardcode for MSVC
6094     SAL_TYPES_SIZEOFSHORT=2
6095     SAL_TYPES_SIZEOFINT=4
6096     SAL_TYPES_SIZEOFLONG=4
6097     SAL_TYPES_SIZEOFLONGLONG=8
6098     if test "$BITNESS_OVERRIDE" = ""; then
6099         SAL_TYPES_SIZEOFPOINTER=4
6100     else
6101         SAL_TYPES_SIZEOFPOINTER=8
6102     fi
6103     SAL_TYPES_ALIGNMENT2=2
6104     SAL_TYPES_ALIGNMENT4=4
6105     SAL_TYPES_ALIGNMENT8=8
6106     LFS_CFLAGS=''
6108 AC_SUBST(LFS_CFLAGS)
6110 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6111 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6112 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6113 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6114 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6115 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6116 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6117 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6119 dnl ===================================================================
6120 dnl Check whether to enable runtime optimizations
6121 dnl ===================================================================
6122 ENABLE_RUNTIME_OPTIMIZATIONS=
6123 AC_MSG_CHECKING([whether to enable runtime optimizations])
6124 if test -z "$enable_runtime_optimizations"; then
6125     for i in $CC; do
6126         case $i in
6127         -fsanitize=*)
6128             enable_runtime_optimizations=no
6129             break
6130             ;;
6131         esac
6132     done
6134 if test "$enable_runtime_optimizations" != no; then
6135     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6136     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6137     AC_MSG_RESULT([yes])
6138 else
6139     AC_MSG_RESULT([no])
6141 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6143 dnl ===================================================================
6144 dnl Check if valgrind headers are available
6145 dnl ===================================================================
6146 ENABLE_VALGRIND=
6147 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6148     prev_cppflags=$CPPFLAGS
6149     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6150     # or where does it come from?
6151     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6152     AC_CHECK_HEADER([valgrind/valgrind.h],
6153         [ENABLE_VALGRIND=TRUE])
6154     CPPFLAGS=$prev_cppflags
6156 AC_SUBST([ENABLE_VALGRIND])
6157 if test -z "$ENABLE_VALGRIND"; then
6158     if test "$with_valgrind" = yes; then
6159         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6160     fi
6161     VALGRIND_CFLAGS=
6163 AC_SUBST([VALGRIND_CFLAGS])
6166 dnl ===================================================================
6167 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6168 dnl ===================================================================
6170 # We need at least the sys/sdt.h include header.
6171 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6172 if test "$SDT_H_FOUND" = "TRUE"; then
6173     # Found sys/sdt.h header, now make sure the c++ compiler works.
6174     # Old g++ versions had problems with probes in constructors/destructors.
6175     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6176     AC_LANG_PUSH([C++])
6177     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6178     #include <sys/sdt.h>
6179     class ProbeClass
6180     {
6181     private:
6182       int& ref;
6183       const char *name;
6185     public:
6186       ProbeClass(int& v, const char *n) : ref(v), name(n)
6187       {
6188         DTRACE_PROBE2(_test_, cons, name, ref);
6189       }
6191       void method(int min)
6192       {
6193         DTRACE_PROBE3(_test_, meth, name, ref, min);
6194         ref -= min;
6195       }
6197       ~ProbeClass()
6198       {
6199         DTRACE_PROBE2(_test_, dest, name, ref);
6200       }
6201     };
6202     ]],[[
6203     int i = 64;
6204     DTRACE_PROBE1(_test_, call, i);
6205     ProbeClass inst = ProbeClass(i, "call");
6206     inst.method(24);
6207     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6208           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6209     AC_LANG_POP([C++])
6211 AC_CONFIG_HEADERS([config_host/config_probes.h])
6213 dnl ===================================================================
6214 dnl GCC features
6215 dnl ===================================================================
6216 HAVE_GCC_STACK_CLASH_PROTECTION=
6217 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6218     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6219     save_CFLAGS=$CFLAGS
6220     CFLAGS="$CFLAGS -fstack-clash-protection"
6221     AC_LINK_IFELSE(
6222         [AC_LANG_PROGRAM(, [[return 0;]])],
6223         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6224         [AC_MSG_RESULT([no])])
6225     CFLAGS=$save_CFLAGS
6227     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6228     save_CFLAGS=$CFLAGS
6229     CFLAGS="$CFLAGS -Werror -mno-avx"
6230     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6231     CFLAGS=$save_CFLAGS
6232     if test "$HAVE_GCC_AVX" = "TRUE"; then
6233         AC_MSG_RESULT([yes])
6234     else
6235         AC_MSG_RESULT([no])
6236     fi
6238     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6239     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6240     int v = 0;
6241     if (__sync_add_and_fetch(&v, 1) != 1 ||
6242         __sync_sub_and_fetch(&v, 1) != 0)
6243         return 1;
6244     __sync_synchronize();
6245     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6246         v != 1)
6247         return 1;
6248     return 0;
6249 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6250     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6251         AC_MSG_RESULT([yes])
6252         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6253     else
6254         AC_MSG_RESULT([no])
6255     fi
6257     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6258     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6259     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6260         AC_MSG_RESULT([yes])
6261         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6262     else
6263         AC_MSG_RESULT([no])
6264     fi
6266     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6267     save_CFLAGS=$CFLAGS
6268     CFLAGS="$CFLAGS -Werror"
6269     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6270             __attribute__((deprecated("test"))) void f();
6271         ])], [
6272             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6273             AC_MSG_RESULT([yes])
6274         ], [AC_MSG_RESULT([no])])
6275     CFLAGS=$save_CFLAGS
6277     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6278     AC_LANG_PUSH([C++])
6279     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6280             #include <cstddef>
6281             #include <cxxabi.h>
6282             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6283         ])], [
6284             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6285             AC_MSG_RESULT([yes])
6286         ], [AC_MSG_RESULT([no])])
6287     AC_LANG_POP([C++])
6289     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6290     AC_LANG_PUSH([C++])
6291     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6292             #include <cstddef>
6293             #include <cxxabi.h>
6294             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6295         ])], [
6296             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6297             AC_MSG_RESULT([yes])
6298         ], [AC_MSG_RESULT([no])])
6299     AC_LANG_POP([C++])
6301     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6302     AC_LANG_PUSH([C++])
6303     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6304             #include <cxxabi.h>
6305             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6306         ])], [
6307             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6308             AC_MSG_RESULT([yes])
6309         ], [AC_MSG_RESULT([no])])
6310     AC_LANG_POP([C++])
6312     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6313     AC_LANG_PUSH([C++])
6314     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6315             #include <cstddef>
6316             #include <cxxabi.h>
6317             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6318         ])], [
6319             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6320             AC_MSG_RESULT([yes])
6321         ], [AC_MSG_RESULT([no])])
6322     AC_LANG_POP([C++])
6324     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6325     AC_LANG_PUSH([C++])
6326     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6327             #include <cstddef>
6328             #include <cxxabi.h>
6329             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6330         ])], [
6331             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6332             AC_MSG_RESULT([yes])
6333         ], [AC_MSG_RESULT([no])])
6334     AC_LANG_POP([C++])
6336     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6337     AC_LANG_PUSH([C++])
6338     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6339             #include <cxxabi.h>
6340             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6341         ])], [
6342             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6343             AC_MSG_RESULT([yes])
6344         ], [AC_MSG_RESULT([no])])
6345     AC_LANG_POP([C++])
6347     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6348     AC_LANG_PUSH([C++])
6349     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6350             #include <cxxabi.h>
6351             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6352         ])], [
6353             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6354             AC_MSG_RESULT([yes])
6355         ], [AC_MSG_RESULT([no])])
6356     AC_LANG_POP([C++])
6358     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6359     AC_LANG_PUSH([C++])
6360     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6361             #include <cxxabi.h>
6362             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6363         ])], [
6364             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6365             AC_MSG_RESULT([yes])
6366         ], [AC_MSG_RESULT([no])])
6367     AC_LANG_POP([C++])
6369     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6370     AC_LANG_PUSH([C++])
6371     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6372             #include <cstddef>
6373             #include <cxxabi.h>
6374             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6375         ])], [
6376             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6377             AC_MSG_RESULT([yes])
6378         ], [AC_MSG_RESULT([no])])
6379     AC_LANG_POP([C++])
6381     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6382     AC_LANG_PUSH([C++])
6383     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6384             #include <cstddef>
6385             #include <cxxabi.h>
6386             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6387         ])], [
6388             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6389             AC_MSG_RESULT([yes])
6390         ], [AC_MSG_RESULT([no])])
6391     AC_LANG_POP([C++])
6393     dnl Available in GCC 4.9 and at least since Clang 3.4:
6394     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6395     AC_LANG_PUSH([C++])
6396     save_CXXFLAGS=$CXXFLAGS
6397     CXXFLAGS="$CXXFLAGS -Werror"
6398     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6399             struct __attribute__((warn_unused)) dummy {};
6400         ])], [
6401             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6402             AC_MSG_RESULT([yes])
6403         ], [AC_MSG_RESULT([no])])
6404     CXXFLAGS=$save_CXXFLAGS
6405 AC_LANG_POP([C++])
6408 AC_SUBST(HAVE_GCC_AVX)
6409 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6410 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6411 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6413 dnl ===================================================================
6414 dnl Identify the C++ library
6415 dnl ===================================================================
6417 AC_MSG_CHECKING([what the C++ library is])
6418 AC_LANG_PUSH([C++])
6419 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6420 #include <utility>
6421 #ifndef __GLIBCXX__
6422 foo bar
6423 #endif
6424 ]])],
6425     [CPP_LIBRARY=GLIBCXX
6426      cpp_library_name="GNU libstdc++"
6427     ],
6428     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6429 #include <utility>
6430 #ifndef _LIBCPP_VERSION
6431 foo bar
6432 #endif
6433 ]])],
6434     [CPP_LIBRARY=LIBCPP
6435      cpp_library_name="LLVM libc++"
6436      AC_DEFINE([HAVE_LIBCXX])
6437     ],
6438     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6439 #include <utility>
6440 #ifndef _MSC_VER
6441 foo bar
6442 #endif
6443 ]])],
6444     [CPP_LIBRARY=MSVCRT
6445      cpp_library_name="Microsoft"
6446     ],
6447     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6448 AC_MSG_RESULT([$cpp_library_name])
6449 AC_LANG_POP([C++])
6451 dnl ===================================================================
6452 dnl Check for gperf
6453 dnl ===================================================================
6454 AC_PATH_PROG(GPERF, gperf)
6455 if test -z "$GPERF"; then
6456     AC_MSG_ERROR([gperf not found but needed. Install it.])
6458 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6459     GPERF=`cygpath -m $GPERF`
6461 AC_MSG_CHECKING([whether gperf is new enough])
6462 my_gperf_ver1=$($GPERF --version | head -n 1)
6463 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6464 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6465 if test "$my_gperf_ver3" -ge 301; then
6466     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6467 else
6468     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6470 AC_SUBST(GPERF)
6472 dnl ===================================================================
6473 dnl Check for system libcmis
6474 dnl ===================================================================
6475 # libcmis requires curl and we can't build curl for iOS
6476 if test $_os != iOS; then
6477     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6478     ENABLE_LIBCMIS=TRUE
6479 else
6480     ENABLE_LIBCMIS=
6482 AC_SUBST(ENABLE_LIBCMIS)
6484 dnl ===================================================================
6485 dnl C++11
6486 dnl ===================================================================
6488 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6489 CXXFLAGS_CXX11=
6490 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6491     if test "$with_latest_c__" = yes; then
6492         CXXFLAGS_CXX11=-std:c++latest
6493     else
6494         CXXFLAGS_CXX11=-std:c++17
6495     fi
6496     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6497 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6498     my_flags='-std=c++17 -std=c++1z'
6499     if test "$with_latest_c__" = yes; then
6500         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6501     fi
6502     for flag in $my_flags; do
6503         if test "$COM" = MSC; then
6504             flag="-Xclang $flag"
6505         fi
6506         save_CXXFLAGS=$CXXFLAGS
6507         CXXFLAGS="$CXXFLAGS $flag -Werror"
6508         if test "$SYSTEM_LIBCMIS" = TRUE; then
6509             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6510         fi
6511         AC_LANG_PUSH([C++])
6512         dnl Clang 3.9 supports __float128 since
6513         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6514         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6515         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6516         dnl $flag is supported below, so check this first):
6517         my_float128hack=
6518         my_float128hack_impl=-D__float128=void
6519         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6520             #include <vector>
6521             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6522             // (__float128)
6523             ]])
6524         ],,[
6525             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6526             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6527             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6528             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6529             dnl place where __float128 is used is in a template specialization, -D__float128=void
6530             dnl will avoid the problem there while still causing a problem if somebody actually uses
6531             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6532             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6533             dnl "fixed" with this hack):
6534             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6535             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6536                 #include <vector>
6537                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6538                 // (__float128)
6539                 ]])
6540             ],[my_float128hack=$my_float128hack_impl])
6541         ])
6542         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6543             #include <algorithm>
6544             #include <functional>
6545             #include <vector>
6547             #if defined SYSTEM_LIBCMIS
6548             // See ucb/source/ucp/cmis/auth_provider.hxx:
6549             #if !defined __clang__
6550             #pragma GCC diagnostic push
6551             #pragma GCC diagnostic ignored "-Wdeprecated"
6552             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6553             #endif
6554             #include <libcmis/libcmis.hxx>
6555             #if !defined __clang__
6556             #pragma GCC diagnostic pop
6557             #endif
6558             #endif
6560             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6561                 std::sort(v.begin(), v.end(), fn);
6562             }
6563             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6564         AC_LANG_POP([C++])
6565         CXXFLAGS=$save_CXXFLAGS
6566         if test -n "$CXXFLAGS_CXX11"; then
6567             break
6568         fi
6569     done
6571 if test -n "$CXXFLAGS_CXX11"; then
6572     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6573 else
6574     AC_MSG_ERROR(no)
6576 AC_SUBST(CXXFLAGS_CXX11)
6578 if test "$GCC" = "yes"; then
6579     save_CXXFLAGS=$CXXFLAGS
6580     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6581     CHECK_L_ATOMIC
6582     CXXFLAGS=$save_CXXFLAGS
6583     AC_SUBST(ATOMIC_LIB)
6586 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6587 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6588 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6589 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6590 dnl again towards 4.7.2:
6591 if test $CPP_LIBRARY = GLIBCXX; then
6592     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6593     AC_LANG_PUSH([C++])
6594     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6595 #include <list>
6596 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6597     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6598     //   GCC 4.7.0: 20120322
6599     //   GCC 4.7.1: 20120614
6600     // and using a range check is not possible as the mapping between
6601     // __GLIBCXX__ values and GCC versions is not monotonic
6602 /* ok */
6603 #else
6604 abi broken
6605 #endif
6606         ]])], [AC_MSG_RESULT(no, ok)],
6607         [AC_MSG_ERROR(yes)])
6608     AC_LANG_POP([C++])
6611 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6612 save_CXXFLAGS=$CXXFLAGS
6613 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6614 AC_LANG_PUSH([C++])
6616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6617 #include <stddef.h>
6619 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6621 namespace
6623         struct b
6624         {
6625                 int i;
6626                 int j;
6627         };
6629 ]], [[
6630 struct a
6632         int i;
6633         int j;
6635 a thinga[]={{0,0}, {1,1}};
6636 b thingb[]={{0,0}, {1,1}};
6637 size_t i = sizeof(sal_n_array_size(thinga));
6638 size_t j = sizeof(sal_n_array_size(thingb));
6639 return !(i != 0 && j != 0);
6641     ], [ AC_MSG_RESULT(yes) ],
6642     [ AC_MSG_ERROR(no)])
6643 AC_LANG_POP([C++])
6644 CXXFLAGS=$save_CXXFLAGS
6646 dnl _Pragma support (may require C++11)
6647 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6648     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6649     AC_LANG_PUSH([C++])
6650     save_CXXFLAGS=$CXXFLAGS
6651     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6652     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6653             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6654         ])], [
6655             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6656             AC_MSG_RESULT([yes])
6657         ], [AC_MSG_RESULT([no])])
6658     AC_LANG_POP([C++])
6659     CXXFLAGS=$save_CXXFLAGS
6662 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6663 if test "$GCC" = yes; then
6664     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6665     AC_LANG_PUSH([C++])
6666     save_CXXFLAGS=$CXXFLAGS
6667     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6668     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6669     CXXFLAGS=$save_CXXFLAGS
6670     AC_LANG_POP([C++])
6671     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6672         AC_MSG_RESULT([yes])
6673     else
6674         AC_MSG_RESULT([no])
6675     fi
6677 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6679 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6680 AC_LANG_PUSH([C++])
6681 save_CXXFLAGS=$CXXFLAGS
6682 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6683 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6684         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6685         // supporting it:
6686         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6687         struct S {
6688         private:
6689             S(S const &);
6690         public:
6691             S();
6692             ~S();
6693         };
6694         S copy();
6695         void f() { S c(copy()); }
6696         #endif
6697     ])], [
6698         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6699         AC_MSG_RESULT([yes])
6700     ], [AC_MSG_RESULT([no])])
6701 CXXFLAGS=$save_CXXFLAGS
6702 AC_LANG_POP([C++])
6704 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6705 AC_LANG_PUSH([C++])
6706 save_CXXFLAGS=$CXXFLAGS
6707 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6708 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6709         #include <algorithm>
6710         #include <initializer_list>
6711         #include <vector>
6712         template<typename T> class S {
6713         private:
6714             std::vector<T> v_;
6715         public:
6716             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6717         };
6718         constinit S<int> s{3, 2, 1};
6719     ])], [
6720         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6721         AC_MSG_RESULT([yes])
6722     ], [AC_MSG_RESULT([no])])
6723 CXXFLAGS=$save_CXXFLAGS
6724 AC_LANG_POP([C++])
6726 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6727 AC_LANG_PUSH([C++])
6728 save_CXXFLAGS=$CXXFLAGS
6729 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6730 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6731         #include <span>
6732         #include <type_traits>
6733         // Don't check size_type directly, as it was called index_type before P1872R0:
6734         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6735     ])], [
6736         AC_DEFINE([HAVE_CPP_SPAN],[1])
6737         AC_MSG_RESULT([yes])
6738     ], [AC_MSG_RESULT([no])])
6739 CXXFLAGS=$save_CXXFLAGS
6740 AC_LANG_POP([C++])
6742 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6743 AC_LANG_PUSH([C++])
6744 save_CXXFLAGS=$CXXFLAGS
6745 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6746 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6747         struct S1 { S1(S1 &&); };
6748         struct S2: S1 {};
6749         S1 f(S2 s) { return s; }
6750     ])], [
6751         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6752         AC_MSG_RESULT([yes])
6753     ], [AC_MSG_RESULT([no])])
6754 CXXFLAGS=$save_CXXFLAGS
6755 AC_LANG_POP([C++])
6757 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6758 dnl uninitialized warning for code like
6760 dnl   OString f();
6761 dnl   boost::optional<OString> * g(bool b) {
6762 dnl       boost::optional<OString> o;
6763 dnl       if (b) o = f();
6764 dnl       return new boost::optional<OString>(o);
6765 dnl   }
6767 dnl (as is e.g. present, in a slightly more elaborate form, in
6768 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6769 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6770 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6771 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6772     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6773     AC_LANG_PUSH([C++])
6774     save_CXXFLAGS=$CXXFLAGS
6775     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6776     if test "$ENABLE_OPTIMIZED" = TRUE; then
6777         CXXFLAGS="$CXXFLAGS -O2"
6778     else
6779         CXXFLAGS="$CXXFLAGS -O0"
6780     fi
6781     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6782             #include <new>
6783             void f1(int);
6784             struct S1 {
6785                 ~S1() { f1(n); }
6786                 int n = 0;
6787             };
6788             struct S2 {
6789                 S2() {}
6790                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6791                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6792                 void set(S1 s) {
6793                     new (stg) S1(s);
6794                     init = true;
6795                 }
6796                 bool init = false;
6797                 char stg[sizeof (S1)];
6798             } ;
6799             S1 f2();
6800             S2 * f3(bool b) {
6801                 S2 o;
6802                 if (b) o.set(f2());
6803                 return new S2(o);
6804             }
6805         ]])], [AC_MSG_RESULT([no])], [
6806             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6807             AC_MSG_RESULT([yes])
6808         ])
6809     CXXFLAGS=$save_CXXFLAGS
6810     AC_LANG_POP([C++])
6812 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6814 dnl ===================================================================
6815 dnl CPU Intrinsics support - SSE, AVX
6816 dnl ===================================================================
6818 INTRINSICS_CXXFLAGS=""
6820 if test "$GCC" = "yes"; then
6821     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6822     AC_LANG_PUSH([C++])
6823     save_CXXFLAGS=$CXXFLAGS
6824     CXXFLAGS="$CXXFLAGS -msse2"
6825     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6826         #include <emmintrin.h>
6827         int main () {
6828             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6829             c = _mm_xor_si128 (a, b);
6830             return 0;
6831         }
6832         ])],
6833         [can_compile_sse2=yes],
6834         [can_compile_sse2=no])
6835     AC_LANG_POP([C++])
6836     CXXFLAGS=$save_CXXFLAGS
6837     AC_MSG_RESULT([${can_compile_sse2}])
6838     if test "${can_compile_sse2}" = "yes" ; then
6839         INTRINSICS_CXXFLAGS="-msse2"
6840     else
6841         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6842     fi
6844     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6845     AC_LANG_PUSH([C++])
6846     save_CXXFLAGS=$CXXFLAGS
6847     CXXFLAGS="$CXXFLAGS -mssse3"
6848     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6849         #include <tmmintrin.h>
6850         int main () {
6851             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6852             c = _mm_maddubs_epi16 (a, b);
6853             return 0;
6854         }
6855         ])],
6856         [can_compile_ssse3=yes],
6857         [can_compile_ssse3=no])
6858     AC_LANG_POP([C++])
6859     CXXFLAGS=$save_CXXFLAGS
6860     AC_MSG_RESULT([${can_compile_ssse3}])
6861     if test "${can_compile_ssse3}" = "yes" ; then
6862         INTRINSICS_CXXFLAGS="-mssse3"
6863     else
6864         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6865     fi
6867     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6868     AC_LANG_PUSH([C++])
6869     save_CXXFLAGS=$CXXFLAGS
6870     CXXFLAGS="$CXXFLAGS -mavx"
6871     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6872         #include <immintrin.h>
6873         int main () {
6874             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6875             c = _mm256_xor_ps(a, b);
6876             return 0;
6877         }
6878         ])],
6879         [can_compile_avx=yes],
6880         [can_compile_avx=no])
6881     AC_LANG_POP([C++])
6882     CXXFLAGS=$save_CXXFLAGS
6883     AC_MSG_RESULT([${can_compile_avx}])
6884     if test "${can_compile_avx}" = "yes" ; then
6885         INTRINSICS_CXXFLAGS="-mavx"
6886     else
6887         AC_MSG_WARN([cannot compile AVX intrinsics])
6888     fi
6890     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6891     AC_LANG_PUSH([C++])
6892     save_CXXFLAGS=$CXXFLAGS
6893     CXXFLAGS="$CXXFLAGS -mavx2"
6894     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6895         #include <immintrin.h>
6896         int main () {
6897             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6898             c = _mm256_maddubs_epi16(a, b);
6899             return 0;
6900         }
6901         ])],
6902         [can_compile_avx2=yes],
6903         [can_compile_avx2=no])
6904     AC_LANG_POP([C++])
6905     CXXFLAGS=$save_CXXFLAGS
6906     AC_MSG_RESULT([${can_compile_avx2}])
6907     if test "${can_compile_avx2}" = "yes" ; then
6908         INTRINSICS_CXXFLAGS="-mavx2"
6909     else
6910         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6911     fi
6914 AC_SUBST([INTRINSICS_CXXFLAGS])
6916 dnl ===================================================================
6917 dnl system stl sanity tests
6918 dnl ===================================================================
6919 if test "$_os" != "WINNT"; then
6921     AC_LANG_PUSH([C++])
6923     save_CPPFLAGS="$CPPFLAGS"
6924     if test -n "$MACOSX_SDK_PATH"; then
6925         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6926     fi
6928     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6929     # only.
6930     if test "$CPP_LIBRARY" = GLIBCXX; then
6931         dnl gcc#19664, gcc#22482, rhbz#162935
6932         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6933         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6934         AC_MSG_RESULT([$stlvisok])
6935         if test "$stlvisok" = "no"; then
6936             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6937         fi
6938     fi
6940     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6941     # when we don't make any dynamic libraries?
6942     if test "$DISABLE_DYNLOADING" = ""; then
6943         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6944         cat > conftestlib1.cc <<_ACEOF
6945 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6946 struct S2: S1<int> { virtual ~S2(); };
6947 S2::~S2() {}
6948 _ACEOF
6949         cat > conftestlib2.cc <<_ACEOF
6950 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6951 struct S2: S1<int> { virtual ~S2(); };
6952 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6953 _ACEOF
6954         gccvisinlineshiddenok=yes
6955         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6956             gccvisinlineshiddenok=no
6957         else
6958             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6959             dnl known to not work with -z defs (unsetting which makes the test
6960             dnl moot, though):
6961             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6962             if test "$COM_IS_CLANG" = TRUE; then
6963                 for i in $CXX $CXXFLAGS; do
6964                     case $i in
6965                     -fsanitize=*)
6966                         my_linkflagsnoundefs=
6967                         break
6968                         ;;
6969                     esac
6970                 done
6971             fi
6972             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6973                 gccvisinlineshiddenok=no
6974             fi
6975         fi
6977         rm -fr libconftest*
6978         AC_MSG_RESULT([$gccvisinlineshiddenok])
6979         if test "$gccvisinlineshiddenok" = "no"; then
6980             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6981         fi
6982     fi
6984    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6985     cat >visibility.cxx <<_ACEOF
6986 #pragma GCC visibility push(hidden)
6987 struct __attribute__ ((visibility ("default"))) TestStruct {
6988   static void Init();
6990 __attribute__ ((visibility ("default"))) void TestFunc() {
6991   TestStruct::Init();
6993 _ACEOF
6994     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6995         gccvisbroken=yes
6996     else
6997         case "$host_cpu" in
6998         i?86|x86_64)
6999             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7000                 gccvisbroken=no
7001             else
7002                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7003                     gccvisbroken=no
7004                 else
7005                     gccvisbroken=yes
7006                 fi
7007             fi
7008             ;;
7009         *)
7010             gccvisbroken=no
7011             ;;
7012         esac
7013     fi
7014     rm -f visibility.s visibility.cxx
7016     AC_MSG_RESULT([$gccvisbroken])
7017     if test "$gccvisbroken" = "yes"; then
7018         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7019     fi
7021     CPPFLAGS="$save_CPPFLAGS"
7023     AC_LANG_POP([C++])
7026 dnl ===================================================================
7027 dnl  Clang++ tests
7028 dnl ===================================================================
7030 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7031 if test "$GCC" = "yes"; then
7032     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7033     AC_LANG_PUSH([C++])
7034     save_CXXFLAGS=$CXXFLAGS
7035     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7036     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7037     CXXFLAGS=$save_CXXFLAGS
7038     AC_LANG_POP([C++])
7039     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7040         AC_MSG_RESULT([yes])
7041     else
7042         AC_MSG_RESULT([no])
7043     fi
7045 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7047 dnl ===================================================================
7048 dnl Compiler plugins
7049 dnl ===================================================================
7051 COMPILER_PLUGINS=
7052 # currently only Clang
7054 if test "$COM_IS_CLANG" != "TRUE"; then
7055     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7056         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7057         enable_compiler_plugins=no
7058     fi
7061 if test "$COM_IS_CLANG" = "TRUE"; then
7062     if test -n "$enable_compiler_plugins"; then
7063         compiler_plugins="$enable_compiler_plugins"
7064     elif test -n "$ENABLE_DBGUTIL"; then
7065         compiler_plugins=test
7066     else
7067         compiler_plugins=no
7068     fi
7069     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7070         if test "$CLANGVER" -lt 50002; then
7071             if test "$compiler_plugins" = yes; then
7072                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7073             else
7074                 compiler_plugins=no
7075             fi
7076         fi
7077     fi
7078     if test "$compiler_plugins" != "no"; then
7079         dnl The prefix where Clang resides, override to where Clang resides if
7080         dnl using a source build:
7081         if test -z "$CLANGDIR"; then
7082             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7083         fi
7084         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7085         if test -z "$COMPILER_PLUGINS_CXX"; then
7086             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7087         fi
7088         clangbindir=$CLANGDIR/bin
7089         if test "$build_os" = "cygwin"; then
7090             clangbindir=$(cygpath -u "$clangbindir")
7091         fi
7092         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7093         if test -n "$LLVM_CONFIG"; then
7094             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7095             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7096             if test -z "$CLANGLIBDIR"; then
7097                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7098             fi
7099             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7100             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7101             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7102             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7103                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7104             fi
7105             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7106             clangobjdir=$($LLVM_CONFIG --obj-root)
7107             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7108                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7109             fi
7110         fi
7111         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7112         AC_LANG_PUSH([C++])
7113         save_CXX=$CXX
7114         save_CXXCPP=$CXXCPP
7115         save_CPPFLAGS=$CPPFLAGS
7116         save_CXXFLAGS=$CXXFLAGS
7117         save_LDFLAGS=$LDFLAGS
7118         save_LIBS=$LIBS
7119         CXX=$COMPILER_PLUGINS_CXX
7120         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7121         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7122         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7123         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7124             [COMPILER_PLUGINS=TRUE],
7125             [
7126             if test "$compiler_plugins" = "yes"; then
7127                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7128             else
7129                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7130                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7131             fi
7132             ])
7133         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7134         dnl comment in compilerplugins/Makefile-clang.mk:
7135         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7136             LDFLAGS=""
7137             AC_MSG_CHECKING([for clang libraries to use])
7138             if test -z "$CLANGTOOLLIBS"; then
7139                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7140  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7141                 AC_LINK_IFELSE([
7142                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7143                         [[ clang::FullSourceLoc().dump(); ]])
7144                 ],[CLANGTOOLLIBS="$LIBS"],[])
7145             fi
7146             if test -z "$CLANGTOOLLIBS"; then
7147                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7148                 AC_LINK_IFELSE([
7149                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7150                         [[ clang::FullSourceLoc().dump(); ]])
7151                 ],[CLANGTOOLLIBS="$LIBS"],[])
7152             fi
7153             AC_MSG_RESULT([$CLANGTOOLLIBS])
7154             if test -z "$CLANGTOOLLIBS"; then
7155                 if test "$compiler_plugins" = "yes"; then
7156                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7157                 else
7158                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7159                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7160                 fi
7161                 COMPILER_PLUGINS=
7162             fi
7163             if test -n "$COMPILER_PLUGINS"; then
7164                 if test -z "$CLANGSYSINCLUDE"; then
7165                     if test -n "$LLVM_CONFIG"; then
7166                         # Path to the clang system headers (no idea if there's a better way to get it).
7167                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7168                     fi
7169                 fi
7170             fi
7171         fi
7172         CXX=$save_CXX
7173         CXXCPP=$save_CXXCPP
7174         CPPFLAGS=$save_CPPFLAGS
7175         CXXFLAGS=$save_CXXFLAGS
7176         LDFLAGS=$save_LDFLAGS
7177         LIBS="$save_LIBS"
7178         AC_LANG_POP([C++])
7179     fi
7180 else
7181     if test "$enable_compiler_plugins" = "yes"; then
7182         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7183     fi
7185 AC_SUBST(COMPILER_PLUGINS)
7186 AC_SUBST(COMPILER_PLUGINS_CXX)
7187 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7188 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7189 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7190 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7191 AC_SUBST(CLANGDIR)
7192 AC_SUBST(CLANGLIBDIR)
7193 AC_SUBST(CLANGTOOLLIBS)
7194 AC_SUBST(CLANGSYSINCLUDE)
7196 # Plugin to help linker.
7197 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7198 # This makes --enable-lto build with clang work.
7199 AC_SUBST(LD_PLUGIN)
7201 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7202 AC_SUBST(HAVE_POSIX_FALLOCATE)
7204 dnl ===================================================================
7205 dnl Custom build version
7206 dnl ===================================================================
7208 AC_MSG_CHECKING([whether to add custom build version])
7209 if test "$with_build_version" != ""; then
7210     BUILD_VER_STRING=$with_build_version
7211     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7212 else
7213     BUILD_VER_STRING=
7214     AC_MSG_RESULT([no])
7216 AC_SUBST(BUILD_VER_STRING)
7218 JITC_PROCESSOR_TYPE=""
7219 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7220     # IBMs JDK needs this...
7221     JITC_PROCESSOR_TYPE=6
7222     export JITC_PROCESSOR_TYPE
7224 AC_SUBST([JITC_PROCESSOR_TYPE])
7226 # Misc Windows Stuff
7227 AC_ARG_WITH(ucrt-dir,
7228     AS_HELP_STRING([--with-ucrt-dir],
7229         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7230         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7231         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7232             Windows6.1-KB2999226-x64.msu
7233             Windows6.1-KB2999226-x86.msu
7234             Windows8.1-KB2999226-x64.msu
7235             Windows8.1-KB2999226-x86.msu
7236             Windows8-RT-KB2999226-x64.msu
7237             Windows8-RT-KB2999226-x86.msu
7238         A zip archive including those files is available from Microsoft site:
7239         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7241 UCRT_REDISTDIR="$with_ucrt_dir"
7242 if test $_os = "WINNT"; then
7243     find_msvc_x64_dlls
7244     find_msms
7245     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7246     MSVC_DLLS="$msvcdlls"
7247     MSM_PATH=`win_short_path_for_make "$msmdir"`
7248     # MSVC 15.3 changed it to VC141
7249     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7250         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7251     else
7252         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7253     fi
7255     if test "$UCRT_REDISTDIR" = "no"; then
7256         dnl explicitly disabled
7257         UCRT_REDISTDIR=""
7258     else
7259         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7260                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7261                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7262                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7263                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7264                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7265             UCRT_REDISTDIR=""
7266             if test -n "$PKGFORMAT"; then
7267                for i in $PKGFORMAT; do
7268                    case "$i" in
7269                    msi)
7270                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7271                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7272                        ;;
7273                    esac
7274                done
7275             fi
7276         fi
7277     fi
7280 AC_SUBST(UCRT_REDISTDIR)
7281 AC_SUBST(MSVC_DLL_PATH)
7282 AC_SUBST(MSVC_DLLS)
7283 AC_SUBST(MSM_PATH)
7285 dnl ===================================================================
7286 dnl Checks for Java
7287 dnl ===================================================================
7288 if test "$ENABLE_JAVA" != ""; then
7290     # Windows-specific tests
7291     if test "$build_os" = "cygwin"; then
7292         if test "$BITNESS_OVERRIDE" = 64; then
7293             bitness=64
7294         else
7295             bitness=32
7296         fi
7298         if test -z "$with_jdk_home"; then
7299             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7300             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7301             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7302             if test -n "$regvalue"; then
7303                 ver=$regvalue
7304                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7305                 _jdk_home=$regvalue
7306             fi
7307             if test -z "$with_jdk_home"; then
7308                 for ver in 1.8; do
7309                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7310                     if test -n "$regvalue"; then
7311                         _jdk_home=$regvalue
7312                         break
7313                     fi
7314                 done
7315             fi
7316             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7317                 with_jdk_home="$_jdk_home"
7318                 howfound="found automatically"
7319             else
7320                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7321             fi
7322         else
7323             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7324             howfound="you passed"
7325         fi
7326     fi
7328     # 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.
7329     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7330     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7331         with_jdk_home=`/usr/libexec/java_home`
7332     fi
7334     JAVA_HOME=; export JAVA_HOME
7335     if test -z "$with_jdk_home"; then
7336         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7337     else
7338         _java_path="$with_jdk_home/bin/$with_java"
7339         dnl Check if there is a Java interpreter at all.
7340         if test -x "$_java_path"; then
7341             JAVAINTERPRETER=$_java_path
7342         else
7343             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7344         fi
7345     fi
7347     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7348     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7349     dnl loaded by java to run JunitTests:
7350     if test "$build_os" = "cygwin"; then
7351         shortjdkhome=`cygpath -d "$with_jdk_home"`
7352         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
7353             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7354             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7355         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
7356             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7357             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7358         fi
7360         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7361             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7362         fi
7363         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7364     elif test "$cross_compiling" != "yes"; then
7365         case $CPUNAME in
7366             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7367                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7368                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7369                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7370                 fi
7371                 ;;
7372             *) # assumption: everything else 32-bit
7373                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7374                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7375                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7376                 fi
7377                 ;;
7378         esac
7379     fi
7382 dnl ===================================================================
7383 dnl Checks for JDK.
7384 dnl ===================================================================
7386 # Note that JAVA_HOME as for now always means the *build* platform's
7387 # JAVA_HOME. Whether all the complexity here actually is needed any
7388 # more or not, no idea.
7390 if test "$ENABLE_JAVA" != ""; then
7391     _gij_longver=0
7392     AC_MSG_CHECKING([the installed JDK])
7393     if test -n "$JAVAINTERPRETER"; then
7394         dnl java -version sends output to stderr!
7395         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7396             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7397         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7398             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7399         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7400             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7401         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7402             JDK=ibm
7404             dnl IBM JDK specific tests
7405             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7406             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7408             if test "$_jdk_ver" -lt 10800; then
7409                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7410             fi
7412             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7414             if test "$with_jdk_home" = ""; then
7415                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7416 you must use the "--with-jdk-home" configure option explicitly])
7417             fi
7419             JAVA_HOME=$with_jdk_home
7420         else
7421             JDK=sun
7423             dnl Sun JDK specific tests
7424             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7425             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7427             if test "$_jdk_ver" -lt 10800; then
7428                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7429             fi
7430             if test "$_jdk_ver" -gt 10800; then
7431                 JAVA_CLASSPATH_NOT_SET=TRUE
7432             fi
7434             AC_MSG_RESULT([found (JDK $_jdk)])
7435             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7436             if test "$_os" = "WINNT"; then
7437                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7438             fi
7440             # set to limit VM usage for JunitTests
7441             JAVAIFLAGS=-Xmx64M
7442             # set to limit VM usage for javac
7443             JAVAFLAGS=-J-Xmx128M
7444         fi
7445     else
7446         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7447     fi
7448 else
7449     dnl Java disabled
7450     JAVA_HOME=
7451     export JAVA_HOME
7454 dnl ===================================================================
7455 dnl Checks for javac
7456 dnl ===================================================================
7457 if test "$ENABLE_JAVA" != ""; then
7458     javacompiler="javac"
7459     : ${JAVA_SOURCE_VER=8}
7460     : ${JAVA_TARGET_VER=8}
7461     if test -z "$with_jdk_home"; then
7462         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7463     else
7464         _javac_path="$with_jdk_home/bin/$javacompiler"
7465         dnl Check if there is a Java compiler at all.
7466         if test -x "$_javac_path"; then
7467             JAVACOMPILER=$_javac_path
7468         fi
7469     fi
7470     if test -z "$JAVACOMPILER"; then
7471         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7472     fi
7473     if test "$build_os" = "cygwin"; then
7474         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7475             JAVACOMPILER="${JAVACOMPILER}.exe"
7476         fi
7477         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7478     fi
7481 dnl ===================================================================
7482 dnl Checks for javadoc
7483 dnl ===================================================================
7484 if test "$ENABLE_JAVA" != ""; then
7485     if test -z "$with_jdk_home"; then
7486         AC_PATH_PROG(JAVADOC, javadoc)
7487     else
7488         _javadoc_path="$with_jdk_home/bin/javadoc"
7489         dnl Check if there is a javadoc at all.
7490         if test -x "$_javadoc_path"; then
7491             JAVADOC=$_javadoc_path
7492         else
7493             AC_PATH_PROG(JAVADOC, javadoc)
7494         fi
7495     fi
7496     if test -z "$JAVADOC"; then
7497         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7498     fi
7499     if test "$build_os" = "cygwin"; then
7500         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7501             JAVADOC="${JAVADOC}.exe"
7502         fi
7503         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7504     fi
7506     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7507     JAVADOCISGJDOC="yes"
7508     fi
7510 AC_SUBST(JAVADOCISGJDOC)
7512 if test "$ENABLE_JAVA" != ""; then
7513     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7514     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7515         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7516            # try to recover first by looking whether we have an alternative
7517            # system as in Debian or newer SuSEs where following /usr/bin/javac
7518            # over /etc/alternatives/javac leads to the right bindir where we
7519            # just need to strip a bit away to get a valid JAVA_HOME
7520            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7521         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7522             # maybe only one level of symlink (e.g. on Mac)
7523             JAVA_HOME=$(readlink $JAVACOMPILER)
7524             if test "$(dirname $JAVA_HOME)" = "."; then
7525                 # we've got no path to trim back
7526                 JAVA_HOME=""
7527             fi
7528         else
7529             # else warn
7530             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7531             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7532             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7533             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7534         fi
7535         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7536         if test "$JAVA_HOME" != "/usr"; then
7537             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7538                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7539                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7540                 dnl Tiger already returns a JDK path...
7541                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7542             else
7543                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7544                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7545                 dnl that checks which version to run
7546                 if test -f "$JAVA_HOME"; then
7547                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7548                 fi
7549             fi
7550         fi
7551     fi
7552     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7554     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7555     if test -z "$JAVA_HOME"; then
7556         if test "x$with_jdk_home" = "x"; then
7557             cat > findhome.java <<_ACEOF
7558 [import java.io.File;
7560 class findhome
7562     public static void main(String args[])
7563     {
7564         String jrelocation = System.getProperty("java.home");
7565         File jre = new File(jrelocation);
7566         System.out.println(jre.getParent());
7567     }
7569 _ACEOF
7570             AC_MSG_CHECKING([if javac works])
7571             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7572             AC_TRY_EVAL(javac_cmd)
7573             if test $? = 0 -a -f ./findhome.class; then
7574                 AC_MSG_RESULT([javac works])
7575             else
7576                 echo "configure: javac test failed" >&5
7577                 cat findhome.java >&5
7578                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7579             fi
7580             AC_MSG_CHECKING([if gij knows its java.home])
7581             JAVA_HOME=`$JAVAINTERPRETER findhome`
7582             if test $? = 0 -a "$JAVA_HOME" != ""; then
7583                 AC_MSG_RESULT([$JAVA_HOME])
7584             else
7585                 echo "configure: java test failed" >&5
7586                 cat findhome.java >&5
7587                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7588             fi
7589             # clean-up after ourselves
7590             rm -f ./findhome.java ./findhome.class
7591         else
7592             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7593         fi
7594     fi
7596     # now check if $JAVA_HOME is really valid
7597     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7598         case "${JAVA_HOME}" in
7599             /Library/Java/JavaVirtualMachines/*)
7600                 ;;
7601             *)
7602                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7603                 ;;
7604         esac
7605         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7606             JAVA_HOME_OK="NO"
7607         fi
7608     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7609         JAVA_HOME_OK="NO"
7610     fi
7611     if test "$JAVA_HOME_OK" = "NO"; then
7612         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7613         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7614         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7615         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7616         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7617         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7618     fi
7619     PathFormat "$JAVA_HOME"
7620     JAVA_HOME="$formatted_path"
7623 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7624     "$_os" != Darwin
7625 then
7626     AC_MSG_CHECKING([for JAWT lib])
7627     if test "$_os" = WINNT; then
7628         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7629         JAWTLIB=jawt.lib
7630     else
7631         case "$host_cpu" in
7632         arm*)
7633             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7634             JAVA_ARCH=$my_java_arch
7635             ;;
7636         i*86)
7637             my_java_arch=i386
7638             ;;
7639         m68k)
7640             my_java_arch=m68k
7641             ;;
7642         powerpc)
7643             my_java_arch=ppc
7644             ;;
7645         powerpc64)
7646             my_java_arch=ppc64
7647             ;;
7648         powerpc64le)
7649             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7650             JAVA_ARCH=$my_java_arch
7651             ;;
7652         sparc64)
7653             my_java_arch=sparcv9
7654             ;;
7655         x86_64)
7656             my_java_arch=amd64
7657             ;;
7658         *)
7659             my_java_arch=$host_cpu
7660             ;;
7661         esac
7662         # This is where JDK9 puts the library
7663         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7664             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7665         else
7666             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7667         fi
7668         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7669     fi
7670     AC_MSG_RESULT([$JAWTLIB])
7672 AC_SUBST(JAWTLIB)
7674 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7675     case "$host_os" in
7677     aix*)
7678         JAVAINC="-I$JAVA_HOME/include"
7679         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7680         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7681         ;;
7683     cygwin*)
7684         JAVAINC="-I$JAVA_HOME/include/win32"
7685         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7686         ;;
7688     darwin*)
7689         if test -d "$JAVA_HOME/include/darwin"; then
7690             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7691         else
7692             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7693         fi
7694         ;;
7696     dragonfly*)
7697         JAVAINC="-I$JAVA_HOME/include"
7698         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7699         ;;
7701     freebsd*)
7702         JAVAINC="-I$JAVA_HOME/include"
7703         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7704         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7705         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7706         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7707         ;;
7709     k*bsd*-gnu*)
7710         JAVAINC="-I$JAVA_HOME/include"
7711         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7712         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7713         ;;
7715     linux-gnu*)
7716         JAVAINC="-I$JAVA_HOME/include"
7717         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7718         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7719         ;;
7721     *netbsd*)
7722         JAVAINC="-I$JAVA_HOME/include"
7723         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7724         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7725        ;;
7727     openbsd*)
7728         JAVAINC="-I$JAVA_HOME/include"
7729         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7730         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7731         ;;
7733     solaris*)
7734         JAVAINC="-I$JAVA_HOME/include"
7735         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7736         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7737         ;;
7738     esac
7740 SOLARINC="$SOLARINC $JAVAINC"
7742 AC_SUBST(JAVACOMPILER)
7743 AC_SUBST(JAVADOC)
7744 AC_SUBST(JAVAINTERPRETER)
7745 AC_SUBST(JAVAIFLAGS)
7746 AC_SUBST(JAVAFLAGS)
7747 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7748 AC_SUBST(JAVA_HOME)
7749 AC_SUBST(JAVA_SOURCE_VER)
7750 AC_SUBST(JAVA_TARGET_VER)
7751 AC_SUBST(JDK)
7754 dnl ===================================================================
7755 dnl Export file validation
7756 dnl ===================================================================
7757 AC_MSG_CHECKING([whether to enable export file validation])
7758 if test "$with_export_validation" != "no"; then
7759     if test -z "$ENABLE_JAVA"; then
7760         if test "$with_export_validation" = "yes"; then
7761             AC_MSG_ERROR([requested, but Java is disabled])
7762         else
7763             AC_MSG_RESULT([no, as Java is disabled])
7764         fi
7765     elif ! test -d "${SRC_ROOT}/schema"; then
7766         if test "$with_export_validation" = "yes"; then
7767             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7768         else
7769             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7770         fi
7771     else
7772         AC_MSG_RESULT([yes])
7773         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7775         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7776         if test -z "$ODFVALIDATOR"; then
7777             # remember to download the ODF toolkit with validator later
7778             AC_MSG_NOTICE([no odfvalidator found, will download it])
7779             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7780             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7782             # and fetch name of odfvalidator jar name from download.lst
7783             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7784             AC_SUBST(ODFVALIDATOR_JAR)
7786             if test -z "$ODFVALIDATOR_JAR"; then
7787                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7788             fi
7789         fi
7790         if test "$build_os" = "cygwin"; then
7791             # In case of Cygwin it will be executed from Windows,
7792             # so we need to run bash and absolute path to validator
7793             # so instead of "odfvalidator" it will be
7794             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7795             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7796         else
7797             ODFVALIDATOR="sh $ODFVALIDATOR"
7798         fi
7799         AC_SUBST(ODFVALIDATOR)
7802         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7803         if test -z "$OFFICEOTRON"; then
7804             # remember to download the officeotron with validator later
7805             AC_MSG_NOTICE([no officeotron found, will download it])
7806             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7807             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7809             # and fetch name of officeotron jar name from download.lst
7810             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7811             AC_SUBST(OFFICEOTRON_JAR)
7813             if test -z "$OFFICEOTRON_JAR"; then
7814                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7815             fi
7816         else
7817             # check version of existing officeotron
7818             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7819             if test 0"$OFFICEOTRON_VER" -lt 704; then
7820                 AC_MSG_ERROR([officeotron too old])
7821             fi
7822         fi
7823         if test "$build_os" = "cygwin"; then
7824             # In case of Cygwin it will be executed from Windows,
7825             # so we need to run bash and absolute path to validator
7826             # so instead of "odfvalidator" it will be
7827             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7828             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7829         else
7830             OFFICEOTRON="sh $OFFICEOTRON"
7831         fi
7832     fi
7833     AC_SUBST(OFFICEOTRON)
7834 else
7835     AC_MSG_RESULT([no])
7838 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7839 if test "$with_bffvalidator" != "no"; then
7840     AC_DEFINE(HAVE_BFFVALIDATOR)
7842     if test "$with_export_validation" = "no"; then
7843         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7844     fi
7846     if test "$with_bffvalidator" = "yes"; then
7847         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7848     else
7849         BFFVALIDATOR="$with_bffvalidator"
7850     fi
7852     if test "$build_os" = "cygwin"; then
7853         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7854             AC_MSG_RESULT($BFFVALIDATOR)
7855         else
7856             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7857         fi
7858     elif test -n "$BFFVALIDATOR"; then
7859         # We are not in Cygwin but need to run Windows binary with wine
7860         AC_PATH_PROGS(WINE, wine)
7862         # so swap in a shell wrapper that converts paths transparently
7863         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7864         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7865         AC_SUBST(BFFVALIDATOR_EXE)
7866         AC_MSG_RESULT($BFFVALIDATOR)
7867     else
7868         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7869     fi
7870     AC_SUBST(BFFVALIDATOR)
7871 else
7872     AC_MSG_RESULT([no])
7875 dnl ===================================================================
7876 dnl Check for C preprocessor to use
7877 dnl ===================================================================
7878 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7879 if test -n "$with_idlc_cpp"; then
7880     AC_MSG_RESULT([$with_idlc_cpp])
7881     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7882 else
7883     AC_MSG_RESULT([ucpp])
7884     AC_MSG_CHECKING([which ucpp tp use])
7885     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7886         AC_MSG_RESULT([external])
7887         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7888     else
7889         AC_MSG_RESULT([internal])
7890         BUILD_TYPE="$BUILD_TYPE UCPP"
7891     fi
7893 AC_SUBST(SYSTEM_UCPP)
7895 dnl ===================================================================
7896 dnl Check for epm (not needed for Windows)
7897 dnl ===================================================================
7898 AC_MSG_CHECKING([whether to enable EPM for packing])
7899 if test "$enable_epm" = "yes"; then
7900     AC_MSG_RESULT([yes])
7901     if test "$_os" != "WINNT"; then
7902         if test $_os = Darwin; then
7903             EPM=internal
7904         elif test -n "$with_epm"; then
7905             EPM=$with_epm
7906         else
7907             AC_PATH_PROG(EPM, epm, no)
7908         fi
7909         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7910             AC_MSG_NOTICE([EPM will be built.])
7911             BUILD_TYPE="$BUILD_TYPE EPM"
7912             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7913         else
7914             # Gentoo has some epm which is something different...
7915             AC_MSG_CHECKING([whether the found epm is the right epm])
7916             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7917                 AC_MSG_RESULT([yes])
7918             else
7919                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7920             fi
7921             AC_MSG_CHECKING([epm version])
7922             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7923             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7924                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7925                 AC_MSG_RESULT([OK, >= 3.7])
7926             else
7927                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7928                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7929             fi
7930         fi
7931     fi
7933     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7934         AC_MSG_CHECKING([for rpm])
7935         for a in "$RPM" rpmbuild rpm; do
7936             $a --usage >/dev/null 2> /dev/null
7937             if test $? -eq 0; then
7938                 RPM=$a
7939                 break
7940             else
7941                 $a --version >/dev/null 2> /dev/null
7942                 if test $? -eq 0; then
7943                     RPM=$a
7944                     break
7945                 fi
7946             fi
7947         done
7948         if test -z "$RPM"; then
7949             AC_MSG_ERROR([not found])
7950         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7951             RPM_PATH=`which $RPM`
7952             AC_MSG_RESULT([$RPM_PATH])
7953             SCPDEFS="$SCPDEFS -DWITH_RPM"
7954         else
7955             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7956         fi
7957     fi
7958     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7959         AC_PATH_PROG(DPKG, dpkg, no)
7960         if test "$DPKG" = "no"; then
7961             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7962         fi
7963     fi
7964     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7965        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7966         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7967             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7968                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7969                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7970                     AC_MSG_RESULT([yes])
7971                 else
7972                     AC_MSG_RESULT([no])
7973                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7974                         _pt="rpm"
7975                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7976                         add_warning "the rpms will need to be installed with --nodeps"
7977                     else
7978                         _pt="pkg"
7979                     fi
7980                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7981                     add_warning "the ${_pt}s will not be relocatable"
7982                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7983                                  relocation will work, you need to patch your epm with the
7984                                  patch in epm/epm-3.7.patch or build with
7985                                  --with-epm=internal which will build a suitable epm])
7986                 fi
7987             fi
7988         fi
7989     fi
7990     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7991         AC_PATH_PROG(PKGMK, pkgmk, no)
7992         if test "$PKGMK" = "no"; then
7993             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7994         fi
7995     fi
7996     AC_SUBST(RPM)
7997     AC_SUBST(DPKG)
7998     AC_SUBST(PKGMK)
7999 else
8000     for i in $PKGFORMAT; do
8001         case "$i" in
8002         aix | bsd | deb | pkg | rpm | native | portable)
8003             AC_MSG_ERROR(
8004                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8005             ;;
8006         esac
8007     done
8008     AC_MSG_RESULT([no])
8009     EPM=NO
8011 AC_SUBST(EPM)
8013 ENABLE_LWP=
8014 if test "$enable_lotuswordpro" = "yes"; then
8015     ENABLE_LWP="TRUE"
8017 AC_SUBST(ENABLE_LWP)
8019 dnl ===================================================================
8020 dnl Check for building ODK
8021 dnl ===================================================================
8022 if test "$enable_odk" = no; then
8023     unset DOXYGEN
8024 else
8025     if test "$with_doxygen" = no; then
8026         AC_MSG_CHECKING([for doxygen])
8027         unset DOXYGEN
8028         AC_MSG_RESULT([no])
8029     else
8030         if test "$with_doxygen" = yes; then
8031             AC_PATH_PROG([DOXYGEN], [doxygen])
8032             if test -z "$DOXYGEN"; then
8033                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8034             fi
8035             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8036                 if ! dot -V 2>/dev/null; then
8037                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8038                 fi
8039             fi
8040         else
8041             AC_MSG_CHECKING([for doxygen])
8042             DOXYGEN=$with_doxygen
8043             AC_MSG_RESULT([$DOXYGEN])
8044         fi
8045         if test -n "$DOXYGEN"; then
8046             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8047             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8048             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8049                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8050             fi
8051         fi
8052     fi
8054 AC_SUBST([DOXYGEN])
8056 AC_MSG_CHECKING([whether to build the ODK])
8057 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8058     AC_MSG_RESULT([yes])
8060     if test "$with_java" != "no"; then
8061         AC_MSG_CHECKING([whether to build unowinreg.dll])
8062         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8063             # build on Win by default
8064             enable_build_unowinreg=yes
8065         fi
8066         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8067             AC_MSG_RESULT([no])
8068             BUILD_UNOWINREG=
8069         else
8070             AC_MSG_RESULT([yes])
8071             BUILD_UNOWINREG=TRUE
8072         fi
8073         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8074             if test -z "$with_mingw_cross_compiler"; then
8075                 dnl Guess...
8076                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8077             elif test -x "$with_mingw_cross_compiler"; then
8078                  MINGWCXX="$with_mingw_cross_compiler"
8079             else
8080                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8081             fi
8083             if test "$MINGWCXX" = "false"; then
8084                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8085             fi
8087             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8088             if test -x "$mingwstrip_test"; then
8089                 MINGWSTRIP="$mingwstrip_test"
8090             else
8091                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8092             fi
8094             if test "$MINGWSTRIP" = "false"; then
8095                 AC_MSG_ERROR(MinGW32 binutils not found.)
8096             fi
8097         fi
8098     fi
8099     BUILD_TYPE="$BUILD_TYPE ODK"
8100 else
8101     AC_MSG_RESULT([no])
8102     BUILD_UNOWINREG=
8104 AC_SUBST(BUILD_UNOWINREG)
8105 AC_SUBST(MINGWCXX)
8106 AC_SUBST(MINGWSTRIP)
8108 dnl ===================================================================
8109 dnl Check for system zlib
8110 dnl ===================================================================
8111 if test "$with_system_zlib" = "auto"; then
8112     case "$_os" in
8113     WINNT)
8114         with_system_zlib="$with_system_libs"
8115         ;;
8116     *)
8117         if test "$enable_fuzzers" != "yes"; then
8118             with_system_zlib=yes
8119         else
8120             with_system_zlib=no
8121         fi
8122         ;;
8123     esac
8126 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8127 dnl and has no pkg-config for it at least on some tinderboxes,
8128 dnl so leaving that out for now
8129 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8130 AC_MSG_CHECKING([which zlib to use])
8131 if test "$with_system_zlib" = "yes"; then
8132     AC_MSG_RESULT([external])
8133     SYSTEM_ZLIB=TRUE
8134     AC_CHECK_HEADER(zlib.h, [],
8135         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8136     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8137         [AC_MSG_ERROR(zlib not found or functional)], [])
8138 else
8139     AC_MSG_RESULT([internal])
8140     SYSTEM_ZLIB=
8141     BUILD_TYPE="$BUILD_TYPE ZLIB"
8142     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8143     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8145 AC_SUBST(ZLIB_CFLAGS)
8146 AC_SUBST(ZLIB_LIBS)
8147 AC_SUBST(SYSTEM_ZLIB)
8149 dnl ===================================================================
8150 dnl Check for system jpeg
8151 dnl ===================================================================
8152 AC_MSG_CHECKING([which libjpeg to use])
8153 if test "$with_system_jpeg" = "yes"; then
8154     AC_MSG_RESULT([external])
8155     SYSTEM_LIBJPEG=TRUE
8156     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8157         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8158     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8159         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8160 else
8161     SYSTEM_LIBJPEG=
8162     AC_MSG_RESULT([internal, libjpeg-turbo])
8163     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8164     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8165     if test "$COM" = "MSC"; then
8166         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8167     else
8168         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8169     fi
8171     case "$host_cpu" in
8172     x86_64 | amd64 | i*86 | x86 | ia32)
8173         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8174         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8175             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8176                 NASM="$LODE_HOME/opt/bin/nasm"
8177             elif test -x "/opt/lo/bin/nasm"; then
8178                 NASM="/opt/lo/bin/nasm"
8179             fi
8180         fi
8182         if test -n "$NASM"; then
8183             AC_MSG_CHECKING([for object file format of host system])
8184             case "$host_os" in
8185               cygwin* | mingw* | pw32* | interix*)
8186                 case "$host_cpu" in
8187                   x86_64)
8188                     objfmt='Win64-COFF'
8189                     ;;
8190                   *)
8191                     objfmt='Win32-COFF'
8192                     ;;
8193                 esac
8194               ;;
8195               msdosdjgpp* | go32*)
8196                 objfmt='COFF'
8197               ;;
8198               os2-emx*) # not tested
8199                 objfmt='MSOMF' # obj
8200               ;;
8201               linux*coff* | linux*oldld*)
8202                 objfmt='COFF' # ???
8203               ;;
8204               linux*aout*)
8205                 objfmt='a.out'
8206               ;;
8207               linux*)
8208                 case "$host_cpu" in
8209                   x86_64)
8210                     objfmt='ELF64'
8211                     ;;
8212                   *)
8213                     objfmt='ELF'
8214                     ;;
8215                 esac
8216               ;;
8217               kfreebsd* | freebsd* | netbsd* | openbsd*)
8218                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8219                   objfmt='BSD-a.out'
8220                 else
8221                   case "$host_cpu" in
8222                     x86_64 | amd64)
8223                       objfmt='ELF64'
8224                       ;;
8225                     *)
8226                       objfmt='ELF'
8227                       ;;
8228                   esac
8229                 fi
8230               ;;
8231               solaris* | sunos* | sysv* | sco*)
8232                 case "$host_cpu" in
8233                   x86_64)
8234                     objfmt='ELF64'
8235                     ;;
8236                   *)
8237                     objfmt='ELF'
8238                     ;;
8239                 esac
8240               ;;
8241               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8242                 case "$host_cpu" in
8243                   x86_64)
8244                     objfmt='Mach-O64'
8245                     ;;
8246                   *)
8247                     objfmt='Mach-O'
8248                     ;;
8249                 esac
8250               ;;
8251               *)
8252                 objfmt='ELF ?'
8253               ;;
8254             esac
8256             AC_MSG_RESULT([$objfmt])
8257             if test "$objfmt" = 'ELF ?'; then
8258               objfmt='ELF'
8259               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8260             fi
8262             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8263             case "$objfmt" in
8264               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8265               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8266               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8267               COFF)       NAFLAGS='-fcoff -DCOFF';;
8268               a.out)      NAFLAGS='-faout -DAOUT';;
8269               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8270               ELF)        NAFLAGS='-felf -DELF';;
8271               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8272               RDF)        NAFLAGS='-frdf -DRDF';;
8273               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8274               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8275             esac
8276             AC_MSG_RESULT([$NAFLAGS])
8278             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8279             cat > conftest.asm << EOF
8280             [%line __oline__ "configure"
8281                     section .text
8282                     global  _main,main
8283             _main:
8284             main:   xor     eax,eax
8285                     ret
8286             ]
8288             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8289             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8290               AC_MSG_RESULT(yes)
8291             else
8292               echo "configure: failed program was:" >&AC_FD_CC
8293               cat conftest.asm >&AC_FD_CC
8294               rm -rf conftest*
8295               AC_MSG_RESULT(no)
8296               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8297               NASM=""
8298             fi
8300         fi
8302         if test -z "$NASM"; then
8303 cat << _EOS
8304 ****************************************************************************
8305 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8306 To get one please:
8308 _EOS
8309             if test "$build_os" = "cygwin"; then
8310 cat << _EOS
8311 install a pre-compiled binary for Win32
8313 mkdir -p /opt/lo/bin
8314 cd /opt/lo/bin
8315 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8316 chmod +x nasm
8318 or get and install one from http://www.nasm.us/
8320 Then re-run autogen.sh
8322 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8323 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8325 _EOS
8326             else
8327 cat << _EOS
8328 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8330 _EOS
8331             fi
8332             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8333             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8334         fi
8335       ;;
8336     esac
8339 AC_SUBST(NASM)
8340 AC_SUBST(LIBJPEG_CFLAGS)
8341 AC_SUBST(LIBJPEG_LIBS)
8342 AC_SUBST(SYSTEM_LIBJPEG)
8344 dnl ===================================================================
8345 dnl Check for system clucene
8346 dnl ===================================================================
8347 dnl we should rather be using
8348 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8349 dnl but the contribs-lib check seems tricky
8350 AC_MSG_CHECKING([which clucene to use])
8351 if test "$with_system_clucene" = "yes"; then
8352     AC_MSG_RESULT([external])
8353     SYSTEM_CLUCENE=TRUE
8354     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8355     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8356     FilterLibs "${CLUCENE_LIBS}"
8357     CLUCENE_LIBS="${filteredlibs}"
8358     AC_LANG_PUSH([C++])
8359     save_CXXFLAGS=$CXXFLAGS
8360     save_CPPFLAGS=$CPPFLAGS
8361     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8362     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8363     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8364     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8365     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8366                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8367     CXXFLAGS=$save_CXXFLAGS
8368     CPPFLAGS=$save_CPPFLAGS
8369     AC_LANG_POP([C++])
8371     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8372 else
8373     AC_MSG_RESULT([internal])
8374     SYSTEM_CLUCENE=
8375     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8377 AC_SUBST(SYSTEM_CLUCENE)
8378 AC_SUBST(CLUCENE_CFLAGS)
8379 AC_SUBST(CLUCENE_LIBS)
8381 dnl ===================================================================
8382 dnl Check for system expat
8383 dnl ===================================================================
8384 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8386 dnl ===================================================================
8387 dnl Check for system xmlsec
8388 dnl ===================================================================
8389 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8391 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8392 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8393     ENABLE_EOT="TRUE"
8394     AC_DEFINE([ENABLE_EOT])
8395     AC_MSG_RESULT([yes])
8397     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8398 else
8399     ENABLE_EOT=
8400     AC_MSG_RESULT([no])
8402 AC_SUBST([ENABLE_EOT])
8404 dnl ===================================================================
8405 dnl Check for DLP libs
8406 dnl ===================================================================
8407 AS_IF([test "$COM" = "MSC"],
8408       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8409       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8411 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8413 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8415 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8417 AS_IF([test "$COM" = "MSC"],
8418       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8419       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8421 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8423 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8425 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8426 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8428 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8430 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8432 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8434 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8435 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8437 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8438 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8440 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8442 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8443 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8445 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8447 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8449 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8451 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8453 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8454 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8456 dnl ===================================================================
8457 dnl Check for system lcms2
8458 dnl ===================================================================
8459 if test "$with_system_lcms2" != "yes"; then
8460     SYSTEM_LCMS2=
8462 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8463 if test "$GCC" = "yes"; then
8464     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8466 if test "$COM" = "MSC"; then # override the above
8467     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8470 dnl ===================================================================
8471 dnl Check for system cppunit
8472 dnl ===================================================================
8473 if test "$_os" != "Android" ; then
8474     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8477 dnl ===================================================================
8478 dnl Check whether freetype is available
8479 dnl ===================================================================
8480 if test  "$test_freetype" = "yes"; then
8481     AC_MSG_CHECKING([whether freetype is available])
8482     # FreeType has 3 different kinds of versions
8483     # * release, like 2.4.10
8484     # * libtool, like 13.0.7 (this what pkg-config returns)
8485     # * soname
8486     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8487     #
8488     # 9.9.3 is 2.2.0
8489     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8490     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8491     FilterLibs "${FREETYPE_LIBS}"
8492     FREETYPE_LIBS="${filteredlibs}"
8493     SYSTEM_FREETYPE=TRUE
8494 else
8495     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8496     if test "x$ac_config_site_64bit_host" = xYES; then
8497         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8498     else
8499         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8500     fi
8502 AC_SUBST(FREETYPE_CFLAGS)
8503 AC_SUBST(FREETYPE_LIBS)
8504 AC_SUBST([SYSTEM_FREETYPE])
8506 # ===================================================================
8507 # Check for system libxslt
8508 # to prevent incompatibilities between internal libxml2 and external libxslt,
8509 # or vice versa, use with_system_libxml here
8510 # ===================================================================
8511 if test "$with_system_libxml" = "auto"; then
8512     case "$_os" in
8513     WINNT|iOS|Android)
8514         with_system_libxml="$with_system_libs"
8515         ;;
8516     *)
8517         if test "$enable_fuzzers" != "yes"; then
8518             with_system_libxml=yes
8519         else
8520             with_system_libxml=no
8521         fi
8522         ;;
8523     esac
8526 AC_MSG_CHECKING([which libxslt to use])
8527 if test "$with_system_libxml" = "yes"; then
8528     AC_MSG_RESULT([external])
8529     SYSTEM_LIBXSLT=TRUE
8530     if test "$_os" = "Darwin"; then
8531         dnl make sure to use SDK path
8532         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8533         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8534         dnl omit -L/usr/lib
8535         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8536         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8537     else
8538         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8539         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8540         FilterLibs "${LIBXSLT_LIBS}"
8541         LIBXSLT_LIBS="${filteredlibs}"
8542         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8543         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8544         FilterLibs "${LIBEXSLT_LIBS}"
8545         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8546     fi
8548     dnl Check for xsltproc
8549     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8550     if test "$XSLTPROC" = "no"; then
8551         AC_MSG_ERROR([xsltproc is required])
8552     fi
8553 else
8554     AC_MSG_RESULT([internal])
8555     SYSTEM_LIBXSLT=
8556     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8558     if test "$cross_compiling" = "yes"; then
8559         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8560         if test "$XSLTPROC" = "no"; then
8561             AC_MSG_ERROR([xsltproc is required])
8562         fi
8563     fi
8565 AC_SUBST(SYSTEM_LIBXSLT)
8566 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8567     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8569 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8571 AC_SUBST(LIBEXSLT_CFLAGS)
8572 AC_SUBST(LIBEXSLT_LIBS)
8573 AC_SUBST(LIBXSLT_CFLAGS)
8574 AC_SUBST(LIBXSLT_LIBS)
8575 AC_SUBST(XSLTPROC)
8577 # ===================================================================
8578 # Check for system libxml
8579 # ===================================================================
8580 AC_MSG_CHECKING([which libxml to use])
8581 if test "$with_system_libxml" = "yes"; then
8582     AC_MSG_RESULT([external])
8583     SYSTEM_LIBXML=TRUE
8584     if test "$_os" = "Darwin"; then
8585         dnl make sure to use SDK path
8586         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8587         dnl omit -L/usr/lib
8588         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8589     elif test $_os = iOS; then
8590         dnl make sure to use SDK path
8591         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8592         LIBXML_CFLAGS="-I$usr/include/libxml2"
8593         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8594     else
8595         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8596         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8597         FilterLibs "${LIBXML_LIBS}"
8598         LIBXML_LIBS="${filteredlibs}"
8599     fi
8601     dnl Check for xmllint
8602     AC_PATH_PROG(XMLLINT, xmllint, no)
8603     if test "$XMLLINT" = "no"; then
8604         AC_MSG_ERROR([xmllint is required])
8605     fi
8606 else
8607     AC_MSG_RESULT([internal])
8608     SYSTEM_LIBXML=
8609     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8610     if test "$COM" = "MSC"; then
8611         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8612     fi
8613     if test "$COM" = "MSC"; then
8614         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8615     else
8616         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8617     fi
8618     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8620 AC_SUBST(SYSTEM_LIBXML)
8621 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8622     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8624 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8625 AC_SUBST(LIBXML_CFLAGS)
8626 AC_SUBST(LIBXML_LIBS)
8627 AC_SUBST(XMLLINT)
8629 # =====================================================================
8630 # Checking for a Python interpreter with version >= 2.7.
8631 # Build and runtime requires Python 3 compatible version (>= 2.7).
8632 # Optionally user can pass an option to configure, i. e.
8633 # ./configure PYTHON=/usr/bin/python
8634 # =====================================================================
8635 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8636     if test -n "$PYTHON"; then
8637         PYTHON_FOR_BUILD=$PYTHON
8638     else
8639         # This allows a lack of system python with no error, we use internal one in that case.
8640         AM_PATH_PYTHON([2.7],, [:])
8641         # Clean PYTHON_VERSION checked below if cross-compiling
8642         PYTHON_VERSION=""
8643         if test "$PYTHON" != ":"; then
8644             PYTHON_FOR_BUILD=$PYTHON
8645         fi
8646     fi
8648 AC_SUBST(PYTHON_FOR_BUILD)
8650 # Checks for Python to use for Pyuno
8651 AC_MSG_CHECKING([which Python to use for Pyuno])
8652 case "$enable_python" in
8653 no|disable)
8654     if test -z $PYTHON_FOR_BUILD; then
8655         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8656         # requirement from the choice whether to include Python stuff in the installer, but why
8657         # bother?
8658         AC_MSG_ERROR([Python is required at build time.])
8659     fi
8660     enable_python=no
8661     AC_MSG_RESULT([none])
8662     ;;
8663 ""|yes|auto)
8664     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8665         AC_MSG_RESULT([no, overridden by --disable-scripting])
8666         enable_python=no
8667     elif test $build_os = cygwin; then
8668         dnl When building on Windows we don't attempt to use any installed
8669         dnl "system"  Python.
8670         AC_MSG_RESULT([fully internal])
8671         enable_python=internal
8672     elif test "$cross_compiling" = yes; then
8673         AC_MSG_RESULT([system])
8674         enable_python=system
8675     else
8676         # Unset variables set by the above AM_PATH_PYTHON so that
8677         # we actually do check anew.
8678         AC_MSG_RESULT([])
8679         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
8680         AM_PATH_PYTHON([3.3],, [:])
8681         AC_MSG_CHECKING([which Python to use for Pyuno])
8682         if test "$PYTHON" = ":"; then
8683             if test -z "$PYTHON_FOR_BUILD"; then
8684                 AC_MSG_RESULT([fully internal])
8685             else
8686                 AC_MSG_RESULT([internal])
8687             fi
8688             enable_python=internal
8689         else
8690             AC_MSG_RESULT([system])
8691             enable_python=system
8692         fi
8693     fi
8694     ;;
8695 internal)
8696     AC_MSG_RESULT([internal])
8697     ;;
8698 fully-internal)
8699     AC_MSG_RESULT([fully internal])
8700     enable_python=internal
8701     ;;
8702 system)
8703     AC_MSG_RESULT([system])
8704     if test "$_os" = Darwin; then
8705         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])
8706     fi
8707     ;;
8709     AC_MSG_ERROR([Incorrect --enable-python option])
8710     ;;
8711 esac
8713 if test $enable_python != no; then
8714     BUILD_TYPE="$BUILD_TYPE PYUNO"
8717 if test $enable_python = system; then
8718     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8719         # Fallback: Accept these in the environment, or as set above
8720         # for MacOSX.
8721         :
8722     elif test "$cross_compiling" != yes; then
8723         # Unset variables set by the above AM_PATH_PYTHON so that
8724         # we actually do check anew.
8725         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
8726         # This causes an error if no python command is found
8727         AM_PATH_PYTHON([3.3])
8728         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8729         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8730         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8731         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8732         if test -z "$PKG_CONFIG"; then
8733             PYTHON_CFLAGS="-I$python_include"
8734             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8735         elif $PKG_CONFIG --exists python-$python_version-embed; then
8736             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8737             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8738         elif $PKG_CONFIG --exists python-$python_version; then
8739             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8740             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8741         else
8742             PYTHON_CFLAGS="-I$python_include"
8743             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8744         fi
8745         FilterLibs "${PYTHON_LIBS}"
8746         PYTHON_LIBS="${filteredlibs}"
8747     else
8748         dnl How to find out the cross-compilation Python installation path?
8749         AC_MSG_CHECKING([for python version])
8750         AS_IF([test -n "$PYTHON_VERSION"],
8751               [AC_MSG_RESULT([$PYTHON_VERSION])],
8752               [AC_MSG_RESULT([not found])
8753                AC_MSG_ERROR([no usable python found])])
8754         test -n "$PYTHON_CFLAGS" && break
8755     fi
8757     dnl Check if the headers really work
8758     save_CPPFLAGS="$CPPFLAGS"
8759     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8760     AC_CHECK_HEADER(Python.h)
8761     CPPFLAGS="$save_CPPFLAGS"
8763     # let the PYTHON_FOR_BUILD match the same python installation that
8764     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8765     # better for PythonTests.
8766     PYTHON_FOR_BUILD=$PYTHON
8769 if test "$with_lxml" != no; then
8770     if test -z "$PYTHON_FOR_BUILD"; then
8771         case $build_os in
8772             cygwin)
8773                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8774                 ;;
8775             *)
8776                 if test "$cross_compiling" != yes ; then
8777                     BUILD_TYPE="$BUILD_TYPE LXML"
8778                 fi
8779                 ;;
8780         esac
8781     else
8782         AC_MSG_CHECKING([for python lxml])
8783         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8784             AC_MSG_RESULT([yes])
8785         else
8786             case $build_os in
8787                 cygwin)
8788                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8789                     ;;
8790                 *)
8791                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8792                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8793                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8794                         else
8795                             BUILD_TYPE="$BUILD_TYPE LXML"
8796                             AC_MSG_RESULT([no, using internal lxml])
8797                         fi
8798                     else
8799                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8800                     fi
8801                     ;;
8802             esac
8803         fi
8804     fi
8807 dnl By now enable_python should be "system", "internal" or "no"
8808 case $enable_python in
8809 system)
8810     SYSTEM_PYTHON=TRUE
8812     if test "x$ac_cv_header_Python_h" != "xyes"; then
8813        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8814     fi
8816     AC_LANG_PUSH(C)
8817     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8818     AC_MSG_CHECKING([for correct python library version])
8819        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8820 #include <Python.h>
8822 int main(int argc, char **argv) {
8823    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8824        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8825    else return 1;
8827        ]])],[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])])
8828     CFLAGS=$save_CFLAGS
8829     AC_LANG_POP(C)
8831     dnl FIXME Check if the Python library can be linked with, too?
8832     ;;
8834 internal)
8835     SYSTEM_PYTHON=
8836     PYTHON_VERSION_MAJOR=3
8837     PYTHON_VERSION_MINOR=7
8838     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8839     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8840         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8841     fi
8842     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8843     BUILD_TYPE="$BUILD_TYPE PYTHON"
8844     if test "$OS" = LINUX; then
8845         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8846     fi
8847     # Embedded Python dies without Home set
8848     if test "$HOME" = ""; then
8849         export HOME=""
8850     fi
8851     ;;
8853     DISABLE_PYTHON=TRUE
8854     SYSTEM_PYTHON=
8855     ;;
8857     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8858     ;;
8859 esac
8861 AC_SUBST(DISABLE_PYTHON)
8862 AC_SUBST(SYSTEM_PYTHON)
8863 AC_SUBST(PYTHON_CFLAGS)
8864 AC_SUBST(PYTHON_LIBS)
8865 AC_SUBST(PYTHON_VERSION)
8866 AC_SUBST(PYTHON_VERSION_MAJOR)
8867 AC_SUBST(PYTHON_VERSION_MINOR)
8869 ENABLE_MARIADBC=TRUE
8870 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8871     ENABLE_MARIADBC=
8873 MARIADBC_MAJOR=1
8874 MARIADBC_MINOR=0
8875 MARIADBC_MICRO=2
8876 if test "$ENABLE_MARIADBC" = "TRUE"; then
8877     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8880 AC_SUBST(ENABLE_MARIADBC)
8881 AC_SUBST(MARIADBC_MAJOR)
8882 AC_SUBST(MARIADBC_MINOR)
8883 AC_SUBST(MARIADBC_MICRO)
8885 if test "$ENABLE_MARIADBC" = "TRUE"; then
8886     dnl ===================================================================
8887     dnl Check for system MariaDB
8888     dnl ===================================================================
8889     AC_MSG_CHECKING([which MariaDB to use])
8890     if test "$with_system_mariadb" = "yes"; then
8891         AC_MSG_RESULT([external])
8892         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8893         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8894         if test -z "$MARIADBCONFIG"; then
8895             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8896             if test -z "$MARIADBCONFIG"; then
8897                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8898                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8899             fi
8900         fi
8901         AC_MSG_CHECKING([MariaDB version])
8902         MARIADB_VERSION=`$MARIADBCONFIG --version`
8903         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8904         if test "$MARIADB_MAJOR" -ge "5"; then
8905             AC_MSG_RESULT([OK])
8906         else
8907             AC_MSG_ERROR([too old, use 5.0.x or later])
8908         fi
8909         AC_MSG_CHECKING([for MariaDB Client library])
8910         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8911         if test "$COM_IS_CLANG" = TRUE; then
8912             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8913         fi
8914         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8915         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8916         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8917         dnl linux32:
8918         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8919             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8920             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8921                 | sed -e 's|/lib64/|/lib/|')
8922         fi
8923         FilterLibs "${MARIADB_LIBS}"
8924         MARIADB_LIBS="${filteredlibs}"
8925         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8926         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8927         if test "$enable_bundle_mariadb" = "yes"; then
8928             AC_MSG_RESULT([yes])
8929             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8930             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8932 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8934 /g' | grep -E '(mysqlclient|mariadb)')
8935             if test "$_os" = "Darwin"; then
8936                 LIBMARIADB=${LIBMARIADB}.dylib
8937             elif test "$_os" = "WINNT"; then
8938                 LIBMARIADB=${LIBMARIADB}.dll
8939             else
8940                 LIBMARIADB=${LIBMARIADB}.so
8941             fi
8942             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8943             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8944             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8945                 AC_MSG_RESULT([found.])
8946                 PathFormat "$LIBMARIADB_PATH"
8947                 LIBMARIADB_PATH="$formatted_path"
8948             else
8949                 AC_MSG_ERROR([not found.])
8950             fi
8951         else
8952             AC_MSG_RESULT([no])
8953             BUNDLE_MARIADB_CONNECTOR_C=
8954         fi
8955     else
8956         AC_MSG_RESULT([internal])
8957         SYSTEM_MARIADB_CONNECTOR_C=
8958         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8959         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8960         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8961     fi
8963     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8964     AC_SUBST(MARIADB_CFLAGS)
8965     AC_SUBST(MARIADB_LIBS)
8966     AC_SUBST(LIBMARIADB)
8967     AC_SUBST(LIBMARIADB_PATH)
8968     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8971 dnl ===================================================================
8972 dnl Check for system hsqldb
8973 dnl ===================================================================
8974 if test "$with_java" != "no"; then
8975     HSQLDB_USE_JDBC_4_1=
8976     AC_MSG_CHECKING([which hsqldb to use])
8977     if test "$with_system_hsqldb" = "yes"; then
8978         AC_MSG_RESULT([external])
8979         SYSTEM_HSQLDB=TRUE
8980         if test -z $HSQLDB_JAR; then
8981             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8982         fi
8983         if ! test -f $HSQLDB_JAR; then
8984                AC_MSG_ERROR(hsqldb.jar not found.)
8985         fi
8986         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8987         export HSQLDB_JAR
8988         if $PERL -e \
8989            'use Archive::Zip;
8990             my $file = "$ENV{'HSQLDB_JAR'}";
8991             my $zip = Archive::Zip->new( $file );
8992             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8993             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8994             {
8995                 push @l, split(/\n/, $mf);
8996                 foreach my $line (@l)
8997                 {
8998                     if ($line =~ m/Specification-Version:/)
8999                     {
9000                         ($t, $version) = split (/:/,$line);
9001                         $version =~ s/^\s//;
9002                         ($a, $b, $c, $d) = split (/\./,$version);
9003                         if ($c == "0" && $d > "8")
9004                         {
9005                             exit 0;
9006                         }
9007                         else
9008                         {
9009                             exit 1;
9010                         }
9011                     }
9012                 }
9013             }
9014             else
9015             {
9016                 exit 1;
9017             }'; then
9018             AC_MSG_RESULT([yes])
9019         else
9020             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9021         fi
9022     else
9023         AC_MSG_RESULT([internal])
9024         SYSTEM_HSQLDB=
9025         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9026         NEED_ANT=TRUE
9027         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9028         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9029         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9030             AC_MSG_RESULT([yes])
9031             HSQLDB_USE_JDBC_4_1=TRUE
9032         else
9033             AC_MSG_RESULT([no])
9034         fi
9035     fi
9036     AC_SUBST(SYSTEM_HSQLDB)
9037     AC_SUBST(HSQLDB_JAR)
9038     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9041 dnl ===================================================================
9042 dnl Check for PostgreSQL stuff
9043 dnl ===================================================================
9044 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9045 if test "x$enable_postgresql_sdbc" != "xno"; then
9046     AC_MSG_RESULT([yes])
9047     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9049     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9050         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9051     fi
9052     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9053         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9054     fi
9056     postgres_interface=""
9057     if test "$with_system_postgresql" = "yes"; then
9058         postgres_interface="external PostgreSQL"
9059         SYSTEM_POSTGRESQL=TRUE
9060         if test "$_os" = Darwin; then
9061             supp_path=''
9062             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9063                 pg_supp_path="$P_SEP$d$pg_supp_path"
9064             done
9065         fi
9066         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9067         if test -n "$PGCONFIG"; then
9068             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9069             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9070         else
9071             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9072               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9073               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9074             ],[
9075               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9076             ])
9077         fi
9078         FilterLibs "${POSTGRESQL_LIB}"
9079         POSTGRESQL_LIB="${filteredlibs}"
9080     else
9081         # if/when anything else than PostgreSQL uses Kerberos,
9082         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9083         WITH_KRB5=
9084         WITH_GSSAPI=
9085         case "$_os" in
9086         Darwin)
9087             # macOS has system MIT Kerberos 5 since 10.4
9088             if test "$with_krb5" != "no"; then
9089                 WITH_KRB5=TRUE
9090                 save_LIBS=$LIBS
9091                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9092                 # that the libraries where these functions are located on macOS will change, is it?
9093                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9094                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9095                 KRB5_LIBS=$LIBS
9096                 LIBS=$save_LIBS
9097                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9098                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9099                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9100                 LIBS=$save_LIBS
9101             fi
9102             if test "$with_gssapi" != "no"; then
9103                 WITH_GSSAPI=TRUE
9104                 save_LIBS=$LIBS
9105                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9106                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9107                 GSSAPI_LIBS=$LIBS
9108                 LIBS=$save_LIBS
9109             fi
9110             ;;
9111         WINNT)
9112             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9113                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9114             fi
9115             ;;
9116         Linux|GNU|*BSD|DragonFly)
9117             if test "$with_krb5" != "no"; then
9118                 WITH_KRB5=TRUE
9119                 save_LIBS=$LIBS
9120                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9121                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9122                 KRB5_LIBS=$LIBS
9123                 LIBS=$save_LIBS
9124                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9125                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9126                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9127                 LIBS=$save_LIBS
9128             fi
9129             if test "$with_gssapi" != "no"; then
9130                 WITH_GSSAPI=TRUE
9131                 save_LIBS=$LIBS
9132                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9133                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9134                 GSSAPI_LIBS=$LIBS
9135                 LIBS=$save_LIBS
9136             fi
9137             ;;
9138         *)
9139             if test "$with_krb5" = "yes"; then
9140                 WITH_KRB5=TRUE
9141                 save_LIBS=$LIBS
9142                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9143                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9144                 KRB5_LIBS=$LIBS
9145                 LIBS=$save_LIBS
9146                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9147                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9148                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9149                 LIBS=$save_LIBS
9150             fi
9151             if test "$with_gssapi" = "yes"; then
9152                 WITH_GSSAPI=TRUE
9153                 save_LIBS=$LIBS
9154                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9155                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9156                 LIBS=$save_LIBS
9157                 GSSAPI_LIBS=$LIBS
9158             fi
9159         esac
9161         if test -n "$with_libpq_path"; then
9162             SYSTEM_POSTGRESQL=TRUE
9163             postgres_interface="external libpq"
9164             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9165             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9166         else
9167             SYSTEM_POSTGRESQL=
9168             postgres_interface="internal"
9169             POSTGRESQL_LIB=""
9170             POSTGRESQL_INC="%OVERRIDE_ME%"
9171             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9172         fi
9173     fi
9175     AC_MSG_CHECKING([PostgreSQL C interface])
9176     AC_MSG_RESULT([$postgres_interface])
9178     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9179         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9180         save_CFLAGS=$CFLAGS
9181         save_CPPFLAGS=$CPPFLAGS
9182         save_LIBS=$LIBS
9183         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9184         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9185         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9186         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9187             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9188         CFLAGS=$save_CFLAGS
9189         CPPFLAGS=$save_CPPFLAGS
9190         LIBS=$save_LIBS
9191     fi
9192     BUILD_POSTGRESQL_SDBC=TRUE
9193 else
9194     AC_MSG_RESULT([no])
9196 AC_SUBST(WITH_KRB5)
9197 AC_SUBST(WITH_GSSAPI)
9198 AC_SUBST(GSSAPI_LIBS)
9199 AC_SUBST(KRB5_LIBS)
9200 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9201 AC_SUBST(SYSTEM_POSTGRESQL)
9202 AC_SUBST(POSTGRESQL_INC)
9203 AC_SUBST(POSTGRESQL_LIB)
9205 dnl ===================================================================
9206 dnl Check for Firebird stuff
9207 dnl ===================================================================
9208 ENABLE_FIREBIRD_SDBC=
9209 if test "$enable_firebird_sdbc" = "yes" ; then
9210     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9212     dnl ===================================================================
9213     dnl Check for system Firebird
9214     dnl ===================================================================
9215     AC_MSG_CHECKING([which Firebird to use])
9216     if test "$with_system_firebird" = "yes"; then
9217         AC_MSG_RESULT([external])
9218         SYSTEM_FIREBIRD=TRUE
9219         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9220         if test -z "$FIREBIRDCONFIG"; then
9221             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9222             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9223                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9224             ])
9225             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9226         else
9227             AC_MSG_NOTICE([fb_config found])
9228             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9229             AC_MSG_CHECKING([for Firebird Client library])
9230             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9231             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9232             FilterLibs "${FIREBIRD_LIBS}"
9233             FIREBIRD_LIBS="${filteredlibs}"
9234         fi
9235         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9236         AC_MSG_CHECKING([Firebird version])
9237         if test -n "${FIREBIRD_VERSION}"; then
9238             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9239             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9240             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9241                 AC_MSG_RESULT([OK])
9242             else
9243                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9244             fi
9245         else
9246             __save_CFLAGS="${CFLAGS}"
9247             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9248             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9249 #if defined(FB_API_VER) && FB_API_VER == 30
9250 int fb_api_is_30(void) { return 0; }
9251 #else
9252 #error "Wrong Firebird API version"
9253 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9254             CFLAGS="${__save_CFLAGS}"
9255         fi
9256         ENABLE_FIREBIRD_SDBC=TRUE
9257         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9258     elif test "$enable_database_connectivity" != yes; then
9259         AC_MSG_RESULT([none])
9260     elif test "$cross_compiling" = "yes"; then
9261         AC_MSG_RESULT([none])
9262     else
9263         dnl Embedded Firebird has version 3.0
9264         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9265         dnl We need libatomic_ops for any non X86/X64 system
9266         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9267             dnl ===================================================================
9268             dnl Check for system libatomic_ops
9269             dnl ===================================================================
9270             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9271             if test "$with_system_libatomic_ops" = "yes"; then
9272                 SYSTEM_LIBATOMIC_OPS=TRUE
9273                 AC_CHECK_HEADERS(atomic_ops.h, [],
9274                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9275             else
9276                 SYSTEM_LIBATOMIC_OPS=
9277                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9278                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9279                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9280             fi
9281         fi
9283         AC_MSG_RESULT([internal])
9284         SYSTEM_FIREBIRD=
9285         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9286         FIREBIRD_LIBS="-lfbclient"
9288         if test "$with_system_libtommath" = "yes"; then
9289             SYSTEM_LIBTOMMATH=TRUE
9290             dnl check for tommath presence
9291             save_LIBS=$LIBS
9292             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9293             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9294             LIBS=$save_LIBS
9295         else
9296             SYSTEM_LIBTOMMATH=
9297             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9298             LIBTOMMATH_LIBS="-ltommath"
9299             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9300         fi
9302         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9303         ENABLE_FIREBIRD_SDBC=TRUE
9304         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9305     fi
9307 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9308 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9309 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9310 AC_SUBST(LIBATOMIC_OPS_LIBS)
9311 AC_SUBST(SYSTEM_FIREBIRD)
9312 AC_SUBST(FIREBIRD_CFLAGS)
9313 AC_SUBST(FIREBIRD_LIBS)
9314 AC_SUBST([TOMMATH_CFLAGS])
9315 AC_SUBST([TOMMATH_LIBS])
9317 dnl ===================================================================
9318 dnl Check for system curl
9319 dnl ===================================================================
9320 AC_MSG_CHECKING([which libcurl to use])
9321 if test "$with_system_curl" = "auto"; then
9322     with_system_curl="$with_system_libs"
9325 if test "$with_system_curl" = "yes"; then
9326     AC_MSG_RESULT([external])
9327     SYSTEM_CURL=TRUE
9329     # First try PKGCONFIG and then fall back
9330     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9332     if test -n "$CURL_PKG_ERRORS"; then
9333         AC_PATH_PROG(CURLCONFIG, curl-config)
9334         if test -z "$CURLCONFIG"; then
9335             AC_MSG_ERROR([curl development files not found])
9336         fi
9337         CURL_LIBS=`$CURLCONFIG --libs`
9338         FilterLibs "${CURL_LIBS}"
9339         CURL_LIBS="${filteredlibs}"
9340         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9341         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9343         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9344         case $curl_version in
9345         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9346         dnl so they need to be doubled to end up in the configure script
9347         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9348             AC_MSG_RESULT([yes])
9349             ;;
9350         *)
9351             AC_MSG_ERROR([no, you have $curl_version])
9352             ;;
9353         esac
9354     fi
9356     ENABLE_CURL=TRUE
9357 elif test $_os = iOS; then
9358     # Let's see if we need curl, I think not?
9359     AC_MSG_RESULT([none])
9360     ENABLE_CURL=
9361 else
9362     AC_MSG_RESULT([internal])
9363     SYSTEM_CURL=
9364     BUILD_TYPE="$BUILD_TYPE CURL"
9365     ENABLE_CURL=TRUE
9367 AC_SUBST(SYSTEM_CURL)
9368 AC_SUBST(CURL_CFLAGS)
9369 AC_SUBST(CURL_LIBS)
9370 AC_SUBST(ENABLE_CURL)
9372 dnl ===================================================================
9373 dnl Check for system boost
9374 dnl ===================================================================
9375 AC_MSG_CHECKING([which boost to use])
9376 if test "$with_system_boost" = "yes"; then
9377     AC_MSG_RESULT([external])
9378     SYSTEM_BOOST=TRUE
9379     AX_BOOST_BASE(1.47)
9380     AX_BOOST_DATE_TIME
9381     AX_BOOST_FILESYSTEM
9382     AX_BOOST_IOSTREAMS
9383     AX_BOOST_LOCALE
9384     AC_LANG_PUSH([C++])
9385     save_CXXFLAGS=$CXXFLAGS
9386     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9387     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9388        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9389     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9390        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9391     CXXFLAGS=$save_CXXFLAGS
9392     AC_LANG_POP([C++])
9393     # this is in m4/ax_boost_base.m4
9394     FilterLibs "${BOOST_LDFLAGS}"
9395     BOOST_LDFLAGS="${filteredlibs}"
9396 else
9397     AC_MSG_RESULT([internal])
9398     BUILD_TYPE="$BUILD_TYPE BOOST"
9399     SYSTEM_BOOST=
9400     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9401         # use warning-suppressing wrapper headers
9402         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9403     else
9404         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9405     fi
9407 AC_SUBST(SYSTEM_BOOST)
9409 dnl ===================================================================
9410 dnl Check for system mdds
9411 dnl ===================================================================
9412 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9414 dnl ===================================================================
9415 dnl Check for system glm
9416 dnl ===================================================================
9417 AC_MSG_CHECKING([which glm to use])
9418 if test "$with_system_glm" = "yes"; then
9419     AC_MSG_RESULT([external])
9420     SYSTEM_GLM=TRUE
9421     AC_LANG_PUSH([C++])
9422     AC_CHECK_HEADER([glm/glm.hpp], [],
9423        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9424     AC_LANG_POP([C++])
9425 else
9426     AC_MSG_RESULT([internal])
9427     BUILD_TYPE="$BUILD_TYPE GLM"
9428     SYSTEM_GLM=
9429     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9431 AC_SUBST([GLM_CFLAGS])
9432 AC_SUBST([SYSTEM_GLM])
9434 dnl ===================================================================
9435 dnl Check for system odbc
9436 dnl ===================================================================
9437 AC_MSG_CHECKING([which odbc headers to use])
9438 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
9439     AC_MSG_RESULT([external])
9440     SYSTEM_ODBC_HEADERS=TRUE
9442     if test "$build_os" = "cygwin"; then
9443         save_CPPFLAGS=$CPPFLAGS
9444         find_winsdk
9445         PathFormat "$winsdktest"
9446         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"
9447         AC_CHECK_HEADER(sqlext.h, [],
9448             [AC_MSG_ERROR(odbc not found. install odbc)],
9449             [#include <windows.h>])
9450         CPPFLAGS=$save_CPPFLAGS
9451     else
9452         AC_CHECK_HEADER(sqlext.h, [],
9453             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9454     fi
9455 elif test "$enable_database_connectivity" != yes; then
9456     AC_MSG_RESULT([none])
9457 else
9458     AC_MSG_RESULT([internal])
9459     SYSTEM_ODBC_HEADERS=
9461 AC_SUBST(SYSTEM_ODBC_HEADERS)
9463 dnl ===================================================================
9464 dnl Enable LDAP support
9465 dnl ===================================================================
9467 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9468 AC_MSG_CHECKING([whether to enable LDAP support])
9469     if test "$enable_ldap" != "yes"; then
9470         AC_MSG_RESULT([no])
9471         ENABLE_LDAP=""
9472         enable_ldap=no
9473     else
9474         AC_MSG_RESULT([yes])
9475         ENABLE_LDAP="TRUE"
9476         AC_DEFINE(HAVE_FEATURE_LDAP)
9477     fi
9479 AC_SUBST(ENABLE_LDAP)
9481 dnl ===================================================================
9482 dnl Check for system openldap
9483 dnl ===================================================================
9485 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9486 AC_MSG_CHECKING([which openldap library to use])
9487 if test "$with_system_openldap" = "yes"; then
9488     AC_MSG_RESULT([external])
9489     SYSTEM_OPENLDAP=TRUE
9490     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9491     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9492     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9493 else
9494     AC_MSG_RESULT([internal])
9495     SYSTEM_OPENLDAP=
9496     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9499 AC_SUBST(SYSTEM_OPENLDAP)
9501 dnl ===================================================================
9502 dnl Check for system NSS
9503 dnl ===================================================================
9504 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9505     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9506     AC_DEFINE(HAVE_FEATURE_NSS)
9507     ENABLE_NSS="TRUE"
9508     AC_DEFINE(ENABLE_NSS)
9509 elif test $_os != iOS ; then
9510     with_tls=openssl
9512 AC_SUBST(ENABLE_NSS)
9514 dnl ===================================================================
9515 dnl Check for TLS/SSL and cryptographic implementation to use
9516 dnl ===================================================================
9517 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9518 if test -n "$with_tls"; then
9519     case $with_tls in
9520     openssl)
9521         AC_DEFINE(USE_TLS_OPENSSL)
9522         TLS=OPENSSL
9524         if test "$enable_openssl" != "yes"; then
9525             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9526         fi
9528         # warn that OpenSSL has been selected but not all TLS code has this option
9529         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9530         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9531         ;;
9532     nss)
9533         AC_DEFINE(USE_TLS_NSS)
9534         TLS=NSS
9535         ;;
9536     no)
9537         AC_MSG_WARN([Skipping TLS/SSL])
9538         ;;
9539     *)
9540         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9541 openssl - OpenSSL
9542 nss - Mozilla's Network Security Services (NSS)
9543     ])
9544         ;;
9545     esac
9546 else
9547     # default to using NSS, it results in smaller oox lib
9548     AC_DEFINE(USE_TLS_NSS)
9549     TLS=NSS
9551 AC_MSG_RESULT([$TLS])
9552 AC_SUBST(TLS)
9554 dnl ===================================================================
9555 dnl Check for system sane
9556 dnl ===================================================================
9557 AC_MSG_CHECKING([which sane header to use])
9558 if test "$with_system_sane" = "yes"; then
9559     AC_MSG_RESULT([external])
9560     AC_CHECK_HEADER(sane/sane.h, [],
9561       [AC_MSG_ERROR(sane not found. install sane)], [])
9562 else
9563     AC_MSG_RESULT([internal])
9564     BUILD_TYPE="$BUILD_TYPE SANE"
9567 dnl ===================================================================
9568 dnl Check for system icu
9569 dnl ===================================================================
9570 SYSTEM_GENBRK=
9571 SYSTEM_GENCCODE=
9572 SYSTEM_GENCMN=
9574 ICU_MAJOR=65
9575 ICU_MINOR=1
9576 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9577 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9578 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9579 AC_MSG_CHECKING([which icu to use])
9580 if test "$with_system_icu" = "yes"; then
9581     AC_MSG_RESULT([external])
9582     SYSTEM_ICU=TRUE
9583     AC_LANG_PUSH([C++])
9584     AC_MSG_CHECKING([for unicode/rbbi.h])
9585     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9586     AC_LANG_POP([C++])
9588     if test "$cross_compiling" != "yes"; then
9589         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9590         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9591         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9592         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9593     fi
9595     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9596         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9597         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9598         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9599         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9600         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9601             AC_MSG_RESULT([yes])
9602         else
9603             AC_MSG_RESULT([no])
9604             if test "$with_system_icu_for_build" != "force"; then
9605                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9606 You can use --with-system-icu-for-build=force to use it anyway.])
9607             fi
9608         fi
9609     fi
9611     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9612         # using the system icu tools can lead to version confusion, use the
9613         # ones from the build environment when cross-compiling
9614         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9615         if test -z "$SYSTEM_GENBRK"; then
9616             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9617         fi
9618         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9619         if test -z "$SYSTEM_GENCCODE"; then
9620             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9621         fi
9622         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9623         if test -z "$SYSTEM_GENCMN"; then
9624             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9625         fi
9626         if test "$ICU_MAJOR" -ge "49"; then
9627             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9628             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9629             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9630         else
9631             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9632             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9633             ICU_RECLASSIFIED_HEBREW_LETTER=
9634         fi
9635     fi
9637     if test "$cross_compiling" = "yes"; then
9638         if test "$ICU_MAJOR" -ge "50"; then
9639             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9640             ICU_MINOR=""
9641         fi
9642     fi
9643 else
9644     AC_MSG_RESULT([internal])
9645     SYSTEM_ICU=
9646     BUILD_TYPE="$BUILD_TYPE ICU"
9647     # surprisingly set these only for "internal" (to be used by various other
9648     # external libs): the system icu-config is quite unhelpful and spits out
9649     # dozens of weird flags and also default path -I/usr/include
9650     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9651     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9653 if test "$ICU_MAJOR" -ge "59"; then
9654     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9655     # with -std=c++11 but not all external libraries can be built with that,
9656     # for those use a bit-compatible typedef uint16_t UChar; see
9657     # icu/source/common/unicode/umachine.h
9658     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9659 else
9660     ICU_UCHAR_TYPE=""
9662 AC_SUBST(SYSTEM_ICU)
9663 AC_SUBST(SYSTEM_GENBRK)
9664 AC_SUBST(SYSTEM_GENCCODE)
9665 AC_SUBST(SYSTEM_GENCMN)
9666 AC_SUBST(ICU_MAJOR)
9667 AC_SUBST(ICU_MINOR)
9668 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9669 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9670 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9671 AC_SUBST(ICU_CFLAGS)
9672 AC_SUBST(ICU_LIBS)
9673 AC_SUBST(ICU_UCHAR_TYPE)
9675 dnl ==================================================================
9676 dnl Breakpad
9677 dnl ==================================================================
9678 DEFAULT_CRASHDUMP_VALUE="true"
9679 AC_MSG_CHECKING([whether to enable breakpad])
9680 if test "$enable_breakpad" != yes; then
9681     AC_MSG_RESULT([no])
9682 else
9683     AC_MSG_RESULT([yes])
9684     ENABLE_BREAKPAD="TRUE"
9685     AC_DEFINE(ENABLE_BREAKPAD)
9686     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9687     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9689     AC_MSG_CHECKING([for disable crash dump])
9690     if test "$enable_crashdump" = no; then
9691         DEFAULT_CRASHDUMP_VALUE="false"
9692         AC_MSG_RESULT([yes])
9693     else
9694        AC_MSG_RESULT([no])
9695     fi
9697     AC_MSG_CHECKING([for crashreport config])
9698     if test "$with_symbol_config" = "no"; then
9699         BREAKPAD_SYMBOL_CONFIG="invalid"
9700         AC_MSG_RESULT([no])
9701     else
9702         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9703         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9704         AC_MSG_RESULT([yes])
9705     fi
9706     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9708 AC_SUBST(ENABLE_BREAKPAD)
9709 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9711 dnl ==================================================================
9712 dnl libfuzzer
9713 dnl ==================================================================
9714 AC_MSG_CHECKING([whether to enable fuzzers])
9715 if test "$enable_fuzzers" != yes; then
9716     AC_MSG_RESULT([no])
9717 else
9718     AC_MSG_RESULT([yes])
9719     ENABLE_FUZZERS="TRUE"
9720     AC_DEFINE([ENABLE_FUZZERS],1)
9721     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9723 AC_SUBST(ENABLE_FUZZERS)
9725 dnl ===================================================================
9726 dnl Orcus
9727 dnl ===================================================================
9728 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9729 if test "$with_system_orcus" != "yes"; then
9730     if test "$SYSTEM_BOOST" = "TRUE"; then
9731         # ===========================================================
9732         # Determine if we are going to need to link with Boost.System
9733         # ===========================================================
9734         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9735         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9736         dnl in documentation has no effect.
9737         AC_MSG_CHECKING([if we need to link with Boost.System])
9738         AC_LANG_PUSH([C++])
9739         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9740                 @%:@include <boost/version.hpp>
9741             ]],[[
9742                 #if BOOST_VERSION >= 105000
9743                 #   error yes, we need to link with Boost.System
9744                 #endif
9745             ]])],[
9746                 AC_MSG_RESULT([no])
9747             ],[
9748                 AC_MSG_RESULT([yes])
9749                 AX_BOOST_SYSTEM
9750         ])
9751         AC_LANG_POP([C++])
9752     fi
9754 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9755 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9756 AC_SUBST([BOOST_SYSTEM_LIB])
9757 AC_SUBST(SYSTEM_LIBORCUS)
9759 dnl ===================================================================
9760 dnl HarfBuzz
9761 dnl ===================================================================
9762 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9763                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9764                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9766 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9767                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9768                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9770 if test "$COM" = "MSC"; then # override the above
9771     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9772     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9775 if test "$with_system_harfbuzz" = "yes"; then
9776     if test "$with_system_graphite" = "no"; then
9777         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9778     fi
9779     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9780     _save_libs="$LIBS"
9781     _save_cflags="$CFLAGS"
9782     LIBS="$LIBS $HARFBUZZ_LIBS"
9783     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9784     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9785     LIBS="$_save_libs"
9786     CFLAGS="$_save_cflags"
9787 else
9788     if test "$with_system_graphite" = "yes"; then
9789         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9790     fi
9793 AC_MSG_CHECKING([whether to use X11])
9794 dnl ***************************************
9795 dnl testing for X libraries and includes...
9796 dnl ***************************************
9797 if test "$USING_X11" = TRUE; then
9798     AC_DEFINE(HAVE_FEATURE_X11)
9800 AC_MSG_RESULT([$USING_X11])
9802 if test "$USING_X11" = TRUE; then
9803     AC_PATH_X
9804     AC_PATH_XTRA
9805     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9807     if test -z "$x_includes"; then
9808         x_includes="default_x_includes"
9809     fi
9810     if test -z "$x_libraries"; then
9811         x_libraries="default_x_libraries"
9812     fi
9813     CFLAGS="$CFLAGS $X_CFLAGS"
9814     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9815     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9816 else
9817     x_includes="no_x_includes"
9818     x_libraries="no_x_libraries"
9821 if test "$USING_X11" = TRUE; then
9822     dnl ===================================================================
9823     dnl Check for extension headers
9824     dnl ===================================================================
9825     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9826      [#include <X11/extensions/shape.h>])
9828     # vcl needs ICE and SM
9829     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9830     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9831         [AC_MSG_ERROR(ICE library not found)])
9832     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9833     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9834         [AC_MSG_ERROR(SM library not found)])
9837 dnl ===================================================================
9838 dnl Check for system Xrender
9839 dnl ===================================================================
9840 AC_MSG_CHECKING([whether to use Xrender])
9841 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9842     AC_MSG_RESULT([yes])
9843     PKG_CHECK_MODULES(XRENDER, xrender)
9844     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9845     FilterLibs "${XRENDER_LIBS}"
9846     XRENDER_LIBS="${filteredlibs}"
9847     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9848       [AC_MSG_ERROR(libXrender not found or functional)], [])
9849     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9850       [AC_MSG_ERROR(Xrender not found. install X)], [])
9851 else
9852     AC_MSG_RESULT([no])
9854 AC_SUBST(XRENDER_CFLAGS)
9855 AC_SUBST(XRENDER_LIBS)
9857 dnl ===================================================================
9858 dnl Check for XRandr
9859 dnl ===================================================================
9860 AC_MSG_CHECKING([whether to enable RandR support])
9861 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9862     AC_MSG_RESULT([yes])
9863     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9864     if test "$ENABLE_RANDR" != "TRUE"; then
9865         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9866                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9867         XRANDR_CFLAGS=" "
9868         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9869           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9870         XRANDR_LIBS="-lXrandr "
9871         ENABLE_RANDR="TRUE"
9872     fi
9873     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9874     FilterLibs "${XRANDR_LIBS}"
9875     XRANDR_LIBS="${filteredlibs}"
9876 else
9877     ENABLE_RANDR=""
9878     AC_MSG_RESULT([no])
9880 AC_SUBST(XRANDR_CFLAGS)
9881 AC_SUBST(XRANDR_LIBS)
9882 AC_SUBST(ENABLE_RANDR)
9884 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9885     WITH_WEBDAV="serf"
9887 if test $_os = iOS -o $_os = Android; then
9888     WITH_WEBDAV="no"
9890 AC_MSG_CHECKING([for webdav library])
9891 case "$WITH_WEBDAV" in
9892 serf)
9893     AC_MSG_RESULT([serf])
9894     # Check for system apr-util
9895     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9896                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9897                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9898     if test "$COM" = "MSC"; then
9899         APR_LIB_DIR="LibR"
9900         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9901         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9902     fi
9904     # Check for system serf
9905     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9906                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9907     if test "$COM" = "MSC"; then
9908         SERF_LIB_DIR="Release"
9909         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9910         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9911     fi
9912     ;;
9913 neon)
9914     AC_MSG_RESULT([neon])
9915     # Check for system neon
9916     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9917     if test "$with_system_neon" = "yes"; then
9918         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9919     else
9920         NEON_VERSION=0295
9921     fi
9922     AC_SUBST(NEON_VERSION)
9923     ;;
9925     AC_MSG_RESULT([none, disabled])
9926     WITH_WEBDAV=""
9927     ;;
9928 esac
9929 AC_SUBST(WITH_WEBDAV)
9931 dnl ===================================================================
9932 dnl Check for disabling cve_tests
9933 dnl ===================================================================
9934 AC_MSG_CHECKING([whether to execute CVE tests])
9935 # If not explicitly enabled or disabled, default
9936 if test -z "$enable_cve_tests"; then
9937     case "$OS" in
9938     WNT)
9939         # Default cves off for Windows with its wild and wonderful
9940         # variety of AV software kicking in and panicking
9941         enable_cve_tests=no
9942         ;;
9943     *)
9944         # otherwise yes
9945         enable_cve_tests=yes
9946         ;;
9947     esac
9949 if test "$enable_cve_tests" = "no"; then
9950     AC_MSG_RESULT([no])
9951     DISABLE_CVE_TESTS=TRUE
9952     AC_SUBST(DISABLE_CVE_TESTS)
9953 else
9954     AC_MSG_RESULT([yes])
9957 dnl ===================================================================
9958 dnl Check for enabling chart XShape tests
9959 dnl ===================================================================
9960 AC_MSG_CHECKING([whether to execute chart XShape tests])
9961 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9962     AC_MSG_RESULT([yes])
9963     ENABLE_CHART_TESTS=TRUE
9964     AC_SUBST(ENABLE_CHART_TESTS)
9965 else
9966     AC_MSG_RESULT([no])
9969 dnl ===================================================================
9970 dnl Check for system openssl
9971 dnl ===================================================================
9972 DISABLE_OPENSSL=
9973 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9974 if test "$enable_openssl" = "yes"; then
9975     AC_MSG_RESULT([no])
9976     if test "$_os" = Darwin ; then
9977         # OpenSSL is deprecated when building for 10.7 or later.
9978         #
9979         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9980         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9982         with_system_openssl=no
9983         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9984     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9985             && test "$with_system_openssl" != "no"; then
9986         with_system_openssl=yes
9987         SYSTEM_OPENSSL=TRUE
9988         OPENSSL_CFLAGS=
9989         OPENSSL_LIBS="-lssl -lcrypto"
9990     else
9991         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9992     fi
9993     if test "$with_system_openssl" = "yes"; then
9994         AC_MSG_CHECKING([whether openssl supports SHA512])
9995         AC_LANG_PUSH([C])
9996         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9997             SHA512_CTX context;
9998 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9999         AC_LANG_POP(C)
10000     fi
10001 else
10002     AC_MSG_RESULT([yes])
10003     DISABLE_OPENSSL=TRUE
10005     # warn that although OpenSSL is disabled, system libraries may depend on it
10006     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10007     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10010 AC_SUBST([DISABLE_OPENSSL])
10012 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10013     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10014         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10015         enable_cipher_openssl_backend=no
10016     else
10017         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10018     fi
10020 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10021 ENABLE_CIPHER_OPENSSL_BACKEND=
10022 if test "$enable_cipher_openssl_backend" = yes; then
10023     AC_MSG_RESULT([yes])
10024     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10025 else
10026     AC_MSG_RESULT([no])
10028 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10030 dnl ===================================================================
10031 dnl Check for building gnutls
10032 dnl ===================================================================
10033 AC_MSG_CHECKING([whether to use gnutls])
10034 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10035     AC_MSG_RESULT([yes])
10036     AM_PATH_LIBGCRYPT()
10037     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10038         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10039                       available in the system to use as replacement.]]))
10040     FilterLibs "${LIBGCRYPT_LIBS}"
10041     LIBGCRYPT_LIBS="${filteredlibs}"
10042 else
10043     AC_MSG_RESULT([no])
10046 AC_SUBST([LIBGCRYPT_CFLAGS])
10047 AC_SUBST([LIBGCRYPT_LIBS])
10049 dnl ===================================================================
10050 dnl Check for system redland
10051 dnl ===================================================================
10052 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10053 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10054 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10055 if test "$with_system_redland" = "yes"; then
10056     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10057             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10058 else
10059     RAPTOR_MAJOR="0"
10060     RASQAL_MAJOR="3"
10061     REDLAND_MAJOR="0"
10063 AC_SUBST(RAPTOR_MAJOR)
10064 AC_SUBST(RASQAL_MAJOR)
10065 AC_SUBST(REDLAND_MAJOR)
10067 dnl ===================================================================
10068 dnl Check for system hunspell
10069 dnl ===================================================================
10070 AC_MSG_CHECKING([which libhunspell to use])
10071 if test "$_os" = iOS; then
10072    AC_MSG_RESULT([none])
10073 elif test "$with_system_hunspell" = "yes"; then
10074     AC_MSG_RESULT([external])
10075     SYSTEM_HUNSPELL=TRUE
10076     AC_LANG_PUSH([C++])
10077     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10078     if test "$HUNSPELL_PC" != "TRUE"; then
10079         AC_CHECK_HEADER(hunspell.hxx, [],
10080             [
10081             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10082             [AC_MSG_ERROR(hunspell headers not found.)], [])
10083             ], [])
10084         AC_CHECK_LIB([hunspell], [main], [:],
10085            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10086         HUNSPELL_LIBS=-lhunspell
10087     fi
10088     AC_LANG_POP([C++])
10089     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10090     FilterLibs "${HUNSPELL_LIBS}"
10091     HUNSPELL_LIBS="${filteredlibs}"
10092 else
10093     AC_MSG_RESULT([internal])
10094     SYSTEM_HUNSPELL=
10095     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10096     if test "$COM" = "MSC"; then
10097         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10098     else
10099         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10100     fi
10101     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10103 AC_SUBST(SYSTEM_HUNSPELL)
10104 AC_SUBST(HUNSPELL_CFLAGS)
10105 AC_SUBST(HUNSPELL_LIBS)
10107 dnl ===================================================================
10108 dnl Check for system qrcodegen
10109 dnl ===================================================================
10110 AC_MSG_CHECKING([which libqrcodegen to use])
10111 if test "$with_system_qrcodegen" = "yes"; then
10112     AC_MSG_RESULT([external])
10113     SYSTEM_QRCODEGEN=TRUE
10114     AC_LANG_PUSH([C++])
10115     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10116         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10117     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10118         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10119     QRCODEGEN_LIBS=-lqrcodegencpp
10120     AC_LANG_POP([C++])
10121     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10122     FilterLibs "${QRCODEGEN_LIBS}"
10123     QRCODEGEN_LIBS="${filteredlibs}"
10124 else
10125     AC_MSG_RESULT([internal])
10126     SYSTEM_QRCODEGEN=
10127     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10129 AC_SUBST(SYSTEM_QRCODEGEN)
10130 AC_SUBST(QRCODEGEN_CFLAGS)
10131 AC_SUBST(QRCODEGEN_LIBS)
10133 dnl ===================================================================
10134 dnl Checking for altlinuxhyph
10135 dnl ===================================================================
10136 AC_MSG_CHECKING([which altlinuxhyph to use])
10137 if test "$with_system_altlinuxhyph" = "yes"; then
10138     AC_MSG_RESULT([external])
10139     SYSTEM_HYPH=TRUE
10140     AC_CHECK_HEADER(hyphen.h, [],
10141        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10142     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10143        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10144        [#include <hyphen.h>])
10145     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10146         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10147     if test -z "$HYPHEN_LIB"; then
10148         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10149            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10150     fi
10151     if test -z "$HYPHEN_LIB"; then
10152         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10153            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10154     fi
10155 else
10156     AC_MSG_RESULT([internal])
10157     SYSTEM_HYPH=
10158     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10159     if test "$COM" = "MSC"; then
10160         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10161     else
10162         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10163     fi
10165 AC_SUBST(SYSTEM_HYPH)
10166 AC_SUBST(HYPHEN_LIB)
10168 dnl ===================================================================
10169 dnl Checking for mythes
10170 dnl ===================================================================
10171 AC_MSG_CHECKING([which mythes to use])
10172 if test "$_os" = iOS; then
10173    AC_MSG_RESULT([none])
10174 elif test "$with_system_mythes" = "yes"; then
10175     AC_MSG_RESULT([external])
10176     SYSTEM_MYTHES=TRUE
10177     AC_LANG_PUSH([C++])
10178     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10179     if test "$MYTHES_PKGCONFIG" = "no"; then
10180         AC_CHECK_HEADER(mythes.hxx, [],
10181             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10182         AC_CHECK_LIB([mythes-1.2], [main], [:],
10183             [ MYTHES_FOUND=no], [])
10184     if test "$MYTHES_FOUND" = "no"; then
10185         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10186                 [ MYTHES_FOUND=no], [])
10187     fi
10188     if test "$MYTHES_FOUND" = "no"; then
10189         AC_MSG_ERROR([mythes library not found!.])
10190     fi
10191     fi
10192     AC_LANG_POP([C++])
10193     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10194     FilterLibs "${MYTHES_LIBS}"
10195     MYTHES_LIBS="${filteredlibs}"
10196 else
10197     AC_MSG_RESULT([internal])
10198     SYSTEM_MYTHES=
10199     BUILD_TYPE="$BUILD_TYPE MYTHES"
10200     if test "$COM" = "MSC"; then
10201         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10202     else
10203         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10204     fi
10206 AC_SUBST(SYSTEM_MYTHES)
10207 AC_SUBST(MYTHES_CFLAGS)
10208 AC_SUBST(MYTHES_LIBS)
10210 dnl ===================================================================
10211 dnl How should we build the linear programming solver ?
10212 dnl ===================================================================
10214 ENABLE_COINMP=
10215 AC_MSG_CHECKING([whether to build with CoinMP])
10216 if test "$enable_coinmp" != "no"; then
10217     ENABLE_COINMP=TRUE
10218     AC_MSG_RESULT([yes])
10219     if test "$with_system_coinmp" = "yes"; then
10220         SYSTEM_COINMP=TRUE
10221         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10222         FilterLibs "${COINMP_LIBS}"
10223         COINMP_LIBS="${filteredlibs}"
10224     else
10225         BUILD_TYPE="$BUILD_TYPE COINMP"
10226     fi
10227 else
10228     AC_MSG_RESULT([no])
10230 AC_SUBST(ENABLE_COINMP)
10231 AC_SUBST(SYSTEM_COINMP)
10232 AC_SUBST(COINMP_CFLAGS)
10233 AC_SUBST(COINMP_LIBS)
10235 ENABLE_LPSOLVE=
10236 AC_MSG_CHECKING([whether to build with lpsolve])
10237 if test "$enable_lpsolve" != "no"; then
10238     ENABLE_LPSOLVE=TRUE
10239     AC_MSG_RESULT([yes])
10240 else
10241     AC_MSG_RESULT([no])
10243 AC_SUBST(ENABLE_LPSOLVE)
10245 if test "$ENABLE_LPSOLVE" = TRUE; then
10246     AC_MSG_CHECKING([which lpsolve to use])
10247     if test "$with_system_lpsolve" = "yes"; then
10248         AC_MSG_RESULT([external])
10249         SYSTEM_LPSOLVE=TRUE
10250         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10251            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10252         save_LIBS=$LIBS
10253         # some systems need this. Like Ubuntu...
10254         AC_CHECK_LIB(m, floor)
10255         AC_CHECK_LIB(dl, dlopen)
10256         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10257             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10258         LIBS=$save_LIBS
10259     else
10260         AC_MSG_RESULT([internal])
10261         SYSTEM_LPSOLVE=
10262         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10263     fi
10265 AC_SUBST(SYSTEM_LPSOLVE)
10267 dnl ===================================================================
10268 dnl Checking for libexttextcat
10269 dnl ===================================================================
10270 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10271 if test "$with_system_libexttextcat" = "yes"; then
10272     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10274 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10276 dnl ===================================================================
10277 dnl Checking for libnumbertext
10278 dnl ===================================================================
10279 AC_MSG_CHECKING([whether to use libnumbertext])
10280 if test "$enable_libnumbertext" = "no"; then
10281     AC_MSG_RESULT([no])
10282     ENABLE_LIBNUMBERTEXT=
10283     SYSTEM_LIBNUMBERTEXT=
10284 else
10285     AC_MSG_RESULT([yes])
10286     ENABLE_LIBNUMBERTEXT=TRUE
10287     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10288     if test "$with_system_libnumbertext" = "yes"; then
10289         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10290         SYSTEM_LIBNUMBERTEXT=YES
10291     else
10292         SYSTEM_LIBNUMBERTEXT=
10293         AC_LANG_PUSH([C++])
10294         save_CPPFLAGS=$CPPFLAGS
10295         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10296         AC_CHECK_HEADERS([codecvt regex])
10297         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10298                 [ ENABLE_LIBNUMBERTEXT=''
10299                   LIBNUMBERTEXT_CFLAGS=''
10300                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10301                                Enable libnumbertext fallback (missing number to number name conversion).])
10302                 ])
10303         CPPFLAGS=$save_CPPFLAGS
10304         AC_LANG_POP([C++])
10305     fi
10306     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10307         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10308     fi
10310 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10311 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10312 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10313 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10315 dnl ***************************************
10316 dnl testing libc version for Linux...
10317 dnl ***************************************
10318 if test "$_os" = "Linux"; then
10319     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10320     exec 6>/dev/null # no output
10321     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10322     exec 6>&1 # output on again
10323     if test "$HAVE_LIBC"; then
10324         AC_MSG_RESULT([yes])
10325     else
10326         AC_MSG_ERROR([no, upgrade libc])
10327     fi
10330 dnl =========================================
10331 dnl Check for uuidgen
10332 dnl =========================================
10333 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10334     # presence is already tested above in the WINDOWS_SDK_HOME check
10335     UUIDGEN=uuidgen.exe
10336     AC_SUBST(UUIDGEN)
10337 else
10338     AC_PATH_PROG([UUIDGEN], [uuidgen])
10339     if test -z "$UUIDGEN"; then
10340         AC_MSG_WARN([uuid is needed for building installation sets])
10341     fi
10344 dnl ***************************************
10345 dnl Checking for bison and flex
10346 dnl ***************************************
10347 AC_PATH_PROG(BISON, bison)
10348 if test -z "$BISON"; then
10349     AC_MSG_ERROR([no bison found in \$PATH, install it])
10350 else
10351     AC_MSG_CHECKING([the bison version])
10352     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10353     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10354     # Accept newer than 2.0
10355     if test "$_bison_longver" -lt 2000; then
10356         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10357     fi
10360 AC_PATH_PROG(FLEX, flex)
10361 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10362     FLEX=`cygpath -m $FLEX`
10364 if test -z "$FLEX"; then
10365     AC_MSG_ERROR([no flex found in \$PATH, install it])
10366 else
10367     AC_MSG_CHECKING([the flex version])
10368     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10369     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10370         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10371     fi
10373 AC_SUBST([FLEX])
10374 dnl ***************************************
10375 dnl Checking for patch
10376 dnl ***************************************
10377 AC_PATH_PROG(PATCH, patch)
10378 if test -z "$PATCH"; then
10379     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10382 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10383 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10384     if test -z "$with_gnu_patch"; then
10385         GNUPATCH=$PATCH
10386     else
10387         if test -x "$with_gnu_patch"; then
10388             GNUPATCH=$with_gnu_patch
10389         else
10390             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10391         fi
10392     fi
10394     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10395     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10396         AC_MSG_RESULT([yes])
10397     else
10398         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10399     fi
10400 else
10401     GNUPATCH=$PATCH
10404 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10405     GNUPATCH=`cygpath -m $GNUPATCH`
10408 dnl We also need to check for --with-gnu-cp
10410 if test -z "$with_gnu_cp"; then
10411     # check the place where the good stuff is hidden on Solaris...
10412     if test -x /usr/gnu/bin/cp; then
10413         GNUCP=/usr/gnu/bin/cp
10414     else
10415         AC_PATH_PROGS(GNUCP, gnucp cp)
10416     fi
10417     if test -z $GNUCP; then
10418         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10419     fi
10420 else
10421     if test -x "$with_gnu_cp"; then
10422         GNUCP=$with_gnu_cp
10423     else
10424         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10425     fi
10428 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10429     GNUCP=`cygpath -m $GNUCP`
10432 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10433 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10434     AC_MSG_RESULT([yes])
10435 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10436     AC_MSG_RESULT([yes])
10437 else
10438     case "$build_os" in
10439     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10440         x_GNUCP=[\#]
10441         GNUCP=''
10442         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10443         ;;
10444     *)
10445         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10446         ;;
10447     esac
10450 AC_SUBST(GNUPATCH)
10451 AC_SUBST(GNUCP)
10452 AC_SUBST(x_GNUCP)
10454 dnl ***************************************
10455 dnl testing assembler path
10456 dnl ***************************************
10457 ML_EXE=""
10458 if test "$_os" = "WINNT"; then
10459     if test "$BITNESS_OVERRIDE" = ""; then
10460         assembler=ml.exe
10461     else
10462         assembler=ml64.exe
10463     fi
10465     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10466     if test -f "$CL_PATH/$assembler"; then
10467         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10468         AC_MSG_RESULT([$ML_EXE])
10469     else
10470         AC_MSG_ERROR([not found])
10471     fi
10474 AC_SUBST(ML_EXE)
10476 dnl ===================================================================
10477 dnl We need zip and unzip
10478 dnl ===================================================================
10479 AC_PATH_PROG(ZIP, zip)
10480 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10481 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10482     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],,)
10485 AC_PATH_PROG(UNZIP, unzip)
10486 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10488 dnl ===================================================================
10489 dnl Zip must be a specific type for different build types.
10490 dnl ===================================================================
10491 if test $build_os = cygwin; then
10492     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10493         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10494     fi
10497 dnl ===================================================================
10498 dnl We need touch with -h option support.
10499 dnl ===================================================================
10500 AC_PATH_PROG(TOUCH, touch)
10501 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10502 touch warn
10503 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10504     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],,)
10507 dnl ===================================================================
10508 dnl Check for system epoxy
10509 dnl ===================================================================
10510 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10512 dnl ===================================================================
10513 dnl Set vcl option: coordinate device in double or sal_Int32
10514 dnl ===================================================================
10516 dnl disabled for now, we don't want subtle differences between OSs
10517 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10518 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10519 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10520 dnl     AC_MSG_RESULT([double])
10521 dnl else
10522 dnl     AC_MSG_RESULT([sal_Int32])
10523 dnl fi
10525 dnl ===================================================================
10526 dnl Test which vclplugs have to be built.
10527 dnl ===================================================================
10528 R=""
10529 if test "$USING_X11" != TRUE; then
10530     enable_gtk3=no
10532 GTK3_CFLAGS=""
10533 GTK3_LIBS=""
10534 ENABLE_GTK3=""
10535 if test "x$enable_gtk3" = "xyes"; then
10536     if test "$with_system_cairo" = no; then
10537         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10538     fi
10539     : ${with_system_cairo:=yes}
10540     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="")
10541     if test "x$ENABLE_GTK3" = "xTRUE"; then
10542         AC_DEFINE(ENABLE_GTK3)
10543         R="gtk3"
10544     else
10545         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10546     fi
10547     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10548     FilterLibs "${GTK3_LIBS}"
10549     GTK3_LIBS="${filteredlibs}"
10551     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10552     if test "$with_system_epoxy" != "yes"; then
10553         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10554         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10555                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10556     fi
10558 AC_SUBST(GTK3_LIBS)
10559 AC_SUBST(GTK3_CFLAGS)
10560 AC_SUBST(ENABLE_GTK3)
10562 if test "$enable_introspection" = yes; then
10563     if test "$ENABLE_GTK3" = TRUE; then
10564         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10565     else
10566         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10567     fi
10570 ENABLE_QT5=""
10571 if test "x$enable_qt5" = "xyes"; then
10572     ENABLE_QT5="TRUE"
10573     AC_DEFINE(ENABLE_QT5)
10574     R="$R qt5"
10576 AC_SUBST(ENABLE_QT5)
10578 ENABLE_KF5=""
10579 if test "x$enable_kf5" = "xyes"; then
10580     ENABLE_KF5="TRUE"
10581     AC_DEFINE(ENABLE_KF5)
10582     R="$R kf5"
10584 AC_SUBST(ENABLE_KF5)
10586 ENABLE_GTK3_KDE5=""
10587 if test "x$enable_gtk3_kde5" = "xyes"; then
10588     ENABLE_GTK3_KDE5="TRUE"
10589     AC_DEFINE(ENABLE_GTK3_KDE5)
10590     R="$R gtk3_kde5"
10592 AC_SUBST(ENABLE_GTK3_KDE5)
10594 if test "$_os" = "WINNT"; then
10595     R="$R win"
10596 elif test "$_os" = "Darwin"; then
10597     R="$R osx"
10598 elif test "$_os" = "iOS"; then
10599     R="ios (builtin)"
10602 build_vcl_plugins="$R"
10603 if test -z "$build_vcl_plugins"; then
10604     build_vcl_plugins="none"
10606 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10608 dnl ===================================================================
10609 dnl check for dbus support
10610 dnl ===================================================================
10611 ENABLE_DBUS=""
10612 DBUS_CFLAGS=""
10613 DBUS_LIBS=""
10614 DBUS_GLIB_CFLAGS=""
10615 DBUS_GLIB_LIBS=""
10616 DBUS_HAVE_GLIB=""
10618 if test "$enable_dbus" = "no"; then
10619     test_dbus=no
10622 AC_MSG_CHECKING([whether to enable DBUS support])
10623 if test "$test_dbus" = "yes"; then
10624     ENABLE_DBUS="TRUE"
10625     AC_MSG_RESULT([yes])
10626     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10627     AC_DEFINE(ENABLE_DBUS)
10628     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10629     FilterLibs "${DBUS_LIBS}"
10630     DBUS_LIBS="${filteredlibs}"
10632     # Glib is needed for BluetoothServer
10633     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10634     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10635         [
10636             DBUS_HAVE_GLIB="TRUE"
10637             AC_DEFINE(DBUS_HAVE_GLIB,1)
10638         ],
10639         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10640     )
10641 else
10642     AC_MSG_RESULT([no])
10645 AC_SUBST(ENABLE_DBUS)
10646 AC_SUBST(DBUS_CFLAGS)
10647 AC_SUBST(DBUS_LIBS)
10648 AC_SUBST(DBUS_GLIB_CFLAGS)
10649 AC_SUBST(DBUS_GLIB_LIBS)
10650 AC_SUBST(DBUS_HAVE_GLIB)
10652 AC_MSG_CHECKING([whether to enable Impress remote control])
10653 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10654     AC_MSG_RESULT([yes])
10655     ENABLE_SDREMOTE=TRUE
10656     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10658     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10659         # The Bluetooth code doesn't compile with macOS SDK 10.15
10660         enable_sdremote_bluetooth=no
10661     fi
10662     # If not explicitly enabled or disabled, default
10663     if test -z "$enable_sdremote_bluetooth"; then
10664         case "$OS" in
10665         LINUX|MACOSX|WNT)
10666             # Default to yes for these
10667             enable_sdremote_bluetooth=yes
10668             ;;
10669         *)
10670             # otherwise no
10671             enable_sdremote_bluetooth=no
10672             ;;
10673         esac
10674     fi
10675     # $enable_sdremote_bluetooth is guaranteed non-empty now
10677     if test "$enable_sdremote_bluetooth" != "no"; then
10678         if test "$OS" = "LINUX"; then
10679             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10680                 AC_MSG_RESULT([yes])
10681                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10682                 dnl ===================================================================
10683                 dnl Check for system bluez
10684                 dnl ===================================================================
10685                 AC_MSG_CHECKING([which Bluetooth header to use])
10686                 if test "$with_system_bluez" = "yes"; then
10687                     AC_MSG_RESULT([external])
10688                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10689                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10690                     SYSTEM_BLUEZ=TRUE
10691                 else
10692                     AC_MSG_RESULT([internal])
10693                     SYSTEM_BLUEZ=
10694                 fi
10695             else
10696                 AC_MSG_RESULT([no, dbus disabled])
10697                 ENABLE_SDREMOTE_BLUETOOTH=
10698                 SYSTEM_BLUEZ=
10699             fi
10700         else
10701             AC_MSG_RESULT([yes])
10702             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10703             SYSTEM_BLUEZ=
10704         fi
10705     else
10706         AC_MSG_RESULT([no])
10707         ENABLE_SDREMOTE_BLUETOOTH=
10708         SYSTEM_BLUEZ=
10709     fi
10710 else
10711     ENABLE_SDREMOTE=
10712     SYSTEM_BLUEZ=
10713     AC_MSG_RESULT([no])
10715 AC_SUBST(ENABLE_SDREMOTE)
10716 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10717 AC_SUBST(SYSTEM_BLUEZ)
10719 dnl ===================================================================
10720 dnl Check whether to enable GIO support
10721 dnl ===================================================================
10722 if test "$ENABLE_GTK3" = "TRUE"; then
10723     AC_MSG_CHECKING([whether to enable GIO support])
10724     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10725         dnl Need at least 2.26 for the dbus support.
10726         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10727                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10728         if test "$ENABLE_GIO" = "TRUE"; then
10729             AC_DEFINE(ENABLE_GIO)
10730             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10731             FilterLibs "${GIO_LIBS}"
10732             GIO_LIBS="${filteredlibs}"
10733         fi
10734     else
10735         AC_MSG_RESULT([no])
10736     fi
10738 AC_SUBST(ENABLE_GIO)
10739 AC_SUBST(GIO_CFLAGS)
10740 AC_SUBST(GIO_LIBS)
10743 dnl ===================================================================
10745 SPLIT_APP_MODULES=""
10746 if test "$enable_split_app_modules" = "yes"; then
10747     SPLIT_APP_MODULES="TRUE"
10749 AC_SUBST(SPLIT_APP_MODULES)
10751 SPLIT_OPT_FEATURES=""
10752 if test "$enable_split_opt_features" = "yes"; then
10753     SPLIT_OPT_FEATURES="TRUE"
10755 AC_SUBST(SPLIT_OPT_FEATURES)
10757 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10758     if test "$enable_cairo_canvas" = yes; then
10759         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10760     fi
10761     enable_cairo_canvas=no
10762 elif test -z "$enable_cairo_canvas"; then
10763     enable_cairo_canvas=yes
10766 ENABLE_CAIRO_CANVAS=""
10767 if test "$enable_cairo_canvas" = "yes"; then
10768     test_cairo=yes
10769     ENABLE_CAIRO_CANVAS="TRUE"
10770     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10772 AC_SUBST(ENABLE_CAIRO_CANVAS)
10774 dnl ===================================================================
10775 dnl Check whether the GStreamer libraries are available.
10776 dnl ===================================================================
10778 ENABLE_GSTREAMER_1_0=""
10780 if test "$build_gstreamer_1_0" = "yes"; then
10782     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10783     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10784         ENABLE_GSTREAMER_1_0="TRUE"
10785         AC_MSG_RESULT([yes])
10786         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10787         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10788         FilterLibs "${GSTREAMER_1_0_LIBS}"
10789         GSTREAMER_1_0_LIBS="${filteredlibs}"
10790         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10791     else
10792         AC_MSG_RESULT([no])
10793     fi
10795 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10796 AC_SUBST(GSTREAMER_1_0_LIBS)
10797 AC_SUBST(ENABLE_GSTREAMER_1_0)
10799 dnl ===================================================================
10800 dnl Check whether to build the VLC avmedia backend
10801 dnl ===================================================================
10803 ENABLE_VLC=""
10805 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10806 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10807     ENABLE_VLC="TRUE"
10808     AC_MSG_RESULT([yes])
10809 else
10810     AC_MSG_RESULT([no])
10812 AC_SUBST(ENABLE_VLC)
10814 ENABLE_OPENGL_TRANSITIONS=
10815 ENABLE_OPENGL_CANVAS=
10816 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10817    : # disable
10818 elif test "$_os" = "Darwin"; then
10819     # We use frameworks on macOS, no need for detail checks
10820     ENABLE_OPENGL_TRANSITIONS=TRUE
10821     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10822     ENABLE_OPENGL_CANVAS=TRUE
10823 elif test $_os = WINNT; then
10824     ENABLE_OPENGL_TRANSITIONS=TRUE
10825     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10826     ENABLE_OPENGL_CANVAS=TRUE
10827 else
10828     if test "$USING_X11" = TRUE; then
10829         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10830         ENABLE_OPENGL_TRANSITIONS=TRUE
10831         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10832         ENABLE_OPENGL_CANVAS=TRUE
10833     fi
10836 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10837 AC_SUBST(ENABLE_OPENGL_CANVAS)
10839 dnl =================================================
10840 dnl Check whether to build with OpenCL support.
10841 dnl =================================================
10843 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10844     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10845     # platform (optional at run-time, used through clew).
10846     BUILD_TYPE="$BUILD_TYPE OPENCL"
10847     AC_DEFINE(HAVE_FEATURE_OPENCL)
10850 dnl =================================================
10851 dnl Check whether to build with dconf support.
10852 dnl =================================================
10854 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10855     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10856         if test "$enable_dconf" = yes; then
10857             AC_MSG_ERROR([dconf not found])
10858         else
10859             enable_dconf=no
10860         fi])
10862 AC_MSG_CHECKING([whether to enable dconf])
10863 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10864     DCONF_CFLAGS=
10865     DCONF_LIBS=
10866     ENABLE_DCONF=
10867     AC_MSG_RESULT([no])
10868 else
10869     ENABLE_DCONF=TRUE
10870     AC_DEFINE(ENABLE_DCONF)
10871     AC_MSG_RESULT([yes])
10873 AC_SUBST([DCONF_CFLAGS])
10874 AC_SUBST([DCONF_LIBS])
10875 AC_SUBST([ENABLE_DCONF])
10877 # pdf import?
10878 AC_MSG_CHECKING([whether to build the PDF import feature])
10879 ENABLE_PDFIMPORT=
10880 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10881     AC_MSG_RESULT([yes])
10882     ENABLE_PDFIMPORT=TRUE
10883     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10884 else
10885     AC_MSG_RESULT([no])
10888 # Pdfium?
10889 AC_MSG_CHECKING([whether to build PDFium])
10890 ENABLE_PDFIUM=
10891 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10892     AC_MSG_RESULT([yes])
10893     ENABLE_PDFIUM=TRUE
10894     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10895     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10896 else
10897     AC_MSG_RESULT([no])
10899 AC_SUBST(ENABLE_PDFIUM)
10901 dnl ===================================================================
10902 dnl Check for poppler
10903 dnl ===================================================================
10904 ENABLE_POPPLER=
10905 AC_MSG_CHECKING([whether to build Poppler])
10906 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10907     AC_MSG_RESULT([yes])
10908     ENABLE_POPPLER=TRUE
10909     AC_DEFINE(HAVE_FEATURE_POPPLER)
10910 else
10911     AC_MSG_RESULT([no])
10913 AC_SUBST(ENABLE_POPPLER)
10915 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10916     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10919 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10920     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10923 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10924     dnl ===================================================================
10925     dnl Check for system poppler
10926     dnl ===================================================================
10927     AC_MSG_CHECKING([which PDF import poppler to use])
10928     if test "$with_system_poppler" = "yes"; then
10929         AC_MSG_RESULT([external])
10930         SYSTEM_POPPLER=TRUE
10931         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10932         AC_LANG_PUSH([C++])
10933         save_CXXFLAGS=$CXXFLAGS
10934         save_CPPFLAGS=$CPPFLAGS
10935         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10936         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10937         AC_CHECK_HEADER([cpp/poppler-version.h],
10938             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10939             [])
10940         CXXFLAGS=$save_CXXFLAGS
10941         CPPFLAGS=$save_CPPFLAGS
10942         AC_LANG_POP([C++])
10943         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10945         FilterLibs "${POPPLER_LIBS}"
10946         POPPLER_LIBS="${filteredlibs}"
10947     else
10948         AC_MSG_RESULT([internal])
10949         SYSTEM_POPPLER=
10950         BUILD_TYPE="$BUILD_TYPE POPPLER"
10951         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10952     fi
10953     AC_DEFINE([ENABLE_PDFIMPORT],1)
10955 AC_SUBST(ENABLE_PDFIMPORT)
10956 AC_SUBST(SYSTEM_POPPLER)
10957 AC_SUBST(POPPLER_CFLAGS)
10958 AC_SUBST(POPPLER_LIBS)
10960 SYSTEM_GPGMEPP=
10962 if test "$build_for_ios" = "YES"; then
10963     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10964     AC_MSG_RESULT([yes])
10965 elif test "$enable_mpl_subset" = "yes"; then
10966     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10967     AC_MSG_RESULT([yes])
10968 elif test "$enable_fuzzers" = "yes"; then
10969     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10970     AC_MSG_RESULT([yes])
10971 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10972     dnl ===================================================================
10973     dnl Check for system gpgme
10974     dnl ===================================================================
10975     AC_MSG_CHECKING([which gpgmepp to use])
10976     if test "$with_system_gpgmepp" = "yes"; then
10977         AC_MSG_RESULT([external])
10978         SYSTEM_GPGMEPP=TRUE
10980         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10981         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10982             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10983         # progress_callback is the only func with plain C linkage
10984         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10985         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10986             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10987         AC_CHECK_HEADER(gpgme.h, [],
10988             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10989     else
10990         AC_MSG_RESULT([internal])
10991         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10992         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10994         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10995         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10996         if test "$_os" != "WINNT"; then
10997             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10998             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10999         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11000             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11001         fi
11002     fi
11003     ENABLE_GPGMEPP=TRUE
11004     AC_DEFINE([HAVE_FEATURE_GPGME])
11005     AC_PATH_PROG(GPG, gpg)
11006     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11007     # so let's exclude that manually for the moment
11008     if test -n "$GPG" -a "$_os" != "WINNT"; then
11009         # make sure we not only have a working gpgme, but a full working
11010         # gpg installation to run OpenPGP signature verification
11011         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11012     fi
11013     if test "$_os" = "Linux"; then
11014       uid=`id -u`
11015       AC_MSG_CHECKING([for /run/user/$uid])
11016       if test -d /run/user/$uid; then
11017         AC_MSG_RESULT([yes])
11018         AC_PATH_PROG(GPGCONF, gpgconf)
11020         # Older versions of gpgconf are not working as expected, since
11021         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11022         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11023         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11024         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11025         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11026         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11027         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11028           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11029           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11030           if $GPGCONF --dump-options > /dev/null ; then
11031             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11032               AC_MSG_RESULT([yes])
11033               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11034               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11035             else
11036               AC_MSG_RESULT([no])
11037             fi
11038           else
11039             AC_MSG_RESULT([no. missing or broken gpgconf?])
11040           fi
11041         else
11042           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11043         fi
11044       else
11045         AC_MSG_RESULT([no])
11046      fi
11047    fi
11049 AC_SUBST(ENABLE_GPGMEPP)
11050 AC_SUBST(SYSTEM_GPGMEPP)
11051 AC_SUBST(GPG_ERROR_CFLAGS)
11052 AC_SUBST(GPG_ERROR_LIBS)
11053 AC_SUBST(LIBASSUAN_CFLAGS)
11054 AC_SUBST(LIBASSUAN_LIBS)
11055 AC_SUBST(GPGMEPP_CFLAGS)
11056 AC_SUBST(GPGMEPP_LIBS)
11058 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11059 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11060     AC_MSG_RESULT([yes])
11061     ENABLE_MEDIAWIKI=TRUE
11062     BUILD_TYPE="$BUILD_TYPE XSLTML"
11063     if test  "x$with_java" = "xno"; then
11064         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11065     fi
11066 else
11067     AC_MSG_RESULT([no])
11068     ENABLE_MEDIAWIKI=
11069     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11071 AC_SUBST(ENABLE_MEDIAWIKI)
11073 AC_MSG_CHECKING([whether to build the Report Builder])
11074 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11075     AC_MSG_RESULT([yes])
11076     ENABLE_REPORTBUILDER=TRUE
11077     AC_MSG_CHECKING([which jfreereport libs to use])
11078     if test "$with_system_jfreereport" = "yes"; then
11079         SYSTEM_JFREEREPORT=TRUE
11080         AC_MSG_RESULT([external])
11081         if test -z $SAC_JAR; then
11082             SAC_JAR=/usr/share/java/sac.jar
11083         fi
11084         if ! test -f $SAC_JAR; then
11085              AC_MSG_ERROR(sac.jar not found.)
11086         fi
11088         if test -z $LIBXML_JAR; then
11089             if test -f /usr/share/java/libxml-1.0.0.jar; then
11090                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11091             elif test -f /usr/share/java/libxml.jar; then
11092                 LIBXML_JAR=/usr/share/java/libxml.jar
11093             else
11094                 AC_MSG_ERROR(libxml.jar replacement not found.)
11095             fi
11096         elif ! test -f $LIBXML_JAR; then
11097             AC_MSG_ERROR(libxml.jar not found.)
11098         fi
11100         if test -z $FLUTE_JAR; then
11101             if test -f/usr/share/java/flute-1.3.0.jar; then
11102                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11103             elif test -f /usr/share/java/flute.jar; then
11104                 FLUTE_JAR=/usr/share/java/flute.jar
11105             else
11106                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11107             fi
11108         elif ! test -f $FLUTE_JAR; then
11109             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11110         fi
11112         if test -z $JFREEREPORT_JAR; then
11113             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11114                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11115             elif test -f /usr/share/java/flow-engine.jar; then
11116                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11117             else
11118                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11119             fi
11120         elif ! test -f  $JFREEREPORT_JAR; then
11121                 AC_MSG_ERROR(jfreereport.jar not found.)
11122         fi
11124         if test -z $LIBLAYOUT_JAR; then
11125             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11126                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11127             elif test -f /usr/share/java/liblayout.jar; then
11128                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11129             else
11130                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11131             fi
11132         elif ! test -f $LIBLAYOUT_JAR; then
11133                 AC_MSG_ERROR(liblayout.jar not found.)
11134         fi
11136         if test -z $LIBLOADER_JAR; then
11137             if test -f /usr/share/java/libloader-1.0.0.jar; then
11138                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11139             elif test -f /usr/share/java/libloader.jar; then
11140                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11141             else
11142                 AC_MSG_ERROR(libloader.jar replacement not found.)
11143             fi
11144         elif ! test -f  $LIBLOADER_JAR; then
11145             AC_MSG_ERROR(libloader.jar not found.)
11146         fi
11148         if test -z $LIBFORMULA_JAR; then
11149             if test -f /usr/share/java/libformula-0.2.0.jar; then
11150                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11151             elif test -f /usr/share/java/libformula.jar; then
11152                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11153             else
11154                 AC_MSG_ERROR(libformula.jar replacement not found.)
11155             fi
11156         elif ! test -f $LIBFORMULA_JAR; then
11157                 AC_MSG_ERROR(libformula.jar not found.)
11158         fi
11160         if test -z $LIBREPOSITORY_JAR; then
11161             if test -f /usr/share/java/librepository-1.0.0.jar; then
11162                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11163             elif test -f /usr/share/java/librepository.jar; then
11164                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11165             else
11166                 AC_MSG_ERROR(librepository.jar replacement not found.)
11167             fi
11168         elif ! test -f $LIBREPOSITORY_JAR; then
11169             AC_MSG_ERROR(librepository.jar not found.)
11170         fi
11172         if test -z $LIBFONTS_JAR; then
11173             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11174                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11175             elif test -f /usr/share/java/libfonts.jar; then
11176                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11177             else
11178                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11179             fi
11180         elif ! test -f $LIBFONTS_JAR; then
11181                 AC_MSG_ERROR(libfonts.jar not found.)
11182         fi
11184         if test -z $LIBSERIALIZER_JAR; then
11185             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11186                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11187             elif test -f /usr/share/java/libserializer.jar; then
11188                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11189             else
11190                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11191             fi
11192         elif ! test -f $LIBSERIALIZER_JAR; then
11193                 AC_MSG_ERROR(libserializer.jar not found.)
11194         fi
11196         if test -z $LIBBASE_JAR; then
11197             if test -f /usr/share/java/libbase-1.0.0.jar; then
11198                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11199             elif test -f /usr/share/java/libbase.jar; then
11200                 LIBBASE_JAR=/usr/share/java/libbase.jar
11201             else
11202                 AC_MSG_ERROR(libbase.jar replacement not found.)
11203             fi
11204         elif ! test -f $LIBBASE_JAR; then
11205             AC_MSG_ERROR(libbase.jar not found.)
11206         fi
11208     else
11209         AC_MSG_RESULT([internal])
11210         SYSTEM_JFREEREPORT=
11211         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11212         NEED_ANT=TRUE
11213     fi
11214 else
11215     AC_MSG_RESULT([no])
11216     ENABLE_REPORTBUILDER=
11217     SYSTEM_JFREEREPORT=
11219 AC_SUBST(ENABLE_REPORTBUILDER)
11220 AC_SUBST(SYSTEM_JFREEREPORT)
11221 AC_SUBST(SAC_JAR)
11222 AC_SUBST(LIBXML_JAR)
11223 AC_SUBST(FLUTE_JAR)
11224 AC_SUBST(JFREEREPORT_JAR)
11225 AC_SUBST(LIBBASE_JAR)
11226 AC_SUBST(LIBLAYOUT_JAR)
11227 AC_SUBST(LIBLOADER_JAR)
11228 AC_SUBST(LIBFORMULA_JAR)
11229 AC_SUBST(LIBREPOSITORY_JAR)
11230 AC_SUBST(LIBFONTS_JAR)
11231 AC_SUBST(LIBSERIALIZER_JAR)
11233 # this has to be here because both the Wiki Publisher and the SRB use
11234 # commons-logging
11235 COMMONS_LOGGING_VERSION=1.2
11236 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11237     AC_MSG_CHECKING([which Apache commons-* libs to use])
11238     if test "$with_system_apache_commons" = "yes"; then
11239         SYSTEM_APACHE_COMMONS=TRUE
11240         AC_MSG_RESULT([external])
11241         if test -z $COMMONS_LOGGING_JAR; then
11242             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11243                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11244            elif test -f /usr/share/java/commons-logging.jar; then
11245                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11246             else
11247                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11248             fi
11249         elif ! test -f $COMMONS_LOGGING_JAR; then
11250             AC_MSG_ERROR(commons-logging.jar not found.)
11251         fi
11252     else
11253         AC_MSG_RESULT([internal])
11254         SYSTEM_APACHE_COMMONS=
11255         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11256         NEED_ANT=TRUE
11257     fi
11259 AC_SUBST(SYSTEM_APACHE_COMMONS)
11260 AC_SUBST(COMMONS_LOGGING_JAR)
11261 AC_SUBST(COMMONS_LOGGING_VERSION)
11263 # scripting provider for BeanShell?
11264 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11265 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11266     AC_MSG_RESULT([yes])
11267     ENABLE_SCRIPTING_BEANSHELL=TRUE
11269     dnl ===================================================================
11270     dnl Check for system beanshell
11271     dnl ===================================================================
11272     AC_MSG_CHECKING([which beanshell to use])
11273     if test "$with_system_beanshell" = "yes"; then
11274         AC_MSG_RESULT([external])
11275         SYSTEM_BSH=TRUE
11276         if test -z $BSH_JAR; then
11277             BSH_JAR=/usr/share/java/bsh.jar
11278         fi
11279         if ! test -f $BSH_JAR; then
11280             AC_MSG_ERROR(bsh.jar not found.)
11281         fi
11282     else
11283         AC_MSG_RESULT([internal])
11284         SYSTEM_BSH=
11285         BUILD_TYPE="$BUILD_TYPE BSH"
11286     fi
11287 else
11288     AC_MSG_RESULT([no])
11289     ENABLE_SCRIPTING_BEANSHELL=
11290     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11292 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11293 AC_SUBST(SYSTEM_BSH)
11294 AC_SUBST(BSH_JAR)
11296 # scripting provider for JavaScript?
11297 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11298 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11299     AC_MSG_RESULT([yes])
11300     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11302     dnl ===================================================================
11303     dnl Check for system rhino
11304     dnl ===================================================================
11305     AC_MSG_CHECKING([which rhino to use])
11306     if test "$with_system_rhino" = "yes"; then
11307         AC_MSG_RESULT([external])
11308         SYSTEM_RHINO=TRUE
11309         if test -z $RHINO_JAR; then
11310             RHINO_JAR=/usr/share/java/js.jar
11311         fi
11312         if ! test -f $RHINO_JAR; then
11313             AC_MSG_ERROR(js.jar not found.)
11314         fi
11315     else
11316         AC_MSG_RESULT([internal])
11317         SYSTEM_RHINO=
11318         BUILD_TYPE="$BUILD_TYPE RHINO"
11319         NEED_ANT=TRUE
11320     fi
11321 else
11322     AC_MSG_RESULT([no])
11323     ENABLE_SCRIPTING_JAVASCRIPT=
11324     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11326 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11327 AC_SUBST(SYSTEM_RHINO)
11328 AC_SUBST(RHINO_JAR)
11330 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11331 # paths should be added to library search path. So lets put all 64-bit
11332 # platforms there.
11333 supports_multilib=
11334 case "$host_cpu" in
11335 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11336     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11337         supports_multilib="yes"
11338     fi
11339     ;;
11341     ;;
11342 esac
11344 dnl ===================================================================
11345 dnl QT5 Integration
11346 dnl ===================================================================
11348 QT5_CFLAGS=""
11349 QT5_LIBS=""
11350 QMAKE5="qmake"
11351 MOC5="moc"
11352 QT5_GOBJECT_CFLAGS=""
11353 QT5_GOBJECT_LIBS=""
11354 QT5_HAVE_GOBJECT=""
11355 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11356         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11357         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11358 then
11359     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11360     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11362     if test -n "$supports_multilib"; then
11363         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11364     fi
11366     qt5_test_include="QtWidgets/qapplication.h"
11367     qt5_test_library="libQt5Widgets.so"
11369     dnl Check for qmake5
11370     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11371     if test "$QMAKE5" = "no"; then
11372         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11373     else
11374         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11375         if test -z "$qmake5_test_ver"; then
11376             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11377         fi
11378         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11379         qt5_minimal_minor="6"
11380         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11381             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11382         else
11383             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11384         fi
11385     fi
11387     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11388     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11390     AC_MSG_CHECKING([for Qt5 headers])
11391     qt5_incdir="no"
11392     for inc_dir in $qt5_incdirs; do
11393         if test -r "$inc_dir/$qt5_test_include"; then
11394             qt5_incdir="$inc_dir"
11395             break
11396         fi
11397     done
11398     AC_MSG_RESULT([$qt5_incdir])
11399     if test "x$qt5_incdir" = "xno"; then
11400         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11401     fi
11403     AC_MSG_CHECKING([for Qt5 libraries])
11404     qt5_libdir="no"
11405     for lib_dir in $qt5_libdirs; do
11406         if test -r "$lib_dir/$qt5_test_library"; then
11407             qt5_libdir="$lib_dir"
11408             break
11409         fi
11410     done
11411     AC_MSG_RESULT([$qt5_libdir])
11412     if test "x$qt5_libdir" = "xno"; then
11413         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11414     fi
11416     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11417     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11418     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11420     if test "$USING_X11" = TRUE; then
11421         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11422         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11423             QT5_HAVE_XCB_ICCCM=1
11424             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11425         ],[
11426             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
11427             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11428         ])
11429         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11430         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11431         QT5_USING_X11=1
11432         AC_DEFINE(QT5_USING_X11)
11433     fi
11435     dnl Check for Meta Object Compiler
11437     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11438     if test "$MOC5" = "no"; then
11439         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11440 the root of your Qt installation by exporting QT5DIR before running "configure".])
11441     fi
11443     if test "$build_gstreamer_1_0" = "yes"; then
11444         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11445                 QT5_HAVE_GOBJECT=1
11446                 AC_DEFINE(QT5_HAVE_GOBJECT)
11447             ],
11448             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11449         )
11450     fi
11452 AC_SUBST(QT5_CFLAGS)
11453 AC_SUBST(QT5_LIBS)
11454 AC_SUBST(MOC5)
11455 AC_SUBST(QT5_GOBJECT_CFLAGS)
11456 AC_SUBST(QT5_GOBJECT_LIBS)
11457 AC_SUBST(QT5_HAVE_GOBJECT)
11459 dnl ===================================================================
11460 dnl KF5 Integration
11461 dnl ===================================================================
11463 KF5_CFLAGS=""
11464 KF5_LIBS=""
11465 KF5_CONFIG="kf5-config"
11466 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11467         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11468 then
11469     if test "$OS" = "HAIKU"; then
11470         haiku_arch="`echo $RTL_ARCH | tr X x`"
11471         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11472         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11473     fi
11475     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11476     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11477     if test -n "$supports_multilib"; then
11478         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11479     fi
11481     kf5_test_include="KF5/kcoreaddons_version.h"
11482     kf5_test_library="libKF5CoreAddons.so"
11483     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11485     dnl kf5 KDE4 support compatibility installed
11486     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11487     if test "$KF5_CONFIG" != "no"; then
11488         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11489         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11490     fi
11492     dnl Check for KF5 headers
11493     AC_MSG_CHECKING([for KF5 headers])
11494     kf5_incdir="no"
11495     for kf5_check in $kf5_incdirs; do
11496         if test -r "$kf5_check/$kf5_test_include"; then
11497             kf5_incdir="$kf5_check/KF5"
11498             break
11499         fi
11500     done
11501     AC_MSG_RESULT([$kf5_incdir])
11502     if test "x$kf5_incdir" = "xno"; then
11503         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11504     fi
11506     dnl Check for KF5 libraries
11507     AC_MSG_CHECKING([for KF5 libraries])
11508     kf5_libdir="no"
11509     for kf5_check in $kf5_libdirs; do
11510         if test -r "$kf5_check/$kf5_test_library"; then
11511             kf5_libdir="$kf5_check"
11512             break
11513         fi
11514     done
11516     AC_MSG_RESULT([$kf5_libdir])
11517     if test "x$kf5_libdir" = "xno"; then
11518         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11519     fi
11521     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"
11522     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11523     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11525     if test "$USING_X11" = TRUE; then
11526         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11527     fi
11529     AC_LANG_PUSH([C++])
11530     save_CXXFLAGS=$CXXFLAGS
11531     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11532     AC_MSG_CHECKING([whether KDE is >= 5.0])
11533        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11534 #include <kcoreaddons_version.h>
11536 int main(int argc, char **argv) {
11537        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11538        else return 1;
11540        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11541     CXXFLAGS=$save_CXXFLAGS
11542     AC_LANG_POP([C++])
11544 AC_SUBST(KF5_CFLAGS)
11545 AC_SUBST(KF5_LIBS)
11547 dnl ===================================================================
11548 dnl Test whether to include Evolution 2 support
11549 dnl ===================================================================
11550 AC_MSG_CHECKING([whether to enable evolution 2 support])
11551 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11552     AC_MSG_RESULT([yes])
11553     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11554     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11555     FilterLibs "${GOBJECT_LIBS}"
11556     GOBJECT_LIBS="${filteredlibs}"
11557     ENABLE_EVOAB2="TRUE"
11558 else
11559     ENABLE_EVOAB2=""
11560     AC_MSG_RESULT([no])
11562 AC_SUBST(ENABLE_EVOAB2)
11563 AC_SUBST(GOBJECT_CFLAGS)
11564 AC_SUBST(GOBJECT_LIBS)
11566 dnl ===================================================================
11567 dnl Test which themes to include
11568 dnl ===================================================================
11569 AC_MSG_CHECKING([which themes to include])
11570 # if none given use default subset of available themes
11571 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11572     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg tango"
11575 WITH_THEMES=""
11576 if test "x$with_theme" != "xno"; then
11577     for theme in $with_theme; do
11578         case $theme in
11579         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|tango) real_theme="$theme" ;;
11580         default) real_theme=colibre ;;
11581         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11582         esac
11583         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11584     done
11586 AC_MSG_RESULT([$WITH_THEMES])
11587 AC_SUBST([WITH_THEMES])
11588 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11589 for theme in $with_theme; do
11590     case $theme in
11591     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11592     *) ;;
11593     esac
11594 done
11596 dnl ===================================================================
11597 dnl Test whether to integrate helppacks into the product's installer
11598 dnl ===================================================================
11599 AC_MSG_CHECKING([for helppack integration])
11600 if test "$with_helppack_integration" = "no"; then
11601     AC_MSG_RESULT([no integration])
11602 else
11603     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11604     AC_MSG_RESULT([integration])
11607 ###############################################################################
11608 # Extensions checking
11609 ###############################################################################
11610 AC_MSG_CHECKING([for extensions integration])
11611 if test "x$enable_extension_integration" != "xno"; then
11612     WITH_EXTENSION_INTEGRATION=TRUE
11613     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11614     AC_MSG_RESULT([yes, use integration])
11615 else
11616     WITH_EXTENSION_INTEGRATION=
11617     AC_MSG_RESULT([no, do not integrate])
11619 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11621 dnl Should any extra extensions be included?
11622 dnl There are standalone tests for each of these below.
11623 WITH_EXTRA_EXTENSIONS=
11624 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11626 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11627 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11628 if test "x$with_java" != "xno"; then
11629     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11630     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11633 AC_MSG_CHECKING([whether to build opens___.ttf])
11634 if test "$enable_build_opensymbol" = "yes"; then
11635     AC_MSG_RESULT([yes])
11636     AC_PATH_PROG(FONTFORGE, fontforge)
11637     if test -z "$FONTFORGE"; then
11638         AC_MSG_ERROR([fontforge not installed])
11639     fi
11640 else
11641     AC_MSG_RESULT([no])
11642     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11643     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11645 AC_SUBST(OPENSYMBOL_TTF)
11646 AC_SUBST(FONTFORGE)
11648 dnl ===================================================================
11649 dnl Test whether to include fonts
11650 dnl ===================================================================
11651 AC_MSG_CHECKING([whether to include third-party fonts])
11652 if test "$with_fonts" != "no"; then
11653     AC_MSG_RESULT([yes])
11654     WITH_FONTS=TRUE
11655     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11656     AC_DEFINE(HAVE_MORE_FONTS)
11657 else
11658     AC_MSG_RESULT([no])
11659     WITH_FONTS=
11660     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11662 AC_SUBST(WITH_FONTS)
11664 dnl Test whether to include more Google Noto fonts
11665 dnl ===================================================================
11666 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11667 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11668     AC_MSG_RESULT([no])
11669     WITH_NOTO_FONT=
11670 else
11671     AC_MSG_RESULT([yes])
11672     WITH_NOTO_FONT=TRUE
11673     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11674     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11676 AC_SUBST(WITH_NOTO_FONT)
11678 dnl ===================================================================
11679 dnl Test whether to enable online update service
11680 dnl ===================================================================
11681 AC_MSG_CHECKING([whether to enable online update])
11682 ENABLE_ONLINE_UPDATE=
11683 ENABLE_ONLINE_UPDATE_MAR=
11684 UPDATE_CONFIG=
11685 if test "$enable_online_update" = ""; then
11686     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11687         AC_MSG_RESULT([yes])
11688         ENABLE_ONLINE_UPDATE="TRUE"
11689     else
11690         AC_MSG_RESULT([no])
11691     fi
11692 else
11693     if test "$enable_online_update" = "mar"; then
11694         AC_MSG_RESULT([yes - MAR-based online update])
11695         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11696         if test "$with_update_config" = ""; then
11697             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11698         fi
11699         UPDATE_CONFIG="$with_update_config"
11700         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11701     elif test "$enable_online_update" = "yes"; then
11702         AC_MSG_RESULT([yes])
11703         ENABLE_ONLINE_UPDATE="TRUE"
11704     else
11705         AC_MSG_RESULT([no])
11706     fi
11708 AC_SUBST(ENABLE_ONLINE_UPDATE)
11709 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11710 AC_SUBST(UPDATE_CONFIG)
11712 dnl ===================================================================
11713 dnl Test whether we need bzip2
11714 dnl ===================================================================
11715 SYSTEM_BZIP2=
11716 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11717     AC_MSG_CHECKING([whether to use system bzip2])
11718     if test "$with_system_bzip2" = yes; then
11719         SYSTEM_BZIP2=TRUE
11720         AC_MSG_RESULT([yes])
11721         PKG_CHECK_MODULES(BZIP2, bzip2)
11722         FilterLibs "${BZIP2_LIBS}"
11723         BZIP2_LIBS="${filteredlibs}"
11724     else
11725         AC_MSG_RESULT([no])
11726         BUILD_TYPE="$BUILD_TYPE BZIP2"
11727     fi
11729 AC_SUBST(SYSTEM_BZIP2)
11730 AC_SUBST(BZIP2_CFLAGS)
11731 AC_SUBST(BZIP2_LIBS)
11733 dnl ===================================================================
11734 dnl Test whether to enable extension update
11735 dnl ===================================================================
11736 AC_MSG_CHECKING([whether to enable extension update])
11737 ENABLE_EXTENSION_UPDATE=
11738 if test "x$enable_extension_update" = "xno"; then
11739     AC_MSG_RESULT([no])
11740 else
11741     AC_MSG_RESULT([yes])
11742     ENABLE_EXTENSION_UPDATE="TRUE"
11743     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11744     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11746 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11749 dnl ===================================================================
11750 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11751 dnl ===================================================================
11752 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11753 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11754     AC_MSG_RESULT([no])
11755     ENABLE_SILENT_MSI=
11756 else
11757     AC_MSG_RESULT([yes])
11758     ENABLE_SILENT_MSI=TRUE
11759     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11761 AC_SUBST(ENABLE_SILENT_MSI)
11763 AC_MSG_CHECKING([whether and how to use Xinerama])
11764 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11765     if test "$x_libraries" = "default_x_libraries"; then
11766         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11767         if test "x$XINERAMALIB" = x; then
11768            XINERAMALIB="/usr/lib"
11769         fi
11770     else
11771         XINERAMALIB="$x_libraries"
11772     fi
11773     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11774         # we have both versions, let the user decide but use the dynamic one
11775         # per default
11776         USE_XINERAMA=TRUE
11777         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11778             XINERAMA_LINK=dynamic
11779         else
11780             XINERAMA_LINK=static
11781         fi
11782     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11783         # we have only the dynamic version
11784         USE_XINERAMA=TRUE
11785         XINERAMA_LINK=dynamic
11786     elif test -e "$XINERAMALIB/libXinerama.a"; then
11787         # static version
11788         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11789             USE_XINERAMA=TRUE
11790             XINERAMA_LINK=static
11791         else
11792             USE_XINERAMA=
11793             XINERAMA_LINK=none
11794         fi
11795     else
11796         # no Xinerama
11797         USE_XINERAMA=
11798         XINERAMA_LINK=none
11799     fi
11800     if test "$USE_XINERAMA" = "TRUE"; then
11801         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11802         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11803             [AC_MSG_ERROR(Xinerama header not found.)], [])
11804         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11805         if test "x$XEXTLIB" = x; then
11806            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11807         fi
11808         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11809         if test "$_os" = "FreeBSD"; then
11810             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11811         fi
11812         if test "$_os" = "Linux"; then
11813             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11814         fi
11815         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11816             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11817     else
11818         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11819     fi
11820 else
11821     USE_XINERAMA=
11822     XINERAMA_LINK=none
11823     AC_MSG_RESULT([no])
11825 AC_SUBST(USE_XINERAMA)
11826 AC_SUBST(XINERAMA_LINK)
11828 dnl ===================================================================
11829 dnl Test whether to build cairo or rely on the system version
11830 dnl ===================================================================
11832 if test "$USING_X11" = TRUE; then
11833     # Used in vcl/Library_vclplug_gen.mk
11834     test_cairo=yes
11837 if test "$test_cairo" = "yes"; then
11838     AC_MSG_CHECKING([whether to use the system cairo])
11840     : ${with_system_cairo:=$with_system_libs}
11841     if test "$with_system_cairo" = "yes"; then
11842         SYSTEM_CAIRO=TRUE
11843         AC_MSG_RESULT([yes])
11845         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11846         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11847         FilterLibs "${CAIRO_LIBS}"
11848         CAIRO_LIBS="${filteredlibs}"
11850         if test "$test_xrender" = "yes"; then
11851             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11852             AC_LANG_PUSH([C])
11853             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11854 #ifdef PictStandardA8
11855 #else
11856       return fail;
11857 #endif
11858 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11860             AC_LANG_POP([C])
11861         fi
11862     else
11863         SYSTEM_CAIRO=
11864         AC_MSG_RESULT([no])
11866         BUILD_TYPE="$BUILD_TYPE CAIRO"
11867     fi
11870 AC_SUBST(SYSTEM_CAIRO)
11871 AC_SUBST(CAIRO_CFLAGS)
11872 AC_SUBST(CAIRO_LIBS)
11874 dnl ===================================================================
11875 dnl Test whether to use avahi
11876 dnl ===================================================================
11877 if test "$_os" = "WINNT"; then
11878     # Windows uses bundled mDNSResponder
11879     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11880 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11881     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11882                       [ENABLE_AVAHI="TRUE"])
11883     AC_DEFINE(HAVE_FEATURE_AVAHI)
11884     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11885     FilterLibs "${AVAHI_LIBS}"
11886     AVAHI_LIBS="${filteredlibs}"
11889 AC_SUBST(ENABLE_AVAHI)
11890 AC_SUBST(AVAHI_CFLAGS)
11891 AC_SUBST(AVAHI_LIBS)
11893 dnl ===================================================================
11894 dnl Test whether to use liblangtag
11895 dnl ===================================================================
11896 SYSTEM_LIBLANGTAG=
11897 AC_MSG_CHECKING([whether to use system liblangtag])
11898 if test "$with_system_liblangtag" = yes; then
11899     SYSTEM_LIBLANGTAG=TRUE
11900     AC_MSG_RESULT([yes])
11901     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11902     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11903     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11904     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11905     FilterLibs "${LIBLANGTAG_LIBS}"
11906     LIBLANGTAG_LIBS="${filteredlibs}"
11907 else
11908     SYSTEM_LIBLANGTAG=
11909     AC_MSG_RESULT([no])
11910     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11911     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11912     if test "$COM" = "MSC"; then
11913         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11914     else
11915         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11916     fi
11918 AC_SUBST(SYSTEM_LIBLANGTAG)
11919 AC_SUBST(LIBLANGTAG_CFLAGS)
11920 AC_SUBST(LIBLANGTAG_LIBS)
11922 dnl ===================================================================
11923 dnl Test whether to build libpng or rely on the system version
11924 dnl ===================================================================
11926 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11928 dnl ===================================================================
11929 dnl Check for runtime JVM search path
11930 dnl ===================================================================
11931 if test "$ENABLE_JAVA" != ""; then
11932     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11933     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11934         AC_MSG_RESULT([yes])
11935         if ! test -d "$with_jvm_path"; then
11936             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11937         fi
11938         if ! test -d "$with_jvm_path"jvm; then
11939             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11940         fi
11941         JVM_ONE_PATH_CHECK="$with_jvm_path"
11942         AC_SUBST(JVM_ONE_PATH_CHECK)
11943     else
11944         AC_MSG_RESULT([no])
11945     fi
11948 dnl ===================================================================
11949 dnl Test for the presence of Ant and that it works
11950 dnl ===================================================================
11952 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11953     ANT_HOME=; export ANT_HOME
11954     WITH_ANT_HOME=; export WITH_ANT_HOME
11955     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11956         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11957             if test "$_os" = "WINNT"; then
11958                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11959             else
11960                 with_ant_home="$LODE_HOME/opt/ant"
11961             fi
11962         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11963             with_ant_home="$LODE_HOME/opt/ant"
11964         fi
11965     fi
11966     if test -z "$with_ant_home"; then
11967         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11968     else
11969         if test "$_os" = "WINNT"; then
11970             # AC_PATH_PROGS needs unix path
11971             with_ant_home=`cygpath -u "$with_ant_home"`
11972         fi
11973         AbsolutePath "$with_ant_home"
11974         with_ant_home=$absolute_path
11975         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11976         WITH_ANT_HOME=$with_ant_home
11977         ANT_HOME=$with_ant_home
11978     fi
11980     if test -z "$ANT"; then
11981         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11982     else
11983         # resolve relative or absolute symlink
11984         while test -h "$ANT"; do
11985             a_cwd=`pwd`
11986             a_basename=`basename "$ANT"`
11987             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11988             cd "`dirname "$ANT"`"
11989             cd "`dirname "$a_script"`"
11990             ANT="`pwd`"/"`basename "$a_script"`"
11991             cd "$a_cwd"
11992         done
11994         AC_MSG_CHECKING([if $ANT works])
11995         mkdir -p conftest.dir
11996         a_cwd=$(pwd)
11997         cd conftest.dir
11998         cat > conftest.java << EOF
11999         public class conftest {
12000             int testmethod(int a, int b) {
12001                     return a + b;
12002             }
12003         }
12006         cat > conftest.xml << EOF
12007         <project name="conftest" default="conftest">
12008         <target name="conftest">
12009             <javac srcdir="." includes="conftest.java">
12010             </javac>
12011         </target>
12012         </project>
12015         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12016         if test $? = 0 -a -f ./conftest.class; then
12017             AC_MSG_RESULT([Ant works])
12018             if test -z "$WITH_ANT_HOME"; then
12019                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12020                 if test -z "$ANT_HOME"; then
12021                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12022                 fi
12023             else
12024                 ANT_HOME="$WITH_ANT_HOME"
12025             fi
12026         else
12027             echo "configure: Ant test failed" >&5
12028             cat conftest.java >&5
12029             cat conftest.xml >&5
12030             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12031         fi
12032         cd "$a_cwd"
12033         rm -fr conftest.dir
12034     fi
12035     if test -z "$ANT_HOME"; then
12036         ANT_HOME="NO_ANT_HOME"
12037     else
12038         PathFormat "$ANT_HOME"
12039         ANT_HOME="$formatted_path"
12040         PathFormat "$ANT"
12041         ANT="$formatted_path"
12042     fi
12043     AC_SUBST(ANT_HOME)
12044     AC_SUBST(ANT)
12046     dnl Checking for ant.jar
12047     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12048         AC_MSG_CHECKING([Ant lib directory])
12049         if test -f $ANT_HOME/lib/ant.jar; then
12050             ANT_LIB="$ANT_HOME/lib"
12051         else
12052             if test -f $ANT_HOME/ant.jar; then
12053                 ANT_LIB="$ANT_HOME"
12054             else
12055                 if test -f /usr/share/java/ant.jar; then
12056                     ANT_LIB=/usr/share/java
12057                 else
12058                     if test -f /usr/share/ant-core/lib/ant.jar; then
12059                         ANT_LIB=/usr/share/ant-core/lib
12060                     else
12061                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12062                             ANT_LIB="$ANT_HOME/lib/ant"
12063                         else
12064                             if test -f /usr/share/lib/ant/ant.jar; then
12065                                 ANT_LIB=/usr/share/lib/ant
12066                             else
12067                                 AC_MSG_ERROR([Ant libraries not found!])
12068                             fi
12069                         fi
12070                     fi
12071                 fi
12072             fi
12073         fi
12074         PathFormat "$ANT_LIB"
12075         ANT_LIB="$formatted_path"
12076         AC_MSG_RESULT([Ant lib directory found.])
12077     fi
12078     AC_SUBST(ANT_LIB)
12080     ant_minver=1.6.0
12081     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12083     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12084     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12085     ant_version_major=`echo $ant_version | cut -d. -f1`
12086     ant_version_minor=`echo $ant_version | cut -d. -f2`
12087     echo "configure: ant_version $ant_version " >&5
12088     echo "configure: ant_version_major $ant_version_major " >&5
12089     echo "configure: ant_version_minor $ant_version_minor " >&5
12090     if test "$ant_version_major" -ge "2"; then
12091         AC_MSG_RESULT([yes, $ant_version])
12092     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12093         AC_MSG_RESULT([yes, $ant_version])
12094     else
12095         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12096     fi
12098     rm -f conftest* core core.* *.core
12101 OOO_JUNIT_JAR=
12102 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12103     AC_MSG_CHECKING([for JUnit 4])
12104     if test "$with_junit" = "yes"; then
12105         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12106             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12107         elif test -e /usr/share/java/junit4.jar; then
12108             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12109         else
12110            if test -e /usr/share/lib/java/junit.jar; then
12111               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12112            else
12113               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12114            fi
12115         fi
12116     else
12117         OOO_JUNIT_JAR=$with_junit
12118     fi
12119     if test "$_os" = "WINNT"; then
12120         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12121     fi
12122     printf 'import org.junit.Before;' > conftest.java
12123     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12124         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12125     else
12126         AC_MSG_ERROR(
12127 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12128  specify its pathname via --with-junit=..., or disable it via --without-junit])
12129     fi
12130     rm -f conftest.class conftest.java
12131     if test $OOO_JUNIT_JAR != ""; then
12132     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12133     fi
12135 AC_SUBST(OOO_JUNIT_JAR)
12137 HAMCREST_JAR=
12138 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12139     AC_MSG_CHECKING([for included Hamcrest])
12140     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12141     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12142         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12143     else
12144         AC_MSG_RESULT([Not included])
12145         AC_MSG_CHECKING([for standalone hamcrest jar.])
12146         if test "$with_hamcrest" = "yes"; then
12147             if test -e /usr/share/lib/java/hamcrest.jar; then
12148                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12149             elif test -e /usr/share/java/hamcrest/core.jar; then
12150                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12151             else
12152                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12153             fi
12154         else
12155             HAMCREST_JAR=$with_hamcrest
12156         fi
12157         if test "$_os" = "WINNT"; then
12158             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12159         fi
12160         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12161             AC_MSG_RESULT([$HAMCREST_JAR])
12162         else
12163             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),
12164                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12165         fi
12166     fi
12167     rm -f conftest.class conftest.java
12169 AC_SUBST(HAMCREST_JAR)
12172 AC_SUBST(SCPDEFS)
12175 # check for wget and curl
12177 WGET=
12178 CURL=
12180 if test "$enable_fetch_external" != "no"; then
12182 CURL=`which curl 2>/dev/null`
12184 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12185     # wget new enough?
12186     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12187     if test $? -eq 0; then
12188         WGET=$i
12189         break
12190     fi
12191 done
12193 if test -z "$WGET" -a -z "$CURL"; then
12194     AC_MSG_ERROR([neither wget nor curl found!])
12199 AC_SUBST(WGET)
12200 AC_SUBST(CURL)
12203 # check for sha256sum
12205 SHA256SUM=
12207 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12208     eval "$i -a 256 --version" > /dev/null 2>&1
12209     ret=$?
12210     if test $ret -eq 0; then
12211         SHA256SUM="$i -a 256"
12212         break
12213     fi
12214 done
12216 if test -z "$SHA256SUM"; then
12217     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12218         eval "$i --version" > /dev/null 2>&1
12219         ret=$?
12220         if test $ret -eq 0; then
12221             SHA256SUM=$i
12222             break
12223         fi
12224     done
12227 if test -z "$SHA256SUM"; then
12228     AC_MSG_ERROR([no sha256sum found!])
12231 AC_SUBST(SHA256SUM)
12233 dnl ===================================================================
12234 dnl Dealing with l10n options
12235 dnl ===================================================================
12236 AC_MSG_CHECKING([which languages to be built])
12237 # get list of all languages
12238 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12239 # the sed command does the following:
12240 #   + if a line ends with a backslash, append the next line to it
12241 #   + adds " on the beginning of the value (after =)
12242 #   + adds " at the end of the value
12243 #   + removes en-US; we want to put it on the beginning
12244 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12245 [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)]
12246 ALL_LANGS="en-US $completelangiso"
12247 # check the configured localizations
12248 WITH_LANG="$with_lang"
12250 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12251 # (Norwegian is "nb" and "nn".)
12252 if test "$WITH_LANG" = "no"; then
12253     WITH_LANG=
12256 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12257     AC_MSG_RESULT([en-US])
12258 else
12259     AC_MSG_RESULT([$WITH_LANG])
12260     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12261     if test -z "$MSGFMT"; then
12262         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12263             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12264         elif test -x "/opt/lo/bin/msgfmt"; then
12265             MSGFMT="/opt/lo/bin/msgfmt"
12266         else
12267             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12268             if test -z "$MSGFMT"; then
12269                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12270             fi
12271         fi
12272     fi
12273     if test -z "$MSGUNIQ"; then
12274         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12275             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12276         elif test -x "/opt/lo/bin/msguniq"; then
12277             MSGUNIQ="/opt/lo/bin/msguniq"
12278         else
12279             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12280             if test -z "$MSGUNIQ"; then
12281                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12282             fi
12283         fi
12284     fi
12286 AC_SUBST(MSGFMT)
12287 AC_SUBST(MSGUNIQ)
12288 # check that the list is valid
12289 for lang in $WITH_LANG; do
12290     test "$lang" = "ALL" && continue
12291     # need to check for the exact string, so add space before and after the list of all languages
12292     for vl in $ALL_LANGS; do
12293         if test "$vl" = "$lang"; then
12294            break
12295         fi
12296     done
12297     if test "$vl" != "$lang"; then
12298         # if you're reading this - you prolly quoted your languages remove the quotes ...
12299         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12300     fi
12301 done
12302 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12303     echo $WITH_LANG | grep -q en-US
12304     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12306 # list with substituted ALL
12307 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12308 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12309 test "$WITH_LANG" = "en-US" && WITH_LANG=
12310 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12311     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12312     ALL_LANGS=`echo $ALL_LANGS qtz`
12314 AC_SUBST(ALL_LANGS)
12315 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12316 AC_SUBST(WITH_LANG)
12317 AC_SUBST(WITH_LANG_LIST)
12318 AC_SUBST(GIT_NEEDED_SUBMODULES)
12320 WITH_POOR_HELP_LOCALIZATIONS=
12321 if test -d "$SRC_ROOT/translations/source"; then
12322     for l in `ls -1 $SRC_ROOT/translations/source`; do
12323         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12324             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12325         fi
12326     done
12328 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12330 if test -n "$with_locales"; then
12331     WITH_LOCALES="$with_locales"
12333     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12334     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12335     # config_host/config_locales.h.in
12336     for locale in $WITH_LOCALES; do
12337         lang=${locale%_*}
12339         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12341         case $lang in
12342         hi|mr*ne)
12343             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12344             ;;
12345         bg|ru)
12346             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12347             ;;
12348         esac
12349     done
12350 else
12351     AC_DEFINE(WITH_LOCALE_ALL)
12353 AC_SUBST(WITH_LOCALES)
12355 dnl git submodule update --reference
12356 dnl ===================================================================
12357 if test -n "${GIT_REFERENCE_SRC}"; then
12358     for repo in ${GIT_NEEDED_SUBMODULES}; do
12359         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12360             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12361         fi
12362     done
12364 AC_SUBST(GIT_REFERENCE_SRC)
12366 dnl git submodules linked dirs
12367 dnl ===================================================================
12368 if test -n "${GIT_LINK_SRC}"; then
12369     for repo in ${GIT_NEEDED_SUBMODULES}; do
12370         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12371             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12372         fi
12373     done
12375 AC_SUBST(GIT_LINK_SRC)
12377 dnl branding
12378 dnl ===================================================================
12379 AC_MSG_CHECKING([for alternative branding images directory])
12380 # initialize mapped arrays
12381 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12382 brand_files="$BRAND_INTRO_IMAGES about.svg"
12384 if test -z "$with_branding" -o "$with_branding" = "no"; then
12385     AC_MSG_RESULT([none])
12386     DEFAULT_BRAND_IMAGES="$brand_files"
12387 else
12388     if ! test -d $with_branding ; then
12389         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12390     else
12391         AC_MSG_RESULT([$with_branding])
12392         CUSTOM_BRAND_DIR="$with_branding"
12393         for lfile in $brand_files
12394         do
12395             if ! test -f $with_branding/$lfile ; then
12396                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12397                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12398             else
12399                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12400             fi
12401         done
12402         check_for_progress="yes"
12403     fi
12405 AC_SUBST([BRAND_INTRO_IMAGES])
12406 AC_SUBST([CUSTOM_BRAND_DIR])
12407 AC_SUBST([CUSTOM_BRAND_IMAGES])
12408 AC_SUBST([DEFAULT_BRAND_IMAGES])
12411 AC_MSG_CHECKING([for 'intro' progress settings])
12412 PROGRESSBARCOLOR=
12413 PROGRESSSIZE=
12414 PROGRESSPOSITION=
12415 PROGRESSFRAMECOLOR=
12416 PROGRESSTEXTCOLOR=
12417 PROGRESSTEXTBASELINE=
12419 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12420     source "$with_branding/progress.conf"
12421     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12422 else
12423     AC_MSG_RESULT([none])
12426 AC_SUBST(PROGRESSBARCOLOR)
12427 AC_SUBST(PROGRESSSIZE)
12428 AC_SUBST(PROGRESSPOSITION)
12429 AC_SUBST(PROGRESSFRAMECOLOR)
12430 AC_SUBST(PROGRESSTEXTCOLOR)
12431 AC_SUBST(PROGRESSTEXTBASELINE)
12434 AC_MSG_CHECKING([for extra build ID])
12435 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12436     EXTRA_BUILDID="$with_extra_buildid"
12438 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12439 if test -n "$EXTRA_BUILDID" ; then
12440     AC_MSG_RESULT([$EXTRA_BUILDID])
12441 else
12442     AC_MSG_RESULT([not set])
12444 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12446 OOO_VENDOR=
12447 AC_MSG_CHECKING([for vendor])
12448 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12449     OOO_VENDOR="$USERNAME"
12451     if test -z "$OOO_VENDOR"; then
12452         OOO_VENDOR="$USER"
12453     fi
12455     if test -z "$OOO_VENDOR"; then
12456         OOO_VENDOR="`id -u -n`"
12457     fi
12459     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12460 else
12461     OOO_VENDOR="$with_vendor"
12462     AC_MSG_RESULT([$OOO_VENDOR])
12464 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12465 AC_SUBST(OOO_VENDOR)
12467 if test "$_os" = "Android" ; then
12468     ANDROID_PACKAGE_NAME=
12469     AC_MSG_CHECKING([for Android package name])
12470     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12471         if test -n "$ENABLE_DEBUG"; then
12472             # Default to the package name that makes ndk-gdb happy.
12473             ANDROID_PACKAGE_NAME="org.libreoffice"
12474         else
12475             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12476         fi
12478         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12479     else
12480         ANDROID_PACKAGE_NAME="$with_android_package_name"
12481         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12482     fi
12483     AC_SUBST(ANDROID_PACKAGE_NAME)
12486 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12487 if test "$with_compat_oowrappers" = "yes"; then
12488     WITH_COMPAT_OOWRAPPERS=TRUE
12489     AC_MSG_RESULT(yes)
12490 else
12491     WITH_COMPAT_OOWRAPPERS=
12492     AC_MSG_RESULT(no)
12494 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12496 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12497 AC_MSG_CHECKING([for install dirname])
12498 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12499     INSTALLDIRNAME="$with_install_dirname"
12501 AC_MSG_RESULT([$INSTALLDIRNAME])
12502 AC_SUBST(INSTALLDIRNAME)
12504 AC_MSG_CHECKING([for prefix])
12505 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12506 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12507 PREFIXDIR="$prefix"
12508 AC_MSG_RESULT([$PREFIXDIR])
12509 AC_SUBST(PREFIXDIR)
12511 LIBDIR=[$(eval echo $(eval echo $libdir))]
12512 AC_SUBST(LIBDIR)
12514 DATADIR=[$(eval echo $(eval echo $datadir))]
12515 AC_SUBST(DATADIR)
12517 MANDIR=[$(eval echo $(eval echo $mandir))]
12518 AC_SUBST(MANDIR)
12520 DOCDIR=[$(eval echo $(eval echo $docdir))]
12521 AC_SUBST(DOCDIR)
12523 BINDIR=[$(eval echo $(eval echo $bindir))]
12524 AC_SUBST(BINDIR)
12526 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12527 AC_SUBST(INSTALLDIR)
12529 TESTINSTALLDIR="${BUILDDIR}/test-install"
12530 AC_SUBST(TESTINSTALLDIR)
12533 # ===================================================================
12534 # OAuth2 id and secrets
12535 # ===================================================================
12537 AC_MSG_CHECKING([for Google Drive client id and secret])
12538 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12539     AC_MSG_RESULT([not set])
12540     GDRIVE_CLIENT_ID="\"\""
12541     GDRIVE_CLIENT_SECRET="\"\""
12542 else
12543     AC_MSG_RESULT([set])
12544     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12545     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12547 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12548 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12550 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12551 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12552     AC_MSG_RESULT([not set])
12553     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12554     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12555 else
12556     AC_MSG_RESULT([set])
12557     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12558     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12560 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12561 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12563 AC_MSG_CHECKING([for OneDrive client id and secret])
12564 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12565     AC_MSG_RESULT([not set])
12566     ONEDRIVE_CLIENT_ID="\"\""
12567     ONEDRIVE_CLIENT_SECRET="\"\""
12568 else
12569     AC_MSG_RESULT([set])
12570     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12571     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12573 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12574 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12577 dnl ===================================================================
12578 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12579 dnl --enable-dependency-tracking configure option
12580 dnl ===================================================================
12581 AC_MSG_CHECKING([whether to enable dependency tracking])
12582 if test "$enable_dependency_tracking" = "no"; then
12583     nodep=TRUE
12584     AC_MSG_RESULT([no])
12585 else
12586     AC_MSG_RESULT([yes])
12588 AC_SUBST(nodep)
12590 dnl ===================================================================
12591 dnl Number of CPUs to use during the build
12592 dnl ===================================================================
12593 AC_MSG_CHECKING([for number of processors to use])
12594 # plain --with-parallelism is just the default
12595 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12596     if test "$with_parallelism" = "no"; then
12597         PARALLELISM=0
12598     else
12599         PARALLELISM=$with_parallelism
12600     fi
12601 else
12602     if test "$enable_icecream" = "yes"; then
12603         PARALLELISM="40"
12604     else
12605         case `uname -s` in
12607         Darwin|FreeBSD|NetBSD|OpenBSD)
12608             PARALLELISM=`sysctl -n hw.ncpu`
12609             ;;
12611         Linux)
12612             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12613         ;;
12614         # what else than above does profit here *and* has /proc?
12615         *)
12616             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12617             ;;
12618         esac
12620         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12621         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12622     fi
12625 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12626     if test -z "$with_parallelism"; then
12627             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12628             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12629             PARALLELISM="1"
12630     else
12631         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."
12632     fi
12635 if test $PARALLELISM -eq 0; then
12636     AC_MSG_RESULT([explicit make -j option needed])
12637 else
12638     AC_MSG_RESULT([$PARALLELISM])
12640 AC_SUBST(PARALLELISM)
12642 IWYU_PATH="$with_iwyu"
12643 AC_SUBST(IWYU_PATH)
12644 if test ! -z "$IWYU_PATH"; then
12645     if test ! -f "$IWYU_PATH"; then
12646         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12647     fi
12651 # Set up ILIB for MSVC build
12653 ILIB1=
12654 if test "$build_os" = "cygwin"; then
12655     ILIB="."
12656     if test -n "$JAVA_HOME"; then
12657         ILIB="$ILIB;$JAVA_HOME/lib"
12658     fi
12659     ILIB1=-link
12660     if test "$BITNESS_OVERRIDE" = 64; then
12661         ILIB="$ILIB;$COMPATH/lib/x64"
12662         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12663         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12664         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12665         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12666             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12667             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12668         fi
12669         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12670         ucrtlibpath_formatted=$formatted_path
12671         ILIB="$ILIB;$ucrtlibpath_formatted"
12672         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12673     else
12674         ILIB="$ILIB;$COMPATH/lib/x86"
12675         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12676         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12677         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12678         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12679             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12680             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12681         fi
12682         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12683         ucrtlibpath_formatted=$formatted_path
12684         ILIB="$ILIB;$ucrtlibpath_formatted"
12685         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12686     fi
12687     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12688         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12689     else
12690         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12691     fi
12693     AC_SUBST(ILIB)
12696 # ===================================================================
12697 # Creating bigger shared library to link against
12698 # ===================================================================
12699 AC_MSG_CHECKING([whether to create huge library])
12700 MERGELIBS=
12702 if test $_os = iOS -o $_os = Android; then
12703     # Never any point in mergelibs for these as we build just static
12704     # libraries anyway...
12705     enable_mergelibs=no
12708 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12709     if test $_os != Linux -a $_os != WINNT; then
12710         add_warning "--enable-mergelibs is not tested for this platform"
12711     fi
12712     MERGELIBS="TRUE"
12713     AC_MSG_RESULT([yes])
12714 else
12715     AC_MSG_RESULT([no])
12717 AC_SUBST([MERGELIBS])
12719 dnl ===================================================================
12720 dnl icerun is a wrapper that stops us spawning tens of processes
12721 dnl locally - for tools that can't be executed on the compile cluster
12722 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12723 dnl ===================================================================
12724 AC_MSG_CHECKING([whether to use icerun wrapper])
12725 ICECREAM_RUN=
12726 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12727     ICECREAM_RUN=icerun
12728     AC_MSG_RESULT([yes])
12729 else
12730     AC_MSG_RESULT([no])
12732 AC_SUBST(ICECREAM_RUN)
12734 dnl ===================================================================
12735 dnl Setup the ICECC_VERSION for the build the same way it was set for
12736 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12737 dnl ===================================================================
12738 x_ICECC_VERSION=[\#]
12739 if test -n "$ICECC_VERSION" ; then
12740     x_ICECC_VERSION=
12742 AC_SUBST(x_ICECC_VERSION)
12743 AC_SUBST(ICECC_VERSION)
12745 dnl ===================================================================
12747 AC_MSG_CHECKING([MPL subset])
12748 MPL_SUBSET=
12750 if test "$enable_mpl_subset" = "yes"; then
12751     warn_report=false
12752     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12753         warn_report=true
12754     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12755         warn_report=true
12756     fi
12757     if test "$warn_report" = "true"; then
12758         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12759     fi
12760     if test "x$enable_postgresql_sdbc" != "xno"; then
12761         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12762     fi
12763     if test "$enable_lotuswordpro" = "yes"; then
12764         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12765     fi
12766     if test "$WITH_WEBDAV" = "neon"; then
12767         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12768     fi
12769     if test -n "$ENABLE_POPPLER"; then
12770         if test "x$SYSTEM_POPPLER" = "x"; then
12771             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12772         fi
12773     fi
12774     # cf. m4/libo_check_extension.m4
12775     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12776         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12777     fi
12778     for theme in $WITH_THEMES; do
12779         case $theme in
12780         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12781             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12782         *) : ;;
12783         esac
12784     done
12786     ENABLE_OPENGL_TRANSITIONS=
12788     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12789         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12790     fi
12792     MPL_SUBSET="TRUE"
12793     AC_DEFINE(MPL_HAVE_SUBSET)
12794     AC_MSG_RESULT([only])
12795 else
12796     AC_MSG_RESULT([no restrictions])
12798 AC_SUBST(MPL_SUBSET)
12800 dnl ===================================================================
12802 AC_MSG_CHECKING([formula logger])
12803 ENABLE_FORMULA_LOGGER=
12805 if test "x$enable_formula_logger" = "xyes"; then
12806     AC_MSG_RESULT([yes])
12807     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12808     ENABLE_FORMULA_LOGGER=TRUE
12809 elif test -n "$ENABLE_DBGUTIL" ; then
12810     AC_MSG_RESULT([yes])
12811     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12812     ENABLE_FORMULA_LOGGER=TRUE
12813 else
12814     AC_MSG_RESULT([no])
12817 AC_SUBST(ENABLE_FORMULA_LOGGER)
12819 dnl ===================================================================
12820 dnl Setting up the environment.
12821 dnl ===================================================================
12822 AC_MSG_NOTICE([setting up the build environment variables...])
12824 AC_SUBST(COMPATH)
12826 if test "$build_os" = "cygwin"; then
12827     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12828         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12829         ATL_INCLUDE="$COMPATH/atlmfc/include"
12830     elif test -d "$COMPATH/atlmfc/lib"; then
12831         ATL_LIB="$COMPATH/atlmfc/lib"
12832         ATL_INCLUDE="$COMPATH/atlmfc/include"
12833     else
12834         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12835         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12836     fi
12837     if test "$BITNESS_OVERRIDE" = 64; then
12838         ATL_LIB="$ATL_LIB/x64"
12839     else
12840         ATL_LIB="$ATL_LIB/x86"
12841     fi
12842     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12843     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12845     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12846     PathFormat "/usr/bin/find.exe"
12847     FIND="$formatted_path"
12848     PathFormat "/usr/bin/sort.exe"
12849     SORT="$formatted_path"
12850     PathFormat "/usr/bin/grep.exe"
12851     WIN_GREP="$formatted_path"
12852     PathFormat "/usr/bin/ls.exe"
12853     WIN_LS="$formatted_path"
12854     PathFormat "/usr/bin/touch.exe"
12855     WIN_TOUCH="$formatted_path"
12856 else
12857     FIND=find
12858     SORT=sort
12861 AC_SUBST(ATL_INCLUDE)
12862 AC_SUBST(ATL_LIB)
12863 AC_SUBST(FIND)
12864 AC_SUBST(SORT)
12865 AC_SUBST(WIN_GREP)
12866 AC_SUBST(WIN_LS)
12867 AC_SUBST(WIN_TOUCH)
12869 AC_SUBST(BUILD_TYPE)
12871 AC_SUBST(SOLARINC)
12873 PathFormat "$PERL"
12874 PERL="$formatted_path"
12875 AC_SUBST(PERL)
12877 if test -n "$TMPDIR"; then
12878     TEMP_DIRECTORY="$TMPDIR"
12879 else
12880     TEMP_DIRECTORY="/tmp"
12882 if test "$build_os" = "cygwin"; then
12883     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12885 AC_SUBST(TEMP_DIRECTORY)
12887 # setup the PATH for the environment
12888 if test -n "$LO_PATH_FOR_BUILD"; then
12889     LO_PATH="$LO_PATH_FOR_BUILD"
12890 else
12891     LO_PATH="$PATH"
12893     case "$host_os" in
12895     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12896         if test "$ENABLE_JAVA" != ""; then
12897             pathmunge "$JAVA_HOME/bin" "after"
12898         fi
12899         ;;
12901     cygwin*)
12902         # Win32 make needs native paths
12903         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12904             LO_PATH=`cygpath -p -m "$PATH"`
12905         fi
12906         if test "$BITNESS_OVERRIDE" = 64; then
12907             # needed for msi packaging
12908             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12909         fi
12910         # .NET 4.6 and higher don't have bin directory
12911         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12912             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12913         fi
12914         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12915         pathmunge "$CSC_PATH" "before"
12916         pathmunge "$MIDL_PATH" "before"
12917         pathmunge "$AL_PATH" "before"
12918         pathmunge "$MSPDB_PATH" "before"
12919         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12920             pathmunge "$CL_PATH" "before"
12921         fi
12922         if test -n "$MSBUILD_PATH" ; then
12923             pathmunge "$MSBUILD_PATH" "before"
12924         fi
12925         if test "$BITNESS_OVERRIDE" = 64; then
12926             pathmunge "$COMPATH/bin/amd64" "before"
12927             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12928         else
12929             pathmunge "$COMPATH/bin" "before"
12930             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12931         fi
12932         if test "$ENABLE_JAVA" != ""; then
12933             if test -d "$JAVA_HOME/jre/bin/client"; then
12934                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12935             fi
12936             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12937                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12938             fi
12939             pathmunge "$JAVA_HOME/bin" "before"
12940         fi
12941         ;;
12943     solaris*)
12944         pathmunge "/usr/css/bin" "before"
12945         if test "$ENABLE_JAVA" != ""; then
12946             pathmunge "$JAVA_HOME/bin" "after"
12947         fi
12948         ;;
12949     esac
12952 AC_SUBST(LO_PATH)
12954 libo_FUZZ_SUMMARY
12956 # Generate a configuration sha256 we can use for deps
12957 if test -f config_host.mk; then
12958     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12960 if test -f config_host_lang.mk; then
12961     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12964 CFLAGS=$my_original_CFLAGS
12965 CXXFLAGS=$my_original_CXXFLAGS
12966 CPPFLAGS=$my_original_CPPFLAGS
12968 AC_LINK_FILES([include], [include])
12969 AC_CONFIG_FILES([config_host.mk
12970                  config_host_lang.mk
12971                  Makefile
12972                  bin/bffvalidator.sh
12973                  bin/odfvalidator.sh
12974                  bin/officeotron.sh
12975                  instsetoo_native/util/openoffice.lst
12976                  sysui/desktop/macosx/Info.plist])
12977 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12978 AC_CONFIG_HEADERS([config_host/config_clang.h])
12979 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12980 AC_CONFIG_HEADERS([config_host/config_eot.h])
12981 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12982 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12983 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12984 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12985 AC_CONFIG_HEADERS([config_host/config_features.h])
12986 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12987 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12988 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12989 AC_CONFIG_HEADERS([config_host/config_folders.h])
12990 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12991 AC_CONFIG_HEADERS([config_host/config_gio.h])
12992 AC_CONFIG_HEADERS([config_host/config_global.h])
12993 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12994 AC_CONFIG_HEADERS([config_host/config_java.h])
12995 AC_CONFIG_HEADERS([config_host/config_langs.h])
12996 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12997 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12998 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12999 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13000 AC_CONFIG_HEADERS([config_host/config_locales.h])
13001 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13002 AC_CONFIG_HEADERS([config_host/config_oox.h])
13003 AC_CONFIG_HEADERS([config_host/config_options.h])
13004 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13005 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13006 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13007 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13008 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13009 AC_CONFIG_HEADERS([config_host/config_version.h])
13010 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13011 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13012 AC_CONFIG_HEADERS([config_host/config_python.h])
13013 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13014 AC_OUTPUT
13016 if test "$CROSS_COMPILING" = TRUE; then
13017     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13020 # touch the config timestamp file
13021 if test ! -f config_host.mk.stamp; then
13022     echo > config_host.mk.stamp
13023 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13024     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13025 else
13026     echo > config_host.mk.stamp
13029 # touch the config lang timestamp file
13030 if test ! -f config_host_lang.mk.stamp; then
13031     echo > config_host_lang.mk.stamp
13032 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13033     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13034 else
13035     echo > config_host_lang.mk.stamp
13039 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13040         -a "$build_os" = "cygwin"; then
13042 cat << _EOS
13043 ****************************************************************************
13044 WARNING:
13045 Your make version is known to be horribly slow, and hard to debug
13046 problems with. To get a reasonably functional make please do:
13048 to install a pre-compiled binary make for Win32
13050  mkdir -p /opt/lo/bin
13051  cd /opt/lo/bin
13052  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13053  cp make-4.2.1-msvc.exe make
13054  chmod +x make
13056 to install from source:
13057 place yourself in a working directory of you choice.
13059  git clone git://git.savannah.gnu.org/make.git
13061  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13062  set PATH=%PATH%;C:\Cygwin\bin
13063  [or Cygwin64, if that is what you have]
13064  cd path-to-make-repo-you-cloned-above
13065  build_w32.bat --without-guile
13067 should result in a WinRel/gnumake.exe.
13068 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13070 Then re-run autogen.sh
13072 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13073 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13075 _EOS
13076 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13077     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13082 cat << _EOF
13083 ****************************************************************************
13085 To build, run:
13086 $GNUMAKE
13088 To view some help, run:
13089 $GNUMAKE help
13091 _EOF
13093 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13094     cat << _EOF
13095 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13096 _EOF
13098     if test $_os = Darwin; then
13099         echo open instdir/$PRODUCTNAME.app
13100     else
13101         echo instdir/program/soffice
13102     fi
13103     cat << _EOF
13105 If you want to run the smoketest, run:
13106 $GNUMAKE check
13108 _EOF
13111 if test -f warn; then
13112     cat warn
13113     rm warn
13116 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: