bump product version to 6.4.3.1
[LibreOffice.git] / configure.ac
blobc0a09f194bf2c43320a62549f94562e8078cf153
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[6.4.3.1],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
338 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
339     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
342 # need sed in os checks...
343 AC_PATH_PROGS(SED, sed)
344 if test -z "$SED"; then
345     AC_MSG_ERROR([install sed to run this script])
348 # Set the ENABLE_LTO variable
349 # ===================================================================
350 AC_MSG_CHECKING([whether to use link-time optimization])
351 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
352     ENABLE_LTO="TRUE"
353     AC_MSG_RESULT([yes])
354     AC_DEFINE(STATIC_LINKING)
355 else
356     ENABLE_LTO=""
357     AC_MSG_RESULT([no])
359 AC_SUBST(ENABLE_LTO)
361 AC_ARG_ENABLE(fuzz-options,
362     AS_HELP_STRING([--enable-fuzz-options],
363         [Randomly enable or disable each of those configurable options
364          that are supposed to be freely selectable without interdependencies,
365          or where bad interaction from interdependencies is automatically avoided.])
368 dnl ===================================================================
369 dnl When building for Android, --with-android-ndk,
370 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
371 dnl mandatory
372 dnl ===================================================================
374 AC_ARG_WITH(android-ndk,
375     AS_HELP_STRING([--with-android-ndk],
376         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
379 AC_ARG_WITH(android-ndk-toolchain-version,
380     AS_HELP_STRING([--with-android-ndk-toolchain-version],
381         [Specify which toolchain version to use, of those present in the
382         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
383         with_android_ndk_toolchain_version=clang5.0)
385 AC_ARG_WITH(android-sdk,
386     AS_HELP_STRING([--with-android-sdk],
387         [Specify location of the Android SDK. Mandatory when building for Android.]),
390 AC_ARG_WITH(android-api-level,
391     AS_HELP_STRING([--with-android-api-level],
392         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
395 ANDROID_NDK_HOME=
396 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
397     with_android_ndk="$SRC_ROOT/external/android-ndk"
399 if test -n "$with_android_ndk"; then
400     eval ANDROID_NDK_HOME=$with_android_ndk
402     # Set up a lot of pre-canned defaults
404     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
405         if test ! -f $ANDROID_NDK_HOME/source.properties; then
406             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
407         fi
408         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
409     else
410         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
411     fi
412     if test -z "$ANDROID_NDK_VERSION";  then
413         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
414     fi
415     case $ANDROID_NDK_VERSION in
416     r9*|r10*)
417         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
418         ;;
419     11.1.*|12.1.*|13.1.*|14.1.*)
420         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
421         ;;
422     16.*|17.*|18.*|19.*|20.*)
423         ;;
424     *)
425         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
426         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
427         ;;
428     esac
430     ANDROID_API_LEVEL=16
431     if test -n "$with_android_api_level" ; then
432         ANDROID_API_LEVEL="$with_android_api_level"
433     fi
435     android_cpu=$host_cpu
436     if test $host_cpu = arm; then
437         android_platform_prefix=arm-linux-androideabi
438         android_gnu_prefix=$android_platform_prefix
439         LLVM_TRIPLE=armv7a-linux-androideabi
440         ANDROID_APP_ABI=armeabi-v7a
441         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
442     elif test $host_cpu = aarch64; then
443         android_platform_prefix=aarch64-linux-android
444         android_gnu_prefix=$android_platform_prefix
445         LLVM_TRIPLE=$android_platform_prefix
446         # minimum android version that supports aarch64
447         if test "$ANDROID_API_LEVEL" -lt "21" ; then
448             ANDROID_API_LEVEL=21
449         fi
450         ANDROID_APP_ABI=arm64-v8a
451     elif test $host_cpu = x86_64; then
452         android_platform_prefix=x86_64-linux-android
453         android_gnu_prefix=$android_platform_prefix
454         LLVM_TRIPLE=$android_platform_prefix
455         # minimum android version that supports x86_64
456         ANDROID_API_LEVEL=21
457         ANDROID_APP_ABI=x86_64
458     else
459         # host_cpu is something like "i386" or "i686" I guess, NDK uses
460         # "x86" in some contexts
461         android_cpu=x86
462         android_platform_prefix=$android_cpu
463         android_gnu_prefix=i686-linux-android
464         LLVM_TRIPLE=$android_gnu_prefix
465         ANDROID_APP_ABI=x86
466     fi
468     case "$with_android_ndk_toolchain_version" in
469     clang5.0)
470         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
471         ;;
472     *)
473         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
474     esac
476     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
478     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
479     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
480     # manage to link the (app-specific) single huge .so that is built for the app in
481     # android/source/ if there is debug information in a significant part of the object files.
482     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
483     # all objects have been built with debug information.)
484     case $build_os in
485     linux-gnu*)
486         android_HOST_TAG=linux-x86_64
487         ;;
488     darwin*)
489         android_HOST_TAG=darwin-x86_64
490         ;;
491     *)
492         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
493         # ndk would also support windows and windows-x86_64
494         ;;
495     esac
496     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
497     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
498     dnl TODO: NSS build uses it...
499     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
500     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
502     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
510     if test "$ENABLE_LTO" = TRUE; then
511         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
512         # $CC and $CXX when building external libraries
513         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
514     fi
516     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
518     if test -z "$CC"; then
519         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
520         CC_BASE="clang"
521     fi
522     if test -z "$CXX"; then
523         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
524         CXX_BASE="clang++"
525     fi
527     # remember to download the ownCloud Android library later
528     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
530 AC_SUBST(ANDROID_NDK_HOME)
531 AC_SUBST(ANDROID_APP_ABI)
532 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
534 dnl ===================================================================
535 dnl --with-android-sdk
536 dnl ===================================================================
537 ANDROID_SDK_HOME=
538 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
539     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
541 if test -n "$with_android_sdk"; then
542     eval ANDROID_SDK_HOME=$with_android_sdk
543     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
545 AC_SUBST(ANDROID_SDK_HOME)
547 libo_FUZZ_ARG_ENABLE([android-editing],
548     AS_HELP_STRING([--enable-android-editing],
549         [Enable the experimental editing feature on Android.])
551 ENABLE_ANDROID_EDITING=
552 if test "$enable_android_editing" = yes; then
553     ENABLE_ANDROID_EDITING=TRUE
555 AC_SUBST([ENABLE_ANDROID_EDITING])
557 dnl ===================================================================
558 dnl The following is a list of supported systems.
559 dnl Sequential to keep the logic very simple
560 dnl These values may be checked and reset later.
561 dnl ===================================================================
562 #defaults unless the os test overrides this:
563 test_randr=yes
564 test_xrender=yes
565 test_cups=yes
566 test_dbus=yes
567 test_fontconfig=yes
568 test_cairo=no
569 test_gdb_index=no
570 test_split_debug=no
572 # Default values, as such probably valid just for Linux, set
573 # differently below just for Mac OSX, but at least better than
574 # hardcoding these as we used to do. Much of this is duplicated also
575 # in solenv for old build system and for gbuild, ideally we should
576 # perhaps define stuff like this only here in configure.ac?
578 LINKFLAGSSHL="-shared"
579 PICSWITCH="-fpic"
580 DLLPOST=".so"
582 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
584 INSTROOTBASESUFFIX=
585 INSTROOTCONTENTSUFFIX=
586 SDKDIRNAME=sdk
588 case "$host_os" in
590 solaris*)
591     build_gstreamer_1_0=yes
592     test_freetype=yes
593     _os=SunOS
595     dnl ===========================================================
596     dnl Check whether we're using Solaris 10 - SPARC or Intel.
597     dnl ===========================================================
598     AC_MSG_CHECKING([the Solaris operating system release])
599     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
600     if test "$_os_release" -lt "10"; then
601         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
602     else
603         AC_MSG_RESULT([ok ($_os_release)])
604     fi
606     dnl Check whether we're using a SPARC or i386 processor
607     AC_MSG_CHECKING([the processor type])
608     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
609         AC_MSG_RESULT([ok ($host_cpu)])
610     else
611         AC_MSG_ERROR([only SPARC and i386 processors are supported])
612     fi
613     ;;
615 linux-gnu*|k*bsd*-gnu*)
616     build_gstreamer_1_0=yes
617     test_kf5=yes
618     test_gtk3_kde5=yes
619     test_gdb_index=yes
620     test_split_debug=yes
621     if test "$enable_fuzzers" != yes; then
622         test_freetype=yes
623         test_fontconfig=yes
624     else
625         test_freetype=no
626         test_fontconfig=no
627         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
628     fi
629     _os=Linux
630     ;;
632 gnu)
633     test_randr=no
634     test_xrender=no
635     _os=GNU
636      ;;
638 cygwin*|interix*)
640     # When building on Windows normally with MSVC under Cygwin,
641     # configure thinks that the host platform (the platform the
642     # built code will run on) is Cygwin, even if it obviously is
643     # Windows, which in Autoconf terminology is called
644     # "mingw32". (Which is misleading as MinGW is the name of the
645     # tool-chain, not an operating system.)
647     # Somewhat confusing, yes. But this configure script doesn't
648     # look at $host etc that much, it mostly uses its own $_os
649     # variable, set here in this case statement.
651     test_cups=no
652     test_dbus=no
653     test_randr=no
654     test_xrender=no
655     test_freetype=no
656     test_fontconfig=no
657     _os=WINNT
659     DLLPOST=".dll"
660     LINKFLAGSNOUNDEFS=
661     ;;
663 darwin*) # macOS or iOS
664     test_randr=no
665     test_xrender=no
666     test_freetype=no
667     test_fontconfig=no
668     test_dbus=no
669     if test -n "$LODE_HOME" ; then
670         mac_sanitize_path
671         AC_MSG_NOTICE([sanitized the PATH to $PATH])
672     fi
673     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
674         build_for_ios=YES
675         _os=iOS
676         test_cups=no
677         enable_mpl_subset=yes
678         enable_lotuswordpro=no
679         enable_coinmp=no
680         enable_lpsolve=no
681         enable_postgresql_sdbc=no
682         enable_extension_integration=no
683         enable_report_builder=no
684         with_ppds=no
685         if test "$enable_ios_simulator" = "yes"; then
686             host=x86_64-apple-darwin
687         fi
688     else
689         _os=Darwin
690         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
691         INSTROOTCONTENTSUFFIX=/Contents
692         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
693     fi
694     # See comment above the case "$host_os"
695     LINKFLAGSSHL="-dynamiclib -single_module"
697     # -fPIC is default
698     PICSWITCH=""
700     DLLPOST=".dylib"
702     # -undefined error is the default
703     LINKFLAGSNOUNDEFS=""
706 freebsd*)
707     build_gstreamer_1_0=yes
708     test_kf5=yes
709     test_gtk3_kde5=yes
710     test_freetype=yes
711     AC_MSG_CHECKING([the FreeBSD operating system release])
712     if test -n "$with_os_version"; then
713         OSVERSION="$with_os_version"
714     else
715         OSVERSION=`/sbin/sysctl -n kern.osreldate`
716     fi
717     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
718     AC_MSG_CHECKING([which thread library to use])
719     if test "$OSVERSION" -lt "500016"; then
720         PTHREAD_CFLAGS="-D_THREAD_SAFE"
721         PTHREAD_LIBS="-pthread"
722     elif test "$OSVERSION" -lt "502102"; then
723         PTHREAD_CFLAGS="-D_THREAD_SAFE"
724         PTHREAD_LIBS="-lc_r"
725     else
726         PTHREAD_CFLAGS=""
727         PTHREAD_LIBS="-pthread"
728     fi
729     AC_MSG_RESULT([$PTHREAD_LIBS])
730     _os=FreeBSD
731     ;;
733 *netbsd*)
734     build_gstreamer_1_0=yes
735     test_kf5=yes
736     test_gtk3_kde5=yes
737     test_freetype=yes
738     PTHREAD_LIBS="-pthread -lpthread"
739     _os=NetBSD
740     ;;
742 aix*)
743     test_randr=no
744     test_freetype=yes
745     PTHREAD_LIBS=-pthread
746     _os=AIX
747     ;;
749 openbsd*)
750     test_freetype=yes
751     PTHREAD_CFLAGS="-D_THREAD_SAFE"
752     PTHREAD_LIBS="-pthread"
753     _os=OpenBSD
754     ;;
756 dragonfly*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     PTHREAD_LIBS="-pthread"
762     _os=DragonFly
763     ;;
765 linux-android*)
766     build_gstreamer_1_0=no
767     enable_lotuswordpro=no
768     enable_mpl_subset=yes
769     enable_coinmp=yes
770     enable_lpsolve=no
771     enable_report_builder=no
772     enable_odk=no
773     enable_postgresql_sdbc=no
774     enable_python=no
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_kf5=no
780     test_qt5=no
781     test_gtk3_kde5=no
782     test_randr=no
783     test_xrender=no
784     _os=Android
786     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
787     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
788     ;;
790 haiku*)
791     test_cups=no
792     test_dbus=no
793     test_randr=no
794     test_xrender=no
795     test_freetype=yes
796     enable_odk=no
797     enable_gstreamer_1_0=no
798     enable_vlc=no
799     enable_coinmp=no
800     enable_pdfium=no
801     enable_sdremote=no
802     enable_postgresql_sdbc=no
803     enable_firebird_sdbc=no
804     _os=Haiku
805     ;;
808     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
809     ;;
810 esac
812 if test "$_os" = "Android" ; then
813     # Verify that the NDK and SDK options are proper
814     if test -z "$with_android_ndk"; then
815         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
816     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
817         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
818     fi
820     if test -z "$ANDROID_SDK_HOME"; then
821         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
822     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
823         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
824     fi
826     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
827     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
828         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
829                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
830                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
831         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
832         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
833         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
834     fi
835     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
836         AC_MSG_WARN([android support repository not found - install with
837                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
838                      to allow the build to download the specified version of the android support libraries])
839         add_warning "android support repository not found - install with"
840         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
841         add_warning "to allow the build to download the specified version of the android support libraries"
842     fi
845 if test "$_os" = "AIX"; then
846     AC_PATH_PROG(GAWK, gawk)
847     if test -z "$GAWK"; then
848         AC_MSG_ERROR([gawk not found in \$PATH])
849     fi
852 AC_SUBST(SDKDIRNAME)
854 AC_SUBST(PTHREAD_CFLAGS)
855 AC_SUBST(PTHREAD_LIBS)
857 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
858 # By default use the ones specified by our build system,
859 # but explicit override is possible.
860 AC_MSG_CHECKING(for explicit AFLAGS)
861 if test -n "$AFLAGS"; then
862     AC_MSG_RESULT([$AFLAGS])
863     x_AFLAGS=
864 else
865     AC_MSG_RESULT(no)
866     x_AFLAGS=[\#]
868 AC_MSG_CHECKING(for explicit CFLAGS)
869 if test -n "$CFLAGS"; then
870     AC_MSG_RESULT([$CFLAGS])
871     x_CFLAGS=
872 else
873     AC_MSG_RESULT(no)
874     x_CFLAGS=[\#]
876 AC_MSG_CHECKING(for explicit CXXFLAGS)
877 if test -n "$CXXFLAGS"; then
878     AC_MSG_RESULT([$CXXFLAGS])
879     x_CXXFLAGS=
880 else
881     AC_MSG_RESULT(no)
882     x_CXXFLAGS=[\#]
884 AC_MSG_CHECKING(for explicit OBJCFLAGS)
885 if test -n "$OBJCFLAGS"; then
886     AC_MSG_RESULT([$OBJCFLAGS])
887     x_OBJCFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_OBJCFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
893 if test -n "$OBJCXXFLAGS"; then
894     AC_MSG_RESULT([$OBJCXXFLAGS])
895     x_OBJCXXFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_OBJCXXFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit LDFLAGS)
901 if test -n "$LDFLAGS"; then
902     AC_MSG_RESULT([$LDFLAGS])
903     x_LDFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_LDFLAGS=[\#]
908 AC_SUBST(AFLAGS)
909 AC_SUBST(CFLAGS)
910 AC_SUBST(CXXFLAGS)
911 AC_SUBST(OBJCFLAGS)
912 AC_SUBST(OBJCXXFLAGS)
913 AC_SUBST(LDFLAGS)
914 AC_SUBST(x_AFLAGS)
915 AC_SUBST(x_CFLAGS)
916 AC_SUBST(x_CXXFLAGS)
917 AC_SUBST(x_OBJCFLAGS)
918 AC_SUBST(x_OBJCXXFLAGS)
919 AC_SUBST(x_LDFLAGS)
921 dnl These are potentially set for MSVC, in the code checking for UCRT below:
922 my_original_CFLAGS=$CFLAGS
923 my_original_CXXFLAGS=$CXXFLAGS
924 my_original_CPPFLAGS=$CPPFLAGS
926 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
927 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
928 dnl AC_PROG_CC internally.
929 if test "$_os" != "WINNT"; then
930     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
931     save_CFLAGS=$CFLAGS
932     AC_PROG_CC
933     CFLAGS=$save_CFLAGS
934     if test -z "$CC_BASE"; then
935         CC_BASE=`first_arg_basename "$CC"`
936     fi
939 if test "$_os" != "WINNT"; then
940     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
941 else
942     ENDIANNESS=little
944 AC_SUBST(ENDIANNESS)
946 if test $_os != "WINNT"; then
947     save_LIBS="$LIBS"
948     AC_SEARCH_LIBS([dlsym], [dl],
949         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
950         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
951     LIBS="$save_LIBS"
953 AC_SUBST(DLOPEN_LIBS)
955 AC_ARG_ENABLE(ios-simulator,
956     AS_HELP_STRING([--enable-ios-simulator],
957         [build i386 or x86_64 for ios simulator])
960 AC_ARG_ENABLE(ios-libreofficelight-app,
961     AS_HELP_STRING([--enable-ios-libreofficelight-app],
962         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
963          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
964          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
967 ENABLE_IOS_LIBREOFFICELIGHT_APP=
968 if test "$enable_ios_libreofficelight_app" = yes; then
969     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
971 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
973 ###############################################################################
974 # Extensions switches --enable/--disable
975 ###############################################################################
976 # By default these should be enabled unless having extra dependencies.
977 # If there is extra dependency over configure options then the enable should
978 # be automagic based on whether the requiring feature is enabled or not.
979 # All this options change anything only with --enable-extension-integration.
981 # The name of this option and its help string makes it sound as if
982 # extensions are built anyway, just not integrated in the installer,
983 # if you use --disable-extension-integration. Is that really the
984 # case?
986 libo_FUZZ_ARG_ENABLE(extension-integration,
987     AS_HELP_STRING([--disable-extension-integration],
988         [Disable integration of the built extensions in the installer of the
989          product. Use this switch to disable the integration.])
992 AC_ARG_ENABLE(avmedia,
993     AS_HELP_STRING([--disable-avmedia],
994         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
997 AC_ARG_ENABLE(database-connectivity,
998     AS_HELP_STRING([--disable-database-connectivity],
999         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1002 # This doesn't mean not building (or "integrating") extensions
1003 # (although it probably should; i.e. it should imply
1004 # --disable-extension-integration I guess), it means not supporting
1005 # any extension mechanism at all
1006 libo_FUZZ_ARG_ENABLE(extensions,
1007     AS_HELP_STRING([--disable-extensions],
1008         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1011 AC_ARG_ENABLE(scripting,
1012     AS_HELP_STRING([--disable-scripting],
1013         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1016 # This is mainly for Android and iOS, but could potentially be used in some
1017 # special case otherwise, too, so factored out as a separate setting
1019 AC_ARG_ENABLE(dynamic-loading,
1020     AS_HELP_STRING([--disable-dynamic-loading],
1021         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1024 libo_FUZZ_ARG_ENABLE(report-builder,
1025     AS_HELP_STRING([--disable-report-builder],
1026         [Disable the Report Builder.])
1029 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1030     AS_HELP_STRING([--enable-ext-wiki-publisher],
1031         [Enable the Wiki Publisher extension.])
1034 libo_FUZZ_ARG_ENABLE(lpsolve,
1035     AS_HELP_STRING([--disable-lpsolve],
1036         [Disable compilation of the lp solve solver ])
1038 libo_FUZZ_ARG_ENABLE(coinmp,
1039     AS_HELP_STRING([--disable-coinmp],
1040         [Disable compilation of the CoinMP solver ])
1043 libo_FUZZ_ARG_ENABLE(pdfimport,
1044     AS_HELP_STRING([--disable-pdfimport],
1045         [Disable building the PDF import feature.])
1048 libo_FUZZ_ARG_ENABLE(pdfium,
1049     AS_HELP_STRING([--disable-pdfium],
1050         [Disable building PDFium.])
1053 ###############################################################################
1055 dnl ---------- *** ----------
1057 libo_FUZZ_ARG_ENABLE(mergelibs,
1058     AS_HELP_STRING([--enable-mergelibs],
1059         [Merge several of the smaller libraries into one big, "merged", one.])
1062 libo_FUZZ_ARG_ENABLE(breakpad,
1063     AS_HELP_STRING([--enable-breakpad],
1064         [Enables breakpad for crash reporting.])
1067 libo_FUZZ_ARG_ENABLE(crashdump,
1068     AS_HELP_STRING([--disable-crashdump],
1069         [Disable dump.ini and dump-file, when --enable-breakpad])
1072 AC_ARG_ENABLE(fetch-external,
1073     AS_HELP_STRING([--disable-fetch-external],
1074         [Disables fetching external tarballs from web sources.])
1077 AC_ARG_ENABLE(fuzzers,
1078     AS_HELP_STRING([--enable-fuzzers],
1079         [Enables building libfuzzer targets for fuzz testing.])
1082 libo_FUZZ_ARG_ENABLE(pch,
1083     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1084         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1085          Using 'system' will include only external headers, 'base' will add also headers
1086          from base modules, 'normal' will also add all headers except from the module built,
1087          'full' will use all suitable headers even from a module itself.])
1090 libo_FUZZ_ARG_ENABLE(epm,
1091     AS_HELP_STRING([--enable-epm],
1092         [LibreOffice includes self-packaging code, that requires epm, however epm is
1093          useless for large scale package building.])
1096 libo_FUZZ_ARG_ENABLE(odk,
1097     AS_HELP_STRING([--disable-odk],
1098         [LibreOffice includes an ODK, office development kit which some packagers may
1099          wish to build without.])
1102 AC_ARG_ENABLE(mpl-subset,
1103     AS_HELP_STRING([--enable-mpl-subset],
1104         [Don't compile any pieces which are not MPL or more liberally licensed])
1107 libo_FUZZ_ARG_ENABLE(evolution2,
1108     AS_HELP_STRING([--enable-evolution2],
1109         [Allows the built-in evolution 2 addressbook connectivity build to be
1110          enabled.])
1113 AC_ARG_ENABLE(avahi,
1114     AS_HELP_STRING([--enable-avahi],
1115         [Determines whether to use Avahi to advertise Impress to remote controls.])
1118 libo_FUZZ_ARG_ENABLE(werror,
1119     AS_HELP_STRING([--enable-werror],
1120         [Turn warnings to errors. (Has no effect in modules where the treating
1121          of warnings as errors is disabled explicitly.)]),
1124 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1125     AS_HELP_STRING([--enable-assert-always-abort],
1126         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1129 libo_FUZZ_ARG_ENABLE(dbgutil,
1130     AS_HELP_STRING([--enable-dbgutil],
1131         [Provide debugging support from --enable-debug and include additional debugging
1132          utilities such as object counting or more expensive checks.
1133          This is the recommended option for developers.
1134          Note that this makes the build ABI incompatible, it is not possible to mix object
1135          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1137 libo_FUZZ_ARG_ENABLE(debug,
1138     AS_HELP_STRING([--enable-debug],
1139         [Include debugging information, disable compiler optimization and inlining plus
1140          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1142 libo_FUZZ_ARG_ENABLE(split-debug,
1143     AS_HELP_STRING([--disable-split-debug],
1144         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1145          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1147 libo_FUZZ_ARG_ENABLE(gdb-index,
1148     AS_HELP_STRING([--disable-gdb-index],
1149         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1150          The feature requires the gold or lld linker.]))
1152 libo_FUZZ_ARG_ENABLE(sal-log,
1153     AS_HELP_STRING([--enable-sal-log],
1154         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1156 libo_FUZZ_ARG_ENABLE(symbols,
1157     AS_HELP_STRING([--enable-symbols],
1158         [Generate debug information.
1159          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1160          otherwise. It is possible to explicitly specify gbuild build targets
1161          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1162          everything in the directory; there is no ordering, more specific overrides
1163          more general, and disabling takes precedence).
1164          Example: --enable-symbols="all -sw/ -Library_sc".]))
1166 libo_FUZZ_ARG_ENABLE(optimized,
1167     AS_HELP_STRING([--disable-optimized],
1168         [Whether to compile with optimization flags.
1169          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1170          otherwise.]))
1172 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1173     AS_HELP_STRING([--disable-runtime-optimizations],
1174         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1175          JVM JIT) that are known to interact badly with certain dynamic analysis
1176          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1177          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1178          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1180 AC_ARG_WITH(valgrind,
1181     AS_HELP_STRING([--with-valgrind],
1182         [Make availability of Valgrind headers a hard requirement.]))
1184 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1185     AS_HELP_STRING([--enable-compiler-plugins],
1186         [Enable compiler plugins that will perform additional checks during
1187          building. Enabled automatically by --enable-dbgutil.
1188          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1189 COMPILER_PLUGINS_DEBUG=
1190 if test "$enable_compiler_plugins" = debug; then
1191     enable_compiler_plugins=yes
1192     COMPILER_PLUGINS_DEBUG=TRUE
1195 libo_FUZZ_ARG_ENABLE(ooenv,
1196     AS_HELP_STRING([--disable-ooenv],
1197         [Disable ooenv for the instdir installation.]))
1199 libo_FUZZ_ARG_ENABLE(libnumbertext,
1200     AS_HELP_STRING([--disable-libnumbertext],
1201         [Disable use of numbertext external library.]))
1203 AC_ARG_ENABLE(lto,
1204     AS_HELP_STRING([--enable-lto],
1205         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1206          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1207          linker. For MSVC, this option is broken at the moment. This is experimental work
1208          in progress that shouldn't be used unless you are working on it.)]))
1210 AC_ARG_ENABLE(python,
1211     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1212         [Enables or disables Python support at run-time.
1213          Also specifies what Python to use. 'auto' is the default.
1214          'fully-internal' even forces the internal version for uses of Python
1215          during the build.]))
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1220 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1222 AC_ARG_ENABLE(introspection,
1223     AS_HELP_STRING([--enable-introspection],
1224         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1225          Linux distributions.)]))
1227 AC_ARG_ENABLE(split-app-modules,
1228     AS_HELP_STRING([--enable-split-app-modules],
1229         [Split file lists for app modules, e.g. base, calc.
1230          Has effect only with make distro-pack-install]),
1233 AC_ARG_ENABLE(split-opt-features,
1234     AS_HELP_STRING([--enable-split-opt-features],
1235         [Split file lists for some optional features, e.g. pyuno, testtool.
1236          Has effect only with make distro-pack-install]),
1239 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1240     AS_HELP_STRING([--disable-cairo-canvas],
1241         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1244 libo_FUZZ_ARG_ENABLE(dbus,
1245     AS_HELP_STRING([--disable-dbus],
1246         [Determines whether to enable features that depend on dbus.
1247          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1248 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1250 libo_FUZZ_ARG_ENABLE(sdremote,
1251     AS_HELP_STRING([--disable-sdremote],
1252         [Determines whether to enable Impress remote control (i.e. the server component).]),
1253 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1255 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1256     AS_HELP_STRING([--disable-sdremote-bluetooth],
1257         [Determines whether to build sdremote with bluetooth support.
1258          Requires dbus on Linux.]))
1260 libo_FUZZ_ARG_ENABLE(gio,
1261     AS_HELP_STRING([--disable-gio],
1262         [Determines whether to use the GIO support.]),
1263 ,test "${enable_gio+set}" = set || enable_gio=yes)
1265 AC_ARG_ENABLE(qt5,
1266     AS_HELP_STRING([--enable-qt5],
1267         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1268          available.]),
1271 AC_ARG_ENABLE(kf5,
1272     AS_HELP_STRING([--enable-kf5],
1273         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1274          KF5 are available.]),
1277 AC_ARG_ENABLE(kde5,
1278     AS_HELP_STRING([--enable-kde5],
1279         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1282 AC_ARG_ENABLE(gtk3_kde5,
1283     AS_HELP_STRING([--enable-gtk3-kde5],
1284         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1285          platforms where Gtk3, Qt5 and Plasma is available.]),
1288 AC_ARG_ENABLE(gui,
1289     AS_HELP_STRING([--disable-gui],
1290         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1291 ,enable_gui=yes)
1293 libo_FUZZ_ARG_ENABLE(randr,
1294     AS_HELP_STRING([--disable-randr],
1295         [Disable RandR support in the vcl project.]),
1296 ,test "${enable_randr+set}" = set || enable_randr=yes)
1298 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1299     AS_HELP_STRING([--disable-gstreamer-1-0],
1300         [Disable building with the gstreamer 1.0 avmedia backend.]),
1301 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1361          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1375          Additionally ccache's depend mode is enabled if possible,
1376          use --enable-ccache=nodepend to enable ccache without depend mode.
1380 AC_ARG_ENABLE(64-bit,
1381     AS_HELP_STRING([--enable-64-bit],
1382         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1383          At the moment meaningful only for Windows.]), ,)
1385 libo_FUZZ_ARG_ENABLE(online-update,
1386     AS_HELP_STRING([--enable-online-update],
1387         [Enable the online update service that will check for new versions of
1388          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1389          If the value is "mar", the experimental Mozilla-like update will be
1390          enabled instead of the traditional update mechanism.]),
1393 AC_ARG_WITH(update-config,
1394     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1395                    [Path to the update config ini file]))
1397 libo_FUZZ_ARG_ENABLE(extension-update,
1398     AS_HELP_STRING([--disable-extension-update],
1399         [Disable possibility to update installed extensions.]),
1402 libo_FUZZ_ARG_ENABLE(release-build,
1403     AS_HELP_STRING([--enable-release-build],
1404         [Enable release build. Note that the "release build" choice is orthogonal to
1405          whether symbols are present, debug info is generated, or optimization
1406          is done.
1407          See http://wiki.documentfoundation.org/Development/DevBuild]),
1410 AC_ARG_ENABLE(windows-build-signing,
1411     AS_HELP_STRING([--enable-windows-build-signing],
1412         [Enable signing of windows binaries (*.exe, *.dll)]),
1415 AC_ARG_ENABLE(silent-msi,
1416     AS_HELP_STRING([--enable-silent-msi],
1417         [Enable MSI with LIMITUI=1 (silent install).]),
1420 AC_ARG_ENABLE(macosx-code-signing,
1421     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1422         [Sign executables, dylibs, frameworks and the app bundle. If you
1423          don't provide an identity the first suitable certificate
1424          in your keychain is used.]),
1427 AC_ARG_ENABLE(macosx-package-signing,
1428     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1429         [Create a .pkg suitable for uploading to the Mac App Store and sign
1430          it. If you don't provide an identity the first suitable certificate
1431          in your keychain is used.]),
1434 AC_ARG_ENABLE(macosx-sandbox,
1435     AS_HELP_STRING([--enable-macosx-sandbox],
1436         [Make the app bundle run in a sandbox. Requires code signing.
1437          Is required by apps distributed in the Mac App Store, and implies
1438          adherence to App Store rules.]),
1441 AC_ARG_WITH(macosx-bundle-identifier,
1442     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1443         [Define the macOS bundle identifier. Default is the somewhat weird
1444          org.libreoffice.script ("script", huh?).]),
1445 ,with_macosx_bundle_identifier=org.libreoffice.script)
1447 AC_ARG_WITH(product-name,
1448     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1449         [Define the product name. Default is AC_PACKAGE_NAME.]),
1450 ,with_product_name=$PRODUCTNAME)
1452 AC_ARG_WITH(package-version,
1453     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1454         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1457 libo_FUZZ_ARG_ENABLE(readonly-installset,
1458     AS_HELP_STRING([--enable-readonly-installset],
1459         [Prevents any attempts by LibreOffice to write into its installation. That means
1460          at least that no "system-wide" extensions can be added. Partly experimental work in
1461          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1464 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1465     AS_HELP_STRING([--disable-postgresql-sdbc],
1466         [Disable the build of the PostgreSQL-SDBC driver.])
1469 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1470     AS_HELP_STRING([--disable-lotuswordpro],
1471         [Disable the build of the Lotus Word Pro filter.]),
1472 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1474 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1475     AS_HELP_STRING([--disable-firebird-sdbc],
1476         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1477 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1479 AC_ARG_ENABLE(bogus-pkg-config,
1480     AS_HELP_STRING([--enable-bogus-pkg-config],
1481         [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.]),
1484 AC_ARG_ENABLE(openssl,
1485     AS_HELP_STRING([--disable-openssl],
1486         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1487          components will either use GNUTLS or NSS. Work in progress,
1488          use only if you are hacking on it.]),
1489 ,enable_openssl=yes)
1491 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1492     AS_HELP_STRING([--enable-cipher-openssl-backend],
1493         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1494          Requires --enable-openssl.]))
1496 AC_ARG_ENABLE(library-bin-tar,
1497     AS_HELP_STRING([--enable-library-bin-tar],
1498         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1499         Some libraries can save their build result in a tarball
1500         stored in TARFILE_LOCATION. That binary tarball is
1501         uniquely identified by the source tarball,
1502         the content of the config_host.mk file and the content
1503         of the top-level directory in core for that library
1504         If this option is enabled, then if such a tarfile exist, it will be untarred
1505         instead of the source tarfile, and the build step will be skipped for that
1506         library.
1507         If a proper tarfile does not exist, then the normal source-based
1508         build is done for that library and a proper binary tarfile is created
1509         for the next time.]),
1512 AC_ARG_ENABLE(dconf,
1513     AS_HELP_STRING([--disable-dconf],
1514         [Disable the dconf configuration backend (enabled by default where
1515          available).]))
1517 libo_FUZZ_ARG_ENABLE(formula-logger,
1518     AS_HELP_STRING(
1519         [--enable-formula-logger],
1520         [Enable formula logger for logging formula calculation flow in Calc.]
1521     )
1524 AC_ARG_ENABLE(ldap,
1525     AS_HELP_STRING([--disable-ldap],
1526         [Disable LDAP support.]),
1527 ,enable_ldap=yes)
1529 dnl ===================================================================
1530 dnl Optional Packages (--with/without-)
1531 dnl ===================================================================
1533 AC_ARG_WITH(gcc-home,
1534     AS_HELP_STRING([--with-gcc-home],
1535         [Specify the location of gcc/g++ manually. This can be used in conjunction
1536          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1537          non-default path.]),
1540 AC_ARG_WITH(gnu-patch,
1541     AS_HELP_STRING([--with-gnu-patch],
1542         [Specify location of GNU patch on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(build-platform-configure-options,
1546     AS_HELP_STRING([--with-build-platform-configure-options],
1547         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1550 AC_ARG_WITH(gnu-cp,
1551     AS_HELP_STRING([--with-gnu-cp],
1552         [Specify location of GNU cp on Solaris or FreeBSD.]),
1555 AC_ARG_WITH(external-tar,
1556     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1557         [Specify an absolute path of where to find (and store) tarfiles.]),
1558     TARFILE_LOCATION=$withval ,
1561 AC_ARG_WITH(referenced-git,
1562     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1563         [Specify another checkout directory to reference. This makes use of
1564                  git submodule update --reference, and saves a lot of diskspace
1565                  when having multiple trees side-by-side.]),
1566     GIT_REFERENCE_SRC=$withval ,
1569 AC_ARG_WITH(linked-git,
1570     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1571         [Specify a directory where the repositories of submodules are located.
1572          This uses a method similar to git-new-workdir to get submodules.]),
1573     GIT_LINK_SRC=$withval ,
1576 AC_ARG_WITH(galleries,
1577     AS_HELP_STRING([--with-galleries],
1578         [Specify how galleries should be built. It is possible either to
1579          build these internally from source ("build"),
1580          or to disable them ("no")]),
1583 AC_ARG_WITH(theme,
1584     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1585         [Choose which themes to include. By default those themes with an '*' are included.
1586          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1587          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1590 libo_FUZZ_ARG_WITH(helppack-integration,
1591     AS_HELP_STRING([--without-helppack-integration],
1592         [It will not integrate the helppacks to the installer
1593          of the product. Please use this switch to use the online help
1594          or separate help packages.]),
1597 libo_FUZZ_ARG_WITH(fonts,
1598     AS_HELP_STRING([--without-fonts],
1599         [LibreOffice includes some third-party fonts to provide a reliable basis for
1600          help content, templates, samples, etc. When these fonts are already
1601          known to be available on the system then you should use this option.]),
1604 AC_ARG_WITH(epm,
1605     AS_HELP_STRING([--with-epm],
1606         [Decides which epm to use. Default is to use the one from the system if
1607          one is built. When either this is not there or you say =internal epm
1608          will be built.]),
1611 AC_ARG_WITH(package-format,
1612     AS_HELP_STRING([--with-package-format],
1613         [Specify package format(s) for LibreOffice installation sets. The
1614          implicit --without-package-format leads to no installation sets being
1615          generated. Possible values: aix, archive, bsd, deb, dmg,
1616          installed, msi, pkg, and rpm.
1617          Example: --with-package-format='deb rpm']),
1620 AC_ARG_WITH(tls,
1621     AS_HELP_STRING([--with-tls],
1622         [Decides which TLS/SSL and cryptographic implementations to use for
1623          LibreOffice's code. Notice that this doesn't apply for depending
1624          libraries like "neon", for example. Default is to use OpenSSL
1625          although NSS is also possible. Notice that selecting NSS restricts
1626          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1627          restrict by now the usage of NSS in LO's code. Possible values:
1628          openssl, nss. Example: --with-tls="nss"]),
1631 AC_ARG_WITH(system-libs,
1632     AS_HELP_STRING([--with-system-libs],
1633         [Use libraries already on system -- enables all --with-system-* flags.]),
1636 AC_ARG_WITH(system-bzip2,
1637     AS_HELP_STRING([--with-system-bzip2],
1638         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1639     [with_system_bzip2="$with_system_libs"])
1641 AC_ARG_WITH(system-headers,
1642     AS_HELP_STRING([--with-system-headers],
1643         [Use headers already on system -- enables all --with-system-* flags for
1644          external packages whose headers are the only entities used i.e.
1645          boost/odbc/sane-header(s).]),,
1646     [with_system_headers="$with_system_libs"])
1648 AC_ARG_WITH(system-jars,
1649     AS_HELP_STRING([--without-system-jars],
1650         [When building with --with-system-libs, also the needed jars are expected
1651          on the system. Use this to disable that]),,
1652     [with_system_jars="$with_system_libs"])
1654 AC_ARG_WITH(system-cairo,
1655     AS_HELP_STRING([--with-system-cairo],
1656         [Use cairo libraries already on system.  Happens automatically for
1657          (implicit) --enable-gtk3.]))
1659 AC_ARG_WITH(system-epoxy,
1660     AS_HELP_STRING([--with-system-epoxy],
1661         [Use epoxy libraries already on system.  Happens automatically for
1662          (implicit) --enable-gtk3.]),,
1663        [with_system_epoxy="$with_system_libs"])
1665 AC_ARG_WITH(myspell-dicts,
1666     AS_HELP_STRING([--with-myspell-dicts],
1667         [Adds myspell dictionaries to the LibreOffice installation set]),
1670 AC_ARG_WITH(system-dicts,
1671     AS_HELP_STRING([--without-system-dicts],
1672         [Do not use dictionaries from system paths.]),
1675 AC_ARG_WITH(external-dict-dir,
1676     AS_HELP_STRING([--with-external-dict-dir],
1677         [Specify external dictionary dir.]),
1680 AC_ARG_WITH(external-hyph-dir,
1681     AS_HELP_STRING([--with-external-hyph-dir],
1682         [Specify external hyphenation pattern dir.]),
1685 AC_ARG_WITH(external-thes-dir,
1686     AS_HELP_STRING([--with-external-thes-dir],
1687         [Specify external thesaurus dir.]),
1690 AC_ARG_WITH(system-zlib,
1691     AS_HELP_STRING([--with-system-zlib],
1692         [Use zlib already on system.]),,
1693     [with_system_zlib=auto])
1695 AC_ARG_WITH(system-jpeg,
1696     AS_HELP_STRING([--with-system-jpeg],
1697         [Use jpeg already on system.]),,
1698     [with_system_jpeg="$with_system_libs"])
1700 AC_ARG_WITH(system-clucene,
1701     AS_HELP_STRING([--with-system-clucene],
1702         [Use clucene already on system.]),,
1703     [with_system_clucene="$with_system_libs"])
1705 AC_ARG_WITH(system-expat,
1706     AS_HELP_STRING([--with-system-expat],
1707         [Use expat already on system.]),,
1708     [with_system_expat="$with_system_libs"])
1710 AC_ARG_WITH(system-libxml,
1711     AS_HELP_STRING([--with-system-libxml],
1712         [Use libxml/libxslt already on system.]),,
1713     [with_system_libxml=auto])
1715 AC_ARG_WITH(system-icu,
1716     AS_HELP_STRING([--with-system-icu],
1717         [Use icu already on system.]),,
1718     [with_system_icu="$with_system_libs"])
1720 AC_ARG_WITH(system-ucpp,
1721     AS_HELP_STRING([--with-system-ucpp],
1722         [Use ucpp already on system.]),,
1723     [])
1725 AC_ARG_WITH(system-openldap,
1726     AS_HELP_STRING([--with-system-openldap],
1727         [Use the OpenLDAP LDAP SDK already on system.]),,
1728     [with_system_openldap="$with_system_libs"])
1730 libo_FUZZ_ARG_ENABLE(poppler,
1731     AS_HELP_STRING([--disable-poppler],
1732         [Disable building Poppler.])
1735 AC_ARG_WITH(system-poppler,
1736     AS_HELP_STRING([--with-system-poppler],
1737         [Use system poppler (only needed for PDF import).]),,
1738     [with_system_poppler="$with_system_libs"])
1740 AC_ARG_WITH(system-gpgmepp,
1741     AS_HELP_STRING([--with-system-gpgmepp],
1742         [Use gpgmepp already on system]),,
1743     [with_system_gpgmepp="$with_system_libs"])
1745 AC_ARG_WITH(system-apache-commons,
1746     AS_HELP_STRING([--with-system-apache-commons],
1747         [Use Apache commons libraries already on system.]),,
1748     [with_system_apache_commons="$with_system_jars"])
1750 AC_ARG_WITH(system-mariadb,
1751     AS_HELP_STRING([--with-system-mariadb],
1752         [Use MariaDB/MySQL libraries already on system.]),,
1753     [with_system_mariadb="$with_system_libs"])
1755 AC_ARG_ENABLE(bundle-mariadb,
1756     AS_HELP_STRING([--enable-bundle-mariadb],
1757         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1760 AC_ARG_WITH(system-postgresql,
1761     AS_HELP_STRING([--with-system-postgresql],
1762         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1763          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1764     [with_system_postgresql="$with_system_libs"])
1766 AC_ARG_WITH(libpq-path,
1767     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1768         [Use this PostgreSQL C interface (libpq) installation for building
1769          the PostgreSQL-SDBC extension.]),
1772 AC_ARG_WITH(system-firebird,
1773     AS_HELP_STRING([--with-system-firebird],
1774         [Use Firebird libraries already on system, for building the Firebird-SDBC
1775          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1776     [with_system_firebird="$with_system_libs"])
1778 AC_ARG_WITH(system-libtommath,
1779             AS_HELP_STRING([--with-system-libtommath],
1780                            [Use libtommath already on system]),,
1781             [with_system_libtommath="$with_system_libs"])
1783 AC_ARG_WITH(system-hsqldb,
1784     AS_HELP_STRING([--with-system-hsqldb],
1785         [Use hsqldb already on system.]))
1787 AC_ARG_WITH(hsqldb-jar,
1788     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     HSQLDB_JAR=$withval)
1792 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1793     AS_HELP_STRING([--disable-scripting-beanshell],
1794         [Disable support for scripts in BeanShell.]),
1798 AC_ARG_WITH(system-beanshell,
1799     AS_HELP_STRING([--with-system-beanshell],
1800         [Use beanshell already on system.]),,
1801     [with_system_beanshell="$with_system_jars"])
1803 AC_ARG_WITH(beanshell-jar,
1804     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     BSH_JAR=$withval)
1808 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1809     AS_HELP_STRING([--disable-scripting-javascript],
1810         [Disable support for scripts in JavaScript.]),
1814 AC_ARG_WITH(system-rhino,
1815     AS_HELP_STRING([--with-system-rhino],
1816         [Use rhino already on system.]),,)
1817 #    [with_system_rhino="$with_system_jars"])
1818 # Above is not used as we have different debug interface
1819 # patched into internal rhino. This code needs to be fixed
1820 # before we can enable it by default.
1822 AC_ARG_WITH(rhino-jar,
1823     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     RHINO_JAR=$withval)
1827 AC_ARG_WITH(commons-logging-jar,
1828     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     COMMONS_LOGGING_JAR=$withval)
1832 AC_ARG_WITH(system-jfreereport,
1833     AS_HELP_STRING([--with-system-jfreereport],
1834         [Use JFreeReport already on system.]),,
1835     [with_system_jfreereport="$with_system_jars"])
1837 AC_ARG_WITH(sac-jar,
1838     AS_HELP_STRING([--with-sac-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     SAC_JAR=$withval)
1842 AC_ARG_WITH(libxml-jar,
1843     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     LIBXML_JAR=$withval)
1847 AC_ARG_WITH(flute-jar,
1848     AS_HELP_STRING([--with-flute-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     FLUTE_JAR=$withval)
1852 AC_ARG_WITH(jfreereport-jar,
1853     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     JFREEREPORT_JAR=$withval)
1857 AC_ARG_WITH(liblayout-jar,
1858     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBLAYOUT_JAR=$withval)
1862 AC_ARG_WITH(libloader-jar,
1863     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBLOADER_JAR=$withval)
1867 AC_ARG_WITH(libformula-jar,
1868     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFORMULA_JAR=$withval)
1872 AC_ARG_WITH(librepository-jar,
1873     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBREPOSITORY_JAR=$withval)
1877 AC_ARG_WITH(libfonts-jar,
1878     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBFONTS_JAR=$withval)
1882 AC_ARG_WITH(libserializer-jar,
1883     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBSERIALIZER_JAR=$withval)
1887 AC_ARG_WITH(libbase-jar,
1888     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBBASE_JAR=$withval)
1892 AC_ARG_WITH(system-odbc,
1893     AS_HELP_STRING([--with-system-odbc],
1894         [Use the odbc headers already on system.]),,
1895     [with_system_odbc="auto"])
1897 AC_ARG_WITH(system-sane,
1898     AS_HELP_STRING([--with-system-sane],
1899         [Use sane.h already on system.]),,
1900     [with_system_sane="$with_system_headers"])
1902 AC_ARG_WITH(system-bluez,
1903     AS_HELP_STRING([--with-system-bluez],
1904         [Use bluetooth.h already on system.]),,
1905     [with_system_bluez="$with_system_headers"])
1907 AC_ARG_WITH(system-curl,
1908     AS_HELP_STRING([--with-system-curl],
1909         [Use curl already on system.]),,
1910     [with_system_curl=auto])
1912 AC_ARG_WITH(system-boost,
1913     AS_HELP_STRING([--with-system-boost],
1914         [Use boost already on system.]),,
1915     [with_system_boost="$with_system_headers"])
1917 AC_ARG_WITH(system-glm,
1918     AS_HELP_STRING([--with-system-glm],
1919         [Use glm already on system.]),,
1920     [with_system_glm="$with_system_headers"])
1922 AC_ARG_WITH(system-hunspell,
1923     AS_HELP_STRING([--with-system-hunspell],
1924         [Use libhunspell already on system.]),,
1925     [with_system_hunspell="$with_system_libs"])
1927 AC_ARG_WITH(system-qrcodegen,
1928     AS_HELP_STRING([--with-system-qrcodegen],
1929         [Use libqrcodegen already on system.]),,
1930     [with_system_qrcodegen="$with_system_libs"])
1932 AC_ARG_WITH(system-mythes,
1933     AS_HELP_STRING([--with-system-mythes],
1934         [Use mythes already on system.]),,
1935     [with_system_mythes="$with_system_libs"])
1937 AC_ARG_WITH(system-altlinuxhyph,
1938     AS_HELP_STRING([--with-system-altlinuxhyph],
1939         [Use ALTLinuxhyph already on system.]),,
1940     [with_system_altlinuxhyph="$with_system_libs"])
1942 AC_ARG_WITH(system-lpsolve,
1943     AS_HELP_STRING([--with-system-lpsolve],
1944         [Use lpsolve already on system.]),,
1945     [with_system_lpsolve="$with_system_libs"])
1947 AC_ARG_WITH(system-coinmp,
1948     AS_HELP_STRING([--with-system-coinmp],
1949         [Use CoinMP already on system.]),,
1950     [with_system_coinmp="$with_system_libs"])
1952 AC_ARG_WITH(system-liblangtag,
1953     AS_HELP_STRING([--with-system-liblangtag],
1954         [Use liblangtag library already on system.]),,
1955     [with_system_liblangtag="$with_system_libs"])
1957 AC_ARG_WITH(webdav,
1958     AS_HELP_STRING([--with-webdav],
1959         [Specify which library to use for webdav implementation.
1960          Possible values: "neon", "serf", "no". The default value is "neon".
1961          Example: --with-webdav="serf"]),
1962     WITH_WEBDAV=$withval,
1963     WITH_WEBDAV="neon")
1965 AC_ARG_WITH(linker-hash-style,
1966     AS_HELP_STRING([--with-linker-hash-style],
1967         [Use linker with --hash-style=<style> when linking shared objects.
1968          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1969          if supported on the build system, and "sysv" otherwise.]))
1971 AC_ARG_WITH(jdk-home,
1972     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1973         [If you have installed JDK 8 or later on your system please supply the
1974          path here. Note that this is not the location of the java command but the
1975          location of the entire distribution.]),
1978 AC_ARG_WITH(help,
1979     AS_HELP_STRING([--with-help],
1980         [Enable the build of help. There is a special parameter "common" that
1981          can be used to bundle only the common part, .e.g help-specific icons.
1982          This is useful when you build the helpcontent separately.])
1983     [
1984                           Usage:     --with-help    build the old local help
1985                                  --without-help     no local help (default)
1986                                  --with-help=html   build the new HTML local help
1987                                  --with-help=online build the new HTML online help
1988     ],
1991 AC_ARG_WITH(omindex,
1992    AS_HELP_STRING([--with-omindex],
1993         [Enable the support of xapian-omega index for online help.])
1994    [
1995                          Usage: --with-omindex=server prepare the pages for omindex
1996                                 but let xapian-omega be built in server.
1997                                 --with-omindex=noxap do not prepare online pages
1998                                 for xapian-omega
1999   ],
2002 libo_FUZZ_ARG_WITH(java,
2003     AS_HELP_STRING([--with-java=<java command>],
2004         [Specify the name of the Java interpreter command. Typically "java"
2005          which is the default.
2007          To build without support for Java components, applets, accessibility
2008          or the XML filters written in Java, use --without-java or --with-java=no.]),
2009     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2010     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2013 AC_ARG_WITH(jvm-path,
2014     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2015         [Use a specific JVM search path at runtime.
2016          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2019 AC_ARG_WITH(ant-home,
2020     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2021         [If you have installed Apache Ant on your system, please supply the path here.
2022          Note that this is not the location of the Ant binary but the location
2023          of the entire distribution.]),
2026 AC_ARG_WITH(symbol-config,
2027     AS_HELP_STRING([--with-symbol-config],
2028         [Configuration for the crashreport symbol upload]),
2029         [],
2030         [with_symbol_config=no])
2032 AC_ARG_WITH(export-validation,
2033     AS_HELP_STRING([--without-export-validation],
2034         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2035 ,with_export_validation=auto)
2037 AC_ARG_WITH(bffvalidator,
2038     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2039         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2040          Requires installed Microsoft Office Binary File Format Validator.
2041          Note: export-validation (--with-export-validation) is required to be turned on.
2042          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2043 ,with_bffvalidator=no)
2045 libo_FUZZ_ARG_WITH(junit,
2046     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2047         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2048          --without-junit disables those tests. Not relevant in the --without-java case.]),
2049 ,with_junit=yes)
2051 AC_ARG_WITH(hamcrest,
2052     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2053         [Specifies the hamcrest jar file to use for JUnit-based tests.
2054          --without-junit disables those tests. Not relevant in the --without-java case.]),
2055 ,with_hamcrest=yes)
2057 AC_ARG_WITH(perl-home,
2058     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2059         [If you have installed Perl 5 Distribution, on your system, please
2060          supply the path here. Note that this is not the location of the Perl
2061          binary but the location of the entire distribution.]),
2064 libo_FUZZ_ARG_WITH(doxygen,
2065     AS_HELP_STRING(
2066         [--with-doxygen=<absolute path to doxygen executable>],
2067         [Specifies the doxygen executable to use when generating ODK C/C++
2068          documentation. --without-doxygen disables generation of ODK C/C++
2069          documentation. Not relevant in the --disable-odk case.]),
2070 ,with_doxygen=yes)
2072 AC_ARG_WITH(visual-studio,
2073     AS_HELP_STRING([--with-visual-studio=<2017>],
2074         [Specify which Visual Studio version to use in case several are
2075          installed. Currently only 2017 is supported.]),
2078 AC_ARG_WITH(windows-sdk,
2079     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2080         [Specify which Windows SDK, or "Windows Kit", version to use
2081          in case the one that came with the selected Visual Studio
2082          is not what you want for some reason. Note that not all compiler/SDK
2083          combinations are supported. The intent is that this option should not
2084          be needed.]),
2087 AC_ARG_WITH(lang,
2088     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2089         [Use this option to build LibreOffice with additional UI language support.
2090          English (US) is always included by default.
2091          Separate multiple languages with space.
2092          For all languages, use --with-lang=ALL.]),
2095 AC_ARG_WITH(locales,
2096     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2097         [Use this option to limit the locale information built in.
2098          Separate multiple locales with space.
2099          Very experimental and might well break stuff.
2100          Just a desperate measure to shrink code and data size.
2101          By default all the locales available is included.
2102          This option is completely unrelated to --with-lang.])
2103     [
2104                           Affects also our character encoding conversion
2105                           tables for encodings mainly targeted for a
2106                           particular locale, like EUC-CN and EUC-TW for
2107                           zh, ISO-2022-JP for ja.
2109                           Affects also our add-on break iterator data for
2110                           some languages.
2112                           For the default, all locales, don't use this switch at all.
2113                           Specifying just the language part of a locale means all matching
2114                           locales will be included.
2115     ],
2118 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2119 libo_FUZZ_ARG_WITH(krb5,
2120     AS_HELP_STRING([--with-krb5],
2121         [Enable MIT Kerberos 5 support in modules that support it.
2122          By default automatically enabled on platforms
2123          where a good system Kerberos 5 is available.]),
2126 libo_FUZZ_ARG_WITH(gssapi,
2127     AS_HELP_STRING([--with-gssapi],
2128         [Enable GSSAPI support in modules that support it.
2129          By default automatically enabled on platforms
2130          where a good system GSSAPI is available.]),
2133 AC_ARG_WITH(iwyu,
2134     AS_HELP_STRING([--with-iwyu],
2135         [Use given IWYU binary path to check unneeded includes instead of building.
2136          Use only if you are hacking on it.]),
2139 libo_FUZZ_ARG_WITH(lxml,
2140     AS_HELP_STRING([--without-lxml],
2141         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2142          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2143          report widget classes and ids.]),
2146 dnl ===================================================================
2147 dnl Branding
2148 dnl ===================================================================
2150 AC_ARG_WITH(branding,
2151     AS_HELP_STRING([--with-branding=/path/to/images],
2152         [Use given path to retrieve branding images set.])
2153     [
2154                           Search for intro.png about.svg and flat_logo.svg.
2155                           If any is missing, default ones will be used instead.
2157                           Search also progress.conf for progress
2158                           settings on intro screen :
2160                           PROGRESSBARCOLOR="255,255,255" Set color of
2161                           progress bar. Comma separated RGB decimal values.
2162                           PROGRESSSIZE="407,6" Set size of progress bar.
2163                           Comma separated decimal values (width, height).
2164                           PROGRESSPOSITION="61,317" Set position of progress
2165                           bar from left,top. Comma separated decimal values.
2166                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2167                           bar frame. Comma separated RGB decimal values.
2168                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2169                           bar text. Comma separated RGB decimal values.
2170                           PROGRESSTEXTBASELINE="287" Set vertical position of
2171                           progress bar text from top. Decimal value.
2173                           Default values will be used if not found.
2174     ],
2178 AC_ARG_WITH(extra-buildid,
2179     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2180         [Show addition build identification in about dialog.]),
2184 AC_ARG_WITH(vendor,
2185     AS_HELP_STRING([--with-vendor="John the Builder"],
2186         [Set vendor of the build.]),
2189 AC_ARG_WITH(android-package-name,
2190     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2191         [Set Android package name of the build.]),
2194 AC_ARG_WITH(compat-oowrappers,
2195     AS_HELP_STRING([--with-compat-oowrappers],
2196         [Install oo* wrappers in parallel with
2197          lo* ones to keep backward compatibility.
2198          Has effect only with make distro-pack-install]),
2201 AC_ARG_WITH(os-version,
2202     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2203         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2206 AC_ARG_WITH(mingw-cross-compiler,
2207     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2208         [Specify the MinGW cross-compiler to use.
2209          When building on the ODK on Unix and building unowinreg.dll,
2210          specify the MinGW C++ cross-compiler.]),
2213 AC_ARG_WITH(idlc-cpp,
2214     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2215         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2218 AC_ARG_WITH(build-version,
2219     AS_HELP_STRING([--with-build-version="Built by Jim"],
2220         [Allows the builder to add a custom version tag that will appear in the
2221          Help/About box for QA purposes.]),
2222 with_build_version=$withval,
2225 AC_ARG_WITH(parallelism,
2226     AS_HELP_STRING([--with-parallelism],
2227         [Number of jobs to run simultaneously during build. Parallel builds can
2228         save a lot of time on multi-cpu machines. Defaults to the number of
2229         CPUs on the machine, unless you configure --enable-icecream - then to
2230         40.]),
2233 AC_ARG_WITH(all-tarballs,
2234     AS_HELP_STRING([--with-all-tarballs],
2235         [Download all external tarballs unconditionally]))
2237 AC_ARG_WITH(gdrive-client-id,
2238     AS_HELP_STRING([--with-gdrive-client-id],
2239         [Provides the client id of the application for OAuth2 authentication
2240         on Google Drive. If either this or --with-gdrive-client-secret is
2241         empty, the feature will be disabled]),
2244 AC_ARG_WITH(gdrive-client-secret,
2245     AS_HELP_STRING([--with-gdrive-client-secret],
2246         [Provides the client secret of the application for OAuth2
2247         authentication on Google Drive. If either this or
2248         --with-gdrive-client-id is empty, the feature will be disabled]),
2251 AC_ARG_WITH(alfresco-cloud-client-id,
2252     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2253         [Provides the client id of the application for OAuth2 authentication
2254         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2255         empty, the feature will be disabled]),
2258 AC_ARG_WITH(alfresco-cloud-client-secret,
2259     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2260         [Provides the client secret of the application for OAuth2
2261         authentication on Alfresco Cloud. If either this or
2262         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2265 AC_ARG_WITH(onedrive-client-id,
2266     AS_HELP_STRING([--with-onedrive-client-id],
2267         [Provides the client id of the application for OAuth2 authentication
2268         on OneDrive. If either this or --with-onedrive-client-secret is
2269         empty, the feature will be disabled]),
2272 AC_ARG_WITH(onedrive-client-secret,
2273     AS_HELP_STRING([--with-onedrive-client-secret],
2274         [Provides the client secret of the application for OAuth2
2275         authentication on OneDrive. If either this or
2276         --with-onedrive-client-id is empty, the feature will be disabled]),
2278 dnl ===================================================================
2279 dnl Do we want to use pre-build binary tarball for recompile
2280 dnl ===================================================================
2282 if test "$enable_library_bin_tar" = "yes" ; then
2283     USE_LIBRARY_BIN_TAR=TRUE
2284 else
2285     USE_LIBRARY_BIN_TAR=
2287 AC_SUBST(USE_LIBRARY_BIN_TAR)
2289 dnl ===================================================================
2290 dnl Test whether build target is Release Build
2291 dnl ===================================================================
2292 AC_MSG_CHECKING([whether build target is Release Build])
2293 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2294     AC_MSG_RESULT([no])
2295     ENABLE_RELEASE_BUILD=
2296 else
2297     AC_MSG_RESULT([yes])
2298     ENABLE_RELEASE_BUILD=TRUE
2300 AC_SUBST(ENABLE_RELEASE_BUILD)
2302 dnl ===================================================================
2303 dnl Test whether to sign Windows Build
2304 dnl ===================================================================
2305 AC_MSG_CHECKING([whether to sign windows build])
2306 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2307     AC_MSG_RESULT([yes])
2308     WINDOWS_BUILD_SIGNING="TRUE"
2309 else
2310     AC_MSG_RESULT([no])
2311     WINDOWS_BUILD_SIGNING="FALSE"
2313 AC_SUBST(WINDOWS_BUILD_SIGNING)
2315 dnl ===================================================================
2316 dnl MacOSX build and runtime environment options
2317 dnl ===================================================================
2319 AC_ARG_WITH(macosx-sdk,
2320     AS_HELP_STRING([--with-macosx-sdk=<version>],
2321         [Prefer a specific SDK for building.])
2322     [
2323                           If the requested SDK is not available, a search for the oldest one will be done.
2324                           With current Xcode versions, only the latest SDK is included, so this option is
2325                           not terribly useful. It works fine to build with a new SDK and run the result
2326                           on an older OS.
2328                           e. g.: --with-macosx-sdk=10.10
2330                           there are 3 options to control the MacOSX build:
2331                           --with-macosx-sdk (referred as 'sdk' below)
2332                           --with-macosx-version-min-required (referred as 'min' below)
2333                           --with-macosx-version-max-allowed (referred as 'max' below)
2335                           the connection between these value and the default they take is as follow:
2336                           ( ? means not specified on the command line, s means the SDK version found,
2337                           constraint: 8 <= x <= y <= z)
2339                           ==========================================
2340                            command line      || config result
2341                           ==========================================
2342                           min  | max  | sdk  || min   | max  | sdk  |
2343                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2344                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2345                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2346                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2347                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2348                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2349                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2350                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2353                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2354                           for a detailed technical explanation of these variables
2356                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2357     ],
2360 AC_ARG_WITH(macosx-version-min-required,
2361     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2362         [set the minimum OS version needed to run the built LibreOffice])
2363     [
2364                           e. g.: --with-macos-version-min-required=10.10
2365                           see --with-macosx-sdk for more info
2366     ],
2369 AC_ARG_WITH(macosx-version-max-allowed,
2370     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2371         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2372     [
2373                           e. g.: --with-macos-version-max-allowed=10.10
2374                           see --with-macosx-sdk for more info
2375     ],
2379 dnl ===================================================================
2380 dnl options for stuff used during cross-compilation build
2381 dnl Not quite superseded by --with-build-platform-configure-options.
2382 dnl TODO: check, if the "force" option is still needed anywhere.
2383 dnl ===================================================================
2385 AC_ARG_WITH(system-icu-for-build,
2386     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2387         [Use icu already on system for build tools (cross-compilation only).]))
2390 dnl ===================================================================
2391 dnl Check for incompatible options set by fuzzing, and reset those
2392 dnl automatically to working combinations
2393 dnl ===================================================================
2395 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2396         "$enable_dbus" != "$enable_avahi"; then
2397     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2398     enable_avahi=$enable_dbus
2401 add_lopath_after ()
2403     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2404         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2405     fi
2408 add_lopath_before ()
2410     local IFS=${P_SEP}
2411     local path_cleanup
2412     local dir
2413     for dir in $LO_PATH ; do
2414         if test "$dir" != "$1" ; then
2415             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2416         fi
2417     done
2418     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2421 dnl ===================================================================
2422 dnl check for required programs (grep, awk, sed, bash)
2423 dnl ===================================================================
2425 pathmunge ()
2427     if test -n "$1"; then
2428         if test "$build_os" = "cygwin"; then
2429             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2430                 PathFormat "$1"
2431                 new_path=`cygpath -sm "$formatted_path"`
2432             else
2433                 PathFormat "$1"
2434                 new_path=`cygpath -u "$formatted_path"`
2435             fi
2436         else
2437             new_path="$1"
2438         fi
2439         if test "$2" = "after"; then
2440             add_lopath_after "$new_path"
2441         else
2442             add_lopath_before "$new_path"
2443         fi
2444         unset new_path
2445     fi
2448 AC_PROG_AWK
2449 AC_PATH_PROG( AWK, $AWK)
2450 if test -z "$AWK"; then
2451     AC_MSG_ERROR([install awk to run this script])
2454 AC_PATH_PROG(BASH, bash)
2455 if test -z "$BASH"; then
2456     AC_MSG_ERROR([bash not found in \$PATH])
2458 AC_SUBST(BASH)
2460 AC_MSG_CHECKING([for GNU or BSD tar])
2461 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2462     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2463     if test $? -eq 0;  then
2464         GNUTAR=$a
2465         break
2466     fi
2467 done
2468 AC_MSG_RESULT($GNUTAR)
2469 if test -z "$GNUTAR"; then
2470     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2472 AC_SUBST(GNUTAR)
2474 AC_MSG_CHECKING([for tar's option to strip components])
2475 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2476 if test $? -eq 0; then
2477     STRIP_COMPONENTS="--strip-components"
2478 else
2479     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2480     if test $? -eq 0; then
2481         STRIP_COMPONENTS="--strip-path"
2482     else
2483         STRIP_COMPONENTS="unsupported"
2484     fi
2486 AC_MSG_RESULT($STRIP_COMPONENTS)
2487 if test x$STRIP_COMPONENTS = xunsupported; then
2488     AC_MSG_ERROR([you need a tar that is able to strip components.])
2490 AC_SUBST(STRIP_COMPONENTS)
2492 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2493 dnl desktop OSes from "mobile" ones.
2495 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2496 dnl In other words, that when building for an OS that is not a
2497 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2499 dnl Note the direction of the implication; there is no assumption that
2500 dnl cross-compiling would imply a non-desktop OS.
2502 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2503     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2504     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2505     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2508 # Whether to build "avmedia" functionality or not.
2510 if test -z "$enable_avmedia"; then
2511     enable_avmedia=yes
2514 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2515 if test "$enable_avmedia" = yes; then
2516     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2517 else
2518     USE_AVMEDIA_DUMMY='TRUE'
2520 AC_SUBST(USE_AVMEDIA_DUMMY)
2522 # Decide whether to build database connectivity stuff (including
2523 # Base) or not. We probably don't want to on non-desktop OSes.
2524 if test -z "$enable_database_connectivity"; then
2525     # --disable-database-connectivity is unfinished work in progress
2526     # and the iOS test app doesn't link if we actually try to use it.
2527     # if test $_os != iOS -a $_os != Android; then
2528     if test $_os != iOS; then
2529         enable_database_connectivity=yes
2530     fi
2533 if test "$enable_database_connectivity" = yes; then
2534     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2535     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2538 if test -z "$enable_extensions"; then
2539     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2540     if test $_os != iOS -a $_os != Android; then
2541         enable_extensions=yes
2542     fi
2545 if test "$enable_extensions" = yes; then
2546     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2547     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2550 if test -z "$enable_scripting"; then
2551     # Disable scripting for iOS unless specifically overridden
2552     # with --enable-scripting.
2553     if test $_os != iOS; then
2554         enable_scripting=yes
2555     fi
2558 DISABLE_SCRIPTING=''
2559 if test "$enable_scripting" = yes; then
2560     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2561     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2562 else
2563     DISABLE_SCRIPTING='TRUE'
2564     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2567 if test $_os = iOS -o $_os = Android; then
2568     # Disable dynamic_loading always for iOS and Android
2569     enable_dynamic_loading=no
2570 elif test -z "$enable_dynamic_loading"; then
2571     # Otherwise enable it unless specifically disabled
2572     enable_dynamic_loading=yes
2575 DISABLE_DYNLOADING=''
2576 if test "$enable_dynamic_loading" = yes; then
2577     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2578 else
2579     DISABLE_DYNLOADING='TRUE'
2581 AC_SUBST(DISABLE_DYNLOADING)
2583 # remember SYSBASE value
2584 AC_SUBST(SYSBASE)
2586 dnl ===================================================================
2587 dnl  Sort out various gallery compilation options
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([how to build and package galleries])
2590 if test -n "${with_galleries}"; then
2591     if test "$with_galleries" = "build"; then
2592         WITH_GALLERY_BUILD=TRUE
2593         AC_MSG_RESULT([build from source images internally])
2594     elif test "$with_galleries" = "no"; then
2595         WITH_GALLERY_BUILD=
2596         AC_MSG_RESULT([disable non-internal gallery build])
2597     else
2598         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2599     fi
2600 else
2601     if test $_os != iOS -a $_os != Android; then
2602         WITH_GALLERY_BUILD=TRUE
2603         AC_MSG_RESULT([internal src images for desktop])
2604     else
2605         WITH_GALLERY_BUILD=
2606         AC_MSG_RESULT([disable src image build])
2607     fi
2609 AC_SUBST(WITH_GALLERY_BUILD)
2611 dnl ===================================================================
2612 dnl  Checks if ccache is available
2613 dnl ===================================================================
2614 CCACHE_DEPEND_MODE=
2615 if test "$_os" = "WINNT"; then
2616     # on windows/VC build do not use ccache
2617     CCACHE=""
2618 elif test "$enable_ccache" = "no"; then
2619     CCACHE=""
2620 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2621     case "%$CC%$CXX%" in
2622     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2623     # assume that's good then
2624     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2625         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2626         CCACHE_DEPEND_MODE=1
2627         ;;
2628     *)
2629         AC_PATH_PROG([CCACHE],[ccache],[not found])
2630         if test "$CCACHE" = "not found"; then
2631             CCACHE=""
2632         else
2633             CCACHE_DEPEND_MODE=1
2634             # Need to check for ccache version: otherwise prevents
2635             # caching of the results (like "-x objective-c++" for Mac)
2636             if test $_os = Darwin -o $_os = iOS; then
2637                 # Check ccache version
2638                 AC_MSG_CHECKING([whether version of ccache is suitable])
2639                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2640                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2641                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2642                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2643                 else
2644                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2645                     CCACHE=""
2646                     CCACHE_DEPEND_MODE=
2647                 fi
2648             fi
2649         fi
2650         ;;
2651     esac
2652 else
2653     CCACHE=""
2655 if test "$enable_ccache" = "nodepend"; then
2656     CCACHE_DEPEND_MODE=""
2658 AC_SUBST(CCACHE_DEPEND_MODE)
2660 if test "$CCACHE" != ""; then
2661     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2662     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2663     if test "$ccache_size" = ""; then
2664         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2665         if test "$ccache_size" = ""; then
2666             ccache_size=0
2667         fi
2668         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2669         if test $ccache_size -lt 1024; then
2670             CCACHE=""
2671             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2672             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2673         else
2674             # warn that ccache may be too small for debug build
2675             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2676             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2677         fi
2678     else
2679         if test $ccache_size -lt 5; then
2680             #warn that ccache may be too small for debug build
2681             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2682             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2683         fi
2684     fi
2687 dnl ===================================================================
2688 dnl  Checks for C compiler,
2689 dnl  The check for the C++ compiler is later on.
2690 dnl ===================================================================
2691 if test "$_os" != "WINNT"; then
2692     GCC_HOME_SET="true"
2693     AC_MSG_CHECKING([gcc home])
2694     if test -z "$with_gcc_home"; then
2695         if test "$enable_icecream" = "yes"; then
2696             if test -d "/usr/lib/icecc/bin"; then
2697                 GCC_HOME="/usr/lib/icecc/"
2698             elif test -d "/usr/libexec/icecc/bin"; then
2699                 GCC_HOME="/usr/libexec/icecc/"
2700             elif test -d "/opt/icecream/bin"; then
2701                 GCC_HOME="/opt/icecream/"
2702             else
2703                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2705             fi
2706         else
2707             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2708             GCC_HOME_SET="false"
2709         fi
2710     else
2711         GCC_HOME="$with_gcc_home"
2712     fi
2713     AC_MSG_RESULT($GCC_HOME)
2714     AC_SUBST(GCC_HOME)
2716     if test "$GCC_HOME_SET" = "true"; then
2717         if test -z "$CC"; then
2718             CC="$GCC_HOME/bin/gcc"
2719             CC_BASE="gcc"
2720         fi
2721         if test -z "$CXX"; then
2722             CXX="$GCC_HOME/bin/g++"
2723             CXX_BASE="g++"
2724         fi
2725     fi
2728 COMPATH=`dirname "$CC"`
2729 if test "$COMPATH" = "."; then
2730     AC_PATH_PROGS(COMPATH, $CC)
2731     dnl double square bracket to get single because of M4 quote...
2732     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2734 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2736 dnl ===================================================================
2737 dnl Java support
2738 dnl ===================================================================
2739 AC_MSG_CHECKING([whether to build with Java support])
2740 if test "$with_java" != "no"; then
2741     if test "$DISABLE_SCRIPTING" = TRUE; then
2742         AC_MSG_RESULT([no, overridden by --disable-scripting])
2743         ENABLE_JAVA=""
2744         with_java=no
2745     else
2746         AC_MSG_RESULT([yes])
2747         ENABLE_JAVA="TRUE"
2748         AC_DEFINE(HAVE_FEATURE_JAVA)
2749     fi
2750 else
2751     AC_MSG_RESULT([no])
2752     ENABLE_JAVA=""
2755 AC_SUBST(ENABLE_JAVA)
2757 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2759 dnl ENABLE_JAVA="" indicate no Java support at all
2761 dnl ===================================================================
2762 dnl Check macOS SDK and compiler
2763 dnl ===================================================================
2765 HAVE_MACOS_LD_PLATFORMVERSION=
2766 if test $_os = Darwin; then
2768     # If no --with-macosx-sdk option is given, look for one
2770     # The intent is that for "most" Mac-based developers, a suitable
2771     # SDK will be found automatically without any configure options.
2773     # For developers with a current Xcode, the lowest-numbered SDK
2774     # higher than or equal to the minimum required should be found.
2776     AC_MSG_CHECKING([what macOS SDK to use])
2777     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2778         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2779         if test -d "$MACOSX_SDK_PATH"; then
2780             with_macosx_sdk="${_macosx_sdk}"
2781             break
2782         else
2783             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2784             if test -d "$MACOSX_SDK_PATH"; then
2785                 with_macosx_sdk="${_macosx_sdk}"
2786                 break
2787             fi
2788         fi
2789     done
2790     if test ! -d "$MACOSX_SDK_PATH"; then
2791         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2792     fi
2794     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2796     case $with_macosx_sdk in
2797     10.12)
2798         MACOSX_SDK_VERSION=101200
2799         ;;
2800     10.13)
2801         MACOSX_SDK_VERSION=101300
2802         ;;
2803     10.14)
2804         MACOSX_SDK_VERSION=101400
2805         ;;
2806     10.15)
2807         MACOSX_SDK_VERSION=101500
2808         ;;
2809     *)
2810         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2811         ;;
2812     esac
2814     if test "$with_macosx_version_min_required" = "" ; then
2815         with_macosx_version_min_required="10.10";
2816     fi
2818     if test "$with_macosx_version_max_allowed" = "" ; then
2819         with_macosx_version_max_allowed="$with_macosx_sdk"
2820     fi
2822     # export this so that "xcrun" invocations later return matching values
2823     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2824     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2825     export DEVELOPER_DIR
2826     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2827     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2829     AC_MSG_CHECKING([whether Xcode is new enough])
2830     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2831     my_xcode_ver2=${my_xcode_ver1#Xcode }
2832     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2833     if test "$my_xcode_ver3" -ge 903; then
2834         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2835     else
2836         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2837     fi
2839     case "$with_macosx_version_min_required" in
2840     10.10)
2841         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2842         ;;
2843     10.11)
2844         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2845         ;;
2846     10.12)
2847         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2848         ;;
2849     10.13)
2850         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2851         ;;
2852     10.14)
2853         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2854         ;;
2855     10.15)
2856         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2857         ;;
2858     *)
2859         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2860         ;;
2861     esac
2862     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2864     LIBTOOL=/usr/bin/libtool
2865     INSTALL_NAME_TOOL=install_name_tool
2866     if test -z "$save_CC"; then
2867         stdlib=-stdlib=libc++
2868         if test "$ENABLE_LTO" = TRUE; then
2869             lto=-flto
2870         fi
2872         AC_MSG_CHECKING([what C compiler to use])
2873         CC="`xcrun -find clang`"
2874         CC_BASE=`first_arg_basename "$CC"`
2875         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2876         AC_MSG_RESULT([$CC])
2878         AC_MSG_CHECKING([what C++ compiler to use])
2879         CXX="`xcrun -find clang++`"
2880         CXX_BASE=`first_arg_basename "$CXX"`
2881         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2882         AC_MSG_RESULT([$CXX])
2884         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2885         AR=`xcrun -find ar`
2886         NM=`xcrun -find nm`
2887         STRIP=`xcrun -find strip`
2888         LIBTOOL=`xcrun -find libtool`
2889         RANLIB=`xcrun -find ranlib`
2890     fi
2892     case "$with_macosx_version_max_allowed" in
2893     10.10)
2894         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2895         ;;
2896     10.11)
2897         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2898         ;;
2899     10.12)
2900         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2901         ;;
2902     10.13)
2903         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2904         ;;
2905     10.14)
2906         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2907         ;;
2908     10.15)
2909         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2910         ;;
2911     *)
2912         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2913         ;;
2914     esac
2916     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2917     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2918         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])
2919     else
2920         AC_MSG_RESULT([ok])
2921     fi
2923     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2924     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2925         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2926     else
2927         AC_MSG_RESULT([ok])
2928     fi
2929     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2930     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2932     AC_MSG_CHECKING([whether to do code signing])
2934     if test "$enable_macosx_code_signing" = yes; then
2935         # By default use the first suitable certificate (?).
2937         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2938         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2939         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2940         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2941         # "Developer ID Application" one.
2943         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2944         if test -n "$identity"; then
2945             MACOSX_CODESIGNING_IDENTITY=$identity
2946             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2947             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2948         else
2949             AC_MSG_ERROR([cannot determine identity to use])
2950         fi
2951     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2952         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2953         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2954         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2955     else
2956         AC_MSG_RESULT([no])
2957     fi
2959     AC_MSG_CHECKING([whether to create a Mac App Store package])
2961     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2962         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2963     elif test "$enable_macosx_package_signing" = yes; then
2964         # By default use the first suitable certificate.
2965         # It should be a "3rd Party Mac Developer Installer" one
2967         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2968         if test -n "$identity"; then
2969             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2970             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2971             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2972         else
2973             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2974         fi
2975     elif test -n "$enable_macosx_package_signing"; then
2976         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2977         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2978         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2979     else
2980         AC_MSG_RESULT([no])
2981     fi
2983     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2984         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2985     fi
2987     AC_MSG_CHECKING([whether to sandbox the application])
2989     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2990         AC_MSG_ERROR([macOS sandboxing requires code signing])
2991     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2992         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2993     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2994         ENABLE_MACOSX_SANDBOX=TRUE
2995         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2996         AC_MSG_RESULT([yes])
2997     else
2998         AC_MSG_RESULT([no])
2999     fi
3001     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3002     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3003     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3005     AC_MSG_CHECKING([whether the linker supports -platform_version])
3006     save_LDFLAGS=$LDFLAGS
3007     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3008         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3009     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3010         [AC_MSG_RESULT([yes])
3011          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3012         [AC_MSG_RESULT([no])])
3013     LDFLAGS=$save_LDFLAGS
3015 AC_SUBST(MACOSX_SDK_PATH)
3016 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3017 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3018 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3019 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3020 AC_SUBST(INSTALL_NAME_TOOL)
3021 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3022 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3023 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3024 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3025 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3026 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3028 dnl ===================================================================
3029 dnl Check iOS SDK and compiler
3030 dnl ===================================================================
3032 if test $_os = iOS; then
3033     AC_MSG_CHECKING([what iOS SDK to use])
3034     current_sdk_ver=13.2
3035     older_sdk_vers="13.1 13.0 12.4 12.2"
3036     if test "$enable_ios_simulator" = "yes"; then
3037         platform=iPhoneSimulator
3038         versionmin=-mios-simulator-version-min=12.2
3039     else
3040         platform=iPhoneOS
3041         versionmin=-miphoneos-version-min=12.2
3042     fi
3043     xcode_developer=`xcode-select -print-path`
3045     for sdkver in $current_sdk_ver $older_sdk_vers; do
3046         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3047         if test -d $t; then
3048             sysroot=$t
3049             break
3050         fi
3051     done
3053     if test -z "$sysroot"; then
3054         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3055     fi
3057     AC_MSG_RESULT($sysroot)
3059     # LTO is not really recommended for iOS builds,
3060     # the link time will be astronomical
3061     if test "$ENABLE_LTO" = TRUE; then
3062         lto=-flto
3063     fi
3065     stdlib="-stdlib=libc++"
3067     AC_MSG_CHECKING([what C compiler to use])
3068     CC="`xcrun -find clang`"
3069     CC_BASE=`first_arg_basename "$CC"`
3070     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3071     AC_MSG_RESULT([$CC])
3073     AC_MSG_CHECKING([what C++ compiler to use])
3074     CXX="`xcrun -find clang++`"
3075     CXX_BASE=`first_arg_basename "$CXX"`
3076     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3077     AC_MSG_RESULT([$CXX])
3079     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3080     AR=`xcrun -find ar`
3081     NM=`xcrun -find nm`
3082     STRIP=`xcrun -find strip`
3083     LIBTOOL=`xcrun -find libtool`
3084     RANLIB=`xcrun -find ranlib`
3087 AC_MSG_CHECKING([whether to treat the installation as read-only])
3089 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3090         "$enable_extensions" != yes; then
3091     enable_readonly_installset=yes
3093 if test "$enable_readonly_installset" = yes; then
3094     AC_MSG_RESULT([yes])
3095     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3096 else
3097     AC_MSG_RESULT([no])
3100 dnl ===================================================================
3101 dnl Structure of install set
3102 dnl ===================================================================
3104 if test $_os = Darwin; then
3105     LIBO_BIN_FOLDER=MacOS
3106     LIBO_ETC_FOLDER=Resources
3107     LIBO_LIBEXEC_FOLDER=MacOS
3108     LIBO_LIB_FOLDER=Frameworks
3109     LIBO_LIB_PYUNO_FOLDER=Resources
3110     LIBO_SHARE_FOLDER=Resources
3111     LIBO_SHARE_HELP_FOLDER=Resources/help
3112     LIBO_SHARE_JAVA_FOLDER=Resources/java
3113     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3114     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3115     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3116     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3117     LIBO_URE_BIN_FOLDER=MacOS
3118     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3119     LIBO_URE_LIB_FOLDER=Frameworks
3120     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3121     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3122 elif test $_os = WINNT; then
3123     LIBO_BIN_FOLDER=program
3124     LIBO_ETC_FOLDER=program
3125     LIBO_LIBEXEC_FOLDER=program
3126     LIBO_LIB_FOLDER=program
3127     LIBO_LIB_PYUNO_FOLDER=program
3128     LIBO_SHARE_FOLDER=share
3129     LIBO_SHARE_HELP_FOLDER=help
3130     LIBO_SHARE_JAVA_FOLDER=program/classes
3131     LIBO_SHARE_PRESETS_FOLDER=presets
3132     LIBO_SHARE_READMES_FOLDER=readmes
3133     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3134     LIBO_SHARE_SHELL_FOLDER=program/shell
3135     LIBO_URE_BIN_FOLDER=program
3136     LIBO_URE_ETC_FOLDER=program
3137     LIBO_URE_LIB_FOLDER=program
3138     LIBO_URE_MISC_FOLDER=program
3139     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3140 else
3141     LIBO_BIN_FOLDER=program
3142     LIBO_ETC_FOLDER=program
3143     LIBO_LIBEXEC_FOLDER=program
3144     LIBO_LIB_FOLDER=program
3145     LIBO_LIB_PYUNO_FOLDER=program
3146     LIBO_SHARE_FOLDER=share
3147     LIBO_SHARE_HELP_FOLDER=help
3148     LIBO_SHARE_JAVA_FOLDER=program/classes
3149     LIBO_SHARE_PRESETS_FOLDER=presets
3150     LIBO_SHARE_READMES_FOLDER=readmes
3151     if test "$enable_fuzzers" != yes; then
3152         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3153     else
3154         LIBO_SHARE_RESOURCE_FOLDER=resource
3155     fi
3156     LIBO_SHARE_SHELL_FOLDER=program/shell
3157     LIBO_URE_BIN_FOLDER=program
3158     LIBO_URE_ETC_FOLDER=program
3159     LIBO_URE_LIB_FOLDER=program
3160     LIBO_URE_MISC_FOLDER=program
3161     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3163 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3172 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3173 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3177 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3178 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3180 # Not all of them needed in config_host.mk, add more if need arises
3181 AC_SUBST(LIBO_BIN_FOLDER)
3182 AC_SUBST(LIBO_ETC_FOLDER)
3183 AC_SUBST(LIBO_LIB_FOLDER)
3184 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3185 AC_SUBST(LIBO_SHARE_FOLDER)
3186 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3187 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3188 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3189 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3190 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3191 AC_SUBST(LIBO_URE_BIN_FOLDER)
3192 AC_SUBST(LIBO_URE_ETC_FOLDER)
3193 AC_SUBST(LIBO_URE_LIB_FOLDER)
3194 AC_SUBST(LIBO_URE_MISC_FOLDER)
3195 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3197 dnl ===================================================================
3198 dnl Windows specific tests and stuff
3199 dnl ===================================================================
3201 reg_get_value()
3203     # Return value: $regvalue
3204     unset regvalue
3206     local _regentry="/proc/registry${1}/${2}"
3207     if test -f "$_regentry"; then
3208         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3209         # Registry keys read via /proc/registry* are always \0 terminated!
3210         local _regvalue=$(tr -d '\0' < "$_regentry")
3211         if test $? -eq 0; then
3212             regvalue=$_regvalue
3213         fi
3214     fi
3217 # Get a value from the 32-bit side of the Registry
3218 reg_get_value_32()
3220     reg_get_value "32" "$1"
3223 # Get a value from the 64-bit side of the Registry
3224 reg_get_value_64()
3226     reg_get_value "64" "$1"
3229 if test "$_os" = "WINNT"; then
3230     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3231     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3232         AC_MSG_RESULT([no])
3233         WINDOWS_SDK_ARCH="x86"
3234     else
3235         AC_MSG_RESULT([yes])
3236         WINDOWS_SDK_ARCH="x64"
3237         BITNESS_OVERRIDE=64
3238     fi
3240 if test "$_os" = "iOS"; then
3241     cross_compiling="yes"
3244 if test "$cross_compiling" = "yes"; then
3245     export CROSS_COMPILING=TRUE
3246 else
3247     CROSS_COMPILING=
3248     BUILD_TYPE="$BUILD_TYPE NATIVE"
3250 AC_SUBST(CROSS_COMPILING)
3252 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3253 # NOTE: must _not_ be used for bundled external libraries!
3254 ISYSTEM=
3255 if test "$GCC" = "yes"; then
3256     AC_MSG_CHECKING( for -isystem )
3257     save_CFLAGS=$CFLAGS
3258     CFLAGS="$CFLAGS -Werror"
3259     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3260     CFLAGS=$save_CFLAGS
3261     if test -n "$ISYSTEM"; then
3262         AC_MSG_RESULT(yes)
3263     else
3264         AC_MSG_RESULT(no)
3265     fi
3267 if test -z "$ISYSTEM"; then
3268     # fall back to using -I
3269     ISYSTEM=-I
3271 AC_SUBST(ISYSTEM)
3273 dnl ===================================================================
3274 dnl  Check which Visual Studio compiler is used
3275 dnl ===================================================================
3277 map_vs_year_to_version()
3279     # Return value: $vsversion
3281     unset vsversion
3283     case $1 in
3284     2017)
3285         vsversion=15;;
3286     2019)
3287         vsversion=16;;
3288     *)
3289         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3290     esac
3293 vs_versions_to_check()
3295     # Args: $1 (optional) : versions to check, in the order of preference
3296     # Return value: $vsversions
3298     unset vsversions
3300     if test -n "$1"; then
3301         map_vs_year_to_version "$1"
3302         vsversions=$vsversion
3303     else
3304         # We accept only 2017
3305         vsversions="15"
3306     fi
3309 win_get_env_from_vsvars32bat()
3311     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3312     # Also seems to be located in another directory under the same name: vsvars32.bat
3313     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3314     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3315     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3316     chmod +x $WRAPPERBATCHFILEPATH
3317     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3318     rm -f $WRAPPERBATCHFILEPATH
3319     printf '%s' "$_win_get_env_from_vsvars32bat"
3322 find_ucrt()
3324     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3325     if test -n "$regvalue"; then
3326         PathFormat "$regvalue"
3327         UCRTSDKDIR=$formatted_path
3328         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3329         UCRTVERSION=$regvalue
3330         # Rest if not exist
3331         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3332           UCRTSDKDIR=
3333         fi
3334     fi
3335     if test -z "$UCRTSDKDIR"; then
3336         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3337         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3338         if test -f "$ide_env_file"; then
3339             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3340             UCRTSDKDIR=$formatted_path
3341             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3342             dnl Hack needed at least by tml:
3343             if test "$UCRTVERSION" = 10.0.15063.0 \
3344                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3345                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3346             then
3347                 UCRTVERSION=10.0.14393.0
3348             fi
3349         else
3350           AC_MSG_ERROR([No UCRT found])
3351         fi
3352     fi
3355 find_msvc()
3357     # Find Visual C++ 2017/2019
3358     # Args: $1 (optional) : The VS version year
3359     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3361     unset vctest vcnum vcnumwithdot vcbuildnumber
3363     vs_versions_to_check "$1"
3364     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3365     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3366     PathFormat "$vswhere"
3367     vswhere=$formatted_path
3368     for ver in $vsversions; do
3369         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3370         if test -n "$vswhereoutput"; then
3371             PathFormat "$vswhereoutput"
3372             vctest=$formatted_path
3373             break
3374         fi
3375     done
3377     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3378     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3379     # should be removed when upgrading baseline.
3380     if ! test -n "$vctest"; then
3381         for ver in $vsversions; do
3382             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3383             if test -n "$regvalue"; then
3384                 vctest=$regvalue
3385                 break
3386             fi
3387             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3388             if test -n "$regvalue"; then
3389                 AC_MSG_RESULT([found: $regvalue])
3390                 PathFormat "$regvalue"
3391                 vctest=$formatted_path
3392                 break
3393             fi
3394         done
3395     fi
3397     if test -n "$vctest"; then
3398         vcnumwithdot="$ver.0"
3399         case "$vcnumwithdot" in
3400         15.0)
3401             vcyear=2017
3402             vcnum=150
3403             ;;
3404         16.0)
3405             vcyear=2019
3406             vcnum=160
3407             ;;
3408         esac
3409         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3411     fi
3414 SOLARINC=
3415 MSBUILD_PATH=
3416 DEVENV=
3417 if test "$_os" = "WINNT"; then
3418     AC_MSG_CHECKING([Visual C++])
3419     find_msvc "$with_visual_studio"
3420     if test -z "$vctest"; then
3421         if test -n "$with_visual_studio"; then
3422             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3423         else
3424             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3425         fi
3426     fi
3428     if test "$BITNESS_OVERRIDE" = ""; then
3429         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3430             VC_PRODUCT_DIR=$vctest/VC
3431         else
3432             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3433         fi
3434     else
3435         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3436             VC_PRODUCT_DIR=$vctest/VC
3437         else
3438             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3439         fi
3440     fi
3441     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3443     AC_MSG_CHECKING([for short pathname of VC product directory])
3444     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3445     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3447     UCRTSDKDIR=
3448     UCRTVERSION=
3450     AC_MSG_CHECKING([for UCRT location])
3451     find_ucrt
3452     # find_ucrt errors out if it doesn't find it
3453     AC_MSG_RESULT([found])
3454     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3455     ucrtincpath_formatted=$formatted_path
3456     # SOLARINC is used for external modules and must be set too.
3457     # And no, it's not sufficient to set SOLARINC only, as configure
3458     # itself doesn't honour it.
3459     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3460     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3461     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3462     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3464     AC_SUBST(UCRTSDKDIR)
3465     AC_SUBST(UCRTVERSION)
3467     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3468     # Find the proper version of MSBuild.exe to use based on the VS version
3469     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3470     if test -n "$regvalue" ; then
3471         AC_MSG_RESULT([found: $regvalue])
3472         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3473     else
3474         if test "$vcnumwithdot" = "16.0"; then
3475             if test "$BITNESS_OVERRIDE" = ""; then
3476                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3477             else
3478                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3479             fi
3480         else
3481             if test "$BITNESS_OVERRIDE" = ""; then
3482                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3483             else
3484                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3485             fi
3486         fi
3487         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3488         AC_MSG_RESULT([$regvalue])
3489     fi
3491     # Find the version of devenv.exe
3492     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3493     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3494     if test ! -e "$DEVENV"; then
3495         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3496     fi
3498     dnl ===========================================================
3499     dnl  Check for the corresponding mspdb*.dll
3500     dnl ===========================================================
3502     VC_HOST_DIR=
3503     MSPDB_PATH=
3504     CL_PATH=
3506     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3507         VC_HOST_DIR="HostX64"
3508         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3509     else
3510         VC_HOST_DIR="HostX86"
3511         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3512     fi
3514     if test "$BITNESS_OVERRIDE" = ""; then
3515         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3516     else
3517         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3518     fi
3520     # MSVC 15.0 has libraries from 14.0?
3521     mspdbnum="140"
3523     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3524         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3525     fi
3527     dnl The path needs to be added before cl is called
3528     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3529     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3531     AC_MSG_CHECKING([cl.exe])
3533     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3534     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3535     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3536     # is not enough?
3538     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3539     dnl needed when building CLR code:
3540     if test -z "$MSVC_CXX"; then
3541         if test -f "$CL_PATH/cl.exe"; then
3542             MSVC_CXX="$CL_PATH/cl.exe"
3543         fi
3545         # This gives us a posix path with 8.3 filename restrictions
3546         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3547     fi
3549     if test -z "$CC"; then
3550         CC=$MSVC_CXX
3551         CC_BASE=`first_arg_basename "$CC"`
3552     fi
3553     if test "$BITNESS_OVERRIDE" = ""; then
3554         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3555         MSVC_CXX="$MSVC_CXX -arch:SSE"
3556     fi
3557     if test -z "$CXX"; then
3558         CXX=$MSVC_CXX
3559         CXX_BASE=`first_arg_basename "$CXX"`
3560     fi
3562     if test -n "$CC"; then
3563         # Remove /cl.exe from CC case insensitive
3564         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3565         if test "$BITNESS_OVERRIDE" = ""; then
3566            COMPATH="$VC_PRODUCT_DIR"
3567         else
3568             if test -n "$VC_PRODUCT_DIR"; then
3569                 COMPATH=$VC_PRODUCT_DIR
3570             fi
3571         fi
3572         if test "$BITNESS_OVERRIDE" = ""; then
3573             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3574             CC="$CC -arch:SSE"
3575         fi
3577         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3579         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3581         PathFormat "$COMPATH"
3582         COMPATH=`win_short_path_for_make "$formatted_path"`
3584         VCVER=$vcnum
3585         MSVSVER=$vcyear
3587         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3588         # are always "better", we list them in reverse chronological order.
3590         case "$vcnum" in
3591         150|160)
3592             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3593             ;;
3594         esac
3596         # The expectation is that --with-windows-sdk should not need to be used
3597         if test -n "$with_windows_sdk"; then
3598             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3599             *" "$with_windows_sdk" "*)
3600                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3601                 ;;
3602             *)
3603                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3604                 ;;
3605             esac
3606         fi
3608         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3609         ac_objext=obj
3610         ac_exeext=exe
3612     else
3613         AC_MSG_ERROR([Visual C++ not found after all, huh])
3614     fi
3616     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3617     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3618         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3619         // between Visual Studio versions and _MSC_VER:
3620         #if _MSC_VER < 1914
3621         #error
3622         #endif
3623     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3625     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3626     # version of the Explorer extension (and maybe other small
3627     # bits, too) needed when installing a 32-bit LibreOffice on a
3628     # 64-bit OS. The 64-bit Explorer extension is a feature that
3629     # has been present since long in OOo. Don't confuse it with
3630     # building LibreOffice itself as 64-bit code.
3632     BUILD_X64=
3633     CXX_X64_BINARY=
3635     if test "$BITNESS_OVERRIDE" = ""; then
3636         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3637         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3638              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3639             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3640                 BUILD_X64=TRUE
3641                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3642             fi
3643         fi
3644         if test "$BUILD_X64" = TRUE; then
3645             AC_MSG_RESULT([found])
3646         else
3647             AC_MSG_RESULT([not found])
3648             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3649         fi
3650     else
3651         CXX_X64_BINARY=$CXX
3652     fi
3653     AC_SUBST(BUILD_X64)
3655     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3656     AC_SUBST(CXX_X64_BINARY)
3658     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3659     # needed to support TWAIN scan on both 32- and 64-bit systems
3661     BUILD_X86=
3663     if test "$BITNESS_OVERRIDE" = "64"; then
3664         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3665         if test -n "$CXX_X86_BINARY"; then
3666             BUILD_X86=TRUE
3667             AC_MSG_RESULT([preset])
3668         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3669             BUILD_X86=TRUE
3670             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3671             CXX_X86_BINARY+=" /arch:SSE"
3672             AC_MSG_RESULT([found])
3673         else
3674             CXX_X86_BINARY=
3675             AC_MSG_RESULT([not found])
3676             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3677         fi
3678     else
3679         BUILD_X86=TRUE
3680         CXX_X86_BINARY=$MSVC_CXX
3681     fi
3682     AC_SUBST(BUILD_X86)
3683     AC_SUBST(CXX_X86_BINARY)
3685 AC_SUBST(VCVER)
3686 AC_SUBST(DEVENV)
3687 AC_SUBST(MSVC_CXX)
3690 # unowinreg.dll
3692 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3693 AC_SUBST(UNOWINREG_DLL)
3695 COM_IS_CLANG=
3696 AC_MSG_CHECKING([whether the compiler is actually Clang])
3697 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3698     #ifndef __clang__
3699     you lose
3700     #endif
3701     int foo=42;
3702     ]])],
3703     [AC_MSG_RESULT([yes])
3704      COM_IS_CLANG=TRUE],
3705     [AC_MSG_RESULT([no])])
3706 AC_SUBST(COM_IS_CLANG)
3708 CC_PLAIN=$CC
3709 CLANGVER=
3710 if test "$COM_IS_CLANG" = TRUE; then
3711     AC_MSG_CHECKING([whether Clang is new enough])
3712     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3713         #if !defined __apple_build_version__
3714         #error
3715         #endif
3716         ]])],
3717         [my_apple_clang=yes],[my_apple_clang=])
3718     if test "$my_apple_clang" = yes; then
3719         AC_MSG_RESULT([assumed yes (Apple Clang)])
3720     else
3721         if test "$_os" = WINNT; then
3722             dnl In which case, assume clang-cl:
3723             my_args="/EP /TC"
3724             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3725             dnl clang-cl:
3726             CC_PLAIN=
3727             for i in $CC; do
3728                 case $i in
3729                 -FIIntrin.h)
3730                     ;;
3731                 *)
3732                     CC_PLAIN="$CC_PLAIN $i"
3733                     ;;
3734                 esac
3735             done
3736         else
3737             my_args="-E -P"
3738         fi
3739         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3740         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3741         CLANGVER=`echo $clang_version \
3742             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3743         if test "$CLANGVER" -ge 50002; then
3744             AC_MSG_RESULT([yes ($clang_version)])
3745         else
3746             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3747         fi
3748         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3749         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3750     fi
3753 SHOWINCLUDES_PREFIX=
3754 if test "$_os" = WINNT; then
3755     dnl We need to guess the prefix of the -showIncludes output, it can be
3756     dnl localized
3757     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3758     echo "#include <stdlib.h>" > conftest.c
3759     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3760         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3761     rm -f conftest.c conftest.obj
3762     if test -z "$SHOWINCLUDES_PREFIX"; then
3763         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3764     else
3765         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3766     fi
3768 AC_SUBST(SHOWINCLUDES_PREFIX)
3771 # prefix C with ccache if needed
3773 if test "$CCACHE" != ""; then
3774     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3776     AC_LANG_PUSH([C])
3777     save_CFLAGS=$CFLAGS
3778     CFLAGS="$CFLAGS --ccache-skip -O2"
3779     dnl an empty program will do, we're checking the compiler flags
3780     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3781                       [use_ccache=yes], [use_ccache=no])
3782     if test $use_ccache = yes; then
3783         AC_MSG_RESULT([yes])
3784     else
3785         CC="$CCACHE $CC"
3786         CC_BASE="ccache $CC_BASE"
3787         AC_MSG_RESULT([no])
3788     fi
3789     CFLAGS=$save_CFLAGS
3790     AC_LANG_POP([C])
3793 # ===================================================================
3794 # check various GCC options that Clang does not support now but maybe
3795 # will somewhen in the future, check them even for GCC, so that the
3796 # flags are set
3797 # ===================================================================
3799 HAVE_GCC_GGDB2=
3800 if test "$GCC" = "yes"; then
3801     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3802     save_CFLAGS=$CFLAGS
3803     CFLAGS="$CFLAGS -Werror -ggdb2"
3804     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3805     CFLAGS=$save_CFLAGS
3806     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3807         AC_MSG_RESULT([yes])
3808     else
3809         AC_MSG_RESULT([no])
3810     fi
3812     if test "$host_cpu" = "m68k"; then
3813         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3814         save_CFLAGS=$CFLAGS
3815         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3816         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3817         CFLAGS=$save_CFLAGS
3818         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3819             AC_MSG_RESULT([yes])
3820         else
3821             AC_MSG_ERROR([no])
3822         fi
3823     fi
3825 AC_SUBST(HAVE_GCC_GGDB2)
3827 dnl ===================================================================
3828 dnl  Test the gcc version
3829 dnl ===================================================================
3830 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3831     AC_MSG_CHECKING([the GCC version])
3832     _gcc_version=`$CC -dumpversion`
3833     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3834         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3835     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3837     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3839     if test "$gcc_full_version" -lt 70000; then
3840         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3841     fi
3842 else
3843     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3844     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3845     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3846     # (which reports itself as GCC 4.2.1).
3847     GCC_VERSION=
3849 AC_SUBST(GCC_VERSION)
3851 dnl Set the ENABLE_DBGUTIL variable
3852 dnl ===================================================================
3853 AC_MSG_CHECKING([whether to build with additional debug utilities])
3854 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3855     ENABLE_DBGUTIL="TRUE"
3856     # this is an extra var so it can have different default on different MSVC
3857     # versions (in case there are version specific problems with it)
3858     MSVC_USE_DEBUG_RUNTIME="TRUE"
3860     AC_MSG_RESULT([yes])
3861     # cppunit and graphite expose STL in public headers
3862     if test "$with_system_cppunit" = "yes"; then
3863         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3864     else
3865         with_system_cppunit=no
3866     fi
3867     if test "$with_system_graphite" = "yes"; then
3868         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3869     else
3870         with_system_graphite=no
3871     fi
3872     if test "$with_system_orcus" = "yes"; then
3873         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3874     else
3875         with_system_orcus=no
3876     fi
3877     if test "$with_system_libcmis" = "yes"; then
3878         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3879     else
3880         with_system_libcmis=no
3881     fi
3882     if test "$with_system_hunspell" = "yes"; then
3883         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3884     else
3885         with_system_hunspell=no
3886     fi
3887     if test "$with_system_gpgmepp" = "yes"; then
3888         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3889     else
3890         with_system_gpgmepp=no
3891     fi
3892     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3893     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3894     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3895     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3896     # of those two is using the system variant:
3897     if test "$with_system_libnumbertext" = "yes"; then
3898         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3899     else
3900         with_system_libnumbertext=no
3901     fi
3902     if test "$with_system_libwps" = "yes"; then
3903         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3904     else
3905         with_system_libwps=no
3906     fi
3907 else
3908     ENABLE_DBGUTIL=""
3909     MSVC_USE_DEBUG_RUNTIME=""
3910     AC_MSG_RESULT([no])
3912 AC_SUBST(ENABLE_DBGUTIL)
3913 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3915 dnl Set the ENABLE_DEBUG variable.
3916 dnl ===================================================================
3917 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3918     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3920 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3921     if test -z "$libo_fuzzed_enable_debug"; then
3922         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3923     else
3924         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3925         enable_debug=yes
3926     fi
3929 AC_MSG_CHECKING([whether to do a debug build])
3930 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3931     ENABLE_DEBUG="TRUE"
3932     if test -n "$ENABLE_DBGUTIL" ; then
3933         AC_MSG_RESULT([yes (dbgutil)])
3934     else
3935         AC_MSG_RESULT([yes])
3936     fi
3937 else
3938     ENABLE_DEBUG=""
3939     AC_MSG_RESULT([no])
3941 AC_SUBST(ENABLE_DEBUG)
3943 dnl ===================================================================
3944 dnl Select the linker to use (gold/lld/ld.bfd).
3945 dnl This is done only after compiler checks (need to know if Clang is
3946 dnl used, for different defaults) and after checking if a debug build
3947 dnl is wanted (non-debug builds get the default linker if not explicitly
3948 dnl specified otherwise).
3949 dnl All checks for linker features/options should come after this.
3950 dnl ===================================================================
3951 check_use_ld()
3953     use_ld=$1
3954     use_ld_fail_if_error=$2
3955     use_ld_ok=
3956     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3957     use_ld_ldflags_save="$LDFLAGS"
3958     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3959     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3960 #include <stdio.h>
3961         ],[
3962 printf ("hello world\n");
3963         ])], USE_LD=$use_ld, [])
3964     if test -n "$USE_LD"; then
3965         AC_MSG_RESULT( yes )
3966         use_ld_ok=yes
3967     else
3968         if test -n "$use_ld_fail_if_error"; then
3969             AC_MSG_ERROR( no )
3970         else
3971             AC_MSG_RESULT( no )
3972         fi
3973     fi
3974     if test -n "$use_ld_ok"; then
3975         dnl keep the value of LDFLAGS
3976         return 0
3977     fi
3978     LDFLAGS="$use_ld_ldflags_save"
3979     return 1
3981 USE_LD=
3982 if test "$enable_ld" != "no"; then
3983     if test "$GCC" = "yes"; then
3984         if test -n "$enable_ld"; then
3985             check_use_ld "$enable_ld" fail_if_error
3986         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3987             dnl non-debug builds default to the default linker
3988             true
3989         elif test -n "$COM_IS_CLANG"; then
3990             check_use_ld lld
3991             if test $? -ne 0; then
3992                 check_use_ld gold
3993             fi
3994         else
3995             # For gcc first try gold, new versions also support lld.
3996             check_use_ld gold
3997             if test $? -ne 0; then
3998                 check_use_ld lld
3999             fi
4000         fi
4001         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4002         rm conftest.out
4003         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4004         if test -z "$ld_used"; then
4005             ld_used="unknown"
4006         fi
4007         AC_MSG_CHECKING([for linker that is used])
4008         AC_MSG_RESULT([$ld_used])
4009         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4010             if echo "$ld_used" | grep -q "^GNU ld"; then
4011                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4012                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4013             fi
4014         fi
4015     else
4016         if test "$enable_ld" = "yes"; then
4017             AC_MSG_ERROR([--enable-ld not supported])
4018         fi
4019     fi
4021 AC_SUBST(USE_LD)
4023 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4024 if test "$GCC" = "yes"; then
4025     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4026     bsymbolic_functions_ldflags_save=$LDFLAGS
4027     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4028     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4029 #include <stdio.h>
4030         ],[
4031 printf ("hello world\n");
4032         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4033     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4034         AC_MSG_RESULT( found )
4035     else
4036         AC_MSG_RESULT( not found )
4037     fi
4038     LDFLAGS=$bsymbolic_functions_ldflags_save
4040 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4043 HAVE_GSPLIT_DWARF=
4044 if test "$enable_split_debug" != no; then
4045     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4046     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4047         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4048         save_CFLAGS=$CFLAGS
4049         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4050         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4051         CFLAGS=$save_CFLAGS
4052         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4053             AC_MSG_RESULT([yes])
4054         else
4055             if test "$enable_split_debug" = yes; then
4056                 AC_MSG_ERROR([no])
4057             else
4058                 AC_MSG_RESULT([no])
4059             fi
4060         fi
4061     fi
4062     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4063         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4064         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4065     fi
4067 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4069 ENABLE_GDB_INDEX=
4070 if test "$enable_gdb_index" != "no"; then
4071     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4072     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4073         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4074         save_CFLAGS=$CFLAGS
4075         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4076         have_ggnu_pubnames=
4077         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4078         if test "$have_ggnu_pubnames" != "TRUE"; then
4079             if test "$enable_gdb_index" = "yes"; then
4080                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4081             else
4082                 AC_MSG_RESULT( no )
4083             fi
4084         else
4085             AC_MSG_RESULT( yes )
4086             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4087             ldflags_save=$LDFLAGS
4088             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4089             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4090 #include <stdio.h>
4091                 ],[
4092 printf ("hello world\n");
4093                 ])], ENABLE_GDB_INDEX=TRUE, [])
4094             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4095                 AC_MSG_RESULT( yes )
4096             else
4097                 if test "$enable_gdb_index" = "yes"; then
4098                     AC_MSG_ERROR( no )
4099                 else
4100                     AC_MSG_RESULT( no )
4101                 fi
4102             fi
4103             LDFLAGS=$ldflags_save
4104         fi
4105         CFLAGS=$save_CFLAGS
4106         fi
4107     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4108         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4109         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4110     fi
4112 AC_SUBST(ENABLE_GDB_INDEX)
4114 if test "$enable_sal_log" = yes; then
4115     ENABLE_SAL_LOG=TRUE
4117 AC_SUBST(ENABLE_SAL_LOG)
4119 dnl Check for enable symbols option
4120 dnl ===================================================================
4121 AC_MSG_CHECKING([whether to generate debug information])
4122 if test -z "$enable_symbols"; then
4123     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4124         enable_symbols=yes
4125     else
4126         enable_symbols=no
4127     fi
4129 if test "$enable_symbols" = yes; then
4130     ENABLE_SYMBOLS_FOR=all
4131     AC_MSG_RESULT([yes])
4132 elif test "$enable_symbols" = no; then
4133     ENABLE_SYMBOLS_FOR=
4134     AC_MSG_RESULT([no])
4135 else
4136     # Selective debuginfo.
4137     ENABLE_SYMBOLS_FOR="$enable_symbols"
4138     AC_MSG_RESULT([for "$enable_symbols"])
4140 AC_SUBST(ENABLE_SYMBOLS_FOR)
4142 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4143     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4144     AC_MSG_CHECKING([whether enough memory is available for linking])
4145     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4146     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4147     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4148         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4149     else
4150         AC_MSG_RESULT([yes])
4151     fi
4154 AC_MSG_CHECKING([whether to compile with optimization flags])
4155 if test -z "$enable_optimized"; then
4156     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4157         enable_optimized=no
4158     else
4159         enable_optimized=yes
4160     fi
4162 if test "$enable_optimized" != no; then
4163     ENABLE_OPTIMIZED=TRUE
4164     AC_MSG_RESULT([yes])
4165 else
4166     ENABLE_OPTIMIZED=
4167     AC_MSG_RESULT([no])
4169 AC_SUBST(ENABLE_OPTIMIZED)
4172 # determine CPUNAME, OS, ...
4173 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4175 case "$host_os" in
4177 aix*)
4178     COM=GCC
4179     CPUNAME=POWERPC
4180     USING_X11=TRUE
4181     OS=AIX
4182     RTL_OS=AIX
4183     RTL_ARCH=PowerPC
4184     PLATFORMID=aix_powerpc
4185     P_SEP=:
4186     ;;
4188 cygwin*)
4189     COM=MSC
4190     USING_X11=
4191     OS=WNT
4192     RTL_OS=Windows
4193     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4194         P_SEP=";"
4195     else
4196         P_SEP=:
4197     fi
4198     case "$host_cpu" in
4199     i*86|x86_64)
4200         if test "$BITNESS_OVERRIDE" = 64; then
4201             CPUNAME=X86_64
4202             RTL_ARCH=X86_64
4203             PLATFORMID=windows_x86_64
4204             WINDOWS_X64=1
4205             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4206         else
4207             CPUNAME=INTEL
4208             RTL_ARCH=x86
4209             PLATFORMID=windows_x86
4210         fi
4211         ;;
4212     *)
4213         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4214         ;;
4215     esac
4216     SCPDEFS="$SCPDEFS -D_MSC_VER"
4217     ;;
4219 darwin*)
4220     COM=GCC
4221     USING_X11=
4222     OS=MACOSX
4223     RTL_OS=MacOSX
4224     P_SEP=:
4226     case "$host_cpu" in
4227     arm)
4228         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4229         ;;
4230     arm64)
4231         OS=iOS
4232         RTL_OS=iOS
4233         if test "$enable_ios_simulator" = "yes"; then
4234             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4235         else
4236             CPUNAME=ARM64
4237             RTL_ARCH=ARM_EABI
4238             PLATFORMID=ios_arm64
4239         fi
4240         ;;
4241     i*86)
4242         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4243         ;;
4244     x86_64)
4245         if test "$enable_ios_simulator" = "yes"; then
4246             OS=iOS
4247         fi
4248         CPUNAME=X86_64
4249         RTL_ARCH=X86_64
4250         PLATFORMID=macosx_x86_64
4251         ;;
4252     *)
4253         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4254         ;;
4255     esac
4256     ;;
4258 dragonfly*)
4259     COM=GCC
4260     USING_X11=TRUE
4261     OS=DRAGONFLY
4262     RTL_OS=DragonFly
4263     P_SEP=:
4265     case "$host_cpu" in
4266     i*86)
4267         CPUNAME=INTEL
4268         RTL_ARCH=x86
4269         PLATFORMID=dragonfly_x86
4270         ;;
4271     x86_64)
4272         CPUNAME=X86_64
4273         RTL_ARCH=X86_64
4274         PLATFORMID=dragonfly_x86_64
4275         ;;
4276     *)
4277         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4278         ;;
4279     esac
4280     ;;
4282 freebsd*)
4283     COM=GCC
4284     USING_X11=TRUE
4285     RTL_OS=FreeBSD
4286     OS=FREEBSD
4287     P_SEP=:
4289     case "$host_cpu" in
4290     i*86)
4291         CPUNAME=INTEL
4292         RTL_ARCH=x86
4293         PLATFORMID=freebsd_x86
4294         ;;
4295     x86_64|amd64)
4296         CPUNAME=X86_64
4297         RTL_ARCH=X86_64
4298         PLATFORMID=freebsd_x86_64
4299         ;;
4300     *)
4301         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4302         ;;
4303     esac
4304     ;;
4306 haiku*)
4307     COM=GCC
4308     USING_X11=
4309     GUIBASE=haiku
4310     RTL_OS=Haiku
4311     OS=HAIKU
4312     P_SEP=:
4314     case "$host_cpu" in
4315     i*86)
4316         CPUNAME=INTEL
4317         RTL_ARCH=x86
4318         PLATFORMID=haiku_x86
4319         ;;
4320     x86_64|amd64)
4321         CPUNAME=X86_64
4322         RTL_ARCH=X86_64
4323         PLATFORMID=haiku_x86_64
4324         ;;
4325     *)
4326         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4327         ;;
4328     esac
4329     ;;
4331 kfreebsd*)
4332     COM=GCC
4333     USING_X11=TRUE
4334     OS=LINUX
4335     RTL_OS=kFreeBSD
4336     P_SEP=:
4338     case "$host_cpu" in
4340     i*86)
4341         CPUNAME=INTEL
4342         RTL_ARCH=x86
4343         PLATFORMID=kfreebsd_x86
4344         ;;
4345     x86_64)
4346         CPUNAME=X86_64
4347         RTL_ARCH=X86_64
4348         PLATFORMID=kfreebsd_x86_64
4349         ;;
4350     *)
4351         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4352         ;;
4353     esac
4354     ;;
4356 linux-gnu*)
4357     COM=GCC
4358     USING_X11=TRUE
4359     OS=LINUX
4360     RTL_OS=Linux
4361     P_SEP=:
4363     case "$host_cpu" in
4365     aarch64)
4366         CPUNAME=AARCH64
4367         PLATFORMID=linux_aarch64
4368         RTL_ARCH=AARCH64
4369         ;;
4370     alpha)
4371         CPUNAME=AXP
4372         RTL_ARCH=ALPHA
4373         PLATFORMID=linux_alpha
4374         ;;
4375     arm*)
4376         CPUNAME=ARM
4377         EPM_FLAGS="-a arm"
4378         RTL_ARCH=ARM_EABI
4379         PLATFORMID=linux_arm_eabi
4380         case "$host_cpu" in
4381         arm*-linux)
4382             RTL_ARCH=ARM_OABI
4383             PLATFORMID=linux_arm_oabi
4384             ;;
4385         esac
4386         ;;
4387     hppa)
4388         CPUNAME=HPPA
4389         RTL_ARCH=HPPA
4390         EPM_FLAGS="-a hppa"
4391         PLATFORMID=linux_hppa
4392         ;;
4393     i*86)
4394         CPUNAME=INTEL
4395         RTL_ARCH=x86
4396         PLATFORMID=linux_x86
4397         ;;
4398     ia64)
4399         CPUNAME=IA64
4400         RTL_ARCH=IA64
4401         PLATFORMID=linux_ia64
4402         ;;
4403     mips)
4404         CPUNAME=GODSON
4405         RTL_ARCH=MIPS_EB
4406         EPM_FLAGS="-a mips"
4407         PLATFORMID=linux_mips_eb
4408         ;;
4409     mips64)
4410         CPUNAME=GODSON64
4411         RTL_ARCH=MIPS64_EB
4412         EPM_FLAGS="-a mips64"
4413         PLATFORMID=linux_mips64_eb
4414         ;;
4415     mips64el)
4416         CPUNAME=GODSON64
4417         RTL_ARCH=MIPS64_EL
4418         EPM_FLAGS="-a mips64el"
4419         PLATFORMID=linux_mips64_el
4420         ;;
4421     mipsel)
4422         CPUNAME=GODSON
4423         RTL_ARCH=MIPS_EL
4424         EPM_FLAGS="-a mipsel"
4425         PLATFORMID=linux_mips_el
4426         ;;
4427     m68k)
4428         CPUNAME=M68K
4429         RTL_ARCH=M68K
4430         PLATFORMID=linux_m68k
4431         ;;
4432     powerpc)
4433         CPUNAME=POWERPC
4434         RTL_ARCH=PowerPC
4435         PLATFORMID=linux_powerpc
4436         ;;
4437     powerpc64)
4438         CPUNAME=POWERPC64
4439         RTL_ARCH=PowerPC_64
4440         PLATFORMID=linux_powerpc64
4441         ;;
4442     powerpc64le)
4443         CPUNAME=POWERPC64
4444         RTL_ARCH=PowerPC_64_LE
4445         PLATFORMID=linux_powerpc64_le
4446         ;;
4447     sparc)
4448         CPUNAME=SPARC
4449         RTL_ARCH=SPARC
4450         PLATFORMID=linux_sparc
4451         ;;
4452     sparc64)
4453         CPUNAME=SPARC64
4454         RTL_ARCH=SPARC64
4455         PLATFORMID=linux_sparc64
4456         ;;
4457     s390)
4458         CPUNAME=S390
4459         RTL_ARCH=S390
4460         PLATFORMID=linux_s390
4461         ;;
4462     s390x)
4463         CPUNAME=S390X
4464         RTL_ARCH=S390x
4465         PLATFORMID=linux_s390x
4466         ;;
4467     x86_64)
4468         CPUNAME=X86_64
4469         RTL_ARCH=X86_64
4470         PLATFORMID=linux_x86_64
4471         ;;
4472     *)
4473         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4474         ;;
4475     esac
4476     ;;
4478 linux-android*)
4479     COM=GCC
4480     USING_X11=
4481     OS=ANDROID
4482     RTL_OS=Android
4483     P_SEP=:
4485     case "$host_cpu" in
4487     arm|armel)
4488         CPUNAME=ARM
4489         RTL_ARCH=ARM_EABI
4490         PLATFORMID=android_arm_eabi
4491         ;;
4492     aarch64)
4493         CPUNAME=AARCH64
4494         RTL_ARCH=AARCH64
4495         PLATFORMID=android_aarch64
4496         ;;
4497     i*86)
4498         CPUNAME=INTEL
4499         RTL_ARCH=x86
4500         PLATFORMID=android_x86
4501         ;;
4502     x86_64)
4503         CPUNAME=X86_64
4504         RTL_ARCH=X86_64
4505         PLATFORMID=android_x86_64
4506         ;;
4507     *)
4508         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4509         ;;
4510     esac
4511     ;;
4513 *netbsd*)
4514     COM=GCC
4515     USING_X11=TRUE
4516     OS=NETBSD
4517     RTL_OS=NetBSD
4518     P_SEP=:
4520     case "$host_cpu" in
4521     i*86)
4522         CPUNAME=INTEL
4523         RTL_ARCH=x86
4524         PLATFORMID=netbsd_x86
4525         ;;
4526     powerpc)
4527         CPUNAME=POWERPC
4528         RTL_ARCH=PowerPC
4529         PLATFORMID=netbsd_powerpc
4530         ;;
4531     sparc)
4532         CPUNAME=SPARC
4533         RTL_ARCH=SPARC
4534         PLATFORMID=netbsd_sparc
4535         ;;
4536     x86_64)
4537         CPUNAME=X86_64
4538         RTL_ARCH=X86_64
4539         PLATFORMID=netbsd_x86_64
4540         ;;
4541     *)
4542         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4543         ;;
4544     esac
4545     ;;
4547 openbsd*)
4548     COM=GCC
4549     USING_X11=TRUE
4550     OS=OPENBSD
4551     RTL_OS=OpenBSD
4552     P_SEP=:
4554     case "$host_cpu" in
4555     i*86)
4556         CPUNAME=INTEL
4557         RTL_ARCH=x86
4558         PLATFORMID=openbsd_x86
4559         ;;
4560     x86_64)
4561         CPUNAME=X86_64
4562         RTL_ARCH=X86_64
4563         PLATFORMID=openbsd_x86_64
4564         ;;
4565     *)
4566         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4567         ;;
4568     esac
4569     SOLARINC="$SOLARINC -I/usr/local/include"
4570     ;;
4572 solaris*)
4573     COM=GCC
4574     USING_X11=TRUE
4575     OS=SOLARIS
4576     RTL_OS=Solaris
4577     P_SEP=:
4579     case "$host_cpu" in
4580     i*86)
4581         CPUNAME=INTEL
4582         RTL_ARCH=x86
4583         PLATFORMID=solaris_x86
4584         ;;
4585     sparc)
4586         CPUNAME=SPARC
4587         RTL_ARCH=SPARC
4588         PLATFORMID=solaris_sparc
4589         ;;
4590     sparc64)
4591         CPUNAME=SPARC64
4592         RTL_ARCH=SPARC64
4593         PLATFORMID=solaris_sparc64
4594         ;;
4595     *)
4596         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4597         ;;
4598     esac
4599     SOLARINC="$SOLARINC -I/usr/local/include"
4600     ;;
4603     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4604     ;;
4605 esac
4607 if test "$with_x" = "no"; then
4608     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4611 DISABLE_GUI=""
4612 if test "$enable_gui" = "no"; then
4613     if test "$USING_X11" != TRUE; then
4614         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4615     fi
4616     USING_X11=
4617     DISABLE_GUI=TRUE
4618     AC_DEFINE(HAVE_FEATURE_UI,0)
4619     test_cairo=yes
4621 AC_SUBST(DISABLE_GUI)
4623 WORKDIR="${BUILDDIR}/workdir"
4624 INSTDIR="${BUILDDIR}/instdir"
4625 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4626 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4627 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4628 AC_SUBST(COM)
4629 AC_SUBST(CPUNAME)
4630 AC_SUBST(RTL_OS)
4631 AC_SUBST(RTL_ARCH)
4632 AC_SUBST(EPM_FLAGS)
4633 AC_SUBST(USING_X11)
4634 AC_SUBST([INSTDIR])
4635 AC_SUBST([INSTROOT])
4636 AC_SUBST([INSTROOTBASE])
4637 AC_SUBST(OS)
4638 AC_SUBST(P_SEP)
4639 AC_SUBST(WORKDIR)
4640 AC_SUBST(PLATFORMID)
4641 AC_SUBST(WINDOWS_X64)
4642 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4644 dnl ===================================================================
4645 dnl Test which package format to use
4646 dnl ===================================================================
4647 AC_MSG_CHECKING([which package format to use])
4648 if test -n "$with_package_format" -a "$with_package_format" != no; then
4649     for i in $with_package_format; do
4650         case "$i" in
4651         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4652             ;;
4653         *)
4654             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4655 aix - AIX software distribution
4656 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4657 deb - Debian software distribution
4658 pkg - Solaris software distribution
4659 rpm - RedHat software distribution
4661 LibreOffice additionally supports:
4662 archive - .tar.gz or .zip
4663 dmg - macOS .dmg
4664 installed - installation tree
4665 msi - Windows .msi
4666         ])
4667             ;;
4668         esac
4669     done
4670     # fakeroot is needed to ensure correct file ownerships/permissions
4671     # inside deb packages and tar archives created on Linux and Solaris.
4672     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4673         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4674         if test "$FAKEROOT" = "no"; then
4675             AC_MSG_ERROR(
4676                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4677         fi
4678     fi
4679     PKGFORMAT="$with_package_format"
4680     AC_MSG_RESULT([$PKGFORMAT])
4681 else
4682     PKGFORMAT=
4683     AC_MSG_RESULT([none])
4685 AC_SUBST(PKGFORMAT)
4687 dnl ===================================================================
4688 dnl Set up a different compiler to produce tools to run on the build
4689 dnl machine when doing cross-compilation
4690 dnl ===================================================================
4692 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4693 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4694 if test "$cross_compiling" = "yes"; then
4695     AC_MSG_CHECKING([for BUILD platform configuration])
4696     echo
4697     rm -rf CONF-FOR-BUILD config_build.mk
4698     mkdir CONF-FOR-BUILD
4699     # Here must be listed all files needed when running the configure script. In particular, also
4700     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4701     # keep them in the same order as there.
4702     (cd $SRC_ROOT && tar cf - \
4703         config.guess \
4704         bin/get_config_variables \
4705         solenv/bin/getcompver.awk \
4706         solenv/inc/langlist.mk \
4707         download.lst \
4708         config_host.mk.in \
4709         config_host_lang.mk.in \
4710         Makefile.in \
4711         bin/bffvalidator.sh.in \
4712         bin/odfvalidator.sh.in \
4713         bin/officeotron.sh.in \
4714         instsetoo_native/util/openoffice.lst.in \
4715         config_host/*.in \
4716         sysui/desktop/macosx/Info.plist.in) \
4717     | (cd CONF-FOR-BUILD && tar xf -)
4718     cp configure CONF-FOR-BUILD
4719     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4720     (
4721     unset COM USING_X11 OS CPUNAME
4722     unset CC CXX SYSBASE CFLAGS
4723     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4724     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4725     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4726     if test -n "$CC_FOR_BUILD"; then
4727         export CC="$CC_FOR_BUILD"
4728         CC_BASE=`first_arg_basename "$CC"`
4729     fi
4730     if test -n "$CXX_FOR_BUILD"; then
4731         export CXX="$CXX_FOR_BUILD"
4732         CXX_BASE=`first_arg_basename "$CXX"`
4733     fi
4734     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4735     cd CONF-FOR-BUILD
4736     sub_conf_opts=""
4737     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4738     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4739     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4740     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4741     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4742     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4743     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4744     # Don't bother having configure look for stuff not needed for the build platform anyway
4745     ./configure \
4746         --disable-cups \
4747         --disable-gstreamer-1-0 \
4748         --disable-gtk3 \
4749         --disable-pdfimport \
4750         --disable-postgresql-sdbc \
4751         --with-parallelism="$with_parallelism" \
4752         --without-doxygen \
4753         --without-java \
4754         $sub_conf_opts \
4755         --srcdir=$srcdir \
4756         2>&1 | sed -e 's/^/    /'
4757     test -f ./config_host.mk 2>/dev/null || exit
4758     cp config_host.mk ../config_build.mk
4759     cp config_host_lang.mk ../config_build_lang.mk
4760     mv config.log ../config.Build.log
4761     mkdir -p ../config_build
4762     mv config_host/*.h ../config_build
4763     . ./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
4765     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
4766         VV='$'$V
4767         VV=`eval "echo $VV"`
4768         if test -n "$VV"; then
4769             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4770             echo "$line" >>build-config
4771         fi
4772     done
4774     for V in INSTDIR INSTROOT WORKDIR; do
4775         VV='$'$V
4776         VV=`eval "echo $VV"`
4777         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4778         if test -n "$VV"; then
4779             line="${V}_FOR_BUILD='$VV'"
4780             echo "$line" >>build-config
4781         fi
4782     done
4784     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4785     echo "$line" >>build-config
4787     )
4788     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4789     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])
4790     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4791              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4793     eval `cat CONF-FOR-BUILD/build-config`
4795     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4797     rm -rf CONF-FOR-BUILD
4798 else
4799     OS_FOR_BUILD="$OS"
4800     CC_FOR_BUILD="$CC"
4801     CXX_FOR_BUILD="$CXX"
4802     INSTDIR_FOR_BUILD="$INSTDIR"
4803     INSTROOT_FOR_BUILD="$INSTROOT"
4804     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4805     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4806     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4807     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4808     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4809     WORKDIR_FOR_BUILD="$WORKDIR"
4811 AC_SUBST(OS_FOR_BUILD)
4812 AC_SUBST(INSTDIR_FOR_BUILD)
4813 AC_SUBST(INSTROOT_FOR_BUILD)
4814 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4815 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4816 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4817 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4818 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4819 AC_SUBST(WORKDIR_FOR_BUILD)
4821 dnl ===================================================================
4822 dnl Check for syslog header
4823 dnl ===================================================================
4824 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4826 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4827 dnl ===================================================================
4828 AC_MSG_CHECKING([whether to turn warnings to errors])
4829 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4830     ENABLE_WERROR="TRUE"
4831     AC_MSG_RESULT([yes])
4832 else
4833     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4834         ENABLE_WERROR="TRUE"
4835         AC_MSG_RESULT([yes])
4836     else
4837         AC_MSG_RESULT([no])
4838     fi
4840 AC_SUBST(ENABLE_WERROR)
4842 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4843 dnl ===================================================================
4844 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4845 if test -z "$enable_assert_always_abort"; then
4846    if test "$ENABLE_DEBUG" = TRUE; then
4847        enable_assert_always_abort=yes
4848    else
4849        enable_assert_always_abort=no
4850    fi
4852 if test "$enable_assert_always_abort" = "yes"; then
4853     ASSERT_ALWAYS_ABORT="TRUE"
4854     AC_MSG_RESULT([yes])
4855 else
4856     ASSERT_ALWAYS_ABORT="FALSE"
4857     AC_MSG_RESULT([no])
4859 AC_SUBST(ASSERT_ALWAYS_ABORT)
4861 # Determine whether to use ooenv for the instdir installation
4862 # ===================================================================
4863 if test $_os != "WINNT" -a $_os != "Darwin"; then
4864     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4865     if test "$enable_ooenv" = "no"; then
4866         AC_MSG_RESULT([no])
4867     else
4868         ENABLE_OOENV="TRUE"
4869         AC_MSG_RESULT([yes])
4870     fi
4872 AC_SUBST(ENABLE_OOENV)
4874 if test "$USING_X11" != TRUE; then
4875     # be sure to do not mess with unneeded stuff
4876     test_randr=no
4877     test_xrender=no
4878     test_cups=no
4879     test_dbus=no
4880     build_gstreamer_1_0=no
4881     test_kf5=no
4882     test_qt5=no
4883     test_gtk3_kde5=no
4884     enable_cairo_canvas=no
4887 if test "$OS" = "HAIKU"; then
4888     enable_cairo_canvas=yes
4889     test_kf5=yes
4892 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4893     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!])
4894     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!"
4895     enable_kf5=yes
4898 if test "$test_kf5" = "yes"; then
4899     test_qt5=yes
4902 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4903     if test "$enable_qt5" = "no"; then
4904         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4905     else
4906         enable_qt5=yes
4907     fi
4910 dnl ===================================================================
4911 dnl check for cups support
4912 dnl ===================================================================
4913 ENABLE_CUPS=""
4915 if test "$enable_cups" = "no"; then
4916     test_cups=no
4919 AC_MSG_CHECKING([whether to enable CUPS support])
4920 if test "$test_cups" = "yes"; then
4921     ENABLE_CUPS="TRUE"
4922     AC_MSG_RESULT([yes])
4924     AC_MSG_CHECKING([whether cups support is present])
4925     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4926     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4927     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4928         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4929     fi
4931 else
4932     AC_MSG_RESULT([no])
4935 AC_SUBST(ENABLE_CUPS)
4937 # fontconfig checks
4938 if test "$test_fontconfig" = "yes"; then
4939     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4940     SYSTEM_FONTCONFIG=TRUE
4941     FilterLibs "${FONTCONFIG_LIBS}"
4942     FONTCONFIG_LIBS="${filteredlibs}"
4944 AC_SUBST(FONTCONFIG_CFLAGS)
4945 AC_SUBST(FONTCONFIG_LIBS)
4946 AC_SUBST([SYSTEM_FONTCONFIG])
4948 dnl whether to find & fetch external tarballs?
4949 dnl ===================================================================
4950 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4951    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4952        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4953    else
4954        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4955    fi
4957 if test -z "$TARFILE_LOCATION"; then
4958     if test -d "$SRC_ROOT/src" ; then
4959         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4960         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4961     fi
4962     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4963 else
4964     AbsolutePath "$TARFILE_LOCATION"
4965     PathFormat "${absolute_path}"
4966     TARFILE_LOCATION="${formatted_path}"
4968 AC_SUBST(TARFILE_LOCATION)
4970 AC_MSG_CHECKING([whether we want to fetch tarballs])
4971 if test "$enable_fetch_external" != "no"; then
4972     if test "$with_all_tarballs" = "yes"; then
4973         AC_MSG_RESULT([yes, all of them])
4974         DO_FETCH_TARBALLS="ALL"
4975     else
4976         AC_MSG_RESULT([yes, if we use them])
4977         DO_FETCH_TARBALLS="TRUE"
4978     fi
4979 else
4980     AC_MSG_RESULT([no])
4981     DO_FETCH_TARBALLS=
4983 AC_SUBST(DO_FETCH_TARBALLS)
4985 AC_MSG_CHECKING([whether to build help])
4986 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4987     BUILD_TYPE="$BUILD_TYPE HELP"
4988     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4989     case "$with_help" in
4990     "html")
4991         ENABLE_HTMLHELP=TRUE
4992         SCPDEFS="$SCPDEFS -DWITH_HELP"
4993         AC_MSG_RESULT([HTML])
4994         ;;
4995     "online")
4996         ENABLE_HTMLHELP=TRUE
4997         HELP_ONLINE=TRUE
4998         AC_MSG_RESULT([HTML])
4999         ;;
5000     yes)
5001         SCPDEFS="$SCPDEFS -DWITH_HELP"
5002         AC_MSG_RESULT([yes])
5003         ;;
5004     *)
5005         AC_MSG_ERROR([Unknown --with-help=$with_help])
5006         ;;
5007     esac
5008 else
5009     AC_MSG_RESULT([no])
5011 AC_SUBST([ENABLE_HTMLHELP])
5012 AC_SUBST([HELP_ONLINE])
5014 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5015 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5016     BUILD_TYPE="$BUILD_TYPE HELP"
5017     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5018     case "$with_omindex" in
5019     "server")
5020         ENABLE_HTMLHELP=TRUE
5021         HELP_ONLINE=TRUE
5022         HELP_OMINDEX_PAGE=TRUE
5023         AC_MSG_RESULT([SERVER])
5024         ;;
5025     "noxap")
5026         ENABLE_HTMLHELP=TRUE
5027         HELP_ONLINE=TRUE
5028         HELP_OMINDEX_PAGE=FALSE
5029         AC_MSG_RESULT([NOXAP])
5030         ;;
5031     *)
5032         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5033         ;;
5034     esac
5035 else
5036     HELP_OMINDEX_PAGE=FALSE
5037     AC_MSG_RESULT([no])
5039 AC_SUBST([ENABLE_HTMLHELP])
5040 AC_SUBST([HELP_OMINDEX_PAGE])
5041 AC_SUBST([HELP_ONLINE])
5044 dnl Test whether to include MySpell dictionaries
5045 dnl ===================================================================
5046 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5047 if test "$with_myspell_dicts" = "yes"; then
5048     AC_MSG_RESULT([yes])
5049     WITH_MYSPELL_DICTS=TRUE
5050     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5051     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5052 else
5053     AC_MSG_RESULT([no])
5054     WITH_MYSPELL_DICTS=
5056 AC_SUBST(WITH_MYSPELL_DICTS)
5058 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5059 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5060     if test "$with_system_dicts" = yes; then
5061         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5062     fi
5063     with_system_dicts=no
5066 AC_MSG_CHECKING([whether to use dicts from external paths])
5067 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5068     AC_MSG_RESULT([yes])
5069     SYSTEM_DICTS=TRUE
5070     AC_MSG_CHECKING([for spelling dictionary directory])
5071     if test -n "$with_external_dict_dir"; then
5072         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5073     else
5074         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5075         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5076             DICT_SYSTEM_DIR=file:///usr/share/myspell
5077         fi
5078     fi
5079     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5080     AC_MSG_CHECKING([for hyphenation patterns directory])
5081     if test -n "$with_external_hyph_dir"; then
5082         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5083     else
5084         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5085     fi
5086     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5087     AC_MSG_CHECKING([for thesaurus directory])
5088     if test -n "$with_external_thes_dir"; then
5089         THES_SYSTEM_DIR=file://$with_external_thes_dir
5090     else
5091         THES_SYSTEM_DIR=file:///usr/share/mythes
5092     fi
5093     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5094 else
5095     AC_MSG_RESULT([no])
5096     SYSTEM_DICTS=
5098 AC_SUBST(SYSTEM_DICTS)
5099 AC_SUBST(DICT_SYSTEM_DIR)
5100 AC_SUBST(HYPH_SYSTEM_DIR)
5101 AC_SUBST(THES_SYSTEM_DIR)
5103 dnl ===================================================================
5104 dnl Precompiled headers.
5105 ENABLE_PCH=""
5106 AC_MSG_CHECKING([whether to enable pch feature])
5107 if test -z "$enable_pch"; then
5108     if test "$_os" = "WINNT"; then
5109         # Enabled by default on Windows.
5110         enable_pch=yes
5111     else
5112         enable_pch=no
5113     fi
5115 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5116     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5118 if test "$enable_pch" = "system"; then
5119     ENABLE_PCH="1"
5120     AC_MSG_RESULT([yes (system headers)])
5121 elif test "$enable_pch" = "base"; then
5122     ENABLE_PCH="2"
5123     AC_MSG_RESULT([yes (system and base headers)])
5124 elif test "$enable_pch" = "normal"; then
5125     ENABLE_PCH="3"
5126     AC_MSG_RESULT([yes (normal)])
5127 elif test "$enable_pch" = "full"; then
5128     ENABLE_PCH="4"
5129     AC_MSG_RESULT([yes (full)])
5130 elif test "$enable_pch" = "yes"; then
5131     # Pick a suitable default.
5132     if test "$GCC" = "yes"; then
5133         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5134         # while making the PCHs larger and rebuilds more likely.
5135         ENABLE_PCH="2"
5136         AC_MSG_RESULT([yes (system and base headers)])
5137     else
5138         # With MSVC the highest level makes a significant difference,
5139         # and it was the default when there used to be no PCH levels.
5140         ENABLE_PCH="4"
5141         AC_MSG_RESULT([yes (full)])
5142     fi
5143 elif test "$enable_pch" = "no"; then
5144     AC_MSG_RESULT([no])
5145 else
5146     AC_MSG_ERROR([Unknown value for --enable-pch])
5148 AC_SUBST(ENABLE_PCH)
5149 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5150 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5151     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5152     if test "$CCACHE_BIN" != "not found"; then
5153         AC_MSG_CHECKING([ccache version])
5154         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5155         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5156         AC_MSG_RESULT([$CCACHE_VERSION])
5157         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5158         if test "$CCACHE_NUMVER" -gt "030701"; then
5159             AC_MSG_RESULT([yes])
5160         else
5161             AC_MSG_RESULT([no (not newer than 3.7.1)])
5162             CCACHE_DEPEND_MODE=
5163         fi
5164     fi
5167 TAB=`printf '\t'`
5169 AC_MSG_CHECKING([the GNU Make version])
5170 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5171 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5172 if test "$_make_longver" -ge "038200"; then
5173     AC_MSG_RESULT([$GNUMAKE $_make_version])
5175 elif test "$_make_longver" -ge "038100"; then
5176     if test "$build_os" = "cygwin"; then
5177         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5178     fi
5179     AC_MSG_RESULT([$GNUMAKE $_make_version])
5181     dnl ===================================================================
5182     dnl Search all the common names for sha1sum
5183     dnl ===================================================================
5184     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5185     if test -z "$SHA1SUM"; then
5186         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5187     elif test "$SHA1SUM" = "openssl"; then
5188         SHA1SUM="openssl sha1"
5189     fi
5190     AC_MSG_CHECKING([for GNU Make bug 20033])
5191     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5192     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5193 A := \$(wildcard *.a)
5195 .PHONY: all
5196 all: \$(A:.a=.b)
5197 <TAB>@echo survived bug20033.
5199 .PHONY: setup
5200 setup:
5201 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5203 define d1
5204 @echo lala \$(1)
5205 @sleep 1
5206 endef
5208 define d2
5209 @echo tyty \$(1)
5210 @sleep 1
5211 endef
5213 %.b : %.a
5214 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5215 <TAB>\$(call d1,\$(CHECKSUM)),\
5216 <TAB>\$(call d2,\$(CHECKSUM)))
5218     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5219         no_parallelism_make="YES"
5220         AC_MSG_RESULT([yes, disable parallelism])
5221     else
5222         AC_MSG_RESULT([no, keep parallelism enabled])
5223     fi
5224     rm -rf $TESTGMAKEBUG20033
5225 else
5226     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5229 # find if gnumake support file function
5230 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5231 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5232 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5233     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5235 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5236 \$(file >test.txt,Success )
5238 .PHONY: all
5239 all:
5240 <TAB>@cat test.txt
5243 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5244 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5245     HAVE_GNUMAKE_FILE_FUNC=TRUE
5246     AC_MSG_RESULT([yes])
5247 else
5248     AC_MSG_RESULT([no])
5250 rm -rf $TESTGMAKEFILEFUNC
5251 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5252 AC_SUBST(GNUMAKE_WIN_NATIVE)
5254 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5255 STALE_MAKE=
5256 if test "$_make_ver_check" = ""; then
5257    STALE_MAKE=TRUE
5260 HAVE_LD_HASH_STYLE=FALSE
5261 WITH_LINKER_HASH_STYLE=
5262 AC_MSG_CHECKING([for --hash-style gcc linker support])
5263 if test "$GCC" = "yes"; then
5264     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5265         hash_styles="gnu sysv"
5266     elif test "$with_linker_hash_style" = "no"; then
5267         hash_styles=
5268     else
5269         hash_styles="$with_linker_hash_style"
5270     fi
5272     for hash_style in $hash_styles; do
5273         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5274         hash_style_ldflags_save=$LDFLAGS
5275         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5277         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5278             [
5279 #include <stdio.h>
5280             ],[
5281 printf ("");
5282             ])],
5283             [
5284                   HAVE_LD_HASH_STYLE=TRUE
5285                   WITH_LINKER_HASH_STYLE=$hash_style
5286             ],
5287             [HAVE_LD_HASH_STYLE=FALSE],
5288             [HAVE_LD_HASH_STYLE=FALSE])
5289         LDFLAGS=$hash_style_ldflags_save
5290     done
5292     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5293         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5294     else
5295         AC_MSG_RESULT( no )
5296     fi
5297     LDFLAGS=$hash_style_ldflags_save
5298 else
5299     AC_MSG_RESULT( no )
5301 AC_SUBST(HAVE_LD_HASH_STYLE)
5302 AC_SUBST(WITH_LINKER_HASH_STYLE)
5304 dnl ===================================================================
5305 dnl Check whether there's a Perl version available.
5306 dnl ===================================================================
5307 if test -z "$with_perl_home"; then
5308     AC_PATH_PROG(PERL, perl)
5309 else
5310     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5311     _perl_path="$with_perl_home/bin/perl"
5312     if test -x "$_perl_path"; then
5313         PERL=$_perl_path
5314     else
5315         AC_MSG_ERROR([$_perl_path not found])
5316     fi
5319 dnl ===================================================================
5320 dnl Testing for Perl version 5 or greater.
5321 dnl $] is the Perl version variable, it is returned as an integer
5322 dnl ===================================================================
5323 if test "$PERL"; then
5324     AC_MSG_CHECKING([the Perl version])
5325     ${PERL} -e "exit($]);"
5326     _perl_version=$?
5327     if test "$_perl_version" -lt 5; then
5328         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5329     fi
5330     AC_MSG_RESULT([Perl $_perl_version])
5331 else
5332     AC_MSG_ERROR([Perl not found, install Perl 5])
5335 dnl ===================================================================
5336 dnl Testing for required Perl modules
5337 dnl ===================================================================
5339 AC_MSG_CHECKING([for required Perl modules])
5340 perl_use_string="use Cwd ; use Digest::MD5"
5341 if test "$_os" = "WINNT"; then
5342     if test -n "$PKGFORMAT"; then
5343         for i in $PKGFORMAT; do
5344             case "$i" in
5345             msi)
5346                 # for getting fonts versions to use in MSI
5347                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5348                 ;;
5349             esac
5350         done
5351     fi
5353 if test "$with_system_hsqldb" = "yes"; then
5354     perl_use_string="$perl_use_string ; use Archive::Zip"
5356 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5357     AC_MSG_RESULT([all modules found])
5358 else
5359     AC_MSG_RESULT([failed to find some modules])
5360     # Find out which modules are missing.
5361     for i in $perl_use_string; do
5362         if test "$i" != "use" -a "$i" != ";"; then
5363             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5364                 missing_perl_modules="$missing_perl_modules $i"
5365             fi
5366         fi
5367     done
5368     AC_MSG_ERROR([
5369     The missing Perl modules are: $missing_perl_modules
5370     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5373 dnl ===================================================================
5374 dnl Check for pkg-config
5375 dnl ===================================================================
5376 if test "$_os" != "WINNT"; then
5377     PKG_PROG_PKG_CONFIG
5380 if test "$_os" != "WINNT"; then
5382     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5383     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5384     # explicitly. Or put /path/to/compiler in PATH yourself.
5386     # Use wrappers for LTO
5387     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5388         AC_CHECK_TOOL(AR,gcc-ar)
5389         AC_CHECK_TOOL(NM,gcc-nm)
5390         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5391     else
5392         AC_CHECK_TOOL(AR,ar)
5393         AC_CHECK_TOOL(NM,nm)
5394         AC_CHECK_TOOL(RANLIB,ranlib)
5395     fi
5396     AC_CHECK_TOOL(OBJDUMP,objdump)
5397     AC_CHECK_TOOL(READELF,readelf)
5398     AC_CHECK_TOOL(STRIP,strip)
5399     if test "$_os" = "WINNT"; then
5400         AC_CHECK_TOOL(DLLTOOL,dlltool)
5401         AC_CHECK_TOOL(WINDRES,windres)
5402     fi
5404 AC_SUBST(AR)
5405 AC_SUBST(DLLTOOL)
5406 AC_SUBST(NM)
5407 AC_SUBST(OBJDUMP)
5408 AC_SUBST(PKG_CONFIG)
5409 AC_SUBST(RANLIB)
5410 AC_SUBST(READELF)
5411 AC_SUBST(STRIP)
5412 AC_SUBST(WINDRES)
5414 dnl ===================================================================
5415 dnl pkg-config checks on macOS
5416 dnl ===================================================================
5418 if test $_os = Darwin; then
5419     AC_MSG_CHECKING([for bogus pkg-config])
5420     if test -n "$PKG_CONFIG"; then
5421         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5422             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5423         else
5424             if test "$enable_bogus_pkg_config" = "yes"; then
5425                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5426             else
5427                 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.])
5428             fi
5429         fi
5430     else
5431         AC_MSG_RESULT([no, good])
5432     fi
5435 find_csc()
5437     # Return value: $csctest
5439     unset csctest
5441     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5442     if test -n "$regvalue"; then
5443         csctest=$regvalue
5444         return
5445     fi
5448 find_al()
5450     # Return value: $altest
5452     unset altest
5454     # We need this check to detect 4.6.1 or above.
5455     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5456         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5457         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5458             altest=$regvalue
5459             return
5460         fi
5461     done
5463     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5464         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5465         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5466             altest=$regvalue
5467             return
5468         fi
5469     done
5474 find_dotnetsdk46()
5476     unset frametest
5478     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5479         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5480         if test -n "$regvalue"; then
5481             frametest=$regvalue
5482             return
5483         fi
5484     done
5487 find_winsdk_version()
5489     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5490     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5492     unset winsdktest winsdkbinsubdir winsdklibsubdir
5494     case "$1" in
5495     8.0|8.0A)
5496         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5497         if test -n "$regvalue"; then
5498             winsdktest=$regvalue
5499             winsdklibsubdir=win8
5500             return
5501         fi
5502         ;;
5503     8.1|8.1A)
5504         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5505         if test -n "$regvalue"; then
5506             winsdktest=$regvalue
5507             winsdklibsubdir=winv6.3
5508             return
5509         fi
5510         ;;
5511     10.0)
5512         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5513         if test -n "$regvalue"; then
5514             winsdktest=$regvalue
5515             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5516             if test -n "$regvalue"; then
5517                 winsdkbinsubdir="$regvalue".0
5518                 winsdklibsubdir=$winsdkbinsubdir
5519                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5520                 # test exist the SDK path
5521                 if test -d "$tmppath"; then
5522                    # when path is convertible to a short path then path is okay
5523                    cygpath -d "$tmppath" >/dev/null 2>&1
5524                    if test $? -ne 0; then
5525                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5526                    fi
5527                 else
5528                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5529                 fi
5530             fi
5531             return
5532         fi
5533         ;;
5534     esac
5537 find_winsdk()
5539     # Return value: From find_winsdk_version
5541     unset winsdktest
5543     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5544         find_winsdk_version $ver
5545         if test -n "$winsdktest"; then
5546             return
5547         fi
5548     done
5551 find_msms()
5553     AC_MSG_CHECKING([for MSVC merge modules directory])
5554     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5555     case "$VCVER" in
5556         150|160)
5557         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5558         ;;
5559     esac
5560     for f in $my_msm_files; do
5561         echo "$as_me:$LINENO: searching for $f" >&5
5562     done
5564     msmdir=
5565     for ver in 14.0 15.0; do
5566         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5567         if test -n "$regvalue"; then
5568             for f in ${my_msm_files}; do
5569                 if test -e "$regvalue/${f}"; then
5570                     msmdir=$regvalue
5571                     break
5572                 fi
5573             done
5574         fi
5575     done
5576     dnl Is the following fallback really necessary, or was it added in response
5577     dnl to never having started Visual Studio on a given machine, so the
5578     dnl registry keys checked above had presumably not yet been created?
5579     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5580     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5581     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5582     dnl expanding to "C:\Program Files\Common Files"), which would need
5583     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5584     dnl obtain its value from cygwin:
5585     if test -z "$msmdir"; then
5586         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5587         for f in ${my_msm_files}; do
5588             if test -e "$my_msm_dir/${f}"; then
5589                 msmdir=$my_msm_dir
5590             fi
5591         done
5592     fi
5594     dnl Starting from MSVC 15.0, merge modules are located in different directory
5595     case "$VCVER" in
5596     150|160)
5597         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5598             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5599             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5600             for f in ${my_msm_files}; do
5601                 if test -e "$my_msm_dir/${f}"; then
5602                     msmdir=$my_msm_dir
5603                     break
5604                 fi
5605             done
5606         done
5607         ;;
5608     esac
5610     if test -n "$msmdir"; then
5611         msmdir=`cygpath -m "$msmdir"`
5612         AC_MSG_RESULT([$msmdir])
5613     else
5614         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5615             AC_MSG_FAILURE([not found])
5616         else
5617             AC_MSG_WARN([not found (check config.log)])
5618             add_warning "MSM none of ${my_msm_files} found"
5619         fi
5620     fi
5623 find_msvc_x64_dlls()
5625     AC_MSG_CHECKING([for MSVC x64 DLL path])
5626     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5627     case "$VCVER" in
5628     150|160)
5629         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5630             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5631             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5632                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5633                 break
5634             fi
5635             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5636             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5637                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5638                 break
5639             fi
5640             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5641             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5642                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5643                 break
5644             fi
5645         done
5646         ;;
5647     esac
5648     AC_MSG_RESULT([$msvcdllpath])
5649     AC_MSG_CHECKING([for MSVC x64 DLLs])
5650     msvcdlls="msvcp140.dll vcruntime140.dll"
5651     for dll in $msvcdlls; do
5652         if ! test -f "$msvcdllpath/$dll"; then
5653             AC_MSG_FAILURE([missing $dll])
5654         fi
5655     done
5656     AC_MSG_RESULT([found all ($msvcdlls)])
5659 dnl =========================================
5660 dnl Check for the Windows  SDK.
5661 dnl =========================================
5662 if test "$_os" = "WINNT"; then
5663     AC_MSG_CHECKING([for Windows SDK])
5664     if test "$build_os" = "cygwin"; then
5665         find_winsdk
5666         WINDOWS_SDK_HOME=$winsdktest
5668         # normalize if found
5669         if test -n "$WINDOWS_SDK_HOME"; then
5670             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5671             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5672         fi
5674         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5675     fi
5677     if test -n "$WINDOWS_SDK_HOME"; then
5678         # Remove a possible trailing backslash
5679         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5681         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5682              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5683              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5684             have_windows_sdk_headers=yes
5685         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5686              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5687              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5688             have_windows_sdk_headers=yes
5689         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5690              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5691              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5692             have_windows_sdk_headers=yes
5693         else
5694             have_windows_sdk_headers=no
5695         fi
5697         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5698             have_windows_sdk_libs=yes
5699         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5700             have_windows_sdk_libs=yes
5701         else
5702             have_windows_sdk_libs=no
5703         fi
5705         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5706             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5707 the  Windows SDK are installed.])
5708         fi
5709     fi
5711     if test -z "$WINDOWS_SDK_HOME"; then
5712         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5713     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5714         WINDOWS_SDK_VERSION=80
5715         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5716     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5717         WINDOWS_SDK_VERSION=81
5718         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5719     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5720         WINDOWS_SDK_VERSION=10
5721         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5722     else
5723         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5724     fi
5725     PathFormat "$WINDOWS_SDK_HOME"
5726     WINDOWS_SDK_HOME="$formatted_path"
5727     if test "$build_os" = "cygwin"; then
5728         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5729         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5730             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5731         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5732             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5733         fi
5734     fi
5736     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5737     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5738     dnl but not in v8.0), so allow this to be overridden with a
5739     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5740     dnl and configuration error if no WiLangId.vbs is found would arguably be
5741     dnl better, but I do not know under which conditions exactly it is needed by
5742     dnl msiglobal.pm:
5743     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5744         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5745         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5746             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5747         fi
5748         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5749             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5750         fi
5751         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5752             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5753         fi
5754     fi
5755     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5756         if test -n "$with_package_format" -a "$with_package_format" != no; then
5757             for i in "$with_package_format"; do
5758                 if test "$i" = "msi"; then
5759                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5760                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5761                     fi
5762                 fi
5763             done
5764         fi
5765     fi
5767 AC_SUBST(WINDOWS_SDK_HOME)
5768 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5769 AC_SUBST(WINDOWS_SDK_VERSION)
5770 AC_SUBST(WINDOWS_SDK_WILANGID)
5772 if test "$build_os" = "cygwin"; then
5773     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5774     dnl dir, it also determines that dir's path w/o an arch segment if any,
5775     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5776     AC_MSG_CHECKING([for midl.exe])
5778     find_winsdk
5779     if test -n "$winsdkbinsubdir" \
5780         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5781     then
5782         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5783         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5784     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5785         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5786         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5787     elif test -f "$winsdktest/Bin/midl.exe"; then
5788         MIDL_PATH=$winsdktest/Bin
5789         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5790     fi
5791     if test ! -f "$MIDL_PATH/midl.exe"; then
5792         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5793     else
5794         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5795     fi
5797     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5798     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5800     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5801          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5802          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5803          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5804     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5805          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5806          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5807          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5808     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5809          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5810          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5811          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5812     else
5813         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5814     fi
5816     dnl Check csc.exe
5817     AC_MSG_CHECKING([for csc.exe])
5818     find_csc
5819     if test -f "$csctest/csc.exe"; then
5820         CSC_PATH="$csctest"
5821     fi
5822     if test ! -f "$CSC_PATH/csc.exe"; then
5823         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5824     else
5825         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5826     fi
5828     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5830     dnl Check al.exe
5831     AC_MSG_CHECKING([for al.exe])
5832     find_winsdk
5833     if test -n "$winsdkbinsubdir" \
5834         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5835     then
5836         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5837     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5838         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5839     elif test -f "$winsdktest/Bin/al.exe"; then
5840         AL_PATH="$winsdktest/Bin"
5841     fi
5843     if test -z "$AL_PATH"; then
5844         find_al
5845         if test -f "$altest/bin/al.exe"; then
5846             AL_PATH="$altest/bin"
5847         elif test -f "$altest/al.exe"; then
5848             AL_PATH="$altest"
5849         fi
5850     fi
5851     if test ! -f "$AL_PATH/al.exe"; then
5852         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5853     else
5854         AC_MSG_RESULT([$AL_PATH/al.exe])
5855     fi
5857     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5859     dnl Check mscoree.lib / .NET Framework dir
5860     AC_MSG_CHECKING(.NET Framework)
5861     find_dotnetsdk46
5862     PathFormat "$frametest"
5863     frametest="$formatted_path"
5864     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5865         DOTNET_FRAMEWORK_HOME="$frametest"
5866     else
5867         find_winsdk
5868         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5869             DOTNET_FRAMEWORK_HOME="$winsdktest"
5870         fi
5871     fi
5872     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
5873         AC_MSG_ERROR([mscoree.lib not found])
5874     fi
5875     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5877     PathFormat "$MIDL_PATH"
5878     MIDL_PATH="$formatted_path"
5880     PathFormat "$AL_PATH"
5881     AL_PATH="$formatted_path"
5883     PathFormat "$DOTNET_FRAMEWORK_HOME"
5884     DOTNET_FRAMEWORK_HOME="$formatted_path"
5886     PathFormat "$CSC_PATH"
5887     CSC_PATH="$formatted_path"
5890 dnl ===================================================================
5891 dnl Check if stdc headers are available excluding MSVC.
5892 dnl ===================================================================
5893 if test "$_os" != "WINNT"; then
5894     AC_HEADER_STDC
5897 dnl ===================================================================
5898 dnl Testing for C++ compiler and version...
5899 dnl ===================================================================
5901 if test "$_os" != "WINNT"; then
5902     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5903     save_CXXFLAGS=$CXXFLAGS
5904     AC_PROG_CXX
5905     CXXFLAGS=$save_CXXFLAGS
5906     if test -z "$CXX_BASE"; then
5907         CXX_BASE=`first_arg_basename "$CXX"`
5908     fi
5911 dnl check for GNU C++ compiler version
5912 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5913     AC_MSG_CHECKING([the GNU C++ compiler version])
5915     _gpp_version=`$CXX -dumpversion`
5916     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5918     if test "$_gpp_majmin" -lt "700"; then
5919         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5920     else
5921         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5922     fi
5924     dnl see https://code.google.com/p/android/issues/detail?id=41770
5925         glibcxx_threads=no
5926         AC_LANG_PUSH([C++])
5927         AC_REQUIRE_CPP
5928         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5929         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5930             #include <bits/c++config.h>]],[[
5931             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5932             && !defined(_GLIBCXX__PTHREADS) \
5933             && !defined(_GLIBCXX_HAS_GTHREADS)
5934             choke me
5935             #endif
5936         ]])],[AC_MSG_RESULT([yes])
5937         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5938         AC_LANG_POP([C++])
5939         if test $glibcxx_threads = yes; then
5940             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5941         fi
5943 AC_SUBST(BOOST_CXXFLAGS)
5946 # prefx CXX with ccache if needed
5948 if test "$CCACHE" != ""; then
5949     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5950     AC_LANG_PUSH([C++])
5951     save_CXXFLAGS=$CXXFLAGS
5952     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5953     dnl an empty program will do, we're checking the compiler flags
5954     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5955                       [use_ccache=yes], [use_ccache=no])
5956     if test $use_ccache = yes; then
5957         AC_MSG_RESULT([yes])
5958     else
5959         CXX="$CCACHE $CXX"
5960         CXX_BASE="ccache $CXX_BASE"
5961         AC_MSG_RESULT([no])
5962     fi
5963     CXXFLAGS=$save_CXXFLAGS
5964     AC_LANG_POP([C++])
5967 dnl ===================================================================
5968 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5969 dnl ===================================================================
5971 if test "$_os" != "WINNT"; then
5972     AC_PROG_CXXCPP
5974     dnl Check whether there's a C pre-processor.
5975     AC_PROG_CPP
5979 dnl ===================================================================
5980 dnl Find integral type sizes and alignments
5981 dnl ===================================================================
5983 if test "$_os" != "WINNT"; then
5985 if test "$_os" = "iOS"; then
5986     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5987     ac_cv_sizeof_long=8
5988     ac_cv_sizeof_short=2
5989     ac_cv_sizeof_int=4
5990     ac_cv_sizeof_long_long=8
5991     ac_cv_sizeof_double=8
5992     ac_cv_sizeof_voidp=8
5993 else
5994     AC_CHECK_SIZEOF(long)
5995     AC_CHECK_SIZEOF(short)
5996     AC_CHECK_SIZEOF(int)
5997     AC_CHECK_SIZEOF(long long)
5998     AC_CHECK_SIZEOF(double)
5999     AC_CHECK_SIZEOF(void*)
6002     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6003     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6004     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6005     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6006     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6008     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6009     m4_pattern_allow([AC_CHECK_ALIGNOF])
6010     m4_ifdef([AC_CHECK_ALIGNOF],
6011         [
6012             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6013             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6014             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6015             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6016         ],
6017         [
6018             case "$_os-$host_cpu" in
6019             Linux-i686)
6020                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6021                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6022                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6023                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6024                 ;;
6025             Linux-x86_64)
6026                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6027                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6028                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6029                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6030                 ;;
6031             *)
6032                 if test -z "$ac_cv_alignof_short" -o \
6033                         -z "$ac_cv_alignof_int" -o \
6034                         -z "$ac_cv_alignof_long" -o \
6035                         -z "$ac_cv_alignof_double"; then
6036                    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.])
6037                 fi
6038                 ;;
6039             esac
6040         ])
6042     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6043     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6044     if test $ac_cv_sizeof_long -eq 8; then
6045         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6046     elif test $ac_cv_sizeof_double -eq 8; then
6047         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6048     else
6049         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6050     fi
6052     dnl Check for large file support
6053     AC_SYS_LARGEFILE
6054     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6055         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6056     fi
6057     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6058         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6059     fi
6060 else
6061     # Hardcode for MSVC
6062     SAL_TYPES_SIZEOFSHORT=2
6063     SAL_TYPES_SIZEOFINT=4
6064     SAL_TYPES_SIZEOFLONG=4
6065     SAL_TYPES_SIZEOFLONGLONG=8
6066     if test "$BITNESS_OVERRIDE" = ""; then
6067         SAL_TYPES_SIZEOFPOINTER=4
6068     else
6069         SAL_TYPES_SIZEOFPOINTER=8
6070     fi
6071     SAL_TYPES_ALIGNMENT2=2
6072     SAL_TYPES_ALIGNMENT4=4
6073     SAL_TYPES_ALIGNMENT8=8
6074     LFS_CFLAGS=''
6076 AC_SUBST(LFS_CFLAGS)
6078 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6079 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6080 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6081 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6082 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6083 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6084 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6085 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6087 dnl ===================================================================
6088 dnl Check whether to enable runtime optimizations
6089 dnl ===================================================================
6090 ENABLE_RUNTIME_OPTIMIZATIONS=
6091 AC_MSG_CHECKING([whether to enable runtime optimizations])
6092 if test -z "$enable_runtime_optimizations"; then
6093     for i in $CC; do
6094         case $i in
6095         -fsanitize=*)
6096             enable_runtime_optimizations=no
6097             break
6098             ;;
6099         esac
6100     done
6102 if test "$enable_runtime_optimizations" != no; then
6103     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6104     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6105     AC_MSG_RESULT([yes])
6106 else
6107     AC_MSG_RESULT([no])
6109 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6111 dnl ===================================================================
6112 dnl Check if valgrind headers are available
6113 dnl ===================================================================
6114 ENABLE_VALGRIND=
6115 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6116     prev_cppflags=$CPPFLAGS
6117     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6118     # or where does it come from?
6119     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6120     AC_CHECK_HEADER([valgrind/valgrind.h],
6121         [ENABLE_VALGRIND=TRUE])
6122     CPPFLAGS=$prev_cppflags
6124 AC_SUBST([ENABLE_VALGRIND])
6125 if test -z "$ENABLE_VALGRIND"; then
6126     if test "$with_valgrind" = yes; then
6127         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6128     fi
6129     VALGRIND_CFLAGS=
6131 AC_SUBST([VALGRIND_CFLAGS])
6134 dnl ===================================================================
6135 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6136 dnl ===================================================================
6138 # We need at least the sys/sdt.h include header.
6139 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6140 if test "$SDT_H_FOUND" = "TRUE"; then
6141     # Found sys/sdt.h header, now make sure the c++ compiler works.
6142     # Old g++ versions had problems with probes in constructors/destructors.
6143     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6144     AC_LANG_PUSH([C++])
6145     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6146     #include <sys/sdt.h>
6147     class ProbeClass
6148     {
6149     private:
6150       int& ref;
6151       const char *name;
6153     public:
6154       ProbeClass(int& v, const char *n) : ref(v), name(n)
6155       {
6156         DTRACE_PROBE2(_test_, cons, name, ref);
6157       }
6159       void method(int min)
6160       {
6161         DTRACE_PROBE3(_test_, meth, name, ref, min);
6162         ref -= min;
6163       }
6165       ~ProbeClass()
6166       {
6167         DTRACE_PROBE2(_test_, dest, name, ref);
6168       }
6169     };
6170     ]],[[
6171     int i = 64;
6172     DTRACE_PROBE1(_test_, call, i);
6173     ProbeClass inst = ProbeClass(i, "call");
6174     inst.method(24);
6175     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6176           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6177     AC_LANG_POP([C++])
6179 AC_CONFIG_HEADERS([config_host/config_probes.h])
6181 dnl ===================================================================
6182 dnl GCC features
6183 dnl ===================================================================
6184 HAVE_GCC_STACK_CLASH_PROTECTION=
6185 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6186     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6187     save_CFLAGS=$CFLAGS
6188     CFLAGS="$CFLAGS -fstack-clash-protection"
6189     AC_LINK_IFELSE(
6190         [AC_LANG_PROGRAM(, [[return 0;]])],
6191         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6192         [AC_MSG_RESULT([no])])
6193     CFLAGS=$save_CFLAGS
6195     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6196     save_CFLAGS=$CFLAGS
6197     CFLAGS="$CFLAGS -Werror -mno-avx"
6198     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6199     CFLAGS=$save_CFLAGS
6200     if test "$HAVE_GCC_AVX" = "TRUE"; then
6201         AC_MSG_RESULT([yes])
6202     else
6203         AC_MSG_RESULT([no])
6204     fi
6206     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6207     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6208     int v = 0;
6209     if (__sync_add_and_fetch(&v, 1) != 1 ||
6210         __sync_sub_and_fetch(&v, 1) != 0)
6211         return 1;
6212     __sync_synchronize();
6213     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6214         v != 1)
6215         return 1;
6216     return 0;
6217 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6218     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6219         AC_MSG_RESULT([yes])
6220         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6221     else
6222         AC_MSG_RESULT([no])
6223     fi
6225     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6226     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6227     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6228         AC_MSG_RESULT([yes])
6229         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6230     else
6231         AC_MSG_RESULT([no])
6232     fi
6234     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6235     save_CFLAGS=$CFLAGS
6236     CFLAGS="$CFLAGS -Werror"
6237     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6238             __attribute__((deprecated("test"))) void f();
6239         ])], [
6240             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6241             AC_MSG_RESULT([yes])
6242         ], [AC_MSG_RESULT([no])])
6243     CFLAGS=$save_CFLAGS
6245     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6246     AC_LANG_PUSH([C++])
6247     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6248             #include <cstddef>
6249             #include <cxxabi.h>
6250             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6251         ])], [
6252             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6253             AC_MSG_RESULT([yes])
6254         ], [AC_MSG_RESULT([no])])
6255     AC_LANG_POP([C++])
6257     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6258     AC_LANG_PUSH([C++])
6259     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6260             #include <cstddef>
6261             #include <cxxabi.h>
6262             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6263         ])], [
6264             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6265             AC_MSG_RESULT([yes])
6266         ], [AC_MSG_RESULT([no])])
6267     AC_LANG_POP([C++])
6269     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6270     AC_LANG_PUSH([C++])
6271     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6272             #include <cxxabi.h>
6273             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6274         ])], [
6275             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6276             AC_MSG_RESULT([yes])
6277         ], [AC_MSG_RESULT([no])])
6278     AC_LANG_POP([C++])
6280     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6281     AC_LANG_PUSH([C++])
6282     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6283             #include <cstddef>
6284             #include <cxxabi.h>
6285             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6286         ])], [
6287             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6288             AC_MSG_RESULT([yes])
6289         ], [AC_MSG_RESULT([no])])
6290     AC_LANG_POP([C++])
6292     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6293     AC_LANG_PUSH([C++])
6294     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6295             #include <cstddef>
6296             #include <cxxabi.h>
6297             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6298         ])], [
6299             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6300             AC_MSG_RESULT([yes])
6301         ], [AC_MSG_RESULT([no])])
6302     AC_LANG_POP([C++])
6304     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6305     AC_LANG_PUSH([C++])
6306     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6307             #include <cxxabi.h>
6308             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6309         ])], [
6310             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6311             AC_MSG_RESULT([yes])
6312         ], [AC_MSG_RESULT([no])])
6313     AC_LANG_POP([C++])
6315     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6316     AC_LANG_PUSH([C++])
6317     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6318             #include <cxxabi.h>
6319             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6320         ])], [
6321             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6322             AC_MSG_RESULT([yes])
6323         ], [AC_MSG_RESULT([no])])
6324     AC_LANG_POP([C++])
6326     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6327     AC_LANG_PUSH([C++])
6328     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6329             #include <cxxabi.h>
6330             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6331         ])], [
6332             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6333             AC_MSG_RESULT([yes])
6334         ], [AC_MSG_RESULT([no])])
6335     AC_LANG_POP([C++])
6337     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6338     AC_LANG_PUSH([C++])
6339     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6340             #include <cstddef>
6341             #include <cxxabi.h>
6342             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6343         ])], [
6344             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6345             AC_MSG_RESULT([yes])
6346         ], [AC_MSG_RESULT([no])])
6347     AC_LANG_POP([C++])
6349     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6350     AC_LANG_PUSH([C++])
6351     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6352             #include <cstddef>
6353             #include <cxxabi.h>
6354             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6355         ])], [
6356             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6357             AC_MSG_RESULT([yes])
6358         ], [AC_MSG_RESULT([no])])
6359     AC_LANG_POP([C++])
6361     dnl Available in GCC 4.9 and at least since Clang 3.4:
6362     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6363     AC_LANG_PUSH([C++])
6364     save_CXXFLAGS=$CXXFLAGS
6365     CXXFLAGS="$CXXFLAGS -Werror"
6366     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6367             struct __attribute__((warn_unused)) dummy {};
6368         ])], [
6369             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6370             AC_MSG_RESULT([yes])
6371         ], [AC_MSG_RESULT([no])])
6372     CXXFLAGS=$save_CXXFLAGS
6373 AC_LANG_POP([C++])
6376 AC_SUBST(HAVE_GCC_AVX)
6377 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6378 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6379 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6381 dnl ===================================================================
6382 dnl Identify the C++ library
6383 dnl ===================================================================
6385 AC_MSG_CHECKING([what the C++ library is])
6386 AC_LANG_PUSH([C++])
6387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6388 #include <utility>
6389 #ifndef __GLIBCXX__
6390 foo bar
6391 #endif
6392 ]])],
6393     [CPP_LIBRARY=GLIBCXX
6394      cpp_library_name="GNU libstdc++"
6395     ],
6396     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6397 #include <utility>
6398 #ifndef _LIBCPP_VERSION
6399 foo bar
6400 #endif
6401 ]])],
6402     [CPP_LIBRARY=LIBCPP
6403      cpp_library_name="LLVM libc++"
6404      AC_DEFINE([HAVE_LIBCXX])
6405     ],
6406     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6407 #include <utility>
6408 #ifndef _MSC_VER
6409 foo bar
6410 #endif
6411 ]])],
6412     [CPP_LIBRARY=MSVCRT
6413      cpp_library_name="Microsoft"
6414     ],
6415     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6416 AC_MSG_RESULT([$cpp_library_name])
6417 AC_LANG_POP([C++])
6419 dnl ===================================================================
6420 dnl Check for gperf
6421 dnl ===================================================================
6422 AC_PATH_PROG(GPERF, gperf)
6423 if test -z "$GPERF"; then
6424     AC_MSG_ERROR([gperf not found but needed. Install it.])
6426 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6427     GPERF=`cygpath -m $GPERF`
6429 AC_MSG_CHECKING([whether gperf is new enough])
6430 my_gperf_ver1=$($GPERF --version | head -n 1)
6431 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6432 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6433 if test "$my_gperf_ver3" -ge 301; then
6434     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6435 else
6436     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6438 AC_SUBST(GPERF)
6440 dnl ===================================================================
6441 dnl Check for system libcmis
6442 dnl ===================================================================
6443 # libcmis requires curl and we can't build curl for iOS
6444 if test $_os != iOS; then
6445     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6446     ENABLE_LIBCMIS=TRUE
6447 else
6448     ENABLE_LIBCMIS=
6450 AC_SUBST(ENABLE_LIBCMIS)
6452 dnl ===================================================================
6453 dnl C++11
6454 dnl ===================================================================
6456 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6457 CXXFLAGS_CXX11=
6458 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6459     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6460 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6461     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6462     for flag in $my_flags; do
6463         if test "$COM" = MSC; then
6464             flag="-Xclang $flag"
6465         fi
6466         save_CXXFLAGS=$CXXFLAGS
6467         CXXFLAGS="$CXXFLAGS $flag -Werror"
6468         if test "$SYSTEM_LIBCMIS" = TRUE; then
6469             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6470         fi
6471         AC_LANG_PUSH([C++])
6472         dnl Clang 3.9 supports __float128 since
6473         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6474         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6475         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6476         dnl $flag is supported below, so check this first):
6477         my_float128hack=
6478         my_float128hack_impl=-D__float128=void
6479         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6480             #include <vector>
6481             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6482             // (__float128)
6483             ]])
6484         ],,[
6485             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6486             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6487             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6488             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6489             dnl place where __float128 is used is in a template specialization, -D__float128=void
6490             dnl will avoid the problem there while still causing a problem if somebody actually uses
6491             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6492             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6493             dnl "fixed" with this hack):
6494             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6495             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6496                 #include <vector>
6497                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6498                 // (__float128)
6499                 ]])
6500             ],[my_float128hack=$my_float128hack_impl])
6501         ])
6502         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6503             #include <algorithm>
6504             #include <functional>
6505             #include <vector>
6507             #if defined SYSTEM_LIBCMIS
6508             // See ucb/source/ucp/cmis/auth_provider.hxx:
6509             #if !defined __clang__
6510             #pragma GCC diagnostic push
6511             #pragma GCC diagnostic ignored "-Wdeprecated"
6512             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6513             #endif
6514             #include <libcmis/libcmis.hxx>
6515             #if !defined __clang__
6516             #pragma GCC diagnostic pop
6517             #endif
6518             #endif
6520             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6521                 std::sort(v.begin(), v.end(), fn);
6522             }
6523             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6524         AC_LANG_POP([C++])
6525         CXXFLAGS=$save_CXXFLAGS
6526         if test -n "$CXXFLAGS_CXX11"; then
6527             break
6528         fi
6529     done
6531 if test -n "$CXXFLAGS_CXX11"; then
6532     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6533 else
6534     AC_MSG_ERROR(no)
6536 AC_SUBST(CXXFLAGS_CXX11)
6538 if test "$GCC" = "yes"; then
6539     save_CXXFLAGS=$CXXFLAGS
6540     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6541     CHECK_L_ATOMIC
6542     CXXFLAGS=$save_CXXFLAGS
6543     AC_SUBST(ATOMIC_LIB)
6546 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6547 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6548 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6549 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6550 dnl again towards 4.7.2:
6551 if test $CPP_LIBRARY = GLIBCXX; then
6552     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6553     AC_LANG_PUSH([C++])
6554     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6555 #include <list>
6556 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6557     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6558     //   GCC 4.7.0: 20120322
6559     //   GCC 4.7.1: 20120614
6560     // and using a range check is not possible as the mapping between
6561     // __GLIBCXX__ values and GCC versions is not monotonic
6562 /* ok */
6563 #else
6564 abi broken
6565 #endif
6566         ]])], [AC_MSG_RESULT(no, ok)],
6567         [AC_MSG_ERROR(yes)])
6568     AC_LANG_POP([C++])
6571 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6572 save_CXXFLAGS=$CXXFLAGS
6573 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6574 AC_LANG_PUSH([C++])
6576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6577 #include <stddef.h>
6579 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6581 namespace
6583         struct b
6584         {
6585                 int i;
6586                 int j;
6587         };
6589 ]], [[
6590 struct a
6592         int i;
6593         int j;
6595 a thinga[]={{0,0}, {1,1}};
6596 b thingb[]={{0,0}, {1,1}};
6597 size_t i = sizeof(sal_n_array_size(thinga));
6598 size_t j = sizeof(sal_n_array_size(thingb));
6599 return !(i != 0 && j != 0);
6601     ], [ AC_MSG_RESULT(yes) ],
6602     [ AC_MSG_ERROR(no)])
6603 AC_LANG_POP([C++])
6604 CXXFLAGS=$save_CXXFLAGS
6606 dnl _Pragma support (may require C++11)
6607 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6608     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6609     AC_LANG_PUSH([C++])
6610     save_CXXFLAGS=$CXXFLAGS
6611     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6612     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6613             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6614         ])], [
6615             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6616             AC_MSG_RESULT([yes])
6617         ], [AC_MSG_RESULT([no])])
6618     AC_LANG_POP([C++])
6619     CXXFLAGS=$save_CXXFLAGS
6622 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6623 if test "$GCC" = yes; then
6624     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6625     AC_LANG_PUSH([C++])
6626     save_CXXFLAGS=$CXXFLAGS
6627     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6628     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6629     CXXFLAGS=$save_CXXFLAGS
6630     AC_LANG_POP([C++])
6631     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6632         AC_MSG_RESULT([yes])
6633     else
6634         AC_MSG_RESULT([no])
6635     fi
6637 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6639 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6640 AC_LANG_PUSH([C++])
6641 save_CXXFLAGS=$CXXFLAGS
6642 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6643 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6644         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6645         // supporting it:
6646         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6647         struct S {
6648         private:
6649             S(S const &);
6650         public:
6651             S();
6652             ~S();
6653         };
6654         S copy();
6655         void f() { S c(copy()); }
6656         #endif
6657     ])], [
6658         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6659         AC_MSG_RESULT([yes])
6660     ], [AC_MSG_RESULT([no])])
6661 CXXFLAGS=$save_CXXFLAGS
6662 AC_LANG_POP([C++])
6664 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6665 AC_LANG_PUSH([C++])
6666 save_CXXFLAGS=$CXXFLAGS
6667 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6668 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6669         #include <algorithm>
6670         #include <initializer_list>
6671         #include <vector>
6672         template<typename T> class S {
6673         private:
6674             std::vector<T> v_;
6675         public:
6676             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6677         };
6678         constinit S<int> s{3, 2, 1};
6679     ])], [
6680         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6681         AC_MSG_RESULT([yes])
6682     ], [AC_MSG_RESULT([no])])
6683 CXXFLAGS=$save_CXXFLAGS
6684 AC_LANG_POP([C++])
6686 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6687 AC_LANG_PUSH([C++])
6688 save_CXXFLAGS=$CXXFLAGS
6689 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6690 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6691         #include <span>
6692         #include <type_traits>
6693         // Don't check size_type directly, as it was called index_type before P1872R0:
6694         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6695     ])], [
6696         AC_DEFINE([HAVE_CPP_SPAN],[1])
6697         AC_MSG_RESULT([yes])
6698     ], [AC_MSG_RESULT([no])])
6699 CXXFLAGS=$save_CXXFLAGS
6700 AC_LANG_POP([C++])
6702 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6703 AC_LANG_PUSH([C++])
6704 save_CXXFLAGS=$CXXFLAGS
6705 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6706 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6707         struct S1 { S1(S1 &&); };
6708         struct S2: S1 {};
6709         S1 f(S2 s) { return s; }
6710     ])], [
6711         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6712         AC_MSG_RESULT([yes])
6713     ], [AC_MSG_RESULT([no])])
6714 CXXFLAGS=$save_CXXFLAGS
6715 AC_LANG_POP([C++])
6717 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6718 dnl uninitialized warning for code like
6720 dnl   OString f();
6721 dnl   boost::optional<OString> * g(bool b) {
6722 dnl       boost::optional<OString> o;
6723 dnl       if (b) o = f();
6724 dnl       return new boost::optional<OString>(o);
6725 dnl   }
6727 dnl (as is e.g. present, in a slightly more elaborate form, in
6728 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6729 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6730 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6731 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6732     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6733     AC_LANG_PUSH([C++])
6734     save_CXXFLAGS=$CXXFLAGS
6735     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6736     if test "$ENABLE_OPTIMIZED" = TRUE; then
6737         CXXFLAGS="$CXXFLAGS -O2"
6738     else
6739         CXXFLAGS="$CXXFLAGS -O0"
6740     fi
6741     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6742             #include <new>
6743             void f1(int);
6744             struct S1 {
6745                 ~S1() { f1(n); }
6746                 int n = 0;
6747             };
6748             struct S2 {
6749                 S2() {}
6750                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6751                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6752                 void set(S1 s) {
6753                     new (stg) S1(s);
6754                     init = true;
6755                 }
6756                 bool init = false;
6757                 char stg[sizeof (S1)];
6758             } ;
6759             S1 f2();
6760             S2 * f3(bool b) {
6761                 S2 o;
6762                 if (b) o.set(f2());
6763                 return new S2(o);
6764             }
6765         ]])], [AC_MSG_RESULT([no])], [
6766             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6767             AC_MSG_RESULT([yes])
6768         ])
6769     CXXFLAGS=$save_CXXFLAGS
6770     AC_LANG_POP([C++])
6772 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6774 dnl ===================================================================
6775 dnl CPU Intrinsics support - SSE, AVX
6776 dnl ===================================================================
6778 INTRINSICS_CXXFLAGS=""
6780 if test "$GCC" = "yes"; then
6781     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6782     AC_LANG_PUSH([C++])
6783     save_CXXFLAGS=$CXXFLAGS
6784     CXXFLAGS="$CXXFLAGS -msse2"
6785     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6786         #include <emmintrin.h>
6787         int main () {
6788             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6789             c = _mm_xor_si128 (a, b);
6790             return 0;
6791         }
6792         ])],
6793         [can_compile_sse2=yes],
6794         [can_compile_sse2=no])
6795     AC_LANG_POP([C++])
6796     CXXFLAGS=$save_CXXFLAGS
6797     AC_MSG_RESULT([${can_compile_sse2}])
6798     if test "${can_compile_sse2}" = "yes" ; then
6799         INTRINSICS_CXXFLAGS="-msse2"
6800     else
6801         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6802     fi
6804     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6805     AC_LANG_PUSH([C++])
6806     save_CXXFLAGS=$CXXFLAGS
6807     CXXFLAGS="$CXXFLAGS -mssse3"
6808     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6809         #include <tmmintrin.h>
6810         int main () {
6811             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6812             c = _mm_maddubs_epi16 (a, b);
6813             return 0;
6814         }
6815         ])],
6816         [can_compile_ssse3=yes],
6817         [can_compile_ssse3=no])
6818     AC_LANG_POP([C++])
6819     CXXFLAGS=$save_CXXFLAGS
6820     AC_MSG_RESULT([${can_compile_ssse3}])
6821     if test "${can_compile_ssse3}" = "yes" ; then
6822         INTRINSICS_CXXFLAGS="-mssse3"
6823     else
6824         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6825     fi
6827     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6828     AC_LANG_PUSH([C++])
6829     save_CXXFLAGS=$CXXFLAGS
6830     CXXFLAGS="$CXXFLAGS -mavx"
6831     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6832         #include <immintrin.h>
6833         int main () {
6834             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6835             c = _mm256_xor_ps(a, b);
6836             return 0;
6837         }
6838         ])],
6839         [can_compile_avx=yes],
6840         [can_compile_avx=no])
6841     AC_LANG_POP([C++])
6842     CXXFLAGS=$save_CXXFLAGS
6843     AC_MSG_RESULT([${can_compile_avx}])
6844     if test "${can_compile_avx}" = "yes" ; then
6845         INTRINSICS_CXXFLAGS="-mavx"
6846     else
6847         AC_MSG_WARN([cannot compile AVX intrinsics])
6848     fi
6850     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6851     AC_LANG_PUSH([C++])
6852     save_CXXFLAGS=$CXXFLAGS
6853     CXXFLAGS="$CXXFLAGS -mavx2"
6854     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6855         #include <immintrin.h>
6856         int main () {
6857             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6858             c = _mm256_maddubs_epi16(a, b);
6859             return 0;
6860         }
6861         ])],
6862         [can_compile_avx2=yes],
6863         [can_compile_avx2=no])
6864     AC_LANG_POP([C++])
6865     CXXFLAGS=$save_CXXFLAGS
6866     AC_MSG_RESULT([${can_compile_avx2}])
6867     if test "${can_compile_avx2}" = "yes" ; then
6868         INTRINSICS_CXXFLAGS="-mavx2"
6869     else
6870         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6871     fi
6874 AC_SUBST([INTRINSICS_CXXFLAGS])
6876 dnl ===================================================================
6877 dnl system stl sanity tests
6878 dnl ===================================================================
6879 if test "$_os" != "WINNT"; then
6881     AC_LANG_PUSH([C++])
6883     save_CPPFLAGS="$CPPFLAGS"
6884     if test -n "$MACOSX_SDK_PATH"; then
6885         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6886     fi
6888     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6889     # only.
6890     if test "$CPP_LIBRARY" = GLIBCXX; then
6891         dnl gcc#19664, gcc#22482, rhbz#162935
6892         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6893         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6894         AC_MSG_RESULT([$stlvisok])
6895         if test "$stlvisok" = "no"; then
6896             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6897         fi
6898     fi
6900     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6901     # when we don't make any dynamic libraries?
6902     if test "$DISABLE_DYNLOADING" = ""; then
6903         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6904         cat > conftestlib1.cc <<_ACEOF
6905 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6906 struct S2: S1<int> { virtual ~S2(); };
6907 S2::~S2() {}
6908 _ACEOF
6909         cat > conftestlib2.cc <<_ACEOF
6910 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6911 struct S2: S1<int> { virtual ~S2(); };
6912 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6913 _ACEOF
6914         gccvisinlineshiddenok=yes
6915         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6916             gccvisinlineshiddenok=no
6917         else
6918             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6919             dnl known to not work with -z defs (unsetting which makes the test
6920             dnl moot, though):
6921             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6922             if test "$COM_IS_CLANG" = TRUE; then
6923                 for i in $CXX $CXXFLAGS; do
6924                     case $i in
6925                     -fsanitize=*)
6926                         my_linkflagsnoundefs=
6927                         break
6928                         ;;
6929                     esac
6930                 done
6931             fi
6932             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6933                 gccvisinlineshiddenok=no
6934             fi
6935         fi
6937         rm -fr libconftest*
6938         AC_MSG_RESULT([$gccvisinlineshiddenok])
6939         if test "$gccvisinlineshiddenok" = "no"; then
6940             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6941         fi
6942     fi
6944    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6945     cat >visibility.cxx <<_ACEOF
6946 #pragma GCC visibility push(hidden)
6947 struct __attribute__ ((visibility ("default"))) TestStruct {
6948   static void Init();
6950 __attribute__ ((visibility ("default"))) void TestFunc() {
6951   TestStruct::Init();
6953 _ACEOF
6954     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6955         gccvisbroken=yes
6956     else
6957         case "$host_cpu" in
6958         i?86|x86_64)
6959             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6960                 gccvisbroken=no
6961             else
6962                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6963                     gccvisbroken=no
6964                 else
6965                     gccvisbroken=yes
6966                 fi
6967             fi
6968             ;;
6969         *)
6970             gccvisbroken=no
6971             ;;
6972         esac
6973     fi
6974     rm -f visibility.s visibility.cxx
6976     AC_MSG_RESULT([$gccvisbroken])
6977     if test "$gccvisbroken" = "yes"; then
6978         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6979     fi
6981     CPPFLAGS="$save_CPPFLAGS"
6983     AC_LANG_POP([C++])
6986 dnl ===================================================================
6987 dnl  Clang++ tests
6988 dnl ===================================================================
6990 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6991 if test "$GCC" = "yes"; then
6992     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6993     AC_LANG_PUSH([C++])
6994     save_CXXFLAGS=$CXXFLAGS
6995     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6996     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6997     CXXFLAGS=$save_CXXFLAGS
6998     AC_LANG_POP([C++])
6999     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7000         AC_MSG_RESULT([yes])
7001     else
7002         AC_MSG_RESULT([no])
7003     fi
7005 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7007 dnl ===================================================================
7008 dnl Compiler plugins
7009 dnl ===================================================================
7011 COMPILER_PLUGINS=
7012 # currently only Clang
7014 if test "$COM_IS_CLANG" != "TRUE"; then
7015     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7016         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7017         enable_compiler_plugins=no
7018     fi
7021 if test "$COM_IS_CLANG" = "TRUE"; then
7022     if test -n "$enable_compiler_plugins"; then
7023         compiler_plugins="$enable_compiler_plugins"
7024     elif test -n "$ENABLE_DBGUTIL"; then
7025         compiler_plugins=test
7026     else
7027         compiler_plugins=no
7028     fi
7029     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7030         if test "$CLANGVER" -lt 50002; then
7031             if test "$compiler_plugins" = yes; then
7032                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7033             else
7034                 compiler_plugins=no
7035             fi
7036         fi
7037     fi
7038     if test "$compiler_plugins" != "no"; then
7039         dnl The prefix where Clang resides, override to where Clang resides if
7040         dnl using a source build:
7041         if test -z "$CLANGDIR"; then
7042             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7043         fi
7044         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7045         if test -z "$COMPILER_PLUGINS_CXX"; then
7046             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7047         fi
7048         clangbindir=$CLANGDIR/bin
7049         if test "$build_os" = "cygwin"; then
7050             clangbindir=$(cygpath -u "$clangbindir")
7051         fi
7052         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7053         if test -n "$LLVM_CONFIG"; then
7054             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7055             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7056             if test -z "$CLANGLIBDIR"; then
7057                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7058             fi
7059             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7060             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7061             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7062             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7063                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7064             fi
7065             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7066             clangobjdir=$($LLVM_CONFIG --obj-root)
7067             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7068                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7069             fi
7070         fi
7071         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7072         AC_LANG_PUSH([C++])
7073         save_CXX=$CXX
7074         save_CXXCPP=$CXXCPP
7075         save_CPPFLAGS=$CPPFLAGS
7076         save_CXXFLAGS=$CXXFLAGS
7077         save_LDFLAGS=$LDFLAGS
7078         save_LIBS=$LIBS
7079         CXX=$COMPILER_PLUGINS_CXX
7080         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7081         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7082         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7083         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7084             [COMPILER_PLUGINS=TRUE],
7085             [
7086             if test "$compiler_plugins" = "yes"; then
7087                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7088             else
7089                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7090                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7091             fi
7092             ])
7093         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7094         dnl comment in compilerplugins/Makefile-clang.mk:
7095         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7096             LDFLAGS=""
7097             AC_MSG_CHECKING([for clang libraries to use])
7098             if test -z "$CLANGTOOLLIBS"; then
7099                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7100  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7101                 AC_LINK_IFELSE([
7102                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7103                         [[ clang::FullSourceLoc().dump(); ]])
7104                 ],[CLANGTOOLLIBS="$LIBS"],[])
7105             fi
7106             if test -z "$CLANGTOOLLIBS"; then
7107                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7108                 AC_LINK_IFELSE([
7109                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7110                         [[ clang::FullSourceLoc().dump(); ]])
7111                 ],[CLANGTOOLLIBS="$LIBS"],[])
7112             fi
7113             AC_MSG_RESULT([$CLANGTOOLLIBS])
7114             if test -z "$CLANGTOOLLIBS"; then
7115                 if test "$compiler_plugins" = "yes"; then
7116                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7117                 else
7118                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7119                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7120                 fi
7121                 COMPILER_PLUGINS=
7122             fi
7123             if test -n "$COMPILER_PLUGINS"; then
7124                 if test -z "$CLANGSYSINCLUDE"; then
7125                     if test -n "$LLVM_CONFIG"; then
7126                         # Path to the clang system headers (no idea if there's a better way to get it).
7127                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7128                     fi
7129                 fi
7130             fi
7131         fi
7132         CXX=$save_CXX
7133         CXXCPP=$save_CXXCPP
7134         CPPFLAGS=$save_CPPFLAGS
7135         CXXFLAGS=$save_CXXFLAGS
7136         LDFLAGS=$save_LDFLAGS
7137         LIBS="$save_LIBS"
7138         AC_LANG_POP([C++])
7139     fi
7140 else
7141     if test "$enable_compiler_plugins" = "yes"; then
7142         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7143     fi
7145 AC_SUBST(COMPILER_PLUGINS)
7146 AC_SUBST(COMPILER_PLUGINS_CXX)
7147 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7148 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7149 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7150 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7151 AC_SUBST(CLANGDIR)
7152 AC_SUBST(CLANGLIBDIR)
7153 AC_SUBST(CLANGTOOLLIBS)
7154 AC_SUBST(CLANGSYSINCLUDE)
7156 # Plugin to help linker.
7157 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7158 # This makes --enable-lto build with clang work.
7159 AC_SUBST(LD_PLUGIN)
7161 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7162 AC_SUBST(HAVE_POSIX_FALLOCATE)
7164 dnl ===================================================================
7165 dnl Custom build version
7166 dnl ===================================================================
7168 AC_MSG_CHECKING([whether to add custom build version])
7169 if test "$with_build_version" != ""; then
7170     BUILD_VER_STRING=$with_build_version
7171     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7172 else
7173     BUILD_VER_STRING=
7174     AC_MSG_RESULT([no])
7176 AC_SUBST(BUILD_VER_STRING)
7178 JITC_PROCESSOR_TYPE=""
7179 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7180     # IBMs JDK needs this...
7181     JITC_PROCESSOR_TYPE=6
7182     export JITC_PROCESSOR_TYPE
7184 AC_SUBST([JITC_PROCESSOR_TYPE])
7186 # Misc Windows Stuff
7187 AC_ARG_WITH(ucrt-dir,
7188     AS_HELP_STRING([--with-ucrt-dir],
7189         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7190         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7191         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7192             Windows6.1-KB2999226-x64.msu
7193             Windows6.1-KB2999226-x86.msu
7194             Windows8.1-KB2999226-x64.msu
7195             Windows8.1-KB2999226-x86.msu
7196             Windows8-RT-KB2999226-x64.msu
7197             Windows8-RT-KB2999226-x86.msu
7198         A zip archive including those files is available from Microsoft site:
7199         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7201 UCRT_REDISTDIR="$with_ucrt_dir"
7202 if test $_os = "WINNT"; then
7203     find_msvc_x64_dlls
7204     find_msms
7205     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7206     MSVC_DLLS="$msvcdlls"
7207     MSM_PATH=`win_short_path_for_make "$msmdir"`
7208     # MSVC 15.3 changed it to VC141
7209     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7210         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7211     else
7212         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7213     fi
7215     if test "$UCRT_REDISTDIR" = "no"; then
7216         dnl explicitly disabled
7217         UCRT_REDISTDIR=""
7218     else
7219         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7220                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7221                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7222                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7223                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7224                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7225             UCRT_REDISTDIR=""
7226             if test -n "$PKGFORMAT"; then
7227                for i in $PKGFORMAT; do
7228                    case "$i" in
7229                    msi)
7230                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7231                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7232                        ;;
7233                    esac
7234                done
7235             fi
7236         fi
7237     fi
7240 AC_SUBST(UCRT_REDISTDIR)
7241 AC_SUBST(MSVC_DLL_PATH)
7242 AC_SUBST(MSVC_DLLS)
7243 AC_SUBST(MSM_PATH)
7245 dnl ===================================================================
7246 dnl Checks for Java
7247 dnl ===================================================================
7248 if test "$ENABLE_JAVA" != ""; then
7250     # Windows-specific tests
7251     if test "$build_os" = "cygwin"; then
7252         if test "$BITNESS_OVERRIDE" = 64; then
7253             bitness=64
7254         else
7255             bitness=32
7256         fi
7258         if test -z "$with_jdk_home"; then
7259             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7260             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7261             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7262             if test -n "$regvalue"; then
7263                 ver=$regvalue
7264                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7265                 _jdk_home=$regvalue
7266             fi
7267             if test -z "$with_jdk_home"; then
7268                 for ver in 1.8; do
7269                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7270                     if test -n "$regvalue"; then
7271                         _jdk_home=$regvalue
7272                         break
7273                     fi
7274                 done
7275             fi
7276             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7277                 with_jdk_home="$_jdk_home"
7278                 howfound="found automatically"
7279             else
7280                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7281             fi
7282         else
7283             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7284             howfound="you passed"
7285         fi
7286     fi
7288     # 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.
7289     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7290     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7291         with_jdk_home=`/usr/libexec/java_home`
7292     fi
7294     JAVA_HOME=; export JAVA_HOME
7295     if test -z "$with_jdk_home"; then
7296         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7297     else
7298         _java_path="$with_jdk_home/bin/$with_java"
7299         dnl Check if there is a Java interpreter at all.
7300         if test -x "$_java_path"; then
7301             JAVAINTERPRETER=$_java_path
7302         else
7303             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7304         fi
7305     fi
7307     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7308     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7309     dnl loaded by java to run JunitTests:
7310     if test "$build_os" = "cygwin"; then
7311         shortjdkhome=`cygpath -d "$with_jdk_home"`
7312         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
7313             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7314             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7315         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
7316             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7317             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7318         fi
7320         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7321             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7322         fi
7323         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7324     elif test "$cross_compiling" != "yes"; then
7325         case $CPUNAME in
7326             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7327                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7328                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7329                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7330                 fi
7331                 ;;
7332             *) # assumption: everything else 32-bit
7333                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7334                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7335                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7336                 fi
7337                 ;;
7338         esac
7339     fi
7342 dnl ===================================================================
7343 dnl Checks for JDK.
7344 dnl ===================================================================
7346 # Note that JAVA_HOME as for now always means the *build* platform's
7347 # JAVA_HOME. Whether all the complexity here actually is needed any
7348 # more or not, no idea.
7350 if test "$ENABLE_JAVA" != ""; then
7351     _gij_longver=0
7352     AC_MSG_CHECKING([the installed JDK])
7353     if test -n "$JAVAINTERPRETER"; then
7354         dnl java -version sends output to stderr!
7355         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7356             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7357         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7358             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7359         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7360             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7361         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7362             JDK=ibm
7364             dnl IBM JDK specific tests
7365             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7366             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7368             if test "$_jdk_ver" -lt 10800; then
7369                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7370             fi
7372             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7374             if test "$with_jdk_home" = ""; then
7375                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7376 you must use the "--with-jdk-home" configure option explicitly])
7377             fi
7379             JAVA_HOME=$with_jdk_home
7380         else
7381             JDK=sun
7383             dnl Sun JDK specific tests
7384             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7385             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7387             if test "$_jdk_ver" -lt 10800; then
7388                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7389             fi
7390             if test "$_jdk_ver" -gt 10800; then
7391                 JAVA_CLASSPATH_NOT_SET=TRUE
7392             fi
7394             AC_MSG_RESULT([found (JDK $_jdk)])
7395             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7396             if test "$_os" = "WINNT"; then
7397                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7398             fi
7400             # set to limit VM usage for JunitTests
7401             JAVAIFLAGS=-Xmx64M
7402             # set to limit VM usage for javac
7403             JAVAFLAGS=-J-Xmx128M
7404         fi
7405     else
7406         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7407     fi
7408 else
7409     dnl Java disabled
7410     JAVA_HOME=
7411     export JAVA_HOME
7414 dnl ===================================================================
7415 dnl Checks for javac
7416 dnl ===================================================================
7417 if test "$ENABLE_JAVA" != ""; then
7418     javacompiler="javac"
7419     : ${JAVA_SOURCE_VER=8}
7420     : ${JAVA_TARGET_VER=8}
7421     if test -z "$with_jdk_home"; then
7422         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7423     else
7424         _javac_path="$with_jdk_home/bin/$javacompiler"
7425         dnl Check if there is a Java compiler at all.
7426         if test -x "$_javac_path"; then
7427             JAVACOMPILER=$_javac_path
7428         fi
7429     fi
7430     if test -z "$JAVACOMPILER"; then
7431         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7432     fi
7433     if test "$build_os" = "cygwin"; then
7434         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7435             JAVACOMPILER="${JAVACOMPILER}.exe"
7436         fi
7437         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7438     fi
7441 dnl ===================================================================
7442 dnl Checks for javadoc
7443 dnl ===================================================================
7444 if test "$ENABLE_JAVA" != ""; then
7445     if test -z "$with_jdk_home"; then
7446         AC_PATH_PROG(JAVADOC, javadoc)
7447     else
7448         _javadoc_path="$with_jdk_home/bin/javadoc"
7449         dnl Check if there is a javadoc at all.
7450         if test -x "$_javadoc_path"; then
7451             JAVADOC=$_javadoc_path
7452         else
7453             AC_PATH_PROG(JAVADOC, javadoc)
7454         fi
7455     fi
7456     if test -z "$JAVADOC"; then
7457         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7458     fi
7459     if test "$build_os" = "cygwin"; then
7460         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7461             JAVADOC="${JAVADOC}.exe"
7462         fi
7463         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7464     fi
7466     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7467     JAVADOCISGJDOC="yes"
7468     fi
7470 AC_SUBST(JAVADOCISGJDOC)
7472 if test "$ENABLE_JAVA" != ""; then
7473     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7474     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7475         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7476            # try to recover first by looking whether we have an alternative
7477            # system as in Debian or newer SuSEs where following /usr/bin/javac
7478            # over /etc/alternatives/javac leads to the right bindir where we
7479            # just need to strip a bit away to get a valid JAVA_HOME
7480            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7481         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7482             # maybe only one level of symlink (e.g. on Mac)
7483             JAVA_HOME=$(readlink $JAVACOMPILER)
7484             if test "$(dirname $JAVA_HOME)" = "."; then
7485                 # we've got no path to trim back
7486                 JAVA_HOME=""
7487             fi
7488         else
7489             # else warn
7490             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7491             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7492             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7493             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7494         fi
7495         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7496         if test "$JAVA_HOME" != "/usr"; then
7497             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7498                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7499                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7500                 dnl Tiger already returns a JDK path...
7501                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7502             else
7503                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7504                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7505                 dnl that checks which version to run
7506                 if test -f "$JAVA_HOME"; then
7507                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7508                 fi
7509             fi
7510         fi
7511     fi
7512     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7514     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7515     if test -z "$JAVA_HOME"; then
7516         if test "x$with_jdk_home" = "x"; then
7517             cat > findhome.java <<_ACEOF
7518 [import java.io.File;
7520 class findhome
7522     public static void main(String args[])
7523     {
7524         String jrelocation = System.getProperty("java.home");
7525         File jre = new File(jrelocation);
7526         System.out.println(jre.getParent());
7527     }
7529 _ACEOF
7530             AC_MSG_CHECKING([if javac works])
7531             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7532             AC_TRY_EVAL(javac_cmd)
7533             if test $? = 0 -a -f ./findhome.class; then
7534                 AC_MSG_RESULT([javac works])
7535             else
7536                 echo "configure: javac test failed" >&5
7537                 cat findhome.java >&5
7538                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7539             fi
7540             AC_MSG_CHECKING([if gij knows its java.home])
7541             JAVA_HOME=`$JAVAINTERPRETER findhome`
7542             if test $? = 0 -a "$JAVA_HOME" != ""; then
7543                 AC_MSG_RESULT([$JAVA_HOME])
7544             else
7545                 echo "configure: java test failed" >&5
7546                 cat findhome.java >&5
7547                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7548             fi
7549             # clean-up after ourselves
7550             rm -f ./findhome.java ./findhome.class
7551         else
7552             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7553         fi
7554     fi
7556     # now check if $JAVA_HOME is really valid
7557     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7558         case "${JAVA_HOME}" in
7559             /Library/Java/JavaVirtualMachines/*)
7560                 ;;
7561             *)
7562                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7563                 ;;
7564         esac
7565         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7566             JAVA_HOME_OK="NO"
7567         fi
7568     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7569         JAVA_HOME_OK="NO"
7570     fi
7571     if test "$JAVA_HOME_OK" = "NO"; then
7572         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7573         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7574         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7575         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7576         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7577         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7578     fi
7579     PathFormat "$JAVA_HOME"
7580     JAVA_HOME="$formatted_path"
7583 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7584     "$_os" != Darwin
7585 then
7586     AC_MSG_CHECKING([for JAWT lib])
7587     if test "$_os" = WINNT; then
7588         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7589         JAWTLIB=jawt.lib
7590     else
7591         case "$host_cpu" in
7592         arm*)
7593             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7594             JAVA_ARCH=$my_java_arch
7595             ;;
7596         i*86)
7597             my_java_arch=i386
7598             ;;
7599         m68k)
7600             my_java_arch=m68k
7601             ;;
7602         powerpc)
7603             my_java_arch=ppc
7604             ;;
7605         powerpc64)
7606             my_java_arch=ppc64
7607             ;;
7608         powerpc64le)
7609             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7610             JAVA_ARCH=$my_java_arch
7611             ;;
7612         sparc64)
7613             my_java_arch=sparcv9
7614             ;;
7615         x86_64)
7616             my_java_arch=amd64
7617             ;;
7618         *)
7619             my_java_arch=$host_cpu
7620             ;;
7621         esac
7622         # This is where JDK9 puts the library
7623         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7624             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7625         else
7626             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7627         fi
7628         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7629     fi
7630     AC_MSG_RESULT([$JAWTLIB])
7632 AC_SUBST(JAWTLIB)
7634 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7635     case "$host_os" in
7637     aix*)
7638         JAVAINC="-I$JAVA_HOME/include"
7639         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7640         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7641         ;;
7643     cygwin*)
7644         JAVAINC="-I$JAVA_HOME/include/win32"
7645         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7646         ;;
7648     darwin*)
7649         if test -d "$JAVA_HOME/include/darwin"; then
7650             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7651         else
7652             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7653         fi
7654         ;;
7656     dragonfly*)
7657         JAVAINC="-I$JAVA_HOME/include"
7658         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7659         ;;
7661     freebsd*)
7662         JAVAINC="-I$JAVA_HOME/include"
7663         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7664         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7665         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7666         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7667         ;;
7669     k*bsd*-gnu*)
7670         JAVAINC="-I$JAVA_HOME/include"
7671         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7672         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7673         ;;
7675     linux-gnu*)
7676         JAVAINC="-I$JAVA_HOME/include"
7677         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7678         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7679         ;;
7681     *netbsd*)
7682         JAVAINC="-I$JAVA_HOME/include"
7683         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7684         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7685        ;;
7687     openbsd*)
7688         JAVAINC="-I$JAVA_HOME/include"
7689         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7690         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7691         ;;
7693     solaris*)
7694         JAVAINC="-I$JAVA_HOME/include"
7695         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7696         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7697         ;;
7698     esac
7700 SOLARINC="$SOLARINC $JAVAINC"
7702 AC_SUBST(JAVACOMPILER)
7703 AC_SUBST(JAVADOC)
7704 AC_SUBST(JAVAINTERPRETER)
7705 AC_SUBST(JAVAIFLAGS)
7706 AC_SUBST(JAVAFLAGS)
7707 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7708 AC_SUBST(JAVA_HOME)
7709 AC_SUBST(JAVA_SOURCE_VER)
7710 AC_SUBST(JAVA_TARGET_VER)
7711 AC_SUBST(JDK)
7714 dnl ===================================================================
7715 dnl Export file validation
7716 dnl ===================================================================
7717 AC_MSG_CHECKING([whether to enable export file validation])
7718 if test "$with_export_validation" != "no"; then
7719     if test -z "$ENABLE_JAVA"; then
7720         if test "$with_export_validation" = "yes"; then
7721             AC_MSG_ERROR([requested, but Java is disabled])
7722         else
7723             AC_MSG_RESULT([no, as Java is disabled])
7724         fi
7725     elif ! test -d "${SRC_ROOT}/schema"; then
7726         if test "$with_export_validation" = "yes"; then
7727             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7728         else
7729             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7730         fi
7731     else
7732         AC_MSG_RESULT([yes])
7733         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7735         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7736         if test -z "$ODFVALIDATOR"; then
7737             # remember to download the ODF toolkit with validator later
7738             AC_MSG_NOTICE([no odfvalidator found, will download it])
7739             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7740             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7742             # and fetch name of odfvalidator jar name from download.lst
7743             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7744             AC_SUBST(ODFVALIDATOR_JAR)
7746             if test -z "$ODFVALIDATOR_JAR"; then
7747                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7748             fi
7749         fi
7750         if test "$build_os" = "cygwin"; then
7751             # In case of Cygwin it will be executed from Windows,
7752             # so we need to run bash and absolute path to validator
7753             # so instead of "odfvalidator" it will be
7754             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7755             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7756         else
7757             ODFVALIDATOR="sh $ODFVALIDATOR"
7758         fi
7759         AC_SUBST(ODFVALIDATOR)
7762         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7763         if test -z "$OFFICEOTRON"; then
7764             # remember to download the officeotron with validator later
7765             AC_MSG_NOTICE([no officeotron found, will download it])
7766             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7767             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7769             # and fetch name of officeotron jar name from download.lst
7770             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7771             AC_SUBST(OFFICEOTRON_JAR)
7773             if test -z "$OFFICEOTRON_JAR"; then
7774                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7775             fi
7776         else
7777             # check version of existing officeotron
7778             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7779             if test 0"$OFFICEOTRON_VER" -lt 704; then
7780                 AC_MSG_ERROR([officeotron too old])
7781             fi
7782         fi
7783         if test "$build_os" = "cygwin"; then
7784             # In case of Cygwin it will be executed from Windows,
7785             # so we need to run bash and absolute path to validator
7786             # so instead of "odfvalidator" it will be
7787             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7788             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7789         else
7790             OFFICEOTRON="sh $OFFICEOTRON"
7791         fi
7792     fi
7793     AC_SUBST(OFFICEOTRON)
7794 else
7795     AC_MSG_RESULT([no])
7798 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7799 if test "$with_bffvalidator" != "no"; then
7800     AC_DEFINE(HAVE_BFFVALIDATOR)
7802     if test "$with_export_validation" = "no"; then
7803         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7804     fi
7806     if test "$with_bffvalidator" = "yes"; then
7807         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7808     else
7809         BFFVALIDATOR="$with_bffvalidator"
7810     fi
7812     if test "$build_os" = "cygwin"; then
7813         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7814             AC_MSG_RESULT($BFFVALIDATOR)
7815         else
7816             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7817         fi
7818     elif test -n "$BFFVALIDATOR"; then
7819         # We are not in Cygwin but need to run Windows binary with wine
7820         AC_PATH_PROGS(WINE, wine)
7822         # so swap in a shell wrapper that converts paths transparently
7823         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7824         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7825         AC_SUBST(BFFVALIDATOR_EXE)
7826         AC_MSG_RESULT($BFFVALIDATOR)
7827     else
7828         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7829     fi
7830     AC_SUBST(BFFVALIDATOR)
7831 else
7832     AC_MSG_RESULT([no])
7835 dnl ===================================================================
7836 dnl Check for C preprocessor to use
7837 dnl ===================================================================
7838 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7839 if test -n "$with_idlc_cpp"; then
7840     AC_MSG_RESULT([$with_idlc_cpp])
7841     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7842 else
7843     AC_MSG_RESULT([ucpp])
7844     AC_MSG_CHECKING([which ucpp tp use])
7845     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7846         AC_MSG_RESULT([external])
7847         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7848     else
7849         AC_MSG_RESULT([internal])
7850         BUILD_TYPE="$BUILD_TYPE UCPP"
7851     fi
7853 AC_SUBST(SYSTEM_UCPP)
7855 dnl ===================================================================
7856 dnl Check for epm (not needed for Windows)
7857 dnl ===================================================================
7858 AC_MSG_CHECKING([whether to enable EPM for packing])
7859 if test "$enable_epm" = "yes"; then
7860     AC_MSG_RESULT([yes])
7861     if test "$_os" != "WINNT"; then
7862         if test $_os = Darwin; then
7863             EPM=internal
7864         elif test -n "$with_epm"; then
7865             EPM=$with_epm
7866         else
7867             AC_PATH_PROG(EPM, epm, no)
7868         fi
7869         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7870             AC_MSG_NOTICE([EPM will be built.])
7871             BUILD_TYPE="$BUILD_TYPE EPM"
7872             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7873         else
7874             # Gentoo has some epm which is something different...
7875             AC_MSG_CHECKING([whether the found epm is the right epm])
7876             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7877                 AC_MSG_RESULT([yes])
7878             else
7879                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7880             fi
7881             AC_MSG_CHECKING([epm version])
7882             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7883             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7884                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7885                 AC_MSG_RESULT([OK, >= 3.7])
7886             else
7887                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7888                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7889             fi
7890         fi
7891     fi
7893     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7894         AC_MSG_CHECKING([for rpm])
7895         for a in "$RPM" rpmbuild rpm; do
7896             $a --usage >/dev/null 2> /dev/null
7897             if test $? -eq 0; then
7898                 RPM=$a
7899                 break
7900             else
7901                 $a --version >/dev/null 2> /dev/null
7902                 if test $? -eq 0; then
7903                     RPM=$a
7904                     break
7905                 fi
7906             fi
7907         done
7908         if test -z "$RPM"; then
7909             AC_MSG_ERROR([not found])
7910         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7911             RPM_PATH=`which $RPM`
7912             AC_MSG_RESULT([$RPM_PATH])
7913             SCPDEFS="$SCPDEFS -DWITH_RPM"
7914         else
7915             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7916         fi
7917     fi
7918     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7919         AC_PATH_PROG(DPKG, dpkg, no)
7920         if test "$DPKG" = "no"; then
7921             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7922         fi
7923     fi
7924     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7925        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7926         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7927             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7928                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7929                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7930                     AC_MSG_RESULT([yes])
7931                 else
7932                     AC_MSG_RESULT([no])
7933                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7934                         _pt="rpm"
7935                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7936                         add_warning "the rpms will need to be installed with --nodeps"
7937                     else
7938                         _pt="pkg"
7939                     fi
7940                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7941                     add_warning "the ${_pt}s will not be relocatable"
7942                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7943                                  relocation will work, you need to patch your epm with the
7944                                  patch in epm/epm-3.7.patch or build with
7945                                  --with-epm=internal which will build a suitable epm])
7946                 fi
7947             fi
7948         fi
7949     fi
7950     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7951         AC_PATH_PROG(PKGMK, pkgmk, no)
7952         if test "$PKGMK" = "no"; then
7953             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7954         fi
7955     fi
7956     AC_SUBST(RPM)
7957     AC_SUBST(DPKG)
7958     AC_SUBST(PKGMK)
7959 else
7960     for i in $PKGFORMAT; do
7961         case "$i" in
7962         aix | bsd | deb | pkg | rpm | native | portable)
7963             AC_MSG_ERROR(
7964                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7965             ;;
7966         esac
7967     done
7968     AC_MSG_RESULT([no])
7969     EPM=NO
7971 AC_SUBST(EPM)
7973 ENABLE_LWP=
7974 if test "$enable_lotuswordpro" = "yes"; then
7975     ENABLE_LWP="TRUE"
7977 AC_SUBST(ENABLE_LWP)
7979 dnl ===================================================================
7980 dnl Check for building ODK
7981 dnl ===================================================================
7982 if test "$enable_odk" = no; then
7983     unset DOXYGEN
7984 else
7985     if test "$with_doxygen" = no; then
7986         AC_MSG_CHECKING([for doxygen])
7987         unset DOXYGEN
7988         AC_MSG_RESULT([no])
7989     else
7990         if test "$with_doxygen" = yes; then
7991             AC_PATH_PROG([DOXYGEN], [doxygen])
7992             if test -z "$DOXYGEN"; then
7993                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7994             fi
7995             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7996                 if ! dot -V 2>/dev/null; then
7997                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7998                 fi
7999             fi
8000         else
8001             AC_MSG_CHECKING([for doxygen])
8002             DOXYGEN=$with_doxygen
8003             AC_MSG_RESULT([$DOXYGEN])
8004         fi
8005         if test -n "$DOXYGEN"; then
8006             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8007             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8008             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8009                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8010             fi
8011         fi
8012     fi
8014 AC_SUBST([DOXYGEN])
8016 AC_MSG_CHECKING([whether to build the ODK])
8017 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8018     AC_MSG_RESULT([yes])
8020     if test "$with_java" != "no"; then
8021         AC_MSG_CHECKING([whether to build unowinreg.dll])
8022         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8023             # build on Win by default
8024             enable_build_unowinreg=yes
8025         fi
8026         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8027             AC_MSG_RESULT([no])
8028             BUILD_UNOWINREG=
8029         else
8030             AC_MSG_RESULT([yes])
8031             BUILD_UNOWINREG=TRUE
8032         fi
8033         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8034             if test -z "$with_mingw_cross_compiler"; then
8035                 dnl Guess...
8036                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8037             elif test -x "$with_mingw_cross_compiler"; then
8038                  MINGWCXX="$with_mingw_cross_compiler"
8039             else
8040                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8041             fi
8043             if test "$MINGWCXX" = "false"; then
8044                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8045             fi
8047             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8048             if test -x "$mingwstrip_test"; then
8049                 MINGWSTRIP="$mingwstrip_test"
8050             else
8051                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8052             fi
8054             if test "$MINGWSTRIP" = "false"; then
8055                 AC_MSG_ERROR(MinGW32 binutils not found.)
8056             fi
8057         fi
8058     fi
8059     BUILD_TYPE="$BUILD_TYPE ODK"
8060 else
8061     AC_MSG_RESULT([no])
8062     BUILD_UNOWINREG=
8064 AC_SUBST(BUILD_UNOWINREG)
8065 AC_SUBST(MINGWCXX)
8066 AC_SUBST(MINGWSTRIP)
8068 dnl ===================================================================
8069 dnl Check for system zlib
8070 dnl ===================================================================
8071 if test "$with_system_zlib" = "auto"; then
8072     case "$_os" in
8073     WINNT)
8074         with_system_zlib="$with_system_libs"
8075         ;;
8076     *)
8077         if test "$enable_fuzzers" != "yes"; then
8078             with_system_zlib=yes
8079         else
8080             with_system_zlib=no
8081         fi
8082         ;;
8083     esac
8086 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8087 dnl and has no pkg-config for it at least on some tinderboxes,
8088 dnl so leaving that out for now
8089 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8090 AC_MSG_CHECKING([which zlib to use])
8091 if test "$with_system_zlib" = "yes"; then
8092     AC_MSG_RESULT([external])
8093     SYSTEM_ZLIB=TRUE
8094     AC_CHECK_HEADER(zlib.h, [],
8095         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8096     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8097         [AC_MSG_ERROR(zlib not found or functional)], [])
8098 else
8099     AC_MSG_RESULT([internal])
8100     SYSTEM_ZLIB=
8101     BUILD_TYPE="$BUILD_TYPE ZLIB"
8102     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8103     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8105 AC_SUBST(ZLIB_CFLAGS)
8106 AC_SUBST(ZLIB_LIBS)
8107 AC_SUBST(SYSTEM_ZLIB)
8109 dnl ===================================================================
8110 dnl Check for system jpeg
8111 dnl ===================================================================
8112 AC_MSG_CHECKING([which libjpeg to use])
8113 if test "$with_system_jpeg" = "yes"; then
8114     AC_MSG_RESULT([external])
8115     SYSTEM_LIBJPEG=TRUE
8116     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8117         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8118     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8119         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8120 else
8121     SYSTEM_LIBJPEG=
8122     AC_MSG_RESULT([internal, libjpeg-turbo])
8123     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8124     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8125     if test "$COM" = "MSC"; then
8126         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8127     else
8128         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8129     fi
8131     case "$host_cpu" in
8132     x86_64 | amd64 | i*86 | x86 | ia32)
8133         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8134         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8135             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8136                 NASM="$LODE_HOME/opt/bin/nasm"
8137             elif test -x "/opt/lo/bin/nasm"; then
8138                 NASM="/opt/lo/bin/nasm"
8139             fi
8140         fi
8142         if test -n "$NASM"; then
8143             AC_MSG_CHECKING([for object file format of host system])
8144             case "$host_os" in
8145               cygwin* | mingw* | pw32* | interix*)
8146                 case "$host_cpu" in
8147                   x86_64)
8148                     objfmt='Win64-COFF'
8149                     ;;
8150                   *)
8151                     objfmt='Win32-COFF'
8152                     ;;
8153                 esac
8154               ;;
8155               msdosdjgpp* | go32*)
8156                 objfmt='COFF'
8157               ;;
8158               os2-emx*) # not tested
8159                 objfmt='MSOMF' # obj
8160               ;;
8161               linux*coff* | linux*oldld*)
8162                 objfmt='COFF' # ???
8163               ;;
8164               linux*aout*)
8165                 objfmt='a.out'
8166               ;;
8167               linux*)
8168                 case "$host_cpu" in
8169                   x86_64)
8170                     objfmt='ELF64'
8171                     ;;
8172                   *)
8173                     objfmt='ELF'
8174                     ;;
8175                 esac
8176               ;;
8177               kfreebsd* | freebsd* | netbsd* | openbsd*)
8178                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8179                   objfmt='BSD-a.out'
8180                 else
8181                   case "$host_cpu" in
8182                     x86_64 | amd64)
8183                       objfmt='ELF64'
8184                       ;;
8185                     *)
8186                       objfmt='ELF'
8187                       ;;
8188                   esac
8189                 fi
8190               ;;
8191               solaris* | sunos* | sysv* | sco*)
8192                 case "$host_cpu" in
8193                   x86_64)
8194                     objfmt='ELF64'
8195                     ;;
8196                   *)
8197                     objfmt='ELF'
8198                     ;;
8199                 esac
8200               ;;
8201               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8202                 case "$host_cpu" in
8203                   x86_64)
8204                     objfmt='Mach-O64'
8205                     ;;
8206                   *)
8207                     objfmt='Mach-O'
8208                     ;;
8209                 esac
8210               ;;
8211               *)
8212                 objfmt='ELF ?'
8213               ;;
8214             esac
8216             AC_MSG_RESULT([$objfmt])
8217             if test "$objfmt" = 'ELF ?'; then
8218               objfmt='ELF'
8219               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8220             fi
8222             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8223             case "$objfmt" in
8224               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8225               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8226               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8227               COFF)       NAFLAGS='-fcoff -DCOFF';;
8228               a.out)      NAFLAGS='-faout -DAOUT';;
8229               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8230               ELF)        NAFLAGS='-felf -DELF';;
8231               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8232               RDF)        NAFLAGS='-frdf -DRDF';;
8233               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8234               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8235             esac
8236             AC_MSG_RESULT([$NAFLAGS])
8238             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8239             cat > conftest.asm << EOF
8240             [%line __oline__ "configure"
8241                     section .text
8242                     global  _main,main
8243             _main:
8244             main:   xor     eax,eax
8245                     ret
8246             ]
8248             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8249             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8250               AC_MSG_RESULT(yes)
8251             else
8252               echo "configure: failed program was:" >&AC_FD_CC
8253               cat conftest.asm >&AC_FD_CC
8254               rm -rf conftest*
8255               AC_MSG_RESULT(no)
8256               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8257               NASM=""
8258             fi
8260         fi
8262         if test -z "$NASM"; then
8263 cat << _EOS
8264 ****************************************************************************
8265 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8266 To get one please:
8268 _EOS
8269             if test "$build_os" = "cygwin"; then
8270 cat << _EOS
8271 install a pre-compiled binary for Win32
8273 mkdir -p /opt/lo/bin
8274 cd /opt/lo/bin
8275 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8276 chmod +x nasm
8278 or get and install one from http://www.nasm.us/
8280 Then re-run autogen.sh
8282 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8283 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8285 _EOS
8286             else
8287 cat << _EOS
8288 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8290 _EOS
8291             fi
8292             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8293             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8294         fi
8295       ;;
8296     esac
8299 AC_SUBST(NASM)
8300 AC_SUBST(LIBJPEG_CFLAGS)
8301 AC_SUBST(LIBJPEG_LIBS)
8302 AC_SUBST(SYSTEM_LIBJPEG)
8304 dnl ===================================================================
8305 dnl Check for system clucene
8306 dnl ===================================================================
8307 dnl we should rather be using
8308 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8309 dnl but the contribs-lib check seems tricky
8310 AC_MSG_CHECKING([which clucene to use])
8311 if test "$with_system_clucene" = "yes"; then
8312     AC_MSG_RESULT([external])
8313     SYSTEM_CLUCENE=TRUE
8314     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8315     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8316     FilterLibs "${CLUCENE_LIBS}"
8317     CLUCENE_LIBS="${filteredlibs}"
8318     AC_LANG_PUSH([C++])
8319     save_CXXFLAGS=$CXXFLAGS
8320     save_CPPFLAGS=$CPPFLAGS
8321     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8322     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8323     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8324     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8325     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8326                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8327     CXXFLAGS=$save_CXXFLAGS
8328     CPPFLAGS=$save_CPPFLAGS
8329     AC_LANG_POP([C++])
8331     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8332 else
8333     AC_MSG_RESULT([internal])
8334     SYSTEM_CLUCENE=
8335     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8337 AC_SUBST(SYSTEM_CLUCENE)
8338 AC_SUBST(CLUCENE_CFLAGS)
8339 AC_SUBST(CLUCENE_LIBS)
8341 dnl ===================================================================
8342 dnl Check for system expat
8343 dnl ===================================================================
8344 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8346 dnl ===================================================================
8347 dnl Check for system xmlsec
8348 dnl ===================================================================
8349 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8351 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8352 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8353     ENABLE_EOT="TRUE"
8354     AC_DEFINE([ENABLE_EOT])
8355     AC_MSG_RESULT([yes])
8357     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8358 else
8359     ENABLE_EOT=
8360     AC_MSG_RESULT([no])
8362 AC_SUBST([ENABLE_EOT])
8364 dnl ===================================================================
8365 dnl Check for DLP libs
8366 dnl ===================================================================
8367 AS_IF([test "$COM" = "MSC"],
8368       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8369       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8371 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8373 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8375 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8377 AS_IF([test "$COM" = "MSC"],
8378       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8379       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8381 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8383 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8385 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8386 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8388 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8390 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8392 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8394 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8395 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8397 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8398 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8400 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8402 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8403 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8405 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8407 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8409 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8411 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8413 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8414 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8416 dnl ===================================================================
8417 dnl Check for system lcms2
8418 dnl ===================================================================
8419 if test "$with_system_lcms2" != "yes"; then
8420     SYSTEM_LCMS2=
8422 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8423 if test "$GCC" = "yes"; then
8424     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8426 if test "$COM" = "MSC"; then # override the above
8427     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8430 dnl ===================================================================
8431 dnl Check for system cppunit
8432 dnl ===================================================================
8433 if test "$_os" != "Android" ; then
8434     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8437 dnl ===================================================================
8438 dnl Check whether freetype is available
8439 dnl ===================================================================
8440 if test  "$test_freetype" = "yes"; then
8441     AC_MSG_CHECKING([whether freetype is available])
8442     # FreeType has 3 different kinds of versions
8443     # * release, like 2.4.10
8444     # * libtool, like 13.0.7 (this what pkg-config returns)
8445     # * soname
8446     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8447     #
8448     # 9.9.3 is 2.2.0
8449     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8450     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8451     FilterLibs "${FREETYPE_LIBS}"
8452     FREETYPE_LIBS="${filteredlibs}"
8453     SYSTEM_FREETYPE=TRUE
8454 else
8455     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8456     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8458 AC_SUBST(FREETYPE_CFLAGS)
8459 AC_SUBST(FREETYPE_LIBS)
8460 AC_SUBST([SYSTEM_FREETYPE])
8462 # ===================================================================
8463 # Check for system libxslt
8464 # to prevent incompatibilities between internal libxml2 and external libxslt,
8465 # or vice versa, use with_system_libxml here
8466 # ===================================================================
8467 if test "$with_system_libxml" = "auto"; then
8468     case "$_os" in
8469     WINNT|iOS|Android)
8470         with_system_libxml="$with_system_libs"
8471         ;;
8472     *)
8473         if test "$enable_fuzzers" != "yes"; then
8474             with_system_libxml=yes
8475         else
8476             with_system_libxml=no
8477         fi
8478         ;;
8479     esac
8482 AC_MSG_CHECKING([which libxslt to use])
8483 if test "$with_system_libxml" = "yes"; then
8484     AC_MSG_RESULT([external])
8485     SYSTEM_LIBXSLT=TRUE
8486     if test "$_os" = "Darwin"; then
8487         dnl make sure to use SDK path
8488         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8489         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8490         dnl omit -L/usr/lib
8491         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8492         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8493     else
8494         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8495         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8496         FilterLibs "${LIBXSLT_LIBS}"
8497         LIBXSLT_LIBS="${filteredlibs}"
8498         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8499         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8500         FilterLibs "${LIBEXSLT_LIBS}"
8501         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8502     fi
8504     dnl Check for xsltproc
8505     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8506     if test "$XSLTPROC" = "no"; then
8507         AC_MSG_ERROR([xsltproc is required])
8508     fi
8509 else
8510     AC_MSG_RESULT([internal])
8511     SYSTEM_LIBXSLT=
8512     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8514     if test "$cross_compiling" = "yes"; then
8515         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8516         if test "$XSLTPROC" = "no"; then
8517             AC_MSG_ERROR([xsltproc is required])
8518         fi
8519     fi
8521 AC_SUBST(SYSTEM_LIBXSLT)
8522 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8523     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8525 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8527 AC_SUBST(LIBEXSLT_CFLAGS)
8528 AC_SUBST(LIBEXSLT_LIBS)
8529 AC_SUBST(LIBXSLT_CFLAGS)
8530 AC_SUBST(LIBXSLT_LIBS)
8531 AC_SUBST(XSLTPROC)
8533 # ===================================================================
8534 # Check for system libxml
8535 # ===================================================================
8536 AC_MSG_CHECKING([which libxml to use])
8537 if test "$with_system_libxml" = "yes"; then
8538     AC_MSG_RESULT([external])
8539     SYSTEM_LIBXML=TRUE
8540     if test "$_os" = "Darwin"; then
8541         dnl make sure to use SDK path
8542         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8543         dnl omit -L/usr/lib
8544         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8545     elif test $_os = iOS; then
8546         dnl make sure to use SDK path
8547         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8548         LIBXML_CFLAGS="-I$usr/include/libxml2"
8549         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8550     else
8551         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8552         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8553         FilterLibs "${LIBXML_LIBS}"
8554         LIBXML_LIBS="${filteredlibs}"
8555     fi
8557     dnl Check for xmllint
8558     AC_PATH_PROG(XMLLINT, xmllint, no)
8559     if test "$XMLLINT" = "no"; then
8560         AC_MSG_ERROR([xmllint is required])
8561     fi
8562 else
8563     AC_MSG_RESULT([internal])
8564     SYSTEM_LIBXML=
8565     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8566     if test "$COM" = "MSC"; then
8567         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8568     fi
8569     if test "$COM" = "MSC"; then
8570         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8571     else
8572         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8573     fi
8574     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8576 AC_SUBST(SYSTEM_LIBXML)
8577 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8578     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8580 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8581 AC_SUBST(LIBXML_CFLAGS)
8582 AC_SUBST(LIBXML_LIBS)
8583 AC_SUBST(XMLLINT)
8585 # =====================================================================
8586 # Checking for a Python interpreter with version >= 2.7.
8587 # Build and runtime requires Python 3 compatible version (>= 2.7).
8588 # Optionally user can pass an option to configure, i. e.
8589 # ./configure PYTHON=/usr/bin/python
8590 # =====================================================================
8591 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8592     if test -n "$PYTHON"; then
8593         PYTHON_FOR_BUILD=$PYTHON
8594     else
8595         # This allows a lack of system python with no error, we use internal one in that case.
8596         AM_PATH_PYTHON([2.7],, [:])
8597         # Clean PYTHON_VERSION checked below if cross-compiling
8598         PYTHON_VERSION=""
8599         if test "$PYTHON" != ":"; then
8600             PYTHON_FOR_BUILD=$PYTHON
8601         fi
8602     fi
8604 AC_SUBST(PYTHON_FOR_BUILD)
8606 # Checks for Python to use for Pyuno
8607 AC_MSG_CHECKING([which Python to use for Pyuno])
8608 case "$enable_python" in
8609 no|disable)
8610     if test -z $PYTHON_FOR_BUILD; then
8611         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8612         # requirement from the choice whether to include Python stuff in the installer, but why
8613         # bother?
8614         AC_MSG_ERROR([Python is required at build time.])
8615     fi
8616     enable_python=no
8617     AC_MSG_RESULT([none])
8618     ;;
8619 ""|yes|auto)
8620     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8621         AC_MSG_RESULT([no, overridden by --disable-scripting])
8622         enable_python=no
8623     elif test $build_os = cygwin; then
8624         dnl When building on Windows we don't attempt to use any installed
8625         dnl "system"  Python.
8626         AC_MSG_RESULT([fully internal])
8627         enable_python=internal
8628     elif test "$cross_compiling" = yes; then
8629         AC_MSG_RESULT([system])
8630         enable_python=system
8631     else
8632         # Unset variables set by the above AM_PATH_PYTHON so that
8633         # we actually do check anew.
8634         AC_MSG_RESULT([])
8635         unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
8636         AM_PATH_PYTHON([3.3],, [:])
8637         AC_MSG_CHECKING([which Python to use for Pyuno])
8638         if test "$PYTHON" = ":"; then
8639             if test -z "$PYTHON_FOR_BUILD"; then
8640                 AC_MSG_RESULT([fully internal])
8641             else
8642                 AC_MSG_RESULT([internal])
8643             fi
8644             enable_python=internal
8645         else
8646             AC_MSG_RESULT([system])
8647             enable_python=system
8648         fi
8649     fi
8650     ;;
8651 internal)
8652     AC_MSG_RESULT([internal])
8653     ;;
8654 fully-internal)
8655     AC_MSG_RESULT([fully internal])
8656     enable_python=internal
8657     ;;
8658 system)
8659     AC_MSG_RESULT([system])
8660     if test "$_os" = Darwin; then
8661         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])
8662     fi
8663     ;;
8665     AC_MSG_ERROR([Incorrect --enable-python option])
8666     ;;
8667 esac
8669 if test $enable_python != no; then
8670     BUILD_TYPE="$BUILD_TYPE PYUNO"
8673 if test $enable_python = system; then
8674     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8675         # Fallback: Accept these in the environment, or as set above
8676         # for MacOSX.
8677         :
8678     elif test "$cross_compiling" != yes; then
8679         # Unset variables set by the above AM_PATH_PYTHON so that
8680         # we actually do check anew.
8681         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
8682         # This causes an error if no python command is found
8683         AM_PATH_PYTHON([3.3])
8684         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8685         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8686         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8687         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8688         if test -z "$PKG_CONFIG"; then
8689             PYTHON_CFLAGS="-I$python_include"
8690             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8691         elif $PKG_CONFIG --exists python-$python_version-embed; then
8692             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8693             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8694         elif $PKG_CONFIG --exists python-$python_version; then
8695             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8696             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8697         else
8698             PYTHON_CFLAGS="-I$python_include"
8699             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8700         fi
8701         FilterLibs "${PYTHON_LIBS}"
8702         PYTHON_LIBS="${filteredlibs}"
8703     else
8704         dnl How to find out the cross-compilation Python installation path?
8705         AC_MSG_CHECKING([for python version])
8706         AS_IF([test -n "$PYTHON_VERSION"],
8707               [AC_MSG_RESULT([$PYTHON_VERSION])],
8708               [AC_MSG_RESULT([not found])
8709                AC_MSG_ERROR([no usable python found])])
8710         test -n "$PYTHON_CFLAGS" && break
8711     fi
8713     dnl Check if the headers really work
8714     save_CPPFLAGS="$CPPFLAGS"
8715     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8716     AC_CHECK_HEADER(Python.h)
8717     CPPFLAGS="$save_CPPFLAGS"
8719     # let the PYTHON_FOR_BUILD match the same python installation that
8720     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8721     # better for PythonTests.
8722     PYTHON_FOR_BUILD=$PYTHON
8725 if test "$with_lxml" != no; then
8726     if test -z "$PYTHON_FOR_BUILD"; then
8727         case $build_os in
8728             cygwin)
8729                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8730                 ;;
8731             *)
8732                 if test "$cross_compiling" != yes ; then
8733                     BUILD_TYPE="$BUILD_TYPE LXML"
8734                 fi
8735                 ;;
8736         esac
8737     else
8738         AC_MSG_CHECKING([for python lxml])
8739         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8740             AC_MSG_RESULT([yes])
8741         else
8742             case $build_os in
8743                 cygwin)
8744                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8745                     ;;
8746                 *)
8747                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8748                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8749                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8750                         else
8751                             BUILD_TYPE="$BUILD_TYPE LXML"
8752                             AC_MSG_RESULT([no, using internal lxml])
8753                         fi
8754                     else
8755                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8756                     fi
8757                     ;;
8758             esac
8759         fi
8760     fi
8763 dnl By now enable_python should be "system", "internal" or "no"
8764 case $enable_python in
8765 system)
8766     SYSTEM_PYTHON=TRUE
8768     if test "x$ac_cv_header_Python_h" != "xyes"; then
8769        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8770     fi
8772     AC_LANG_PUSH(C)
8773     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8774     AC_MSG_CHECKING([for correct python library version])
8775        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8776 #include <Python.h>
8778 int main(int argc, char **argv) {
8779    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8780        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8781    else return 1;
8783        ]])],[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])])
8784     CFLAGS=$save_CFLAGS
8785     AC_LANG_POP(C)
8787     dnl FIXME Check if the Python library can be linked with, too?
8788     ;;
8790 internal)
8791     SYSTEM_PYTHON=
8792     PYTHON_VERSION_MAJOR=3
8793     PYTHON_VERSION_MINOR=7
8794     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8795     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8796         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8797     fi
8798     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8799     BUILD_TYPE="$BUILD_TYPE PYTHON"
8800     if test "$OS" = LINUX; then
8801         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8802     fi
8803     # Embedded Python dies without Home set
8804     if test "$HOME" = ""; then
8805         export HOME=""
8806     fi
8807     ;;
8809     DISABLE_PYTHON=TRUE
8810     SYSTEM_PYTHON=
8811     ;;
8813     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8814     ;;
8815 esac
8817 AC_SUBST(DISABLE_PYTHON)
8818 AC_SUBST(SYSTEM_PYTHON)
8819 AC_SUBST(PYTHON_CFLAGS)
8820 AC_SUBST(PYTHON_LIBS)
8821 AC_SUBST(PYTHON_VERSION)
8822 AC_SUBST(PYTHON_VERSION_MAJOR)
8823 AC_SUBST(PYTHON_VERSION_MINOR)
8825 ENABLE_MARIADBC=TRUE
8826 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8827     ENABLE_MARIADBC=
8829 MARIADBC_MAJOR=1
8830 MARIADBC_MINOR=0
8831 MARIADBC_MICRO=2
8832 if test "$ENABLE_MARIADBC" = "TRUE"; then
8833     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8836 AC_SUBST(ENABLE_MARIADBC)
8837 AC_SUBST(MARIADBC_MAJOR)
8838 AC_SUBST(MARIADBC_MINOR)
8839 AC_SUBST(MARIADBC_MICRO)
8841 if test "$ENABLE_MARIADBC" = "TRUE"; then
8842     dnl ===================================================================
8843     dnl Check for system MariaDB
8844     dnl ===================================================================
8845     AC_MSG_CHECKING([which MariaDB to use])
8846     if test "$with_system_mariadb" = "yes"; then
8847         AC_MSG_RESULT([external])
8848         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8849         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8850         if test -z "$MARIADBCONFIG"; then
8851             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8852             if test -z "$MARIADBCONFIG"; then
8853                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8854                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8855             fi
8856         fi
8857         AC_MSG_CHECKING([MariaDB version])
8858         MARIADB_VERSION=`$MARIADBCONFIG --version`
8859         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8860         if test "$MARIADB_MAJOR" -ge "5"; then
8861             AC_MSG_RESULT([OK])
8862         else
8863             AC_MSG_ERROR([too old, use 5.0.x or later])
8864         fi
8865         AC_MSG_CHECKING([for MariaDB Client library])
8866         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8867         if test "$COM_IS_CLANG" = TRUE; then
8868             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8869         fi
8870         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8871         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8872         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8873         dnl linux32:
8874         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8875             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8876             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8877                 | sed -e 's|/lib64/|/lib/|')
8878         fi
8879         FilterLibs "${MARIADB_LIBS}"
8880         MARIADB_LIBS="${filteredlibs}"
8881         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8882         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8883         if test "$enable_bundle_mariadb" = "yes"; then
8884             AC_MSG_RESULT([yes])
8885             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8886             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8888 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8890 /g' | grep -E '(mysqlclient|mariadb)')
8891             if test "$_os" = "Darwin"; then
8892                 LIBMARIADB=${LIBMARIADB}.dylib
8893             elif test "$_os" = "WINNT"; then
8894                 LIBMARIADB=${LIBMARIADB}.dll
8895             else
8896                 LIBMARIADB=${LIBMARIADB}.so
8897             fi
8898             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8899             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8900             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8901                 AC_MSG_RESULT([found.])
8902                 PathFormat "$LIBMARIADB_PATH"
8903                 LIBMARIADB_PATH="$formatted_path"
8904             else
8905                 AC_MSG_ERROR([not found.])
8906             fi
8907         else
8908             AC_MSG_RESULT([no])
8909             BUNDLE_MARIADB_CONNECTOR_C=
8910         fi
8911     else
8912         AC_MSG_RESULT([internal])
8913         SYSTEM_MARIADB_CONNECTOR_C=
8914         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8915         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8916         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8917     fi
8919     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8920     AC_SUBST(MARIADB_CFLAGS)
8921     AC_SUBST(MARIADB_LIBS)
8922     AC_SUBST(LIBMARIADB)
8923     AC_SUBST(LIBMARIADB_PATH)
8924     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8927 dnl ===================================================================
8928 dnl Check for system hsqldb
8929 dnl ===================================================================
8930 if test "$with_java" != "no"; then
8931     HSQLDB_USE_JDBC_4_1=
8932     AC_MSG_CHECKING([which hsqldb to use])
8933     if test "$with_system_hsqldb" = "yes"; then
8934         AC_MSG_RESULT([external])
8935         SYSTEM_HSQLDB=TRUE
8936         if test -z $HSQLDB_JAR; then
8937             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8938         fi
8939         if ! test -f $HSQLDB_JAR; then
8940                AC_MSG_ERROR(hsqldb.jar not found.)
8941         fi
8942         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8943         export HSQLDB_JAR
8944         if $PERL -e \
8945            'use Archive::Zip;
8946             my $file = "$ENV{'HSQLDB_JAR'}";
8947             my $zip = Archive::Zip->new( $file );
8948             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8949             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8950             {
8951                 push @l, split(/\n/, $mf);
8952                 foreach my $line (@l)
8953                 {
8954                     if ($line =~ m/Specification-Version:/)
8955                     {
8956                         ($t, $version) = split (/:/,$line);
8957                         $version =~ s/^\s//;
8958                         ($a, $b, $c, $d) = split (/\./,$version);
8959                         if ($c == "0" && $d > "8")
8960                         {
8961                             exit 0;
8962                         }
8963                         else
8964                         {
8965                             exit 1;
8966                         }
8967                     }
8968                 }
8969             }
8970             else
8971             {
8972                 exit 1;
8973             }'; then
8974             AC_MSG_RESULT([yes])
8975         else
8976             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8977         fi
8978     else
8979         AC_MSG_RESULT([internal])
8980         SYSTEM_HSQLDB=
8981         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8982         NEED_ANT=TRUE
8983         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8984         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8985         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8986             AC_MSG_RESULT([yes])
8987             HSQLDB_USE_JDBC_4_1=TRUE
8988         else
8989             AC_MSG_RESULT([no])
8990         fi
8991     fi
8992     AC_SUBST(SYSTEM_HSQLDB)
8993     AC_SUBST(HSQLDB_JAR)
8994     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8997 dnl ===================================================================
8998 dnl Check for PostgreSQL stuff
8999 dnl ===================================================================
9000 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9001 if test "x$enable_postgresql_sdbc" != "xno"; then
9002     AC_MSG_RESULT([yes])
9003     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9005     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9006         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9007     fi
9008     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9009         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9010     fi
9012     postgres_interface=""
9013     if test "$with_system_postgresql" = "yes"; then
9014         postgres_interface="external PostgreSQL"
9015         SYSTEM_POSTGRESQL=TRUE
9016         if test "$_os" = Darwin; then
9017             supp_path=''
9018             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9019                 pg_supp_path="$P_SEP$d$pg_supp_path"
9020             done
9021         fi
9022         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9023         if test -n "$PGCONFIG"; then
9024             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9025             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9026         else
9027             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9028               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9029               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9030             ],[
9031               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9032             ])
9033         fi
9034         FilterLibs "${POSTGRESQL_LIB}"
9035         POSTGRESQL_LIB="${filteredlibs}"
9036     else
9037         # if/when anything else than PostgreSQL uses Kerberos,
9038         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9039         WITH_KRB5=
9040         WITH_GSSAPI=
9041         case "$_os" in
9042         Darwin)
9043             # macOS has system MIT Kerberos 5 since 10.4
9044             if test "$with_krb5" != "no"; then
9045                 WITH_KRB5=TRUE
9046                 save_LIBS=$LIBS
9047                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9048                 # that the libraries where these functions are located on macOS will change, is it?
9049                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9050                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9051                 KRB5_LIBS=$LIBS
9052                 LIBS=$save_LIBS
9053                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9054                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9055                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9056                 LIBS=$save_LIBS
9057             fi
9058             if test "$with_gssapi" != "no"; then
9059                 WITH_GSSAPI=TRUE
9060                 save_LIBS=$LIBS
9061                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9062                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9063                 GSSAPI_LIBS=$LIBS
9064                 LIBS=$save_LIBS
9065             fi
9066             ;;
9067         WINNT)
9068             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9069                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9070             fi
9071             ;;
9072         Linux|GNU|*BSD|DragonFly)
9073             if test "$with_krb5" != "no"; then
9074                 WITH_KRB5=TRUE
9075                 save_LIBS=$LIBS
9076                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9077                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9078                 KRB5_LIBS=$LIBS
9079                 LIBS=$save_LIBS
9080                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9081                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9082                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9083                 LIBS=$save_LIBS
9084             fi
9085             if test "$with_gssapi" != "no"; then
9086                 WITH_GSSAPI=TRUE
9087                 save_LIBS=$LIBS
9088                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9089                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9090                 GSSAPI_LIBS=$LIBS
9091                 LIBS=$save_LIBS
9092             fi
9093             ;;
9094         *)
9095             if test "$with_krb5" = "yes"; then
9096                 WITH_KRB5=TRUE
9097                 save_LIBS=$LIBS
9098                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9099                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9100                 KRB5_LIBS=$LIBS
9101                 LIBS=$save_LIBS
9102                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9103                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9104                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9105                 LIBS=$save_LIBS
9106             fi
9107             if test "$with_gssapi" = "yes"; then
9108                 WITH_GSSAPI=TRUE
9109                 save_LIBS=$LIBS
9110                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9111                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9112                 LIBS=$save_LIBS
9113                 GSSAPI_LIBS=$LIBS
9114             fi
9115         esac
9117         if test -n "$with_libpq_path"; then
9118             SYSTEM_POSTGRESQL=TRUE
9119             postgres_interface="external libpq"
9120             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9121             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9122         else
9123             SYSTEM_POSTGRESQL=
9124             postgres_interface="internal"
9125             POSTGRESQL_LIB=""
9126             POSTGRESQL_INC="%OVERRIDE_ME%"
9127             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9128         fi
9129     fi
9131     AC_MSG_CHECKING([PostgreSQL C interface])
9132     AC_MSG_RESULT([$postgres_interface])
9134     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9135         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9136         save_CFLAGS=$CFLAGS
9137         save_CPPFLAGS=$CPPFLAGS
9138         save_LIBS=$LIBS
9139         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9140         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9141         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9142         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9143             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9144         CFLAGS=$save_CFLAGS
9145         CPPFLAGS=$save_CPPFLAGS
9146         LIBS=$save_LIBS
9147     fi
9148     BUILD_POSTGRESQL_SDBC=TRUE
9149 else
9150     AC_MSG_RESULT([no])
9152 AC_SUBST(WITH_KRB5)
9153 AC_SUBST(WITH_GSSAPI)
9154 AC_SUBST(GSSAPI_LIBS)
9155 AC_SUBST(KRB5_LIBS)
9156 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9157 AC_SUBST(SYSTEM_POSTGRESQL)
9158 AC_SUBST(POSTGRESQL_INC)
9159 AC_SUBST(POSTGRESQL_LIB)
9161 dnl ===================================================================
9162 dnl Check for Firebird stuff
9163 dnl ===================================================================
9164 ENABLE_FIREBIRD_SDBC=
9165 if test "$enable_firebird_sdbc" = "yes" ; then
9166     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9168     dnl ===================================================================
9169     dnl Check for system Firebird
9170     dnl ===================================================================
9171     AC_MSG_CHECKING([which Firebird to use])
9172     if test "$with_system_firebird" = "yes"; then
9173         AC_MSG_RESULT([external])
9174         SYSTEM_FIREBIRD=TRUE
9175         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9176         if test -z "$FIREBIRDCONFIG"; then
9177             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9178             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9179                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9180             ])
9181             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9182         else
9183             AC_MSG_NOTICE([fb_config found])
9184             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9185             AC_MSG_CHECKING([for Firebird Client library])
9186             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9187             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9188             FilterLibs "${FIREBIRD_LIBS}"
9189             FIREBIRD_LIBS="${filteredlibs}"
9190         fi
9191         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9192         AC_MSG_CHECKING([Firebird version])
9193         if test -n "${FIREBIRD_VERSION}"; then
9194             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9195             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9196             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9197                 AC_MSG_RESULT([OK])
9198             else
9199                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9200             fi
9201         else
9202             __save_CFLAGS="${CFLAGS}"
9203             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9204             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9205 #if defined(FB_API_VER) && FB_API_VER == 30
9206 int fb_api_is_30(void) { return 0; }
9207 #else
9208 #error "Wrong Firebird API version"
9209 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9210             CFLAGS="${__save_CFLAGS}"
9211         fi
9212         ENABLE_FIREBIRD_SDBC=TRUE
9213         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9214     elif test "$enable_database_connectivity" != yes; then
9215         AC_MSG_RESULT([none])
9216     elif test "$cross_compiling" = "yes"; then
9217         AC_MSG_RESULT([none])
9218     else
9219         dnl Embedded Firebird has version 3.0
9220         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9221         dnl We need libatomic_ops for any non X86/X64 system
9222         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9223             dnl ===================================================================
9224             dnl Check for system libatomic_ops
9225             dnl ===================================================================
9226             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9227             if test "$with_system_libatomic_ops" = "yes"; then
9228                 SYSTEM_LIBATOMIC_OPS=TRUE
9229                 AC_CHECK_HEADERS(atomic_ops.h, [],
9230                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9231             else
9232                 SYSTEM_LIBATOMIC_OPS=
9233                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9234                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9235                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9236             fi
9237         fi
9239         AC_MSG_RESULT([internal])
9240         SYSTEM_FIREBIRD=
9241         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9242         FIREBIRD_LIBS="-lfbclient"
9244         if test "$with_system_libtommath" = "yes"; then
9245             SYSTEM_LIBTOMMATH=TRUE
9246             dnl check for tommath presence
9247             save_LIBS=$LIBS
9248             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9249             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9250             LIBS=$save_LIBS
9251         else
9252             SYSTEM_LIBTOMMATH=
9253             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9254             LIBTOMMATH_LIBS="-ltommath"
9255             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9256         fi
9258         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9259         ENABLE_FIREBIRD_SDBC=TRUE
9260         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9261     fi
9263 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9264 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9265 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9266 AC_SUBST(LIBATOMIC_OPS_LIBS)
9267 AC_SUBST(SYSTEM_FIREBIRD)
9268 AC_SUBST(FIREBIRD_CFLAGS)
9269 AC_SUBST(FIREBIRD_LIBS)
9270 AC_SUBST([TOMMATH_CFLAGS])
9271 AC_SUBST([TOMMATH_LIBS])
9273 dnl ===================================================================
9274 dnl Check for system curl
9275 dnl ===================================================================
9276 AC_MSG_CHECKING([which libcurl to use])
9277 if test "$with_system_curl" = "auto"; then
9278     with_system_curl="$with_system_libs"
9281 if test "$with_system_curl" = "yes"; then
9282     AC_MSG_RESULT([external])
9283     SYSTEM_CURL=TRUE
9285     # First try PKGCONFIG and then fall back
9286     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9288     if test -n "$CURL_PKG_ERRORS"; then
9289         AC_PATH_PROG(CURLCONFIG, curl-config)
9290         if test -z "$CURLCONFIG"; then
9291             AC_MSG_ERROR([curl development files not found])
9292         fi
9293         CURL_LIBS=`$CURLCONFIG --libs`
9294         FilterLibs "${CURL_LIBS}"
9295         CURL_LIBS="${filteredlibs}"
9296         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9297         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9299         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9300         case $curl_version in
9301         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9302         dnl so they need to be doubled to end up in the configure script
9303         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9304             AC_MSG_RESULT([yes])
9305             ;;
9306         *)
9307             AC_MSG_ERROR([no, you have $curl_version])
9308             ;;
9309         esac
9310     fi
9312     ENABLE_CURL=TRUE
9313 elif test $_os = iOS; then
9314     # Let's see if we need curl, I think not?
9315     AC_MSG_RESULT([none])
9316     ENABLE_CURL=
9317 else
9318     AC_MSG_RESULT([internal])
9319     SYSTEM_CURL=
9320     BUILD_TYPE="$BUILD_TYPE CURL"
9321     ENABLE_CURL=TRUE
9323 AC_SUBST(SYSTEM_CURL)
9324 AC_SUBST(CURL_CFLAGS)
9325 AC_SUBST(CURL_LIBS)
9326 AC_SUBST(ENABLE_CURL)
9328 dnl ===================================================================
9329 dnl Check for system boost
9330 dnl ===================================================================
9331 AC_MSG_CHECKING([which boost to use])
9332 if test "$with_system_boost" = "yes"; then
9333     AC_MSG_RESULT([external])
9334     SYSTEM_BOOST=TRUE
9335     AX_BOOST_BASE(1.47)
9336     AX_BOOST_DATE_TIME
9337     AX_BOOST_FILESYSTEM
9338     AX_BOOST_IOSTREAMS
9339     AX_BOOST_LOCALE
9340     AC_LANG_PUSH([C++])
9341     save_CXXFLAGS=$CXXFLAGS
9342     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9343     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9344        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9345     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9346        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9347     CXXFLAGS=$save_CXXFLAGS
9348     AC_LANG_POP([C++])
9349     # this is in m4/ax_boost_base.m4
9350     FilterLibs "${BOOST_LDFLAGS}"
9351     BOOST_LDFLAGS="${filteredlibs}"
9352 else
9353     AC_MSG_RESULT([internal])
9354     BUILD_TYPE="$BUILD_TYPE BOOST"
9355     SYSTEM_BOOST=
9356     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9357         # use warning-suppressing wrapper headers
9358         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9359     else
9360         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9361     fi
9363 AC_SUBST(SYSTEM_BOOST)
9365 dnl ===================================================================
9366 dnl Check for system mdds
9367 dnl ===================================================================
9368 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9370 dnl ===================================================================
9371 dnl Check for system glm
9372 dnl ===================================================================
9373 AC_MSG_CHECKING([which glm to use])
9374 if test "$with_system_glm" = "yes"; then
9375     AC_MSG_RESULT([external])
9376     SYSTEM_GLM=TRUE
9377     AC_LANG_PUSH([C++])
9378     AC_CHECK_HEADER([glm/glm.hpp], [],
9379        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9380     AC_LANG_POP([C++])
9381 else
9382     AC_MSG_RESULT([internal])
9383     BUILD_TYPE="$BUILD_TYPE GLM"
9384     SYSTEM_GLM=
9385     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9387 AC_SUBST([GLM_CFLAGS])
9388 AC_SUBST([SYSTEM_GLM])
9390 dnl ===================================================================
9391 dnl Check for system odbc
9392 dnl ===================================================================
9393 AC_MSG_CHECKING([which odbc headers to use])
9394 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
9395     AC_MSG_RESULT([external])
9396     SYSTEM_ODBC_HEADERS=TRUE
9398     if test "$build_os" = "cygwin"; then
9399         save_CPPFLAGS=$CPPFLAGS
9400         find_winsdk
9401         PathFormat "$winsdktest"
9402         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"
9403         AC_CHECK_HEADER(sqlext.h, [],
9404             [AC_MSG_ERROR(odbc not found. install odbc)],
9405             [#include <windows.h>])
9406         CPPFLAGS=$save_CPPFLAGS
9407     else
9408         AC_CHECK_HEADER(sqlext.h, [],
9409             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9410     fi
9411 elif test "$enable_database_connectivity" != yes; then
9412     AC_MSG_RESULT([none])
9413 else
9414     AC_MSG_RESULT([internal])
9415     SYSTEM_ODBC_HEADERS=
9417 AC_SUBST(SYSTEM_ODBC_HEADERS)
9419 dnl ===================================================================
9420 dnl Enable LDAP support
9421 dnl ===================================================================
9423 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9424 AC_MSG_CHECKING([whether to enable LDAP support])
9425     if test "$enable_ldap" != "yes"; then
9426         AC_MSG_RESULT([no])
9427         ENABLE_LDAP=""
9428         enable_ldap=no
9429     else
9430         AC_MSG_RESULT([yes])
9431         ENABLE_LDAP="TRUE"
9432         AC_DEFINE(HAVE_FEATURE_LDAP)
9433     fi
9435 AC_SUBST(ENABLE_LDAP)
9437 dnl ===================================================================
9438 dnl Check for system openldap
9439 dnl ===================================================================
9441 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9442 AC_MSG_CHECKING([which openldap library to use])
9443 if test "$with_system_openldap" = "yes"; then
9444     AC_MSG_RESULT([external])
9445     SYSTEM_OPENLDAP=TRUE
9446     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9447     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9448     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9449 else
9450     AC_MSG_RESULT([internal])
9451     SYSTEM_OPENLDAP=
9452     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9455 AC_SUBST(SYSTEM_OPENLDAP)
9457 dnl ===================================================================
9458 dnl Check for system NSS
9459 dnl ===================================================================
9460 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9461     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9462     AC_DEFINE(HAVE_FEATURE_NSS)
9463     ENABLE_NSS="TRUE"
9464     AC_DEFINE(ENABLE_NSS)
9465 elif test $_os != iOS ; then
9466     with_tls=openssl
9468 AC_SUBST(ENABLE_NSS)
9470 dnl ===================================================================
9471 dnl Check for TLS/SSL and cryptographic implementation to use
9472 dnl ===================================================================
9473 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9474 if test -n "$with_tls"; then
9475     case $with_tls in
9476     openssl)
9477         AC_DEFINE(USE_TLS_OPENSSL)
9478         TLS=OPENSSL
9480         if test "$enable_openssl" != "yes"; then
9481             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9482         fi
9484         # warn that OpenSSL has been selected but not all TLS code has this option
9485         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9486         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9487         ;;
9488     nss)
9489         AC_DEFINE(USE_TLS_NSS)
9490         TLS=NSS
9491         ;;
9492     no)
9493         AC_MSG_WARN([Skipping TLS/SSL])
9494         ;;
9495     *)
9496         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9497 openssl - OpenSSL
9498 nss - Mozilla's Network Security Services (NSS)
9499     ])
9500         ;;
9501     esac
9502 else
9503     # default to using NSS, it results in smaller oox lib
9504     AC_DEFINE(USE_TLS_NSS)
9505     TLS=NSS
9507 AC_MSG_RESULT([$TLS])
9508 AC_SUBST(TLS)
9510 dnl ===================================================================
9511 dnl Check for system sane
9512 dnl ===================================================================
9513 AC_MSG_CHECKING([which sane header to use])
9514 if test "$with_system_sane" = "yes"; then
9515     AC_MSG_RESULT([external])
9516     AC_CHECK_HEADER(sane/sane.h, [],
9517       [AC_MSG_ERROR(sane not found. install sane)], [])
9518 else
9519     AC_MSG_RESULT([internal])
9520     BUILD_TYPE="$BUILD_TYPE SANE"
9523 dnl ===================================================================
9524 dnl Check for system icu
9525 dnl ===================================================================
9526 SYSTEM_GENBRK=
9527 SYSTEM_GENCCODE=
9528 SYSTEM_GENCMN=
9530 ICU_MAJOR=65
9531 ICU_MINOR=1
9532 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9533 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9534 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9535 AC_MSG_CHECKING([which icu to use])
9536 if test "$with_system_icu" = "yes"; then
9537     AC_MSG_RESULT([external])
9538     SYSTEM_ICU=TRUE
9539     AC_LANG_PUSH([C++])
9540     AC_MSG_CHECKING([for unicode/rbbi.h])
9541     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9542     AC_LANG_POP([C++])
9544     if test "$cross_compiling" != "yes"; then
9545         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9546         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9547         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9548         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9549     fi
9551     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9552         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9553         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9554         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9555         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9556         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9557             AC_MSG_RESULT([yes])
9558         else
9559             AC_MSG_RESULT([no])
9560             if test "$with_system_icu_for_build" != "force"; then
9561                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9562 You can use --with-system-icu-for-build=force to use it anyway.])
9563             fi
9564         fi
9565     fi
9567     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9568         # using the system icu tools can lead to version confusion, use the
9569         # ones from the build environment when cross-compiling
9570         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9571         if test -z "$SYSTEM_GENBRK"; then
9572             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9573         fi
9574         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9575         if test -z "$SYSTEM_GENCCODE"; then
9576             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9577         fi
9578         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9579         if test -z "$SYSTEM_GENCMN"; then
9580             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9581         fi
9582         if test "$ICU_MAJOR" -ge "49"; then
9583             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9584             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9585             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9586         else
9587             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9588             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9589             ICU_RECLASSIFIED_HEBREW_LETTER=
9590         fi
9591     fi
9593     if test "$cross_compiling" = "yes"; then
9594         if test "$ICU_MAJOR" -ge "50"; then
9595             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9596             ICU_MINOR=""
9597         fi
9598     fi
9599 else
9600     AC_MSG_RESULT([internal])
9601     SYSTEM_ICU=
9602     BUILD_TYPE="$BUILD_TYPE ICU"
9603     # surprisingly set these only for "internal" (to be used by various other
9604     # external libs): the system icu-config is quite unhelpful and spits out
9605     # dozens of weird flags and also default path -I/usr/include
9606     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9607     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9609 if test "$ICU_MAJOR" -ge "59"; then
9610     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9611     # with -std=c++11 but not all external libraries can be built with that,
9612     # for those use a bit-compatible typedef uint16_t UChar; see
9613     # icu/source/common/unicode/umachine.h
9614     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9615 else
9616     ICU_UCHAR_TYPE=""
9618 AC_SUBST(SYSTEM_ICU)
9619 AC_SUBST(SYSTEM_GENBRK)
9620 AC_SUBST(SYSTEM_GENCCODE)
9621 AC_SUBST(SYSTEM_GENCMN)
9622 AC_SUBST(ICU_MAJOR)
9623 AC_SUBST(ICU_MINOR)
9624 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9625 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9626 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9627 AC_SUBST(ICU_CFLAGS)
9628 AC_SUBST(ICU_LIBS)
9629 AC_SUBST(ICU_UCHAR_TYPE)
9631 dnl ==================================================================
9632 dnl Breakpad
9633 dnl ==================================================================
9634 DEFAULT_CRASHDUMP_VALUE="true"
9635 AC_MSG_CHECKING([whether to enable breakpad])
9636 if test "$enable_breakpad" != yes; then
9637     AC_MSG_RESULT([no])
9638 else
9639     AC_MSG_RESULT([yes])
9640     ENABLE_BREAKPAD="TRUE"
9641     AC_DEFINE(ENABLE_BREAKPAD)
9642     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9643     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9645     AC_MSG_CHECKING([for disable crash dump])
9646     if test "$enable_crashdump" = no; then
9647         DEFAULT_CRASHDUMP_VALUE="false"
9648         AC_MSG_RESULT([yes])
9649     else
9650        AC_MSG_RESULT([no])
9651     fi
9653     AC_MSG_CHECKING([for crashreport config])
9654     if test "$with_symbol_config" = "no"; then
9655         BREAKPAD_SYMBOL_CONFIG="invalid"
9656         AC_MSG_RESULT([no])
9657     else
9658         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9659         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9660         AC_MSG_RESULT([yes])
9661     fi
9662     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9664 AC_SUBST(ENABLE_BREAKPAD)
9665 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9667 dnl ==================================================================
9668 dnl libfuzzer
9669 dnl ==================================================================
9670 AC_MSG_CHECKING([whether to enable fuzzers])
9671 if test "$enable_fuzzers" != yes; then
9672     AC_MSG_RESULT([no])
9673 else
9674     AC_MSG_RESULT([yes])
9675     ENABLE_FUZZERS="TRUE"
9676     AC_DEFINE([ENABLE_FUZZERS],1)
9677     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9679 AC_SUBST(ENABLE_FUZZERS)
9681 dnl ===================================================================
9682 dnl Orcus
9683 dnl ===================================================================
9684 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9685 if test "$with_system_orcus" != "yes"; then
9686     if test "$SYSTEM_BOOST" = "TRUE"; then
9687         # ===========================================================
9688         # Determine if we are going to need to link with Boost.System
9689         # ===========================================================
9690         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9691         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9692         dnl in documentation has no effect.
9693         AC_MSG_CHECKING([if we need to link with Boost.System])
9694         AC_LANG_PUSH([C++])
9695         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9696                 @%:@include <boost/version.hpp>
9697             ]],[[
9698                 #if BOOST_VERSION >= 105000
9699                 #   error yes, we need to link with Boost.System
9700                 #endif
9701             ]])],[
9702                 AC_MSG_RESULT([no])
9703             ],[
9704                 AC_MSG_RESULT([yes])
9705                 AX_BOOST_SYSTEM
9706         ])
9707         AC_LANG_POP([C++])
9708     fi
9710 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9711 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9712 AC_SUBST([BOOST_SYSTEM_LIB])
9713 AC_SUBST(SYSTEM_LIBORCUS)
9715 dnl ===================================================================
9716 dnl HarfBuzz
9717 dnl ===================================================================
9718 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9719                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9720                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9722 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9723                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9724                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9726 if test "$COM" = "MSC"; then # override the above
9727     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9728     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9731 if test "$with_system_harfbuzz" = "yes"; then
9732     if test "$with_system_graphite" = "no"; then
9733         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9734     fi
9735     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9736     _save_libs="$LIBS"
9737     _save_cflags="$CFLAGS"
9738     LIBS="$LIBS $HARFBUZZ_LIBS"
9739     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9740     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9741     LIBS="$_save_libs"
9742     CFLAGS="$_save_cflags"
9743 else
9744     if test "$with_system_graphite" = "yes"; then
9745         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9746     fi
9749 AC_MSG_CHECKING([whether to use X11])
9750 dnl ***************************************
9751 dnl testing for X libraries and includes...
9752 dnl ***************************************
9753 if test "$USING_X11" = TRUE; then
9754     AC_DEFINE(HAVE_FEATURE_X11)
9756 AC_MSG_RESULT([$USING_X11])
9758 if test "$USING_X11" = TRUE; then
9759     AC_PATH_X
9760     AC_PATH_XTRA
9761     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9763     if test -z "$x_includes"; then
9764         x_includes="default_x_includes"
9765     fi
9766     if test -z "$x_libraries"; then
9767         x_libraries="default_x_libraries"
9768     fi
9769     CFLAGS="$CFLAGS $X_CFLAGS"
9770     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9771     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9772 else
9773     x_includes="no_x_includes"
9774     x_libraries="no_x_libraries"
9777 if test "$USING_X11" = TRUE; then
9778     dnl ===================================================================
9779     dnl Check for extension headers
9780     dnl ===================================================================
9781     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9782      [#include <X11/extensions/shape.h>])
9784     # vcl needs ICE and SM
9785     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9786     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9787         [AC_MSG_ERROR(ICE library not found)])
9788     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9789     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9790         [AC_MSG_ERROR(SM library not found)])
9793 dnl ===================================================================
9794 dnl Check for system Xrender
9795 dnl ===================================================================
9796 AC_MSG_CHECKING([whether to use Xrender])
9797 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9798     AC_MSG_RESULT([yes])
9799     PKG_CHECK_MODULES(XRENDER, xrender)
9800     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9801     FilterLibs "${XRENDER_LIBS}"
9802     XRENDER_LIBS="${filteredlibs}"
9803     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9804       [AC_MSG_ERROR(libXrender not found or functional)], [])
9805     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9806       [AC_MSG_ERROR(Xrender not found. install X)], [])
9807 else
9808     AC_MSG_RESULT([no])
9810 AC_SUBST(XRENDER_CFLAGS)
9811 AC_SUBST(XRENDER_LIBS)
9813 dnl ===================================================================
9814 dnl Check for XRandr
9815 dnl ===================================================================
9816 AC_MSG_CHECKING([whether to enable RandR support])
9817 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9818     AC_MSG_RESULT([yes])
9819     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9820     if test "$ENABLE_RANDR" != "TRUE"; then
9821         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9822                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9823         XRANDR_CFLAGS=" "
9824         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9825           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9826         XRANDR_LIBS="-lXrandr "
9827         ENABLE_RANDR="TRUE"
9828     fi
9829     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9830     FilterLibs "${XRANDR_LIBS}"
9831     XRANDR_LIBS="${filteredlibs}"
9832 else
9833     ENABLE_RANDR=""
9834     AC_MSG_RESULT([no])
9836 AC_SUBST(XRANDR_CFLAGS)
9837 AC_SUBST(XRANDR_LIBS)
9838 AC_SUBST(ENABLE_RANDR)
9840 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9841     WITH_WEBDAV="serf"
9843 if test $_os = iOS -o $_os = Android; then
9844     WITH_WEBDAV="no"
9846 AC_MSG_CHECKING([for webdav library])
9847 case "$WITH_WEBDAV" in
9848 serf)
9849     AC_MSG_RESULT([serf])
9850     # Check for system apr-util
9851     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9852                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9853                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9854     if test "$COM" = "MSC"; then
9855         APR_LIB_DIR="LibR"
9856         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9857         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9858     fi
9860     # Check for system serf
9861     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9862                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9863     if test "$COM" = "MSC"; then
9864         SERF_LIB_DIR="Release"
9865         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9866         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9867     fi
9868     ;;
9869 neon)
9870     AC_MSG_RESULT([neon])
9871     # Check for system neon
9872     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9873     if test "$with_system_neon" = "yes"; then
9874         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9875     else
9876         NEON_VERSION=0295
9877     fi
9878     AC_SUBST(NEON_VERSION)
9879     ;;
9881     AC_MSG_RESULT([none, disabled])
9882     WITH_WEBDAV=""
9883     ;;
9884 esac
9885 AC_SUBST(WITH_WEBDAV)
9887 dnl ===================================================================
9888 dnl Check for disabling cve_tests
9889 dnl ===================================================================
9890 AC_MSG_CHECKING([whether to execute CVE tests])
9891 # If not explicitly enabled or disabled, default
9892 if test -z "$enable_cve_tests"; then
9893     case "$OS" in
9894     WNT)
9895         # Default cves off for Windows with its wild and wonderful
9896         # variety of AV software kicking in and panicking
9897         enable_cve_tests=no
9898         ;;
9899     *)
9900         # otherwise yes
9901         enable_cve_tests=yes
9902         ;;
9903     esac
9905 if test "$enable_cve_tests" = "no"; then
9906     AC_MSG_RESULT([no])
9907     DISABLE_CVE_TESTS=TRUE
9908     AC_SUBST(DISABLE_CVE_TESTS)
9909 else
9910     AC_MSG_RESULT([yes])
9913 dnl ===================================================================
9914 dnl Check for enabling chart XShape tests
9915 dnl ===================================================================
9916 AC_MSG_CHECKING([whether to execute chart XShape tests])
9917 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9918     AC_MSG_RESULT([yes])
9919     ENABLE_CHART_TESTS=TRUE
9920     AC_SUBST(ENABLE_CHART_TESTS)
9921 else
9922     AC_MSG_RESULT([no])
9925 dnl ===================================================================
9926 dnl Check for system openssl
9927 dnl ===================================================================
9928 DISABLE_OPENSSL=
9929 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9930 if test "$enable_openssl" = "yes"; then
9931     AC_MSG_RESULT([no])
9932     if test "$_os" = Darwin ; then
9933         # OpenSSL is deprecated when building for 10.7 or later.
9934         #
9935         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9936         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9938         with_system_openssl=no
9939         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9940     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9941             && test "$with_system_openssl" != "no"; then
9942         with_system_openssl=yes
9943         SYSTEM_OPENSSL=TRUE
9944         OPENSSL_CFLAGS=
9945         OPENSSL_LIBS="-lssl -lcrypto"
9946     else
9947         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9948     fi
9949     if test "$with_system_openssl" = "yes"; then
9950         AC_MSG_CHECKING([whether openssl supports SHA512])
9951         AC_LANG_PUSH([C])
9952         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9953             SHA512_CTX context;
9954 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9955         AC_LANG_POP(C)
9956     fi
9957 else
9958     AC_MSG_RESULT([yes])
9959     DISABLE_OPENSSL=TRUE
9961     # warn that although OpenSSL is disabled, system libraries may depend on it
9962     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9963     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9966 AC_SUBST([DISABLE_OPENSSL])
9968 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9969     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9970         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9971         enable_cipher_openssl_backend=no
9972     else
9973         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9974     fi
9976 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9977 ENABLE_CIPHER_OPENSSL_BACKEND=
9978 if test "$enable_cipher_openssl_backend" = yes; then
9979     AC_MSG_RESULT([yes])
9980     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9981 else
9982     AC_MSG_RESULT([no])
9984 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9986 dnl ===================================================================
9987 dnl Check for building gnutls
9988 dnl ===================================================================
9989 AC_MSG_CHECKING([whether to use gnutls])
9990 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9991     AC_MSG_RESULT([yes])
9992     AM_PATH_LIBGCRYPT()
9993     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9994         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9995                       available in the system to use as replacement.]]))
9996     FilterLibs "${LIBGCRYPT_LIBS}"
9997     LIBGCRYPT_LIBS="${filteredlibs}"
9998 else
9999     AC_MSG_RESULT([no])
10002 AC_SUBST([LIBGCRYPT_CFLAGS])
10003 AC_SUBST([LIBGCRYPT_LIBS])
10005 dnl ===================================================================
10006 dnl Check for system redland
10007 dnl ===================================================================
10008 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10009 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10010 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10011 if test "$with_system_redland" = "yes"; then
10012     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10013             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10014 else
10015     RAPTOR_MAJOR="0"
10016     RASQAL_MAJOR="3"
10017     REDLAND_MAJOR="0"
10019 AC_SUBST(RAPTOR_MAJOR)
10020 AC_SUBST(RASQAL_MAJOR)
10021 AC_SUBST(REDLAND_MAJOR)
10023 dnl ===================================================================
10024 dnl Check for system hunspell
10025 dnl ===================================================================
10026 AC_MSG_CHECKING([which libhunspell to use])
10027 if test "$with_system_hunspell" = "yes"; then
10028     AC_MSG_RESULT([external])
10029     SYSTEM_HUNSPELL=TRUE
10030     AC_LANG_PUSH([C++])
10031     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10032     if test "$HUNSPELL_PC" != "TRUE"; then
10033         AC_CHECK_HEADER(hunspell.hxx, [],
10034             [
10035             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10036             [AC_MSG_ERROR(hunspell headers not found.)], [])
10037             ], [])
10038         AC_CHECK_LIB([hunspell], [main], [:],
10039            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10040         HUNSPELL_LIBS=-lhunspell
10041     fi
10042     AC_LANG_POP([C++])
10043     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10044     FilterLibs "${HUNSPELL_LIBS}"
10045     HUNSPELL_LIBS="${filteredlibs}"
10046 else
10047     AC_MSG_RESULT([internal])
10048     SYSTEM_HUNSPELL=
10049     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10050     if test "$COM" = "MSC"; then
10051         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10052     else
10053         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10054     fi
10055     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10057 AC_SUBST(SYSTEM_HUNSPELL)
10058 AC_SUBST(HUNSPELL_CFLAGS)
10059 AC_SUBST(HUNSPELL_LIBS)
10061 dnl ===================================================================
10062 dnl Check for system qrcodegen
10063 dnl ===================================================================
10064 AC_MSG_CHECKING([which libqrcodegen to use])
10065 if test "$with_system_qrcodegen" = "yes"; then
10066     AC_MSG_RESULT([external])
10067     SYSTEM_QRCODEGEN=TRUE
10068     AC_LANG_PUSH([C++])
10069     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10070         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10071     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10072         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10073     QRCODEGEN_LIBS=-lqrcodegencpp
10074     AC_LANG_POP([C++])
10075     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10076     FilterLibs "${QRCODEGEN_LIBS}"
10077     QRCODEGEN_LIBS="${filteredlibs}"
10078 else
10079     AC_MSG_RESULT([internal])
10080     SYSTEM_QRCODEGEN=
10081     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10083 AC_SUBST(SYSTEM_QRCODEGEN)
10084 AC_SUBST(QRCODEGEN_CFLAGS)
10085 AC_SUBST(QRCODEGEN_LIBS)
10087 dnl ===================================================================
10088 dnl Checking for altlinuxhyph
10089 dnl ===================================================================
10090 AC_MSG_CHECKING([which altlinuxhyph to use])
10091 if test "$with_system_altlinuxhyph" = "yes"; then
10092     AC_MSG_RESULT([external])
10093     SYSTEM_HYPH=TRUE
10094     AC_CHECK_HEADER(hyphen.h, [],
10095        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10096     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10097        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10098        [#include <hyphen.h>])
10099     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10100         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10101     if test -z "$HYPHEN_LIB"; then
10102         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10103            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10104     fi
10105     if test -z "$HYPHEN_LIB"; then
10106         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10107            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10108     fi
10109 else
10110     AC_MSG_RESULT([internal])
10111     SYSTEM_HYPH=
10112     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10113     if test "$COM" = "MSC"; then
10114         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10115     else
10116         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10117     fi
10119 AC_SUBST(SYSTEM_HYPH)
10120 AC_SUBST(HYPHEN_LIB)
10122 dnl ===================================================================
10123 dnl Checking for mythes
10124 dnl ===================================================================
10125 AC_MSG_CHECKING([which mythes to use])
10126 if test "$with_system_mythes" = "yes"; then
10127     AC_MSG_RESULT([external])
10128     SYSTEM_MYTHES=TRUE
10129     AC_LANG_PUSH([C++])
10130     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10131     if test "$MYTHES_PKGCONFIG" = "no"; then
10132         AC_CHECK_HEADER(mythes.hxx, [],
10133             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10134         AC_CHECK_LIB([mythes-1.2], [main], [:],
10135             [ MYTHES_FOUND=no], [])
10136     if test "$MYTHES_FOUND" = "no"; then
10137         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10138                 [ MYTHES_FOUND=no], [])
10139     fi
10140     if test "$MYTHES_FOUND" = "no"; then
10141         AC_MSG_ERROR([mythes library not found!.])
10142     fi
10143     fi
10144     AC_LANG_POP([C++])
10145     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10146     FilterLibs "${MYTHES_LIBS}"
10147     MYTHES_LIBS="${filteredlibs}"
10148 else
10149     AC_MSG_RESULT([internal])
10150     SYSTEM_MYTHES=
10151     BUILD_TYPE="$BUILD_TYPE MYTHES"
10152     if test "$COM" = "MSC"; then
10153         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10154     else
10155         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10156     fi
10158 AC_SUBST(SYSTEM_MYTHES)
10159 AC_SUBST(MYTHES_CFLAGS)
10160 AC_SUBST(MYTHES_LIBS)
10162 dnl ===================================================================
10163 dnl How should we build the linear programming solver ?
10164 dnl ===================================================================
10166 ENABLE_COINMP=
10167 AC_MSG_CHECKING([whether to build with CoinMP])
10168 if test "$enable_coinmp" != "no"; then
10169     ENABLE_COINMP=TRUE
10170     AC_MSG_RESULT([yes])
10171     if test "$with_system_coinmp" = "yes"; then
10172         SYSTEM_COINMP=TRUE
10173         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10174         FilterLibs "${COINMP_LIBS}"
10175         COINMP_LIBS="${filteredlibs}"
10176     else
10177         BUILD_TYPE="$BUILD_TYPE COINMP"
10178     fi
10179 else
10180     AC_MSG_RESULT([no])
10182 AC_SUBST(ENABLE_COINMP)
10183 AC_SUBST(SYSTEM_COINMP)
10184 AC_SUBST(COINMP_CFLAGS)
10185 AC_SUBST(COINMP_LIBS)
10187 ENABLE_LPSOLVE=
10188 AC_MSG_CHECKING([whether to build with lpsolve])
10189 if test "$enable_lpsolve" != "no"; then
10190     ENABLE_LPSOLVE=TRUE
10191     AC_MSG_RESULT([yes])
10192 else
10193     AC_MSG_RESULT([no])
10195 AC_SUBST(ENABLE_LPSOLVE)
10197 if test "$ENABLE_LPSOLVE" = TRUE; then
10198     AC_MSG_CHECKING([which lpsolve to use])
10199     if test "$with_system_lpsolve" = "yes"; then
10200         AC_MSG_RESULT([external])
10201         SYSTEM_LPSOLVE=TRUE
10202         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10203            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10204         save_LIBS=$LIBS
10205         # some systems need this. Like Ubuntu...
10206         AC_CHECK_LIB(m, floor)
10207         AC_CHECK_LIB(dl, dlopen)
10208         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10209             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10210         LIBS=$save_LIBS
10211     else
10212         AC_MSG_RESULT([internal])
10213         SYSTEM_LPSOLVE=
10214         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10215     fi
10217 AC_SUBST(SYSTEM_LPSOLVE)
10219 dnl ===================================================================
10220 dnl Checking for libexttextcat
10221 dnl ===================================================================
10222 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10223 if test "$with_system_libexttextcat" = "yes"; then
10224     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10226 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10228 dnl ===================================================================
10229 dnl Checking for libnumbertext
10230 dnl ===================================================================
10231 AC_MSG_CHECKING([whether to use libnumbertext])
10232 if test "$enable_libnumbertext" = "no"; then
10233     AC_MSG_RESULT([no])
10234     ENABLE_LIBNUMBERTEXT=
10235     SYSTEM_LIBNUMBERTEXT=
10236 else
10237     AC_MSG_RESULT([yes])
10238     ENABLE_LIBNUMBERTEXT=TRUE
10239     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10240     if test "$with_system_libnumbertext" = "yes"; then
10241         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10242         SYSTEM_LIBNUMBERTEXT=YES
10243     else
10244         SYSTEM_LIBNUMBERTEXT=
10245         AC_LANG_PUSH([C++])
10246         save_CPPFLAGS=$CPPFLAGS
10247         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10248         AC_CHECK_HEADERS([codecvt regex])
10249         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10250                 [ ENABLE_LIBNUMBERTEXT=''
10251                   LIBNUMBERTEXT_CFLAGS=''
10252                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10253                                Enable libnumbertext fallback (missing number to number name conversion).])
10254                 ])
10255         CPPFLAGS=$save_CPPFLAGS
10256         AC_LANG_POP([C++])
10257     fi
10258     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10259         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10260     fi
10262 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10263 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10264 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10265 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10267 dnl ***************************************
10268 dnl testing libc version for Linux...
10269 dnl ***************************************
10270 if test "$_os" = "Linux"; then
10271     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10272     exec 6>/dev/null # no output
10273     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10274     exec 6>&1 # output on again
10275     if test "$HAVE_LIBC"; then
10276         AC_MSG_RESULT([yes])
10277     else
10278         AC_MSG_ERROR([no, upgrade libc])
10279     fi
10282 dnl =========================================
10283 dnl Check for uuidgen
10284 dnl =========================================
10285 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10286     # presence is already tested above in the WINDOWS_SDK_HOME check
10287     UUIDGEN=uuidgen.exe
10288     AC_SUBST(UUIDGEN)
10289 else
10290     AC_PATH_PROG([UUIDGEN], [uuidgen])
10291     if test -z "$UUIDGEN"; then
10292         AC_MSG_WARN([uuid is needed for building installation sets])
10293     fi
10296 dnl ***************************************
10297 dnl Checking for bison and flex
10298 dnl ***************************************
10299 AC_PATH_PROG(BISON, bison)
10300 if test -z "$BISON"; then
10301     AC_MSG_ERROR([no bison found in \$PATH, install it])
10302 else
10303     AC_MSG_CHECKING([the bison version])
10304     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10305     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10306     # Accept newer than 2.0
10307     if test "$_bison_longver" -lt 2000; then
10308         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10309     fi
10312 AC_PATH_PROG(FLEX, flex)
10313 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10314     FLEX=`cygpath -m $FLEX`
10316 if test -z "$FLEX"; then
10317     AC_MSG_ERROR([no flex found in \$PATH, install it])
10318 else
10319     AC_MSG_CHECKING([the flex version])
10320     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10321     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10322         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10323     fi
10325 AC_SUBST([FLEX])
10326 dnl ***************************************
10327 dnl Checking for patch
10328 dnl ***************************************
10329 AC_PATH_PROG(PATCH, patch)
10330 if test -z "$PATCH"; then
10331     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10334 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10335 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10336     if test -z "$with_gnu_patch"; then
10337         GNUPATCH=$PATCH
10338     else
10339         if test -x "$with_gnu_patch"; then
10340             GNUPATCH=$with_gnu_patch
10341         else
10342             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10343         fi
10344     fi
10346     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10347     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10348         AC_MSG_RESULT([yes])
10349     else
10350         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10351     fi
10352 else
10353     GNUPATCH=$PATCH
10356 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10357     GNUPATCH=`cygpath -m $GNUPATCH`
10360 dnl We also need to check for --with-gnu-cp
10362 if test -z "$with_gnu_cp"; then
10363     # check the place where the good stuff is hidden on Solaris...
10364     if test -x /usr/gnu/bin/cp; then
10365         GNUCP=/usr/gnu/bin/cp
10366     else
10367         AC_PATH_PROGS(GNUCP, gnucp cp)
10368     fi
10369     if test -z $GNUCP; then
10370         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10371     fi
10372 else
10373     if test -x "$with_gnu_cp"; then
10374         GNUCP=$with_gnu_cp
10375     else
10376         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10377     fi
10380 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10381     GNUCP=`cygpath -m $GNUCP`
10384 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10385 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10386     AC_MSG_RESULT([yes])
10387 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10388     AC_MSG_RESULT([yes])
10389 else
10390     case "$build_os" in
10391     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10392         x_GNUCP=[\#]
10393         GNUCP=''
10394         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10395         ;;
10396     *)
10397         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10398         ;;
10399     esac
10402 AC_SUBST(GNUPATCH)
10403 AC_SUBST(GNUCP)
10404 AC_SUBST(x_GNUCP)
10406 dnl ***************************************
10407 dnl testing assembler path
10408 dnl ***************************************
10409 ML_EXE=""
10410 if test "$_os" = "WINNT"; then
10411     if test "$BITNESS_OVERRIDE" = ""; then
10412         assembler=ml.exe
10413     else
10414         assembler=ml64.exe
10415     fi
10417     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10418     if test -f "$CL_PATH/$assembler"; then
10419         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10420         AC_MSG_RESULT([$ML_EXE])
10421     else
10422         AC_MSG_ERROR([not found])
10423     fi
10426 AC_SUBST(ML_EXE)
10428 dnl ===================================================================
10429 dnl We need zip and unzip
10430 dnl ===================================================================
10431 AC_PATH_PROG(ZIP, zip)
10432 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10433 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10434     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],,)
10437 AC_PATH_PROG(UNZIP, unzip)
10438 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10440 dnl ===================================================================
10441 dnl Zip must be a specific type for different build types.
10442 dnl ===================================================================
10443 if test $build_os = cygwin; then
10444     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10445         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10446     fi
10449 dnl ===================================================================
10450 dnl We need touch with -h option support.
10451 dnl ===================================================================
10452 AC_PATH_PROG(TOUCH, touch)
10453 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10454 touch warn
10455 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10456     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],,)
10459 dnl ===================================================================
10460 dnl Check for system epoxy
10461 dnl ===================================================================
10462 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10464 dnl ===================================================================
10465 dnl Set vcl option: coordinate device in double or sal_Int32
10466 dnl ===================================================================
10468 dnl disabled for now, we don't want subtle differences between OSs
10469 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10470 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10471 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10472 dnl     AC_MSG_RESULT([double])
10473 dnl else
10474 dnl     AC_MSG_RESULT([sal_Int32])
10475 dnl fi
10477 dnl ===================================================================
10478 dnl Test which vclplugs have to be built.
10479 dnl ===================================================================
10480 R=""
10481 if test "$USING_X11" != TRUE; then
10482     enable_gtk3=no
10484 GTK3_CFLAGS=""
10485 GTK3_LIBS=""
10486 ENABLE_GTK3=""
10487 if test "x$enable_gtk3" = "xyes"; then
10488     if test "$with_system_cairo" = no; then
10489         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10490     fi
10491     : ${with_system_cairo:=yes}
10492     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="")
10493     if test "x$ENABLE_GTK3" = "xTRUE"; then
10494         AC_DEFINE(ENABLE_GTK3)
10495         R="gtk3"
10496     else
10497         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10498     fi
10499     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10500     FilterLibs "${GTK3_LIBS}"
10501     GTK3_LIBS="${filteredlibs}"
10503     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10504     if test "$with_system_epoxy" != "yes"; then
10505         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10506         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10507                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10508     fi
10510 AC_SUBST(GTK3_LIBS)
10511 AC_SUBST(GTK3_CFLAGS)
10512 AC_SUBST(ENABLE_GTK3)
10514 if test "$enable_introspection" = yes; then
10515     if test "$ENABLE_GTK3" = TRUE; then
10516         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10517     else
10518         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10519     fi
10522 ENABLE_QT5=""
10523 if test "x$enable_qt5" = "xyes"; then
10524     ENABLE_QT5="TRUE"
10525     AC_DEFINE(ENABLE_QT5)
10526     R="$R qt5"
10528 AC_SUBST(ENABLE_QT5)
10530 ENABLE_KF5=""
10531 if test "x$enable_kf5" = "xyes"; then
10532     ENABLE_KF5="TRUE"
10533     AC_DEFINE(ENABLE_KF5)
10534     R="$R kf5"
10536 AC_SUBST(ENABLE_KF5)
10538 ENABLE_GTK3_KDE5=""
10539 if test "x$enable_gtk3_kde5" = "xyes"; then
10540     ENABLE_GTK3_KDE5="TRUE"
10541     AC_DEFINE(ENABLE_GTK3_KDE5)
10542     R="$R gtk3_kde5"
10544 AC_SUBST(ENABLE_GTK3_KDE5)
10546 if test "$_os" = "WINNT"; then
10547     R="$R win"
10548 elif test "$_os" = "Darwin"; then
10549     R="$R osx"
10550 elif test "$_os" = "iOS"; then
10551     R="ios (builtin)"
10554 build_vcl_plugins="$R"
10555 if test -z "$build_vcl_plugins"; then
10556     build_vcl_plugins="none"
10558 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10560 dnl ===================================================================
10561 dnl check for dbus support
10562 dnl ===================================================================
10563 ENABLE_DBUS=""
10564 DBUS_CFLAGS=""
10565 DBUS_LIBS=""
10566 DBUS_GLIB_CFLAGS=""
10567 DBUS_GLIB_LIBS=""
10568 DBUS_HAVE_GLIB=""
10570 if test "$enable_dbus" = "no"; then
10571     test_dbus=no
10574 AC_MSG_CHECKING([whether to enable DBUS support])
10575 if test "$test_dbus" = "yes"; then
10576     ENABLE_DBUS="TRUE"
10577     AC_MSG_RESULT([yes])
10578     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10579     AC_DEFINE(ENABLE_DBUS)
10580     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10581     FilterLibs "${DBUS_LIBS}"
10582     DBUS_LIBS="${filteredlibs}"
10584     # Glib is needed for BluetoothServer
10585     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10586     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10587         [
10588             DBUS_HAVE_GLIB="TRUE"
10589             AC_DEFINE(DBUS_HAVE_GLIB,1)
10590         ],
10591         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10592     )
10593 else
10594     AC_MSG_RESULT([no])
10597 AC_SUBST(ENABLE_DBUS)
10598 AC_SUBST(DBUS_CFLAGS)
10599 AC_SUBST(DBUS_LIBS)
10600 AC_SUBST(DBUS_GLIB_CFLAGS)
10601 AC_SUBST(DBUS_GLIB_LIBS)
10602 AC_SUBST(DBUS_HAVE_GLIB)
10604 AC_MSG_CHECKING([whether to enable Impress remote control])
10605 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10606     AC_MSG_RESULT([yes])
10607     ENABLE_SDREMOTE=TRUE
10608     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10610     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10611         # The Bluetooth code doesn't compile with macOS SDK 10.15
10612         enable_sdremote_bluetooth=no
10613     fi
10614     # If not explicitly enabled or disabled, default
10615     if test -z "$enable_sdremote_bluetooth"; then
10616         case "$OS" in
10617         LINUX|MACOSX|WNT)
10618             # Default to yes for these
10619             enable_sdremote_bluetooth=yes
10620             ;;
10621         *)
10622             # otherwise no
10623             enable_sdremote_bluetooth=no
10624             ;;
10625         esac
10626     fi
10627     # $enable_sdremote_bluetooth is guaranteed non-empty now
10629     if test "$enable_sdremote_bluetooth" != "no"; then
10630         if test "$OS" = "LINUX"; then
10631             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10632                 AC_MSG_RESULT([yes])
10633                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10634                 dnl ===================================================================
10635                 dnl Check for system bluez
10636                 dnl ===================================================================
10637                 AC_MSG_CHECKING([which Bluetooth header to use])
10638                 if test "$with_system_bluez" = "yes"; then
10639                     AC_MSG_RESULT([external])
10640                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10641                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10642                     SYSTEM_BLUEZ=TRUE
10643                 else
10644                     AC_MSG_RESULT([internal])
10645                     SYSTEM_BLUEZ=
10646                 fi
10647             else
10648                 AC_MSG_RESULT([no, dbus disabled])
10649                 ENABLE_SDREMOTE_BLUETOOTH=
10650                 SYSTEM_BLUEZ=
10651             fi
10652         else
10653             AC_MSG_RESULT([yes])
10654             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10655             SYSTEM_BLUEZ=
10656         fi
10657     else
10658         AC_MSG_RESULT([no])
10659         ENABLE_SDREMOTE_BLUETOOTH=
10660         SYSTEM_BLUEZ=
10661     fi
10662 else
10663     ENABLE_SDREMOTE=
10664     SYSTEM_BLUEZ=
10665     AC_MSG_RESULT([no])
10667 AC_SUBST(ENABLE_SDREMOTE)
10668 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10669 AC_SUBST(SYSTEM_BLUEZ)
10671 dnl ===================================================================
10672 dnl Check whether to enable GIO support
10673 dnl ===================================================================
10674 if test "$ENABLE_GTK3" = "TRUE"; then
10675     AC_MSG_CHECKING([whether to enable GIO support])
10676     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10677         dnl Need at least 2.26 for the dbus support.
10678         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10679                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10680         if test "$ENABLE_GIO" = "TRUE"; then
10681             AC_DEFINE(ENABLE_GIO)
10682             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10683             FilterLibs "${GIO_LIBS}"
10684             GIO_LIBS="${filteredlibs}"
10685         fi
10686     else
10687         AC_MSG_RESULT([no])
10688     fi
10690 AC_SUBST(ENABLE_GIO)
10691 AC_SUBST(GIO_CFLAGS)
10692 AC_SUBST(GIO_LIBS)
10695 dnl ===================================================================
10697 SPLIT_APP_MODULES=""
10698 if test "$enable_split_app_modules" = "yes"; then
10699     SPLIT_APP_MODULES="TRUE"
10701 AC_SUBST(SPLIT_APP_MODULES)
10703 SPLIT_OPT_FEATURES=""
10704 if test "$enable_split_opt_features" = "yes"; then
10705     SPLIT_OPT_FEATURES="TRUE"
10707 AC_SUBST(SPLIT_OPT_FEATURES)
10709 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10710     if test "$enable_cairo_canvas" = yes; then
10711         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10712     fi
10713     enable_cairo_canvas=no
10714 elif test -z "$enable_cairo_canvas"; then
10715     enable_cairo_canvas=yes
10718 ENABLE_CAIRO_CANVAS=""
10719 if test "$enable_cairo_canvas" = "yes"; then
10720     test_cairo=yes
10721     ENABLE_CAIRO_CANVAS="TRUE"
10722     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10724 AC_SUBST(ENABLE_CAIRO_CANVAS)
10726 dnl ===================================================================
10727 dnl Check whether the GStreamer libraries are available.
10728 dnl ===================================================================
10730 ENABLE_GSTREAMER_1_0=""
10732 if test "$build_gstreamer_1_0" = "yes"; then
10734     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10735     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10736         ENABLE_GSTREAMER_1_0="TRUE"
10737         AC_MSG_RESULT([yes])
10738         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10739         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10740         FilterLibs "${GSTREAMER_1_0_LIBS}"
10741         GSTREAMER_1_0_LIBS="${filteredlibs}"
10742         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10743     else
10744         AC_MSG_RESULT([no])
10745     fi
10747 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10748 AC_SUBST(GSTREAMER_1_0_LIBS)
10749 AC_SUBST(ENABLE_GSTREAMER_1_0)
10751 dnl ===================================================================
10752 dnl Check whether to build the VLC avmedia backend
10753 dnl ===================================================================
10755 ENABLE_VLC=""
10757 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10758 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10759     ENABLE_VLC="TRUE"
10760     AC_MSG_RESULT([yes])
10761 else
10762     AC_MSG_RESULT([no])
10764 AC_SUBST(ENABLE_VLC)
10766 ENABLE_OPENGL_TRANSITIONS=
10767 ENABLE_OPENGL_CANVAS=
10768 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10769    : # disable
10770 elif test "$_os" = "Darwin"; then
10771     # We use frameworks on macOS, no need for detail checks
10772     ENABLE_OPENGL_TRANSITIONS=TRUE
10773     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10774     ENABLE_OPENGL_CANVAS=TRUE
10775 elif test $_os = WINNT; then
10776     ENABLE_OPENGL_TRANSITIONS=TRUE
10777     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10778     ENABLE_OPENGL_CANVAS=TRUE
10779 else
10780     if test "$USING_X11" = TRUE; then
10781         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10782         ENABLE_OPENGL_TRANSITIONS=TRUE
10783         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10784         ENABLE_OPENGL_CANVAS=TRUE
10785     fi
10788 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10789 AC_SUBST(ENABLE_OPENGL_CANVAS)
10791 dnl =================================================
10792 dnl Check whether to build with OpenCL support.
10793 dnl =================================================
10795 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10796     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10797     # platform (optional at run-time, used through clew).
10798     BUILD_TYPE="$BUILD_TYPE OPENCL"
10799     AC_DEFINE(HAVE_FEATURE_OPENCL)
10802 dnl =================================================
10803 dnl Check whether to build with dconf support.
10804 dnl =================================================
10806 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10807     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10808         if test "$enable_dconf" = yes; then
10809             AC_MSG_ERROR([dconf not found])
10810         else
10811             enable_dconf=no
10812         fi])
10814 AC_MSG_CHECKING([whether to enable dconf])
10815 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10816     DCONF_CFLAGS=
10817     DCONF_LIBS=
10818     ENABLE_DCONF=
10819     AC_MSG_RESULT([no])
10820 else
10821     ENABLE_DCONF=TRUE
10822     AC_DEFINE(ENABLE_DCONF)
10823     AC_MSG_RESULT([yes])
10825 AC_SUBST([DCONF_CFLAGS])
10826 AC_SUBST([DCONF_LIBS])
10827 AC_SUBST([ENABLE_DCONF])
10829 # pdf import?
10830 AC_MSG_CHECKING([whether to build the PDF import feature])
10831 ENABLE_PDFIMPORT=
10832 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10833     AC_MSG_RESULT([yes])
10834     ENABLE_PDFIMPORT=TRUE
10835     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10836 else
10837     AC_MSG_RESULT([no])
10840 # Pdfium?
10841 AC_MSG_CHECKING([whether to build PDFium])
10842 ENABLE_PDFIUM=
10843 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10844     AC_MSG_RESULT([yes])
10845     ENABLE_PDFIUM=TRUE
10846     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10847     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10848 else
10849     AC_MSG_RESULT([no])
10851 AC_SUBST(ENABLE_PDFIUM)
10853 dnl ===================================================================
10854 dnl Check for poppler
10855 dnl ===================================================================
10856 ENABLE_POPPLER=
10857 AC_MSG_CHECKING([whether to build Poppler])
10858 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10859     AC_MSG_RESULT([yes])
10860     ENABLE_POPPLER=TRUE
10861     AC_DEFINE(HAVE_FEATURE_POPPLER)
10862 else
10863     AC_MSG_RESULT([no])
10865 AC_SUBST(ENABLE_POPPLER)
10867 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10868     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10871 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10872     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10875 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10876     dnl ===================================================================
10877     dnl Check for system poppler
10878     dnl ===================================================================
10879     AC_MSG_CHECKING([which PDF import poppler to use])
10880     if test "$with_system_poppler" = "yes"; then
10881         AC_MSG_RESULT([external])
10882         SYSTEM_POPPLER=TRUE
10883         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10884         AC_LANG_PUSH([C++])
10885         save_CXXFLAGS=$CXXFLAGS
10886         save_CPPFLAGS=$CPPFLAGS
10887         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10888         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10889         AC_CHECK_HEADER([cpp/poppler-version.h],
10890             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10891             [])
10892         CXXFLAGS=$save_CXXFLAGS
10893         CPPFLAGS=$save_CPPFLAGS
10894         AC_LANG_POP([C++])
10895         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10897         FilterLibs "${POPPLER_LIBS}"
10898         POPPLER_LIBS="${filteredlibs}"
10899     else
10900         AC_MSG_RESULT([internal])
10901         SYSTEM_POPPLER=
10902         BUILD_TYPE="$BUILD_TYPE POPPLER"
10903         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10904     fi
10905     AC_DEFINE([ENABLE_PDFIMPORT],1)
10907 AC_SUBST(ENABLE_PDFIMPORT)
10908 AC_SUBST(SYSTEM_POPPLER)
10909 AC_SUBST(POPPLER_CFLAGS)
10910 AC_SUBST(POPPLER_LIBS)
10912 SYSTEM_GPGMEPP=
10914 if test "$build_for_ios" = "YES"; then
10915     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10916     AC_MSG_RESULT([yes])
10917 elif test "$enable_mpl_subset" = "yes"; then
10918     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10919     AC_MSG_RESULT([yes])
10920 elif test "$enable_fuzzers" = "yes"; then
10921     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10922     AC_MSG_RESULT([yes])
10923 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10924     dnl ===================================================================
10925     dnl Check for system gpgme
10926     dnl ===================================================================
10927     AC_MSG_CHECKING([which gpgmepp to use])
10928     if test "$with_system_gpgmepp" = "yes"; then
10929         AC_MSG_RESULT([external])
10930         SYSTEM_GPGMEPP=TRUE
10932         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10933         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10934             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10935         # progress_callback is the only func with plain C linkage
10936         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10937         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10938             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10939         AC_CHECK_HEADER(gpgme.h, [],
10940             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10941     else
10942         AC_MSG_RESULT([internal])
10943         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10944         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10946         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10947         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10948         if test "$_os" != "WINNT"; then
10949             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10950             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10951         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10952             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10953         fi
10954     fi
10955     ENABLE_GPGMEPP=TRUE
10956     AC_DEFINE([HAVE_FEATURE_GPGME])
10957     AC_PATH_PROG(GPG, gpg)
10958     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10959     # so let's exclude that manually for the moment
10960     if test -n "$GPG" -a "$_os" != "WINNT"; then
10961         # make sure we not only have a working gpgme, but a full working
10962         # gpg installation to run OpenPGP signature verification
10963         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10964     fi
10965     if test "$_os" = "Linux"; then
10966       uid=`id -u`
10967       AC_MSG_CHECKING([for /run/user/$uid])
10968       if test -d /run/user/$uid; then
10969         AC_MSG_RESULT([yes])
10970         AC_PATH_PROG(GPGCONF, gpgconf)
10972         # Older versions of gpgconf are not working as expected, since
10973         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10974         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10975         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10976         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10977         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10978         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10979         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10980           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10981           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10982           if $GPGCONF --dump-options > /dev/null ; then
10983             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10984               AC_MSG_RESULT([yes])
10985               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10986               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10987             else
10988               AC_MSG_RESULT([no])
10989             fi
10990           else
10991             AC_MSG_RESULT([no. missing or broken gpgconf?])
10992           fi
10993         else
10994           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10995         fi
10996       else
10997         AC_MSG_RESULT([no])
10998      fi
10999    fi
11001 AC_SUBST(ENABLE_GPGMEPP)
11002 AC_SUBST(SYSTEM_GPGMEPP)
11003 AC_SUBST(GPG_ERROR_CFLAGS)
11004 AC_SUBST(GPG_ERROR_LIBS)
11005 AC_SUBST(LIBASSUAN_CFLAGS)
11006 AC_SUBST(LIBASSUAN_LIBS)
11007 AC_SUBST(GPGMEPP_CFLAGS)
11008 AC_SUBST(GPGMEPP_LIBS)
11010 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11011 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11012     AC_MSG_RESULT([yes])
11013     ENABLE_MEDIAWIKI=TRUE
11014     BUILD_TYPE="$BUILD_TYPE XSLTML"
11015     if test  "x$with_java" = "xno"; then
11016         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11017     fi
11018 else
11019     AC_MSG_RESULT([no])
11020     ENABLE_MEDIAWIKI=
11021     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11023 AC_SUBST(ENABLE_MEDIAWIKI)
11025 AC_MSG_CHECKING([whether to build the Report Builder])
11026 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11027     AC_MSG_RESULT([yes])
11028     ENABLE_REPORTBUILDER=TRUE
11029     AC_MSG_CHECKING([which jfreereport libs to use])
11030     if test "$with_system_jfreereport" = "yes"; then
11031         SYSTEM_JFREEREPORT=TRUE
11032         AC_MSG_RESULT([external])
11033         if test -z $SAC_JAR; then
11034             SAC_JAR=/usr/share/java/sac.jar
11035         fi
11036         if ! test -f $SAC_JAR; then
11037              AC_MSG_ERROR(sac.jar not found.)
11038         fi
11040         if test -z $LIBXML_JAR; then
11041             if test -f /usr/share/java/libxml-1.0.0.jar; then
11042                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11043             elif test -f /usr/share/java/libxml.jar; then
11044                 LIBXML_JAR=/usr/share/java/libxml.jar
11045             else
11046                 AC_MSG_ERROR(libxml.jar replacement not found.)
11047             fi
11048         elif ! test -f $LIBXML_JAR; then
11049             AC_MSG_ERROR(libxml.jar not found.)
11050         fi
11052         if test -z $FLUTE_JAR; then
11053             if test -f/usr/share/java/flute-1.3.0.jar; then
11054                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11055             elif test -f /usr/share/java/flute.jar; then
11056                 FLUTE_JAR=/usr/share/java/flute.jar
11057             else
11058                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11059             fi
11060         elif ! test -f $FLUTE_JAR; then
11061             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11062         fi
11064         if test -z $JFREEREPORT_JAR; then
11065             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11066                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11067             elif test -f /usr/share/java/flow-engine.jar; then
11068                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11069             else
11070                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11071             fi
11072         elif ! test -f  $JFREEREPORT_JAR; then
11073                 AC_MSG_ERROR(jfreereport.jar not found.)
11074         fi
11076         if test -z $LIBLAYOUT_JAR; then
11077             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11078                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11079             elif test -f /usr/share/java/liblayout.jar; then
11080                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11081             else
11082                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11083             fi
11084         elif ! test -f $LIBLAYOUT_JAR; then
11085                 AC_MSG_ERROR(liblayout.jar not found.)
11086         fi
11088         if test -z $LIBLOADER_JAR; then
11089             if test -f /usr/share/java/libloader-1.0.0.jar; then
11090                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11091             elif test -f /usr/share/java/libloader.jar; then
11092                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11093             else
11094                 AC_MSG_ERROR(libloader.jar replacement not found.)
11095             fi
11096         elif ! test -f  $LIBLOADER_JAR; then
11097             AC_MSG_ERROR(libloader.jar not found.)
11098         fi
11100         if test -z $LIBFORMULA_JAR; then
11101             if test -f /usr/share/java/libformula-0.2.0.jar; then
11102                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11103             elif test -f /usr/share/java/libformula.jar; then
11104                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11105             else
11106                 AC_MSG_ERROR(libformula.jar replacement not found.)
11107             fi
11108         elif ! test -f $LIBFORMULA_JAR; then
11109                 AC_MSG_ERROR(libformula.jar not found.)
11110         fi
11112         if test -z $LIBREPOSITORY_JAR; then
11113             if test -f /usr/share/java/librepository-1.0.0.jar; then
11114                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11115             elif test -f /usr/share/java/librepository.jar; then
11116                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11117             else
11118                 AC_MSG_ERROR(librepository.jar replacement not found.)
11119             fi
11120         elif ! test -f $LIBREPOSITORY_JAR; then
11121             AC_MSG_ERROR(librepository.jar not found.)
11122         fi
11124         if test -z $LIBFONTS_JAR; then
11125             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11126                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11127             elif test -f /usr/share/java/libfonts.jar; then
11128                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11129             else
11130                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11131             fi
11132         elif ! test -f $LIBFONTS_JAR; then
11133                 AC_MSG_ERROR(libfonts.jar not found.)
11134         fi
11136         if test -z $LIBSERIALIZER_JAR; then
11137             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11138                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11139             elif test -f /usr/share/java/libserializer.jar; then
11140                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11141             else
11142                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11143             fi
11144         elif ! test -f $LIBSERIALIZER_JAR; then
11145                 AC_MSG_ERROR(libserializer.jar not found.)
11146         fi
11148         if test -z $LIBBASE_JAR; then
11149             if test -f /usr/share/java/libbase-1.0.0.jar; then
11150                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11151             elif test -f /usr/share/java/libbase.jar; then
11152                 LIBBASE_JAR=/usr/share/java/libbase.jar
11153             else
11154                 AC_MSG_ERROR(libbase.jar replacement not found.)
11155             fi
11156         elif ! test -f $LIBBASE_JAR; then
11157             AC_MSG_ERROR(libbase.jar not found.)
11158         fi
11160     else
11161         AC_MSG_RESULT([internal])
11162         SYSTEM_JFREEREPORT=
11163         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11164         NEED_ANT=TRUE
11165     fi
11166 else
11167     AC_MSG_RESULT([no])
11168     ENABLE_REPORTBUILDER=
11169     SYSTEM_JFREEREPORT=
11171 AC_SUBST(ENABLE_REPORTBUILDER)
11172 AC_SUBST(SYSTEM_JFREEREPORT)
11173 AC_SUBST(SAC_JAR)
11174 AC_SUBST(LIBXML_JAR)
11175 AC_SUBST(FLUTE_JAR)
11176 AC_SUBST(JFREEREPORT_JAR)
11177 AC_SUBST(LIBBASE_JAR)
11178 AC_SUBST(LIBLAYOUT_JAR)
11179 AC_SUBST(LIBLOADER_JAR)
11180 AC_SUBST(LIBFORMULA_JAR)
11181 AC_SUBST(LIBREPOSITORY_JAR)
11182 AC_SUBST(LIBFONTS_JAR)
11183 AC_SUBST(LIBSERIALIZER_JAR)
11185 # this has to be here because both the Wiki Publisher and the SRB use
11186 # commons-logging
11187 COMMONS_LOGGING_VERSION=1.2
11188 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11189     AC_MSG_CHECKING([which Apache commons-* libs to use])
11190     if test "$with_system_apache_commons" = "yes"; then
11191         SYSTEM_APACHE_COMMONS=TRUE
11192         AC_MSG_RESULT([external])
11193         if test -z $COMMONS_LOGGING_JAR; then
11194             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11195                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11196            elif test -f /usr/share/java/commons-logging.jar; then
11197                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11198             else
11199                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11200             fi
11201         elif ! test -f $COMMONS_LOGGING_JAR; then
11202             AC_MSG_ERROR(commons-logging.jar not found.)
11203         fi
11204     else
11205         AC_MSG_RESULT([internal])
11206         SYSTEM_APACHE_COMMONS=
11207         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11208         NEED_ANT=TRUE
11209     fi
11211 AC_SUBST(SYSTEM_APACHE_COMMONS)
11212 AC_SUBST(COMMONS_LOGGING_JAR)
11213 AC_SUBST(COMMONS_LOGGING_VERSION)
11215 # scripting provider for BeanShell?
11216 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11217 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11218     AC_MSG_RESULT([yes])
11219     ENABLE_SCRIPTING_BEANSHELL=TRUE
11221     dnl ===================================================================
11222     dnl Check for system beanshell
11223     dnl ===================================================================
11224     AC_MSG_CHECKING([which beanshell to use])
11225     if test "$with_system_beanshell" = "yes"; then
11226         AC_MSG_RESULT([external])
11227         SYSTEM_BSH=TRUE
11228         if test -z $BSH_JAR; then
11229             BSH_JAR=/usr/share/java/bsh.jar
11230         fi
11231         if ! test -f $BSH_JAR; then
11232             AC_MSG_ERROR(bsh.jar not found.)
11233         fi
11234     else
11235         AC_MSG_RESULT([internal])
11236         SYSTEM_BSH=
11237         BUILD_TYPE="$BUILD_TYPE BSH"
11238     fi
11239 else
11240     AC_MSG_RESULT([no])
11241     ENABLE_SCRIPTING_BEANSHELL=
11242     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11244 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11245 AC_SUBST(SYSTEM_BSH)
11246 AC_SUBST(BSH_JAR)
11248 # scripting provider for JavaScript?
11249 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11250 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11251     AC_MSG_RESULT([yes])
11252     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11254     dnl ===================================================================
11255     dnl Check for system rhino
11256     dnl ===================================================================
11257     AC_MSG_CHECKING([which rhino to use])
11258     if test "$with_system_rhino" = "yes"; then
11259         AC_MSG_RESULT([external])
11260         SYSTEM_RHINO=TRUE
11261         if test -z $RHINO_JAR; then
11262             RHINO_JAR=/usr/share/java/js.jar
11263         fi
11264         if ! test -f $RHINO_JAR; then
11265             AC_MSG_ERROR(js.jar not found.)
11266         fi
11267     else
11268         AC_MSG_RESULT([internal])
11269         SYSTEM_RHINO=
11270         BUILD_TYPE="$BUILD_TYPE RHINO"
11271         NEED_ANT=TRUE
11272     fi
11273 else
11274     AC_MSG_RESULT([no])
11275     ENABLE_SCRIPTING_JAVASCRIPT=
11276     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11278 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11279 AC_SUBST(SYSTEM_RHINO)
11280 AC_SUBST(RHINO_JAR)
11282 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11283 # paths should be added to library search path. So lets put all 64-bit
11284 # platforms there.
11285 supports_multilib=
11286 case "$host_cpu" in
11287 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11288     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11289         supports_multilib="yes"
11290     fi
11291     ;;
11293     ;;
11294 esac
11296 dnl ===================================================================
11297 dnl QT5 Integration
11298 dnl ===================================================================
11300 QT5_CFLAGS=""
11301 QT5_LIBS=""
11302 QMAKE5="qmake"
11303 MOC5="moc"
11304 QT5_GOBJECT_CFLAGS=""
11305 QT5_GOBJECT_LIBS=""
11306 QT5_HAVE_GOBJECT=""
11307 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11308         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11309         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11310 then
11311     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11312     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11314     if test -n "$supports_multilib"; then
11315         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11316     fi
11318     qt5_test_include="QtWidgets/qapplication.h"
11319     qt5_test_library="libQt5Widgets.so"
11321     dnl Check for qmake5
11322     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11323     if test "$QMAKE5" = "no"; then
11324         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11325     else
11326         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11327         if test -z "$qmake5_test_ver"; then
11328             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11329         fi
11330         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11331         qt5_minimal_minor="6"
11332         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11333             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11334         else
11335             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11336         fi
11337     fi
11339     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11340     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11342     AC_MSG_CHECKING([for Qt5 headers])
11343     qt5_incdir="no"
11344     for inc_dir in $qt5_incdirs; do
11345         if test -r "$inc_dir/$qt5_test_include"; then
11346             qt5_incdir="$inc_dir"
11347             break
11348         fi
11349     done
11350     AC_MSG_RESULT([$qt5_incdir])
11351     if test "x$qt5_incdir" = "xno"; then
11352         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11353     fi
11355     AC_MSG_CHECKING([for Qt5 libraries])
11356     qt5_libdir="no"
11357     for lib_dir in $qt5_libdirs; do
11358         if test -r "$lib_dir/$qt5_test_library"; then
11359             qt5_libdir="$lib_dir"
11360             break
11361         fi
11362     done
11363     AC_MSG_RESULT([$qt5_libdir])
11364     if test "x$qt5_libdir" = "xno"; then
11365         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11366     fi
11368     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11369     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11370     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11372     if test "$USING_X11" = TRUE; then
11373         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11374         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11375             QT5_HAVE_XCB_ICCCM=1
11376             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11377         ],[
11378             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)])
11379             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11380         ])
11381         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11382         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11383         QT5_USING_X11=1
11384         AC_DEFINE(QT5_USING_X11)
11385     fi
11387     dnl Check for Meta Object Compiler
11389     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11390     if test "$MOC5" = "no"; then
11391         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11392 the root of your Qt installation by exporting QT5DIR before running "configure".])
11393     fi
11395     if test "$build_gstreamer_1_0" = "yes"; then
11396         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11397                 QT5_HAVE_GOBJECT=1
11398                 AC_DEFINE(QT5_HAVE_GOBJECT)
11399             ],
11400             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11401         )
11402     fi
11404 AC_SUBST(QT5_CFLAGS)
11405 AC_SUBST(QT5_LIBS)
11406 AC_SUBST(MOC5)
11407 AC_SUBST(QT5_GOBJECT_CFLAGS)
11408 AC_SUBST(QT5_GOBJECT_LIBS)
11409 AC_SUBST(QT5_HAVE_GOBJECT)
11411 dnl ===================================================================
11412 dnl KF5 Integration
11413 dnl ===================================================================
11415 KF5_CFLAGS=""
11416 KF5_LIBS=""
11417 KF5_CONFIG="kf5-config"
11418 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11419         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11420 then
11421     if test "$OS" = "HAIKU"; then
11422         haiku_arch="`echo $RTL_ARCH | tr X x`"
11423         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11424         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11425     fi
11427     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11428     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11429     if test -n "$supports_multilib"; then
11430         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11431     fi
11433     kf5_test_include="KF5/kcoreaddons_version.h"
11434     kf5_test_library="libKF5CoreAddons.so"
11435     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11437     dnl kf5 KDE4 support compatibility installed
11438     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11439     if test "$KF5_CONFIG" != "no"; then
11440         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11441         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11442     fi
11444     dnl Check for KF5 headers
11445     AC_MSG_CHECKING([for KF5 headers])
11446     kf5_incdir="no"
11447     for kf5_check in $kf5_incdirs; do
11448         if test -r "$kf5_check/$kf5_test_include"; then
11449             kf5_incdir="$kf5_check/KF5"
11450             break
11451         fi
11452     done
11453     AC_MSG_RESULT([$kf5_incdir])
11454     if test "x$kf5_incdir" = "xno"; then
11455         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11456     fi
11458     dnl Check for KF5 libraries
11459     AC_MSG_CHECKING([for KF5 libraries])
11460     kf5_libdir="no"
11461     for kf5_check in $kf5_libdirs; do
11462         if test -r "$kf5_check/$kf5_test_library"; then
11463             kf5_libdir="$kf5_check"
11464             break
11465         fi
11466     done
11468     AC_MSG_RESULT([$kf5_libdir])
11469     if test "x$kf5_libdir" = "xno"; then
11470         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11471     fi
11473     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"
11474     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11475     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11477     if test "$USING_X11" = TRUE; then
11478         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11479     fi
11481     AC_LANG_PUSH([C++])
11482     save_CXXFLAGS=$CXXFLAGS
11483     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11484     AC_MSG_CHECKING([whether KDE is >= 5.0])
11485        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11486 #include <kcoreaddons_version.h>
11488 int main(int argc, char **argv) {
11489        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11490        else return 1;
11492        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11493     CXXFLAGS=$save_CXXFLAGS
11494     AC_LANG_POP([C++])
11496 AC_SUBST(KF5_CFLAGS)
11497 AC_SUBST(KF5_LIBS)
11499 dnl ===================================================================
11500 dnl Test whether to include Evolution 2 support
11501 dnl ===================================================================
11502 AC_MSG_CHECKING([whether to enable evolution 2 support])
11503 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11504     AC_MSG_RESULT([yes])
11505     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11506     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11507     FilterLibs "${GOBJECT_LIBS}"
11508     GOBJECT_LIBS="${filteredlibs}"
11509     ENABLE_EVOAB2="TRUE"
11510 else
11511     ENABLE_EVOAB2=""
11512     AC_MSG_RESULT([no])
11514 AC_SUBST(ENABLE_EVOAB2)
11515 AC_SUBST(GOBJECT_CFLAGS)
11516 AC_SUBST(GOBJECT_LIBS)
11518 dnl ===================================================================
11519 dnl Test which themes to include
11520 dnl ===================================================================
11521 AC_MSG_CHECKING([which themes to include])
11522 # if none given use default subset of available themes
11523 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11524     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"
11527 WITH_THEMES=""
11528 if test "x$with_theme" != "xno"; then
11529     for theme in $with_theme; do
11530         case $theme in
11531         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" ;;
11532         default) real_theme=colibre ;;
11533         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11534         esac
11535         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11536     done
11538 AC_MSG_RESULT([$WITH_THEMES])
11539 AC_SUBST([WITH_THEMES])
11540 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11541 for theme in $with_theme; do
11542     case $theme in
11543     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11544     *) ;;
11545     esac
11546 done
11548 dnl ===================================================================
11549 dnl Test whether to integrate helppacks into the product's installer
11550 dnl ===================================================================
11551 AC_MSG_CHECKING([for helppack integration])
11552 if test "$with_helppack_integration" = "no"; then
11553     AC_MSG_RESULT([no integration])
11554 else
11555     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11556     AC_MSG_RESULT([integration])
11559 ###############################################################################
11560 # Extensions checking
11561 ###############################################################################
11562 AC_MSG_CHECKING([for extensions integration])
11563 if test "x$enable_extension_integration" != "xno"; then
11564     WITH_EXTENSION_INTEGRATION=TRUE
11565     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11566     AC_MSG_RESULT([yes, use integration])
11567 else
11568     WITH_EXTENSION_INTEGRATION=
11569     AC_MSG_RESULT([no, do not integrate])
11571 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11573 dnl Should any extra extensions be included?
11574 dnl There are standalone tests for each of these below.
11575 WITH_EXTRA_EXTENSIONS=
11576 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11578 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11579 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11580 if test "x$with_java" != "xno"; then
11581     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11582     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11585 AC_MSG_CHECKING([whether to build opens___.ttf])
11586 if test "$enable_build_opensymbol" = "yes"; then
11587     AC_MSG_RESULT([yes])
11588     AC_PATH_PROG(FONTFORGE, fontforge)
11589     if test -z "$FONTFORGE"; then
11590         AC_MSG_ERROR([fontforge not installed])
11591     fi
11592 else
11593     AC_MSG_RESULT([no])
11594     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11595     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11597 AC_SUBST(OPENSYMBOL_TTF)
11598 AC_SUBST(FONTFORGE)
11600 dnl ===================================================================
11601 dnl Test whether to include fonts
11602 dnl ===================================================================
11603 AC_MSG_CHECKING([whether to include third-party fonts])
11604 if test "$with_fonts" != "no"; then
11605     AC_MSG_RESULT([yes])
11606     WITH_FONTS=TRUE
11607     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11608     AC_DEFINE(HAVE_MORE_FONTS)
11609 else
11610     AC_MSG_RESULT([no])
11611     WITH_FONTS=
11612     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11614 AC_SUBST(WITH_FONTS)
11617 dnl ===================================================================
11618 dnl Test whether to enable online update service
11619 dnl ===================================================================
11620 AC_MSG_CHECKING([whether to enable online update])
11621 ENABLE_ONLINE_UPDATE=
11622 ENABLE_ONLINE_UPDATE_MAR=
11623 UPDATE_CONFIG=
11624 if test "$enable_online_update" = ""; then
11625     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11626         AC_MSG_RESULT([yes])
11627         ENABLE_ONLINE_UPDATE="TRUE"
11628     else
11629         AC_MSG_RESULT([no])
11630     fi
11631 else
11632     if test "$enable_online_update" = "mar"; then
11633         AC_MSG_RESULT([yes - MAR-based online update])
11634         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11635         if test "$with_update_config" = ""; then
11636             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11637         fi
11638         UPDATE_CONFIG="$with_update_config"
11639         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11640     elif test "$enable_online_update" = "yes"; then
11641         AC_MSG_RESULT([yes])
11642         ENABLE_ONLINE_UPDATE="TRUE"
11643     else
11644         AC_MSG_RESULT([no])
11645     fi
11647 AC_SUBST(ENABLE_ONLINE_UPDATE)
11648 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11649 AC_SUBST(UPDATE_CONFIG)
11651 dnl ===================================================================
11652 dnl Test whether we need bzip2
11653 dnl ===================================================================
11654 SYSTEM_BZIP2=
11655 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11656     AC_MSG_CHECKING([whether to use system bzip2])
11657     if test "$with_system_bzip2" = yes; then
11658         SYSTEM_BZIP2=TRUE
11659         AC_MSG_RESULT([yes])
11660         PKG_CHECK_MODULES(BZIP2, bzip2)
11661         FilterLibs "${BZIP2_LIBS}"
11662         BZIP2_LIBS="${filteredlibs}"
11663     else
11664         AC_MSG_RESULT([no])
11665         BUILD_TYPE="$BUILD_TYPE BZIP2"
11666     fi
11668 AC_SUBST(SYSTEM_BZIP2)
11669 AC_SUBST(BZIP2_CFLAGS)
11670 AC_SUBST(BZIP2_LIBS)
11672 dnl ===================================================================
11673 dnl Test whether to enable extension update
11674 dnl ===================================================================
11675 AC_MSG_CHECKING([whether to enable extension update])
11676 ENABLE_EXTENSION_UPDATE=
11677 if test "x$enable_extension_update" = "xno"; then
11678     AC_MSG_RESULT([no])
11679 else
11680     AC_MSG_RESULT([yes])
11681     ENABLE_EXTENSION_UPDATE="TRUE"
11682     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11683     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11685 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11688 dnl ===================================================================
11689 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11690 dnl ===================================================================
11691 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11692 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11693     AC_MSG_RESULT([no])
11694     ENABLE_SILENT_MSI=
11695 else
11696     AC_MSG_RESULT([yes])
11697     ENABLE_SILENT_MSI=TRUE
11698     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11700 AC_SUBST(ENABLE_SILENT_MSI)
11702 AC_MSG_CHECKING([whether and how to use Xinerama])
11703 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11704     if test "$x_libraries" = "default_x_libraries"; then
11705         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11706         if test "x$XINERAMALIB" = x; then
11707            XINERAMALIB="/usr/lib"
11708         fi
11709     else
11710         XINERAMALIB="$x_libraries"
11711     fi
11712     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11713         # we have both versions, let the user decide but use the dynamic one
11714         # per default
11715         USE_XINERAMA=TRUE
11716         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11717             XINERAMA_LINK=dynamic
11718         else
11719             XINERAMA_LINK=static
11720         fi
11721     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11722         # we have only the dynamic version
11723         USE_XINERAMA=TRUE
11724         XINERAMA_LINK=dynamic
11725     elif test -e "$XINERAMALIB/libXinerama.a"; then
11726         # static version
11727         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11728             USE_XINERAMA=TRUE
11729             XINERAMA_LINK=static
11730         else
11731             USE_XINERAMA=
11732             XINERAMA_LINK=none
11733         fi
11734     else
11735         # no Xinerama
11736         USE_XINERAMA=
11737         XINERAMA_LINK=none
11738     fi
11739     if test "$USE_XINERAMA" = "TRUE"; then
11740         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11741         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11742             [AC_MSG_ERROR(Xinerama header not found.)], [])
11743         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11744         if test "x$XEXTLIB" = x; then
11745            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11746         fi
11747         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11748         if test "$_os" = "FreeBSD"; then
11749             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11750         fi
11751         if test "$_os" = "Linux"; then
11752             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11753         fi
11754         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11755             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11756     else
11757         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11758     fi
11759 else
11760     USE_XINERAMA=
11761     XINERAMA_LINK=none
11762     AC_MSG_RESULT([no])
11764 AC_SUBST(USE_XINERAMA)
11765 AC_SUBST(XINERAMA_LINK)
11767 dnl ===================================================================
11768 dnl Test whether to build cairo or rely on the system version
11769 dnl ===================================================================
11771 if test "$USING_X11" = TRUE; then
11772     # Used in vcl/Library_vclplug_gen.mk
11773     test_cairo=yes
11776 if test "$test_cairo" = "yes"; then
11777     AC_MSG_CHECKING([whether to use the system cairo])
11779     : ${with_system_cairo:=$with_system_libs}
11780     if test "$with_system_cairo" = "yes"; then
11781         SYSTEM_CAIRO=TRUE
11782         AC_MSG_RESULT([yes])
11784         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11785         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11786         FilterLibs "${CAIRO_LIBS}"
11787         CAIRO_LIBS="${filteredlibs}"
11789         if test "$test_xrender" = "yes"; then
11790             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11791             AC_LANG_PUSH([C])
11792             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11793 #ifdef PictStandardA8
11794 #else
11795       return fail;
11796 #endif
11797 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11799             AC_LANG_POP([C])
11800         fi
11801     else
11802         SYSTEM_CAIRO=
11803         AC_MSG_RESULT([no])
11805         BUILD_TYPE="$BUILD_TYPE CAIRO"
11806     fi
11809 AC_SUBST(SYSTEM_CAIRO)
11810 AC_SUBST(CAIRO_CFLAGS)
11811 AC_SUBST(CAIRO_LIBS)
11813 dnl ===================================================================
11814 dnl Test whether to use avahi
11815 dnl ===================================================================
11816 if test "$_os" = "WINNT"; then
11817     # Windows uses bundled mDNSResponder
11818     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11819 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11820     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11821                       [ENABLE_AVAHI="TRUE"])
11822     AC_DEFINE(HAVE_FEATURE_AVAHI)
11823     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11824     FilterLibs "${AVAHI_LIBS}"
11825     AVAHI_LIBS="${filteredlibs}"
11828 AC_SUBST(ENABLE_AVAHI)
11829 AC_SUBST(AVAHI_CFLAGS)
11830 AC_SUBST(AVAHI_LIBS)
11832 dnl ===================================================================
11833 dnl Test whether to use liblangtag
11834 dnl ===================================================================
11835 SYSTEM_LIBLANGTAG=
11836 AC_MSG_CHECKING([whether to use system liblangtag])
11837 if test "$with_system_liblangtag" = yes; then
11838     SYSTEM_LIBLANGTAG=TRUE
11839     AC_MSG_RESULT([yes])
11840     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11841     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11842     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11843     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11844     FilterLibs "${LIBLANGTAG_LIBS}"
11845     LIBLANGTAG_LIBS="${filteredlibs}"
11846 else
11847     SYSTEM_LIBLANGTAG=
11848     AC_MSG_RESULT([no])
11849     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11850     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11851     if test "$COM" = "MSC"; then
11852         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11853     else
11854         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11855     fi
11857 AC_SUBST(SYSTEM_LIBLANGTAG)
11858 AC_SUBST(LIBLANGTAG_CFLAGS)
11859 AC_SUBST(LIBLANGTAG_LIBS)
11861 dnl ===================================================================
11862 dnl Test whether to build libpng or rely on the system version
11863 dnl ===================================================================
11865 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11867 dnl ===================================================================
11868 dnl Check for runtime JVM search path
11869 dnl ===================================================================
11870 if test "$ENABLE_JAVA" != ""; then
11871     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11872     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11873         AC_MSG_RESULT([yes])
11874         if ! test -d "$with_jvm_path"; then
11875             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11876         fi
11877         if ! test -d "$with_jvm_path"jvm; then
11878             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11879         fi
11880         JVM_ONE_PATH_CHECK="$with_jvm_path"
11881         AC_SUBST(JVM_ONE_PATH_CHECK)
11882     else
11883         AC_MSG_RESULT([no])
11884     fi
11887 dnl ===================================================================
11888 dnl Test for the presence of Ant and that it works
11889 dnl ===================================================================
11891 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11892     ANT_HOME=; export ANT_HOME
11893     WITH_ANT_HOME=; export WITH_ANT_HOME
11894     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11895         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11896             if test "$_os" = "WINNT"; then
11897                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11898             else
11899                 with_ant_home="$LODE_HOME/opt/ant"
11900             fi
11901         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11902             with_ant_home="$LODE_HOME/opt/ant"
11903         fi
11904     fi
11905     if test -z "$with_ant_home"; then
11906         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11907     else
11908         if test "$_os" = "WINNT"; then
11909             # AC_PATH_PROGS needs unix path
11910             with_ant_home=`cygpath -u "$with_ant_home"`
11911         fi
11912         AbsolutePath "$with_ant_home"
11913         with_ant_home=$absolute_path
11914         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11915         WITH_ANT_HOME=$with_ant_home
11916         ANT_HOME=$with_ant_home
11917     fi
11919     if test -z "$ANT"; then
11920         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11921     else
11922         # resolve relative or absolute symlink
11923         while test -h "$ANT"; do
11924             a_cwd=`pwd`
11925             a_basename=`basename "$ANT"`
11926             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11927             cd "`dirname "$ANT"`"
11928             cd "`dirname "$a_script"`"
11929             ANT="`pwd`"/"`basename "$a_script"`"
11930             cd "$a_cwd"
11931         done
11933         AC_MSG_CHECKING([if $ANT works])
11934         mkdir -p conftest.dir
11935         a_cwd=$(pwd)
11936         cd conftest.dir
11937         cat > conftest.java << EOF
11938         public class conftest {
11939             int testmethod(int a, int b) {
11940                     return a + b;
11941             }
11942         }
11945         cat > conftest.xml << EOF
11946         <project name="conftest" default="conftest">
11947         <target name="conftest">
11948             <javac srcdir="." includes="conftest.java">
11949             </javac>
11950         </target>
11951         </project>
11954         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11955         if test $? = 0 -a -f ./conftest.class; then
11956             AC_MSG_RESULT([Ant works])
11957             if test -z "$WITH_ANT_HOME"; then
11958                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11959                 if test -z "$ANT_HOME"; then
11960                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11961                 fi
11962             else
11963                 ANT_HOME="$WITH_ANT_HOME"
11964             fi
11965         else
11966             echo "configure: Ant test failed" >&5
11967             cat conftest.java >&5
11968             cat conftest.xml >&5
11969             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11970         fi
11971         cd "$a_cwd"
11972         rm -fr conftest.dir
11973     fi
11974     if test -z "$ANT_HOME"; then
11975         ANT_HOME="NO_ANT_HOME"
11976     else
11977         PathFormat "$ANT_HOME"
11978         ANT_HOME="$formatted_path"
11979         PathFormat "$ANT"
11980         ANT="$formatted_path"
11981     fi
11982     AC_SUBST(ANT_HOME)
11983     AC_SUBST(ANT)
11985     dnl Checking for ant.jar
11986     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11987         AC_MSG_CHECKING([Ant lib directory])
11988         if test -f $ANT_HOME/lib/ant.jar; then
11989             ANT_LIB="$ANT_HOME/lib"
11990         else
11991             if test -f $ANT_HOME/ant.jar; then
11992                 ANT_LIB="$ANT_HOME"
11993             else
11994                 if test -f /usr/share/java/ant.jar; then
11995                     ANT_LIB=/usr/share/java
11996                 else
11997                     if test -f /usr/share/ant-core/lib/ant.jar; then
11998                         ANT_LIB=/usr/share/ant-core/lib
11999                     else
12000                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12001                             ANT_LIB="$ANT_HOME/lib/ant"
12002                         else
12003                             if test -f /usr/share/lib/ant/ant.jar; then
12004                                 ANT_LIB=/usr/share/lib/ant
12005                             else
12006                                 AC_MSG_ERROR([Ant libraries not found!])
12007                             fi
12008                         fi
12009                     fi
12010                 fi
12011             fi
12012         fi
12013         PathFormat "$ANT_LIB"
12014         ANT_LIB="$formatted_path"
12015         AC_MSG_RESULT([Ant lib directory found.])
12016     fi
12017     AC_SUBST(ANT_LIB)
12019     ant_minver=1.6.0
12020     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12022     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12023     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12024     ant_version_major=`echo $ant_version | cut -d. -f1`
12025     ant_version_minor=`echo $ant_version | cut -d. -f2`
12026     echo "configure: ant_version $ant_version " >&5
12027     echo "configure: ant_version_major $ant_version_major " >&5
12028     echo "configure: ant_version_minor $ant_version_minor " >&5
12029     if test "$ant_version_major" -ge "2"; then
12030         AC_MSG_RESULT([yes, $ant_version])
12031     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12032         AC_MSG_RESULT([yes, $ant_version])
12033     else
12034         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12035     fi
12037     rm -f conftest* core core.* *.core
12040 OOO_JUNIT_JAR=
12041 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12042     AC_MSG_CHECKING([for JUnit 4])
12043     if test "$with_junit" = "yes"; then
12044         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12045             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12046         elif test -e /usr/share/java/junit4.jar; then
12047             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12048         else
12049            if test -e /usr/share/lib/java/junit.jar; then
12050               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12051            else
12052               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12053            fi
12054         fi
12055     else
12056         OOO_JUNIT_JAR=$with_junit
12057     fi
12058     if test "$_os" = "WINNT"; then
12059         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12060     fi
12061     printf 'import org.junit.Before;' > conftest.java
12062     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12063         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12064     else
12065         AC_MSG_ERROR(
12066 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12067  specify its pathname via --with-junit=..., or disable it via --without-junit])
12068     fi
12069     rm -f conftest.class conftest.java
12070     if test $OOO_JUNIT_JAR != ""; then
12071     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12072     fi
12074 AC_SUBST(OOO_JUNIT_JAR)
12076 HAMCREST_JAR=
12077 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12078     AC_MSG_CHECKING([for included Hamcrest])
12079     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12080     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12081         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12082     else
12083         AC_MSG_RESULT([Not included])
12084         AC_MSG_CHECKING([for standalone hamcrest jar.])
12085         if test "$with_hamcrest" = "yes"; then
12086             if test -e /usr/share/lib/java/hamcrest.jar; then
12087                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12088             elif test -e /usr/share/java/hamcrest/core.jar; then
12089                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12090             else
12091                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12092             fi
12093         else
12094             HAMCREST_JAR=$with_hamcrest
12095         fi
12096         if test "$_os" = "WINNT"; then
12097             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12098         fi
12099         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12100             AC_MSG_RESULT([$HAMCREST_JAR])
12101         else
12102             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),
12103                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12104         fi
12105     fi
12106     rm -f conftest.class conftest.java
12108 AC_SUBST(HAMCREST_JAR)
12111 AC_SUBST(SCPDEFS)
12114 # check for wget and curl
12116 WGET=
12117 CURL=
12119 if test "$enable_fetch_external" != "no"; then
12121 CURL=`which curl 2>/dev/null`
12123 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12124     # wget new enough?
12125     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12126     if test $? -eq 0; then
12127         WGET=$i
12128         break
12129     fi
12130 done
12132 if test -z "$WGET" -a -z "$CURL"; then
12133     AC_MSG_ERROR([neither wget nor curl found!])
12138 AC_SUBST(WGET)
12139 AC_SUBST(CURL)
12142 # check for sha256sum
12144 SHA256SUM=
12146 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12147     eval "$i -a 256 --version" > /dev/null 2>&1
12148     ret=$?
12149     if test $ret -eq 0; then
12150         SHA256SUM="$i -a 256"
12151         break
12152     fi
12153 done
12155 if test -z "$SHA256SUM"; then
12156     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12157         eval "$i --version" > /dev/null 2>&1
12158         ret=$?
12159         if test $ret -eq 0; then
12160             SHA256SUM=$i
12161             break
12162         fi
12163     done
12166 if test -z "$SHA256SUM"; then
12167     AC_MSG_ERROR([no sha256sum found!])
12170 AC_SUBST(SHA256SUM)
12172 dnl ===================================================================
12173 dnl Dealing with l10n options
12174 dnl ===================================================================
12175 AC_MSG_CHECKING([which languages to be built])
12176 # get list of all languages
12177 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12178 # the sed command does the following:
12179 #   + if a line ends with a backslash, append the next line to it
12180 #   + adds " on the beginning of the value (after =)
12181 #   + adds " at the end of the value
12182 #   + removes en-US; we want to put it on the beginning
12183 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12184 [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)]
12185 ALL_LANGS="en-US $completelangiso"
12186 # check the configured localizations
12187 WITH_LANG="$with_lang"
12189 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12190 # (Norwegian is "nb" and "nn".)
12191 if test "$WITH_LANG" = "no"; then
12192     WITH_LANG=
12195 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12196     AC_MSG_RESULT([en-US])
12197 else
12198     AC_MSG_RESULT([$WITH_LANG])
12199     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12200     if test -z "$MSGFMT"; then
12201         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12202             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12203         elif test -x "/opt/lo/bin/msgfmt"; then
12204             MSGFMT="/opt/lo/bin/msgfmt"
12205         else
12206             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12207             if test -z "$MSGFMT"; then
12208                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12209             fi
12210         fi
12211     fi
12212     if test -z "$MSGUNIQ"; then
12213         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12214             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12215         elif test -x "/opt/lo/bin/msguniq"; then
12216             MSGUNIQ="/opt/lo/bin/msguniq"
12217         else
12218             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12219             if test -z "$MSGUNIQ"; then
12220                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12221             fi
12222         fi
12223     fi
12225 AC_SUBST(MSGFMT)
12226 AC_SUBST(MSGUNIQ)
12227 # check that the list is valid
12228 for lang in $WITH_LANG; do
12229     test "$lang" = "ALL" && continue
12230     # need to check for the exact string, so add space before and after the list of all languages
12231     for vl in $ALL_LANGS; do
12232         if test "$vl" = "$lang"; then
12233            break
12234         fi
12235     done
12236     if test "$vl" != "$lang"; then
12237         # if you're reading this - you prolly quoted your languages remove the quotes ...
12238         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12239     fi
12240 done
12241 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12242     echo $WITH_LANG | grep -q en-US
12243     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12245 # list with substituted ALL
12246 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12247 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12248 test "$WITH_LANG" = "en-US" && WITH_LANG=
12249 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12250     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12251     ALL_LANGS=`echo $ALL_LANGS qtz`
12253 AC_SUBST(ALL_LANGS)
12254 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12255 AC_SUBST(WITH_LANG)
12256 AC_SUBST(WITH_LANG_LIST)
12257 AC_SUBST(GIT_NEEDED_SUBMODULES)
12259 WITH_POOR_HELP_LOCALIZATIONS=
12260 if test -d "$SRC_ROOT/translations/source"; then
12261     for l in `ls -1 $SRC_ROOT/translations/source`; do
12262         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12263             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12264         fi
12265     done
12267 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12269 if test -n "$with_locales"; then
12270     WITH_LOCALES="$with_locales"
12272     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12273     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12274     # config_host/config_locales.h.in
12275     for locale in $WITH_LOCALES; do
12276         lang=${locale%_*}
12278         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12280         case $lang in
12281         hi|mr*ne)
12282             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12283             ;;
12284         bg|ru)
12285             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12286             ;;
12287         esac
12288     done
12289 else
12290     AC_DEFINE(WITH_LOCALE_ALL)
12292 AC_SUBST(WITH_LOCALES)
12294 dnl git submodule update --reference
12295 dnl ===================================================================
12296 if test -n "${GIT_REFERENCE_SRC}"; then
12297     for repo in ${GIT_NEEDED_SUBMODULES}; do
12298         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12299             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12300         fi
12301     done
12303 AC_SUBST(GIT_REFERENCE_SRC)
12305 dnl git submodules linked dirs
12306 dnl ===================================================================
12307 if test -n "${GIT_LINK_SRC}"; then
12308     for repo in ${GIT_NEEDED_SUBMODULES}; do
12309         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12310             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12311         fi
12312     done
12314 AC_SUBST(GIT_LINK_SRC)
12316 dnl branding
12317 dnl ===================================================================
12318 AC_MSG_CHECKING([for alternative branding images directory])
12319 # initialize mapped arrays
12320 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12321 brand_files="$BRAND_INTRO_IMAGES about.svg"
12323 if test -z "$with_branding" -o "$with_branding" = "no"; then
12324     AC_MSG_RESULT([none])
12325     DEFAULT_BRAND_IMAGES="$brand_files"
12326 else
12327     if ! test -d $with_branding ; then
12328         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12329     else
12330         AC_MSG_RESULT([$with_branding])
12331         CUSTOM_BRAND_DIR="$with_branding"
12332         for lfile in $brand_files
12333         do
12334             if ! test -f $with_branding/$lfile ; then
12335                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12336                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12337             else
12338                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12339             fi
12340         done
12341         check_for_progress="yes"
12342     fi
12344 AC_SUBST([BRAND_INTRO_IMAGES])
12345 AC_SUBST([CUSTOM_BRAND_DIR])
12346 AC_SUBST([CUSTOM_BRAND_IMAGES])
12347 AC_SUBST([DEFAULT_BRAND_IMAGES])
12350 AC_MSG_CHECKING([for 'intro' progress settings])
12351 PROGRESSBARCOLOR=
12352 PROGRESSSIZE=
12353 PROGRESSPOSITION=
12354 PROGRESSFRAMECOLOR=
12355 PROGRESSTEXTCOLOR=
12356 PROGRESSTEXTBASELINE=
12358 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12359     source "$with_branding/progress.conf"
12360     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12361 else
12362     AC_MSG_RESULT([none])
12365 AC_SUBST(PROGRESSBARCOLOR)
12366 AC_SUBST(PROGRESSSIZE)
12367 AC_SUBST(PROGRESSPOSITION)
12368 AC_SUBST(PROGRESSFRAMECOLOR)
12369 AC_SUBST(PROGRESSTEXTCOLOR)
12370 AC_SUBST(PROGRESSTEXTBASELINE)
12373 AC_MSG_CHECKING([for extra build ID])
12374 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12375     EXTRA_BUILDID="$with_extra_buildid"
12377 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12378 if test -n "$EXTRA_BUILDID" ; then
12379     AC_MSG_RESULT([$EXTRA_BUILDID])
12380 else
12381     AC_MSG_RESULT([not set])
12383 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12385 OOO_VENDOR=
12386 AC_MSG_CHECKING([for vendor])
12387 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12388     OOO_VENDOR="$USERNAME"
12390     if test -z "$OOO_VENDOR"; then
12391         OOO_VENDOR="$USER"
12392     fi
12394     if test -z "$OOO_VENDOR"; then
12395         OOO_VENDOR="`id -u -n`"
12396     fi
12398     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12399 else
12400     OOO_VENDOR="$with_vendor"
12401     AC_MSG_RESULT([$OOO_VENDOR])
12403 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12404 AC_SUBST(OOO_VENDOR)
12406 if test "$_os" = "Android" ; then
12407     ANDROID_PACKAGE_NAME=
12408     AC_MSG_CHECKING([for Android package name])
12409     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12410         if test -n "$ENABLE_DEBUG"; then
12411             # Default to the package name that makes ndk-gdb happy.
12412             ANDROID_PACKAGE_NAME="org.libreoffice"
12413         else
12414             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12415         fi
12417         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12418     else
12419         ANDROID_PACKAGE_NAME="$with_android_package_name"
12420         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12421     fi
12422     AC_SUBST(ANDROID_PACKAGE_NAME)
12425 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12426 if test "$with_compat_oowrappers" = "yes"; then
12427     WITH_COMPAT_OOWRAPPERS=TRUE
12428     AC_MSG_RESULT(yes)
12429 else
12430     WITH_COMPAT_OOWRAPPERS=
12431     AC_MSG_RESULT(no)
12433 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12435 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12436 AC_MSG_CHECKING([for install dirname])
12437 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12438     INSTALLDIRNAME="$with_install_dirname"
12440 AC_MSG_RESULT([$INSTALLDIRNAME])
12441 AC_SUBST(INSTALLDIRNAME)
12443 AC_MSG_CHECKING([for prefix])
12444 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12445 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12446 PREFIXDIR="$prefix"
12447 AC_MSG_RESULT([$PREFIXDIR])
12448 AC_SUBST(PREFIXDIR)
12450 LIBDIR=[$(eval echo $(eval echo $libdir))]
12451 AC_SUBST(LIBDIR)
12453 DATADIR=[$(eval echo $(eval echo $datadir))]
12454 AC_SUBST(DATADIR)
12456 MANDIR=[$(eval echo $(eval echo $mandir))]
12457 AC_SUBST(MANDIR)
12459 DOCDIR=[$(eval echo $(eval echo $docdir))]
12460 AC_SUBST(DOCDIR)
12462 BINDIR=[$(eval echo $(eval echo $bindir))]
12463 AC_SUBST(BINDIR)
12465 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12466 AC_SUBST(INSTALLDIR)
12468 TESTINSTALLDIR="${BUILDDIR}/test-install"
12469 AC_SUBST(TESTINSTALLDIR)
12472 # ===================================================================
12473 # OAuth2 id and secrets
12474 # ===================================================================
12476 AC_MSG_CHECKING([for Google Drive client id and secret])
12477 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12478     AC_MSG_RESULT([not set])
12479     GDRIVE_CLIENT_ID="\"\""
12480     GDRIVE_CLIENT_SECRET="\"\""
12481 else
12482     AC_MSG_RESULT([set])
12483     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12484     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12486 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12487 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12489 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12490 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12491     AC_MSG_RESULT([not set])
12492     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12493     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12494 else
12495     AC_MSG_RESULT([set])
12496     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12497     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12499 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12500 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12502 AC_MSG_CHECKING([for OneDrive client id and secret])
12503 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12504     AC_MSG_RESULT([not set])
12505     ONEDRIVE_CLIENT_ID="\"\""
12506     ONEDRIVE_CLIENT_SECRET="\"\""
12507 else
12508     AC_MSG_RESULT([set])
12509     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12510     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12512 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12513 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12516 dnl ===================================================================
12517 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12518 dnl --enable-dependency-tracking configure option
12519 dnl ===================================================================
12520 AC_MSG_CHECKING([whether to enable dependency tracking])
12521 if test "$enable_dependency_tracking" = "no"; then
12522     nodep=TRUE
12523     AC_MSG_RESULT([no])
12524 else
12525     AC_MSG_RESULT([yes])
12527 AC_SUBST(nodep)
12529 dnl ===================================================================
12530 dnl Number of CPUs to use during the build
12531 dnl ===================================================================
12532 AC_MSG_CHECKING([for number of processors to use])
12533 # plain --with-parallelism is just the default
12534 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12535     if test "$with_parallelism" = "no"; then
12536         PARALLELISM=0
12537     else
12538         PARALLELISM=$with_parallelism
12539     fi
12540 else
12541     if test "$enable_icecream" = "yes"; then
12542         PARALLELISM="40"
12543     else
12544         case `uname -s` in
12546         Darwin|FreeBSD|NetBSD|OpenBSD)
12547             PARALLELISM=`sysctl -n hw.ncpu`
12548             ;;
12550         Linux)
12551             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12552         ;;
12553         # what else than above does profit here *and* has /proc?
12554         *)
12555             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12556             ;;
12557         esac
12559         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12560         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12561     fi
12564 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12565     if test -z "$with_parallelism"; then
12566             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12567             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12568             PARALLELISM="1"
12569     else
12570         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."
12571     fi
12574 if test $PARALLELISM -eq 0; then
12575     AC_MSG_RESULT([explicit make -j option needed])
12576 else
12577     AC_MSG_RESULT([$PARALLELISM])
12579 AC_SUBST(PARALLELISM)
12581 IWYU_PATH="$with_iwyu"
12582 AC_SUBST(IWYU_PATH)
12583 if test ! -z "$IWYU_PATH"; then
12584     if test ! -f "$IWYU_PATH"; then
12585         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12586     fi
12590 # Set up ILIB for MSVC build
12592 ILIB1=
12593 if test "$build_os" = "cygwin"; then
12594     ILIB="."
12595     if test -n "$JAVA_HOME"; then
12596         ILIB="$ILIB;$JAVA_HOME/lib"
12597     fi
12598     ILIB1=-link
12599     if test "$BITNESS_OVERRIDE" = 64; then
12600         ILIB="$ILIB;$COMPATH/lib/x64"
12601         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12602         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12603         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12604         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12605             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12606             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12607         fi
12608         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12609         ucrtlibpath_formatted=$formatted_path
12610         ILIB="$ILIB;$ucrtlibpath_formatted"
12611         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12612     else
12613         ILIB="$ILIB;$COMPATH/lib/x86"
12614         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12615         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12616         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12617         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12618             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12619             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12620         fi
12621         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12622         ucrtlibpath_formatted=$formatted_path
12623         ILIB="$ILIB;$ucrtlibpath_formatted"
12624         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12625     fi
12626     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12627         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12628     else
12629         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12630     fi
12632     AC_SUBST(ILIB)
12635 # ===================================================================
12636 # Creating bigger shared library to link against
12637 # ===================================================================
12638 AC_MSG_CHECKING([whether to create huge library])
12639 MERGELIBS=
12641 if test $_os = iOS -o $_os = Android; then
12642     # Never any point in mergelibs for these as we build just static
12643     # libraries anyway...
12644     enable_mergelibs=no
12647 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12648     if test $_os != Linux -a $_os != WINNT; then
12649         add_warning "--enable-mergelibs is not tested for this platform"
12650     fi
12651     MERGELIBS="TRUE"
12652     AC_MSG_RESULT([yes])
12653 else
12654     AC_MSG_RESULT([no])
12656 AC_SUBST([MERGELIBS])
12658 dnl ===================================================================
12659 dnl icerun is a wrapper that stops us spawning tens of processes
12660 dnl locally - for tools that can't be executed on the compile cluster
12661 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12662 dnl ===================================================================
12663 AC_MSG_CHECKING([whether to use icerun wrapper])
12664 ICECREAM_RUN=
12665 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12666     ICECREAM_RUN=icerun
12667     AC_MSG_RESULT([yes])
12668 else
12669     AC_MSG_RESULT([no])
12671 AC_SUBST(ICECREAM_RUN)
12673 dnl ===================================================================
12674 dnl Setup the ICECC_VERSION for the build the same way it was set for
12675 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12676 dnl ===================================================================
12677 x_ICECC_VERSION=[\#]
12678 if test -n "$ICECC_VERSION" ; then
12679     x_ICECC_VERSION=
12681 AC_SUBST(x_ICECC_VERSION)
12682 AC_SUBST(ICECC_VERSION)
12684 dnl ===================================================================
12686 AC_MSG_CHECKING([MPL subset])
12687 MPL_SUBSET=
12689 if test "$enable_mpl_subset" = "yes"; then
12690     warn_report=false
12691     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12692         warn_report=true
12693     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12694         warn_report=true
12695     fi
12696     if test "$warn_report" = "true"; then
12697         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12698     fi
12699     if test "x$enable_postgresql_sdbc" != "xno"; then
12700         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12701     fi
12702     if test "$enable_lotuswordpro" = "yes"; then
12703         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12704     fi
12705     if test "$WITH_WEBDAV" = "neon"; then
12706         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12707     fi
12708     if test -n "$ENABLE_POPPLER"; then
12709         if test "x$SYSTEM_POPPLER" = "x"; then
12710             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12711         fi
12712     fi
12713     # cf. m4/libo_check_extension.m4
12714     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12715         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12716     fi
12717     for theme in $WITH_THEMES; do
12718         case $theme in
12719         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12720             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12721         *) : ;;
12722         esac
12723     done
12725     ENABLE_OPENGL_TRANSITIONS=
12727     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12728         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12729     fi
12731     MPL_SUBSET="TRUE"
12732     AC_DEFINE(MPL_HAVE_SUBSET)
12733     AC_MSG_RESULT([only])
12734 else
12735     AC_MSG_RESULT([no restrictions])
12737 AC_SUBST(MPL_SUBSET)
12739 dnl ===================================================================
12741 AC_MSG_CHECKING([formula logger])
12742 ENABLE_FORMULA_LOGGER=
12744 if test "x$enable_formula_logger" = "xyes"; then
12745     AC_MSG_RESULT([yes])
12746     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12747     ENABLE_FORMULA_LOGGER=TRUE
12748 elif test -n "$ENABLE_DBGUTIL" ; then
12749     AC_MSG_RESULT([yes])
12750     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12751     ENABLE_FORMULA_LOGGER=TRUE
12752 else
12753     AC_MSG_RESULT([no])
12756 AC_SUBST(ENABLE_FORMULA_LOGGER)
12758 dnl ===================================================================
12759 dnl Setting up the environment.
12760 dnl ===================================================================
12761 AC_MSG_NOTICE([setting up the build environment variables...])
12763 AC_SUBST(COMPATH)
12765 if test "$build_os" = "cygwin"; then
12766     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12767         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12768         ATL_INCLUDE="$COMPATH/atlmfc/include"
12769     elif test -d "$COMPATH/atlmfc/lib"; then
12770         ATL_LIB="$COMPATH/atlmfc/lib"
12771         ATL_INCLUDE="$COMPATH/atlmfc/include"
12772     else
12773         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12774         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12775     fi
12776     if test "$BITNESS_OVERRIDE" = 64; then
12777         ATL_LIB="$ATL_LIB/x64"
12778     else
12779         ATL_LIB="$ATL_LIB/x86"
12780     fi
12781     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12782     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12784     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12785     PathFormat "/usr/bin/find.exe"
12786     FIND="$formatted_path"
12787     PathFormat "/usr/bin/sort.exe"
12788     SORT="$formatted_path"
12789     PathFormat "/usr/bin/grep.exe"
12790     WIN_GREP="$formatted_path"
12791     PathFormat "/usr/bin/ls.exe"
12792     WIN_LS="$formatted_path"
12793     PathFormat "/usr/bin/touch.exe"
12794     WIN_TOUCH="$formatted_path"
12795 else
12796     FIND=find
12797     SORT=sort
12800 AC_SUBST(ATL_INCLUDE)
12801 AC_SUBST(ATL_LIB)
12802 AC_SUBST(FIND)
12803 AC_SUBST(SORT)
12804 AC_SUBST(WIN_GREP)
12805 AC_SUBST(WIN_LS)
12806 AC_SUBST(WIN_TOUCH)
12808 AC_SUBST(BUILD_TYPE)
12810 AC_SUBST(SOLARINC)
12812 PathFormat "$PERL"
12813 PERL="$formatted_path"
12814 AC_SUBST(PERL)
12816 if test -n "$TMPDIR"; then
12817     TEMP_DIRECTORY="$TMPDIR"
12818 else
12819     TEMP_DIRECTORY="/tmp"
12821 if test "$build_os" = "cygwin"; then
12822     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12824 AC_SUBST(TEMP_DIRECTORY)
12826 # setup the PATH for the environment
12827 if test -n "$LO_PATH_FOR_BUILD"; then
12828     LO_PATH="$LO_PATH_FOR_BUILD"
12829 else
12830     LO_PATH="$PATH"
12832     case "$host_os" in
12834     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12835         if test "$ENABLE_JAVA" != ""; then
12836             pathmunge "$JAVA_HOME/bin" "after"
12837         fi
12838         ;;
12840     cygwin*)
12841         # Win32 make needs native paths
12842         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12843             LO_PATH=`cygpath -p -m "$PATH"`
12844         fi
12845         if test "$BITNESS_OVERRIDE" = 64; then
12846             # needed for msi packaging
12847             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12848         fi
12849         # .NET 4.6 and higher don't have bin directory
12850         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12851             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12852         fi
12853         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12854         pathmunge "$CSC_PATH" "before"
12855         pathmunge "$MIDL_PATH" "before"
12856         pathmunge "$AL_PATH" "before"
12857         pathmunge "$MSPDB_PATH" "before"
12858         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12859             pathmunge "$CL_PATH" "before"
12860         fi
12861         if test -n "$MSBUILD_PATH" ; then
12862             pathmunge "$MSBUILD_PATH" "before"
12863         fi
12864         if test "$BITNESS_OVERRIDE" = 64; then
12865             pathmunge "$COMPATH/bin/amd64" "before"
12866             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12867         else
12868             pathmunge "$COMPATH/bin" "before"
12869             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12870         fi
12871         if test "$ENABLE_JAVA" != ""; then
12872             if test -d "$JAVA_HOME/jre/bin/client"; then
12873                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12874             fi
12875             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12876                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12877             fi
12878             pathmunge "$JAVA_HOME/bin" "before"
12879         fi
12880         ;;
12882     solaris*)
12883         pathmunge "/usr/css/bin" "before"
12884         if test "$ENABLE_JAVA" != ""; then
12885             pathmunge "$JAVA_HOME/bin" "after"
12886         fi
12887         ;;
12888     esac
12891 AC_SUBST(LO_PATH)
12893 libo_FUZZ_SUMMARY
12895 # Generate a configuration sha256 we can use for deps
12896 if test -f config_host.mk; then
12897     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12899 if test -f config_host_lang.mk; then
12900     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12903 CFLAGS=$my_original_CFLAGS
12904 CXXFLAGS=$my_original_CXXFLAGS
12905 CPPFLAGS=$my_original_CPPFLAGS
12907 AC_CONFIG_FILES([config_host.mk
12908                  config_host_lang.mk
12909                  Makefile
12910                  bin/bffvalidator.sh
12911                  bin/odfvalidator.sh
12912                  bin/officeotron.sh
12913                  instsetoo_native/util/openoffice.lst
12914                  sysui/desktop/macosx/Info.plist])
12915 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12916 AC_CONFIG_HEADERS([config_host/config_clang.h])
12917 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12918 AC_CONFIG_HEADERS([config_host/config_eot.h])
12919 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12920 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12921 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12922 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12923 AC_CONFIG_HEADERS([config_host/config_features.h])
12924 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12925 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12926 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12927 AC_CONFIG_HEADERS([config_host/config_folders.h])
12928 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12929 AC_CONFIG_HEADERS([config_host/config_gio.h])
12930 AC_CONFIG_HEADERS([config_host/config_global.h])
12931 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12932 AC_CONFIG_HEADERS([config_host/config_java.h])
12933 AC_CONFIG_HEADERS([config_host/config_langs.h])
12934 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12935 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12936 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12937 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12938 AC_CONFIG_HEADERS([config_host/config_locales.h])
12939 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12940 AC_CONFIG_HEADERS([config_host/config_oox.h])
12941 AC_CONFIG_HEADERS([config_host/config_options.h])
12942 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12943 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12944 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12945 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12946 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12947 AC_CONFIG_HEADERS([config_host/config_version.h])
12948 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12949 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12950 AC_CONFIG_HEADERS([config_host/config_python.h])
12951 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12952 AC_OUTPUT
12954 if test "$CROSS_COMPILING" = TRUE; then
12955     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12958 # touch the config timestamp file
12959 if test ! -f config_host.mk.stamp; then
12960     echo > config_host.mk.stamp
12961 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12962     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12963 else
12964     echo > config_host.mk.stamp
12967 # touch the config lang timestamp file
12968 if test ! -f config_host_lang.mk.stamp; then
12969     echo > config_host_lang.mk.stamp
12970 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12971     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12972 else
12973     echo > config_host_lang.mk.stamp
12977 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12978         -a "$build_os" = "cygwin"; then
12980 cat << _EOS
12981 ****************************************************************************
12982 WARNING:
12983 Your make version is known to be horribly slow, and hard to debug
12984 problems with. To get a reasonably functional make please do:
12986 to install a pre-compiled binary make for Win32
12988  mkdir -p /opt/lo/bin
12989  cd /opt/lo/bin
12990  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12991  cp make-4.2.1-msvc.exe make
12992  chmod +x make
12994 to install from source:
12995 place yourself in a working directory of you choice.
12997  git clone git://git.savannah.gnu.org/make.git
12999  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13000  set PATH=%PATH%;C:\Cygwin\bin
13001  [or Cygwin64, if that is what you have]
13002  cd path-to-make-repo-you-cloned-above
13003  build_w32.bat --without-guile
13005 should result in a WinRel/gnumake.exe.
13006 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13008 Then re-run autogen.sh
13010 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13011 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13013 _EOS
13014 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13015     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13020 cat << _EOF
13021 ****************************************************************************
13023 To build, run:
13024 $GNUMAKE
13026 To view some help, run:
13027 $GNUMAKE help
13029 _EOF
13031 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13032     cat << _EOF
13033 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13034 _EOF
13036     if test $_os = Darwin; then
13037         echo open instdir/$PRODUCTNAME.app
13038     else
13039         echo instdir/program/soffice
13040     fi
13041     cat << _EOF
13043 If you want to run the smoketest, run:
13044 $GNUMAKE check
13046 _EOF
13049 if test -f warn; then
13050     cat warn
13051     rm warn
13054 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: