lok: fix welded dialogs
[LibreOffice.git] / configure.ac
blob194a3cc80fa5128eb20e185be86a6b43675a2ee3
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.5.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(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 AC_ARG_ENABLE([android-lok],
548     AS_HELP_STRING([--enable-android-lok],
549         [The Android app from the android/ subdir needs several tweaks all
550          over the place that break the LOK when used in the Online-based
551          Android app.  This switch indicates that the intent of this build is
552          actually the Online-based, non-modified LOK.])
554 ENABLE_ANDROID_LOK=
555 if test -n "$ANDROID_NDK_HOME" ; then
556     if test "$enable_android_lok" = yes; then
557         ENABLE_ANDROID_LOK=TRUE
558         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
559         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
560     else
561         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
562     fi
564 AC_SUBST([ENABLE_ANDROID_LOK])
566 libo_FUZZ_ARG_ENABLE([android-editing],
567     AS_HELP_STRING([--enable-android-editing],
568         [Enable the experimental editing feature on Android.])
570 ENABLE_ANDROID_EDITING=
571 if test "$enable_android_editing" = yes; then
572     ENABLE_ANDROID_EDITING=TRUE
574 AC_SUBST([ENABLE_ANDROID_EDITING])
576 dnl ===================================================================
577 dnl The following is a list of supported systems.
578 dnl Sequential to keep the logic very simple
579 dnl These values may be checked and reset later.
580 dnl ===================================================================
581 #defaults unless the os test overrides this:
582 test_randr=yes
583 test_xrender=yes
584 test_cups=yes
585 test_dbus=yes
586 test_fontconfig=yes
587 test_cairo=no
588 test_gdb_index=no
589 test_split_debug=no
591 # Default values, as such probably valid just for Linux, set
592 # differently below just for Mac OSX, but at least better than
593 # hardcoding these as we used to do. Much of this is duplicated also
594 # in solenv for old build system and for gbuild, ideally we should
595 # perhaps define stuff like this only here in configure.ac?
597 LINKFLAGSSHL="-shared"
598 PICSWITCH="-fpic"
599 DLLPOST=".so"
601 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
603 INSTROOTBASESUFFIX=
604 INSTROOTCONTENTSUFFIX=
605 SDKDIRNAME=sdk
607 case "$host_os" in
609 solaris*)
610     build_gstreamer_1_0=yes
611     test_freetype=yes
612     build_skia=yes
613     _os=SunOS
615     dnl ===========================================================
616     dnl Check whether we're using Solaris 10 - SPARC or Intel.
617     dnl ===========================================================
618     AC_MSG_CHECKING([the Solaris operating system release])
619     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
620     if test "$_os_release" -lt "10"; then
621         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
622     else
623         AC_MSG_RESULT([ok ($_os_release)])
624     fi
626     dnl Check whether we're using a SPARC or i386 processor
627     AC_MSG_CHECKING([the processor type])
628     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
629         AC_MSG_RESULT([ok ($host_cpu)])
630     else
631         AC_MSG_ERROR([only SPARC and i386 processors are supported])
632     fi
633     ;;
635 linux-gnu*|k*bsd*-gnu*)
636     build_gstreamer_1_0=yes
637     test_kf5=yes
638     test_gtk3_kde5=yes
639     build_skia=yes
640     test_gdb_index=yes
641     test_split_debug=yes
642     if test "$enable_fuzzers" != yes; then
643         test_freetype=yes
644         test_fontconfig=yes
645     else
646         test_freetype=no
647         test_fontconfig=no
648         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
649     fi
650     _os=Linux
651     ;;
653 gnu)
654     test_randr=no
655     test_xrender=no
656     _os=GNU
657      ;;
659 cygwin*|interix*)
661     # When building on Windows normally with MSVC under Cygwin,
662     # configure thinks that the host platform (the platform the
663     # built code will run on) is Cygwin, even if it obviously is
664     # Windows, which in Autoconf terminology is called
665     # "mingw32". (Which is misleading as MinGW is the name of the
666     # tool-chain, not an operating system.)
668     # Somewhat confusing, yes. But this configure script doesn't
669     # look at $host etc that much, it mostly uses its own $_os
670     # variable, set here in this case statement.
672     test_cups=no
673     test_dbus=no
674     test_randr=no
675     test_xrender=no
676     test_freetype=no
677     test_fontconfig=no
678     build_skia=yes
679     _os=WINNT
681     DLLPOST=".dll"
682     LINKFLAGSNOUNDEFS=
683     ;;
685 darwin*) # macOS or iOS
686     test_randr=no
687     test_xrender=no
688     test_freetype=no
689     test_fontconfig=no
690     test_dbus=no
691     if test -n "$LODE_HOME" ; then
692         mac_sanitize_path
693         AC_MSG_NOTICE([sanitized the PATH to $PATH])
694     fi
695     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
696         build_for_ios=YES
697         _os=iOS
698         test_cups=no
699         enable_mpl_subset=yes
700         enable_lotuswordpro=no
701         enable_coinmp=no
702         enable_lpsolve=no
703         enable_postgresql_sdbc=no
704         enable_extension_integration=no
705         enable_report_builder=no
706         with_ppds=no
707         if test "$enable_ios_simulator" = "yes"; then
708             host=x86_64-apple-darwin
709         fi
710     else
711         _os=Darwin
712         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
713         INSTROOTCONTENTSUFFIX=/Contents
714         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
715     fi
716     # See comment above the case "$host_os"
717     LINKFLAGSSHL="-dynamiclib -single_module"
719     # -fPIC is default
720     PICSWITCH=""
722     DLLPOST=".dylib"
724     # -undefined error is the default
725     LINKFLAGSNOUNDEFS=""
728 freebsd*)
729     build_gstreamer_1_0=yes
730     test_kf5=yes
731     test_gtk3_kde5=yes
732     test_freetype=yes
733     build_skia=yes
734     AC_MSG_CHECKING([the FreeBSD operating system release])
735     if test -n "$with_os_version"; then
736         OSVERSION="$with_os_version"
737     else
738         OSVERSION=`/sbin/sysctl -n kern.osreldate`
739     fi
740     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
741     AC_MSG_CHECKING([which thread library to use])
742     if test "$OSVERSION" -lt "500016"; then
743         PTHREAD_CFLAGS="-D_THREAD_SAFE"
744         PTHREAD_LIBS="-pthread"
745     elif test "$OSVERSION" -lt "502102"; then
746         PTHREAD_CFLAGS="-D_THREAD_SAFE"
747         PTHREAD_LIBS="-lc_r"
748     else
749         PTHREAD_CFLAGS=""
750         PTHREAD_LIBS="-pthread"
751     fi
752     AC_MSG_RESULT([$PTHREAD_LIBS])
753     _os=FreeBSD
754     ;;
756 *netbsd*)
757     build_gstreamer_1_0=yes
758     test_kf5=yes
759     test_gtk3_kde5=yes
760     test_freetype=yes
761     build_skia=yes
762     PTHREAD_LIBS="-pthread -lpthread"
763     _os=NetBSD
764     ;;
766 aix*)
767     test_randr=no
768     test_freetype=yes
769     PTHREAD_LIBS=-pthread
770     _os=AIX
771     ;;
773 openbsd*)
774     test_freetype=yes
775     PTHREAD_CFLAGS="-D_THREAD_SAFE"
776     PTHREAD_LIBS="-pthread"
777     _os=OpenBSD
778     ;;
780 dragonfly*)
781     build_gstreamer_1_0=yes
782     test_kf5=yes
783     test_gtk3_kde5=yes
784     test_freetype=yes
785     build_skia=yes
786     PTHREAD_LIBS="-pthread"
787     _os=DragonFly
788     ;;
790 linux-android*)
791     build_gstreamer_1_0=no
792     enable_lotuswordpro=no
793     enable_mpl_subset=yes
794     enable_coinmp=yes
795     enable_lpsolve=no
796     enable_report_builder=no
797     enable_odk=no
798     enable_postgresql_sdbc=no
799     enable_python=no
800     test_cups=no
801     test_dbus=no
802     test_fontconfig=no
803     test_freetype=no
804     test_kf5=no
805     test_qt5=no
806     test_gtk3_kde5=no
807     test_randr=no
808     test_xrender=no
809     _os=Android
811     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
812     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
813     ;;
815 haiku*)
816     test_cups=no
817     test_dbus=no
818     test_randr=no
819     test_xrender=no
820     test_freetype=yes
821     enable_odk=no
822     enable_gstreamer_1_0=no
823     enable_vlc=no
824     enable_coinmp=no
825     enable_pdfium=no
826     enable_sdremote=no
827     enable_postgresql_sdbc=no
828     enable_firebird_sdbc=no
829     _os=Haiku
830     ;;
833     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
834     ;;
835 esac
837 if test "$_os" = "Android" ; then
838     # Verify that the NDK and SDK options are proper
839     if test -z "$with_android_ndk"; then
840         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
841     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
842         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
843     fi
845     if test -z "$ANDROID_SDK_HOME"; then
846         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
847     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
848         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
849     fi
851     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
852     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
853         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
854                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
855                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
856         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
857         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
858         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
859     fi
860     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
861         AC_MSG_WARN([android support repository not found - install with
862                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
863                      to allow the build to download the specified version of the android support libraries])
864         add_warning "android support repository not found - install with"
865         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
866         add_warning "to allow the build to download the specified version of the android support libraries"
867     fi
870 if test "$_os" = "AIX"; then
871     AC_PATH_PROG(GAWK, gawk)
872     if test -z "$GAWK"; then
873         AC_MSG_ERROR([gawk not found in \$PATH])
874     fi
877 AC_SUBST(SDKDIRNAME)
879 AC_SUBST(PTHREAD_CFLAGS)
880 AC_SUBST(PTHREAD_LIBS)
882 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
883 # By default use the ones specified by our build system,
884 # but explicit override is possible.
885 AC_MSG_CHECKING(for explicit AFLAGS)
886 if test -n "$AFLAGS"; then
887     AC_MSG_RESULT([$AFLAGS])
888     x_AFLAGS=
889 else
890     AC_MSG_RESULT(no)
891     x_AFLAGS=[\#]
893 AC_MSG_CHECKING(for explicit CFLAGS)
894 if test -n "$CFLAGS"; then
895     AC_MSG_RESULT([$CFLAGS])
896     x_CFLAGS=
897 else
898     AC_MSG_RESULT(no)
899     x_CFLAGS=[\#]
901 AC_MSG_CHECKING(for explicit CXXFLAGS)
902 if test -n "$CXXFLAGS"; then
903     AC_MSG_RESULT([$CXXFLAGS])
904     x_CXXFLAGS=
905 else
906     AC_MSG_RESULT(no)
907     x_CXXFLAGS=[\#]
909 AC_MSG_CHECKING(for explicit OBJCFLAGS)
910 if test -n "$OBJCFLAGS"; then
911     AC_MSG_RESULT([$OBJCFLAGS])
912     x_OBJCFLAGS=
913 else
914     AC_MSG_RESULT(no)
915     x_OBJCFLAGS=[\#]
917 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
918 if test -n "$OBJCXXFLAGS"; then
919     AC_MSG_RESULT([$OBJCXXFLAGS])
920     x_OBJCXXFLAGS=
921 else
922     AC_MSG_RESULT(no)
923     x_OBJCXXFLAGS=[\#]
925 AC_MSG_CHECKING(for explicit LDFLAGS)
926 if test -n "$LDFLAGS"; then
927     AC_MSG_RESULT([$LDFLAGS])
928     x_LDFLAGS=
929 else
930     AC_MSG_RESULT(no)
931     x_LDFLAGS=[\#]
933 AC_SUBST(AFLAGS)
934 AC_SUBST(CFLAGS)
935 AC_SUBST(CXXFLAGS)
936 AC_SUBST(OBJCFLAGS)
937 AC_SUBST(OBJCXXFLAGS)
938 AC_SUBST(LDFLAGS)
939 AC_SUBST(x_AFLAGS)
940 AC_SUBST(x_CFLAGS)
941 AC_SUBST(x_CXXFLAGS)
942 AC_SUBST(x_OBJCFLAGS)
943 AC_SUBST(x_OBJCXXFLAGS)
944 AC_SUBST(x_LDFLAGS)
946 dnl These are potentially set for MSVC, in the code checking for UCRT below:
947 my_original_CFLAGS=$CFLAGS
948 my_original_CXXFLAGS=$CXXFLAGS
949 my_original_CPPFLAGS=$CPPFLAGS
951 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
952 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
953 dnl AC_PROG_CC internally.
954 if test "$_os" != "WINNT"; then
955     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
956     save_CFLAGS=$CFLAGS
957     AC_PROG_CC
958     CFLAGS=$save_CFLAGS
959     if test -z "$CC_BASE"; then
960         CC_BASE=`first_arg_basename "$CC"`
961     fi
964 if test "$_os" != "WINNT"; then
965     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
966 else
967     ENDIANNESS=little
969 AC_SUBST(ENDIANNESS)
971 if test $_os != "WINNT"; then
972     save_LIBS="$LIBS"
973     AC_SEARCH_LIBS([dlsym], [dl],
974         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
975         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
976     LIBS="$save_LIBS"
978 AC_SUBST(DLOPEN_LIBS)
980 AC_ARG_ENABLE(ios-simulator,
981     AS_HELP_STRING([--enable-ios-simulator],
982         [build i386 or x86_64 for ios simulator])
985 AC_ARG_ENABLE(ios-libreofficelight-app,
986     AS_HELP_STRING([--enable-ios-libreofficelight-app],
987         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
988          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
989          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
992 ENABLE_IOS_LIBREOFFICELIGHT_APP=
993 if test "$enable_ios_libreofficelight_app" = yes; then
994     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
996 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
998 ###############################################################################
999 # Extensions switches --enable/--disable
1000 ###############################################################################
1001 # By default these should be enabled unless having extra dependencies.
1002 # If there is extra dependency over configure options then the enable should
1003 # be automagic based on whether the requiring feature is enabled or not.
1004 # All this options change anything only with --enable-extension-integration.
1006 # The name of this option and its help string makes it sound as if
1007 # extensions are built anyway, just not integrated in the installer,
1008 # if you use --disable-extension-integration. Is that really the
1009 # case?
1011 libo_FUZZ_ARG_ENABLE(extension-integration,
1012     AS_HELP_STRING([--disable-extension-integration],
1013         [Disable integration of the built extensions in the installer of the
1014          product. Use this switch to disable the integration.])
1017 AC_ARG_ENABLE(avmedia,
1018     AS_HELP_STRING([--disable-avmedia],
1019         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1022 AC_ARG_ENABLE(database-connectivity,
1023     AS_HELP_STRING([--disable-database-connectivity],
1024         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1027 # This doesn't mean not building (or "integrating") extensions
1028 # (although it probably should; i.e. it should imply
1029 # --disable-extension-integration I guess), it means not supporting
1030 # any extension mechanism at all
1031 libo_FUZZ_ARG_ENABLE(extensions,
1032     AS_HELP_STRING([--disable-extensions],
1033         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1036 AC_ARG_ENABLE(scripting,
1037     AS_HELP_STRING([--disable-scripting],
1038         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1041 # This is mainly for Android and iOS, but could potentially be used in some
1042 # special case otherwise, too, so factored out as a separate setting
1044 AC_ARG_ENABLE(dynamic-loading,
1045     AS_HELP_STRING([--disable-dynamic-loading],
1046         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1049 libo_FUZZ_ARG_ENABLE(report-builder,
1050     AS_HELP_STRING([--disable-report-builder],
1051         [Disable the Report Builder.])
1054 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1055     AS_HELP_STRING([--enable-ext-wiki-publisher],
1056         [Enable the Wiki Publisher extension.])
1059 libo_FUZZ_ARG_ENABLE(lpsolve,
1060     AS_HELP_STRING([--disable-lpsolve],
1061         [Disable compilation of the lp solve solver ])
1063 libo_FUZZ_ARG_ENABLE(coinmp,
1064     AS_HELP_STRING([--disable-coinmp],
1065         [Disable compilation of the CoinMP solver ])
1068 libo_FUZZ_ARG_ENABLE(pdfimport,
1069     AS_HELP_STRING([--disable-pdfimport],
1070         [Disable building the PDF import feature.])
1073 libo_FUZZ_ARG_ENABLE(pdfium,
1074     AS_HELP_STRING([--disable-pdfium],
1075         [Disable building PDFium.])
1078 libo_FUZZ_ARG_ENABLE(skia,
1079     AS_HELP_STRING([--disable-skia],
1080         [Disable building Skia.])
1083 ###############################################################################
1085 dnl ---------- *** ----------
1087 libo_FUZZ_ARG_ENABLE(mergelibs,
1088     AS_HELP_STRING([--enable-mergelibs],
1089         [Merge several of the smaller libraries into one big, "merged", one.])
1092 libo_FUZZ_ARG_ENABLE(breakpad,
1093     AS_HELP_STRING([--enable-breakpad],
1094         [Enables breakpad for crash reporting.])
1097 libo_FUZZ_ARG_ENABLE(crashdump,
1098     AS_HELP_STRING([--disable-crashdump],
1099         [Disable dump.ini and dump-file, when --enable-breakpad])
1102 AC_ARG_ENABLE(fetch-external,
1103     AS_HELP_STRING([--disable-fetch-external],
1104         [Disables fetching external tarballs from web sources.])
1107 AC_ARG_ENABLE(fuzzers,
1108     AS_HELP_STRING([--enable-fuzzers],
1109         [Enables building libfuzzer targets for fuzz testing.])
1112 libo_FUZZ_ARG_ENABLE(pch,
1113     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1114         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1115          Using 'system' will include only external headers, 'base' will add also headers
1116          from base modules, 'normal' will also add all headers except from the module built,
1117          'full' will use all suitable headers even from a module itself.])
1120 libo_FUZZ_ARG_ENABLE(epm,
1121     AS_HELP_STRING([--enable-epm],
1122         [LibreOffice includes self-packaging code, that requires epm, however epm is
1123          useless for large scale package building.])
1126 libo_FUZZ_ARG_ENABLE(odk,
1127     AS_HELP_STRING([--disable-odk],
1128         [LibreOffice includes an ODK, office development kit which some packagers may
1129          wish to build without.])
1132 AC_ARG_ENABLE(mpl-subset,
1133     AS_HELP_STRING([--enable-mpl-subset],
1134         [Don't compile any pieces which are not MPL or more liberally licensed])
1137 libo_FUZZ_ARG_ENABLE(evolution2,
1138     AS_HELP_STRING([--enable-evolution2],
1139         [Allows the built-in evolution 2 addressbook connectivity build to be
1140          enabled.])
1143 AC_ARG_ENABLE(avahi,
1144     AS_HELP_STRING([--enable-avahi],
1145         [Determines whether to use Avahi to advertise Impress to remote controls.])
1148 libo_FUZZ_ARG_ENABLE(werror,
1149     AS_HELP_STRING([--enable-werror],
1150         [Turn warnings to errors. (Has no effect in modules where the treating
1151          of warnings as errors is disabled explicitly.)]),
1154 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1155     AS_HELP_STRING([--enable-assert-always-abort],
1156         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1159 libo_FUZZ_ARG_ENABLE(dbgutil,
1160     AS_HELP_STRING([--enable-dbgutil],
1161         [Provide debugging support from --enable-debug and include additional debugging
1162          utilities such as object counting or more expensive checks.
1163          This is the recommended option for developers.
1164          Note that this makes the build ABI incompatible, it is not possible to mix object
1165          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1167 libo_FUZZ_ARG_ENABLE(debug,
1168     AS_HELP_STRING([--enable-debug],
1169         [Include debugging information, disable compiler optimization and inlining plus
1170          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1172 libo_FUZZ_ARG_ENABLE(split-debug,
1173     AS_HELP_STRING([--disable-split-debug],
1174         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1175          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1177 libo_FUZZ_ARG_ENABLE(gdb-index,
1178     AS_HELP_STRING([--disable-gdb-index],
1179         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1180          The feature requires the gold or lld linker.]))
1182 libo_FUZZ_ARG_ENABLE(sal-log,
1183     AS_HELP_STRING([--enable-sal-log],
1184         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1186 libo_FUZZ_ARG_ENABLE(symbols,
1187     AS_HELP_STRING([--enable-symbols],
1188         [Generate debug information.
1189          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1190          otherwise. It is possible to explicitly specify gbuild build targets
1191          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1192          everything in the directory; there is no ordering, more specific overrides
1193          more general, and disabling takes precedence).
1194          Example: --enable-symbols="all -sw/ -Library_sc".]))
1196 libo_FUZZ_ARG_ENABLE(optimized,
1197     AS_HELP_STRING([--disable-optimized],
1198         [Whether to compile with optimization flags.
1199          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1200          otherwise.]))
1202 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1203     AS_HELP_STRING([--disable-runtime-optimizations],
1204         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1205          JVM JIT) that are known to interact badly with certain dynamic analysis
1206          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1207          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1208          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1210 AC_ARG_WITH(valgrind,
1211     AS_HELP_STRING([--with-valgrind],
1212         [Make availability of Valgrind headers a hard requirement.]))
1214 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1215     AS_HELP_STRING([--enable-compiler-plugins],
1216         [Enable compiler plugins that will perform additional checks during
1217          building. Enabled automatically by --enable-dbgutil.
1218          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1219 COMPILER_PLUGINS_DEBUG=
1220 if test "$enable_compiler_plugins" = debug; then
1221     enable_compiler_plugins=yes
1222     COMPILER_PLUGINS_DEBUG=TRUE
1225 libo_FUZZ_ARG_ENABLE(ooenv,
1226     AS_HELP_STRING([--disable-ooenv],
1227         [Disable ooenv for the instdir installation.]))
1229 libo_FUZZ_ARG_ENABLE(libnumbertext,
1230     AS_HELP_STRING([--disable-libnumbertext],
1231         [Disable use of numbertext external library.]))
1233 AC_ARG_ENABLE(lto,
1234     AS_HELP_STRING([--enable-lto],
1235         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1236          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1237          linker. For MSVC, this option is broken at the moment. This is experimental work
1238          in progress that shouldn't be used unless you are working on it.)]))
1240 AC_ARG_ENABLE(python,
1241     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1242         [Enables or disables Python support at run-time.
1243          Also specifies what Python to use. 'auto' is the default.
1244          'fully-internal' even forces the internal version for uses of Python
1245          during the build.]))
1247 libo_FUZZ_ARG_ENABLE(gtk3,
1248     AS_HELP_STRING([--disable-gtk3],
1249         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1250 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1252 AC_ARG_ENABLE(introspection,
1253     AS_HELP_STRING([--enable-introspection],
1254         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1255          Linux distributions.)]))
1257 AC_ARG_ENABLE(split-app-modules,
1258     AS_HELP_STRING([--enable-split-app-modules],
1259         [Split file lists for app modules, e.g. base, calc.
1260          Has effect only with make distro-pack-install]),
1263 AC_ARG_ENABLE(split-opt-features,
1264     AS_HELP_STRING([--enable-split-opt-features],
1265         [Split file lists for some optional features, e.g. pyuno, testtool.
1266          Has effect only with make distro-pack-install]),
1269 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1270     AS_HELP_STRING([--disable-cairo-canvas],
1271         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1274 libo_FUZZ_ARG_ENABLE(dbus,
1275     AS_HELP_STRING([--disable-dbus],
1276         [Determines whether to enable features that depend on dbus.
1277          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1278 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1280 libo_FUZZ_ARG_ENABLE(sdremote,
1281     AS_HELP_STRING([--disable-sdremote],
1282         [Determines whether to enable Impress remote control (i.e. the server component).]),
1283 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1285 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1286     AS_HELP_STRING([--disable-sdremote-bluetooth],
1287         [Determines whether to build sdremote with bluetooth support.
1288          Requires dbus on Linux.]))
1290 libo_FUZZ_ARG_ENABLE(gio,
1291     AS_HELP_STRING([--disable-gio],
1292         [Determines whether to use the GIO support.]),
1293 ,test "${enable_gio+set}" = set || enable_gio=yes)
1295 AC_ARG_ENABLE(qt5,
1296     AS_HELP_STRING([--enable-qt5],
1297         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1298          available.]),
1301 AC_ARG_ENABLE(kf5,
1302     AS_HELP_STRING([--enable-kf5],
1303         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1304          KF5 are available.]),
1307 AC_ARG_ENABLE(kde5,
1308     AS_HELP_STRING([--enable-kde5],
1309         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1312 AC_ARG_ENABLE(gtk3_kde5,
1313     AS_HELP_STRING([--enable-gtk3-kde5],
1314         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1315          platforms where Gtk3, Qt5 and Plasma is available.]),
1318 AC_ARG_ENABLE(gui,
1319     AS_HELP_STRING([--disable-gui],
1320         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1321 ,enable_gui=yes)
1323 libo_FUZZ_ARG_ENABLE(randr,
1324     AS_HELP_STRING([--disable-randr],
1325         [Disable RandR support in the vcl project.]),
1326 ,test "${enable_randr+set}" = set || enable_randr=yes)
1328 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1329     AS_HELP_STRING([--disable-gstreamer-1-0],
1330         [Disable building with the gstreamer 1.0 avmedia backend.]),
1331 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1333 libo_FUZZ_ARG_ENABLE(vlc,
1334     AS_HELP_STRING([--enable-vlc],
1335         [Enable building with the (experimental) VLC avmedia backend.]),
1336 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1338 libo_FUZZ_ARG_ENABLE(neon,
1339     AS_HELP_STRING([--disable-neon],
1340         [Disable neon and the compilation of webdav binding.]),
1343 libo_FUZZ_ARG_ENABLE([eot],
1344     [AS_HELP_STRING([--enable-eot],
1345         [Enable support for Embedded OpenType fonts.])],
1346 ,test "${enable_eot+set}" = set || enable_eot=no)
1348 libo_FUZZ_ARG_ENABLE(cve-tests,
1349     AS_HELP_STRING([--disable-cve-tests],
1350         [Prevent CVE tests to be executed]),
1353 libo_FUZZ_ARG_ENABLE(chart-tests,
1354     AS_HELP_STRING([--enable-chart-tests],
1355         [Executes chart XShape tests. In a perfect world these tests would be
1356          stable and everyone could run them, in reality it is best to run them
1357          only on a few machines that are known to work and maintained by people
1358          who can judge if a test failure is a regression or not.]),
1361 AC_ARG_ENABLE(build-unowinreg,
1362     AS_HELP_STRING([--enable-build-unowinreg],
1363         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1364          compiler is needed on Linux.]),
1367 AC_ARG_ENABLE(build-opensymbol,
1368     AS_HELP_STRING([--enable-build-opensymbol],
1369         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1370          fontforge installed.]),
1373 AC_ARG_ENABLE(dependency-tracking,
1374     AS_HELP_STRING([--enable-dependency-tracking],
1375         [Do not reject slow dependency extractors.])[
1376   --disable-dependency-tracking
1377                           Disables generation of dependency information.
1378                           Speed up one-time builds.],
1381 AC_ARG_ENABLE(icecream,
1382     AS_HELP_STRING([--enable-icecream],
1383         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1384          It defaults to /opt/icecream for the location of the icecream gcc/g++
1385          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1388 AC_ARG_ENABLE(ld,
1389     AS_HELP_STRING([--enable-ld=<linker>],
1390         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1391          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1394 libo_FUZZ_ARG_ENABLE(cups,
1395     AS_HELP_STRING([--disable-cups],
1396         [Do not build cups support.])
1399 AC_ARG_ENABLE(ccache,
1400     AS_HELP_STRING([--disable-ccache],
1401         [Do not try to use ccache automatically.
1402          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1403          CC/CXX are not yet set, and --enable-icecream is not given, we
1404          attempt to use ccache. --disable-ccache disables ccache completely.
1405          Additionally ccache's depend mode is enabled if possible,
1406          use --enable-ccache=nodepend to enable ccache without depend mode.
1410 AC_ARG_ENABLE(64-bit,
1411     AS_HELP_STRING([--enable-64-bit],
1412         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1413          At the moment meaningful only for Windows.]), ,)
1415 libo_FUZZ_ARG_ENABLE(online-update,
1416     AS_HELP_STRING([--enable-online-update],
1417         [Enable the online update service that will check for new versions of
1418          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1419          If the value is "mar", the experimental Mozilla-like update will be
1420          enabled instead of the traditional update mechanism.]),
1423 AC_ARG_WITH(update-config,
1424     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1425                    [Path to the update config ini file]))
1427 libo_FUZZ_ARG_ENABLE(extension-update,
1428     AS_HELP_STRING([--disable-extension-update],
1429         [Disable possibility to update installed extensions.]),
1432 libo_FUZZ_ARG_ENABLE(release-build,
1433     AS_HELP_STRING([--enable-release-build],
1434         [Enable release build. Note that the "release build" choice is orthogonal to
1435          whether symbols are present, debug info is generated, or optimization
1436          is done.
1437          See http://wiki.documentfoundation.org/Development/DevBuild]),
1440 AC_ARG_ENABLE(windows-build-signing,
1441     AS_HELP_STRING([--enable-windows-build-signing],
1442         [Enable signing of windows binaries (*.exe, *.dll)]),
1445 AC_ARG_ENABLE(silent-msi,
1446     AS_HELP_STRING([--enable-silent-msi],
1447         [Enable MSI with LIMITUI=1 (silent install).]),
1450 AC_ARG_ENABLE(macosx-code-signing,
1451     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1452         [Sign executables, dylibs, frameworks and the app bundle. If you
1453          don't provide an identity the first suitable certificate
1454          in your keychain is used.]),
1457 AC_ARG_ENABLE(macosx-package-signing,
1458     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1459         [Create a .pkg suitable for uploading to the Mac App Store and sign
1460          it. If you don't provide an identity the first suitable certificate
1461          in your keychain is used.]),
1464 AC_ARG_ENABLE(macosx-sandbox,
1465     AS_HELP_STRING([--enable-macosx-sandbox],
1466         [Make the app bundle run in a sandbox. Requires code signing.
1467          Is required by apps distributed in the Mac App Store, and implies
1468          adherence to App Store rules.]),
1471 AC_ARG_WITH(macosx-bundle-identifier,
1472     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1473         [Define the macOS bundle identifier. Default is the somewhat weird
1474          org.libreoffice.script ("script", huh?).]),
1475 ,with_macosx_bundle_identifier=org.libreoffice.script)
1477 AC_ARG_WITH(product-name,
1478     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1479         [Define the product name. Default is AC_PACKAGE_NAME.]),
1480 ,with_product_name=$PRODUCTNAME)
1482 AC_ARG_WITH(package-version,
1483     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1484         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1487 libo_FUZZ_ARG_ENABLE(readonly-installset,
1488     AS_HELP_STRING([--enable-readonly-installset],
1489         [Prevents any attempts by LibreOffice to write into its installation. That means
1490          at least that no "system-wide" extensions can be added. Partly experimental work in
1491          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1494 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1495     AS_HELP_STRING([--disable-postgresql-sdbc],
1496         [Disable the build of the PostgreSQL-SDBC driver.])
1499 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1500     AS_HELP_STRING([--disable-lotuswordpro],
1501         [Disable the build of the Lotus Word Pro filter.]),
1502 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1504 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1505     AS_HELP_STRING([--disable-firebird-sdbc],
1506         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1507 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1509 AC_ARG_ENABLE(bogus-pkg-config,
1510     AS_HELP_STRING([--enable-bogus-pkg-config],
1511         [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.]),
1514 AC_ARG_ENABLE(openssl,
1515     AS_HELP_STRING([--disable-openssl],
1516         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1517          components will either use GNUTLS or NSS. Work in progress,
1518          use only if you are hacking on it.]),
1519 ,enable_openssl=yes)
1521 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1522     AS_HELP_STRING([--enable-cipher-openssl-backend],
1523         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1524          Requires --enable-openssl.]))
1526 AC_ARG_ENABLE(library-bin-tar,
1527     AS_HELP_STRING([--enable-library-bin-tar],
1528         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1529         Some libraries can save their build result in a tarball
1530         stored in TARFILE_LOCATION. That binary tarball is
1531         uniquely identified by the source tarball,
1532         the content of the config_host.mk file and the content
1533         of the top-level directory in core for that library
1534         If this option is enabled, then if such a tarfile exist, it will be untarred
1535         instead of the source tarfile, and the build step will be skipped for that
1536         library.
1537         If a proper tarfile does not exist, then the normal source-based
1538         build is done for that library and a proper binary tarfile is created
1539         for the next time.]),
1542 AC_ARG_ENABLE(dconf,
1543     AS_HELP_STRING([--disable-dconf],
1544         [Disable the dconf configuration backend (enabled by default where
1545          available).]))
1547 libo_FUZZ_ARG_ENABLE(formula-logger,
1548     AS_HELP_STRING(
1549         [--enable-formula-logger],
1550         [Enable formula logger for logging formula calculation flow in Calc.]
1551     )
1554 AC_ARG_ENABLE(ldap,
1555     AS_HELP_STRING([--disable-ldap],
1556         [Disable LDAP support.]),
1557 ,enable_ldap=yes)
1559 dnl ===================================================================
1560 dnl Optional Packages (--with/without-)
1561 dnl ===================================================================
1563 AC_ARG_WITH(gcc-home,
1564     AS_HELP_STRING([--with-gcc-home],
1565         [Specify the location of gcc/g++ manually. This can be used in conjunction
1566          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1567          non-default path.]),
1570 AC_ARG_WITH(gnu-patch,
1571     AS_HELP_STRING([--with-gnu-patch],
1572         [Specify location of GNU patch on Solaris or FreeBSD.]),
1575 AC_ARG_WITH(build-platform-configure-options,
1576     AS_HELP_STRING([--with-build-platform-configure-options],
1577         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1580 AC_ARG_WITH(gnu-cp,
1581     AS_HELP_STRING([--with-gnu-cp],
1582         [Specify location of GNU cp on Solaris or FreeBSD.]),
1585 AC_ARG_WITH(external-tar,
1586     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1587         [Specify an absolute path of where to find (and store) tarfiles.]),
1588     TARFILE_LOCATION=$withval ,
1591 AC_ARG_WITH(referenced-git,
1592     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1593         [Specify another checkout directory to reference. This makes use of
1594                  git submodule update --reference, and saves a lot of diskspace
1595                  when having multiple trees side-by-side.]),
1596     GIT_REFERENCE_SRC=$withval ,
1599 AC_ARG_WITH(linked-git,
1600     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1601         [Specify a directory where the repositories of submodules are located.
1602          This uses a method similar to git-new-workdir to get submodules.]),
1603     GIT_LINK_SRC=$withval ,
1606 AC_ARG_WITH(galleries,
1607     AS_HELP_STRING([--with-galleries],
1608         [Specify how galleries should be built. It is possible either to
1609          build these internally from source ("build"),
1610          or to disable them ("no")]),
1613 AC_ARG_WITH(theme,
1614     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1615         [Choose which themes to include. By default those themes with an '*' are included.
1616          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1617          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *tango.]),
1620 libo_FUZZ_ARG_WITH(helppack-integration,
1621     AS_HELP_STRING([--without-helppack-integration],
1622         [It will not integrate the helppacks to the installer
1623          of the product. Please use this switch to use the online help
1624          or separate help packages.]),
1627 libo_FUZZ_ARG_WITH(fonts,
1628     AS_HELP_STRING([--without-fonts],
1629         [LibreOffice includes some third-party fonts to provide a reliable basis for
1630          help content, templates, samples, etc. When these fonts are already
1631          known to be available on the system then you should use this option.]),
1634 AC_ARG_WITH(epm,
1635     AS_HELP_STRING([--with-epm],
1636         [Decides which epm to use. Default is to use the one from the system if
1637          one is built. When either this is not there or you say =internal epm
1638          will be built.]),
1641 AC_ARG_WITH(package-format,
1642     AS_HELP_STRING([--with-package-format],
1643         [Specify package format(s) for LibreOffice installation sets. The
1644          implicit --without-package-format leads to no installation sets being
1645          generated. Possible values: aix, archive, bsd, deb, dmg,
1646          installed, msi, pkg, and rpm.
1647          Example: --with-package-format='deb rpm']),
1650 AC_ARG_WITH(tls,
1651     AS_HELP_STRING([--with-tls],
1652         [Decides which TLS/SSL and cryptographic implementations to use for
1653          LibreOffice's code. Notice that this doesn't apply for depending
1654          libraries like "neon", for example. Default is to use OpenSSL
1655          although NSS is also possible. Notice that selecting NSS restricts
1656          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1657          restrict by now the usage of NSS in LO's code. Possible values:
1658          openssl, nss. Example: --with-tls="nss"]),
1661 AC_ARG_WITH(system-libs,
1662     AS_HELP_STRING([--with-system-libs],
1663         [Use libraries already on system -- enables all --with-system-* flags.]),
1666 AC_ARG_WITH(system-bzip2,
1667     AS_HELP_STRING([--with-system-bzip2],
1668         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1669     [with_system_bzip2="$with_system_libs"])
1671 AC_ARG_WITH(system-headers,
1672     AS_HELP_STRING([--with-system-headers],
1673         [Use headers already on system -- enables all --with-system-* flags for
1674          external packages whose headers are the only entities used i.e.
1675          boost/odbc/sane-header(s).]),,
1676     [with_system_headers="$with_system_libs"])
1678 AC_ARG_WITH(system-jars,
1679     AS_HELP_STRING([--without-system-jars],
1680         [When building with --with-system-libs, also the needed jars are expected
1681          on the system. Use this to disable that]),,
1682     [with_system_jars="$with_system_libs"])
1684 AC_ARG_WITH(system-cairo,
1685     AS_HELP_STRING([--with-system-cairo],
1686         [Use cairo libraries already on system.  Happens automatically for
1687          (implicit) --enable-gtk3.]))
1689 AC_ARG_WITH(system-epoxy,
1690     AS_HELP_STRING([--with-system-epoxy],
1691         [Use epoxy libraries already on system.  Happens automatically for
1692          (implicit) --enable-gtk3.]),,
1693        [with_system_epoxy="$with_system_libs"])
1695 AC_ARG_WITH(myspell-dicts,
1696     AS_HELP_STRING([--with-myspell-dicts],
1697         [Adds myspell dictionaries to the LibreOffice installation set]),
1700 AC_ARG_WITH(system-dicts,
1701     AS_HELP_STRING([--without-system-dicts],
1702         [Do not use dictionaries from system paths.]),
1705 AC_ARG_WITH(external-dict-dir,
1706     AS_HELP_STRING([--with-external-dict-dir],
1707         [Specify external dictionary dir.]),
1710 AC_ARG_WITH(external-hyph-dir,
1711     AS_HELP_STRING([--with-external-hyph-dir],
1712         [Specify external hyphenation pattern dir.]),
1715 AC_ARG_WITH(external-thes-dir,
1716     AS_HELP_STRING([--with-external-thes-dir],
1717         [Specify external thesaurus dir.]),
1720 AC_ARG_WITH(system-zlib,
1721     AS_HELP_STRING([--with-system-zlib],
1722         [Use zlib already on system.]),,
1723     [with_system_zlib=auto])
1725 AC_ARG_WITH(system-jpeg,
1726     AS_HELP_STRING([--with-system-jpeg],
1727         [Use jpeg already on system.]),,
1728     [with_system_jpeg="$with_system_libs"])
1730 AC_ARG_WITH(system-clucene,
1731     AS_HELP_STRING([--with-system-clucene],
1732         [Use clucene already on system.]),,
1733     [with_system_clucene="$with_system_libs"])
1735 AC_ARG_WITH(system-expat,
1736     AS_HELP_STRING([--with-system-expat],
1737         [Use expat already on system.]),,
1738     [with_system_expat="$with_system_libs"])
1740 AC_ARG_WITH(system-libxml,
1741     AS_HELP_STRING([--with-system-libxml],
1742         [Use libxml/libxslt already on system.]),,
1743     [with_system_libxml=auto])
1745 AC_ARG_WITH(system-icu,
1746     AS_HELP_STRING([--with-system-icu],
1747         [Use icu already on system.]),,
1748     [with_system_icu="$with_system_libs"])
1750 AC_ARG_WITH(system-ucpp,
1751     AS_HELP_STRING([--with-system-ucpp],
1752         [Use ucpp already on system.]),,
1753     [])
1755 AC_ARG_WITH(system-openldap,
1756     AS_HELP_STRING([--with-system-openldap],
1757         [Use the OpenLDAP LDAP SDK already on system.]),,
1758     [with_system_openldap="$with_system_libs"])
1760 libo_FUZZ_ARG_ENABLE(poppler,
1761     AS_HELP_STRING([--disable-poppler],
1762         [Disable building Poppler.])
1765 AC_ARG_WITH(system-poppler,
1766     AS_HELP_STRING([--with-system-poppler],
1767         [Use system poppler (only needed for PDF import).]),,
1768     [with_system_poppler="$with_system_libs"])
1770 AC_ARG_WITH(system-gpgmepp,
1771     AS_HELP_STRING([--with-system-gpgmepp],
1772         [Use gpgmepp already on system]),,
1773     [with_system_gpgmepp="$with_system_libs"])
1775 AC_ARG_WITH(system-apache-commons,
1776     AS_HELP_STRING([--with-system-apache-commons],
1777         [Use Apache commons libraries already on system.]),,
1778     [with_system_apache_commons="$with_system_jars"])
1780 AC_ARG_WITH(system-mariadb,
1781     AS_HELP_STRING([--with-system-mariadb],
1782         [Use MariaDB/MySQL libraries already on system.]),,
1783     [with_system_mariadb="$with_system_libs"])
1785 AC_ARG_ENABLE(bundle-mariadb,
1786     AS_HELP_STRING([--enable-bundle-mariadb],
1787         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1790 AC_ARG_WITH(system-postgresql,
1791     AS_HELP_STRING([--with-system-postgresql],
1792         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1793          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1794     [with_system_postgresql="$with_system_libs"])
1796 AC_ARG_WITH(libpq-path,
1797     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1798         [Use this PostgreSQL C interface (libpq) installation for building
1799          the PostgreSQL-SDBC extension.]),
1802 AC_ARG_WITH(system-firebird,
1803     AS_HELP_STRING([--with-system-firebird],
1804         [Use Firebird libraries already on system, for building the Firebird-SDBC
1805          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1806     [with_system_firebird="$with_system_libs"])
1808 AC_ARG_WITH(system-libtommath,
1809             AS_HELP_STRING([--with-system-libtommath],
1810                            [Use libtommath already on system]),,
1811             [with_system_libtommath="$with_system_libs"])
1813 AC_ARG_WITH(system-hsqldb,
1814     AS_HELP_STRING([--with-system-hsqldb],
1815         [Use hsqldb already on system.]))
1817 AC_ARG_WITH(hsqldb-jar,
1818     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1819         [Specify path to jarfile manually.]),
1820     HSQLDB_JAR=$withval)
1822 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1823     AS_HELP_STRING([--disable-scripting-beanshell],
1824         [Disable support for scripts in BeanShell.]),
1828 AC_ARG_WITH(system-beanshell,
1829     AS_HELP_STRING([--with-system-beanshell],
1830         [Use beanshell already on system.]),,
1831     [with_system_beanshell="$with_system_jars"])
1833 AC_ARG_WITH(beanshell-jar,
1834     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     BSH_JAR=$withval)
1838 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1839     AS_HELP_STRING([--disable-scripting-javascript],
1840         [Disable support for scripts in JavaScript.]),
1844 AC_ARG_WITH(system-rhino,
1845     AS_HELP_STRING([--with-system-rhino],
1846         [Use rhino already on system.]),,)
1847 #    [with_system_rhino="$with_system_jars"])
1848 # Above is not used as we have different debug interface
1849 # patched into internal rhino. This code needs to be fixed
1850 # before we can enable it by default.
1852 AC_ARG_WITH(rhino-jar,
1853     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     RHINO_JAR=$withval)
1857 AC_ARG_WITH(commons-logging-jar,
1858     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     COMMONS_LOGGING_JAR=$withval)
1862 AC_ARG_WITH(system-jfreereport,
1863     AS_HELP_STRING([--with-system-jfreereport],
1864         [Use JFreeReport already on system.]),,
1865     [with_system_jfreereport="$with_system_jars"])
1867 AC_ARG_WITH(sac-jar,
1868     AS_HELP_STRING([--with-sac-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     SAC_JAR=$withval)
1872 AC_ARG_WITH(libxml-jar,
1873     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBXML_JAR=$withval)
1877 AC_ARG_WITH(flute-jar,
1878     AS_HELP_STRING([--with-flute-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     FLUTE_JAR=$withval)
1882 AC_ARG_WITH(jfreereport-jar,
1883     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     JFREEREPORT_JAR=$withval)
1887 AC_ARG_WITH(liblayout-jar,
1888     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBLAYOUT_JAR=$withval)
1892 AC_ARG_WITH(libloader-jar,
1893     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBLOADER_JAR=$withval)
1897 AC_ARG_WITH(libformula-jar,
1898     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBFORMULA_JAR=$withval)
1902 AC_ARG_WITH(librepository-jar,
1903     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBREPOSITORY_JAR=$withval)
1907 AC_ARG_WITH(libfonts-jar,
1908     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBFONTS_JAR=$withval)
1912 AC_ARG_WITH(libserializer-jar,
1913     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBSERIALIZER_JAR=$withval)
1917 AC_ARG_WITH(libbase-jar,
1918     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1919         [Specify path to jarfile manually.]),
1920     LIBBASE_JAR=$withval)
1922 AC_ARG_WITH(system-odbc,
1923     AS_HELP_STRING([--with-system-odbc],
1924         [Use the odbc headers already on system.]),,
1925     [with_system_odbc="auto"])
1927 AC_ARG_WITH(system-sane,
1928     AS_HELP_STRING([--with-system-sane],
1929         [Use sane.h already on system.]),,
1930     [with_system_sane="$with_system_headers"])
1932 AC_ARG_WITH(system-bluez,
1933     AS_HELP_STRING([--with-system-bluez],
1934         [Use bluetooth.h already on system.]),,
1935     [with_system_bluez="$with_system_headers"])
1937 AC_ARG_WITH(system-curl,
1938     AS_HELP_STRING([--with-system-curl],
1939         [Use curl already on system.]),,
1940     [with_system_curl=auto])
1942 AC_ARG_WITH(system-boost,
1943     AS_HELP_STRING([--with-system-boost],
1944         [Use boost already on system.]),,
1945     [with_system_boost="$with_system_headers"])
1947 AC_ARG_WITH(system-glm,
1948     AS_HELP_STRING([--with-system-glm],
1949         [Use glm already on system.]),,
1950     [with_system_glm="$with_system_headers"])
1952 AC_ARG_WITH(system-hunspell,
1953     AS_HELP_STRING([--with-system-hunspell],
1954         [Use libhunspell already on system.]),,
1955     [with_system_hunspell="$with_system_libs"])
1957 AC_ARG_WITH(system-qrcodegen,
1958     AS_HELP_STRING([--with-system-qrcodegen],
1959         [Use libqrcodegen already on system.]),,
1960     [with_system_qrcodegen="$with_system_libs"])
1962 AC_ARG_WITH(system-mythes,
1963     AS_HELP_STRING([--with-system-mythes],
1964         [Use mythes already on system.]),,
1965     [with_system_mythes="$with_system_libs"])
1967 AC_ARG_WITH(system-altlinuxhyph,
1968     AS_HELP_STRING([--with-system-altlinuxhyph],
1969         [Use ALTLinuxhyph already on system.]),,
1970     [with_system_altlinuxhyph="$with_system_libs"])
1972 AC_ARG_WITH(system-lpsolve,
1973     AS_HELP_STRING([--with-system-lpsolve],
1974         [Use lpsolve already on system.]),,
1975     [with_system_lpsolve="$with_system_libs"])
1977 AC_ARG_WITH(system-coinmp,
1978     AS_HELP_STRING([--with-system-coinmp],
1979         [Use CoinMP already on system.]),,
1980     [with_system_coinmp="$with_system_libs"])
1982 AC_ARG_WITH(system-liblangtag,
1983     AS_HELP_STRING([--with-system-liblangtag],
1984         [Use liblangtag library already on system.]),,
1985     [with_system_liblangtag="$with_system_libs"])
1987 AC_ARG_WITH(webdav,
1988     AS_HELP_STRING([--with-webdav],
1989         [Specify which library to use for webdav implementation.
1990          Possible values: "neon", "serf", "no". The default value is "neon".
1991          Example: --with-webdav="serf"]),
1992     WITH_WEBDAV=$withval,
1993     WITH_WEBDAV="neon")
1995 AC_ARG_WITH(linker-hash-style,
1996     AS_HELP_STRING([--with-linker-hash-style],
1997         [Use linker with --hash-style=<style> when linking shared objects.
1998          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1999          if supported on the build system, and "sysv" otherwise.]))
2001 AC_ARG_WITH(jdk-home,
2002     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2003         [If you have installed JDK 8 or later on your system please supply the
2004          path here. Note that this is not the location of the java command but the
2005          location of the entire distribution.]),
2008 AC_ARG_WITH(help,
2009     AS_HELP_STRING([--with-help],
2010         [Enable the build of help. There is a special parameter "common" that
2011          can be used to bundle only the common part, .e.g help-specific icons.
2012          This is useful when you build the helpcontent separately.])
2013     [
2014                           Usage:     --with-help    build the old local help
2015                                  --without-help     no local help (default)
2016                                  --with-help=html   build the new HTML local help
2017                                  --with-help=online build the new HTML online help
2018     ],
2021 AC_ARG_WITH(omindex,
2022    AS_HELP_STRING([--with-omindex],
2023         [Enable the support of xapian-omega index for online help.])
2024    [
2025                          Usage: --with-omindex=server prepare the pages for omindex
2026                                 but let xapian-omega be built in server.
2027                                 --with-omindex=noxap do not prepare online pages
2028                                 for xapian-omega
2029   ],
2032 libo_FUZZ_ARG_WITH(java,
2033     AS_HELP_STRING([--with-java=<java command>],
2034         [Specify the name of the Java interpreter command. Typically "java"
2035          which is the default.
2037          To build without support for Java components, applets, accessibility
2038          or the XML filters written in Java, use --without-java or --with-java=no.]),
2039     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2040     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2043 AC_ARG_WITH(jvm-path,
2044     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2045         [Use a specific JVM search path at runtime.
2046          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2049 AC_ARG_WITH(ant-home,
2050     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2051         [If you have installed Apache Ant on your system, please supply the path here.
2052          Note that this is not the location of the Ant binary but the location
2053          of the entire distribution.]),
2056 AC_ARG_WITH(symbol-config,
2057     AS_HELP_STRING([--with-symbol-config],
2058         [Configuration for the crashreport symbol upload]),
2059         [],
2060         [with_symbol_config=no])
2062 AC_ARG_WITH(export-validation,
2063     AS_HELP_STRING([--without-export-validation],
2064         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2065 ,with_export_validation=auto)
2067 AC_ARG_WITH(bffvalidator,
2068     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2069         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2070          Requires installed Microsoft Office Binary File Format Validator.
2071          Note: export-validation (--with-export-validation) is required to be turned on.
2072          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2073 ,with_bffvalidator=no)
2075 libo_FUZZ_ARG_WITH(junit,
2076     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2077         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2078          --without-junit disables those tests. Not relevant in the --without-java case.]),
2079 ,with_junit=yes)
2081 AC_ARG_WITH(hamcrest,
2082     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2083         [Specifies the hamcrest jar file to use for JUnit-based tests.
2084          --without-junit disables those tests. Not relevant in the --without-java case.]),
2085 ,with_hamcrest=yes)
2087 AC_ARG_WITH(perl-home,
2088     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2089         [If you have installed Perl 5 Distribution, on your system, please
2090          supply the path here. Note that this is not the location of the Perl
2091          binary but the location of the entire distribution.]),
2094 libo_FUZZ_ARG_WITH(doxygen,
2095     AS_HELP_STRING(
2096         [--with-doxygen=<absolute path to doxygen executable>],
2097         [Specifies the doxygen executable to use when generating ODK C/C++
2098          documentation. --without-doxygen disables generation of ODK C/C++
2099          documentation. Not relevant in the --disable-odk case.]),
2100 ,with_doxygen=yes)
2102 AC_ARG_WITH(visual-studio,
2103     AS_HELP_STRING([--with-visual-studio=<2017>],
2104         [Specify which Visual Studio version to use in case several are
2105          installed. Currently only 2017 is supported.]),
2108 AC_ARG_WITH(windows-sdk,
2109     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2110         [Specify which Windows SDK, or "Windows Kit", version to use
2111          in case the one that came with the selected Visual Studio
2112          is not what you want for some reason. Note that not all compiler/SDK
2113          combinations are supported. The intent is that this option should not
2114          be needed.]),
2117 AC_ARG_WITH(lang,
2118     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2119         [Use this option to build LibreOffice with additional UI language support.
2120          English (US) is always included by default.
2121          Separate multiple languages with space.
2122          For all languages, use --with-lang=ALL.]),
2125 AC_ARG_WITH(locales,
2126     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2127         [Use this option to limit the locale information built in.
2128          Separate multiple locales with space.
2129          Very experimental and might well break stuff.
2130          Just a desperate measure to shrink code and data size.
2131          By default all the locales available is included.
2132          This option is completely unrelated to --with-lang.])
2133     [
2134                           Affects also our character encoding conversion
2135                           tables for encodings mainly targeted for a
2136                           particular locale, like EUC-CN and EUC-TW for
2137                           zh, ISO-2022-JP for ja.
2139                           Affects also our add-on break iterator data for
2140                           some languages.
2142                           For the default, all locales, don't use this switch at all.
2143                           Specifying just the language part of a locale means all matching
2144                           locales will be included.
2145     ],
2148 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2149 libo_FUZZ_ARG_WITH(krb5,
2150     AS_HELP_STRING([--with-krb5],
2151         [Enable MIT Kerberos 5 support in modules that support it.
2152          By default automatically enabled on platforms
2153          where a good system Kerberos 5 is available.]),
2156 libo_FUZZ_ARG_WITH(gssapi,
2157     AS_HELP_STRING([--with-gssapi],
2158         [Enable GSSAPI support in modules that support it.
2159          By default automatically enabled on platforms
2160          where a good system GSSAPI is available.]),
2163 AC_ARG_WITH(iwyu,
2164     AS_HELP_STRING([--with-iwyu],
2165         [Use given IWYU binary path to check unneeded includes instead of building.
2166          Use only if you are hacking on it.]),
2169 libo_FUZZ_ARG_WITH(lxml,
2170     AS_HELP_STRING([--without-lxml],
2171         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2172          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2173          report widget classes and ids.]),
2176 dnl ===================================================================
2177 dnl Branding
2178 dnl ===================================================================
2180 AC_ARG_WITH(branding,
2181     AS_HELP_STRING([--with-branding=/path/to/images],
2182         [Use given path to retrieve branding images set.])
2183     [
2184                           Search for intro.png about.svg and flat_logo.svg.
2185                           If any is missing, default ones will be used instead.
2187                           Search also progress.conf for progress
2188                           settings on intro screen :
2190                           PROGRESSBARCOLOR="255,255,255" Set color of
2191                           progress bar. Comma separated RGB decimal values.
2192                           PROGRESSSIZE="407,6" Set size of progress bar.
2193                           Comma separated decimal values (width, height).
2194                           PROGRESSPOSITION="61,317" Set position of progress
2195                           bar from left,top. Comma separated decimal values.
2196                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2197                           bar frame. Comma separated RGB decimal values.
2198                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2199                           bar text. Comma separated RGB decimal values.
2200                           PROGRESSTEXTBASELINE="287" Set vertical position of
2201                           progress bar text from top. Decimal value.
2203                           Default values will be used if not found.
2204     ],
2208 AC_ARG_WITH(extra-buildid,
2209     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2210         [Show addition build identification in about dialog.]),
2214 AC_ARG_WITH(vendor,
2215     AS_HELP_STRING([--with-vendor="John the Builder"],
2216         [Set vendor of the build.]),
2219 AC_ARG_WITH(android-package-name,
2220     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2221         [Set Android package name of the build.]),
2224 AC_ARG_WITH(compat-oowrappers,
2225     AS_HELP_STRING([--with-compat-oowrappers],
2226         [Install oo* wrappers in parallel with
2227          lo* ones to keep backward compatibility.
2228          Has effect only with make distro-pack-install]),
2231 AC_ARG_WITH(os-version,
2232     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2233         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2236 AC_ARG_WITH(mingw-cross-compiler,
2237     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2238         [Specify the MinGW cross-compiler to use.
2239          When building on the ODK on Unix and building unowinreg.dll,
2240          specify the MinGW C++ cross-compiler.]),
2243 AC_ARG_WITH(idlc-cpp,
2244     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2245         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2248 AC_ARG_WITH(build-version,
2249     AS_HELP_STRING([--with-build-version="Built by Jim"],
2250         [Allows the builder to add a custom version tag that will appear in the
2251          Help/About box for QA purposes.]),
2252 with_build_version=$withval,
2255 AC_ARG_WITH(parallelism,
2256     AS_HELP_STRING([--with-parallelism],
2257         [Number of jobs to run simultaneously during build. Parallel builds can
2258         save a lot of time on multi-cpu machines. Defaults to the number of
2259         CPUs on the machine, unless you configure --enable-icecream - then to
2260         40.]),
2263 AC_ARG_WITH(all-tarballs,
2264     AS_HELP_STRING([--with-all-tarballs],
2265         [Download all external tarballs unconditionally]))
2267 AC_ARG_WITH(gdrive-client-id,
2268     AS_HELP_STRING([--with-gdrive-client-id],
2269         [Provides the client id of the application for OAuth2 authentication
2270         on Google Drive. If either this or --with-gdrive-client-secret is
2271         empty, the feature will be disabled]),
2274 AC_ARG_WITH(gdrive-client-secret,
2275     AS_HELP_STRING([--with-gdrive-client-secret],
2276         [Provides the client secret of the application for OAuth2
2277         authentication on Google Drive. If either this or
2278         --with-gdrive-client-id is empty, the feature will be disabled]),
2281 AC_ARG_WITH(alfresco-cloud-client-id,
2282     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2283         [Provides the client id of the application for OAuth2 authentication
2284         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2285         empty, the feature will be disabled]),
2288 AC_ARG_WITH(alfresco-cloud-client-secret,
2289     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2290         [Provides the client secret of the application for OAuth2
2291         authentication on Alfresco Cloud. If either this or
2292         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2295 AC_ARG_WITH(onedrive-client-id,
2296     AS_HELP_STRING([--with-onedrive-client-id],
2297         [Provides the client id of the application for OAuth2 authentication
2298         on OneDrive. If either this or --with-onedrive-client-secret is
2299         empty, the feature will be disabled]),
2302 AC_ARG_WITH(onedrive-client-secret,
2303     AS_HELP_STRING([--with-onedrive-client-secret],
2304         [Provides the client secret of the application for OAuth2
2305         authentication on OneDrive. If either this or
2306         --with-onedrive-client-id is empty, the feature will be disabled]),
2308 dnl ===================================================================
2309 dnl Do we want to use pre-build binary tarball for recompile
2310 dnl ===================================================================
2312 if test "$enable_library_bin_tar" = "yes" ; then
2313     USE_LIBRARY_BIN_TAR=TRUE
2314 else
2315     USE_LIBRARY_BIN_TAR=
2317 AC_SUBST(USE_LIBRARY_BIN_TAR)
2319 dnl ===================================================================
2320 dnl Test whether build target is Release Build
2321 dnl ===================================================================
2322 AC_MSG_CHECKING([whether build target is Release Build])
2323 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2324     AC_MSG_RESULT([no])
2325     ENABLE_RELEASE_BUILD=
2326 else
2327     AC_MSG_RESULT([yes])
2328     ENABLE_RELEASE_BUILD=TRUE
2330 AC_SUBST(ENABLE_RELEASE_BUILD)
2332 dnl ===================================================================
2333 dnl Test whether to sign Windows Build
2334 dnl ===================================================================
2335 AC_MSG_CHECKING([whether to sign windows build])
2336 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2337     AC_MSG_RESULT([yes])
2338     WINDOWS_BUILD_SIGNING="TRUE"
2339 else
2340     AC_MSG_RESULT([no])
2341     WINDOWS_BUILD_SIGNING="FALSE"
2343 AC_SUBST(WINDOWS_BUILD_SIGNING)
2345 dnl ===================================================================
2346 dnl MacOSX build and runtime environment options
2347 dnl ===================================================================
2349 AC_ARG_WITH(macosx-sdk,
2350     AS_HELP_STRING([--with-macosx-sdk=<version>],
2351         [Prefer a specific SDK for building.])
2352     [
2353                           If the requested SDK is not available, a search for the oldest one will be done.
2354                           With current Xcode versions, only the latest SDK is included, so this option is
2355                           not terribly useful. It works fine to build with a new SDK and run the result
2356                           on an older OS.
2358                           e. g.: --with-macosx-sdk=10.10
2360                           there are 3 options to control the MacOSX build:
2361                           --with-macosx-sdk (referred as 'sdk' below)
2362                           --with-macosx-version-min-required (referred as 'min' below)
2363                           --with-macosx-version-max-allowed (referred as 'max' below)
2365                           the connection between these value and the default they take is as follow:
2366                           ( ? means not specified on the command line, s means the SDK version found,
2367                           constraint: 8 <= x <= y <= z)
2369                           ==========================================
2370                            command line      || config result
2371                           ==========================================
2372                           min  | max  | sdk  || min   | max  | sdk  |
2373                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2374                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2375                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2376                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2377                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2378                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2379                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2380                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2383                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2384                           for a detailed technical explanation of these variables
2386                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2387     ],
2390 AC_ARG_WITH(macosx-version-min-required,
2391     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2392         [set the minimum OS version needed to run the built LibreOffice])
2393     [
2394                           e. g.: --with-macos-version-min-required=10.10
2395                           see --with-macosx-sdk for more info
2396     ],
2399 AC_ARG_WITH(macosx-version-max-allowed,
2400     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2401         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2402     [
2403                           e. g.: --with-macos-version-max-allowed=10.10
2404                           see --with-macosx-sdk for more info
2405     ],
2409 dnl ===================================================================
2410 dnl options for stuff used during cross-compilation build
2411 dnl Not quite superseded by --with-build-platform-configure-options.
2412 dnl TODO: check, if the "force" option is still needed anywhere.
2413 dnl ===================================================================
2415 AC_ARG_WITH(system-icu-for-build,
2416     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2417         [Use icu already on system for build tools (cross-compilation only).]))
2420 dnl ===================================================================
2421 dnl Check for incompatible options set by fuzzing, and reset those
2422 dnl automatically to working combinations
2423 dnl ===================================================================
2425 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2426         "$enable_dbus" != "$enable_avahi"; then
2427     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2428     enable_avahi=$enable_dbus
2431 add_lopath_after ()
2433     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2434         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2435     fi
2438 add_lopath_before ()
2440     local IFS=${P_SEP}
2441     local path_cleanup
2442     local dir
2443     for dir in $LO_PATH ; do
2444         if test "$dir" != "$1" ; then
2445             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2446         fi
2447     done
2448     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2451 dnl ===================================================================
2452 dnl check for required programs (grep, awk, sed, bash)
2453 dnl ===================================================================
2455 pathmunge ()
2457     if test -n "$1"; then
2458         if test "$build_os" = "cygwin"; then
2459             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2460                 PathFormat "$1"
2461                 new_path=`cygpath -sm "$formatted_path"`
2462             else
2463                 PathFormat "$1"
2464                 new_path=`cygpath -u "$formatted_path"`
2465             fi
2466         else
2467             new_path="$1"
2468         fi
2469         if test "$2" = "after"; then
2470             add_lopath_after "$new_path"
2471         else
2472             add_lopath_before "$new_path"
2473         fi
2474         unset new_path
2475     fi
2478 AC_PROG_AWK
2479 AC_PATH_PROG( AWK, $AWK)
2480 if test -z "$AWK"; then
2481     AC_MSG_ERROR([install awk to run this script])
2484 AC_PATH_PROG(BASH, bash)
2485 if test -z "$BASH"; then
2486     AC_MSG_ERROR([bash not found in \$PATH])
2488 AC_SUBST(BASH)
2490 AC_MSG_CHECKING([for GNU or BSD tar])
2491 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2492     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2493     if test $? -eq 0;  then
2494         GNUTAR=$a
2495         break
2496     fi
2497 done
2498 AC_MSG_RESULT($GNUTAR)
2499 if test -z "$GNUTAR"; then
2500     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2502 AC_SUBST(GNUTAR)
2504 AC_MSG_CHECKING([for tar's option to strip components])
2505 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2506 if test $? -eq 0; then
2507     STRIP_COMPONENTS="--strip-components"
2508 else
2509     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2510     if test $? -eq 0; then
2511         STRIP_COMPONENTS="--strip-path"
2512     else
2513         STRIP_COMPONENTS="unsupported"
2514     fi
2516 AC_MSG_RESULT($STRIP_COMPONENTS)
2517 if test x$STRIP_COMPONENTS = xunsupported; then
2518     AC_MSG_ERROR([you need a tar that is able to strip components.])
2520 AC_SUBST(STRIP_COMPONENTS)
2522 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2523 dnl desktop OSes from "mobile" ones.
2525 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2526 dnl In other words, that when building for an OS that is not a
2527 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2529 dnl Note the direction of the implication; there is no assumption that
2530 dnl cross-compiling would imply a non-desktop OS.
2532 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2533     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2534     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2535     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2538 # Whether to build "avmedia" functionality or not.
2540 if test -z "$enable_avmedia"; then
2541     enable_avmedia=yes
2544 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2545 if test "$enable_avmedia" = yes; then
2546     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2547 else
2548     USE_AVMEDIA_DUMMY='TRUE'
2550 AC_SUBST(USE_AVMEDIA_DUMMY)
2552 # Decide whether to build database connectivity stuff (including
2553 # Base) or not. We probably don't want to on non-desktop OSes.
2554 if test -z "$enable_database_connectivity"; then
2555     # --disable-database-connectivity is unfinished work in progress
2556     # and the iOS test app doesn't link if we actually try to use it.
2557     # if test $_os != iOS -a $_os != Android; then
2558     if test $_os != iOS; then
2559         enable_database_connectivity=yes
2560     fi
2563 if test "$enable_database_connectivity" = yes; then
2564     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2565     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2568 if test -z "$enable_extensions"; then
2569     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2570     if test $_os != iOS -a $_os != Android; then
2571         enable_extensions=yes
2572     fi
2575 if test "$enable_extensions" = yes; then
2576     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2577     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2580 if test -z "$enable_scripting"; then
2581     # Disable scripting for iOS unless specifically overridden
2582     # with --enable-scripting.
2583     if test $_os != iOS; then
2584         enable_scripting=yes
2585     fi
2588 DISABLE_SCRIPTING=''
2589 if test "$enable_scripting" = yes; then
2590     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2591     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2592 else
2593     DISABLE_SCRIPTING='TRUE'
2594     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2597 if test $_os = iOS -o $_os = Android; then
2598     # Disable dynamic_loading always for iOS and Android
2599     enable_dynamic_loading=no
2600 elif test -z "$enable_dynamic_loading"; then
2601     # Otherwise enable it unless specifically disabled
2602     enable_dynamic_loading=yes
2605 DISABLE_DYNLOADING=''
2606 if test "$enable_dynamic_loading" = yes; then
2607     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2608 else
2609     DISABLE_DYNLOADING='TRUE'
2611 AC_SUBST(DISABLE_DYNLOADING)
2613 # remember SYSBASE value
2614 AC_SUBST(SYSBASE)
2616 dnl ===================================================================
2617 dnl  Sort out various gallery compilation options
2618 dnl ===================================================================
2619 AC_MSG_CHECKING([how to build and package galleries])
2620 if test -n "${with_galleries}"; then
2621     if test "$with_galleries" = "build"; then
2622         WITH_GALLERY_BUILD=TRUE
2623         AC_MSG_RESULT([build from source images internally])
2624     elif test "$with_galleries" = "no"; then
2625         WITH_GALLERY_BUILD=
2626         AC_MSG_RESULT([disable non-internal gallery build])
2627     else
2628         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2629     fi
2630 else
2631     if test $_os != iOS -a $_os != Android; then
2632         WITH_GALLERY_BUILD=TRUE
2633         AC_MSG_RESULT([internal src images for desktop])
2634     else
2635         WITH_GALLERY_BUILD=
2636         AC_MSG_RESULT([disable src image build])
2637     fi
2639 AC_SUBST(WITH_GALLERY_BUILD)
2641 dnl ===================================================================
2642 dnl  Checks if ccache is available
2643 dnl ===================================================================
2644 CCACHE_DEPEND_MODE=
2645 if test "$_os" = "WINNT"; then
2646     # on windows/VC build do not use ccache
2647     CCACHE=""
2648 elif test "$enable_ccache" = "no"; then
2649     CCACHE=""
2650 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2651     case "%$CC%$CXX%" in
2652     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2653     # assume that's good then
2654     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2655         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2656         CCACHE_DEPEND_MODE=1
2657         ;;
2658     *)
2659         AC_PATH_PROG([CCACHE],[ccache],[not found])
2660         if test "$CCACHE" = "not found"; then
2661             CCACHE=""
2662         else
2663             CCACHE_DEPEND_MODE=1
2664             # Need to check for ccache version: otherwise prevents
2665             # caching of the results (like "-x objective-c++" for Mac)
2666             if test $_os = Darwin -o $_os = iOS; then
2667                 # Check ccache version
2668                 AC_MSG_CHECKING([whether version of ccache is suitable])
2669                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2670                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2671                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2672                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2673                 else
2674                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2675                     CCACHE=""
2676                     CCACHE_DEPEND_MODE=
2677                 fi
2678             fi
2679         fi
2680         ;;
2681     esac
2682 else
2683     CCACHE=""
2685 if test "$enable_ccache" = "nodepend"; then
2686     CCACHE_DEPEND_MODE=""
2688 AC_SUBST(CCACHE_DEPEND_MODE)
2690 if test "$CCACHE" != ""; then
2691     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2692     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2693     if test "$ccache_size" = ""; then
2694         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2695         if test "$ccache_size" = ""; then
2696             ccache_size=0
2697         fi
2698         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2699         if test $ccache_size -lt 1024; then
2700             CCACHE=""
2701             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2702             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2703         else
2704             # warn that ccache may be too small for debug build
2705             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2706             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2707         fi
2708     else
2709         if test $ccache_size -lt 5; then
2710             #warn that ccache may be too small for debug build
2711             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2712             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2713         fi
2714     fi
2717 dnl ===================================================================
2718 dnl  Checks for C compiler,
2719 dnl  The check for the C++ compiler is later on.
2720 dnl ===================================================================
2721 if test "$_os" != "WINNT"; then
2722     GCC_HOME_SET="true"
2723     AC_MSG_CHECKING([gcc home])
2724     if test -z "$with_gcc_home"; then
2725         if test "$enable_icecream" = "yes"; then
2726             if test -d "/usr/lib/icecc/bin"; then
2727                 GCC_HOME="/usr/lib/icecc/"
2728             elif test -d "/usr/libexec/icecc/bin"; then
2729                 GCC_HOME="/usr/libexec/icecc/"
2730             elif test -d "/opt/icecream/bin"; then
2731                 GCC_HOME="/opt/icecream/"
2732             else
2733                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2735             fi
2736         else
2737             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2738             GCC_HOME_SET="false"
2739         fi
2740     else
2741         GCC_HOME="$with_gcc_home"
2742     fi
2743     AC_MSG_RESULT($GCC_HOME)
2744     AC_SUBST(GCC_HOME)
2746     if test "$GCC_HOME_SET" = "true"; then
2747         if test -z "$CC"; then
2748             CC="$GCC_HOME/bin/gcc"
2749             CC_BASE="gcc"
2750         fi
2751         if test -z "$CXX"; then
2752             CXX="$GCC_HOME/bin/g++"
2753             CXX_BASE="g++"
2754         fi
2755     fi
2758 COMPATH=`dirname "$CC"`
2759 if test "$COMPATH" = "."; then
2760     AC_PATH_PROGS(COMPATH, $CC)
2761     dnl double square bracket to get single because of M4 quote...
2762     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2764 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2766 dnl ===================================================================
2767 dnl Java support
2768 dnl ===================================================================
2769 AC_MSG_CHECKING([whether to build with Java support])
2770 if test "$with_java" != "no"; then
2771     if test "$DISABLE_SCRIPTING" = TRUE; then
2772         AC_MSG_RESULT([no, overridden by --disable-scripting])
2773         ENABLE_JAVA=""
2774         with_java=no
2775     else
2776         AC_MSG_RESULT([yes])
2777         ENABLE_JAVA="TRUE"
2778         AC_DEFINE(HAVE_FEATURE_JAVA)
2779     fi
2780 else
2781     AC_MSG_RESULT([no])
2782     ENABLE_JAVA=""
2785 AC_SUBST(ENABLE_JAVA)
2787 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2789 dnl ENABLE_JAVA="" indicate no Java support at all
2791 dnl ===================================================================
2792 dnl Check macOS SDK and compiler
2793 dnl ===================================================================
2795 if test $_os = Darwin; then
2797     # If no --with-macosx-sdk option is given, look for one
2799     # The intent is that for "most" Mac-based developers, a suitable
2800     # SDK will be found automatically without any configure options.
2802     # For developers with a current Xcode, the lowest-numbered SDK
2803     # higher than or equal to the minimum required should be found.
2805     AC_MSG_CHECKING([what macOS SDK to use])
2806     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2807         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2808         if test -d "$MACOSX_SDK_PATH"; then
2809             with_macosx_sdk="${_macosx_sdk}"
2810             break
2811         else
2812             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2813             if test -d "$MACOSX_SDK_PATH"; then
2814                 with_macosx_sdk="${_macosx_sdk}"
2815                 break
2816             fi
2817         fi
2818     done
2819     if test ! -d "$MACOSX_SDK_PATH"; then
2820         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2821     fi
2823     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2825     case $with_macosx_sdk in
2826     10.12)
2827         MACOSX_SDK_VERSION=101200
2828         ;;
2829     10.13)
2830         MACOSX_SDK_VERSION=101300
2831         ;;
2832     10.14)
2833         MACOSX_SDK_VERSION=101400
2834         ;;
2835     10.15)
2836         MACOSX_SDK_VERSION=101500
2837         ;;
2838     *)
2839         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2840         ;;
2841     esac
2843     if test "$with_macosx_version_min_required" = "" ; then
2844         with_macosx_version_min_required="10.10";
2845     fi
2847     if test "$with_macosx_version_max_allowed" = "" ; then
2848         with_macosx_version_max_allowed="$with_macosx_sdk"
2849     fi
2851     # export this so that "xcrun" invocations later return matching values
2852     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2853     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2854     export DEVELOPER_DIR
2855     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2856     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2858     AC_MSG_CHECKING([whether Xcode is new enough])
2859     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2860     my_xcode_ver2=${my_xcode_ver1#Xcode }
2861     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2862     if test "$my_xcode_ver3" -ge 903; then
2863         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2864     else
2865         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2866     fi
2868     case "$with_macosx_version_min_required" in
2869     10.10)
2870         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2871         ;;
2872     10.11)
2873         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2874         ;;
2875     10.12)
2876         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2877         ;;
2878     10.13)
2879         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2880         ;;
2881     10.14)
2882         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2883         ;;
2884     10.15)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2886         ;;
2887     *)
2888         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2889         ;;
2890     esac
2891     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2893     LIBTOOL=/usr/bin/libtool
2894     INSTALL_NAME_TOOL=install_name_tool
2895     if test -z "$save_CC"; then
2896         stdlib=-stdlib=libc++
2897         if test "$ENABLE_LTO" = TRUE; then
2898             lto=-flto
2899         fi
2901         AC_MSG_CHECKING([what C compiler to use])
2902         CC="`xcrun -find clang`"
2903         CC_BASE=`first_arg_basename "$CC"`
2904         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2905         AC_MSG_RESULT([$CC])
2907         AC_MSG_CHECKING([what C++ compiler to use])
2908         CXX="`xcrun -find clang++`"
2909         CXX_BASE=`first_arg_basename "$CXX"`
2910         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2911         AC_MSG_RESULT([$CXX])
2913         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2914         AR=`xcrun -find ar`
2915         NM=`xcrun -find nm`
2916         STRIP=`xcrun -find strip`
2917         LIBTOOL=`xcrun -find libtool`
2918         RANLIB=`xcrun -find ranlib`
2919     fi
2921     case "$with_macosx_version_max_allowed" in
2922     10.10)
2923         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2924         ;;
2925     10.11)
2926         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2927         ;;
2928     10.12)
2929         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2930         ;;
2931     10.13)
2932         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2933         ;;
2934     10.14)
2935         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2936         ;;
2937     10.15)
2938         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2939         ;;
2940     *)
2941         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2942         ;;
2943     esac
2945     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2946     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2947         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])
2948     else
2949         AC_MSG_RESULT([ok])
2950     fi
2952     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2953     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2954         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2955     else
2956         AC_MSG_RESULT([ok])
2957     fi
2958     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2959     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2961     AC_MSG_CHECKING([whether to do code signing])
2963     if test "$enable_macosx_code_signing" = yes; then
2964         # By default use the first suitable certificate (?).
2966         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2967         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2968         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2969         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2970         # "Developer ID Application" one.
2972         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2973         if test -n "$identity"; then
2974             MACOSX_CODESIGNING_IDENTITY=$identity
2975             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2976             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2977         else
2978             AC_MSG_ERROR([cannot determine identity to use])
2979         fi
2980     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2981         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2982         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2983         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2984     else
2985         AC_MSG_RESULT([no])
2986     fi
2988     AC_MSG_CHECKING([whether to create a Mac App Store package])
2990     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2991         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2992     elif test "$enable_macosx_package_signing" = yes; then
2993         # By default use the first suitable certificate.
2994         # It should be a "3rd Party Mac Developer Installer" one
2996         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2997         if test -n "$identity"; then
2998             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2999             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3000             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3001         else
3002             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3003         fi
3004     elif test -n "$enable_macosx_package_signing"; then
3005         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3006         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3007         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3008     else
3009         AC_MSG_RESULT([no])
3010     fi
3012     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3013         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3014     fi
3016     AC_MSG_CHECKING([whether to sandbox the application])
3018     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3019         AC_MSG_ERROR([macOS sandboxing requires code signing])
3020     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3021         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3022     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3023         ENABLE_MACOSX_SANDBOX=TRUE
3024         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3025         AC_MSG_RESULT([yes])
3026     else
3027         AC_MSG_RESULT([no])
3028     fi
3030     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3031     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3032     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3034 AC_SUBST(MACOSX_SDK_PATH)
3035 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3036 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3037 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3038 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3039 AC_SUBST(INSTALL_NAME_TOOL)
3040 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3041 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3042 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3043 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3044 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3046 dnl ===================================================================
3047 dnl Check iOS SDK and compiler
3048 dnl ===================================================================
3050 if test $_os = iOS; then
3051     AC_MSG_CHECKING([what iOS SDK to use])
3052     current_sdk_ver=13.2
3053     older_sdk_vers="13.1 13.0 12.4 12.2"
3054     if test "$enable_ios_simulator" = "yes"; then
3055         platform=iPhoneSimulator
3056         versionmin=-mios-simulator-version-min=12.2
3057     else
3058         platform=iPhoneOS
3059         versionmin=-miphoneos-version-min=12.2
3060     fi
3061     xcode_developer=`xcode-select -print-path`
3063     for sdkver in $current_sdk_ver $older_sdk_vers; do
3064         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3065         if test -d $t; then
3066             sysroot=$t
3067             break
3068         fi
3069     done
3071     if test -z "$sysroot"; then
3072         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3073     fi
3075     AC_MSG_RESULT($sysroot)
3077     # LTO is not really recommended for iOS builds,
3078     # the link time will be astronomical
3079     if test "$ENABLE_LTO" = TRUE; then
3080         lto=-flto
3081     fi
3083     stdlib="-stdlib=libc++"
3085     AC_MSG_CHECKING([what C compiler to use])
3086     CC="`xcrun -find clang`"
3087     CC_BASE=`first_arg_basename "$CC"`
3088     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3089     AC_MSG_RESULT([$CC])
3091     AC_MSG_CHECKING([what C++ compiler to use])
3092     CXX="`xcrun -find clang++`"
3093     CXX_BASE=`first_arg_basename "$CXX"`
3094     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3095     AC_MSG_RESULT([$CXX])
3097     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3098     AR=`xcrun -find ar`
3099     NM=`xcrun -find nm`
3100     STRIP=`xcrun -find strip`
3101     LIBTOOL=`xcrun -find libtool`
3102     RANLIB=`xcrun -find ranlib`
3105 AC_MSG_CHECKING([whether to treat the installation as read-only])
3107 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3108         "$enable_extensions" != yes; then
3109     enable_readonly_installset=yes
3111 if test "$enable_readonly_installset" = yes; then
3112     AC_MSG_RESULT([yes])
3113     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3114 else
3115     AC_MSG_RESULT([no])
3118 dnl ===================================================================
3119 dnl Structure of install set
3120 dnl ===================================================================
3122 if test $_os = Darwin; then
3123     LIBO_BIN_FOLDER=MacOS
3124     LIBO_ETC_FOLDER=Resources
3125     LIBO_LIBEXEC_FOLDER=MacOS
3126     LIBO_LIB_FOLDER=Frameworks
3127     LIBO_LIB_PYUNO_FOLDER=Resources
3128     LIBO_SHARE_FOLDER=Resources
3129     LIBO_SHARE_HELP_FOLDER=Resources/help
3130     LIBO_SHARE_JAVA_FOLDER=Resources/java
3131     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3132     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3133     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3134     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3135     LIBO_URE_BIN_FOLDER=MacOS
3136     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3137     LIBO_URE_LIB_FOLDER=Frameworks
3138     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3139     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3140 elif test $_os = WINNT; then
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     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3152     LIBO_SHARE_SHELL_FOLDER=program/shell
3153     LIBO_URE_BIN_FOLDER=program
3154     LIBO_URE_ETC_FOLDER=program
3155     LIBO_URE_LIB_FOLDER=program
3156     LIBO_URE_MISC_FOLDER=program
3157     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3158 else
3159     LIBO_BIN_FOLDER=program
3160     LIBO_ETC_FOLDER=program
3161     LIBO_LIBEXEC_FOLDER=program
3162     LIBO_LIB_FOLDER=program
3163     LIBO_LIB_PYUNO_FOLDER=program
3164     LIBO_SHARE_FOLDER=share
3165     LIBO_SHARE_HELP_FOLDER=help
3166     LIBO_SHARE_JAVA_FOLDER=program/classes
3167     LIBO_SHARE_PRESETS_FOLDER=presets
3168     LIBO_SHARE_READMES_FOLDER=readmes
3169     if test "$enable_fuzzers" != yes; then
3170         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3171     else
3172         LIBO_SHARE_RESOURCE_FOLDER=resource
3173     fi
3174     LIBO_SHARE_SHELL_FOLDER=program/shell
3175     LIBO_URE_BIN_FOLDER=program
3176     LIBO_URE_ETC_FOLDER=program
3177     LIBO_URE_LIB_FOLDER=program
3178     LIBO_URE_MISC_FOLDER=program
3179     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3181 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3182 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3183 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3184 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3185 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3186 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3187 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3188 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3189 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3190 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3191 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3192 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3193 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3194 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3198 # Not all of them needed in config_host.mk, add more if need arises
3199 AC_SUBST(LIBO_BIN_FOLDER)
3200 AC_SUBST(LIBO_ETC_FOLDER)
3201 AC_SUBST(LIBO_LIB_FOLDER)
3202 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3203 AC_SUBST(LIBO_SHARE_FOLDER)
3204 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3205 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3206 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3207 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3208 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3209 AC_SUBST(LIBO_URE_BIN_FOLDER)
3210 AC_SUBST(LIBO_URE_ETC_FOLDER)
3211 AC_SUBST(LIBO_URE_LIB_FOLDER)
3212 AC_SUBST(LIBO_URE_MISC_FOLDER)
3213 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3215 dnl ===================================================================
3216 dnl Windows specific tests and stuff
3217 dnl ===================================================================
3219 reg_get_value()
3221     # Return value: $regvalue
3222     unset regvalue
3224     local _regentry="/proc/registry${1}/${2}"
3225     if test -f "$_regentry"; then
3226         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3227         # Registry keys read via /proc/registry* are always \0 terminated!
3228         local _regvalue=$(tr -d '\0' < "$_regentry")
3229         if test $? -eq 0; then
3230             regvalue=$_regvalue
3231         fi
3232     fi
3235 # Get a value from the 32-bit side of the Registry
3236 reg_get_value_32()
3238     reg_get_value "32" "$1"
3241 # Get a value from the 64-bit side of the Registry
3242 reg_get_value_64()
3244     reg_get_value "64" "$1"
3247 if test "$_os" = "WINNT"; then
3248     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3249     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3250         AC_MSG_RESULT([no])
3251         WINDOWS_SDK_ARCH="x86"
3252     else
3253         AC_MSG_RESULT([yes])
3254         WINDOWS_SDK_ARCH="x64"
3255         BITNESS_OVERRIDE=64
3256     fi
3258 if test "$_os" = "iOS"; then
3259     cross_compiling="yes"
3262 if test "$cross_compiling" = "yes"; then
3263     export CROSS_COMPILING=TRUE
3264 else
3265     CROSS_COMPILING=
3266     BUILD_TYPE="$BUILD_TYPE NATIVE"
3268 AC_SUBST(CROSS_COMPILING)
3270 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3271 # NOTE: must _not_ be used for bundled external libraries!
3272 ISYSTEM=
3273 if test "$GCC" = "yes"; then
3274     AC_MSG_CHECKING( for -isystem )
3275     save_CFLAGS=$CFLAGS
3276     CFLAGS="$CFLAGS -Werror"
3277     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3278     CFLAGS=$save_CFLAGS
3279     if test -n "$ISYSTEM"; then
3280         AC_MSG_RESULT(yes)
3281     else
3282         AC_MSG_RESULT(no)
3283     fi
3285 if test -z "$ISYSTEM"; then
3286     # fall back to using -I
3287     ISYSTEM=-I
3289 AC_SUBST(ISYSTEM)
3291 dnl ===================================================================
3292 dnl  Check which Visual Studio compiler is used
3293 dnl ===================================================================
3295 map_vs_year_to_version()
3297     # Return value: $vsversion
3299     unset vsversion
3301     case $1 in
3302     2017)
3303         vsversion=15;;
3304     2019)
3305         vsversion=16;;
3306     *)
3307         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3308     esac
3311 vs_versions_to_check()
3313     # Args: $1 (optional) : versions to check, in the order of preference
3314     # Return value: $vsversions
3316     unset vsversions
3318     if test -n "$1"; then
3319         map_vs_year_to_version "$1"
3320         vsversions=$vsversion
3321     else
3322         # We accept only 2017
3323         vsversions="15"
3324     fi
3327 win_get_env_from_vsvars32bat()
3329     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3330     # Also seems to be located in another directory under the same name: vsvars32.bat
3331     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3332     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3333     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3334     chmod +x $WRAPPERBATCHFILEPATH
3335     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3336     rm -f $WRAPPERBATCHFILEPATH
3337     printf '%s' "$_win_get_env_from_vsvars32bat"
3340 find_ucrt()
3342     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3343     if test -n "$regvalue"; then
3344         PathFormat "$regvalue"
3345         UCRTSDKDIR=$formatted_path
3346         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3347         UCRTVERSION=$regvalue
3348         # Rest if not exist
3349         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3350           UCRTSDKDIR=
3351         fi
3352     fi
3353     if test -z "$UCRTSDKDIR"; then
3354         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3355         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3356         if test -f "$ide_env_file"; then
3357             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3358             UCRTSDKDIR=$formatted_path
3359             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3360             dnl Hack needed at least by tml:
3361             if test "$UCRTVERSION" = 10.0.15063.0 \
3362                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3363                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3364             then
3365                 UCRTVERSION=10.0.14393.0
3366             fi
3367         else
3368           AC_MSG_ERROR([No UCRT found])
3369         fi
3370     fi
3373 find_msvc()
3375     # Find Visual C++ 2017/2019
3376     # Args: $1 (optional) : The VS version year
3377     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3379     unset vctest vcnum vcnumwithdot vcbuildnumber
3381     vs_versions_to_check "$1"
3382     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3383     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3384     PathFormat "$vswhere"
3385     vswhere=$formatted_path
3386     for ver in $vsversions; do
3387         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3388         if test -n "$vswhereoutput"; then
3389             PathFormat "$vswhereoutput"
3390             vctest=$formatted_path
3391             break
3392         fi
3393     done
3395     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3396     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3397     # should be removed when upgrading baseline.
3398     if ! test -n "$vctest"; then
3399         for ver in $vsversions; do
3400             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3401             if test -n "$regvalue"; then
3402                 vctest=$regvalue
3403                 break
3404             fi
3405             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3406             if test -n "$regvalue"; then
3407                 AC_MSG_RESULT([found: $regvalue])
3408                 PathFormat "$regvalue"
3409                 vctest=$formatted_path
3410                 break
3411             fi
3412         done
3413     fi
3415     if test -n "$vctest"; then
3416         vcnumwithdot="$ver.0"
3417         case "$vcnumwithdot" in
3418         15.0)
3419             vcyear=2017
3420             vcnum=150
3421             ;;
3422         16.0)
3423             vcyear=2019
3424             vcnum=160
3425             ;;
3426         esac
3427         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3429     fi
3432 SOLARINC=
3433 MSBUILD_PATH=
3434 DEVENV=
3435 if test "$_os" = "WINNT"; then
3436     AC_MSG_CHECKING([Visual C++])
3437     find_msvc "$with_visual_studio"
3438     if test -z "$vctest"; then
3439         if test -n "$with_visual_studio"; then
3440             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3441         else
3442             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3443         fi
3444     fi
3446     if test "$BITNESS_OVERRIDE" = ""; then
3447         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3448             VC_PRODUCT_DIR=$vctest/VC
3449         else
3450             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3451         fi
3452     else
3453         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3454             VC_PRODUCT_DIR=$vctest/VC
3455         else
3456             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3457         fi
3458     fi
3459     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3461     AC_MSG_CHECKING([for short pathname of VC product directory])
3462     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3463     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3465     UCRTSDKDIR=
3466     UCRTVERSION=
3468     AC_MSG_CHECKING([for UCRT location])
3469     find_ucrt
3470     # find_ucrt errors out if it doesn't find it
3471     AC_MSG_RESULT([found])
3472     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3473     ucrtincpath_formatted=$formatted_path
3474     # SOLARINC is used for external modules and must be set too.
3475     # And no, it's not sufficient to set SOLARINC only, as configure
3476     # itself doesn't honour it.
3477     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3478     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3479     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3480     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3482     AC_SUBST(UCRTSDKDIR)
3483     AC_SUBST(UCRTVERSION)
3485     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3486     # Find the proper version of MSBuild.exe to use based on the VS version
3487     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3488     if test -n "$regvalue" ; then
3489         AC_MSG_RESULT([found: $regvalue])
3490         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3491     else
3492         if test "$vcnumwithdot" = "16.0"; then
3493             if test "$BITNESS_OVERRIDE" = ""; then
3494                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3495             else
3496                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3497             fi
3498         else
3499             if test "$BITNESS_OVERRIDE" = ""; then
3500                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3501             else
3502                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3503             fi
3504         fi
3505         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3506         AC_MSG_RESULT([$regvalue])
3507     fi
3509     # Find the version of devenv.exe
3510     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3511     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3512     if test ! -e "$DEVENV"; then
3513         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3514     fi
3516     dnl ===========================================================
3517     dnl  Check for the corresponding mspdb*.dll
3518     dnl ===========================================================
3520     VC_HOST_DIR=
3521     MSPDB_PATH=
3522     CL_PATH=
3524     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3525         VC_HOST_DIR="HostX64"
3526         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3527     else
3528         VC_HOST_DIR="HostX86"
3529         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3530     fi
3532     if test "$BITNESS_OVERRIDE" = ""; then
3533         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3534     else
3535         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3536     fi
3538     # MSVC 15.0 has libraries from 14.0?
3539     mspdbnum="140"
3541     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3542         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3543     fi
3545     dnl The path needs to be added before cl is called
3546     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3547     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3549     AC_MSG_CHECKING([cl.exe])
3551     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3552     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3553     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3554     # is not enough?
3556     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3557     dnl needed when building CLR code:
3558     if test -z "$MSVC_CXX"; then
3559         if test -f "$CL_PATH/cl.exe"; then
3560             MSVC_CXX="$CL_PATH/cl.exe"
3561         fi
3563         # This gives us a posix path with 8.3 filename restrictions
3564         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3565     fi
3567     if test -z "$CC"; then
3568         CC=$MSVC_CXX
3569         CC_BASE=`first_arg_basename "$CC"`
3570     fi
3571     if test "$BITNESS_OVERRIDE" = ""; then
3572         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3573         MSVC_CXX="$MSVC_CXX -arch:SSE"
3574     fi
3575     if test -z "$CXX"; then
3576         CXX=$MSVC_CXX
3577         CXX_BASE=`first_arg_basename "$CXX"`
3578     fi
3580     if test -n "$CC"; then
3581         # Remove /cl.exe from CC case insensitive
3582         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3583         if test "$BITNESS_OVERRIDE" = ""; then
3584            COMPATH="$VC_PRODUCT_DIR"
3585         else
3586             if test -n "$VC_PRODUCT_DIR"; then
3587                 COMPATH=$VC_PRODUCT_DIR
3588             fi
3589         fi
3590         if test "$BITNESS_OVERRIDE" = ""; then
3591             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3592             CC="$CC -arch:SSE"
3593         fi
3595         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3597         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3599         PathFormat "$COMPATH"
3600         COMPATH=`win_short_path_for_make "$formatted_path"`
3602         VCVER=$vcnum
3603         MSVSVER=$vcyear
3605         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3606         # are always "better", we list them in reverse chronological order.
3608         case "$vcnum" in
3609         150|160)
3610             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3611             ;;
3612         esac
3614         # The expectation is that --with-windows-sdk should not need to be used
3615         if test -n "$with_windows_sdk"; then
3616             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3617             *" "$with_windows_sdk" "*)
3618                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3619                 ;;
3620             *)
3621                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3622                 ;;
3623             esac
3624         fi
3626         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3627         ac_objext=obj
3628         ac_exeext=exe
3630     else
3631         AC_MSG_ERROR([Visual C++ not found after all, huh])
3632     fi
3634     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3635     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3636         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3637         // between Visual Studio versions and _MSC_VER:
3638         #if _MSC_VER < 1914
3639         #error
3640         #endif
3641     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3643     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3644     # version of the Explorer extension (and maybe other small
3645     # bits, too) needed when installing a 32-bit LibreOffice on a
3646     # 64-bit OS. The 64-bit Explorer extension is a feature that
3647     # has been present since long in OOo. Don't confuse it with
3648     # building LibreOffice itself as 64-bit code.
3650     BUILD_X64=
3651     CXX_X64_BINARY=
3653     if test "$BITNESS_OVERRIDE" = ""; then
3654         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3655         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3656              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3657             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3658                 BUILD_X64=TRUE
3659                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3660             fi
3661         fi
3662         if test "$BUILD_X64" = TRUE; then
3663             AC_MSG_RESULT([found])
3664         else
3665             AC_MSG_RESULT([not found])
3666             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3667         fi
3668     else
3669         CXX_X64_BINARY=$CXX
3670     fi
3671     AC_SUBST(BUILD_X64)
3673     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3674     AC_SUBST(CXX_X64_BINARY)
3676     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3677     # needed to support TWAIN scan on both 32- and 64-bit systems
3679     BUILD_X86=
3681     if test "$BITNESS_OVERRIDE" = "64"; then
3682         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3683         if test -n "$CXX_X86_BINARY"; then
3684             BUILD_X86=TRUE
3685             AC_MSG_RESULT([preset])
3686         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3687             BUILD_X86=TRUE
3688             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3689             CXX_X86_BINARY+=" /arch:SSE"
3690             AC_MSG_RESULT([found])
3691         else
3692             CXX_X86_BINARY=
3693             AC_MSG_RESULT([not found])
3694             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3695         fi
3696     else
3697         BUILD_X86=TRUE
3698         CXX_X86_BINARY=$MSVC_CXX
3699     fi
3700     AC_SUBST(BUILD_X86)
3701     AC_SUBST(CXX_X86_BINARY)
3703 AC_SUBST(VCVER)
3704 AC_SUBST(DEVENV)
3705 AC_SUBST(MSVC_CXX)
3708 # unowinreg.dll
3710 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3711 AC_SUBST(UNOWINREG_DLL)
3713 COM_IS_CLANG=
3714 AC_MSG_CHECKING([whether the compiler is actually Clang])
3715 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3716     #ifndef __clang__
3717     you lose
3718     #endif
3719     int foo=42;
3720     ]])],
3721     [AC_MSG_RESULT([yes])
3722      COM_IS_CLANG=TRUE],
3723     [AC_MSG_RESULT([no])])
3724 AC_SUBST(COM_IS_CLANG)
3726 CC_PLAIN=$CC
3727 CLANGVER=
3728 if test "$COM_IS_CLANG" = TRUE; then
3729     AC_MSG_CHECKING([whether Clang is new enough])
3730     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3731         #if !defined __apple_build_version__
3732         #error
3733         #endif
3734         ]])],
3735         [my_apple_clang=yes],[my_apple_clang=])
3736     if test "$my_apple_clang" = yes; then
3737         AC_MSG_RESULT([assumed yes (Apple Clang)])
3738     else
3739         if test "$_os" = WINNT; then
3740             dnl In which case, assume clang-cl:
3741             my_args="/EP /TC"
3742             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3743             dnl clang-cl:
3744             CC_PLAIN=
3745             for i in $CC; do
3746                 case $i in
3747                 -FIIntrin.h)
3748                     ;;
3749                 *)
3750                     CC_PLAIN="$CC_PLAIN $i"
3751                     ;;
3752                 esac
3753             done
3754         else
3755             my_args="-E -P"
3756         fi
3757         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3758         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3759         CLANGVER=`echo $clang_version \
3760             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3761         if test "$CLANGVER" -ge 50002; then
3762             AC_MSG_RESULT([yes ($clang_version)])
3763         else
3764             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3765         fi
3766         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3767         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3768     fi
3771 SHOWINCLUDES_PREFIX=
3772 if test "$_os" = WINNT; then
3773     dnl We need to guess the prefix of the -showIncludes output, it can be
3774     dnl localized
3775     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3776     echo "#include <stdlib.h>" > conftest.c
3777     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3778         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3779     rm -f conftest.c conftest.obj
3780     if test -z "$SHOWINCLUDES_PREFIX"; then
3781         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3782     else
3783         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3784     fi
3786 AC_SUBST(SHOWINCLUDES_PREFIX)
3789 # prefix C with ccache if needed
3791 if test "$CCACHE" != ""; then
3792     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3794     AC_LANG_PUSH([C])
3795     save_CFLAGS=$CFLAGS
3796     CFLAGS="$CFLAGS --ccache-skip -O2"
3797     dnl an empty program will do, we're checking the compiler flags
3798     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3799                       [use_ccache=yes], [use_ccache=no])
3800     if test $use_ccache = yes; then
3801         AC_MSG_RESULT([yes])
3802     else
3803         CC="$CCACHE $CC"
3804         CC_BASE="ccache $CC_BASE"
3805         AC_MSG_RESULT([no])
3806     fi
3807     CFLAGS=$save_CFLAGS
3808     AC_LANG_POP([C])
3811 # ===================================================================
3812 # check various GCC options that Clang does not support now but maybe
3813 # will somewhen in the future, check them even for GCC, so that the
3814 # flags are set
3815 # ===================================================================
3817 HAVE_GCC_GGDB2=
3818 if test "$GCC" = "yes"; then
3819     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3820     save_CFLAGS=$CFLAGS
3821     CFLAGS="$CFLAGS -Werror -ggdb2"
3822     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3823     CFLAGS=$save_CFLAGS
3824     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3825         AC_MSG_RESULT([yes])
3826     else
3827         AC_MSG_RESULT([no])
3828     fi
3830     if test "$host_cpu" = "m68k"; then
3831         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3832         save_CFLAGS=$CFLAGS
3833         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3834         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3835         CFLAGS=$save_CFLAGS
3836         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3837             AC_MSG_RESULT([yes])
3838         else
3839             AC_MSG_ERROR([no])
3840         fi
3841     fi
3843 AC_SUBST(HAVE_GCC_GGDB2)
3845 dnl ===================================================================
3846 dnl  Test the gcc version
3847 dnl ===================================================================
3848 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3849     AC_MSG_CHECKING([the GCC version])
3850     _gcc_version=`$CC -dumpversion`
3851     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3852         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3853     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3855     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3857     if test "$gcc_full_version" -lt 70000; then
3858         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3859     fi
3860 else
3861     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3862     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3863     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3864     # (which reports itself as GCC 4.2.1).
3865     GCC_VERSION=
3867 AC_SUBST(GCC_VERSION)
3869 dnl Set the ENABLE_DBGUTIL variable
3870 dnl ===================================================================
3871 AC_MSG_CHECKING([whether to build with additional debug utilities])
3872 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3873     ENABLE_DBGUTIL="TRUE"
3874     # this is an extra var so it can have different default on different MSVC
3875     # versions (in case there are version specific problems with it)
3876     MSVC_USE_DEBUG_RUNTIME="TRUE"
3878     AC_MSG_RESULT([yes])
3879     # cppunit and graphite expose STL in public headers
3880     if test "$with_system_cppunit" = "yes"; then
3881         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3882     else
3883         with_system_cppunit=no
3884     fi
3885     if test "$with_system_graphite" = "yes"; then
3886         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3887     else
3888         with_system_graphite=no
3889     fi
3890     if test "$with_system_orcus" = "yes"; then
3891         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3892     else
3893         with_system_orcus=no
3894     fi
3895     if test "$with_system_libcmis" = "yes"; then
3896         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3897     else
3898         with_system_libcmis=no
3899     fi
3900     if test "$with_system_hunspell" = "yes"; then
3901         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3902     else
3903         with_system_hunspell=no
3904     fi
3905     if test "$with_system_gpgmepp" = "yes"; then
3906         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3907     else
3908         with_system_gpgmepp=no
3909     fi
3910     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3911     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3912     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3913     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3914     # of those two is using the system variant:
3915     if test "$with_system_libnumbertext" = "yes"; then
3916         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3917     else
3918         with_system_libnumbertext=no
3919     fi
3920     if test "$with_system_libwps" = "yes"; then
3921         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3922     else
3923         with_system_libwps=no
3924     fi
3925 else
3926     ENABLE_DBGUTIL=""
3927     MSVC_USE_DEBUG_RUNTIME=""
3928     AC_MSG_RESULT([no])
3930 AC_SUBST(ENABLE_DBGUTIL)
3931 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3933 dnl Set the ENABLE_DEBUG variable.
3934 dnl ===================================================================
3935 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3936     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3938 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3939     if test -z "$libo_fuzzed_enable_debug"; then
3940         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3941     else
3942         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3943         enable_debug=yes
3944     fi
3947 AC_MSG_CHECKING([whether to do a debug build])
3948 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3949     ENABLE_DEBUG="TRUE"
3950     if test -n "$ENABLE_DBGUTIL" ; then
3951         AC_MSG_RESULT([yes (dbgutil)])
3952     else
3953         AC_MSG_RESULT([yes])
3954     fi
3955 else
3956     ENABLE_DEBUG=""
3957     AC_MSG_RESULT([no])
3959 AC_SUBST(ENABLE_DEBUG)
3961 dnl ===================================================================
3962 dnl Select the linker to use (gold/lld/ld.bfd).
3963 dnl This is done only after compiler checks (need to know if Clang is
3964 dnl used, for different defaults) and after checking if a debug build
3965 dnl is wanted (non-debug builds get the default linker if not explicitly
3966 dnl specified otherwise).
3967 dnl All checks for linker features/options should come after this.
3968 dnl ===================================================================
3969 check_use_ld()
3971     use_ld=$1
3972     use_ld_fail_if_error=$2
3973     use_ld_ok=
3974     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3975     use_ld_ldflags_save="$LDFLAGS"
3976     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3977     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3978 #include <stdio.h>
3979         ],[
3980 printf ("hello world\n");
3981         ])], USE_LD=$use_ld, [])
3982     if test -n "$USE_LD"; then
3983         AC_MSG_RESULT( yes )
3984         use_ld_ok=yes
3985     else
3986         if test -n "$use_ld_fail_if_error"; then
3987             AC_MSG_ERROR( no )
3988         else
3989             AC_MSG_RESULT( no )
3990         fi
3991     fi
3992     if test -n "$use_ld_ok"; then
3993         dnl keep the value of LDFLAGS
3994         return 0
3995     fi
3996     LDFLAGS="$use_ld_ldflags_save"
3997     return 1
3999 USE_LD=
4000 if test "$enable_ld" != "no"; then
4001     if test "$GCC" = "yes"; then
4002         if test -n "$enable_ld"; then
4003             check_use_ld "$enable_ld" fail_if_error
4004         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4005             dnl non-debug builds default to the default linker
4006             true
4007         elif test -n "$COM_IS_CLANG"; then
4008             check_use_ld lld
4009             if test $? -ne 0; then
4010                 check_use_ld gold
4011             fi
4012         else
4013             # For gcc first try gold, new versions also support lld.
4014             check_use_ld gold
4015             if test $? -ne 0; then
4016                 check_use_ld lld
4017             fi
4018         fi
4019         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4020         rm conftest.out
4021         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4022         if test -z "$ld_used"; then
4023             ld_used="unknown"
4024         fi
4025         AC_MSG_CHECKING([for linker that is used])
4026         AC_MSG_RESULT([$ld_used])
4027         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4028             if echo "$ld_used" | grep -q "^GNU ld"; then
4029                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4030                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4031             fi
4032         fi
4033     else
4034         if test "$enable_ld" = "yes"; then
4035             AC_MSG_ERROR([--enable-ld not supported])
4036         fi
4037     fi
4039 AC_SUBST(USE_LD)
4041 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4042 if test "$GCC" = "yes"; then
4043     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4044     bsymbolic_functions_ldflags_save=$LDFLAGS
4045     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4046     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4047 #include <stdio.h>
4048         ],[
4049 printf ("hello world\n");
4050         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4051     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4052         AC_MSG_RESULT( found )
4053     else
4054         AC_MSG_RESULT( not found )
4055     fi
4056     LDFLAGS=$bsymbolic_functions_ldflags_save
4058 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4061 HAVE_GSPLIT_DWARF=
4062 if test "$enable_split_debug" != no; then
4063     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4064     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4065         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4066         save_CFLAGS=$CFLAGS
4067         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4068         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4069         CFLAGS=$save_CFLAGS
4070         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4071             AC_MSG_RESULT([yes])
4072         else
4073             if test "$enable_split_debug" = yes; then
4074                 AC_MSG_ERROR([no])
4075             else
4076                 AC_MSG_RESULT([no])
4077             fi
4078         fi
4079     fi
4080     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4081         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4082         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4083     fi
4085 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4087 ENABLE_GDB_INDEX=
4088 if test "$enable_gdb_index" != "no"; then
4089     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4090     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4091         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4092         save_CFLAGS=$CFLAGS
4093         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4094         have_ggnu_pubnames=
4095         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4096         if test "$have_ggnu_pubnames" != "TRUE"; then
4097             if test "$enable_gdb_index" = "yes"; then
4098                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4099             else
4100                 AC_MSG_RESULT( no )
4101             fi
4102         else
4103             AC_MSG_RESULT( yes )
4104             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4105             ldflags_save=$LDFLAGS
4106             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4107             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4108 #include <stdio.h>
4109                 ],[
4110 printf ("hello world\n");
4111                 ])], ENABLE_GDB_INDEX=TRUE, [])
4112             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4113                 AC_MSG_RESULT( yes )
4114             else
4115                 if test "$enable_gdb_index" = "yes"; then
4116                     AC_MSG_ERROR( no )
4117                 else
4118                     AC_MSG_RESULT( no )
4119                 fi
4120             fi
4121             LDFLAGS=$ldflags_save
4122         fi
4123         CFLAGS=$save_CFLAGS
4124         fi
4125     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4126         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4127         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4128     fi
4130 AC_SUBST(ENABLE_GDB_INDEX)
4132 if test "$enable_sal_log" = yes; then
4133     ENABLE_SAL_LOG=TRUE
4135 AC_SUBST(ENABLE_SAL_LOG)
4137 dnl Check for enable symbols option
4138 dnl ===================================================================
4139 AC_MSG_CHECKING([whether to generate debug information])
4140 if test -z "$enable_symbols"; then
4141     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4142         enable_symbols=yes
4143     else
4144         enable_symbols=no
4145     fi
4147 if test "$enable_symbols" = yes; then
4148     ENABLE_SYMBOLS_FOR=all
4149     AC_MSG_RESULT([yes])
4150 elif test "$enable_symbols" = no; then
4151     ENABLE_SYMBOLS_FOR=
4152     AC_MSG_RESULT([no])
4153 else
4154     # Selective debuginfo.
4155     ENABLE_SYMBOLS_FOR="$enable_symbols"
4156     AC_MSG_RESULT([for "$enable_symbols"])
4158 AC_SUBST(ENABLE_SYMBOLS_FOR)
4160 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4161     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4162     AC_MSG_CHECKING([whether enough memory is available for linking])
4163     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4164     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4165     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4166         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4167     else
4168         AC_MSG_RESULT([yes])
4169     fi
4172 AC_MSG_CHECKING([whether to compile with optimization flags])
4173 if test -z "$enable_optimized"; then
4174     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4175         enable_optimized=no
4176     else
4177         enable_optimized=yes
4178     fi
4180 if test "$enable_optimized" != no; then
4181     ENABLE_OPTIMIZED=TRUE
4182     AC_MSG_RESULT([yes])
4183 else
4184     ENABLE_OPTIMIZED=
4185     AC_MSG_RESULT([no])
4187 AC_SUBST(ENABLE_OPTIMIZED)
4190 # determine CPUNAME, OS, ...
4191 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4193 case "$host_os" in
4195 aix*)
4196     COM=GCC
4197     CPUNAME=POWERPC
4198     USING_X11=TRUE
4199     OS=AIX
4200     RTL_OS=AIX
4201     RTL_ARCH=PowerPC
4202     PLATFORMID=aix_powerpc
4203     P_SEP=:
4204     ;;
4206 cygwin*)
4207     COM=MSC
4208     USING_X11=
4209     OS=WNT
4210     RTL_OS=Windows
4211     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4212         P_SEP=";"
4213     else
4214         P_SEP=:
4215     fi
4216     case "$host_cpu" in
4217     i*86|x86_64)
4218         if test "$BITNESS_OVERRIDE" = 64; then
4219             CPUNAME=X86_64
4220             RTL_ARCH=X86_64
4221             PLATFORMID=windows_x86_64
4222             WINDOWS_X64=1
4223             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4224         else
4225             CPUNAME=INTEL
4226             RTL_ARCH=x86
4227             PLATFORMID=windows_x86
4228         fi
4229         ;;
4230     *)
4231         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4232         ;;
4233     esac
4234     SCPDEFS="$SCPDEFS -D_MSC_VER"
4235     ;;
4237 darwin*)
4238     COM=GCC
4239     USING_X11=
4240     OS=MACOSX
4241     RTL_OS=MacOSX
4242     P_SEP=:
4244     case "$host_cpu" in
4245     arm)
4246         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4247         ;;
4248     arm64)
4249         OS=iOS
4250         RTL_OS=iOS
4251         if test "$enable_ios_simulator" = "yes"; then
4252             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4253         else
4254             CPUNAME=ARM64
4255             RTL_ARCH=ARM_EABI
4256             PLATFORMID=ios_arm64
4257         fi
4258         ;;
4259     i*86)
4260         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4261         ;;
4262     x86_64)
4263         if test "$enable_ios_simulator" = "yes"; then
4264             OS=iOS
4265         fi
4266         CPUNAME=X86_64
4267         RTL_ARCH=X86_64
4268         PLATFORMID=macosx_x86_64
4269         ;;
4270     *)
4271         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4272         ;;
4273     esac
4274     ;;
4276 dragonfly*)
4277     COM=GCC
4278     USING_X11=TRUE
4279     OS=DRAGONFLY
4280     RTL_OS=DragonFly
4281     P_SEP=:
4283     case "$host_cpu" in
4284     i*86)
4285         CPUNAME=INTEL
4286         RTL_ARCH=x86
4287         PLATFORMID=dragonfly_x86
4288         ;;
4289     x86_64)
4290         CPUNAME=X86_64
4291         RTL_ARCH=X86_64
4292         PLATFORMID=dragonfly_x86_64
4293         ;;
4294     *)
4295         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4296         ;;
4297     esac
4298     ;;
4300 freebsd*)
4301     COM=GCC
4302     USING_X11=TRUE
4303     RTL_OS=FreeBSD
4304     OS=FREEBSD
4305     P_SEP=:
4307     case "$host_cpu" in
4308     i*86)
4309         CPUNAME=INTEL
4310         RTL_ARCH=x86
4311         PLATFORMID=freebsd_x86
4312         ;;
4313     x86_64|amd64)
4314         CPUNAME=X86_64
4315         RTL_ARCH=X86_64
4316         PLATFORMID=freebsd_x86_64
4317         ;;
4318     *)
4319         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4320         ;;
4321     esac
4322     ;;
4324 haiku*)
4325     COM=GCC
4326     USING_X11=
4327     GUIBASE=haiku
4328     RTL_OS=Haiku
4329     OS=HAIKU
4330     P_SEP=:
4332     case "$host_cpu" in
4333     i*86)
4334         CPUNAME=INTEL
4335         RTL_ARCH=x86
4336         PLATFORMID=haiku_x86
4337         ;;
4338     x86_64|amd64)
4339         CPUNAME=X86_64
4340         RTL_ARCH=X86_64
4341         PLATFORMID=haiku_x86_64
4342         ;;
4343     *)
4344         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4345         ;;
4346     esac
4347     ;;
4349 kfreebsd*)
4350     COM=GCC
4351     USING_X11=TRUE
4352     OS=LINUX
4353     RTL_OS=kFreeBSD
4354     P_SEP=:
4356     case "$host_cpu" in
4358     i*86)
4359         CPUNAME=INTEL
4360         RTL_ARCH=x86
4361         PLATFORMID=kfreebsd_x86
4362         ;;
4363     x86_64)
4364         CPUNAME=X86_64
4365         RTL_ARCH=X86_64
4366         PLATFORMID=kfreebsd_x86_64
4367         ;;
4368     *)
4369         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4370         ;;
4371     esac
4372     ;;
4374 linux-gnu*)
4375     COM=GCC
4376     USING_X11=TRUE
4377     OS=LINUX
4378     RTL_OS=Linux
4379     P_SEP=:
4381     case "$host_cpu" in
4383     aarch64)
4384         CPUNAME=AARCH64
4385         PLATFORMID=linux_aarch64
4386         RTL_ARCH=AARCH64
4387         ;;
4388     alpha)
4389         CPUNAME=AXP
4390         RTL_ARCH=ALPHA
4391         PLATFORMID=linux_alpha
4392         ;;
4393     arm*)
4394         CPUNAME=ARM
4395         EPM_FLAGS="-a arm"
4396         RTL_ARCH=ARM_EABI
4397         PLATFORMID=linux_arm_eabi
4398         case "$host_cpu" in
4399         arm*-linux)
4400             RTL_ARCH=ARM_OABI
4401             PLATFORMID=linux_arm_oabi
4402             ;;
4403         esac
4404         ;;
4405     hppa)
4406         CPUNAME=HPPA
4407         RTL_ARCH=HPPA
4408         EPM_FLAGS="-a hppa"
4409         PLATFORMID=linux_hppa
4410         ;;
4411     i*86)
4412         CPUNAME=INTEL
4413         RTL_ARCH=x86
4414         PLATFORMID=linux_x86
4415         ;;
4416     ia64)
4417         CPUNAME=IA64
4418         RTL_ARCH=IA64
4419         PLATFORMID=linux_ia64
4420         ;;
4421     mips)
4422         CPUNAME=GODSON
4423         RTL_ARCH=MIPS_EB
4424         EPM_FLAGS="-a mips"
4425         PLATFORMID=linux_mips_eb
4426         ;;
4427     mips64)
4428         CPUNAME=GODSON64
4429         RTL_ARCH=MIPS64_EB
4430         EPM_FLAGS="-a mips64"
4431         PLATFORMID=linux_mips64_eb
4432         ;;
4433     mips64el)
4434         CPUNAME=GODSON64
4435         RTL_ARCH=MIPS64_EL
4436         EPM_FLAGS="-a mips64el"
4437         PLATFORMID=linux_mips64_el
4438         ;;
4439     mipsel)
4440         CPUNAME=GODSON
4441         RTL_ARCH=MIPS_EL
4442         EPM_FLAGS="-a mipsel"
4443         PLATFORMID=linux_mips_el
4444         ;;
4445     m68k)
4446         CPUNAME=M68K
4447         RTL_ARCH=M68K
4448         PLATFORMID=linux_m68k
4449         ;;
4450     powerpc)
4451         CPUNAME=POWERPC
4452         RTL_ARCH=PowerPC
4453         PLATFORMID=linux_powerpc
4454         ;;
4455     powerpc64)
4456         CPUNAME=POWERPC64
4457         RTL_ARCH=PowerPC_64
4458         PLATFORMID=linux_powerpc64
4459         ;;
4460     powerpc64le)
4461         CPUNAME=POWERPC64
4462         RTL_ARCH=PowerPC_64_LE
4463         PLATFORMID=linux_powerpc64_le
4464         ;;
4465     sparc)
4466         CPUNAME=SPARC
4467         RTL_ARCH=SPARC
4468         PLATFORMID=linux_sparc
4469         ;;
4470     sparc64)
4471         CPUNAME=SPARC64
4472         RTL_ARCH=SPARC64
4473         PLATFORMID=linux_sparc64
4474         ;;
4475     s390)
4476         CPUNAME=S390
4477         RTL_ARCH=S390
4478         PLATFORMID=linux_s390
4479         ;;
4480     s390x)
4481         CPUNAME=S390X
4482         RTL_ARCH=S390x
4483         PLATFORMID=linux_s390x
4484         ;;
4485     x86_64)
4486         CPUNAME=X86_64
4487         RTL_ARCH=X86_64
4488         PLATFORMID=linux_x86_64
4489         ;;
4490     *)
4491         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4492         ;;
4493     esac
4494     ;;
4496 linux-android*)
4497     COM=GCC
4498     USING_X11=
4499     OS=ANDROID
4500     RTL_OS=Android
4501     P_SEP=:
4503     case "$host_cpu" in
4505     arm|armel)
4506         CPUNAME=ARM
4507         RTL_ARCH=ARM_EABI
4508         PLATFORMID=android_arm_eabi
4509         ;;
4510     aarch64)
4511         CPUNAME=AARCH64
4512         RTL_ARCH=AARCH64
4513         PLATFORMID=android_aarch64
4514         ;;
4515     i*86)
4516         CPUNAME=INTEL
4517         RTL_ARCH=x86
4518         PLATFORMID=android_x86
4519         ;;
4520     x86_64)
4521         CPUNAME=X86_64
4522         RTL_ARCH=X86_64
4523         PLATFORMID=android_x86_64
4524         ;;
4525     *)
4526         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4527         ;;
4528     esac
4529     ;;
4531 *netbsd*)
4532     COM=GCC
4533     USING_X11=TRUE
4534     OS=NETBSD
4535     RTL_OS=NetBSD
4536     P_SEP=:
4538     case "$host_cpu" in
4539     i*86)
4540         CPUNAME=INTEL
4541         RTL_ARCH=x86
4542         PLATFORMID=netbsd_x86
4543         ;;
4544     powerpc)
4545         CPUNAME=POWERPC
4546         RTL_ARCH=PowerPC
4547         PLATFORMID=netbsd_powerpc
4548         ;;
4549     sparc)
4550         CPUNAME=SPARC
4551         RTL_ARCH=SPARC
4552         PLATFORMID=netbsd_sparc
4553         ;;
4554     x86_64)
4555         CPUNAME=X86_64
4556         RTL_ARCH=X86_64
4557         PLATFORMID=netbsd_x86_64
4558         ;;
4559     *)
4560         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4561         ;;
4562     esac
4563     ;;
4565 openbsd*)
4566     COM=GCC
4567     USING_X11=TRUE
4568     OS=OPENBSD
4569     RTL_OS=OpenBSD
4570     P_SEP=:
4572     case "$host_cpu" in
4573     i*86)
4574         CPUNAME=INTEL
4575         RTL_ARCH=x86
4576         PLATFORMID=openbsd_x86
4577         ;;
4578     x86_64)
4579         CPUNAME=X86_64
4580         RTL_ARCH=X86_64
4581         PLATFORMID=openbsd_x86_64
4582         ;;
4583     *)
4584         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4585         ;;
4586     esac
4587     SOLARINC="$SOLARINC -I/usr/local/include"
4588     ;;
4590 solaris*)
4591     COM=GCC
4592     USING_X11=TRUE
4593     OS=SOLARIS
4594     RTL_OS=Solaris
4595     P_SEP=:
4597     case "$host_cpu" in
4598     i*86)
4599         CPUNAME=INTEL
4600         RTL_ARCH=x86
4601         PLATFORMID=solaris_x86
4602         ;;
4603     sparc)
4604         CPUNAME=SPARC
4605         RTL_ARCH=SPARC
4606         PLATFORMID=solaris_sparc
4607         ;;
4608     sparc64)
4609         CPUNAME=SPARC64
4610         RTL_ARCH=SPARC64
4611         PLATFORMID=solaris_sparc64
4612         ;;
4613     *)
4614         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4615         ;;
4616     esac
4617     SOLARINC="$SOLARINC -I/usr/local/include"
4618     ;;
4621     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4622     ;;
4623 esac
4625 if test "$with_x" = "no"; then
4626     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4629 DISABLE_GUI=""
4630 if test "$enable_gui" = "no"; then
4631     if test "$USING_X11" != TRUE; then
4632         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4633     fi
4634     USING_X11=
4635     DISABLE_GUI=TRUE
4636     AC_DEFINE(HAVE_FEATURE_UI,0)
4637     test_cairo=yes
4639 AC_SUBST(DISABLE_GUI)
4641 WORKDIR="${BUILDDIR}/workdir"
4642 INSTDIR="${BUILDDIR}/instdir"
4643 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4644 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4645 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4646 AC_SUBST(COM)
4647 AC_SUBST(CPUNAME)
4648 AC_SUBST(RTL_OS)
4649 AC_SUBST(RTL_ARCH)
4650 AC_SUBST(EPM_FLAGS)
4651 AC_SUBST(USING_X11)
4652 AC_SUBST([INSTDIR])
4653 AC_SUBST([INSTROOT])
4654 AC_SUBST([INSTROOTBASE])
4655 AC_SUBST(OS)
4656 AC_SUBST(P_SEP)
4657 AC_SUBST(WORKDIR)
4658 AC_SUBST(PLATFORMID)
4659 AC_SUBST(WINDOWS_X64)
4660 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4662 dnl ===================================================================
4663 dnl Test which package format to use
4664 dnl ===================================================================
4665 AC_MSG_CHECKING([which package format to use])
4666 if test -n "$with_package_format" -a "$with_package_format" != no; then
4667     for i in $with_package_format; do
4668         case "$i" in
4669         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4670             ;;
4671         *)
4672             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4673 aix - AIX software distribution
4674 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4675 deb - Debian software distribution
4676 pkg - Solaris software distribution
4677 rpm - RedHat software distribution
4679 LibreOffice additionally supports:
4680 archive - .tar.gz or .zip
4681 dmg - macOS .dmg
4682 installed - installation tree
4683 msi - Windows .msi
4684         ])
4685             ;;
4686         esac
4687     done
4688     # fakeroot is needed to ensure correct file ownerships/permissions
4689     # inside deb packages and tar archives created on Linux and Solaris.
4690     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4691         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4692         if test "$FAKEROOT" = "no"; then
4693             AC_MSG_ERROR(
4694                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4695         fi
4696     fi
4697     PKGFORMAT="$with_package_format"
4698     AC_MSG_RESULT([$PKGFORMAT])
4699 else
4700     PKGFORMAT=
4701     AC_MSG_RESULT([none])
4703 AC_SUBST(PKGFORMAT)
4705 dnl ===================================================================
4706 dnl Set up a different compiler to produce tools to run on the build
4707 dnl machine when doing cross-compilation
4708 dnl ===================================================================
4710 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4711 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4712 if test "$cross_compiling" = "yes"; then
4713     AC_MSG_CHECKING([for BUILD platform configuration])
4714     echo
4715     rm -rf CONF-FOR-BUILD config_build.mk
4716     mkdir CONF-FOR-BUILD
4717     # Here must be listed all files needed when running the configure script. In particular, also
4718     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4719     # keep them in the same order as there.
4720     (cd $SRC_ROOT && tar cf - \
4721         config.guess \
4722         bin/get_config_variables \
4723         solenv/bin/getcompver.awk \
4724         solenv/inc/langlist.mk \
4725         download.lst \
4726         config_host.mk.in \
4727         config_host_lang.mk.in \
4728         Makefile.in \
4729         bin/bffvalidator.sh.in \
4730         bin/odfvalidator.sh.in \
4731         bin/officeotron.sh.in \
4732         instsetoo_native/util/openoffice.lst.in \
4733         config_host/*.in \
4734         sysui/desktop/macosx/Info.plist.in) \
4735     | (cd CONF-FOR-BUILD && tar xf -)
4736     cp configure CONF-FOR-BUILD
4737     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4738     (
4739     unset COM USING_X11 OS CPUNAME
4740     unset CC CXX SYSBASE CFLAGS
4741     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4742     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4743     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4744     if test -n "$CC_FOR_BUILD"; then
4745         export CC="$CC_FOR_BUILD"
4746         CC_BASE=`first_arg_basename "$CC"`
4747     fi
4748     if test -n "$CXX_FOR_BUILD"; then
4749         export CXX="$CXX_FOR_BUILD"
4750         CXX_BASE=`first_arg_basename "$CXX"`
4751     fi
4752     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4753     cd CONF-FOR-BUILD
4754     sub_conf_opts=""
4755     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4756     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4757     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4758     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4759     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4760     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4761     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4762     # Don't bother having configure look for stuff not needed for the build platform anyway
4763     ./configure \
4764         --disable-cups \
4765         --disable-gstreamer-1-0 \
4766         --disable-gtk3 \
4767         --disable-pdfimport \
4768         --disable-postgresql-sdbc \
4769         --with-parallelism="$with_parallelism" \
4770         --without-doxygen \
4771         --without-java \
4772         $sub_conf_opts \
4773         --srcdir=$srcdir \
4774         2>&1 | sed -e 's/^/    /'
4775     test -f ./config_host.mk 2>/dev/null || exit
4776     cp config_host.mk ../config_build.mk
4777     cp config_host_lang.mk ../config_build_lang.mk
4778     mv config.log ../config.Build.log
4779     mkdir -p ../config_build
4780     mv config_host/*.h ../config_build
4781     . ./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
4783     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
4784         VV='$'$V
4785         VV=`eval "echo $VV"`
4786         if test -n "$VV"; then
4787             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4788             echo "$line" >>build-config
4789         fi
4790     done
4792     for V in INSTDIR INSTROOT WORKDIR; do
4793         VV='$'$V
4794         VV=`eval "echo $VV"`
4795         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4796         if test -n "$VV"; then
4797             line="${V}_FOR_BUILD='$VV'"
4798             echo "$line" >>build-config
4799         fi
4800     done
4802     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4803     echo "$line" >>build-config
4805     )
4806     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4807     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])
4808     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4809              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4811     eval `cat CONF-FOR-BUILD/build-config`
4813     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4815     rm -rf CONF-FOR-BUILD
4816 else
4817     OS_FOR_BUILD="$OS"
4818     CC_FOR_BUILD="$CC"
4819     CXX_FOR_BUILD="$CXX"
4820     INSTDIR_FOR_BUILD="$INSTDIR"
4821     INSTROOT_FOR_BUILD="$INSTROOT"
4822     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4823     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4824     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4825     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4826     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4827     WORKDIR_FOR_BUILD="$WORKDIR"
4829 AC_SUBST(OS_FOR_BUILD)
4830 AC_SUBST(INSTDIR_FOR_BUILD)
4831 AC_SUBST(INSTROOT_FOR_BUILD)
4832 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4833 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4834 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4835 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4836 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4837 AC_SUBST(WORKDIR_FOR_BUILD)
4839 dnl ===================================================================
4840 dnl Check for syslog header
4841 dnl ===================================================================
4842 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4844 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4845 dnl ===================================================================
4846 AC_MSG_CHECKING([whether to turn warnings to errors])
4847 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4848     ENABLE_WERROR="TRUE"
4849     AC_MSG_RESULT([yes])
4850 else
4851     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4852         ENABLE_WERROR="TRUE"
4853         AC_MSG_RESULT([yes])
4854     else
4855         AC_MSG_RESULT([no])
4856     fi
4858 AC_SUBST(ENABLE_WERROR)
4860 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4861 dnl ===================================================================
4862 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4863 if test -z "$enable_assert_always_abort"; then
4864    if test "$ENABLE_DEBUG" = TRUE; then
4865        enable_assert_always_abort=yes
4866    else
4867        enable_assert_always_abort=no
4868    fi
4870 if test "$enable_assert_always_abort" = "yes"; then
4871     ASSERT_ALWAYS_ABORT="TRUE"
4872     AC_MSG_RESULT([yes])
4873 else
4874     ASSERT_ALWAYS_ABORT="FALSE"
4875     AC_MSG_RESULT([no])
4877 AC_SUBST(ASSERT_ALWAYS_ABORT)
4879 # Determine whether to use ooenv for the instdir installation
4880 # ===================================================================
4881 if test $_os != "WINNT" -a $_os != "Darwin"; then
4882     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4883     if test "$enable_ooenv" = "no"; then
4884         AC_MSG_RESULT([no])
4885     else
4886         ENABLE_OOENV="TRUE"
4887         AC_MSG_RESULT([yes])
4888     fi
4890 AC_SUBST(ENABLE_OOENV)
4892 if test "$USING_X11" != TRUE; then
4893     # be sure to do not mess with unneeded stuff
4894     test_randr=no
4895     test_xrender=no
4896     test_cups=no
4897     test_dbus=no
4898     build_gstreamer_1_0=no
4899     test_kf5=no
4900     test_qt5=no
4901     test_gtk3_kde5=no
4902     enable_cairo_canvas=no
4905 if test "$OS" = "HAIKU"; then
4906     enable_cairo_canvas=yes
4907     test_kf5=yes
4910 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4911     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!])
4912     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!"
4913     enable_kf5=yes
4916 if test "$test_kf5" = "yes"; then
4917     test_qt5=yes
4920 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4921     if test "$enable_qt5" = "no"; then
4922         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4923     else
4924         enable_qt5=yes
4925     fi
4928 dnl ===================================================================
4929 dnl check for cups support
4930 dnl ===================================================================
4931 ENABLE_CUPS=""
4933 if test "$enable_cups" = "no"; then
4934     test_cups=no
4937 AC_MSG_CHECKING([whether to enable CUPS support])
4938 if test "$test_cups" = "yes"; then
4939     ENABLE_CUPS="TRUE"
4940     AC_MSG_RESULT([yes])
4942     AC_MSG_CHECKING([whether cups support is present])
4943     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4944     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4945     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4946         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4947     fi
4949 else
4950     AC_MSG_RESULT([no])
4953 AC_SUBST(ENABLE_CUPS)
4955 # fontconfig checks
4956 if test "$test_fontconfig" = "yes"; then
4957     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4958     SYSTEM_FONTCONFIG=TRUE
4959     FilterLibs "${FONTCONFIG_LIBS}"
4960     FONTCONFIG_LIBS="${filteredlibs}"
4962 AC_SUBST(FONTCONFIG_CFLAGS)
4963 AC_SUBST(FONTCONFIG_LIBS)
4964 AC_SUBST([SYSTEM_FONTCONFIG])
4966 dnl whether to find & fetch external tarballs?
4967 dnl ===================================================================
4968 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4969    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4970        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4971    else
4972        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4973    fi
4975 if test -z "$TARFILE_LOCATION"; then
4976     if test -d "$SRC_ROOT/src" ; then
4977         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4978         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4979     fi
4980     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4981 else
4982     AbsolutePath "$TARFILE_LOCATION"
4983     PathFormat "${absolute_path}"
4984     TARFILE_LOCATION="${formatted_path}"
4986 AC_SUBST(TARFILE_LOCATION)
4988 AC_MSG_CHECKING([whether we want to fetch tarballs])
4989 if test "$enable_fetch_external" != "no"; then
4990     if test "$with_all_tarballs" = "yes"; then
4991         AC_MSG_RESULT([yes, all of them])
4992         DO_FETCH_TARBALLS="ALL"
4993     else
4994         AC_MSG_RESULT([yes, if we use them])
4995         DO_FETCH_TARBALLS="TRUE"
4996     fi
4997 else
4998     AC_MSG_RESULT([no])
4999     DO_FETCH_TARBALLS=
5001 AC_SUBST(DO_FETCH_TARBALLS)
5003 AC_MSG_CHECKING([whether to build help])
5004 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5005     BUILD_TYPE="$BUILD_TYPE HELP"
5006     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5007     case "$with_help" in
5008     "html")
5009         ENABLE_HTMLHELP=TRUE
5010         SCPDEFS="$SCPDEFS -DWITH_HELP"
5011         AC_MSG_RESULT([HTML])
5012         ;;
5013     "online")
5014         ENABLE_HTMLHELP=TRUE
5015         HELP_ONLINE=TRUE
5016         AC_MSG_RESULT([HTML])
5017         ;;
5018     yes)
5019         SCPDEFS="$SCPDEFS -DWITH_HELP"
5020         AC_MSG_RESULT([yes])
5021         ;;
5022     *)
5023         AC_MSG_ERROR([Unknown --with-help=$with_help])
5024         ;;
5025     esac
5026 else
5027     AC_MSG_RESULT([no])
5029 AC_SUBST([ENABLE_HTMLHELP])
5030 AC_SUBST([HELP_ONLINE])
5032 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5033 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5034     BUILD_TYPE="$BUILD_TYPE HELP"
5035     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5036     case "$with_omindex" in
5037     "server")
5038         ENABLE_HTMLHELP=TRUE
5039         HELP_ONLINE=TRUE
5040         HELP_OMINDEX_PAGE=TRUE
5041         AC_MSG_RESULT([SERVER])
5042         ;;
5043     "noxap")
5044         ENABLE_HTMLHELP=TRUE
5045         HELP_ONLINE=TRUE
5046         HELP_OMINDEX_PAGE=FALSE
5047         AC_MSG_RESULT([NOXAP])
5048         ;;
5049     *)
5050         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5051         ;;
5052     esac
5053 else
5054     HELP_OMINDEX_PAGE=FALSE
5055     AC_MSG_RESULT([no])
5057 AC_SUBST([ENABLE_HTMLHELP])
5058 AC_SUBST([HELP_OMINDEX_PAGE])
5059 AC_SUBST([HELP_ONLINE])
5062 dnl Test whether to include MySpell dictionaries
5063 dnl ===================================================================
5064 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5065 if test "$with_myspell_dicts" = "yes"; then
5066     AC_MSG_RESULT([yes])
5067     WITH_MYSPELL_DICTS=TRUE
5068     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5069     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5070 else
5071     AC_MSG_RESULT([no])
5072     WITH_MYSPELL_DICTS=
5074 AC_SUBST(WITH_MYSPELL_DICTS)
5076 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5077 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5078     if test "$with_system_dicts" = yes; then
5079         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5080     fi
5081     with_system_dicts=no
5084 AC_MSG_CHECKING([whether to use dicts from external paths])
5085 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5086     AC_MSG_RESULT([yes])
5087     SYSTEM_DICTS=TRUE
5088     AC_MSG_CHECKING([for spelling dictionary directory])
5089     if test -n "$with_external_dict_dir"; then
5090         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5091     else
5092         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5093         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5094             DICT_SYSTEM_DIR=file:///usr/share/myspell
5095         fi
5096     fi
5097     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5098     AC_MSG_CHECKING([for hyphenation patterns directory])
5099     if test -n "$with_external_hyph_dir"; then
5100         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5101     else
5102         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5103     fi
5104     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5105     AC_MSG_CHECKING([for thesaurus directory])
5106     if test -n "$with_external_thes_dir"; then
5107         THES_SYSTEM_DIR=file://$with_external_thes_dir
5108     else
5109         THES_SYSTEM_DIR=file:///usr/share/mythes
5110     fi
5111     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5112 else
5113     AC_MSG_RESULT([no])
5114     SYSTEM_DICTS=
5116 AC_SUBST(SYSTEM_DICTS)
5117 AC_SUBST(DICT_SYSTEM_DIR)
5118 AC_SUBST(HYPH_SYSTEM_DIR)
5119 AC_SUBST(THES_SYSTEM_DIR)
5121 dnl ===================================================================
5122 dnl Precompiled headers.
5123 ENABLE_PCH=""
5124 AC_MSG_CHECKING([whether to enable pch feature])
5125 if test -z "$enable_pch"; then
5126     if test "$_os" = "WINNT"; then
5127         # Enabled by default on Windows.
5128         enable_pch=yes
5129     else
5130         enable_pch=no
5131     fi
5133 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5134     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5136 if test "$enable_pch" = "system"; then
5137     ENABLE_PCH="1"
5138     AC_MSG_RESULT([yes (system headers)])
5139 elif test "$enable_pch" = "base"; then
5140     ENABLE_PCH="2"
5141     AC_MSG_RESULT([yes (system and base headers)])
5142 elif test "$enable_pch" = "normal"; then
5143     ENABLE_PCH="3"
5144     AC_MSG_RESULT([yes (normal)])
5145 elif test "$enable_pch" = "full"; then
5146     ENABLE_PCH="4"
5147     AC_MSG_RESULT([yes (full)])
5148 elif test "$enable_pch" = "yes"; then
5149     # Pick a suitable default.
5150     if test "$GCC" = "yes"; then
5151         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5152         # while making the PCHs larger and rebuilds more likely.
5153         ENABLE_PCH="2"
5154         AC_MSG_RESULT([yes (system and base headers)])
5155     else
5156         # With MSVC the highest level makes a significant difference,
5157         # and it was the default when there used to be no PCH levels.
5158         ENABLE_PCH="4"
5159         AC_MSG_RESULT([yes (full)])
5160     fi
5161 elif test "$enable_pch" = "no"; then
5162     AC_MSG_RESULT([no])
5163 else
5164     AC_MSG_ERROR([Unknown value for --enable-pch])
5166 AC_SUBST(ENABLE_PCH)
5167 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5168 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5169     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5170     if test "$CCACHE_BIN" != "not found"; then
5171         AC_MSG_CHECKING([ccache version])
5172         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5173         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5174         AC_MSG_RESULT([$CCACHE_VERSION])
5175         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5176         if test "$CCACHE_NUMVER" -gt "030701"; then
5177             AC_MSG_RESULT([yes])
5178         else
5179             AC_MSG_RESULT([no (not newer than 3.7.1)])
5180             CCACHE_DEPEND_MODE=
5181         fi
5182     fi
5185 TAB=`printf '\t'`
5187 AC_MSG_CHECKING([the GNU Make version])
5188 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5189 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5190 if test "$_make_longver" -ge "038200"; then
5191     AC_MSG_RESULT([$GNUMAKE $_make_version])
5193 elif test "$_make_longver" -ge "038100"; then
5194     if test "$build_os" = "cygwin"; then
5195         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5196     fi
5197     AC_MSG_RESULT([$GNUMAKE $_make_version])
5199     dnl ===================================================================
5200     dnl Search all the common names for sha1sum
5201     dnl ===================================================================
5202     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5203     if test -z "$SHA1SUM"; then
5204         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5205     elif test "$SHA1SUM" = "openssl"; then
5206         SHA1SUM="openssl sha1"
5207     fi
5208     AC_MSG_CHECKING([for GNU Make bug 20033])
5209     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5210     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5211 A := \$(wildcard *.a)
5213 .PHONY: all
5214 all: \$(A:.a=.b)
5215 <TAB>@echo survived bug20033.
5217 .PHONY: setup
5218 setup:
5219 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5221 define d1
5222 @echo lala \$(1)
5223 @sleep 1
5224 endef
5226 define d2
5227 @echo tyty \$(1)
5228 @sleep 1
5229 endef
5231 %.b : %.a
5232 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5233 <TAB>\$(call d1,\$(CHECKSUM)),\
5234 <TAB>\$(call d2,\$(CHECKSUM)))
5236     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5237         no_parallelism_make="YES"
5238         AC_MSG_RESULT([yes, disable parallelism])
5239     else
5240         AC_MSG_RESULT([no, keep parallelism enabled])
5241     fi
5242     rm -rf $TESTGMAKEBUG20033
5243 else
5244     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5247 # find if gnumake support file function
5248 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5249 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5250 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5251     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5253 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5254 \$(file >test.txt,Success )
5256 .PHONY: all
5257 all:
5258 <TAB>@cat test.txt
5261 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5262 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5263     HAVE_GNUMAKE_FILE_FUNC=TRUE
5264     AC_MSG_RESULT([yes])
5265 else
5266     AC_MSG_RESULT([no])
5268 rm -rf $TESTGMAKEFILEFUNC
5269 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5270 AC_SUBST(GNUMAKE_WIN_NATIVE)
5272 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5273 STALE_MAKE=
5274 if test "$_make_ver_check" = ""; then
5275    STALE_MAKE=TRUE
5278 HAVE_LD_HASH_STYLE=FALSE
5279 WITH_LINKER_HASH_STYLE=
5280 AC_MSG_CHECKING([for --hash-style gcc linker support])
5281 if test "$GCC" = "yes"; then
5282     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5283         hash_styles="gnu sysv"
5284     elif test "$with_linker_hash_style" = "no"; then
5285         hash_styles=
5286     else
5287         hash_styles="$with_linker_hash_style"
5288     fi
5290     for hash_style in $hash_styles; do
5291         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5292         hash_style_ldflags_save=$LDFLAGS
5293         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5295         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5296             [
5297 #include <stdio.h>
5298             ],[
5299 printf ("");
5300             ])],
5301             [
5302                   HAVE_LD_HASH_STYLE=TRUE
5303                   WITH_LINKER_HASH_STYLE=$hash_style
5304             ],
5305             [HAVE_LD_HASH_STYLE=FALSE],
5306             [HAVE_LD_HASH_STYLE=FALSE])
5307         LDFLAGS=$hash_style_ldflags_save
5308     done
5310     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5311         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5312     else
5313         AC_MSG_RESULT( no )
5314     fi
5315     LDFLAGS=$hash_style_ldflags_save
5316 else
5317     AC_MSG_RESULT( no )
5319 AC_SUBST(HAVE_LD_HASH_STYLE)
5320 AC_SUBST(WITH_LINKER_HASH_STYLE)
5322 dnl ===================================================================
5323 dnl Check whether there's a Perl version available.
5324 dnl ===================================================================
5325 if test -z "$with_perl_home"; then
5326     AC_PATH_PROG(PERL, perl)
5327 else
5328     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5329     _perl_path="$with_perl_home/bin/perl"
5330     if test -x "$_perl_path"; then
5331         PERL=$_perl_path
5332     else
5333         AC_MSG_ERROR([$_perl_path not found])
5334     fi
5337 dnl ===================================================================
5338 dnl Testing for Perl version 5 or greater.
5339 dnl $] is the Perl version variable, it is returned as an integer
5340 dnl ===================================================================
5341 if test "$PERL"; then
5342     AC_MSG_CHECKING([the Perl version])
5343     ${PERL} -e "exit($]);"
5344     _perl_version=$?
5345     if test "$_perl_version" -lt 5; then
5346         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5347     fi
5348     AC_MSG_RESULT([Perl $_perl_version])
5349 else
5350     AC_MSG_ERROR([Perl not found, install Perl 5])
5353 dnl ===================================================================
5354 dnl Testing for required Perl modules
5355 dnl ===================================================================
5357 AC_MSG_CHECKING([for required Perl modules])
5358 perl_use_string="use Cwd ; use Digest::MD5"
5359 if test "$_os" = "WINNT"; then
5360     if test -n "$PKGFORMAT"; then
5361         for i in $PKGFORMAT; do
5362             case "$i" in
5363             msi)
5364                 # for getting fonts versions to use in MSI
5365                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5366                 ;;
5367             esac
5368         done
5369     fi
5371 if test "$with_system_hsqldb" = "yes"; then
5372     perl_use_string="$perl_use_string ; use Archive::Zip"
5374 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5375     AC_MSG_RESULT([all modules found])
5376 else
5377     AC_MSG_RESULT([failed to find some modules])
5378     # Find out which modules are missing.
5379     for i in $perl_use_string; do
5380         if test "$i" != "use" -a "$i" != ";"; then
5381             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5382                 missing_perl_modules="$missing_perl_modules $i"
5383             fi
5384         fi
5385     done
5386     AC_MSG_ERROR([
5387     The missing Perl modules are: $missing_perl_modules
5388     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5391 dnl ===================================================================
5392 dnl Check for pkg-config
5393 dnl ===================================================================
5394 if test "$_os" != "WINNT"; then
5395     PKG_PROG_PKG_CONFIG
5398 if test "$_os" != "WINNT"; then
5400     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5401     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5402     # explicitly. Or put /path/to/compiler in PATH yourself.
5404     # Use wrappers for LTO
5405     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5406         AC_CHECK_TOOL(AR,gcc-ar)
5407         AC_CHECK_TOOL(NM,gcc-nm)
5408         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5409     else
5410         AC_CHECK_TOOL(AR,ar)
5411         AC_CHECK_TOOL(NM,nm)
5412         AC_CHECK_TOOL(RANLIB,ranlib)
5413     fi
5414     AC_CHECK_TOOL(OBJDUMP,objdump)
5415     AC_CHECK_TOOL(READELF,readelf)
5416     AC_CHECK_TOOL(STRIP,strip)
5417     if test "$_os" = "WINNT"; then
5418         AC_CHECK_TOOL(DLLTOOL,dlltool)
5419         AC_CHECK_TOOL(WINDRES,windres)
5420     fi
5422 AC_SUBST(AR)
5423 AC_SUBST(DLLTOOL)
5424 AC_SUBST(NM)
5425 AC_SUBST(OBJDUMP)
5426 AC_SUBST(PKG_CONFIG)
5427 AC_SUBST(RANLIB)
5428 AC_SUBST(READELF)
5429 AC_SUBST(STRIP)
5430 AC_SUBST(WINDRES)
5432 dnl ===================================================================
5433 dnl pkg-config checks on macOS
5434 dnl ===================================================================
5436 if test $_os = Darwin; then
5437     AC_MSG_CHECKING([for bogus pkg-config])
5438     if test -n "$PKG_CONFIG"; then
5439         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5440             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5441         else
5442             if test "$enable_bogus_pkg_config" = "yes"; then
5443                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5444             else
5445                 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.])
5446             fi
5447         fi
5448     else
5449         AC_MSG_RESULT([no, good])
5450     fi
5453 find_csc()
5455     # Return value: $csctest
5457     unset csctest
5459     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5460     if test -n "$regvalue"; then
5461         csctest=$regvalue
5462         return
5463     fi
5466 find_al()
5468     # Return value: $altest
5470     unset altest
5472     # We need this check to detect 4.6.1 or above.
5473     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5474         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5475         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5476             altest=$regvalue
5477             return
5478         fi
5479     done
5481     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5482         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5483         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5484             altest=$regvalue
5485             return
5486         fi
5487     done
5492 find_dotnetsdk46()
5494     unset frametest
5496     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5497         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5498         if test -n "$regvalue"; then
5499             frametest=$regvalue
5500             return
5501         fi
5502     done
5505 find_winsdk_version()
5507     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5508     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5510     unset winsdktest winsdkbinsubdir winsdklibsubdir
5512     case "$1" in
5513     8.0|8.0A)
5514         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5515         if test -n "$regvalue"; then
5516             winsdktest=$regvalue
5517             winsdklibsubdir=win8
5518             return
5519         fi
5520         ;;
5521     8.1|8.1A)
5522         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5523         if test -n "$regvalue"; then
5524             winsdktest=$regvalue
5525             winsdklibsubdir=winv6.3
5526             return
5527         fi
5528         ;;
5529     10.0)
5530         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5531         if test -n "$regvalue"; then
5532             winsdktest=$regvalue
5533             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5534             if test -n "$regvalue"; then
5535                 winsdkbinsubdir="$regvalue".0
5536                 winsdklibsubdir=$winsdkbinsubdir
5537                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5538                 # test exist the SDK path
5539                 if test -d "$tmppath"; then
5540                    # when path is convertible to a short path then path is okay
5541                    cygpath -d "$tmppath" >/dev/null 2>&1
5542                    if test $? -ne 0; then
5543                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5544                    fi
5545                 else
5546                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5547                 fi
5548             fi
5549             return
5550         fi
5551         ;;
5552     esac
5555 find_winsdk()
5557     # Return value: From find_winsdk_version
5559     unset winsdktest
5561     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5562         find_winsdk_version $ver
5563         if test -n "$winsdktest"; then
5564             return
5565         fi
5566     done
5569 find_msms()
5571     AC_MSG_CHECKING([for MSVC merge modules directory])
5572     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5573     case "$VCVER" in
5574         150|160)
5575         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5576         ;;
5577     esac
5578     for f in $my_msm_files; do
5579         echo "$as_me:$LINENO: searching for $f" >&5
5580     done
5582     msmdir=
5583     for ver in 14.0 15.0; do
5584         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5585         if test -n "$regvalue"; then
5586             for f in ${my_msm_files}; do
5587                 if test -e "$regvalue/${f}"; then
5588                     msmdir=$regvalue
5589                     break
5590                 fi
5591             done
5592         fi
5593     done
5594     dnl Is the following fallback really necessary, or was it added in response
5595     dnl to never having started Visual Studio on a given machine, so the
5596     dnl registry keys checked above had presumably not yet been created?
5597     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5598     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5599     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5600     dnl expanding to "C:\Program Files\Common Files"), which would need
5601     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5602     dnl obtain its value from cygwin:
5603     if test -z "$msmdir"; then
5604         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5605         for f in ${my_msm_files}; do
5606             if test -e "$my_msm_dir/${f}"; then
5607                 msmdir=$my_msm_dir
5608             fi
5609         done
5610     fi
5612     dnl Starting from MSVC 15.0, merge modules are located in different directory
5613     case "$VCVER" in
5614     150|160)
5615         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5616             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5617             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5618             for f in ${my_msm_files}; do
5619                 if test -e "$my_msm_dir/${f}"; then
5620                     msmdir=$my_msm_dir
5621                     break
5622                 fi
5623             done
5624         done
5625         ;;
5626     esac
5628     if test -n "$msmdir"; then
5629         msmdir=`cygpath -m "$msmdir"`
5630         AC_MSG_RESULT([$msmdir])
5631     else
5632         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5633             AC_MSG_FAILURE([not found])
5634         else
5635             AC_MSG_WARN([not found (check config.log)])
5636             add_warning "MSM none of ${my_msm_files} found"
5637         fi
5638     fi
5641 find_msvc_x64_dlls()
5643     AC_MSG_CHECKING([for MSVC x64 DLL path])
5644     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5645     case "$VCVER" in
5646     150|160)
5647         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5648             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5649             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5650                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5651                 break
5652             fi
5653             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5654             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5655                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5656                 break
5657             fi
5658             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5659             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5660                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5661                 break
5662             fi
5663         done
5664         ;;
5665     esac
5666     AC_MSG_RESULT([$msvcdllpath])
5667     AC_MSG_CHECKING([for MSVC x64 DLLs])
5668     msvcdlls="msvcp140.dll vcruntime140.dll"
5669     for dll in $msvcdlls; do
5670         if ! test -f "$msvcdllpath/$dll"; then
5671             AC_MSG_FAILURE([missing $dll])
5672         fi
5673     done
5674     AC_MSG_RESULT([found all ($msvcdlls)])
5677 dnl =========================================
5678 dnl Check for the Windows  SDK.
5679 dnl =========================================
5680 if test "$_os" = "WINNT"; then
5681     AC_MSG_CHECKING([for Windows SDK])
5682     if test "$build_os" = "cygwin"; then
5683         find_winsdk
5684         WINDOWS_SDK_HOME=$winsdktest
5686         # normalize if found
5687         if test -n "$WINDOWS_SDK_HOME"; then
5688             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5689             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5690         fi
5692         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5693     fi
5695     if test -n "$WINDOWS_SDK_HOME"; then
5696         # Remove a possible trailing backslash
5697         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5699         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5700              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5701              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5702             have_windows_sdk_headers=yes
5703         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5704              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5705              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5706             have_windows_sdk_headers=yes
5707         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5708              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5709              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5710             have_windows_sdk_headers=yes
5711         else
5712             have_windows_sdk_headers=no
5713         fi
5715         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5716             have_windows_sdk_libs=yes
5717         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5718             have_windows_sdk_libs=yes
5719         else
5720             have_windows_sdk_libs=no
5721         fi
5723         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5724             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5725 the  Windows SDK are installed.])
5726         fi
5727     fi
5729     if test -z "$WINDOWS_SDK_HOME"; then
5730         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5731     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5732         WINDOWS_SDK_VERSION=80
5733         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5734     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5735         WINDOWS_SDK_VERSION=81
5736         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5737     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5738         WINDOWS_SDK_VERSION=10
5739         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5740     else
5741         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5742     fi
5743     PathFormat "$WINDOWS_SDK_HOME"
5744     WINDOWS_SDK_HOME="$formatted_path"
5745     if test "$build_os" = "cygwin"; then
5746         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5747         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5748             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5749         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5750             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5751         fi
5752     fi
5754     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5755     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5756     dnl but not in v8.0), so allow this to be overridden with a
5757     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5758     dnl and configuration error if no WiLangId.vbs is found would arguably be
5759     dnl better, but I do not know under which conditions exactly it is needed by
5760     dnl msiglobal.pm:
5761     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5762         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5763         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5764             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5765         fi
5766         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5767             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5768         fi
5769         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5770             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5771         fi
5772     fi
5773     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5774         if test -n "$with_package_format" -a "$with_package_format" != no; then
5775             for i in "$with_package_format"; do
5776                 if test "$i" = "msi"; then
5777                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5778                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5779                     fi
5780                 fi
5781             done
5782         fi
5783     fi
5785 AC_SUBST(WINDOWS_SDK_HOME)
5786 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5787 AC_SUBST(WINDOWS_SDK_VERSION)
5788 AC_SUBST(WINDOWS_SDK_WILANGID)
5790 if test "$build_os" = "cygwin"; then
5791     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5792     dnl dir, it also determines that dir's path w/o an arch segment if any,
5793     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5794     AC_MSG_CHECKING([for midl.exe])
5796     find_winsdk
5797     if test -n "$winsdkbinsubdir" \
5798         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5799     then
5800         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5801         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5802     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5803         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5804         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5805     elif test -f "$winsdktest/Bin/midl.exe"; then
5806         MIDL_PATH=$winsdktest/Bin
5807         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5808     fi
5809     if test ! -f "$MIDL_PATH/midl.exe"; then
5810         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5811     else
5812         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5813     fi
5815     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5816     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5818     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5819          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5820          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5821          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5822     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5823          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5824          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5825          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5826     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5827          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5828          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5829          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5830     else
5831         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5832     fi
5834     dnl Check csc.exe
5835     AC_MSG_CHECKING([for csc.exe])
5836     find_csc
5837     if test -f "$csctest/csc.exe"; then
5838         CSC_PATH="$csctest"
5839     fi
5840     if test ! -f "$CSC_PATH/csc.exe"; then
5841         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5842     else
5843         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5844     fi
5846     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5848     dnl Check al.exe
5849     AC_MSG_CHECKING([for al.exe])
5850     find_winsdk
5851     if test -n "$winsdkbinsubdir" \
5852         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5853     then
5854         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5855     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5856         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5857     elif test -f "$winsdktest/Bin/al.exe"; then
5858         AL_PATH="$winsdktest/Bin"
5859     fi
5861     if test -z "$AL_PATH"; then
5862         find_al
5863         if test -f "$altest/bin/al.exe"; then
5864             AL_PATH="$altest/bin"
5865         elif test -f "$altest/al.exe"; then
5866             AL_PATH="$altest"
5867         fi
5868     fi
5869     if test ! -f "$AL_PATH/al.exe"; then
5870         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5871     else
5872         AC_MSG_RESULT([$AL_PATH/al.exe])
5873     fi
5875     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5877     dnl Check mscoree.lib / .NET Framework dir
5878     AC_MSG_CHECKING(.NET Framework)
5879     find_dotnetsdk46
5880     PathFormat "$frametest"
5881     frametest="$formatted_path"
5882     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5883         DOTNET_FRAMEWORK_HOME="$frametest"
5884     else
5885         find_winsdk
5886         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5887             DOTNET_FRAMEWORK_HOME="$winsdktest"
5888         fi
5889     fi
5890     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
5891         AC_MSG_ERROR([mscoree.lib not found])
5892     fi
5893     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5895     PathFormat "$MIDL_PATH"
5896     MIDL_PATH="$formatted_path"
5898     PathFormat "$AL_PATH"
5899     AL_PATH="$formatted_path"
5901     PathFormat "$DOTNET_FRAMEWORK_HOME"
5902     DOTNET_FRAMEWORK_HOME="$formatted_path"
5904     PathFormat "$CSC_PATH"
5905     CSC_PATH="$formatted_path"
5908 dnl ===================================================================
5909 dnl Check if stdc headers are available excluding MSVC.
5910 dnl ===================================================================
5911 if test "$_os" != "WINNT"; then
5912     AC_HEADER_STDC
5915 dnl ===================================================================
5916 dnl Testing for C++ compiler and version...
5917 dnl ===================================================================
5919 if test "$_os" != "WINNT"; then
5920     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5921     save_CXXFLAGS=$CXXFLAGS
5922     AC_PROG_CXX
5923     CXXFLAGS=$save_CXXFLAGS
5924     if test -z "$CXX_BASE"; then
5925         CXX_BASE=`first_arg_basename "$CXX"`
5926     fi
5929 dnl check for GNU C++ compiler version
5930 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5931     AC_MSG_CHECKING([the GNU C++ compiler version])
5933     _gpp_version=`$CXX -dumpversion`
5934     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5936     if test "$_gpp_majmin" -lt "700"; then
5937         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5938     else
5939         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5940     fi
5942     dnl see https://code.google.com/p/android/issues/detail?id=41770
5943         glibcxx_threads=no
5944         AC_LANG_PUSH([C++])
5945         AC_REQUIRE_CPP
5946         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5947         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5948             #include <bits/c++config.h>]],[[
5949             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5950             && !defined(_GLIBCXX__PTHREADS) \
5951             && !defined(_GLIBCXX_HAS_GTHREADS)
5952             choke me
5953             #endif
5954         ]])],[AC_MSG_RESULT([yes])
5955         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5956         AC_LANG_POP([C++])
5957         if test $glibcxx_threads = yes; then
5958             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5959         fi
5961 AC_SUBST(BOOST_CXXFLAGS)
5964 # prefx CXX with ccache if needed
5966 if test "$CCACHE" != ""; then
5967     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5968     AC_LANG_PUSH([C++])
5969     save_CXXFLAGS=$CXXFLAGS
5970     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5971     dnl an empty program will do, we're checking the compiler flags
5972     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5973                       [use_ccache=yes], [use_ccache=no])
5974     if test $use_ccache = yes; then
5975         AC_MSG_RESULT([yes])
5976     else
5977         CXX="$CCACHE $CXX"
5978         CXX_BASE="ccache $CXX_BASE"
5979         AC_MSG_RESULT([no])
5980     fi
5981     CXXFLAGS=$save_CXXFLAGS
5982     AC_LANG_POP([C++])
5985 dnl ===================================================================
5986 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5987 dnl ===================================================================
5989 if test "$_os" != "WINNT"; then
5990     AC_PROG_CXXCPP
5992     dnl Check whether there's a C pre-processor.
5993     AC_PROG_CPP
5997 dnl ===================================================================
5998 dnl Find integral type sizes and alignments
5999 dnl ===================================================================
6001 if test "$_os" != "WINNT"; then
6003 if test "$_os" = "iOS"; then
6004     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6005     ac_cv_sizeof_long=8
6006     ac_cv_sizeof_short=2
6007     ac_cv_sizeof_int=4
6008     ac_cv_sizeof_long_long=8
6009     ac_cv_sizeof_double=8
6010     ac_cv_sizeof_voidp=8
6011 else
6012     AC_CHECK_SIZEOF(long)
6013     AC_CHECK_SIZEOF(short)
6014     AC_CHECK_SIZEOF(int)
6015     AC_CHECK_SIZEOF(long long)
6016     AC_CHECK_SIZEOF(double)
6017     AC_CHECK_SIZEOF(void*)
6020     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6021     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6022     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6023     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6024     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6026     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6027     m4_pattern_allow([AC_CHECK_ALIGNOF])
6028     m4_ifdef([AC_CHECK_ALIGNOF],
6029         [
6030             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6031             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6032             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6033             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6034         ],
6035         [
6036             case "$_os-$host_cpu" in
6037             Linux-i686)
6038                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6039                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6040                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6041                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6042                 ;;
6043             Linux-x86_64)
6044                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6045                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6046                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6047                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6048                 ;;
6049             *)
6050                 if test -z "$ac_cv_alignof_short" -o \
6051                         -z "$ac_cv_alignof_int" -o \
6052                         -z "$ac_cv_alignof_long" -o \
6053                         -z "$ac_cv_alignof_double"; then
6054                    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.])
6055                 fi
6056                 ;;
6057             esac
6058         ])
6060     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6061     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6062     if test $ac_cv_sizeof_long -eq 8; then
6063         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6064     elif test $ac_cv_sizeof_double -eq 8; then
6065         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6066     else
6067         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6068     fi
6070     dnl Check for large file support
6071     AC_SYS_LARGEFILE
6072     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6073         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6074     fi
6075     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6076         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6077     fi
6078 else
6079     # Hardcode for MSVC
6080     SAL_TYPES_SIZEOFSHORT=2
6081     SAL_TYPES_SIZEOFINT=4
6082     SAL_TYPES_SIZEOFLONG=4
6083     SAL_TYPES_SIZEOFLONGLONG=8
6084     if test "$BITNESS_OVERRIDE" = ""; then
6085         SAL_TYPES_SIZEOFPOINTER=4
6086     else
6087         SAL_TYPES_SIZEOFPOINTER=8
6088     fi
6089     SAL_TYPES_ALIGNMENT2=2
6090     SAL_TYPES_ALIGNMENT4=4
6091     SAL_TYPES_ALIGNMENT8=8
6092     LFS_CFLAGS=''
6094 AC_SUBST(LFS_CFLAGS)
6096 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6097 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6098 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6099 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6100 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6101 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6102 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6103 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6105 dnl ===================================================================
6106 dnl Check whether to enable runtime optimizations
6107 dnl ===================================================================
6108 ENABLE_RUNTIME_OPTIMIZATIONS=
6109 AC_MSG_CHECKING([whether to enable runtime optimizations])
6110 if test -z "$enable_runtime_optimizations"; then
6111     for i in $CC; do
6112         case $i in
6113         -fsanitize=*)
6114             enable_runtime_optimizations=no
6115             break
6116             ;;
6117         esac
6118     done
6120 if test "$enable_runtime_optimizations" != no; then
6121     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6122     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6123     AC_MSG_RESULT([yes])
6124 else
6125     AC_MSG_RESULT([no])
6127 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6129 dnl ===================================================================
6130 dnl Check if valgrind headers are available
6131 dnl ===================================================================
6132 ENABLE_VALGRIND=
6133 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6134     prev_cppflags=$CPPFLAGS
6135     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6136     # or where does it come from?
6137     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6138     AC_CHECK_HEADER([valgrind/valgrind.h],
6139         [ENABLE_VALGRIND=TRUE])
6140     CPPFLAGS=$prev_cppflags
6142 AC_SUBST([ENABLE_VALGRIND])
6143 if test -z "$ENABLE_VALGRIND"; then
6144     if test "$with_valgrind" = yes; then
6145         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6146     fi
6147     VALGRIND_CFLAGS=
6149 AC_SUBST([VALGRIND_CFLAGS])
6152 dnl ===================================================================
6153 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6154 dnl ===================================================================
6156 # We need at least the sys/sdt.h include header.
6157 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6158 if test "$SDT_H_FOUND" = "TRUE"; then
6159     # Found sys/sdt.h header, now make sure the c++ compiler works.
6160     # Old g++ versions had problems with probes in constructors/destructors.
6161     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6162     AC_LANG_PUSH([C++])
6163     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6164     #include <sys/sdt.h>
6165     class ProbeClass
6166     {
6167     private:
6168       int& ref;
6169       const char *name;
6171     public:
6172       ProbeClass(int& v, const char *n) : ref(v), name(n)
6173       {
6174         DTRACE_PROBE2(_test_, cons, name, ref);
6175       }
6177       void method(int min)
6178       {
6179         DTRACE_PROBE3(_test_, meth, name, ref, min);
6180         ref -= min;
6181       }
6183       ~ProbeClass()
6184       {
6185         DTRACE_PROBE2(_test_, dest, name, ref);
6186       }
6187     };
6188     ]],[[
6189     int i = 64;
6190     DTRACE_PROBE1(_test_, call, i);
6191     ProbeClass inst = ProbeClass(i, "call");
6192     inst.method(24);
6193     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6194           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6195     AC_LANG_POP([C++])
6197 AC_CONFIG_HEADERS([config_host/config_probes.h])
6199 dnl ===================================================================
6200 dnl GCC features
6201 dnl ===================================================================
6202 HAVE_GCC_STACK_CLASH_PROTECTION=
6203 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6204     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6205     save_CFLAGS=$CFLAGS
6206     CFLAGS="$CFLAGS -fstack-clash-protection"
6207     AC_LINK_IFELSE(
6208         [AC_LANG_PROGRAM(, [[return 0;]])],
6209         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6210         [AC_MSG_RESULT([no])])
6211     CFLAGS=$save_CFLAGS
6213     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6214     save_CFLAGS=$CFLAGS
6215     CFLAGS="$CFLAGS -Werror -mno-avx"
6216     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6217     CFLAGS=$save_CFLAGS
6218     if test "$HAVE_GCC_AVX" = "TRUE"; then
6219         AC_MSG_RESULT([yes])
6220     else
6221         AC_MSG_RESULT([no])
6222     fi
6224     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6225     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6226     int v = 0;
6227     if (__sync_add_and_fetch(&v, 1) != 1 ||
6228         __sync_sub_and_fetch(&v, 1) != 0)
6229         return 1;
6230     __sync_synchronize();
6231     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6232         v != 1)
6233         return 1;
6234     return 0;
6235 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6236     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6237         AC_MSG_RESULT([yes])
6238         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6239     else
6240         AC_MSG_RESULT([no])
6241     fi
6243     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6244     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6245     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6246         AC_MSG_RESULT([yes])
6247         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6248     else
6249         AC_MSG_RESULT([no])
6250     fi
6252     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6253     save_CFLAGS=$CFLAGS
6254     CFLAGS="$CFLAGS -Werror"
6255     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6256             __attribute__((deprecated("test"))) void f();
6257         ])], [
6258             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6259             AC_MSG_RESULT([yes])
6260         ], [AC_MSG_RESULT([no])])
6261     CFLAGS=$save_CFLAGS
6263     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6264     AC_LANG_PUSH([C++])
6265     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6266             #include <cstddef>
6267             #include <cxxabi.h>
6268             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6269         ])], [
6270             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6271             AC_MSG_RESULT([yes])
6272         ], [AC_MSG_RESULT([no])])
6273     AC_LANG_POP([C++])
6275     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6276     AC_LANG_PUSH([C++])
6277     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6278             #include <cstddef>
6279             #include <cxxabi.h>
6280             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6281         ])], [
6282             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6283             AC_MSG_RESULT([yes])
6284         ], [AC_MSG_RESULT([no])])
6285     AC_LANG_POP([C++])
6287     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6288     AC_LANG_PUSH([C++])
6289     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6290             #include <cxxabi.h>
6291             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6292         ])], [
6293             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6294             AC_MSG_RESULT([yes])
6295         ], [AC_MSG_RESULT([no])])
6296     AC_LANG_POP([C++])
6298     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6299     AC_LANG_PUSH([C++])
6300     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6301             #include <cstddef>
6302             #include <cxxabi.h>
6303             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6304         ])], [
6305             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6306             AC_MSG_RESULT([yes])
6307         ], [AC_MSG_RESULT([no])])
6308     AC_LANG_POP([C++])
6310     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6311     AC_LANG_PUSH([C++])
6312     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6313             #include <cstddef>
6314             #include <cxxabi.h>
6315             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6316         ])], [
6317             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6318             AC_MSG_RESULT([yes])
6319         ], [AC_MSG_RESULT([no])])
6320     AC_LANG_POP([C++])
6322     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6323     AC_LANG_PUSH([C++])
6324     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6325             #include <cxxabi.h>
6326             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6327         ])], [
6328             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6329             AC_MSG_RESULT([yes])
6330         ], [AC_MSG_RESULT([no])])
6331     AC_LANG_POP([C++])
6333     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6334     AC_LANG_PUSH([C++])
6335     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6336             #include <cxxabi.h>
6337             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6338         ])], [
6339             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6340             AC_MSG_RESULT([yes])
6341         ], [AC_MSG_RESULT([no])])
6342     AC_LANG_POP([C++])
6344     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6345     AC_LANG_PUSH([C++])
6346     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6347             #include <cxxabi.h>
6348             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6349         ])], [
6350             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6351             AC_MSG_RESULT([yes])
6352         ], [AC_MSG_RESULT([no])])
6353     AC_LANG_POP([C++])
6355     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6356     AC_LANG_PUSH([C++])
6357     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6358             #include <cstddef>
6359             #include <cxxabi.h>
6360             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6361         ])], [
6362             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6363             AC_MSG_RESULT([yes])
6364         ], [AC_MSG_RESULT([no])])
6365     AC_LANG_POP([C++])
6367     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6368     AC_LANG_PUSH([C++])
6369     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6370             #include <cstddef>
6371             #include <cxxabi.h>
6372             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6373         ])], [
6374             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6375             AC_MSG_RESULT([yes])
6376         ], [AC_MSG_RESULT([no])])
6377     AC_LANG_POP([C++])
6379     dnl Available in GCC 4.9 and at least since Clang 3.4:
6380     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6381     AC_LANG_PUSH([C++])
6382     save_CXXFLAGS=$CXXFLAGS
6383     CXXFLAGS="$CXXFLAGS -Werror"
6384     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6385             struct __attribute__((warn_unused)) dummy {};
6386         ])], [
6387             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6388             AC_MSG_RESULT([yes])
6389         ], [AC_MSG_RESULT([no])])
6390     CXXFLAGS=$save_CXXFLAGS
6391 AC_LANG_POP([C++])
6394 AC_SUBST(HAVE_GCC_AVX)
6395 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6396 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6397 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6399 dnl ===================================================================
6400 dnl Identify the C++ library
6401 dnl ===================================================================
6403 AC_MSG_CHECKING([what the C++ library is])
6404 AC_LANG_PUSH([C++])
6405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6406 #include <utility>
6407 #ifndef __GLIBCXX__
6408 foo bar
6409 #endif
6410 ]])],
6411     [CPP_LIBRARY=GLIBCXX
6412      cpp_library_name="GNU libstdc++"
6413     ],
6414     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6415 #include <utility>
6416 #ifndef _LIBCPP_VERSION
6417 foo bar
6418 #endif
6419 ]])],
6420     [CPP_LIBRARY=LIBCPP
6421      cpp_library_name="LLVM libc++"
6422      AC_DEFINE([HAVE_LIBCXX])
6423     ],
6424     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6425 #include <utility>
6426 #ifndef _MSC_VER
6427 foo bar
6428 #endif
6429 ]])],
6430     [CPP_LIBRARY=MSVCRT
6431      cpp_library_name="Microsoft"
6432     ],
6433     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6434 AC_MSG_RESULT([$cpp_library_name])
6435 AC_LANG_POP([C++])
6437 dnl ===================================================================
6438 dnl Check for gperf
6439 dnl ===================================================================
6440 AC_PATH_PROG(GPERF, gperf)
6441 if test -z "$GPERF"; then
6442     AC_MSG_ERROR([gperf not found but needed. Install it.])
6444 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6445     GPERF=`cygpath -m $GPERF`
6447 AC_MSG_CHECKING([whether gperf is new enough])
6448 my_gperf_ver1=$($GPERF --version | head -n 1)
6449 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6450 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6451 if test "$my_gperf_ver3" -ge 301; then
6452     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6453 else
6454     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6456 AC_SUBST(GPERF)
6458 dnl ===================================================================
6459 dnl Check for system libcmis
6460 dnl ===================================================================
6461 # libcmis requires curl and we can't build curl for iOS
6462 if test $_os != iOS; then
6463     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6464     ENABLE_LIBCMIS=TRUE
6465 else
6466     ENABLE_LIBCMIS=
6468 AC_SUBST(ENABLE_LIBCMIS)
6470 dnl ===================================================================
6471 dnl C++11
6472 dnl ===================================================================
6474 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6475 CXXFLAGS_CXX11=
6476 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6477     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6478 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6479     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6480     for flag in $my_flags; do
6481         if test "$COM" = MSC; then
6482             flag="-Xclang $flag"
6483         fi
6484         save_CXXFLAGS=$CXXFLAGS
6485         CXXFLAGS="$CXXFLAGS $flag -Werror"
6486         if test "$SYSTEM_LIBCMIS" = TRUE; then
6487             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6488         fi
6489         AC_LANG_PUSH([C++])
6490         dnl Clang 3.9 supports __float128 since
6491         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6492         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6493         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6494         dnl $flag is supported below, so check this first):
6495         my_float128hack=
6496         my_float128hack_impl=-D__float128=void
6497         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6498             #include <vector>
6499             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6500             // (__float128)
6501             ]])
6502         ],,[
6503             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6504             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6505             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6506             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6507             dnl place where __float128 is used is in a template specialization, -D__float128=void
6508             dnl will avoid the problem there while still causing a problem if somebody actually uses
6509             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6510             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6511             dnl "fixed" with this hack):
6512             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6513             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6514                 #include <vector>
6515                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6516                 // (__float128)
6517                 ]])
6518             ],[my_float128hack=$my_float128hack_impl])
6519         ])
6520         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6521             #include <algorithm>
6522             #include <functional>
6523             #include <vector>
6525             #if defined SYSTEM_LIBCMIS
6526             // See ucb/source/ucp/cmis/auth_provider.hxx:
6527             #if !defined __clang__
6528             #pragma GCC diagnostic push
6529             #pragma GCC diagnostic ignored "-Wdeprecated"
6530             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6531             #endif
6532             #include <libcmis/libcmis.hxx>
6533             #if !defined __clang__
6534             #pragma GCC diagnostic pop
6535             #endif
6536             #endif
6538             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6539                 std::sort(v.begin(), v.end(), fn);
6540             }
6541             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6542         AC_LANG_POP([C++])
6543         CXXFLAGS=$save_CXXFLAGS
6544         if test -n "$CXXFLAGS_CXX11"; then
6545             break
6546         fi
6547     done
6549 if test -n "$CXXFLAGS_CXX11"; then
6550     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6551 else
6552     AC_MSG_ERROR(no)
6554 AC_SUBST(CXXFLAGS_CXX11)
6556 if test "$GCC" = "yes"; then
6557     save_CXXFLAGS=$CXXFLAGS
6558     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6559     CHECK_L_ATOMIC
6560     CXXFLAGS=$save_CXXFLAGS
6561     AC_SUBST(ATOMIC_LIB)
6564 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6565 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6566 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6567 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6568 dnl again towards 4.7.2:
6569 if test $CPP_LIBRARY = GLIBCXX; then
6570     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6571     AC_LANG_PUSH([C++])
6572     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6573 #include <list>
6574 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6575     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6576     //   GCC 4.7.0: 20120322
6577     //   GCC 4.7.1: 20120614
6578     // and using a range check is not possible as the mapping between
6579     // __GLIBCXX__ values and GCC versions is not monotonic
6580 /* ok */
6581 #else
6582 abi broken
6583 #endif
6584         ]])], [AC_MSG_RESULT(no, ok)],
6585         [AC_MSG_ERROR(yes)])
6586     AC_LANG_POP([C++])
6589 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6590 save_CXXFLAGS=$CXXFLAGS
6591 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6592 AC_LANG_PUSH([C++])
6594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6595 #include <stddef.h>
6597 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6599 namespace
6601         struct b
6602         {
6603                 int i;
6604                 int j;
6605         };
6607 ]], [[
6608 struct a
6610         int i;
6611         int j;
6613 a thinga[]={{0,0}, {1,1}};
6614 b thingb[]={{0,0}, {1,1}};
6615 size_t i = sizeof(sal_n_array_size(thinga));
6616 size_t j = sizeof(sal_n_array_size(thingb));
6617 return !(i != 0 && j != 0);
6619     ], [ AC_MSG_RESULT(yes) ],
6620     [ AC_MSG_ERROR(no)])
6621 AC_LANG_POP([C++])
6622 CXXFLAGS=$save_CXXFLAGS
6624 dnl _Pragma support (may require C++11)
6625 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6626     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6627     AC_LANG_PUSH([C++])
6628     save_CXXFLAGS=$CXXFLAGS
6629     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6630     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6631             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6632         ])], [
6633             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6634             AC_MSG_RESULT([yes])
6635         ], [AC_MSG_RESULT([no])])
6636     AC_LANG_POP([C++])
6637     CXXFLAGS=$save_CXXFLAGS
6640 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6641 if test "$GCC" = yes; then
6642     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6643     AC_LANG_PUSH([C++])
6644     save_CXXFLAGS=$CXXFLAGS
6645     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6646     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6647     CXXFLAGS=$save_CXXFLAGS
6648     AC_LANG_POP([C++])
6649     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6650         AC_MSG_RESULT([yes])
6651     else
6652         AC_MSG_RESULT([no])
6653     fi
6655 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6657 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6658 AC_LANG_PUSH([C++])
6659 save_CXXFLAGS=$CXXFLAGS
6660 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6661 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6662         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6663         // supporting it:
6664         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6665         struct S {
6666         private:
6667             S(S const &);
6668         public:
6669             S();
6670             ~S();
6671         };
6672         S copy();
6673         void f() { S c(copy()); }
6674         #endif
6675     ])], [
6676         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6677         AC_MSG_RESULT([yes])
6678     ], [AC_MSG_RESULT([no])])
6679 CXXFLAGS=$save_CXXFLAGS
6680 AC_LANG_POP([C++])
6682 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6683 AC_LANG_PUSH([C++])
6684 save_CXXFLAGS=$CXXFLAGS
6685 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6686 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6687         #include <algorithm>
6688         #include <initializer_list>
6689         #include <vector>
6690         template<typename T> class S {
6691         private:
6692             std::vector<T> v_;
6693         public:
6694             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6695         };
6696         constinit S<int> s{3, 2, 1};
6697     ])], [
6698         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6699         AC_MSG_RESULT([yes])
6700     ], [AC_MSG_RESULT([no])])
6701 CXXFLAGS=$save_CXXFLAGS
6702 AC_LANG_POP([C++])
6704 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6705 AC_LANG_PUSH([C++])
6706 save_CXXFLAGS=$CXXFLAGS
6707 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6708 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6709         #include <span>
6710         #include <type_traits>
6711         // Don't check size_type directly, as it was called index_type before P1872R0:
6712         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6713     ])], [
6714         AC_DEFINE([HAVE_CPP_SPAN],[1])
6715         AC_MSG_RESULT([yes])
6716     ], [AC_MSG_RESULT([no])])
6717 CXXFLAGS=$save_CXXFLAGS
6718 AC_LANG_POP([C++])
6720 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6721 AC_LANG_PUSH([C++])
6722 save_CXXFLAGS=$CXXFLAGS
6723 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6724 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6725         struct S1 { S1(S1 &&); };
6726         struct S2: S1 {};
6727         S1 f(S2 s) { return s; }
6728     ])], [
6729         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6730         AC_MSG_RESULT([yes])
6731     ], [AC_MSG_RESULT([no])])
6732 CXXFLAGS=$save_CXXFLAGS
6733 AC_LANG_POP([C++])
6735 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6736 dnl uninitialized warning for code like
6738 dnl   OString f();
6739 dnl   boost::optional<OString> * g(bool b) {
6740 dnl       boost::optional<OString> o;
6741 dnl       if (b) o = f();
6742 dnl       return new boost::optional<OString>(o);
6743 dnl   }
6745 dnl (as is e.g. present, in a slightly more elaborate form, in
6746 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6747 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6748 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6749 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6750     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6751     AC_LANG_PUSH([C++])
6752     save_CXXFLAGS=$CXXFLAGS
6753     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6754     if test "$ENABLE_OPTIMIZED" = TRUE; then
6755         CXXFLAGS="$CXXFLAGS -O2"
6756     else
6757         CXXFLAGS="$CXXFLAGS -O0"
6758     fi
6759     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6760             #include <new>
6761             void f1(int);
6762             struct S1 {
6763                 ~S1() { f1(n); }
6764                 int n = 0;
6765             };
6766             struct S2 {
6767                 S2() {}
6768                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6769                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6770                 void set(S1 s) {
6771                     new (stg) S1(s);
6772                     init = true;
6773                 }
6774                 bool init = false;
6775                 char stg[sizeof (S1)];
6776             } ;
6777             S1 f2();
6778             S2 * f3(bool b) {
6779                 S2 o;
6780                 if (b) o.set(f2());
6781                 return new S2(o);
6782             }
6783         ]])], [AC_MSG_RESULT([no])], [
6784             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6785             AC_MSG_RESULT([yes])
6786         ])
6787     CXXFLAGS=$save_CXXFLAGS
6788     AC_LANG_POP([C++])
6790 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6792 dnl ===================================================================
6793 dnl CPU Intrinsics support - SSE, AVX
6794 dnl ===================================================================
6796 CXXFLAGS_INTRINSICS_SSE2=
6797 CXXFLAGS_INTRINSICS_SSSE3=
6798 CXXFLAGS_INTRINSICS_SSE41=
6799 CXXFLAGS_INTRINSICS_SSE42=
6800 CXXFLAGS_INTRINSICS_AVX=
6801 CXXFLAGS_INTRINSICS_AVX2=
6802 CXXFLAGS_INTRINSICS_F16C=
6803 CXXFLAGS_INTRINSICS_FMA=
6805 if test "$GCC" = "yes"; then
6806     flag_sse2=-msse2
6807     flag_ssse3=-mssse3
6808     flag_sse41=-msse4.1
6809     flag_sse42=-msse4.2
6810     flag_avx=-mavx
6811     flag_avx2=-mavx2
6812     flag_f16c=-mf16c
6813     flag_fma=-mfma
6814 else
6815     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6816     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6817     # SSE2 seems to be SSE2+.
6818     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6819     # is not empty (and can be tested in gbuild), moreover we now default to SSE
6820     # for 32bit x86.
6821     flag_sse2=-arch:SSE2
6822     flag_ssse3=-arch:SSE2
6823     flag_sse41=-arch:SSE2
6824     flag_sse42=-arch:SSE2
6825     flag_avx=-arch:AVX
6826     flag_avx2=-arch:AVX2
6827     # These are part of -arch:AVX2
6828     flag_f16c=-arch:AVX2
6829     flag_fma=-arch:AVX2
6832 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6833 AC_LANG_PUSH([C++])
6834 save_CXXFLAGS=$CXXFLAGS
6835 CXXFLAGS="$CXXFLAGS $flag_sse2"
6836 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6837     #include <emmintrin.h>
6838     int main () {
6839         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6840         c = _mm_xor_si128 (a, b);
6841         return 0;
6842     }
6843     ])],
6844     [can_compile_sse2=yes],
6845     [can_compile_sse2=no])
6846 AC_LANG_POP([C++])
6847 CXXFLAGS=$save_CXXFLAGS
6848 AC_MSG_RESULT([${can_compile_sse2}])
6849 if test "${can_compile_sse2}" = "yes" ; then
6850     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6853 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6854 AC_LANG_PUSH([C++])
6855 save_CXXFLAGS=$CXXFLAGS
6856 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6857 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6858     #include <tmmintrin.h>
6859     int main () {
6860         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6861         c = _mm_maddubs_epi16 (a, b);
6862         return 0;
6863     }
6864     ])],
6865     [can_compile_ssse3=yes],
6866     [can_compile_ssse3=no])
6867 AC_LANG_POP([C++])
6868 CXXFLAGS=$save_CXXFLAGS
6869 AC_MSG_RESULT([${can_compile_ssse3}])
6870 if test "${can_compile_ssse3}" = "yes" ; then
6871     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6874 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6875 AC_LANG_PUSH([C++])
6876 save_CXXFLAGS=$CXXFLAGS
6877 CXXFLAGS="$CXXFLAGS $flag_sse41"
6878 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6879     #include <smmintrin.h>
6880     int main () {
6881         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6882         c = _mm_cmpeq_epi64 (a, b);
6883         return 0;
6884     }
6885     ])],
6886     [can_compile_sse41=yes],
6887     [can_compile_sse41=no])
6888 AC_LANG_POP([C++])
6889 CXXFLAGS=$save_CXXFLAGS
6890 AC_MSG_RESULT([${can_compile_sse41}])
6891 if test "${can_compile_sse41}" = "yes" ; then
6892     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6895 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6896 AC_LANG_PUSH([C++])
6897 save_CXXFLAGS=$CXXFLAGS
6898 CXXFLAGS="$CXXFLAGS $flag_sse42"
6899 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6900     #include <nmmintrin.h>
6901     int main () {
6902         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6903         c = _mm_cmpgt_epi64 (a, b);
6904         return 0;
6905     }
6906     ])],
6907     [can_compile_sse42=yes],
6908     [can_compile_sse42=no])
6909 AC_LANG_POP([C++])
6910 CXXFLAGS=$save_CXXFLAGS
6911 AC_MSG_RESULT([${can_compile_sse42}])
6912 if test "${can_compile_sse42}" = "yes" ; then
6913     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
6916 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6917 AC_LANG_PUSH([C++])
6918 save_CXXFLAGS=$CXXFLAGS
6919 CXXFLAGS="$CXXFLAGS $flag_avx"
6920 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6921     #include <immintrin.h>
6922     int main () {
6923         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6924         c = _mm256_xor_ps(a, b);
6925         return 0;
6926     }
6927     ])],
6928     [can_compile_avx=yes],
6929     [can_compile_avx=no])
6930 AC_LANG_POP([C++])
6931 CXXFLAGS=$save_CXXFLAGS
6932 AC_MSG_RESULT([${can_compile_avx}])
6933 if test "${can_compile_avx}" = "yes" ; then
6934     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
6937 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6938 AC_LANG_PUSH([C++])
6939 save_CXXFLAGS=$CXXFLAGS
6940 CXXFLAGS="$CXXFLAGS $flag_avx2"
6941 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6942     #include <immintrin.h>
6943     int main () {
6944         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6945         c = _mm256_maddubs_epi16(a, b);
6946         return 0;
6947     }
6948     ])],
6949     [can_compile_avx2=yes],
6950     [can_compile_avx2=no])
6951 AC_LANG_POP([C++])
6952 CXXFLAGS=$save_CXXFLAGS
6953 AC_MSG_RESULT([${can_compile_avx2}])
6954 if test "${can_compile_avx2}" = "yes" ; then
6955     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
6958 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
6959 AC_LANG_PUSH([C++])
6960 save_CXXFLAGS=$CXXFLAGS
6961 CXXFLAGS="$CXXFLAGS $flag_f16c"
6962 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6963     #include <immintrin.h>
6964     int main () {
6965         __m128i a = _mm_set1_epi32 (0);
6966         __m128 c;
6967         c = _mm_cvtph_ps(a);
6968         return 0;
6969     }
6970     ])],
6971     [can_compile_f16c=yes],
6972     [can_compile_f16c=no])
6973 AC_LANG_POP([C++])
6974 CXXFLAGS=$save_CXXFLAGS
6975 AC_MSG_RESULT([${can_compile_f16c}])
6976 if test "${can_compile_f16c}" = "yes" ; then
6977     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
6980 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
6981 AC_LANG_PUSH([C++])
6982 save_CXXFLAGS=$CXXFLAGS
6983 CXXFLAGS="$CXXFLAGS $flag_fma"
6984 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6985     #include <immintrin.h>
6986     int main () {
6987         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
6988         d = _mm256_fmadd_ps(a, b, c);
6989         return 0;
6990     }
6991     ])],
6992     [can_compile_fma=yes],
6993     [can_compile_fma=no])
6994 AC_LANG_POP([C++])
6995 CXXFLAGS=$save_CXXFLAGS
6996 AC_MSG_RESULT([${can_compile_fma}])
6997 if test "${can_compile_fma}" = "yes" ; then
6998     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7001 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7002 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7003 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7004 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7005 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7006 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7007 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7008 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7010 dnl ===================================================================
7011 dnl system stl sanity tests
7012 dnl ===================================================================
7013 if test "$_os" != "WINNT"; then
7015     AC_LANG_PUSH([C++])
7017     save_CPPFLAGS="$CPPFLAGS"
7018     if test -n "$MACOSX_SDK_PATH"; then
7019         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7020     fi
7022     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7023     # only.
7024     if test "$CPP_LIBRARY" = GLIBCXX; then
7025         dnl gcc#19664, gcc#22482, rhbz#162935
7026         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7027         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7028         AC_MSG_RESULT([$stlvisok])
7029         if test "$stlvisok" = "no"; then
7030             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7031         fi
7032     fi
7034     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7035     # when we don't make any dynamic libraries?
7036     if test "$DISABLE_DYNLOADING" = ""; then
7037         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7038         cat > conftestlib1.cc <<_ACEOF
7039 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7040 struct S2: S1<int> { virtual ~S2(); };
7041 S2::~S2() {}
7042 _ACEOF
7043         cat > conftestlib2.cc <<_ACEOF
7044 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7045 struct S2: S1<int> { virtual ~S2(); };
7046 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7047 _ACEOF
7048         gccvisinlineshiddenok=yes
7049         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7050             gccvisinlineshiddenok=no
7051         else
7052             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7053             dnl known to not work with -z defs (unsetting which makes the test
7054             dnl moot, though):
7055             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7056             if test "$COM_IS_CLANG" = TRUE; then
7057                 for i in $CXX $CXXFLAGS; do
7058                     case $i in
7059                     -fsanitize=*)
7060                         my_linkflagsnoundefs=
7061                         break
7062                         ;;
7063                     esac
7064                 done
7065             fi
7066             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7067                 gccvisinlineshiddenok=no
7068             fi
7069         fi
7071         rm -fr libconftest*
7072         AC_MSG_RESULT([$gccvisinlineshiddenok])
7073         if test "$gccvisinlineshiddenok" = "no"; then
7074             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7075         fi
7076     fi
7078    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7079     cat >visibility.cxx <<_ACEOF
7080 #pragma GCC visibility push(hidden)
7081 struct __attribute__ ((visibility ("default"))) TestStruct {
7082   static void Init();
7084 __attribute__ ((visibility ("default"))) void TestFunc() {
7085   TestStruct::Init();
7087 _ACEOF
7088     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7089         gccvisbroken=yes
7090     else
7091         case "$host_cpu" in
7092         i?86|x86_64)
7093             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7094                 gccvisbroken=no
7095             else
7096                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7097                     gccvisbroken=no
7098                 else
7099                     gccvisbroken=yes
7100                 fi
7101             fi
7102             ;;
7103         *)
7104             gccvisbroken=no
7105             ;;
7106         esac
7107     fi
7108     rm -f visibility.s visibility.cxx
7110     AC_MSG_RESULT([$gccvisbroken])
7111     if test "$gccvisbroken" = "yes"; then
7112         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7113     fi
7115     CPPFLAGS="$save_CPPFLAGS"
7117     AC_LANG_POP([C++])
7120 dnl ===================================================================
7121 dnl  Clang++ tests
7122 dnl ===================================================================
7124 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7125 if test "$GCC" = "yes"; then
7126     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7127     AC_LANG_PUSH([C++])
7128     save_CXXFLAGS=$CXXFLAGS
7129     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7130     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7131     CXXFLAGS=$save_CXXFLAGS
7132     AC_LANG_POP([C++])
7133     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7134         AC_MSG_RESULT([yes])
7135     else
7136         AC_MSG_RESULT([no])
7137     fi
7139 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7141 dnl ===================================================================
7142 dnl Compiler plugins
7143 dnl ===================================================================
7145 COMPILER_PLUGINS=
7146 # currently only Clang
7148 if test "$COM_IS_CLANG" != "TRUE"; then
7149     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7150         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7151         enable_compiler_plugins=no
7152     fi
7155 if test "$COM_IS_CLANG" = "TRUE"; then
7156     if test -n "$enable_compiler_plugins"; then
7157         compiler_plugins="$enable_compiler_plugins"
7158     elif test -n "$ENABLE_DBGUTIL"; then
7159         compiler_plugins=test
7160     else
7161         compiler_plugins=no
7162     fi
7163     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7164         if test "$CLANGVER" -lt 50002; then
7165             if test "$compiler_plugins" = yes; then
7166                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7167             else
7168                 compiler_plugins=no
7169             fi
7170         fi
7171     fi
7172     if test "$compiler_plugins" != "no"; then
7173         dnl The prefix where Clang resides, override to where Clang resides if
7174         dnl using a source build:
7175         if test -z "$CLANGDIR"; then
7176             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7177         fi
7178         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7179         if test -z "$COMPILER_PLUGINS_CXX"; then
7180             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7181         fi
7182         clangbindir=$CLANGDIR/bin
7183         if test "$build_os" = "cygwin"; then
7184             clangbindir=$(cygpath -u "$clangbindir")
7185         fi
7186         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7187         if test -n "$LLVM_CONFIG"; then
7188             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7189             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7190             if test -z "$CLANGLIBDIR"; then
7191                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7192             fi
7193             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7194             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7195             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7196             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7197                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7198             fi
7199             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7200             clangobjdir=$($LLVM_CONFIG --obj-root)
7201             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7202                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7203             fi
7204         fi
7205         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7206         AC_LANG_PUSH([C++])
7207         save_CXX=$CXX
7208         save_CXXCPP=$CXXCPP
7209         save_CPPFLAGS=$CPPFLAGS
7210         save_CXXFLAGS=$CXXFLAGS
7211         save_LDFLAGS=$LDFLAGS
7212         save_LIBS=$LIBS
7213         CXX=$COMPILER_PLUGINS_CXX
7214         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7215         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7216         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7217         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7218             [COMPILER_PLUGINS=TRUE],
7219             [
7220             if test "$compiler_plugins" = "yes"; then
7221                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7222             else
7223                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7224                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7225             fi
7226             ])
7227         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7228         dnl comment in compilerplugins/Makefile-clang.mk:
7229         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7230             LDFLAGS=""
7231             AC_MSG_CHECKING([for clang libraries to use])
7232             if test -z "$CLANGTOOLLIBS"; then
7233                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7234  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7235                 AC_LINK_IFELSE([
7236                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7237                         [[ clang::FullSourceLoc().dump(); ]])
7238                 ],[CLANGTOOLLIBS="$LIBS"],[])
7239             fi
7240             if test -z "$CLANGTOOLLIBS"; then
7241                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7242                 AC_LINK_IFELSE([
7243                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7244                         [[ clang::FullSourceLoc().dump(); ]])
7245                 ],[CLANGTOOLLIBS="$LIBS"],[])
7246             fi
7247             AC_MSG_RESULT([$CLANGTOOLLIBS])
7248             if test -z "$CLANGTOOLLIBS"; then
7249                 if test "$compiler_plugins" = "yes"; then
7250                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7251                 else
7252                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7253                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7254                 fi
7255                 COMPILER_PLUGINS=
7256             fi
7257             if test -n "$COMPILER_PLUGINS"; then
7258                 if test -z "$CLANGSYSINCLUDE"; then
7259                     if test -n "$LLVM_CONFIG"; then
7260                         # Path to the clang system headers (no idea if there's a better way to get it).
7261                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7262                     fi
7263                 fi
7264             fi
7265         fi
7266         CXX=$save_CXX
7267         CXXCPP=$save_CXXCPP
7268         CPPFLAGS=$save_CPPFLAGS
7269         CXXFLAGS=$save_CXXFLAGS
7270         LDFLAGS=$save_LDFLAGS
7271         LIBS="$save_LIBS"
7272         AC_LANG_POP([C++])
7273     fi
7274 else
7275     if test "$enable_compiler_plugins" = "yes"; then
7276         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7277     fi
7279 AC_SUBST(COMPILER_PLUGINS)
7280 AC_SUBST(COMPILER_PLUGINS_CXX)
7281 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7282 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7283 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7284 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7285 AC_SUBST(CLANGDIR)
7286 AC_SUBST(CLANGLIBDIR)
7287 AC_SUBST(CLANGTOOLLIBS)
7288 AC_SUBST(CLANGSYSINCLUDE)
7290 # Plugin to help linker.
7291 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7292 # This makes --enable-lto build with clang work.
7293 AC_SUBST(LD_PLUGIN)
7295 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7296 AC_SUBST(HAVE_POSIX_FALLOCATE)
7298 dnl ===================================================================
7299 dnl Custom build version
7300 dnl ===================================================================
7302 AC_MSG_CHECKING([whether to add custom build version])
7303 if test "$with_build_version" != ""; then
7304     BUILD_VER_STRING=$with_build_version
7305     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7306 else
7307     BUILD_VER_STRING=
7308     AC_MSG_RESULT([no])
7310 AC_SUBST(BUILD_VER_STRING)
7312 JITC_PROCESSOR_TYPE=""
7313 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7314     # IBMs JDK needs this...
7315     JITC_PROCESSOR_TYPE=6
7316     export JITC_PROCESSOR_TYPE
7318 AC_SUBST([JITC_PROCESSOR_TYPE])
7320 # Misc Windows Stuff
7321 AC_ARG_WITH(ucrt-dir,
7322     AS_HELP_STRING([--with-ucrt-dir],
7323         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7324         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7325         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7326             Windows6.1-KB2999226-x64.msu
7327             Windows6.1-KB2999226-x86.msu
7328             Windows8.1-KB2999226-x64.msu
7329             Windows8.1-KB2999226-x86.msu
7330             Windows8-RT-KB2999226-x64.msu
7331             Windows8-RT-KB2999226-x86.msu
7332         A zip archive including those files is available from Microsoft site:
7333         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7335 UCRT_REDISTDIR="$with_ucrt_dir"
7336 if test $_os = "WINNT"; then
7337     find_msvc_x64_dlls
7338     find_msms
7339     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7340     MSVC_DLLS="$msvcdlls"
7341     MSM_PATH=`win_short_path_for_make "$msmdir"`
7342     # MSVC 15.3 changed it to VC141
7343     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7344         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7345     else
7346         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7347     fi
7349     if test "$UCRT_REDISTDIR" = "no"; then
7350         dnl explicitly disabled
7351         UCRT_REDISTDIR=""
7352     else
7353         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7354                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7355                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7356                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7357                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7358                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7359             UCRT_REDISTDIR=""
7360             if test -n "$PKGFORMAT"; then
7361                for i in $PKGFORMAT; do
7362                    case "$i" in
7363                    msi)
7364                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7365                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7366                        ;;
7367                    esac
7368                done
7369             fi
7370         fi
7371     fi
7374 AC_SUBST(UCRT_REDISTDIR)
7375 AC_SUBST(MSVC_DLL_PATH)
7376 AC_SUBST(MSVC_DLLS)
7377 AC_SUBST(MSM_PATH)
7379 dnl ===================================================================
7380 dnl Checks for Java
7381 dnl ===================================================================
7382 if test "$ENABLE_JAVA" != ""; then
7384     # Windows-specific tests
7385     if test "$build_os" = "cygwin"; then
7386         if test "$BITNESS_OVERRIDE" = 64; then
7387             bitness=64
7388         else
7389             bitness=32
7390         fi
7392         if test -z "$with_jdk_home"; then
7393             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7394             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7395             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7396             if test -n "$regvalue"; then
7397                 ver=$regvalue
7398                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7399                 _jdk_home=$regvalue
7400             fi
7401             if test -z "$with_jdk_home"; then
7402                 for ver in 1.8; do
7403                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7404                     if test -n "$regvalue"; then
7405                         _jdk_home=$regvalue
7406                         break
7407                     fi
7408                 done
7409             fi
7410             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7411                 with_jdk_home="$_jdk_home"
7412                 howfound="found automatically"
7413             else
7414                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7415             fi
7416         else
7417             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7418             howfound="you passed"
7419         fi
7420     fi
7422     # 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.
7423     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7424     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7425         with_jdk_home=`/usr/libexec/java_home`
7426     fi
7428     JAVA_HOME=; export JAVA_HOME
7429     if test -z "$with_jdk_home"; then
7430         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7431     else
7432         _java_path="$with_jdk_home/bin/$with_java"
7433         dnl Check if there is a Java interpreter at all.
7434         if test -x "$_java_path"; then
7435             JAVAINTERPRETER=$_java_path
7436         else
7437             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7438         fi
7439     fi
7441     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7442     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7443     dnl loaded by java to run JunitTests:
7444     if test "$build_os" = "cygwin"; then
7445         shortjdkhome=`cygpath -d "$with_jdk_home"`
7446         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
7447             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7448             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7449         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
7450             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7451             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7452         fi
7454         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7455             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7456         fi
7457         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7458     elif test "$cross_compiling" != "yes"; then
7459         case $CPUNAME in
7460             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7461                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7462                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7463                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7464                 fi
7465                 ;;
7466             *) # assumption: everything else 32-bit
7467                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7468                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7469                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7470                 fi
7471                 ;;
7472         esac
7473     fi
7476 dnl ===================================================================
7477 dnl Checks for JDK.
7478 dnl ===================================================================
7480 # Note that JAVA_HOME as for now always means the *build* platform's
7481 # JAVA_HOME. Whether all the complexity here actually is needed any
7482 # more or not, no idea.
7484 if test "$ENABLE_JAVA" != ""; then
7485     _gij_longver=0
7486     AC_MSG_CHECKING([the installed JDK])
7487     if test -n "$JAVAINTERPRETER"; then
7488         dnl java -version sends output to stderr!
7489         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7490             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7491         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7492             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7493         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7494             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7495         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7496             JDK=ibm
7498             dnl IBM JDK specific tests
7499             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7500             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7502             if test "$_jdk_ver" -lt 10800; then
7503                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7504             fi
7506             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7508             if test "$with_jdk_home" = ""; then
7509                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7510 you must use the "--with-jdk-home" configure option explicitly])
7511             fi
7513             JAVA_HOME=$with_jdk_home
7514         else
7515             JDK=sun
7517             dnl Sun JDK specific tests
7518             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7519             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7521             if test "$_jdk_ver" -lt 10800; then
7522                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7523             fi
7524             if test "$_jdk_ver" -gt 10800; then
7525                 JAVA_CLASSPATH_NOT_SET=TRUE
7526             fi
7528             AC_MSG_RESULT([found (JDK $_jdk)])
7529             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7530             if test "$_os" = "WINNT"; then
7531                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7532             fi
7534             # set to limit VM usage for JunitTests
7535             JAVAIFLAGS=-Xmx64M
7536             # set to limit VM usage for javac
7537             JAVAFLAGS=-J-Xmx128M
7538         fi
7539     else
7540         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7541     fi
7542 else
7543     dnl Java disabled
7544     JAVA_HOME=
7545     export JAVA_HOME
7548 dnl ===================================================================
7549 dnl Checks for javac
7550 dnl ===================================================================
7551 if test "$ENABLE_JAVA" != ""; then
7552     javacompiler="javac"
7553     : ${JAVA_SOURCE_VER=8}
7554     : ${JAVA_TARGET_VER=8}
7555     if test -z "$with_jdk_home"; then
7556         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7557     else
7558         _javac_path="$with_jdk_home/bin/$javacompiler"
7559         dnl Check if there is a Java compiler at all.
7560         if test -x "$_javac_path"; then
7561             JAVACOMPILER=$_javac_path
7562         fi
7563     fi
7564     if test -z "$JAVACOMPILER"; then
7565         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7566     fi
7567     if test "$build_os" = "cygwin"; then
7568         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7569             JAVACOMPILER="${JAVACOMPILER}.exe"
7570         fi
7571         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7572     fi
7575 dnl ===================================================================
7576 dnl Checks for javadoc
7577 dnl ===================================================================
7578 if test "$ENABLE_JAVA" != ""; then
7579     if test -z "$with_jdk_home"; then
7580         AC_PATH_PROG(JAVADOC, javadoc)
7581     else
7582         _javadoc_path="$with_jdk_home/bin/javadoc"
7583         dnl Check if there is a javadoc at all.
7584         if test -x "$_javadoc_path"; then
7585             JAVADOC=$_javadoc_path
7586         else
7587             AC_PATH_PROG(JAVADOC, javadoc)
7588         fi
7589     fi
7590     if test -z "$JAVADOC"; then
7591         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7592     fi
7593     if test "$build_os" = "cygwin"; then
7594         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7595             JAVADOC="${JAVADOC}.exe"
7596         fi
7597         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7598     fi
7600     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7601     JAVADOCISGJDOC="yes"
7602     fi
7604 AC_SUBST(JAVADOCISGJDOC)
7606 if test "$ENABLE_JAVA" != ""; then
7607     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7608     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7609         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7610            # try to recover first by looking whether we have an alternative
7611            # system as in Debian or newer SuSEs where following /usr/bin/javac
7612            # over /etc/alternatives/javac leads to the right bindir where we
7613            # just need to strip a bit away to get a valid JAVA_HOME
7614            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7615         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7616             # maybe only one level of symlink (e.g. on Mac)
7617             JAVA_HOME=$(readlink $JAVACOMPILER)
7618             if test "$(dirname $JAVA_HOME)" = "."; then
7619                 # we've got no path to trim back
7620                 JAVA_HOME=""
7621             fi
7622         else
7623             # else warn
7624             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7625             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7626             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7627             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7628         fi
7629         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7630         if test "$JAVA_HOME" != "/usr"; then
7631             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7632                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7633                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7634                 dnl Tiger already returns a JDK path...
7635                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7636             else
7637                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7638                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7639                 dnl that checks which version to run
7640                 if test -f "$JAVA_HOME"; then
7641                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7642                 fi
7643             fi
7644         fi
7645     fi
7646     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7648     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7649     if test -z "$JAVA_HOME"; then
7650         if test "x$with_jdk_home" = "x"; then
7651             cat > findhome.java <<_ACEOF
7652 [import java.io.File;
7654 class findhome
7656     public static void main(String args[])
7657     {
7658         String jrelocation = System.getProperty("java.home");
7659         File jre = new File(jrelocation);
7660         System.out.println(jre.getParent());
7661     }
7663 _ACEOF
7664             AC_MSG_CHECKING([if javac works])
7665             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7666             AC_TRY_EVAL(javac_cmd)
7667             if test $? = 0 -a -f ./findhome.class; then
7668                 AC_MSG_RESULT([javac works])
7669             else
7670                 echo "configure: javac test failed" >&5
7671                 cat findhome.java >&5
7672                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7673             fi
7674             AC_MSG_CHECKING([if gij knows its java.home])
7675             JAVA_HOME=`$JAVAINTERPRETER findhome`
7676             if test $? = 0 -a "$JAVA_HOME" != ""; then
7677                 AC_MSG_RESULT([$JAVA_HOME])
7678             else
7679                 echo "configure: java test failed" >&5
7680                 cat findhome.java >&5
7681                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7682             fi
7683             # clean-up after ourselves
7684             rm -f ./findhome.java ./findhome.class
7685         else
7686             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7687         fi
7688     fi
7690     # now check if $JAVA_HOME is really valid
7691     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7692         case "${JAVA_HOME}" in
7693             /Library/Java/JavaVirtualMachines/*)
7694                 ;;
7695             *)
7696                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7697                 ;;
7698         esac
7699         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7700             JAVA_HOME_OK="NO"
7701         fi
7702     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7703         JAVA_HOME_OK="NO"
7704     fi
7705     if test "$JAVA_HOME_OK" = "NO"; then
7706         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7707         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7708         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7709         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7710         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7711         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7712     fi
7713     PathFormat "$JAVA_HOME"
7714     JAVA_HOME="$formatted_path"
7717 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7718     "$_os" != Darwin
7719 then
7720     AC_MSG_CHECKING([for JAWT lib])
7721     if test "$_os" = WINNT; then
7722         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7723         JAWTLIB=jawt.lib
7724     else
7725         case "$host_cpu" in
7726         arm*)
7727             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7728             JAVA_ARCH=$my_java_arch
7729             ;;
7730         i*86)
7731             my_java_arch=i386
7732             ;;
7733         m68k)
7734             my_java_arch=m68k
7735             ;;
7736         powerpc)
7737             my_java_arch=ppc
7738             ;;
7739         powerpc64)
7740             my_java_arch=ppc64
7741             ;;
7742         powerpc64le)
7743             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7744             JAVA_ARCH=$my_java_arch
7745             ;;
7746         sparc64)
7747             my_java_arch=sparcv9
7748             ;;
7749         x86_64)
7750             my_java_arch=amd64
7751             ;;
7752         *)
7753             my_java_arch=$host_cpu
7754             ;;
7755         esac
7756         # This is where JDK9 puts the library
7757         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7758             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7759         else
7760             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7761         fi
7762         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7763     fi
7764     AC_MSG_RESULT([$JAWTLIB])
7766 AC_SUBST(JAWTLIB)
7768 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7769     case "$host_os" in
7771     aix*)
7772         JAVAINC="-I$JAVA_HOME/include"
7773         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7774         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7775         ;;
7777     cygwin*)
7778         JAVAINC="-I$JAVA_HOME/include/win32"
7779         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7780         ;;
7782     darwin*)
7783         if test -d "$JAVA_HOME/include/darwin"; then
7784             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7785         else
7786             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7787         fi
7788         ;;
7790     dragonfly*)
7791         JAVAINC="-I$JAVA_HOME/include"
7792         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7793         ;;
7795     freebsd*)
7796         JAVAINC="-I$JAVA_HOME/include"
7797         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7798         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7799         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7800         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7801         ;;
7803     k*bsd*-gnu*)
7804         JAVAINC="-I$JAVA_HOME/include"
7805         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7806         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7807         ;;
7809     linux-gnu*)
7810         JAVAINC="-I$JAVA_HOME/include"
7811         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7812         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7813         ;;
7815     *netbsd*)
7816         JAVAINC="-I$JAVA_HOME/include"
7817         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7818         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7819        ;;
7821     openbsd*)
7822         JAVAINC="-I$JAVA_HOME/include"
7823         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7824         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7825         ;;
7827     solaris*)
7828         JAVAINC="-I$JAVA_HOME/include"
7829         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7830         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7831         ;;
7832     esac
7834 SOLARINC="$SOLARINC $JAVAINC"
7836 AC_SUBST(JAVACOMPILER)
7837 AC_SUBST(JAVADOC)
7838 AC_SUBST(JAVAINTERPRETER)
7839 AC_SUBST(JAVAIFLAGS)
7840 AC_SUBST(JAVAFLAGS)
7841 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7842 AC_SUBST(JAVA_HOME)
7843 AC_SUBST(JAVA_SOURCE_VER)
7844 AC_SUBST(JAVA_TARGET_VER)
7845 AC_SUBST(JDK)
7848 dnl ===================================================================
7849 dnl Export file validation
7850 dnl ===================================================================
7851 AC_MSG_CHECKING([whether to enable export file validation])
7852 if test "$with_export_validation" != "no"; then
7853     if test -z "$ENABLE_JAVA"; then
7854         if test "$with_export_validation" = "yes"; then
7855             AC_MSG_ERROR([requested, but Java is disabled])
7856         else
7857             AC_MSG_RESULT([no, as Java is disabled])
7858         fi
7859     elif ! test -d "${SRC_ROOT}/schema"; then
7860         if test "$with_export_validation" = "yes"; then
7861             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7862         else
7863             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7864         fi
7865     else
7866         AC_MSG_RESULT([yes])
7867         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7869         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7870         if test -z "$ODFVALIDATOR"; then
7871             # remember to download the ODF toolkit with validator later
7872             AC_MSG_NOTICE([no odfvalidator found, will download it])
7873             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7874             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7876             # and fetch name of odfvalidator jar name from download.lst
7877             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7878             AC_SUBST(ODFVALIDATOR_JAR)
7880             if test -z "$ODFVALIDATOR_JAR"; then
7881                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7882             fi
7883         fi
7884         if test "$build_os" = "cygwin"; then
7885             # In case of Cygwin it will be executed from Windows,
7886             # so we need to run bash and absolute path to validator
7887             # so instead of "odfvalidator" it will be
7888             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7889             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7890         else
7891             ODFVALIDATOR="sh $ODFVALIDATOR"
7892         fi
7893         AC_SUBST(ODFVALIDATOR)
7896         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7897         if test -z "$OFFICEOTRON"; then
7898             # remember to download the officeotron with validator later
7899             AC_MSG_NOTICE([no officeotron found, will download it])
7900             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7901             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7903             # and fetch name of officeotron jar name from download.lst
7904             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7905             AC_SUBST(OFFICEOTRON_JAR)
7907             if test -z "$OFFICEOTRON_JAR"; then
7908                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7909             fi
7910         else
7911             # check version of existing officeotron
7912             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7913             if test 0"$OFFICEOTRON_VER" -lt 704; then
7914                 AC_MSG_ERROR([officeotron too old])
7915             fi
7916         fi
7917         if test "$build_os" = "cygwin"; then
7918             # In case of Cygwin it will be executed from Windows,
7919             # so we need to run bash and absolute path to validator
7920             # so instead of "odfvalidator" it will be
7921             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7922             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7923         else
7924             OFFICEOTRON="sh $OFFICEOTRON"
7925         fi
7926     fi
7927     AC_SUBST(OFFICEOTRON)
7928 else
7929     AC_MSG_RESULT([no])
7932 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7933 if test "$with_bffvalidator" != "no"; then
7934     AC_DEFINE(HAVE_BFFVALIDATOR)
7936     if test "$with_export_validation" = "no"; then
7937         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7938     fi
7940     if test "$with_bffvalidator" = "yes"; then
7941         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7942     else
7943         BFFVALIDATOR="$with_bffvalidator"
7944     fi
7946     if test "$build_os" = "cygwin"; then
7947         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7948             AC_MSG_RESULT($BFFVALIDATOR)
7949         else
7950             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7951         fi
7952     elif test -n "$BFFVALIDATOR"; then
7953         # We are not in Cygwin but need to run Windows binary with wine
7954         AC_PATH_PROGS(WINE, wine)
7956         # so swap in a shell wrapper that converts paths transparently
7957         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7958         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7959         AC_SUBST(BFFVALIDATOR_EXE)
7960         AC_MSG_RESULT($BFFVALIDATOR)
7961     else
7962         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7963     fi
7964     AC_SUBST(BFFVALIDATOR)
7965 else
7966     AC_MSG_RESULT([no])
7969 dnl ===================================================================
7970 dnl Check for C preprocessor to use
7971 dnl ===================================================================
7972 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7973 if test -n "$with_idlc_cpp"; then
7974     AC_MSG_RESULT([$with_idlc_cpp])
7975     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7976 else
7977     AC_MSG_RESULT([ucpp])
7978     AC_MSG_CHECKING([which ucpp tp use])
7979     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7980         AC_MSG_RESULT([external])
7981         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7982     else
7983         AC_MSG_RESULT([internal])
7984         BUILD_TYPE="$BUILD_TYPE UCPP"
7985     fi
7987 AC_SUBST(SYSTEM_UCPP)
7989 dnl ===================================================================
7990 dnl Check for epm (not needed for Windows)
7991 dnl ===================================================================
7992 AC_MSG_CHECKING([whether to enable EPM for packing])
7993 if test "$enable_epm" = "yes"; then
7994     AC_MSG_RESULT([yes])
7995     if test "$_os" != "WINNT"; then
7996         if test $_os = Darwin; then
7997             EPM=internal
7998         elif test -n "$with_epm"; then
7999             EPM=$with_epm
8000         else
8001             AC_PATH_PROG(EPM, epm, no)
8002         fi
8003         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8004             AC_MSG_NOTICE([EPM will be built.])
8005             BUILD_TYPE="$BUILD_TYPE EPM"
8006             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8007         else
8008             # Gentoo has some epm which is something different...
8009             AC_MSG_CHECKING([whether the found epm is the right epm])
8010             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8011                 AC_MSG_RESULT([yes])
8012             else
8013                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8014             fi
8015             AC_MSG_CHECKING([epm version])
8016             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8017             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8018                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8019                 AC_MSG_RESULT([OK, >= 3.7])
8020             else
8021                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8022                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8023             fi
8024         fi
8025     fi
8027     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8028         AC_MSG_CHECKING([for rpm])
8029         for a in "$RPM" rpmbuild rpm; do
8030             $a --usage >/dev/null 2> /dev/null
8031             if test $? -eq 0; then
8032                 RPM=$a
8033                 break
8034             else
8035                 $a --version >/dev/null 2> /dev/null
8036                 if test $? -eq 0; then
8037                     RPM=$a
8038                     break
8039                 fi
8040             fi
8041         done
8042         if test -z "$RPM"; then
8043             AC_MSG_ERROR([not found])
8044         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8045             RPM_PATH=`which $RPM`
8046             AC_MSG_RESULT([$RPM_PATH])
8047             SCPDEFS="$SCPDEFS -DWITH_RPM"
8048         else
8049             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8050         fi
8051     fi
8052     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8053         AC_PATH_PROG(DPKG, dpkg, no)
8054         if test "$DPKG" = "no"; then
8055             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8056         fi
8057     fi
8058     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8059        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8060         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8061             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8062                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8063                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8064                     AC_MSG_RESULT([yes])
8065                 else
8066                     AC_MSG_RESULT([no])
8067                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8068                         _pt="rpm"
8069                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8070                         add_warning "the rpms will need to be installed with --nodeps"
8071                     else
8072                         _pt="pkg"
8073                     fi
8074                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8075                     add_warning "the ${_pt}s will not be relocatable"
8076                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8077                                  relocation will work, you need to patch your epm with the
8078                                  patch in epm/epm-3.7.patch or build with
8079                                  --with-epm=internal which will build a suitable epm])
8080                 fi
8081             fi
8082         fi
8083     fi
8084     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8085         AC_PATH_PROG(PKGMK, pkgmk, no)
8086         if test "$PKGMK" = "no"; then
8087             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8088         fi
8089     fi
8090     AC_SUBST(RPM)
8091     AC_SUBST(DPKG)
8092     AC_SUBST(PKGMK)
8093 else
8094     for i in $PKGFORMAT; do
8095         case "$i" in
8096         aix | bsd | deb | pkg | rpm | native | portable)
8097             AC_MSG_ERROR(
8098                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8099             ;;
8100         esac
8101     done
8102     AC_MSG_RESULT([no])
8103     EPM=NO
8105 AC_SUBST(EPM)
8107 ENABLE_LWP=
8108 if test "$enable_lotuswordpro" = "yes"; then
8109     ENABLE_LWP="TRUE"
8111 AC_SUBST(ENABLE_LWP)
8113 dnl ===================================================================
8114 dnl Check for building ODK
8115 dnl ===================================================================
8116 if test "$enable_odk" = no; then
8117     unset DOXYGEN
8118 else
8119     if test "$with_doxygen" = no; then
8120         AC_MSG_CHECKING([for doxygen])
8121         unset DOXYGEN
8122         AC_MSG_RESULT([no])
8123     else
8124         if test "$with_doxygen" = yes; then
8125             AC_PATH_PROG([DOXYGEN], [doxygen])
8126             if test -z "$DOXYGEN"; then
8127                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8128             fi
8129             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8130                 if ! dot -V 2>/dev/null; then
8131                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8132                 fi
8133             fi
8134         else
8135             AC_MSG_CHECKING([for doxygen])
8136             DOXYGEN=$with_doxygen
8137             AC_MSG_RESULT([$DOXYGEN])
8138         fi
8139         if test -n "$DOXYGEN"; then
8140             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8141             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8142             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8143                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8144             fi
8145         fi
8146     fi
8148 AC_SUBST([DOXYGEN])
8150 AC_MSG_CHECKING([whether to build the ODK])
8151 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8152     AC_MSG_RESULT([yes])
8154     if test "$with_java" != "no"; then
8155         AC_MSG_CHECKING([whether to build unowinreg.dll])
8156         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8157             # build on Win by default
8158             enable_build_unowinreg=yes
8159         fi
8160         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8161             AC_MSG_RESULT([no])
8162             BUILD_UNOWINREG=
8163         else
8164             AC_MSG_RESULT([yes])
8165             BUILD_UNOWINREG=TRUE
8166         fi
8167         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8168             if test -z "$with_mingw_cross_compiler"; then
8169                 dnl Guess...
8170                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8171             elif test -x "$with_mingw_cross_compiler"; then
8172                  MINGWCXX="$with_mingw_cross_compiler"
8173             else
8174                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8175             fi
8177             if test "$MINGWCXX" = "false"; then
8178                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8179             fi
8181             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8182             if test -x "$mingwstrip_test"; then
8183                 MINGWSTRIP="$mingwstrip_test"
8184             else
8185                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8186             fi
8188             if test "$MINGWSTRIP" = "false"; then
8189                 AC_MSG_ERROR(MinGW32 binutils not found.)
8190             fi
8191         fi
8192     fi
8193     BUILD_TYPE="$BUILD_TYPE ODK"
8194 else
8195     AC_MSG_RESULT([no])
8196     BUILD_UNOWINREG=
8198 AC_SUBST(BUILD_UNOWINREG)
8199 AC_SUBST(MINGWCXX)
8200 AC_SUBST(MINGWSTRIP)
8202 dnl ===================================================================
8203 dnl Check for system zlib
8204 dnl ===================================================================
8205 if test "$with_system_zlib" = "auto"; then
8206     case "$_os" in
8207     WINNT)
8208         with_system_zlib="$with_system_libs"
8209         ;;
8210     *)
8211         if test "$enable_fuzzers" != "yes"; then
8212             with_system_zlib=yes
8213         else
8214             with_system_zlib=no
8215         fi
8216         ;;
8217     esac
8220 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8221 dnl and has no pkg-config for it at least on some tinderboxes,
8222 dnl so leaving that out for now
8223 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8224 AC_MSG_CHECKING([which zlib to use])
8225 if test "$with_system_zlib" = "yes"; then
8226     AC_MSG_RESULT([external])
8227     SYSTEM_ZLIB=TRUE
8228     AC_CHECK_HEADER(zlib.h, [],
8229         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8230     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8231         [AC_MSG_ERROR(zlib not found or functional)], [])
8232 else
8233     AC_MSG_RESULT([internal])
8234     SYSTEM_ZLIB=
8235     BUILD_TYPE="$BUILD_TYPE ZLIB"
8236     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8237     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8239 AC_SUBST(ZLIB_CFLAGS)
8240 AC_SUBST(ZLIB_LIBS)
8241 AC_SUBST(SYSTEM_ZLIB)
8243 dnl ===================================================================
8244 dnl Check for system jpeg
8245 dnl ===================================================================
8246 AC_MSG_CHECKING([which libjpeg to use])
8247 if test "$with_system_jpeg" = "yes"; then
8248     AC_MSG_RESULT([external])
8249     SYSTEM_LIBJPEG=TRUE
8250     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8251         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8252     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8253         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8254 else
8255     SYSTEM_LIBJPEG=
8256     AC_MSG_RESULT([internal, libjpeg-turbo])
8257     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8258     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8259     if test "$COM" = "MSC"; then
8260         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8261     else
8262         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8263     fi
8265     case "$host_cpu" in
8266     x86_64 | amd64 | i*86 | x86 | ia32)
8267         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8268         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8269             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8270                 NASM="$LODE_HOME/opt/bin/nasm"
8271             elif test -x "/opt/lo/bin/nasm"; then
8272                 NASM="/opt/lo/bin/nasm"
8273             fi
8274         fi
8276         if test -n "$NASM"; then
8277             AC_MSG_CHECKING([for object file format of host system])
8278             case "$host_os" in
8279               cygwin* | mingw* | pw32* | interix*)
8280                 case "$host_cpu" in
8281                   x86_64)
8282                     objfmt='Win64-COFF'
8283                     ;;
8284                   *)
8285                     objfmt='Win32-COFF'
8286                     ;;
8287                 esac
8288               ;;
8289               msdosdjgpp* | go32*)
8290                 objfmt='COFF'
8291               ;;
8292               os2-emx*) # not tested
8293                 objfmt='MSOMF' # obj
8294               ;;
8295               linux*coff* | linux*oldld*)
8296                 objfmt='COFF' # ???
8297               ;;
8298               linux*aout*)
8299                 objfmt='a.out'
8300               ;;
8301               linux*)
8302                 case "$host_cpu" in
8303                   x86_64)
8304                     objfmt='ELF64'
8305                     ;;
8306                   *)
8307                     objfmt='ELF'
8308                     ;;
8309                 esac
8310               ;;
8311               kfreebsd* | freebsd* | netbsd* | openbsd*)
8312                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8313                   objfmt='BSD-a.out'
8314                 else
8315                   case "$host_cpu" in
8316                     x86_64 | amd64)
8317                       objfmt='ELF64'
8318                       ;;
8319                     *)
8320                       objfmt='ELF'
8321                       ;;
8322                   esac
8323                 fi
8324               ;;
8325               solaris* | sunos* | sysv* | sco*)
8326                 case "$host_cpu" in
8327                   x86_64)
8328                     objfmt='ELF64'
8329                     ;;
8330                   *)
8331                     objfmt='ELF'
8332                     ;;
8333                 esac
8334               ;;
8335               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8336                 case "$host_cpu" in
8337                   x86_64)
8338                     objfmt='Mach-O64'
8339                     ;;
8340                   *)
8341                     objfmt='Mach-O'
8342                     ;;
8343                 esac
8344               ;;
8345               *)
8346                 objfmt='ELF ?'
8347               ;;
8348             esac
8350             AC_MSG_RESULT([$objfmt])
8351             if test "$objfmt" = 'ELF ?'; then
8352               objfmt='ELF'
8353               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8354             fi
8356             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8357             case "$objfmt" in
8358               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8359               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8360               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8361               COFF)       NAFLAGS='-fcoff -DCOFF';;
8362               a.out)      NAFLAGS='-faout -DAOUT';;
8363               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8364               ELF)        NAFLAGS='-felf -DELF';;
8365               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8366               RDF)        NAFLAGS='-frdf -DRDF';;
8367               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8368               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8369             esac
8370             AC_MSG_RESULT([$NAFLAGS])
8372             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8373             cat > conftest.asm << EOF
8374             [%line __oline__ "configure"
8375                     section .text
8376                     global  _main,main
8377             _main:
8378             main:   xor     eax,eax
8379                     ret
8380             ]
8382             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8383             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8384               AC_MSG_RESULT(yes)
8385             else
8386               echo "configure: failed program was:" >&AC_FD_CC
8387               cat conftest.asm >&AC_FD_CC
8388               rm -rf conftest*
8389               AC_MSG_RESULT(no)
8390               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8391               NASM=""
8392             fi
8394         fi
8396         if test -z "$NASM"; then
8397 cat << _EOS
8398 ****************************************************************************
8399 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8400 To get one please:
8402 _EOS
8403             if test "$build_os" = "cygwin"; then
8404 cat << _EOS
8405 install a pre-compiled binary for Win32
8407 mkdir -p /opt/lo/bin
8408 cd /opt/lo/bin
8409 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8410 chmod +x nasm
8412 or get and install one from http://www.nasm.us/
8414 Then re-run autogen.sh
8416 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8417 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8419 _EOS
8420             else
8421 cat << _EOS
8422 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8424 _EOS
8425             fi
8426             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8427             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8428         fi
8429       ;;
8430     esac
8433 AC_SUBST(NASM)
8434 AC_SUBST(LIBJPEG_CFLAGS)
8435 AC_SUBST(LIBJPEG_LIBS)
8436 AC_SUBST(SYSTEM_LIBJPEG)
8438 dnl ===================================================================
8439 dnl Check for system clucene
8440 dnl ===================================================================
8441 dnl we should rather be using
8442 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8443 dnl but the contribs-lib check seems tricky
8444 AC_MSG_CHECKING([which clucene to use])
8445 if test "$with_system_clucene" = "yes"; then
8446     AC_MSG_RESULT([external])
8447     SYSTEM_CLUCENE=TRUE
8448     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8449     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8450     FilterLibs "${CLUCENE_LIBS}"
8451     CLUCENE_LIBS="${filteredlibs}"
8452     AC_LANG_PUSH([C++])
8453     save_CXXFLAGS=$CXXFLAGS
8454     save_CPPFLAGS=$CPPFLAGS
8455     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8456     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8457     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8458     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8459     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8460                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8461     CXXFLAGS=$save_CXXFLAGS
8462     CPPFLAGS=$save_CPPFLAGS
8463     AC_LANG_POP([C++])
8465     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8466 else
8467     AC_MSG_RESULT([internal])
8468     SYSTEM_CLUCENE=
8469     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8471 AC_SUBST(SYSTEM_CLUCENE)
8472 AC_SUBST(CLUCENE_CFLAGS)
8473 AC_SUBST(CLUCENE_LIBS)
8475 dnl ===================================================================
8476 dnl Check for system expat
8477 dnl ===================================================================
8478 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8480 dnl ===================================================================
8481 dnl Check for system xmlsec
8482 dnl ===================================================================
8483 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8485 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8486 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8487     ENABLE_EOT="TRUE"
8488     AC_DEFINE([ENABLE_EOT])
8489     AC_MSG_RESULT([yes])
8491     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8492 else
8493     ENABLE_EOT=
8494     AC_MSG_RESULT([no])
8496 AC_SUBST([ENABLE_EOT])
8498 dnl ===================================================================
8499 dnl Check for DLP libs
8500 dnl ===================================================================
8501 AS_IF([test "$COM" = "MSC"],
8502       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8503       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8505 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8507 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8509 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8511 AS_IF([test "$COM" = "MSC"],
8512       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8513       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8515 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8517 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8519 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8520 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8522 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8524 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8526 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8528 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8529 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8531 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8532 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8534 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8536 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8537 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8539 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8541 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8543 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8545 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8547 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8548 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8550 dnl ===================================================================
8551 dnl Check for system lcms2
8552 dnl ===================================================================
8553 if test "$with_system_lcms2" != "yes"; then
8554     SYSTEM_LCMS2=
8556 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8557 if test "$GCC" = "yes"; then
8558     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8560 if test "$COM" = "MSC"; then # override the above
8561     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8564 dnl ===================================================================
8565 dnl Check for system cppunit
8566 dnl ===================================================================
8567 if test "$_os" != "Android" ; then
8568     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8571 dnl ===================================================================
8572 dnl Check whether freetype is available
8573 dnl ===================================================================
8574 if test  "$test_freetype" = "yes"; then
8575     AC_MSG_CHECKING([whether freetype is available])
8576     # FreeType has 3 different kinds of versions
8577     # * release, like 2.4.10
8578     # * libtool, like 13.0.7 (this what pkg-config returns)
8579     # * soname
8580     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8581     #
8582     # 9.9.3 is 2.2.0
8583     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8584     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8585     FilterLibs "${FREETYPE_LIBS}"
8586     FREETYPE_LIBS="${filteredlibs}"
8587     SYSTEM_FREETYPE=TRUE
8588 else
8589     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8590     if test "x$ac_config_site_64bit_host" = xYES; then
8591         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8592     else
8593         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8594     fi
8596 AC_SUBST(FREETYPE_CFLAGS)
8597 AC_SUBST(FREETYPE_LIBS)
8598 AC_SUBST([SYSTEM_FREETYPE])
8600 # ===================================================================
8601 # Check for system libxslt
8602 # to prevent incompatibilities between internal libxml2 and external libxslt,
8603 # or vice versa, use with_system_libxml here
8604 # ===================================================================
8605 if test "$with_system_libxml" = "auto"; then
8606     case "$_os" in
8607     WINNT|iOS|Android)
8608         with_system_libxml="$with_system_libs"
8609         ;;
8610     *)
8611         if test "$enable_fuzzers" != "yes"; then
8612             with_system_libxml=yes
8613         else
8614             with_system_libxml=no
8615         fi
8616         ;;
8617     esac
8620 AC_MSG_CHECKING([which libxslt to use])
8621 if test "$with_system_libxml" = "yes"; then
8622     AC_MSG_RESULT([external])
8623     SYSTEM_LIBXSLT=TRUE
8624     if test "$_os" = "Darwin"; then
8625         dnl make sure to use SDK path
8626         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8627         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8628         dnl omit -L/usr/lib
8629         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8630         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8631     else
8632         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8633         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8634         FilterLibs "${LIBXSLT_LIBS}"
8635         LIBXSLT_LIBS="${filteredlibs}"
8636         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8637         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8638         FilterLibs "${LIBEXSLT_LIBS}"
8639         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8640     fi
8642     dnl Check for xsltproc
8643     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8644     if test "$XSLTPROC" = "no"; then
8645         AC_MSG_ERROR([xsltproc is required])
8646     fi
8647 else
8648     AC_MSG_RESULT([internal])
8649     SYSTEM_LIBXSLT=
8650     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8652     if test "$cross_compiling" = "yes"; then
8653         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8654         if test "$XSLTPROC" = "no"; then
8655             AC_MSG_ERROR([xsltproc is required])
8656         fi
8657     fi
8659 AC_SUBST(SYSTEM_LIBXSLT)
8660 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8661     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8663 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8665 AC_SUBST(LIBEXSLT_CFLAGS)
8666 AC_SUBST(LIBEXSLT_LIBS)
8667 AC_SUBST(LIBXSLT_CFLAGS)
8668 AC_SUBST(LIBXSLT_LIBS)
8669 AC_SUBST(XSLTPROC)
8671 # ===================================================================
8672 # Check for system libxml
8673 # ===================================================================
8674 AC_MSG_CHECKING([which libxml to use])
8675 if test "$with_system_libxml" = "yes"; then
8676     AC_MSG_RESULT([external])
8677     SYSTEM_LIBXML=TRUE
8678     if test "$_os" = "Darwin"; then
8679         dnl make sure to use SDK path
8680         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8681         dnl omit -L/usr/lib
8682         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8683     elif test $_os = iOS; then
8684         dnl make sure to use SDK path
8685         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8686         LIBXML_CFLAGS="-I$usr/include/libxml2"
8687         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8688     else
8689         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8690         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8691         FilterLibs "${LIBXML_LIBS}"
8692         LIBXML_LIBS="${filteredlibs}"
8693     fi
8695     dnl Check for xmllint
8696     AC_PATH_PROG(XMLLINT, xmllint, no)
8697     if test "$XMLLINT" = "no"; then
8698         AC_MSG_ERROR([xmllint is required])
8699     fi
8700 else
8701     AC_MSG_RESULT([internal])
8702     SYSTEM_LIBXML=
8703     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8704     if test "$COM" = "MSC"; then
8705         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8706     fi
8707     if test "$COM" = "MSC"; then
8708         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8709     else
8710         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8711     fi
8712     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8714 AC_SUBST(SYSTEM_LIBXML)
8715 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8716     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8718 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8719 AC_SUBST(LIBXML_CFLAGS)
8720 AC_SUBST(LIBXML_LIBS)
8721 AC_SUBST(XMLLINT)
8723 # =====================================================================
8724 # Checking for a Python interpreter with version >= 2.7.
8725 # Build and runtime requires Python 3 compatible version (>= 2.7).
8726 # Optionally user can pass an option to configure, i. e.
8727 # ./configure PYTHON=/usr/bin/python
8728 # =====================================================================
8729 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8730     if test -n "$PYTHON"; then
8731         PYTHON_FOR_BUILD=$PYTHON
8732     else
8733         # This allows a lack of system python with no error, we use internal one in that case.
8734         AM_PATH_PYTHON([2.7],, [:])
8735         # Clean PYTHON_VERSION checked below if cross-compiling
8736         PYTHON_VERSION=""
8737         if test "$PYTHON" != ":"; then
8738             PYTHON_FOR_BUILD=$PYTHON
8739         fi
8740     fi
8742 AC_SUBST(PYTHON_FOR_BUILD)
8744 # Checks for Python to use for Pyuno
8745 AC_MSG_CHECKING([which Python to use for Pyuno])
8746 case "$enable_python" in
8747 no|disable)
8748     if test -z $PYTHON_FOR_BUILD; then
8749         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8750         # requirement from the choice whether to include Python stuff in the installer, but why
8751         # bother?
8752         AC_MSG_ERROR([Python is required at build time.])
8753     fi
8754     enable_python=no
8755     AC_MSG_RESULT([none])
8756     ;;
8757 ""|yes|auto)
8758     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8759         AC_MSG_RESULT([no, overridden by --disable-scripting])
8760         enable_python=no
8761     elif test $build_os = cygwin; then
8762         dnl When building on Windows we don't attempt to use any installed
8763         dnl "system"  Python.
8764         AC_MSG_RESULT([fully internal])
8765         enable_python=internal
8766     elif test "$cross_compiling" = yes; then
8767         AC_MSG_RESULT([system])
8768         enable_python=system
8769     else
8770         # Unset variables set by the above AM_PATH_PYTHON so that
8771         # we actually do check anew.
8772         AC_MSG_RESULT([])
8773         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
8774         AM_PATH_PYTHON([3.3],, [:])
8775         AC_MSG_CHECKING([which Python to use for Pyuno])
8776         if test "$PYTHON" = ":"; then
8777             if test -z "$PYTHON_FOR_BUILD"; then
8778                 AC_MSG_RESULT([fully internal])
8779             else
8780                 AC_MSG_RESULT([internal])
8781             fi
8782             enable_python=internal
8783         else
8784             AC_MSG_RESULT([system])
8785             enable_python=system
8786         fi
8787     fi
8788     ;;
8789 internal)
8790     AC_MSG_RESULT([internal])
8791     ;;
8792 fully-internal)
8793     AC_MSG_RESULT([fully internal])
8794     enable_python=internal
8795     ;;
8796 system)
8797     AC_MSG_RESULT([system])
8798     if test "$_os" = Darwin; then
8799         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])
8800     fi
8801     ;;
8803     AC_MSG_ERROR([Incorrect --enable-python option])
8804     ;;
8805 esac
8807 if test $enable_python != no; then
8808     BUILD_TYPE="$BUILD_TYPE PYUNO"
8811 if test $enable_python = system; then
8812     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8813         # Fallback: Accept these in the environment, or as set above
8814         # for MacOSX.
8815         :
8816     elif test "$cross_compiling" != yes; then
8817         # Unset variables set by the above AM_PATH_PYTHON so that
8818         # we actually do check anew.
8819         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
8820         # This causes an error if no python command is found
8821         AM_PATH_PYTHON([3.3])
8822         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8823         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8824         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8825         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8826         if test -z "$PKG_CONFIG"; then
8827             PYTHON_CFLAGS="-I$python_include"
8828             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8829         elif $PKG_CONFIG --exists python-$python_version-embed; then
8830             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8831             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8832         elif $PKG_CONFIG --exists python-$python_version; then
8833             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8834             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8835         else
8836             PYTHON_CFLAGS="-I$python_include"
8837             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8838         fi
8839         FilterLibs "${PYTHON_LIBS}"
8840         PYTHON_LIBS="${filteredlibs}"
8841     else
8842         dnl How to find out the cross-compilation Python installation path?
8843         AC_MSG_CHECKING([for python version])
8844         AS_IF([test -n "$PYTHON_VERSION"],
8845               [AC_MSG_RESULT([$PYTHON_VERSION])],
8846               [AC_MSG_RESULT([not found])
8847                AC_MSG_ERROR([no usable python found])])
8848         test -n "$PYTHON_CFLAGS" && break
8849     fi
8851     dnl Check if the headers really work
8852     save_CPPFLAGS="$CPPFLAGS"
8853     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8854     AC_CHECK_HEADER(Python.h)
8855     CPPFLAGS="$save_CPPFLAGS"
8857     # let the PYTHON_FOR_BUILD match the same python installation that
8858     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8859     # better for PythonTests.
8860     PYTHON_FOR_BUILD=$PYTHON
8863 if test "$with_lxml" != no; then
8864     if test -z "$PYTHON_FOR_BUILD"; then
8865         case $build_os in
8866             cygwin)
8867                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8868                 ;;
8869             *)
8870                 if test "$cross_compiling" != yes ; then
8871                     BUILD_TYPE="$BUILD_TYPE LXML"
8872                 fi
8873                 ;;
8874         esac
8875     else
8876         AC_MSG_CHECKING([for python lxml])
8877         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8878             AC_MSG_RESULT([yes])
8879         else
8880             case $build_os in
8881                 cygwin)
8882                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8883                     ;;
8884                 *)
8885                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8886                         BUILD_TYPE="$BUILD_TYPE LXML"
8887                         AC_MSG_RESULT([no, using internal lxml])
8888                     else
8889                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8890                     fi
8891                     ;;
8892             esac
8893         fi
8894     fi
8897 dnl By now enable_python should be "system", "internal" or "no"
8898 case $enable_python in
8899 system)
8900     SYSTEM_PYTHON=TRUE
8902     if test "x$ac_cv_header_Python_h" != "xyes"; then
8903        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8904     fi
8906     AC_LANG_PUSH(C)
8907     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8908     AC_MSG_CHECKING([for correct python library version])
8909        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8910 #include <Python.h>
8912 int main(int argc, char **argv) {
8913    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8914        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8915    else return 1;
8917        ]])],[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])])
8918     CFLAGS=$save_CFLAGS
8919     AC_LANG_POP(C)
8921     dnl FIXME Check if the Python library can be linked with, too?
8922     ;;
8924 internal)
8925     SYSTEM_PYTHON=
8926     PYTHON_VERSION_MAJOR=3
8927     PYTHON_VERSION_MINOR=5
8928     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.9
8929     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8930         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8931     fi
8932     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8933     BUILD_TYPE="$BUILD_TYPE PYTHON"
8934     # Embedded Python dies without Home set
8935     if test "$HOME" = ""; then
8936         export HOME=""
8937     fi
8938     ;;
8940     DISABLE_PYTHON=TRUE
8941     SYSTEM_PYTHON=
8942     ;;
8944     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8945     ;;
8946 esac
8948 AC_SUBST(DISABLE_PYTHON)
8949 AC_SUBST(SYSTEM_PYTHON)
8950 AC_SUBST(PYTHON_CFLAGS)
8951 AC_SUBST(PYTHON_LIBS)
8952 AC_SUBST(PYTHON_VERSION)
8953 AC_SUBST(PYTHON_VERSION_MAJOR)
8954 AC_SUBST(PYTHON_VERSION_MINOR)
8956 ENABLE_MARIADBC=TRUE
8957 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8958     ENABLE_MARIADBC=
8960 MARIADBC_MAJOR=1
8961 MARIADBC_MINOR=0
8962 MARIADBC_MICRO=2
8963 if test "$ENABLE_MARIADBC" = "TRUE"; then
8964     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8967 AC_SUBST(ENABLE_MARIADBC)
8968 AC_SUBST(MARIADBC_MAJOR)
8969 AC_SUBST(MARIADBC_MINOR)
8970 AC_SUBST(MARIADBC_MICRO)
8972 if test "$ENABLE_MARIADBC" = "TRUE"; then
8973     dnl ===================================================================
8974     dnl Check for system MariaDB
8975     dnl ===================================================================
8976     AC_MSG_CHECKING([which MariaDB to use])
8977     if test "$with_system_mariadb" = "yes"; then
8978         AC_MSG_RESULT([external])
8979         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8980         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8981         if test -z "$MARIADBCONFIG"; then
8982             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8983             if test -z "$MARIADBCONFIG"; then
8984                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8985                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8986             fi
8987         fi
8988         AC_MSG_CHECKING([MariaDB version])
8989         MARIADB_VERSION=`$MARIADBCONFIG --version`
8990         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8991         if test "$MARIADB_MAJOR" -ge "5"; then
8992             AC_MSG_RESULT([OK])
8993         else
8994             AC_MSG_ERROR([too old, use 5.0.x or later])
8995         fi
8996         AC_MSG_CHECKING([for MariaDB Client library])
8997         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8998         if test "$COM_IS_CLANG" = TRUE; then
8999             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9000         fi
9001         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9002         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9003         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9004         dnl linux32:
9005         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9006             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9007             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9008                 | sed -e 's|/lib64/|/lib/|')
9009         fi
9010         FilterLibs "${MARIADB_LIBS}"
9011         MARIADB_LIBS="${filteredlibs}"
9012         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9013         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9014         if test "$enable_bundle_mariadb" = "yes"; then
9015             AC_MSG_RESULT([yes])
9016             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9017             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9019 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9021 /g' | grep -E '(mysqlclient|mariadb)')
9022             if test "$_os" = "Darwin"; then
9023                 LIBMARIADB=${LIBMARIADB}.dylib
9024             elif test "$_os" = "WINNT"; then
9025                 LIBMARIADB=${LIBMARIADB}.dll
9026             else
9027                 LIBMARIADB=${LIBMARIADB}.so
9028             fi
9029             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9030             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9031             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9032                 AC_MSG_RESULT([found.])
9033                 PathFormat "$LIBMARIADB_PATH"
9034                 LIBMARIADB_PATH="$formatted_path"
9035             else
9036                 AC_MSG_ERROR([not found.])
9037             fi
9038         else
9039             AC_MSG_RESULT([no])
9040             BUNDLE_MARIADB_CONNECTOR_C=
9041         fi
9042     else
9043         AC_MSG_RESULT([internal])
9044         SYSTEM_MARIADB_CONNECTOR_C=
9045         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9046         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9047         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9048     fi
9050     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9051     AC_SUBST(MARIADB_CFLAGS)
9052     AC_SUBST(MARIADB_LIBS)
9053     AC_SUBST(LIBMARIADB)
9054     AC_SUBST(LIBMARIADB_PATH)
9055     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9058 dnl ===================================================================
9059 dnl Check for system hsqldb
9060 dnl ===================================================================
9061 if test "$with_java" != "no"; then
9062     HSQLDB_USE_JDBC_4_1=
9063     AC_MSG_CHECKING([which hsqldb to use])
9064     if test "$with_system_hsqldb" = "yes"; then
9065         AC_MSG_RESULT([external])
9066         SYSTEM_HSQLDB=TRUE
9067         if test -z $HSQLDB_JAR; then
9068             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9069         fi
9070         if ! test -f $HSQLDB_JAR; then
9071                AC_MSG_ERROR(hsqldb.jar not found.)
9072         fi
9073         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9074         export HSQLDB_JAR
9075         if $PERL -e \
9076            'use Archive::Zip;
9077             my $file = "$ENV{'HSQLDB_JAR'}";
9078             my $zip = Archive::Zip->new( $file );
9079             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9080             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9081             {
9082                 push @l, split(/\n/, $mf);
9083                 foreach my $line (@l)
9084                 {
9085                     if ($line =~ m/Specification-Version:/)
9086                     {
9087                         ($t, $version) = split (/:/,$line);
9088                         $version =~ s/^\s//;
9089                         ($a, $b, $c, $d) = split (/\./,$version);
9090                         if ($c == "0" && $d > "8")
9091                         {
9092                             exit 0;
9093                         }
9094                         else
9095                         {
9096                             exit 1;
9097                         }
9098                     }
9099                 }
9100             }
9101             else
9102             {
9103                 exit 1;
9104             }'; then
9105             AC_MSG_RESULT([yes])
9106         else
9107             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9108         fi
9109     else
9110         AC_MSG_RESULT([internal])
9111         SYSTEM_HSQLDB=
9112         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9113         NEED_ANT=TRUE
9114         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9115         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9116         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9117             AC_MSG_RESULT([yes])
9118             HSQLDB_USE_JDBC_4_1=TRUE
9119         else
9120             AC_MSG_RESULT([no])
9121         fi
9122     fi
9123     AC_SUBST(SYSTEM_HSQLDB)
9124     AC_SUBST(HSQLDB_JAR)
9125     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9128 dnl ===================================================================
9129 dnl Check for PostgreSQL stuff
9130 dnl ===================================================================
9131 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9132 if test "x$enable_postgresql_sdbc" != "xno"; then
9133     AC_MSG_RESULT([yes])
9134     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9136     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9137         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9138     fi
9139     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9140         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9141     fi
9143     postgres_interface=""
9144     if test "$with_system_postgresql" = "yes"; then
9145         postgres_interface="external PostgreSQL"
9146         SYSTEM_POSTGRESQL=TRUE
9147         if test "$_os" = Darwin; then
9148             supp_path=''
9149             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9150                 pg_supp_path="$P_SEP$d$pg_supp_path"
9151             done
9152         fi
9153         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9154         if test -n "$PGCONFIG"; then
9155             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9156             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9157         else
9158             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9159               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9160               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9161             ],[
9162               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9163             ])
9164         fi
9165         FilterLibs "${POSTGRESQL_LIB}"
9166         POSTGRESQL_LIB="${filteredlibs}"
9167     else
9168         # if/when anything else than PostgreSQL uses Kerberos,
9169         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9170         WITH_KRB5=
9171         WITH_GSSAPI=
9172         case "$_os" in
9173         Darwin)
9174             # macOS has system MIT Kerberos 5 since 10.4
9175             if test "$with_krb5" != "no"; then
9176                 WITH_KRB5=TRUE
9177                 save_LIBS=$LIBS
9178                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9179                 # that the libraries where these functions are located on macOS will change, is it?
9180                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9181                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9182                 KRB5_LIBS=$LIBS
9183                 LIBS=$save_LIBS
9184                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9185                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9186                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9187                 LIBS=$save_LIBS
9188             fi
9189             if test "$with_gssapi" != "no"; then
9190                 WITH_GSSAPI=TRUE
9191                 save_LIBS=$LIBS
9192                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9193                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9194                 GSSAPI_LIBS=$LIBS
9195                 LIBS=$save_LIBS
9196             fi
9197             ;;
9198         WINNT)
9199             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9200                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9201             fi
9202             ;;
9203         Linux|GNU|*BSD|DragonFly)
9204             if test "$with_krb5" != "no"; then
9205                 WITH_KRB5=TRUE
9206                 save_LIBS=$LIBS
9207                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9208                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9209                 KRB5_LIBS=$LIBS
9210                 LIBS=$save_LIBS
9211                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9212                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9213                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9214                 LIBS=$save_LIBS
9215             fi
9216             if test "$with_gssapi" != "no"; then
9217                 WITH_GSSAPI=TRUE
9218                 save_LIBS=$LIBS
9219                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9220                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9221                 GSSAPI_LIBS=$LIBS
9222                 LIBS=$save_LIBS
9223             fi
9224             ;;
9225         *)
9226             if test "$with_krb5" = "yes"; then
9227                 WITH_KRB5=TRUE
9228                 save_LIBS=$LIBS
9229                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9230                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9231                 KRB5_LIBS=$LIBS
9232                 LIBS=$save_LIBS
9233                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9234                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9235                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9236                 LIBS=$save_LIBS
9237             fi
9238             if test "$with_gssapi" = "yes"; then
9239                 WITH_GSSAPI=TRUE
9240                 save_LIBS=$LIBS
9241                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9242                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9243                 LIBS=$save_LIBS
9244                 GSSAPI_LIBS=$LIBS
9245             fi
9246         esac
9248         if test -n "$with_libpq_path"; then
9249             SYSTEM_POSTGRESQL=TRUE
9250             postgres_interface="external libpq"
9251             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9252             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9253         else
9254             SYSTEM_POSTGRESQL=
9255             postgres_interface="internal"
9256             POSTGRESQL_LIB=""
9257             POSTGRESQL_INC="%OVERRIDE_ME%"
9258             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9259         fi
9260     fi
9262     AC_MSG_CHECKING([PostgreSQL C interface])
9263     AC_MSG_RESULT([$postgres_interface])
9265     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9266         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9267         save_CFLAGS=$CFLAGS
9268         save_CPPFLAGS=$CPPFLAGS
9269         save_LIBS=$LIBS
9270         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9271         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9272         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9273         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9274             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9275         CFLAGS=$save_CFLAGS
9276         CPPFLAGS=$save_CPPFLAGS
9277         LIBS=$save_LIBS
9278     fi
9279     BUILD_POSTGRESQL_SDBC=TRUE
9280 else
9281     AC_MSG_RESULT([no])
9283 AC_SUBST(WITH_KRB5)
9284 AC_SUBST(WITH_GSSAPI)
9285 AC_SUBST(GSSAPI_LIBS)
9286 AC_SUBST(KRB5_LIBS)
9287 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9288 AC_SUBST(SYSTEM_POSTGRESQL)
9289 AC_SUBST(POSTGRESQL_INC)
9290 AC_SUBST(POSTGRESQL_LIB)
9292 dnl ===================================================================
9293 dnl Check for Firebird stuff
9294 dnl ===================================================================
9295 ENABLE_FIREBIRD_SDBC=
9296 if test "$enable_firebird_sdbc" = "yes" ; then
9297     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9299     dnl ===================================================================
9300     dnl Check for system Firebird
9301     dnl ===================================================================
9302     AC_MSG_CHECKING([which Firebird to use])
9303     if test "$with_system_firebird" = "yes"; then
9304         AC_MSG_RESULT([external])
9305         SYSTEM_FIREBIRD=TRUE
9306         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9307         if test -z "$FIREBIRDCONFIG"; then
9308             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9309             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9310                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9311             ])
9312             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9313         else
9314             AC_MSG_NOTICE([fb_config found])
9315             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9316             AC_MSG_CHECKING([for Firebird Client library])
9317             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9318             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9319             FilterLibs "${FIREBIRD_LIBS}"
9320             FIREBIRD_LIBS="${filteredlibs}"
9321         fi
9322         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9323         AC_MSG_CHECKING([Firebird version])
9324         if test -n "${FIREBIRD_VERSION}"; then
9325             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9326             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9327             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9328                 AC_MSG_RESULT([OK])
9329             else
9330                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9331             fi
9332         else
9333             __save_CFLAGS="${CFLAGS}"
9334             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9335             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9336 #if defined(FB_API_VER) && FB_API_VER == 30
9337 int fb_api_is_30(void) { return 0; }
9338 #else
9339 #error "Wrong Firebird API version"
9340 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9341             CFLAGS="${__save_CFLAGS}"
9342         fi
9343         ENABLE_FIREBIRD_SDBC=TRUE
9344         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9345     elif test "$enable_database_connectivity" != yes; then
9346         AC_MSG_RESULT([none])
9347     elif test "$cross_compiling" = "yes"; then
9348         AC_MSG_RESULT([none])
9349     else
9350         dnl Embedded Firebird has version 3.0
9351         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9352         dnl We need libatomic_ops for any non X86/X64 system
9353         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9354             dnl ===================================================================
9355             dnl Check for system libatomic_ops
9356             dnl ===================================================================
9357             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9358             if test "$with_system_libatomic_ops" = "yes"; then
9359                 SYSTEM_LIBATOMIC_OPS=TRUE
9360                 AC_CHECK_HEADERS(atomic_ops.h, [],
9361                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9362             else
9363                 SYSTEM_LIBATOMIC_OPS=
9364                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9365                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9366                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9367             fi
9368         fi
9370         AC_MSG_RESULT([internal])
9371         SYSTEM_FIREBIRD=
9372         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9373         FIREBIRD_LIBS="-lfbclient"
9375         if test "$with_system_libtommath" = "yes"; then
9376             SYSTEM_LIBTOMMATH=TRUE
9377             dnl check for tommath presence
9378             save_LIBS=$LIBS
9379             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9380             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9381             LIBS=$save_LIBS
9382         else
9383             SYSTEM_LIBTOMMATH=
9384             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9385             LIBTOMMATH_LIBS="-ltommath"
9386             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9387         fi
9389         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9390         ENABLE_FIREBIRD_SDBC=TRUE
9391         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9392     fi
9394 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9395 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9396 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9397 AC_SUBST(LIBATOMIC_OPS_LIBS)
9398 AC_SUBST(SYSTEM_FIREBIRD)
9399 AC_SUBST(FIREBIRD_CFLAGS)
9400 AC_SUBST(FIREBIRD_LIBS)
9401 AC_SUBST([TOMMATH_CFLAGS])
9402 AC_SUBST([TOMMATH_LIBS])
9404 dnl ===================================================================
9405 dnl Check for system curl
9406 dnl ===================================================================
9407 AC_MSG_CHECKING([which libcurl to use])
9408 if test "$with_system_curl" = "auto"; then
9409     with_system_curl="$with_system_libs"
9412 if test "$with_system_curl" = "yes"; then
9413     AC_MSG_RESULT([external])
9414     SYSTEM_CURL=TRUE
9416     # First try PKGCONFIG and then fall back
9417     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9419     if test -n "$CURL_PKG_ERRORS"; then
9420         AC_PATH_PROG(CURLCONFIG, curl-config)
9421         if test -z "$CURLCONFIG"; then
9422             AC_MSG_ERROR([curl development files not found])
9423         fi
9424         CURL_LIBS=`$CURLCONFIG --libs`
9425         FilterLibs "${CURL_LIBS}"
9426         CURL_LIBS="${filteredlibs}"
9427         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9428         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9430         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9431         case $curl_version in
9432         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9433         dnl so they need to be doubled to end up in the configure script
9434         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9435             AC_MSG_RESULT([yes])
9436             ;;
9437         *)
9438             AC_MSG_ERROR([no, you have $curl_version])
9439             ;;
9440         esac
9441     fi
9443     ENABLE_CURL=TRUE
9444 elif test $_os = iOS; then
9445     # Let's see if we need curl, I think not?
9446     AC_MSG_RESULT([none])
9447     ENABLE_CURL=
9448 else
9449     AC_MSG_RESULT([internal])
9450     SYSTEM_CURL=
9451     BUILD_TYPE="$BUILD_TYPE CURL"
9452     ENABLE_CURL=TRUE
9454 AC_SUBST(SYSTEM_CURL)
9455 AC_SUBST(CURL_CFLAGS)
9456 AC_SUBST(CURL_LIBS)
9457 AC_SUBST(ENABLE_CURL)
9459 dnl ===================================================================
9460 dnl Check for system boost
9461 dnl ===================================================================
9462 AC_MSG_CHECKING([which boost to use])
9463 if test "$with_system_boost" = "yes"; then
9464     AC_MSG_RESULT([external])
9465     SYSTEM_BOOST=TRUE
9466     AX_BOOST_BASE(1.47)
9467     AX_BOOST_DATE_TIME
9468     AX_BOOST_FILESYSTEM
9469     AX_BOOST_IOSTREAMS
9470     AX_BOOST_LOCALE
9471     AC_LANG_PUSH([C++])
9472     save_CXXFLAGS=$CXXFLAGS
9473     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9474     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9475        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9476     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9477        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9478     CXXFLAGS=$save_CXXFLAGS
9479     AC_LANG_POP([C++])
9480     # this is in m4/ax_boost_base.m4
9481     FilterLibs "${BOOST_LDFLAGS}"
9482     BOOST_LDFLAGS="${filteredlibs}"
9483 else
9484     AC_MSG_RESULT([internal])
9485     BUILD_TYPE="$BUILD_TYPE BOOST"
9486     SYSTEM_BOOST=
9487     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9488         # use warning-suppressing wrapper headers
9489         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9490     else
9491         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9492     fi
9494 AC_SUBST(SYSTEM_BOOST)
9496 dnl ===================================================================
9497 dnl Check for system mdds
9498 dnl ===================================================================
9499 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9501 dnl ===================================================================
9502 dnl Check for system glm
9503 dnl ===================================================================
9504 AC_MSG_CHECKING([which glm to use])
9505 if test "$with_system_glm" = "yes"; then
9506     AC_MSG_RESULT([external])
9507     SYSTEM_GLM=TRUE
9508     AC_LANG_PUSH([C++])
9509     AC_CHECK_HEADER([glm/glm.hpp], [],
9510        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9511     AC_LANG_POP([C++])
9512 else
9513     AC_MSG_RESULT([internal])
9514     BUILD_TYPE="$BUILD_TYPE GLM"
9515     SYSTEM_GLM=
9516     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9518 AC_SUBST([GLM_CFLAGS])
9519 AC_SUBST([SYSTEM_GLM])
9521 dnl ===================================================================
9522 dnl Check for system odbc
9523 dnl ===================================================================
9524 AC_MSG_CHECKING([which odbc headers to use])
9525 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
9526     AC_MSG_RESULT([external])
9527     SYSTEM_ODBC_HEADERS=TRUE
9529     if test "$build_os" = "cygwin"; then
9530         save_CPPFLAGS=$CPPFLAGS
9531         find_winsdk
9532         PathFormat "$winsdktest"
9533         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"
9534         AC_CHECK_HEADER(sqlext.h, [],
9535             [AC_MSG_ERROR(odbc not found. install odbc)],
9536             [#include <windows.h>])
9537         CPPFLAGS=$save_CPPFLAGS
9538     else
9539         AC_CHECK_HEADER(sqlext.h, [],
9540             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9541     fi
9542 elif test "$enable_database_connectivity" != yes; then
9543     AC_MSG_RESULT([none])
9544 else
9545     AC_MSG_RESULT([internal])
9546     SYSTEM_ODBC_HEADERS=
9548 AC_SUBST(SYSTEM_ODBC_HEADERS)
9550 dnl ===================================================================
9551 dnl Enable LDAP support
9552 dnl ===================================================================
9554 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9555 AC_MSG_CHECKING([whether to enable LDAP support])
9556     if test "$enable_ldap" != "yes"; then
9557         AC_MSG_RESULT([no])
9558         ENABLE_LDAP=""
9559         enable_ldap=no
9560     else
9561         AC_MSG_RESULT([yes])
9562         ENABLE_LDAP="TRUE"
9563         AC_DEFINE(HAVE_FEATURE_LDAP)
9564     fi
9566 AC_SUBST(ENABLE_LDAP)
9568 dnl ===================================================================
9569 dnl Check for system openldap
9570 dnl ===================================================================
9572 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9573 AC_MSG_CHECKING([which openldap library to use])
9574 if test "$with_system_openldap" = "yes"; then
9575     AC_MSG_RESULT([external])
9576     SYSTEM_OPENLDAP=TRUE
9577     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9578     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9579     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9580 else
9581     AC_MSG_RESULT([internal])
9582     SYSTEM_OPENLDAP=
9583     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9586 AC_SUBST(SYSTEM_OPENLDAP)
9588 dnl ===================================================================
9589 dnl Check for system NSS
9590 dnl ===================================================================
9591 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9592     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9593     AC_DEFINE(HAVE_FEATURE_NSS)
9594     ENABLE_NSS="TRUE"
9595     AC_DEFINE(ENABLE_NSS)
9596 elif test $_os != iOS ; then
9597     with_tls=openssl
9599 AC_SUBST(ENABLE_NSS)
9601 dnl ===================================================================
9602 dnl Check for TLS/SSL and cryptographic implementation to use
9603 dnl ===================================================================
9604 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9605 if test -n "$with_tls"; then
9606     case $with_tls in
9607     openssl)
9608         AC_DEFINE(USE_TLS_OPENSSL)
9609         TLS=OPENSSL
9611         if test "$enable_openssl" != "yes"; then
9612             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9613         fi
9615         # warn that OpenSSL has been selected but not all TLS code has this option
9616         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9617         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9618         ;;
9619     nss)
9620         AC_DEFINE(USE_TLS_NSS)
9621         TLS=NSS
9622         ;;
9623     no)
9624         AC_MSG_WARN([Skipping TLS/SSL])
9625         ;;
9626     *)
9627         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9628 openssl - OpenSSL
9629 nss - Mozilla's Network Security Services (NSS)
9630     ])
9631         ;;
9632     esac
9633 else
9634     # default to using NSS, it results in smaller oox lib
9635     AC_DEFINE(USE_TLS_NSS)
9636     TLS=NSS
9638 AC_MSG_RESULT([$TLS])
9639 AC_SUBST(TLS)
9641 dnl ===================================================================
9642 dnl Check for system sane
9643 dnl ===================================================================
9644 AC_MSG_CHECKING([which sane header to use])
9645 if test "$with_system_sane" = "yes"; then
9646     AC_MSG_RESULT([external])
9647     AC_CHECK_HEADER(sane/sane.h, [],
9648       [AC_MSG_ERROR(sane not found. install sane)], [])
9649 else
9650     AC_MSG_RESULT([internal])
9651     BUILD_TYPE="$BUILD_TYPE SANE"
9654 dnl ===================================================================
9655 dnl Check for system icu
9656 dnl ===================================================================
9657 SYSTEM_GENBRK=
9658 SYSTEM_GENCCODE=
9659 SYSTEM_GENCMN=
9661 ICU_MAJOR=65
9662 ICU_MINOR=1
9663 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9664 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9665 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9666 AC_MSG_CHECKING([which icu to use])
9667 if test "$with_system_icu" = "yes"; then
9668     AC_MSG_RESULT([external])
9669     SYSTEM_ICU=TRUE
9670     AC_LANG_PUSH([C++])
9671     AC_MSG_CHECKING([for unicode/rbbi.h])
9672     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9673     AC_LANG_POP([C++])
9675     if test "$cross_compiling" != "yes"; then
9676         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9677         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9678         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9679         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9680     fi
9682     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9683         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9684         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9685         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9686         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9687         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9688             AC_MSG_RESULT([yes])
9689         else
9690             AC_MSG_RESULT([no])
9691             if test "$with_system_icu_for_build" != "force"; then
9692                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9693 You can use --with-system-icu-for-build=force to use it anyway.])
9694             fi
9695         fi
9696     fi
9698     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9699         # using the system icu tools can lead to version confusion, use the
9700         # ones from the build environment when cross-compiling
9701         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9702         if test -z "$SYSTEM_GENBRK"; then
9703             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9704         fi
9705         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9706         if test -z "$SYSTEM_GENCCODE"; then
9707             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9708         fi
9709         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9710         if test -z "$SYSTEM_GENCMN"; then
9711             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9712         fi
9713         if test "$ICU_MAJOR" -ge "49"; then
9714             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9715             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9716             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9717         else
9718             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9719             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9720             ICU_RECLASSIFIED_HEBREW_LETTER=
9721         fi
9722     fi
9724     if test "$cross_compiling" = "yes"; then
9725         if test "$ICU_MAJOR" -ge "50"; then
9726             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9727             ICU_MINOR=""
9728         fi
9729     fi
9730 else
9731     AC_MSG_RESULT([internal])
9732     SYSTEM_ICU=
9733     BUILD_TYPE="$BUILD_TYPE ICU"
9734     # surprisingly set these only for "internal" (to be used by various other
9735     # external libs): the system icu-config is quite unhelpful and spits out
9736     # dozens of weird flags and also default path -I/usr/include
9737     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9738     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9740 if test "$ICU_MAJOR" -ge "59"; then
9741     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9742     # with -std=c++11 but not all external libraries can be built with that,
9743     # for those use a bit-compatible typedef uint16_t UChar; see
9744     # icu/source/common/unicode/umachine.h
9745     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9746 else
9747     ICU_UCHAR_TYPE=""
9749 AC_SUBST(SYSTEM_ICU)
9750 AC_SUBST(SYSTEM_GENBRK)
9751 AC_SUBST(SYSTEM_GENCCODE)
9752 AC_SUBST(SYSTEM_GENCMN)
9753 AC_SUBST(ICU_MAJOR)
9754 AC_SUBST(ICU_MINOR)
9755 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9756 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9757 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9758 AC_SUBST(ICU_CFLAGS)
9759 AC_SUBST(ICU_LIBS)
9760 AC_SUBST(ICU_UCHAR_TYPE)
9762 dnl ==================================================================
9763 dnl Breakpad
9764 dnl ==================================================================
9765 DEFAULT_CRASHDUMP_VALUE="true"
9766 AC_MSG_CHECKING([whether to enable breakpad])
9767 if test "$enable_breakpad" != yes; then
9768     AC_MSG_RESULT([no])
9769 else
9770     AC_MSG_RESULT([yes])
9771     ENABLE_BREAKPAD="TRUE"
9772     AC_DEFINE(ENABLE_BREAKPAD)
9773     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9774     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9776     AC_MSG_CHECKING([for disable crash dump])
9777     if test "$enable_crashdump" = no; then
9778         DEFAULT_CRASHDUMP_VALUE="false"
9779         AC_MSG_RESULT([yes])
9780     else
9781        AC_MSG_RESULT([no])
9782     fi
9784     AC_MSG_CHECKING([for crashreport config])
9785     if test "$with_symbol_config" = "no"; then
9786         BREAKPAD_SYMBOL_CONFIG="invalid"
9787         AC_MSG_RESULT([no])
9788     else
9789         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9790         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9791         AC_MSG_RESULT([yes])
9792     fi
9793     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9795 AC_SUBST(ENABLE_BREAKPAD)
9796 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9798 dnl ==================================================================
9799 dnl libfuzzer
9800 dnl ==================================================================
9801 AC_MSG_CHECKING([whether to enable fuzzers])
9802 if test "$enable_fuzzers" != yes; then
9803     AC_MSG_RESULT([no])
9804 else
9805     AC_MSG_RESULT([yes])
9806     ENABLE_FUZZERS="TRUE"
9807     AC_DEFINE([ENABLE_FUZZERS],1)
9808     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9810 AC_SUBST(ENABLE_FUZZERS)
9812 dnl ===================================================================
9813 dnl Orcus
9814 dnl ===================================================================
9815 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9816 if test "$with_system_orcus" != "yes"; then
9817     if test "$SYSTEM_BOOST" = "TRUE"; then
9818         # ===========================================================
9819         # Determine if we are going to need to link with Boost.System
9820         # ===========================================================
9821         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9822         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9823         dnl in documentation has no effect.
9824         AC_MSG_CHECKING([if we need to link with Boost.System])
9825         AC_LANG_PUSH([C++])
9826         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9827                 @%:@include <boost/version.hpp>
9828             ]],[[
9829                 #if BOOST_VERSION >= 105000
9830                 #   error yes, we need to link with Boost.System
9831                 #endif
9832             ]])],[
9833                 AC_MSG_RESULT([no])
9834             ],[
9835                 AC_MSG_RESULT([yes])
9836                 AX_BOOST_SYSTEM
9837         ])
9838         AC_LANG_POP([C++])
9839     fi
9841 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9842 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9843 AC_SUBST([BOOST_SYSTEM_LIB])
9844 AC_SUBST(SYSTEM_LIBORCUS)
9846 dnl ===================================================================
9847 dnl HarfBuzz
9848 dnl ===================================================================
9849 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9850                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9851                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9853 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9854                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9855                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9857 if test "$COM" = "MSC"; then # override the above
9858     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9859     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9862 if test "$with_system_harfbuzz" = "yes"; then
9863     if test "$with_system_graphite" = "no"; then
9864         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9865     fi
9866     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9867     _save_libs="$LIBS"
9868     _save_cflags="$CFLAGS"
9869     LIBS="$LIBS $HARFBUZZ_LIBS"
9870     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9871     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9872     LIBS="$_save_libs"
9873     CFLAGS="$_save_cflags"
9874 else
9875     if test "$with_system_graphite" = "yes"; then
9876         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9877     fi
9880 AC_MSG_CHECKING([whether to use X11])
9881 dnl ***************************************
9882 dnl testing for X libraries and includes...
9883 dnl ***************************************
9884 if test "$USING_X11" = TRUE; then
9885     AC_DEFINE(HAVE_FEATURE_X11)
9887 AC_MSG_RESULT([$USING_X11])
9889 if test "$USING_X11" = TRUE; then
9890     AC_PATH_X
9891     AC_PATH_XTRA
9892     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9894     if test -z "$x_includes"; then
9895         x_includes="default_x_includes"
9896     fi
9897     if test -z "$x_libraries"; then
9898         x_libraries="default_x_libraries"
9899     fi
9900     CFLAGS="$CFLAGS $X_CFLAGS"
9901     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9902     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9903 else
9904     x_includes="no_x_includes"
9905     x_libraries="no_x_libraries"
9908 if test "$USING_X11" = TRUE; then
9909     dnl ===================================================================
9910     dnl Check for extension headers
9911     dnl ===================================================================
9912     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9913      [#include <X11/extensions/shape.h>])
9915     # vcl needs ICE and SM
9916     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9917     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9918         [AC_MSG_ERROR(ICE library not found)])
9919     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9920     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9921         [AC_MSG_ERROR(SM library not found)])
9924 dnl ===================================================================
9925 dnl Check for system Xrender
9926 dnl ===================================================================
9927 AC_MSG_CHECKING([whether to use Xrender])
9928 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9929     AC_MSG_RESULT([yes])
9930     PKG_CHECK_MODULES(XRENDER, xrender)
9931     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9932     FilterLibs "${XRENDER_LIBS}"
9933     XRENDER_LIBS="${filteredlibs}"
9934     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9935       [AC_MSG_ERROR(libXrender not found or functional)], [])
9936     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9937       [AC_MSG_ERROR(Xrender not found. install X)], [])
9938 else
9939     AC_MSG_RESULT([no])
9941 AC_SUBST(XRENDER_CFLAGS)
9942 AC_SUBST(XRENDER_LIBS)
9944 dnl ===================================================================
9945 dnl Check for XRandr
9946 dnl ===================================================================
9947 AC_MSG_CHECKING([whether to enable RandR support])
9948 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9949     AC_MSG_RESULT([yes])
9950     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9951     if test "$ENABLE_RANDR" != "TRUE"; then
9952         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9953                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9954         XRANDR_CFLAGS=" "
9955         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9956           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9957         XRANDR_LIBS="-lXrandr "
9958         ENABLE_RANDR="TRUE"
9959     fi
9960     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9961     FilterLibs "${XRANDR_LIBS}"
9962     XRANDR_LIBS="${filteredlibs}"
9963 else
9964     ENABLE_RANDR=""
9965     AC_MSG_RESULT([no])
9967 AC_SUBST(XRANDR_CFLAGS)
9968 AC_SUBST(XRANDR_LIBS)
9969 AC_SUBST(ENABLE_RANDR)
9971 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9972     WITH_WEBDAV="serf"
9974 if test $_os = iOS -o $_os = Android; then
9975     WITH_WEBDAV="no"
9977 AC_MSG_CHECKING([for webdav library])
9978 case "$WITH_WEBDAV" in
9979 serf)
9980     AC_MSG_RESULT([serf])
9981     # Check for system apr-util
9982     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9983                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9984                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9985     if test "$COM" = "MSC"; then
9986         APR_LIB_DIR="LibR"
9987         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9988         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9989     fi
9991     # Check for system serf
9992     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9993                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9994     if test "$COM" = "MSC"; then
9995         SERF_LIB_DIR="Release"
9996         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9997         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9998     fi
9999     ;;
10000 neon)
10001     AC_MSG_RESULT([neon])
10002     # Check for system neon
10003     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10004     if test "$with_system_neon" = "yes"; then
10005         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10006     else
10007         NEON_VERSION=0295
10008     fi
10009     AC_SUBST(NEON_VERSION)
10010     ;;
10012     AC_MSG_RESULT([none, disabled])
10013     WITH_WEBDAV=""
10014     ;;
10015 esac
10016 AC_SUBST(WITH_WEBDAV)
10018 dnl ===================================================================
10019 dnl Check for disabling cve_tests
10020 dnl ===================================================================
10021 AC_MSG_CHECKING([whether to execute CVE tests])
10022 # If not explicitly enabled or disabled, default
10023 if test -z "$enable_cve_tests"; then
10024     case "$OS" in
10025     WNT)
10026         # Default cves off for Windows with its wild and wonderful
10027         # variety of AV software kicking in and panicking
10028         enable_cve_tests=no
10029         ;;
10030     *)
10031         # otherwise yes
10032         enable_cve_tests=yes
10033         ;;
10034     esac
10036 if test "$enable_cve_tests" = "no"; then
10037     AC_MSG_RESULT([no])
10038     DISABLE_CVE_TESTS=TRUE
10039     AC_SUBST(DISABLE_CVE_TESTS)
10040 else
10041     AC_MSG_RESULT([yes])
10044 dnl ===================================================================
10045 dnl Check for enabling chart XShape tests
10046 dnl ===================================================================
10047 AC_MSG_CHECKING([whether to execute chart XShape tests])
10048 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10049     AC_MSG_RESULT([yes])
10050     ENABLE_CHART_TESTS=TRUE
10051     AC_SUBST(ENABLE_CHART_TESTS)
10052 else
10053     AC_MSG_RESULT([no])
10056 dnl ===================================================================
10057 dnl Check for system openssl
10058 dnl ===================================================================
10059 DISABLE_OPENSSL=
10060 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10061 if test "$enable_openssl" = "yes"; then
10062     AC_MSG_RESULT([no])
10063     if test "$_os" = Darwin ; then
10064         # OpenSSL is deprecated when building for 10.7 or later.
10065         #
10066         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10067         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10069         with_system_openssl=no
10070         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10071     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10072             && test "$with_system_openssl" != "no"; then
10073         with_system_openssl=yes
10074         SYSTEM_OPENSSL=TRUE
10075         OPENSSL_CFLAGS=
10076         OPENSSL_LIBS="-lssl -lcrypto"
10077     else
10078         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10079     fi
10080     if test "$with_system_openssl" = "yes"; then
10081         AC_MSG_CHECKING([whether openssl supports SHA512])
10082         AC_LANG_PUSH([C])
10083         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10084             SHA512_CTX context;
10085 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10086         AC_LANG_POP(C)
10087     fi
10088 else
10089     AC_MSG_RESULT([yes])
10090     DISABLE_OPENSSL=TRUE
10092     # warn that although OpenSSL is disabled, system libraries may depend on it
10093     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10094     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10097 AC_SUBST([DISABLE_OPENSSL])
10099 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10100     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10101         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10102         enable_cipher_openssl_backend=no
10103     else
10104         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10105     fi
10107 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10108 ENABLE_CIPHER_OPENSSL_BACKEND=
10109 if test "$enable_cipher_openssl_backend" = yes; then
10110     AC_MSG_RESULT([yes])
10111     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10112 else
10113     AC_MSG_RESULT([no])
10115 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10117 dnl ===================================================================
10118 dnl Check for building gnutls
10119 dnl ===================================================================
10120 AC_MSG_CHECKING([whether to use gnutls])
10121 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10122     AC_MSG_RESULT([yes])
10123     AM_PATH_LIBGCRYPT()
10124     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10125         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10126                       available in the system to use as replacement.]]))
10127     FilterLibs "${LIBGCRYPT_LIBS}"
10128     LIBGCRYPT_LIBS="${filteredlibs}"
10129 else
10130     AC_MSG_RESULT([no])
10133 AC_SUBST([LIBGCRYPT_CFLAGS])
10134 AC_SUBST([LIBGCRYPT_LIBS])
10136 dnl ===================================================================
10137 dnl Check for system redland
10138 dnl ===================================================================
10139 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10140 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10141 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10142 if test "$with_system_redland" = "yes"; then
10143     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10144             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10145 else
10146     RAPTOR_MAJOR="0"
10147     RASQAL_MAJOR="3"
10148     REDLAND_MAJOR="0"
10150 AC_SUBST(RAPTOR_MAJOR)
10151 AC_SUBST(RASQAL_MAJOR)
10152 AC_SUBST(REDLAND_MAJOR)
10154 dnl ===================================================================
10155 dnl Check for system hunspell
10156 dnl ===================================================================
10157 AC_MSG_CHECKING([which libhunspell to use])
10158 if test "$with_system_hunspell" = "yes"; then
10159     AC_MSG_RESULT([external])
10160     SYSTEM_HUNSPELL=TRUE
10161     AC_LANG_PUSH([C++])
10162     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10163     if test "$HUNSPELL_PC" != "TRUE"; then
10164         AC_CHECK_HEADER(hunspell.hxx, [],
10165             [
10166             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10167             [AC_MSG_ERROR(hunspell headers not found.)], [])
10168             ], [])
10169         AC_CHECK_LIB([hunspell], [main], [:],
10170            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10171         HUNSPELL_LIBS=-lhunspell
10172     fi
10173     AC_LANG_POP([C++])
10174     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10175     FilterLibs "${HUNSPELL_LIBS}"
10176     HUNSPELL_LIBS="${filteredlibs}"
10177 else
10178     AC_MSG_RESULT([internal])
10179     SYSTEM_HUNSPELL=
10180     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10181     if test "$COM" = "MSC"; then
10182         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10183     else
10184         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10185     fi
10186     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10188 AC_SUBST(SYSTEM_HUNSPELL)
10189 AC_SUBST(HUNSPELL_CFLAGS)
10190 AC_SUBST(HUNSPELL_LIBS)
10192 dnl ===================================================================
10193 dnl Check for system qrcodegen
10194 dnl ===================================================================
10195 AC_MSG_CHECKING([which libqrcodegen to use])
10196 if test "$with_system_qrcodegen" = "yes"; then
10197     AC_MSG_RESULT([external])
10198     SYSTEM_QRCODEGEN=TRUE
10199     AC_LANG_PUSH([C++])
10200     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10201         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10202     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10203         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10204     QRCODEGEN_LIBS=-lqrcodegencpp
10205     AC_LANG_POP([C++])
10206     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10207     FilterLibs "${QRCODEGEN_LIBS}"
10208     QRCODEGEN_LIBS="${filteredlibs}"
10209 else
10210     AC_MSG_RESULT([internal])
10211     SYSTEM_QRCODEGEN=
10212     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10214 AC_SUBST(SYSTEM_QRCODEGEN)
10215 AC_SUBST(QRCODEGEN_CFLAGS)
10216 AC_SUBST(QRCODEGEN_LIBS)
10218 dnl ===================================================================
10219 dnl Checking for altlinuxhyph
10220 dnl ===================================================================
10221 AC_MSG_CHECKING([which altlinuxhyph to use])
10222 if test "$with_system_altlinuxhyph" = "yes"; then
10223     AC_MSG_RESULT([external])
10224     SYSTEM_HYPH=TRUE
10225     AC_CHECK_HEADER(hyphen.h, [],
10226        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10227     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10228        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10229        [#include <hyphen.h>])
10230     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10231         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10232     if test -z "$HYPHEN_LIB"; then
10233         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10234            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10235     fi
10236     if test -z "$HYPHEN_LIB"; then
10237         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10238            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10239     fi
10240 else
10241     AC_MSG_RESULT([internal])
10242     SYSTEM_HYPH=
10243     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10244     if test "$COM" = "MSC"; then
10245         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10246     else
10247         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10248     fi
10250 AC_SUBST(SYSTEM_HYPH)
10251 AC_SUBST(HYPHEN_LIB)
10253 dnl ===================================================================
10254 dnl Checking for mythes
10255 dnl ===================================================================
10256 AC_MSG_CHECKING([which mythes to use])
10257 if test "$with_system_mythes" = "yes"; then
10258     AC_MSG_RESULT([external])
10259     SYSTEM_MYTHES=TRUE
10260     AC_LANG_PUSH([C++])
10261     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10262     if test "$MYTHES_PKGCONFIG" = "no"; then
10263         AC_CHECK_HEADER(mythes.hxx, [],
10264             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10265         AC_CHECK_LIB([mythes-1.2], [main], [:],
10266             [ MYTHES_FOUND=no], [])
10267     if test "$MYTHES_FOUND" = "no"; then
10268         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10269                 [ MYTHES_FOUND=no], [])
10270     fi
10271     if test "$MYTHES_FOUND" = "no"; then
10272         AC_MSG_ERROR([mythes library not found!.])
10273     fi
10274     fi
10275     AC_LANG_POP([C++])
10276     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10277     FilterLibs "${MYTHES_LIBS}"
10278     MYTHES_LIBS="${filteredlibs}"
10279 else
10280     AC_MSG_RESULT([internal])
10281     SYSTEM_MYTHES=
10282     BUILD_TYPE="$BUILD_TYPE MYTHES"
10283     if test "$COM" = "MSC"; then
10284         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10285     else
10286         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10287     fi
10289 AC_SUBST(SYSTEM_MYTHES)
10290 AC_SUBST(MYTHES_CFLAGS)
10291 AC_SUBST(MYTHES_LIBS)
10293 dnl ===================================================================
10294 dnl How should we build the linear programming solver ?
10295 dnl ===================================================================
10297 ENABLE_COINMP=
10298 AC_MSG_CHECKING([whether to build with CoinMP])
10299 if test "$enable_coinmp" != "no"; then
10300     ENABLE_COINMP=TRUE
10301     AC_MSG_RESULT([yes])
10302     if test "$with_system_coinmp" = "yes"; then
10303         SYSTEM_COINMP=TRUE
10304         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10305         FilterLibs "${COINMP_LIBS}"
10306         COINMP_LIBS="${filteredlibs}"
10307     else
10308         BUILD_TYPE="$BUILD_TYPE COINMP"
10309     fi
10310 else
10311     AC_MSG_RESULT([no])
10313 AC_SUBST(ENABLE_COINMP)
10314 AC_SUBST(SYSTEM_COINMP)
10315 AC_SUBST(COINMP_CFLAGS)
10316 AC_SUBST(COINMP_LIBS)
10318 ENABLE_LPSOLVE=
10319 AC_MSG_CHECKING([whether to build with lpsolve])
10320 if test "$enable_lpsolve" != "no"; then
10321     ENABLE_LPSOLVE=TRUE
10322     AC_MSG_RESULT([yes])
10323 else
10324     AC_MSG_RESULT([no])
10326 AC_SUBST(ENABLE_LPSOLVE)
10328 if test "$ENABLE_LPSOLVE" = TRUE; then
10329     AC_MSG_CHECKING([which lpsolve to use])
10330     if test "$with_system_lpsolve" = "yes"; then
10331         AC_MSG_RESULT([external])
10332         SYSTEM_LPSOLVE=TRUE
10333         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10334            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10335         save_LIBS=$LIBS
10336         # some systems need this. Like Ubuntu...
10337         AC_CHECK_LIB(m, floor)
10338         AC_CHECK_LIB(dl, dlopen)
10339         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10340             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10341         LIBS=$save_LIBS
10342     else
10343         AC_MSG_RESULT([internal])
10344         SYSTEM_LPSOLVE=
10345         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10346     fi
10348 AC_SUBST(SYSTEM_LPSOLVE)
10350 dnl ===================================================================
10351 dnl Checking for libexttextcat
10352 dnl ===================================================================
10353 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10354 if test "$with_system_libexttextcat" = "yes"; then
10355     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10357 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10359 dnl ===================================================================
10360 dnl Checking for libnumbertext
10361 dnl ===================================================================
10362 AC_MSG_CHECKING([whether to use libnumbertext])
10363 if test "$enable_libnumbertext" = "no"; then
10364     AC_MSG_RESULT([no])
10365     ENABLE_LIBNUMBERTEXT=
10366     SYSTEM_LIBNUMBERTEXT=
10367 else
10368     AC_MSG_RESULT([yes])
10369     ENABLE_LIBNUMBERTEXT=TRUE
10370     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10371     if test "$with_system_libnumbertext" = "yes"; then
10372         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10373         SYSTEM_LIBNUMBERTEXT=YES
10374     else
10375         SYSTEM_LIBNUMBERTEXT=
10376         AC_LANG_PUSH([C++])
10377         save_CPPFLAGS=$CPPFLAGS
10378         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10379         AC_CHECK_HEADERS([codecvt regex])
10380         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10381                 [ ENABLE_LIBNUMBERTEXT=''
10382                   LIBNUMBERTEXT_CFLAGS=''
10383                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10384                                Enable libnumbertext fallback (missing number to number name conversion).])
10385                 ])
10386         CPPFLAGS=$save_CPPFLAGS
10387         AC_LANG_POP([C++])
10388     fi
10389     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10390         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10391     fi
10393 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10394 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10395 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10396 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10398 dnl ***************************************
10399 dnl testing libc version for Linux...
10400 dnl ***************************************
10401 if test "$_os" = "Linux"; then
10402     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10403     exec 6>/dev/null # no output
10404     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10405     exec 6>&1 # output on again
10406     if test "$HAVE_LIBC"; then
10407         AC_MSG_RESULT([yes])
10408     else
10409         AC_MSG_ERROR([no, upgrade libc])
10410     fi
10413 dnl =========================================
10414 dnl Check for uuidgen
10415 dnl =========================================
10416 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10417     # presence is already tested above in the WINDOWS_SDK_HOME check
10418     UUIDGEN=uuidgen.exe
10419     AC_SUBST(UUIDGEN)
10420 else
10421     AC_PATH_PROG([UUIDGEN], [uuidgen])
10422     if test -z "$UUIDGEN"; then
10423         AC_MSG_WARN([uuid is needed for building installation sets])
10424     fi
10427 dnl ***************************************
10428 dnl Checking for bison and flex
10429 dnl ***************************************
10430 AC_PATH_PROG(BISON, bison)
10431 if test -z "$BISON"; then
10432     AC_MSG_ERROR([no bison found in \$PATH, install it])
10433 else
10434     AC_MSG_CHECKING([the bison version])
10435     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10436     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10437     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10438     dnl cause
10439     dnl
10440     dnl   idlc/source/parser.y:222:15: error: externally available entity 'YYSTYPE' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]
10441     dnl   typedef union YYSTYPE
10442     dnl           ~~~~~~^~~~~~~
10443     dnl
10444     dnl while at least 3.4.1 is know to be good:
10445     if test "$COMPILER_PLUGINS" = TRUE; then
10446         if test "$_bison_longver" -lt 2004; then
10447             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10448         fi
10449     else
10450         if test "$_bison_longver" -lt 2000; then
10451             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10452         fi
10453     fi
10455 AC_SUBST([BISON])
10457 AC_PATH_PROG(FLEX, flex)
10458 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10459     FLEX=`cygpath -m $FLEX`
10461 if test -z "$FLEX"; then
10462     AC_MSG_ERROR([no flex found in \$PATH, install it])
10463 else
10464     AC_MSG_CHECKING([the flex version])
10465     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10466     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10467         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10468     fi
10470 AC_SUBST([FLEX])
10471 dnl ***************************************
10472 dnl Checking for patch
10473 dnl ***************************************
10474 AC_PATH_PROG(PATCH, patch)
10475 if test -z "$PATCH"; then
10476     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10479 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10480 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10481     if test -z "$with_gnu_patch"; then
10482         GNUPATCH=$PATCH
10483     else
10484         if test -x "$with_gnu_patch"; then
10485             GNUPATCH=$with_gnu_patch
10486         else
10487             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10488         fi
10489     fi
10491     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10492     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10493         AC_MSG_RESULT([yes])
10494     else
10495         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10496     fi
10497 else
10498     GNUPATCH=$PATCH
10501 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10502     GNUPATCH=`cygpath -m $GNUPATCH`
10505 dnl We also need to check for --with-gnu-cp
10507 if test -z "$with_gnu_cp"; then
10508     # check the place where the good stuff is hidden on Solaris...
10509     if test -x /usr/gnu/bin/cp; then
10510         GNUCP=/usr/gnu/bin/cp
10511     else
10512         AC_PATH_PROGS(GNUCP, gnucp cp)
10513     fi
10514     if test -z $GNUCP; then
10515         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10516     fi
10517 else
10518     if test -x "$with_gnu_cp"; then
10519         GNUCP=$with_gnu_cp
10520     else
10521         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10522     fi
10525 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10526     GNUCP=`cygpath -m $GNUCP`
10529 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10530 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10531     AC_MSG_RESULT([yes])
10532 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10533     AC_MSG_RESULT([yes])
10534 else
10535     case "$build_os" in
10536     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10537         x_GNUCP=[\#]
10538         GNUCP=''
10539         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10540         ;;
10541     *)
10542         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10543         ;;
10544     esac
10547 AC_SUBST(GNUPATCH)
10548 AC_SUBST(GNUCP)
10549 AC_SUBST(x_GNUCP)
10551 dnl ***************************************
10552 dnl testing assembler path
10553 dnl ***************************************
10554 ML_EXE=""
10555 if test "$_os" = "WINNT"; then
10556     if test "$BITNESS_OVERRIDE" = ""; then
10557         assembler=ml.exe
10558     else
10559         assembler=ml64.exe
10560     fi
10562     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10563     if test -f "$CL_PATH/$assembler"; then
10564         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10565         AC_MSG_RESULT([$ML_EXE])
10566     else
10567         AC_MSG_ERROR([not found])
10568     fi
10571 AC_SUBST(ML_EXE)
10573 dnl ===================================================================
10574 dnl We need zip and unzip
10575 dnl ===================================================================
10576 AC_PATH_PROG(ZIP, zip)
10577 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10578 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10579     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],,)
10582 AC_PATH_PROG(UNZIP, unzip)
10583 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10585 dnl ===================================================================
10586 dnl Zip must be a specific type for different build types.
10587 dnl ===================================================================
10588 if test $build_os = cygwin; then
10589     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10590         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10591     fi
10594 dnl ===================================================================
10595 dnl We need touch with -h option support.
10596 dnl ===================================================================
10597 AC_PATH_PROG(TOUCH, touch)
10598 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10599 touch warn
10600 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10601     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],,)
10604 dnl ===================================================================
10605 dnl Check for system epoxy
10606 dnl ===================================================================
10607 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10609 dnl ===================================================================
10610 dnl Set vcl option: coordinate device in double or sal_Int32
10611 dnl ===================================================================
10613 dnl disabled for now, we don't want subtle differences between OSs
10614 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10615 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10616 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10617 dnl     AC_MSG_RESULT([double])
10618 dnl else
10619 dnl     AC_MSG_RESULT([sal_Int32])
10620 dnl fi
10622 dnl ===================================================================
10623 dnl Test which vclplugs have to be built.
10624 dnl ===================================================================
10625 R=""
10626 if test "$USING_X11" != TRUE; then
10627     enable_gtk3=no
10629 GTK3_CFLAGS=""
10630 GTK3_LIBS=""
10631 ENABLE_GTK3=""
10632 if test "x$enable_gtk3" = "xyes"; then
10633     if test "$with_system_cairo" = no; then
10634         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10635     fi
10636     : ${with_system_cairo:=yes}
10637     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="")
10638     if test "x$ENABLE_GTK3" = "xTRUE"; then
10639         AC_DEFINE(ENABLE_GTK3)
10640         R="gtk3"
10641     else
10642         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10643     fi
10644     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10645     FilterLibs "${GTK3_LIBS}"
10646     GTK3_LIBS="${filteredlibs}"
10648     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10649     if test "$with_system_epoxy" != "yes"; then
10650         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10651         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10652                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10653     fi
10655 AC_SUBST(GTK3_LIBS)
10656 AC_SUBST(GTK3_CFLAGS)
10657 AC_SUBST(ENABLE_GTK3)
10659 if test "$enable_introspection" = yes; then
10660     if test "$ENABLE_GTK3" = TRUE; then
10661         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10662     else
10663         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10664     fi
10667 ENABLE_QT5=""
10668 if test "x$enable_qt5" = "xyes"; then
10669     ENABLE_QT5="TRUE"
10670     AC_DEFINE(ENABLE_QT5)
10671     R="$R qt5"
10673 AC_SUBST(ENABLE_QT5)
10675 ENABLE_KF5=""
10676 if test "x$enable_kf5" = "xyes"; then
10677     ENABLE_KF5="TRUE"
10678     AC_DEFINE(ENABLE_KF5)
10679     R="$R kf5"
10681 AC_SUBST(ENABLE_KF5)
10683 ENABLE_GTK3_KDE5=""
10684 if test "x$enable_gtk3_kde5" = "xyes"; then
10685     ENABLE_GTK3_KDE5="TRUE"
10686     AC_DEFINE(ENABLE_GTK3_KDE5)
10687     R="$R gtk3_kde5"
10689 AC_SUBST(ENABLE_GTK3_KDE5)
10691 if test "$_os" = "WINNT"; then
10692     R="$R win"
10693 elif test "$_os" = "Darwin"; then
10694     R="$R osx"
10695 elif test "$_os" = "iOS"; then
10696     R="ios (builtin)"
10699 build_vcl_plugins="$R"
10700 if test -z "$build_vcl_plugins"; then
10701     build_vcl_plugins="none"
10703 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10705 dnl ===================================================================
10706 dnl check for dbus support
10707 dnl ===================================================================
10708 ENABLE_DBUS=""
10709 DBUS_CFLAGS=""
10710 DBUS_LIBS=""
10711 DBUS_GLIB_CFLAGS=""
10712 DBUS_GLIB_LIBS=""
10713 DBUS_HAVE_GLIB=""
10715 if test "$enable_dbus" = "no"; then
10716     test_dbus=no
10719 AC_MSG_CHECKING([whether to enable DBUS support])
10720 if test "$test_dbus" = "yes"; then
10721     ENABLE_DBUS="TRUE"
10722     AC_MSG_RESULT([yes])
10723     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10724     AC_DEFINE(ENABLE_DBUS)
10725     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10726     FilterLibs "${DBUS_LIBS}"
10727     DBUS_LIBS="${filteredlibs}"
10729     # Glib is needed for BluetoothServer
10730     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10731     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10732         [
10733             DBUS_HAVE_GLIB="TRUE"
10734             AC_DEFINE(DBUS_HAVE_GLIB,1)
10735         ],
10736         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10737     )
10738 else
10739     AC_MSG_RESULT([no])
10742 AC_SUBST(ENABLE_DBUS)
10743 AC_SUBST(DBUS_CFLAGS)
10744 AC_SUBST(DBUS_LIBS)
10745 AC_SUBST(DBUS_GLIB_CFLAGS)
10746 AC_SUBST(DBUS_GLIB_LIBS)
10747 AC_SUBST(DBUS_HAVE_GLIB)
10749 AC_MSG_CHECKING([whether to enable Impress remote control])
10750 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10751     AC_MSG_RESULT([yes])
10752     ENABLE_SDREMOTE=TRUE
10753     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10755     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10756         # The Bluetooth code doesn't compile with macOS SDK 10.15
10757         enable_sdremote_bluetooth=no
10758     fi
10759     # If not explicitly enabled or disabled, default
10760     if test -z "$enable_sdremote_bluetooth"; then
10761         case "$OS" in
10762         LINUX|MACOSX|WNT)
10763             # Default to yes for these
10764             enable_sdremote_bluetooth=yes
10765             ;;
10766         *)
10767             # otherwise no
10768             enable_sdremote_bluetooth=no
10769             ;;
10770         esac
10771     fi
10772     # $enable_sdremote_bluetooth is guaranteed non-empty now
10774     if test "$enable_sdremote_bluetooth" != "no"; then
10775         if test "$OS" = "LINUX"; then
10776             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10777                 AC_MSG_RESULT([yes])
10778                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10779                 dnl ===================================================================
10780                 dnl Check for system bluez
10781                 dnl ===================================================================
10782                 AC_MSG_CHECKING([which Bluetooth header to use])
10783                 if test "$with_system_bluez" = "yes"; then
10784                     AC_MSG_RESULT([external])
10785                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10786                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10787                     SYSTEM_BLUEZ=TRUE
10788                 else
10789                     AC_MSG_RESULT([internal])
10790                     SYSTEM_BLUEZ=
10791                 fi
10792             else
10793                 AC_MSG_RESULT([no, dbus disabled])
10794                 ENABLE_SDREMOTE_BLUETOOTH=
10795                 SYSTEM_BLUEZ=
10796             fi
10797         else
10798             AC_MSG_RESULT([yes])
10799             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10800             SYSTEM_BLUEZ=
10801         fi
10802     else
10803         AC_MSG_RESULT([no])
10804         ENABLE_SDREMOTE_BLUETOOTH=
10805         SYSTEM_BLUEZ=
10806     fi
10807 else
10808     ENABLE_SDREMOTE=
10809     SYSTEM_BLUEZ=
10810     AC_MSG_RESULT([no])
10812 AC_SUBST(ENABLE_SDREMOTE)
10813 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10814 AC_SUBST(SYSTEM_BLUEZ)
10816 dnl ===================================================================
10817 dnl Check whether to enable GIO support
10818 dnl ===================================================================
10819 if test "$ENABLE_GTK3" = "TRUE"; then
10820     AC_MSG_CHECKING([whether to enable GIO support])
10821     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10822         dnl Need at least 2.26 for the dbus support.
10823         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10824                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10825         if test "$ENABLE_GIO" = "TRUE"; then
10826             AC_DEFINE(ENABLE_GIO)
10827             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10828             FilterLibs "${GIO_LIBS}"
10829             GIO_LIBS="${filteredlibs}"
10830         fi
10831     else
10832         AC_MSG_RESULT([no])
10833     fi
10835 AC_SUBST(ENABLE_GIO)
10836 AC_SUBST(GIO_CFLAGS)
10837 AC_SUBST(GIO_LIBS)
10840 dnl ===================================================================
10842 SPLIT_APP_MODULES=""
10843 if test "$enable_split_app_modules" = "yes"; then
10844     SPLIT_APP_MODULES="TRUE"
10846 AC_SUBST(SPLIT_APP_MODULES)
10848 SPLIT_OPT_FEATURES=""
10849 if test "$enable_split_opt_features" = "yes"; then
10850     SPLIT_OPT_FEATURES="TRUE"
10852 AC_SUBST(SPLIT_OPT_FEATURES)
10854 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10855     if test "$enable_cairo_canvas" = yes; then
10856         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10857     fi
10858     enable_cairo_canvas=no
10859 elif test -z "$enable_cairo_canvas"; then
10860     enable_cairo_canvas=yes
10863 ENABLE_CAIRO_CANVAS=""
10864 if test "$enable_cairo_canvas" = "yes"; then
10865     test_cairo=yes
10866     ENABLE_CAIRO_CANVAS="TRUE"
10867     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10869 AC_SUBST(ENABLE_CAIRO_CANVAS)
10871 dnl ===================================================================
10872 dnl Check whether the GStreamer libraries are available.
10873 dnl ===================================================================
10875 ENABLE_GSTREAMER_1_0=""
10877 if test "$build_gstreamer_1_0" = "yes"; then
10879     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10880     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10881         ENABLE_GSTREAMER_1_0="TRUE"
10882         AC_MSG_RESULT([yes])
10883         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10884         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10885         FilterLibs "${GSTREAMER_1_0_LIBS}"
10886         GSTREAMER_1_0_LIBS="${filteredlibs}"
10887         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10888     else
10889         AC_MSG_RESULT([no])
10890     fi
10892 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10893 AC_SUBST(GSTREAMER_1_0_LIBS)
10894 AC_SUBST(ENABLE_GSTREAMER_1_0)
10896 dnl ===================================================================
10897 dnl Check whether to build the VLC avmedia backend
10898 dnl ===================================================================
10900 ENABLE_VLC=""
10902 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10903 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10904     ENABLE_VLC="TRUE"
10905     AC_MSG_RESULT([yes])
10906 else
10907     AC_MSG_RESULT([no])
10909 AC_SUBST(ENABLE_VLC)
10911 ENABLE_OPENGL_TRANSITIONS=
10912 ENABLE_OPENGL_CANVAS=
10913 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10914    : # disable
10915 elif test "$_os" = "Darwin"; then
10916     # We use frameworks on macOS, no need for detail checks
10917     ENABLE_OPENGL_TRANSITIONS=TRUE
10918     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10919     ENABLE_OPENGL_CANVAS=TRUE
10920 elif test $_os = WINNT; then
10921     ENABLE_OPENGL_TRANSITIONS=TRUE
10922     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10923     ENABLE_OPENGL_CANVAS=TRUE
10924 else
10925     if test "$USING_X11" = TRUE; then
10926         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10927         ENABLE_OPENGL_TRANSITIONS=TRUE
10928         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10929         ENABLE_OPENGL_CANVAS=TRUE
10930     fi
10933 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10934 AC_SUBST(ENABLE_OPENGL_CANVAS)
10936 dnl =================================================
10937 dnl Check whether to build with OpenCL support.
10938 dnl =================================================
10940 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10941     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10942     # platform (optional at run-time, used through clew).
10943     BUILD_TYPE="$BUILD_TYPE OPENCL"
10944     AC_DEFINE(HAVE_FEATURE_OPENCL)
10947 dnl =================================================
10948 dnl Check whether to build with dconf support.
10949 dnl =================================================
10951 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10952     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10953         if test "$enable_dconf" = yes; then
10954             AC_MSG_ERROR([dconf not found])
10955         else
10956             enable_dconf=no
10957         fi])
10959 AC_MSG_CHECKING([whether to enable dconf])
10960 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10961     DCONF_CFLAGS=
10962     DCONF_LIBS=
10963     ENABLE_DCONF=
10964     AC_MSG_RESULT([no])
10965 else
10966     ENABLE_DCONF=TRUE
10967     AC_DEFINE(ENABLE_DCONF)
10968     AC_MSG_RESULT([yes])
10970 AC_SUBST([DCONF_CFLAGS])
10971 AC_SUBST([DCONF_LIBS])
10972 AC_SUBST([ENABLE_DCONF])
10974 # pdf import?
10975 AC_MSG_CHECKING([whether to build the PDF import feature])
10976 ENABLE_PDFIMPORT=
10977 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10978     AC_MSG_RESULT([yes])
10979     ENABLE_PDFIMPORT=TRUE
10980     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10981 else
10982     AC_MSG_RESULT([no])
10985 # Pdfium?
10986 AC_MSG_CHECKING([whether to build PDFium])
10987 ENABLE_PDFIUM=
10988 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10989     AC_MSG_RESULT([yes])
10990     ENABLE_PDFIUM=TRUE
10991     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10992     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10993 else
10994     AC_MSG_RESULT([no])
10996 AC_SUBST(ENABLE_PDFIUM)
10998 dnl ===================================================================
10999 dnl Check for poppler
11000 dnl ===================================================================
11001 ENABLE_POPPLER=
11002 AC_MSG_CHECKING([whether to build Poppler])
11003 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11004     AC_MSG_RESULT([yes])
11005     ENABLE_POPPLER=TRUE
11006     AC_DEFINE(HAVE_FEATURE_POPPLER)
11007 else
11008     AC_MSG_RESULT([no])
11010 AC_SUBST(ENABLE_POPPLER)
11012 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11013     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11016 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11017     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11020 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11021     dnl ===================================================================
11022     dnl Check for system poppler
11023     dnl ===================================================================
11024     AC_MSG_CHECKING([which PDF import poppler to use])
11025     if test "$with_system_poppler" = "yes"; then
11026         AC_MSG_RESULT([external])
11027         SYSTEM_POPPLER=TRUE
11028         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11029         AC_LANG_PUSH([C++])
11030         save_CXXFLAGS=$CXXFLAGS
11031         save_CPPFLAGS=$CPPFLAGS
11032         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11033         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11034         AC_CHECK_HEADER([cpp/poppler-version.h],
11035             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11036             [])
11037         CXXFLAGS=$save_CXXFLAGS
11038         CPPFLAGS=$save_CPPFLAGS
11039         AC_LANG_POP([C++])
11040         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11042         FilterLibs "${POPPLER_LIBS}"
11043         POPPLER_LIBS="${filteredlibs}"
11044     else
11045         AC_MSG_RESULT([internal])
11046         SYSTEM_POPPLER=
11047         BUILD_TYPE="$BUILD_TYPE POPPLER"
11048         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11049     fi
11050     AC_DEFINE([ENABLE_PDFIMPORT],1)
11052 AC_SUBST(ENABLE_PDFIMPORT)
11053 AC_SUBST(SYSTEM_POPPLER)
11054 AC_SUBST(POPPLER_CFLAGS)
11055 AC_SUBST(POPPLER_LIBS)
11057 # Skia?
11058 AC_MSG_CHECKING([whether to build Skia])
11059 ENABLE_SKIA=
11060 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11061     AC_MSG_RESULT([yes])
11062     ENABLE_SKIA=TRUE
11063     AC_DEFINE(HAVE_FEATURE_SKIA)
11064     BUILD_TYPE="$BUILD_TYPE SKIA"
11065 else
11066     AC_MSG_RESULT([no])
11068 AC_SUBST(ENABLE_SKIA)
11070 SYSTEM_GPGMEPP=
11072 if test "$build_for_ios" = "YES"; then
11073     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11074     AC_MSG_RESULT([yes])
11075 elif test "$enable_mpl_subset" = "yes"; then
11076     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11077     AC_MSG_RESULT([yes])
11078 elif test "$enable_fuzzers" = "yes"; then
11079     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11080     AC_MSG_RESULT([yes])
11081 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11082     dnl ===================================================================
11083     dnl Check for system gpgme
11084     dnl ===================================================================
11085     AC_MSG_CHECKING([which gpgmepp to use])
11086     if test "$with_system_gpgmepp" = "yes"; then
11087         AC_MSG_RESULT([external])
11088         SYSTEM_GPGMEPP=TRUE
11090         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11091         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11092             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11093         # progress_callback is the only func with plain C linkage
11094         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11095         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11096             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11097         AC_CHECK_HEADER(gpgme.h, [],
11098             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11099     else
11100         AC_MSG_RESULT([internal])
11101         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11102         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11104         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11105         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11106         if test "$_os" != "WINNT"; then
11107             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11108             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11109         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11110             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11111         fi
11112     fi
11113     ENABLE_GPGMEPP=TRUE
11114     AC_DEFINE([HAVE_FEATURE_GPGME])
11115     AC_PATH_PROG(GPG, gpg)
11116     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11117     # so let's exclude that manually for the moment
11118     if test -n "$GPG" -a "$_os" != "WINNT"; then
11119         # make sure we not only have a working gpgme, but a full working
11120         # gpg installation to run OpenPGP signature verification
11121         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11122     fi
11123     if test "$_os" = "Linux"; then
11124       uid=`id -u`
11125       AC_MSG_CHECKING([for /run/user/$uid])
11126       if test -d /run/user/$uid; then
11127         AC_MSG_RESULT([yes])
11128         AC_PATH_PROG(GPGCONF, gpgconf)
11130         # Older versions of gpgconf are not working as expected, since
11131         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11132         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11133         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11134         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11135         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11136         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11137         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11138           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11139           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11140           if $GPGCONF --dump-options > /dev/null ; then
11141             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11142               AC_MSG_RESULT([yes])
11143               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11144               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11145             else
11146               AC_MSG_RESULT([no])
11147             fi
11148           else
11149             AC_MSG_RESULT([no. missing or broken gpgconf?])
11150           fi
11151         else
11152           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11153         fi
11154       else
11155         AC_MSG_RESULT([no])
11156      fi
11157    fi
11159 AC_SUBST(ENABLE_GPGMEPP)
11160 AC_SUBST(SYSTEM_GPGMEPP)
11161 AC_SUBST(GPG_ERROR_CFLAGS)
11162 AC_SUBST(GPG_ERROR_LIBS)
11163 AC_SUBST(LIBASSUAN_CFLAGS)
11164 AC_SUBST(LIBASSUAN_LIBS)
11165 AC_SUBST(GPGMEPP_CFLAGS)
11166 AC_SUBST(GPGMEPP_LIBS)
11168 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11169 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11170     AC_MSG_RESULT([yes])
11171     ENABLE_MEDIAWIKI=TRUE
11172     BUILD_TYPE="$BUILD_TYPE XSLTML"
11173     if test  "x$with_java" = "xno"; then
11174         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11175     fi
11176 else
11177     AC_MSG_RESULT([no])
11178     ENABLE_MEDIAWIKI=
11179     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11181 AC_SUBST(ENABLE_MEDIAWIKI)
11183 AC_MSG_CHECKING([whether to build the Report Builder])
11184 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11185     AC_MSG_RESULT([yes])
11186     ENABLE_REPORTBUILDER=TRUE
11187     AC_MSG_CHECKING([which jfreereport libs to use])
11188     if test "$with_system_jfreereport" = "yes"; then
11189         SYSTEM_JFREEREPORT=TRUE
11190         AC_MSG_RESULT([external])
11191         if test -z $SAC_JAR; then
11192             SAC_JAR=/usr/share/java/sac.jar
11193         fi
11194         if ! test -f $SAC_JAR; then
11195              AC_MSG_ERROR(sac.jar not found.)
11196         fi
11198         if test -z $LIBXML_JAR; then
11199             if test -f /usr/share/java/libxml-1.0.0.jar; then
11200                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11201             elif test -f /usr/share/java/libxml.jar; then
11202                 LIBXML_JAR=/usr/share/java/libxml.jar
11203             else
11204                 AC_MSG_ERROR(libxml.jar replacement not found.)
11205             fi
11206         elif ! test -f $LIBXML_JAR; then
11207             AC_MSG_ERROR(libxml.jar not found.)
11208         fi
11210         if test -z $FLUTE_JAR; then
11211             if test -f/usr/share/java/flute-1.3.0.jar; then
11212                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11213             elif test -f /usr/share/java/flute.jar; then
11214                 FLUTE_JAR=/usr/share/java/flute.jar
11215             else
11216                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11217             fi
11218         elif ! test -f $FLUTE_JAR; then
11219             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11220         fi
11222         if test -z $JFREEREPORT_JAR; then
11223             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11224                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11225             elif test -f /usr/share/java/flow-engine.jar; then
11226                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11227             else
11228                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11229             fi
11230         elif ! test -f  $JFREEREPORT_JAR; then
11231                 AC_MSG_ERROR(jfreereport.jar not found.)
11232         fi
11234         if test -z $LIBLAYOUT_JAR; then
11235             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11236                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11237             elif test -f /usr/share/java/liblayout.jar; then
11238                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11239             else
11240                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11241             fi
11242         elif ! test -f $LIBLAYOUT_JAR; then
11243                 AC_MSG_ERROR(liblayout.jar not found.)
11244         fi
11246         if test -z $LIBLOADER_JAR; then
11247             if test -f /usr/share/java/libloader-1.0.0.jar; then
11248                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11249             elif test -f /usr/share/java/libloader.jar; then
11250                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11251             else
11252                 AC_MSG_ERROR(libloader.jar replacement not found.)
11253             fi
11254         elif ! test -f  $LIBLOADER_JAR; then
11255             AC_MSG_ERROR(libloader.jar not found.)
11256         fi
11258         if test -z $LIBFORMULA_JAR; then
11259             if test -f /usr/share/java/libformula-0.2.0.jar; then
11260                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11261             elif test -f /usr/share/java/libformula.jar; then
11262                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11263             else
11264                 AC_MSG_ERROR(libformula.jar replacement not found.)
11265             fi
11266         elif ! test -f $LIBFORMULA_JAR; then
11267                 AC_MSG_ERROR(libformula.jar not found.)
11268         fi
11270         if test -z $LIBREPOSITORY_JAR; then
11271             if test -f /usr/share/java/librepository-1.0.0.jar; then
11272                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11273             elif test -f /usr/share/java/librepository.jar; then
11274                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11275             else
11276                 AC_MSG_ERROR(librepository.jar replacement not found.)
11277             fi
11278         elif ! test -f $LIBREPOSITORY_JAR; then
11279             AC_MSG_ERROR(librepository.jar not found.)
11280         fi
11282         if test -z $LIBFONTS_JAR; then
11283             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11284                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11285             elif test -f /usr/share/java/libfonts.jar; then
11286                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11287             else
11288                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11289             fi
11290         elif ! test -f $LIBFONTS_JAR; then
11291                 AC_MSG_ERROR(libfonts.jar not found.)
11292         fi
11294         if test -z $LIBSERIALIZER_JAR; then
11295             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11296                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11297             elif test -f /usr/share/java/libserializer.jar; then
11298                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11299             else
11300                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11301             fi
11302         elif ! test -f $LIBSERIALIZER_JAR; then
11303                 AC_MSG_ERROR(libserializer.jar not found.)
11304         fi
11306         if test -z $LIBBASE_JAR; then
11307             if test -f /usr/share/java/libbase-1.0.0.jar; then
11308                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11309             elif test -f /usr/share/java/libbase.jar; then
11310                 LIBBASE_JAR=/usr/share/java/libbase.jar
11311             else
11312                 AC_MSG_ERROR(libbase.jar replacement not found.)
11313             fi
11314         elif ! test -f $LIBBASE_JAR; then
11315             AC_MSG_ERROR(libbase.jar not found.)
11316         fi
11318     else
11319         AC_MSG_RESULT([internal])
11320         SYSTEM_JFREEREPORT=
11321         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11322         NEED_ANT=TRUE
11323     fi
11324 else
11325     AC_MSG_RESULT([no])
11326     ENABLE_REPORTBUILDER=
11327     SYSTEM_JFREEREPORT=
11329 AC_SUBST(ENABLE_REPORTBUILDER)
11330 AC_SUBST(SYSTEM_JFREEREPORT)
11331 AC_SUBST(SAC_JAR)
11332 AC_SUBST(LIBXML_JAR)
11333 AC_SUBST(FLUTE_JAR)
11334 AC_SUBST(JFREEREPORT_JAR)
11335 AC_SUBST(LIBBASE_JAR)
11336 AC_SUBST(LIBLAYOUT_JAR)
11337 AC_SUBST(LIBLOADER_JAR)
11338 AC_SUBST(LIBFORMULA_JAR)
11339 AC_SUBST(LIBREPOSITORY_JAR)
11340 AC_SUBST(LIBFONTS_JAR)
11341 AC_SUBST(LIBSERIALIZER_JAR)
11343 # this has to be here because both the Wiki Publisher and the SRB use
11344 # commons-logging
11345 COMMONS_LOGGING_VERSION=1.2
11346 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11347     AC_MSG_CHECKING([which Apache commons-* libs to use])
11348     if test "$with_system_apache_commons" = "yes"; then
11349         SYSTEM_APACHE_COMMONS=TRUE
11350         AC_MSG_RESULT([external])
11351         if test -z $COMMONS_LOGGING_JAR; then
11352             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11353                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11354            elif test -f /usr/share/java/commons-logging.jar; then
11355                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11356             else
11357                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11358             fi
11359         elif ! test -f $COMMONS_LOGGING_JAR; then
11360             AC_MSG_ERROR(commons-logging.jar not found.)
11361         fi
11362     else
11363         AC_MSG_RESULT([internal])
11364         SYSTEM_APACHE_COMMONS=
11365         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11366         NEED_ANT=TRUE
11367     fi
11369 AC_SUBST(SYSTEM_APACHE_COMMONS)
11370 AC_SUBST(COMMONS_LOGGING_JAR)
11371 AC_SUBST(COMMONS_LOGGING_VERSION)
11373 # scripting provider for BeanShell?
11374 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11375 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11376     AC_MSG_RESULT([yes])
11377     ENABLE_SCRIPTING_BEANSHELL=TRUE
11379     dnl ===================================================================
11380     dnl Check for system beanshell
11381     dnl ===================================================================
11382     AC_MSG_CHECKING([which beanshell to use])
11383     if test "$with_system_beanshell" = "yes"; then
11384         AC_MSG_RESULT([external])
11385         SYSTEM_BSH=TRUE
11386         if test -z $BSH_JAR; then
11387             BSH_JAR=/usr/share/java/bsh.jar
11388         fi
11389         if ! test -f $BSH_JAR; then
11390             AC_MSG_ERROR(bsh.jar not found.)
11391         fi
11392     else
11393         AC_MSG_RESULT([internal])
11394         SYSTEM_BSH=
11395         BUILD_TYPE="$BUILD_TYPE BSH"
11396     fi
11397 else
11398     AC_MSG_RESULT([no])
11399     ENABLE_SCRIPTING_BEANSHELL=
11400     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11402 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11403 AC_SUBST(SYSTEM_BSH)
11404 AC_SUBST(BSH_JAR)
11406 # scripting provider for JavaScript?
11407 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11408 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11409     AC_MSG_RESULT([yes])
11410     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11412     dnl ===================================================================
11413     dnl Check for system rhino
11414     dnl ===================================================================
11415     AC_MSG_CHECKING([which rhino to use])
11416     if test "$with_system_rhino" = "yes"; then
11417         AC_MSG_RESULT([external])
11418         SYSTEM_RHINO=TRUE
11419         if test -z $RHINO_JAR; then
11420             RHINO_JAR=/usr/share/java/js.jar
11421         fi
11422         if ! test -f $RHINO_JAR; then
11423             AC_MSG_ERROR(js.jar not found.)
11424         fi
11425     else
11426         AC_MSG_RESULT([internal])
11427         SYSTEM_RHINO=
11428         BUILD_TYPE="$BUILD_TYPE RHINO"
11429         NEED_ANT=TRUE
11430     fi
11431 else
11432     AC_MSG_RESULT([no])
11433     ENABLE_SCRIPTING_JAVASCRIPT=
11434     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11436 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11437 AC_SUBST(SYSTEM_RHINO)
11438 AC_SUBST(RHINO_JAR)
11440 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11441 # paths should be added to library search path. So lets put all 64-bit
11442 # platforms there.
11443 supports_multilib=
11444 case "$host_cpu" in
11445 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11446     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11447         supports_multilib="yes"
11448     fi
11449     ;;
11451     ;;
11452 esac
11454 dnl ===================================================================
11455 dnl QT5 Integration
11456 dnl ===================================================================
11458 QT5_CFLAGS=""
11459 QT5_LIBS=""
11460 QMAKE5="qmake"
11461 MOC5="moc"
11462 QT5_GOBJECT_CFLAGS=""
11463 QT5_GOBJECT_LIBS=""
11464 QT5_HAVE_GOBJECT=""
11465 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11466         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11467         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11468 then
11469     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11470     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11472     if test -n "$supports_multilib"; then
11473         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11474     fi
11476     qt5_test_include="QtWidgets/qapplication.h"
11477     qt5_test_library="libQt5Widgets.so"
11479     dnl Check for qmake5
11480     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11481     if test "$QMAKE5" = "no"; then
11482         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11483     else
11484         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11485         if test -z "$qmake5_test_ver"; then
11486             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11487         fi
11488         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11489         qt5_minimal_minor="6"
11490         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11491             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11492         else
11493             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11494         fi
11495     fi
11497     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11498     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11500     AC_MSG_CHECKING([for Qt5 headers])
11501     qt5_incdir="no"
11502     for inc_dir in $qt5_incdirs; do
11503         if test -r "$inc_dir/$qt5_test_include"; then
11504             qt5_incdir="$inc_dir"
11505             break
11506         fi
11507     done
11508     AC_MSG_RESULT([$qt5_incdir])
11509     if test "x$qt5_incdir" = "xno"; then
11510         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11511     fi
11513     AC_MSG_CHECKING([for Qt5 libraries])
11514     qt5_libdir="no"
11515     for lib_dir in $qt5_libdirs; do
11516         if test -r "$lib_dir/$qt5_test_library"; then
11517             qt5_libdir="$lib_dir"
11518             break
11519         fi
11520     done
11521     AC_MSG_RESULT([$qt5_libdir])
11522     if test "x$qt5_libdir" = "xno"; then
11523         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11524     fi
11526     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11527     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11528     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11530     if test "$USING_X11" = TRUE; then
11531         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11532         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11533             QT5_HAVE_XCB_ICCCM=1
11534             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11535         ],[
11536             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)])
11537             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11538         ])
11539         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11540         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11541         QT5_USING_X11=1
11542         AC_DEFINE(QT5_USING_X11)
11543     fi
11545     dnl Check for Meta Object Compiler
11547     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11548     if test "$MOC5" = "no"; then
11549         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11550 the root of your Qt installation by exporting QT5DIR before running "configure".])
11551     fi
11553     if test "$build_gstreamer_1_0" = "yes"; then
11554         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11555                 QT5_HAVE_GOBJECT=1
11556                 AC_DEFINE(QT5_HAVE_GOBJECT)
11557             ],
11558             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11559         )
11560     fi
11562 AC_SUBST(QT5_CFLAGS)
11563 AC_SUBST(QT5_LIBS)
11564 AC_SUBST(MOC5)
11565 AC_SUBST(QT5_GOBJECT_CFLAGS)
11566 AC_SUBST(QT5_GOBJECT_LIBS)
11567 AC_SUBST(QT5_HAVE_GOBJECT)
11569 dnl ===================================================================
11570 dnl KF5 Integration
11571 dnl ===================================================================
11573 KF5_CFLAGS=""
11574 KF5_LIBS=""
11575 KF5_CONFIG="kf5-config"
11576 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11577         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11578 then
11579     if test "$OS" = "HAIKU"; then
11580         haiku_arch="`echo $RTL_ARCH | tr X x`"
11581         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11582         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11583     fi
11585     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11586     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11587     if test -n "$supports_multilib"; then
11588         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11589     fi
11591     kf5_test_include="KF5/kcoreaddons_version.h"
11592     kf5_test_library="libKF5CoreAddons.so"
11593     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11595     dnl kf5 KDE4 support compatibility installed
11596     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11597     if test "$KF5_CONFIG" != "no"; then
11598         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11599         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11600     fi
11602     dnl Check for KF5 headers
11603     AC_MSG_CHECKING([for KF5 headers])
11604     kf5_incdir="no"
11605     for kf5_check in $kf5_incdirs; do
11606         if test -r "$kf5_check/$kf5_test_include"; then
11607             kf5_incdir="$kf5_check/KF5"
11608             break
11609         fi
11610     done
11611     AC_MSG_RESULT([$kf5_incdir])
11612     if test "x$kf5_incdir" = "xno"; then
11613         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11614     fi
11616     dnl Check for KF5 libraries
11617     AC_MSG_CHECKING([for KF5 libraries])
11618     kf5_libdir="no"
11619     for kf5_check in $kf5_libdirs; do
11620         if test -r "$kf5_check/$kf5_test_library"; then
11621             kf5_libdir="$kf5_check"
11622             break
11623         fi
11624     done
11626     AC_MSG_RESULT([$kf5_libdir])
11627     if test "x$kf5_libdir" = "xno"; then
11628         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11629     fi
11631     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"
11632     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11633     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11635     if test "$USING_X11" = TRUE; then
11636         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11637     fi
11639     AC_LANG_PUSH([C++])
11640     save_CXXFLAGS=$CXXFLAGS
11641     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11642     AC_MSG_CHECKING([whether KDE is >= 5.0])
11643        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11644 #include <kcoreaddons_version.h>
11646 int main(int argc, char **argv) {
11647        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11648        else return 1;
11650        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11651     CXXFLAGS=$save_CXXFLAGS
11652     AC_LANG_POP([C++])
11654 AC_SUBST(KF5_CFLAGS)
11655 AC_SUBST(KF5_LIBS)
11657 dnl ===================================================================
11658 dnl Test whether to include Evolution 2 support
11659 dnl ===================================================================
11660 AC_MSG_CHECKING([whether to enable evolution 2 support])
11661 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11662     AC_MSG_RESULT([yes])
11663     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11664     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11665     FilterLibs "${GOBJECT_LIBS}"
11666     GOBJECT_LIBS="${filteredlibs}"
11667     ENABLE_EVOAB2="TRUE"
11668 else
11669     ENABLE_EVOAB2=""
11670     AC_MSG_RESULT([no])
11672 AC_SUBST(ENABLE_EVOAB2)
11673 AC_SUBST(GOBJECT_CFLAGS)
11674 AC_SUBST(GOBJECT_LIBS)
11676 dnl ===================================================================
11677 dnl Test which themes to include
11678 dnl ===================================================================
11679 AC_MSG_CHECKING([which themes to include])
11680 # if none given use default subset of available themes
11681 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11682     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11685 WITH_THEMES=""
11686 if test "x$with_theme" != "xno"; then
11687     for theme in $with_theme; do
11688         case $theme in
11689         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11690         default) real_theme=colibre ;;
11691         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11692         esac
11693         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11694     done
11696 AC_MSG_RESULT([$WITH_THEMES])
11697 AC_SUBST([WITH_THEMES])
11698 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11699 for theme in $with_theme; do
11700     case $theme in
11701     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11702     *) ;;
11703     esac
11704 done
11706 dnl ===================================================================
11707 dnl Test whether to integrate helppacks into the product's installer
11708 dnl ===================================================================
11709 AC_MSG_CHECKING([for helppack integration])
11710 if test "$with_helppack_integration" = "no"; then
11711     AC_MSG_RESULT([no integration])
11712 else
11713     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11714     AC_MSG_RESULT([integration])
11717 ###############################################################################
11718 # Extensions checking
11719 ###############################################################################
11720 AC_MSG_CHECKING([for extensions integration])
11721 if test "x$enable_extension_integration" != "xno"; then
11722     WITH_EXTENSION_INTEGRATION=TRUE
11723     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11724     AC_MSG_RESULT([yes, use integration])
11725 else
11726     WITH_EXTENSION_INTEGRATION=
11727     AC_MSG_RESULT([no, do not integrate])
11729 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11731 dnl Should any extra extensions be included?
11732 dnl There are standalone tests for each of these below.
11733 WITH_EXTRA_EXTENSIONS=
11734 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11736 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11737 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11738 if test "x$with_java" != "xno"; then
11739     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11740     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11743 AC_MSG_CHECKING([whether to build opens___.ttf])
11744 if test "$enable_build_opensymbol" = "yes"; then
11745     AC_MSG_RESULT([yes])
11746     AC_PATH_PROG(FONTFORGE, fontforge)
11747     if test -z "$FONTFORGE"; then
11748         AC_MSG_ERROR([fontforge not installed])
11749     fi
11750 else
11751     AC_MSG_RESULT([no])
11752     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11753     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11755 AC_SUBST(OPENSYMBOL_TTF)
11756 AC_SUBST(FONTFORGE)
11758 dnl ===================================================================
11759 dnl Test whether to include fonts
11760 dnl ===================================================================
11761 AC_MSG_CHECKING([whether to include third-party fonts])
11762 if test "$with_fonts" != "no"; then
11763     AC_MSG_RESULT([yes])
11764     WITH_FONTS=TRUE
11765     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11766     AC_DEFINE(HAVE_MORE_FONTS)
11767 else
11768     AC_MSG_RESULT([no])
11769     WITH_FONTS=
11770     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11772 AC_SUBST(WITH_FONTS)
11775 dnl ===================================================================
11776 dnl Test whether to enable online update service
11777 dnl ===================================================================
11778 AC_MSG_CHECKING([whether to enable online update])
11779 ENABLE_ONLINE_UPDATE=
11780 ENABLE_ONLINE_UPDATE_MAR=
11781 UPDATE_CONFIG=
11782 if test "$enable_online_update" = ""; then
11783     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11784         AC_MSG_RESULT([yes])
11785         ENABLE_ONLINE_UPDATE="TRUE"
11786     else
11787         AC_MSG_RESULT([no])
11788     fi
11789 else
11790     if test "$enable_online_update" = "mar"; then
11791         AC_MSG_RESULT([yes - MAR-based online update])
11792         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11793         if test "$with_update_config" = ""; then
11794             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11795         fi
11796         UPDATE_CONFIG="$with_update_config"
11797         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11798     elif test "$enable_online_update" = "yes"; then
11799         AC_MSG_RESULT([yes])
11800         ENABLE_ONLINE_UPDATE="TRUE"
11801     else
11802         AC_MSG_RESULT([no])
11803     fi
11805 AC_SUBST(ENABLE_ONLINE_UPDATE)
11806 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11807 AC_SUBST(UPDATE_CONFIG)
11809 dnl ===================================================================
11810 dnl Test whether we need bzip2
11811 dnl ===================================================================
11812 SYSTEM_BZIP2=
11813 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11814     AC_MSG_CHECKING([whether to use system bzip2])
11815     if test "$with_system_bzip2" = yes; then
11816         SYSTEM_BZIP2=TRUE
11817         AC_MSG_RESULT([yes])
11818         PKG_CHECK_MODULES(BZIP2, bzip2)
11819         FilterLibs "${BZIP2_LIBS}"
11820         BZIP2_LIBS="${filteredlibs}"
11821     else
11822         AC_MSG_RESULT([no])
11823         BUILD_TYPE="$BUILD_TYPE BZIP2"
11824     fi
11826 AC_SUBST(SYSTEM_BZIP2)
11827 AC_SUBST(BZIP2_CFLAGS)
11828 AC_SUBST(BZIP2_LIBS)
11830 dnl ===================================================================
11831 dnl Test whether to enable extension update
11832 dnl ===================================================================
11833 AC_MSG_CHECKING([whether to enable extension update])
11834 ENABLE_EXTENSION_UPDATE=
11835 if test "x$enable_extension_update" = "xno"; then
11836     AC_MSG_RESULT([no])
11837 else
11838     AC_MSG_RESULT([yes])
11839     ENABLE_EXTENSION_UPDATE="TRUE"
11840     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11841     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11843 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11846 dnl ===================================================================
11847 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11848 dnl ===================================================================
11849 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11850 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11851     AC_MSG_RESULT([no])
11852     ENABLE_SILENT_MSI=
11853 else
11854     AC_MSG_RESULT([yes])
11855     ENABLE_SILENT_MSI=TRUE
11856     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11858 AC_SUBST(ENABLE_SILENT_MSI)
11860 AC_MSG_CHECKING([whether and how to use Xinerama])
11861 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11862     if test "$x_libraries" = "default_x_libraries"; then
11863         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11864         if test "x$XINERAMALIB" = x; then
11865            XINERAMALIB="/usr/lib"
11866         fi
11867     else
11868         XINERAMALIB="$x_libraries"
11869     fi
11870     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11871         # we have both versions, let the user decide but use the dynamic one
11872         # per default
11873         USE_XINERAMA=TRUE
11874         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11875             XINERAMA_LINK=dynamic
11876         else
11877             XINERAMA_LINK=static
11878         fi
11879     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11880         # we have only the dynamic version
11881         USE_XINERAMA=TRUE
11882         XINERAMA_LINK=dynamic
11883     elif test -e "$XINERAMALIB/libXinerama.a"; then
11884         # static version
11885         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11886             USE_XINERAMA=TRUE
11887             XINERAMA_LINK=static
11888         else
11889             USE_XINERAMA=
11890             XINERAMA_LINK=none
11891         fi
11892     else
11893         # no Xinerama
11894         USE_XINERAMA=
11895         XINERAMA_LINK=none
11896     fi
11897     if test "$USE_XINERAMA" = "TRUE"; then
11898         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11899         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11900             [AC_MSG_ERROR(Xinerama header not found.)], [])
11901         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11902         if test "x$XEXTLIB" = x; then
11903            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11904         fi
11905         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11906         if test "$_os" = "FreeBSD"; then
11907             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11908         fi
11909         if test "$_os" = "Linux"; then
11910             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11911         fi
11912         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11913             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11914     else
11915         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11916     fi
11917 else
11918     USE_XINERAMA=
11919     XINERAMA_LINK=none
11920     AC_MSG_RESULT([no])
11922 AC_SUBST(USE_XINERAMA)
11923 AC_SUBST(XINERAMA_LINK)
11925 dnl ===================================================================
11926 dnl Test whether to build cairo or rely on the system version
11927 dnl ===================================================================
11929 if test "$USING_X11" = TRUE; then
11930     # Used in vcl/Library_vclplug_gen.mk
11931     test_cairo=yes
11934 if test "$test_cairo" = "yes"; then
11935     AC_MSG_CHECKING([whether to use the system cairo])
11937     : ${with_system_cairo:=$with_system_libs}
11938     if test "$with_system_cairo" = "yes"; then
11939         SYSTEM_CAIRO=TRUE
11940         AC_MSG_RESULT([yes])
11942         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11943         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11944         FilterLibs "${CAIRO_LIBS}"
11945         CAIRO_LIBS="${filteredlibs}"
11947         if test "$test_xrender" = "yes"; then
11948             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11949             AC_LANG_PUSH([C])
11950             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11951 #ifdef PictStandardA8
11952 #else
11953       return fail;
11954 #endif
11955 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11957             AC_LANG_POP([C])
11958         fi
11959     else
11960         SYSTEM_CAIRO=
11961         AC_MSG_RESULT([no])
11963         BUILD_TYPE="$BUILD_TYPE CAIRO"
11964     fi
11967 AC_SUBST(SYSTEM_CAIRO)
11968 AC_SUBST(CAIRO_CFLAGS)
11969 AC_SUBST(CAIRO_LIBS)
11971 dnl ===================================================================
11972 dnl Test whether to use avahi
11973 dnl ===================================================================
11974 if test "$_os" = "WINNT"; then
11975     # Windows uses bundled mDNSResponder
11976     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11977 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11978     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11979                       [ENABLE_AVAHI="TRUE"])
11980     AC_DEFINE(HAVE_FEATURE_AVAHI)
11981     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11982     FilterLibs "${AVAHI_LIBS}"
11983     AVAHI_LIBS="${filteredlibs}"
11986 AC_SUBST(ENABLE_AVAHI)
11987 AC_SUBST(AVAHI_CFLAGS)
11988 AC_SUBST(AVAHI_LIBS)
11990 dnl ===================================================================
11991 dnl Test whether to use liblangtag
11992 dnl ===================================================================
11993 SYSTEM_LIBLANGTAG=
11994 AC_MSG_CHECKING([whether to use system liblangtag])
11995 if test "$with_system_liblangtag" = yes; then
11996     SYSTEM_LIBLANGTAG=TRUE
11997     AC_MSG_RESULT([yes])
11998     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11999     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12000     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12001     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12002     FilterLibs "${LIBLANGTAG_LIBS}"
12003     LIBLANGTAG_LIBS="${filteredlibs}"
12004 else
12005     SYSTEM_LIBLANGTAG=
12006     AC_MSG_RESULT([no])
12007     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12008     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12009     if test "$COM" = "MSC"; then
12010         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12011     else
12012         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12013     fi
12015 AC_SUBST(SYSTEM_LIBLANGTAG)
12016 AC_SUBST(LIBLANGTAG_CFLAGS)
12017 AC_SUBST(LIBLANGTAG_LIBS)
12019 dnl ===================================================================
12020 dnl Test whether to build libpng or rely on the system version
12021 dnl ===================================================================
12023 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12025 dnl ===================================================================
12026 dnl Check for runtime JVM search path
12027 dnl ===================================================================
12028 if test "$ENABLE_JAVA" != ""; then
12029     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12030     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12031         AC_MSG_RESULT([yes])
12032         if ! test -d "$with_jvm_path"; then
12033             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12034         fi
12035         if ! test -d "$with_jvm_path"jvm; then
12036             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12037         fi
12038         JVM_ONE_PATH_CHECK="$with_jvm_path"
12039         AC_SUBST(JVM_ONE_PATH_CHECK)
12040     else
12041         AC_MSG_RESULT([no])
12042     fi
12045 dnl ===================================================================
12046 dnl Test for the presence of Ant and that it works
12047 dnl ===================================================================
12049 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12050     ANT_HOME=; export ANT_HOME
12051     WITH_ANT_HOME=; export WITH_ANT_HOME
12052     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12053         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12054             if test "$_os" = "WINNT"; then
12055                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12056             else
12057                 with_ant_home="$LODE_HOME/opt/ant"
12058             fi
12059         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12060             with_ant_home="$LODE_HOME/opt/ant"
12061         fi
12062     fi
12063     if test -z "$with_ant_home"; then
12064         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12065     else
12066         if test "$_os" = "WINNT"; then
12067             # AC_PATH_PROGS needs unix path
12068             with_ant_home=`cygpath -u "$with_ant_home"`
12069         fi
12070         AbsolutePath "$with_ant_home"
12071         with_ant_home=$absolute_path
12072         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12073         WITH_ANT_HOME=$with_ant_home
12074         ANT_HOME=$with_ant_home
12075     fi
12077     if test -z "$ANT"; then
12078         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12079     else
12080         # resolve relative or absolute symlink
12081         while test -h "$ANT"; do
12082             a_cwd=`pwd`
12083             a_basename=`basename "$ANT"`
12084             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12085             cd "`dirname "$ANT"`"
12086             cd "`dirname "$a_script"`"
12087             ANT="`pwd`"/"`basename "$a_script"`"
12088             cd "$a_cwd"
12089         done
12091         AC_MSG_CHECKING([if $ANT works])
12092         mkdir -p conftest.dir
12093         a_cwd=$(pwd)
12094         cd conftest.dir
12095         cat > conftest.java << EOF
12096         public class conftest {
12097             int testmethod(int a, int b) {
12098                     return a + b;
12099             }
12100         }
12103         cat > conftest.xml << EOF
12104         <project name="conftest" default="conftest">
12105         <target name="conftest">
12106             <javac srcdir="." includes="conftest.java">
12107             </javac>
12108         </target>
12109         </project>
12112         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12113         if test $? = 0 -a -f ./conftest.class; then
12114             AC_MSG_RESULT([Ant works])
12115             if test -z "$WITH_ANT_HOME"; then
12116                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12117                 if test -z "$ANT_HOME"; then
12118                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12119                 fi
12120             else
12121                 ANT_HOME="$WITH_ANT_HOME"
12122             fi
12123         else
12124             echo "configure: Ant test failed" >&5
12125             cat conftest.java >&5
12126             cat conftest.xml >&5
12127             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12128         fi
12129         cd "$a_cwd"
12130         rm -fr conftest.dir
12131     fi
12132     if test -z "$ANT_HOME"; then
12133         ANT_HOME="NO_ANT_HOME"
12134     else
12135         PathFormat "$ANT_HOME"
12136         ANT_HOME="$formatted_path"
12137         PathFormat "$ANT"
12138         ANT="$formatted_path"
12139     fi
12140     AC_SUBST(ANT_HOME)
12141     AC_SUBST(ANT)
12143     dnl Checking for ant.jar
12144     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12145         AC_MSG_CHECKING([Ant lib directory])
12146         if test -f $ANT_HOME/lib/ant.jar; then
12147             ANT_LIB="$ANT_HOME/lib"
12148         else
12149             if test -f $ANT_HOME/ant.jar; then
12150                 ANT_LIB="$ANT_HOME"
12151             else
12152                 if test -f /usr/share/java/ant.jar; then
12153                     ANT_LIB=/usr/share/java
12154                 else
12155                     if test -f /usr/share/ant-core/lib/ant.jar; then
12156                         ANT_LIB=/usr/share/ant-core/lib
12157                     else
12158                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12159                             ANT_LIB="$ANT_HOME/lib/ant"
12160                         else
12161                             if test -f /usr/share/lib/ant/ant.jar; then
12162                                 ANT_LIB=/usr/share/lib/ant
12163                             else
12164                                 AC_MSG_ERROR([Ant libraries not found!])
12165                             fi
12166                         fi
12167                     fi
12168                 fi
12169             fi
12170         fi
12171         PathFormat "$ANT_LIB"
12172         ANT_LIB="$formatted_path"
12173         AC_MSG_RESULT([Ant lib directory found.])
12174     fi
12175     AC_SUBST(ANT_LIB)
12177     ant_minver=1.6.0
12178     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12180     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12181     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12182     ant_version_major=`echo $ant_version | cut -d. -f1`
12183     ant_version_minor=`echo $ant_version | cut -d. -f2`
12184     echo "configure: ant_version $ant_version " >&5
12185     echo "configure: ant_version_major $ant_version_major " >&5
12186     echo "configure: ant_version_minor $ant_version_minor " >&5
12187     if test "$ant_version_major" -ge "2"; then
12188         AC_MSG_RESULT([yes, $ant_version])
12189     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12190         AC_MSG_RESULT([yes, $ant_version])
12191     else
12192         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12193     fi
12195     rm -f conftest* core core.* *.core
12198 OOO_JUNIT_JAR=
12199 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12200     AC_MSG_CHECKING([for JUnit 4])
12201     if test "$with_junit" = "yes"; then
12202         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12203             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12204         elif test -e /usr/share/java/junit4.jar; then
12205             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12206         else
12207            if test -e /usr/share/lib/java/junit.jar; then
12208               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12209            else
12210               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12211            fi
12212         fi
12213     else
12214         OOO_JUNIT_JAR=$with_junit
12215     fi
12216     if test "$_os" = "WINNT"; then
12217         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12218     fi
12219     printf 'import org.junit.Before;' > conftest.java
12220     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12221         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12222     else
12223         AC_MSG_ERROR(
12224 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12225  specify its pathname via --with-junit=..., or disable it via --without-junit])
12226     fi
12227     rm -f conftest.class conftest.java
12228     if test $OOO_JUNIT_JAR != ""; then
12229     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12230     fi
12232 AC_SUBST(OOO_JUNIT_JAR)
12234 HAMCREST_JAR=
12235 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12236     AC_MSG_CHECKING([for included Hamcrest])
12237     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12238     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12239         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12240     else
12241         AC_MSG_RESULT([Not included])
12242         AC_MSG_CHECKING([for standalone hamcrest jar.])
12243         if test "$with_hamcrest" = "yes"; then
12244             if test -e /usr/share/lib/java/hamcrest.jar; then
12245                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12246             elif test -e /usr/share/java/hamcrest/core.jar; then
12247                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12248             else
12249                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12250             fi
12251         else
12252             HAMCREST_JAR=$with_hamcrest
12253         fi
12254         if test "$_os" = "WINNT"; then
12255             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12256         fi
12257         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12258             AC_MSG_RESULT([$HAMCREST_JAR])
12259         else
12260             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),
12261                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12262         fi
12263     fi
12264     rm -f conftest.class conftest.java
12266 AC_SUBST(HAMCREST_JAR)
12269 AC_SUBST(SCPDEFS)
12272 # check for wget and curl
12274 WGET=
12275 CURL=
12277 if test "$enable_fetch_external" != "no"; then
12279 CURL=`which curl 2>/dev/null`
12281 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12282     # wget new enough?
12283     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12284     if test $? -eq 0; then
12285         WGET=$i
12286         break
12287     fi
12288 done
12290 if test -z "$WGET" -a -z "$CURL"; then
12291     AC_MSG_ERROR([neither wget nor curl found!])
12296 AC_SUBST(WGET)
12297 AC_SUBST(CURL)
12300 # check for sha256sum
12302 SHA256SUM=
12304 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12305     eval "$i -a 256 --version" > /dev/null 2>&1
12306     ret=$?
12307     if test $ret -eq 0; then
12308         SHA256SUM="$i -a 256"
12309         break
12310     fi
12311 done
12313 if test -z "$SHA256SUM"; then
12314     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12315         eval "$i --version" > /dev/null 2>&1
12316         ret=$?
12317         if test $ret -eq 0; then
12318             SHA256SUM=$i
12319             break
12320         fi
12321     done
12324 if test -z "$SHA256SUM"; then
12325     AC_MSG_ERROR([no sha256sum found!])
12328 AC_SUBST(SHA256SUM)
12330 dnl ===================================================================
12331 dnl Dealing with l10n options
12332 dnl ===================================================================
12333 AC_MSG_CHECKING([which languages to be built])
12334 # get list of all languages
12335 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12336 # the sed command does the following:
12337 #   + if a line ends with a backslash, append the next line to it
12338 #   + adds " on the beginning of the value (after =)
12339 #   + adds " at the end of the value
12340 #   + removes en-US; we want to put it on the beginning
12341 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12342 [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)]
12343 ALL_LANGS="en-US $completelangiso"
12344 # check the configured localizations
12345 WITH_LANG="$with_lang"
12347 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12348 # (Norwegian is "nb" and "nn".)
12349 if test "$WITH_LANG" = "no"; then
12350     WITH_LANG=
12353 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12354     AC_MSG_RESULT([en-US])
12355 else
12356     AC_MSG_RESULT([$WITH_LANG])
12357     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12358     if test -z "$MSGFMT"; then
12359         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12360             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12361         elif test -x "/opt/lo/bin/msgfmt"; then
12362             MSGFMT="/opt/lo/bin/msgfmt"
12363         else
12364             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12365             if test -z "$MSGFMT"; then
12366                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12367             fi
12368         fi
12369     fi
12370     if test -z "$MSGUNIQ"; then
12371         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12372             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12373         elif test -x "/opt/lo/bin/msguniq"; then
12374             MSGUNIQ="/opt/lo/bin/msguniq"
12375         else
12376             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12377             if test -z "$MSGUNIQ"; then
12378                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12379             fi
12380         fi
12381     fi
12383 AC_SUBST(MSGFMT)
12384 AC_SUBST(MSGUNIQ)
12385 # check that the list is valid
12386 for lang in $WITH_LANG; do
12387     test "$lang" = "ALL" && continue
12388     # need to check for the exact string, so add space before and after the list of all languages
12389     for vl in $ALL_LANGS; do
12390         if test "$vl" = "$lang"; then
12391            break
12392         fi
12393     done
12394     if test "$vl" != "$lang"; then
12395         # if you're reading this - you prolly quoted your languages remove the quotes ...
12396         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12397     fi
12398 done
12399 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12400     echo $WITH_LANG | grep -q en-US
12401     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12403 # list with substituted ALL
12404 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12405 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12406 test "$WITH_LANG" = "en-US" && WITH_LANG=
12407 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12408     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12409     ALL_LANGS=`echo $ALL_LANGS qtz`
12411 AC_SUBST(ALL_LANGS)
12412 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12413 AC_SUBST(WITH_LANG)
12414 AC_SUBST(WITH_LANG_LIST)
12415 AC_SUBST(GIT_NEEDED_SUBMODULES)
12417 WITH_POOR_HELP_LOCALIZATIONS=
12418 if test -d "$SRC_ROOT/translations/source"; then
12419     for l in `ls -1 $SRC_ROOT/translations/source`; do
12420         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12421             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12422         fi
12423     done
12425 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12427 if test -n "$with_locales"; then
12428     WITH_LOCALES="$with_locales"
12430     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12431     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12432     # config_host/config_locales.h.in
12433     for locale in $WITH_LOCALES; do
12434         lang=${locale%_*}
12436         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12438         case $lang in
12439         hi|mr*ne)
12440             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12441             ;;
12442         bg|ru)
12443             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12444             ;;
12445         esac
12446     done
12447 else
12448     AC_DEFINE(WITH_LOCALE_ALL)
12450 AC_SUBST(WITH_LOCALES)
12452 dnl git submodule update --reference
12453 dnl ===================================================================
12454 if test -n "${GIT_REFERENCE_SRC}"; then
12455     for repo in ${GIT_NEEDED_SUBMODULES}; do
12456         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12457             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12458         fi
12459     done
12461 AC_SUBST(GIT_REFERENCE_SRC)
12463 dnl git submodules linked dirs
12464 dnl ===================================================================
12465 if test -n "${GIT_LINK_SRC}"; then
12466     for repo in ${GIT_NEEDED_SUBMODULES}; do
12467         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12468             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12469         fi
12470     done
12472 AC_SUBST(GIT_LINK_SRC)
12474 dnl branding
12475 dnl ===================================================================
12476 AC_MSG_CHECKING([for alternative branding images directory])
12477 # initialize mapped arrays
12478 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12479 brand_files="$BRAND_INTRO_IMAGES about.svg"
12481 if test -z "$with_branding" -o "$with_branding" = "no"; then
12482     AC_MSG_RESULT([none])
12483     DEFAULT_BRAND_IMAGES="$brand_files"
12484 else
12485     if ! test -d $with_branding ; then
12486         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12487     else
12488         AC_MSG_RESULT([$with_branding])
12489         CUSTOM_BRAND_DIR="$with_branding"
12490         for lfile in $brand_files
12491         do
12492             if ! test -f $with_branding/$lfile ; then
12493                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12494                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12495             else
12496                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12497             fi
12498         done
12499         check_for_progress="yes"
12500     fi
12502 AC_SUBST([BRAND_INTRO_IMAGES])
12503 AC_SUBST([CUSTOM_BRAND_DIR])
12504 AC_SUBST([CUSTOM_BRAND_IMAGES])
12505 AC_SUBST([DEFAULT_BRAND_IMAGES])
12508 AC_MSG_CHECKING([for 'intro' progress settings])
12509 PROGRESSBARCOLOR=
12510 PROGRESSSIZE=
12511 PROGRESSPOSITION=
12512 PROGRESSFRAMECOLOR=
12513 PROGRESSTEXTCOLOR=
12514 PROGRESSTEXTBASELINE=
12516 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12517     source "$with_branding/progress.conf"
12518     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12519 else
12520     AC_MSG_RESULT([none])
12523 AC_SUBST(PROGRESSBARCOLOR)
12524 AC_SUBST(PROGRESSSIZE)
12525 AC_SUBST(PROGRESSPOSITION)
12526 AC_SUBST(PROGRESSFRAMECOLOR)
12527 AC_SUBST(PROGRESSTEXTCOLOR)
12528 AC_SUBST(PROGRESSTEXTBASELINE)
12531 AC_MSG_CHECKING([for extra build ID])
12532 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12533     EXTRA_BUILDID="$with_extra_buildid"
12535 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12536 if test -n "$EXTRA_BUILDID" ; then
12537     AC_MSG_RESULT([$EXTRA_BUILDID])
12538 else
12539     AC_MSG_RESULT([not set])
12541 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12543 OOO_VENDOR=
12544 AC_MSG_CHECKING([for vendor])
12545 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12546     OOO_VENDOR="$USERNAME"
12548     if test -z "$OOO_VENDOR"; then
12549         OOO_VENDOR="$USER"
12550     fi
12552     if test -z "$OOO_VENDOR"; then
12553         OOO_VENDOR="`id -u -n`"
12554     fi
12556     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12557 else
12558     OOO_VENDOR="$with_vendor"
12559     AC_MSG_RESULT([$OOO_VENDOR])
12561 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12562 AC_SUBST(OOO_VENDOR)
12564 if test "$_os" = "Android" ; then
12565     ANDROID_PACKAGE_NAME=
12566     AC_MSG_CHECKING([for Android package name])
12567     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12568         if test -n "$ENABLE_DEBUG"; then
12569             # Default to the package name that makes ndk-gdb happy.
12570             ANDROID_PACKAGE_NAME="org.libreoffice"
12571         else
12572             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12573         fi
12575         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12576     else
12577         ANDROID_PACKAGE_NAME="$with_android_package_name"
12578         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12579     fi
12580     AC_SUBST(ANDROID_PACKAGE_NAME)
12583 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12584 if test "$with_compat_oowrappers" = "yes"; then
12585     WITH_COMPAT_OOWRAPPERS=TRUE
12586     AC_MSG_RESULT(yes)
12587 else
12588     WITH_COMPAT_OOWRAPPERS=
12589     AC_MSG_RESULT(no)
12591 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12593 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12594 AC_MSG_CHECKING([for install dirname])
12595 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12596     INSTALLDIRNAME="$with_install_dirname"
12598 AC_MSG_RESULT([$INSTALLDIRNAME])
12599 AC_SUBST(INSTALLDIRNAME)
12601 AC_MSG_CHECKING([for prefix])
12602 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12603 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12604 PREFIXDIR="$prefix"
12605 AC_MSG_RESULT([$PREFIXDIR])
12606 AC_SUBST(PREFIXDIR)
12608 LIBDIR=[$(eval echo $(eval echo $libdir))]
12609 AC_SUBST(LIBDIR)
12611 DATADIR=[$(eval echo $(eval echo $datadir))]
12612 AC_SUBST(DATADIR)
12614 MANDIR=[$(eval echo $(eval echo $mandir))]
12615 AC_SUBST(MANDIR)
12617 DOCDIR=[$(eval echo $(eval echo $docdir))]
12618 AC_SUBST(DOCDIR)
12620 BINDIR=[$(eval echo $(eval echo $bindir))]
12621 AC_SUBST(BINDIR)
12623 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12624 AC_SUBST(INSTALLDIR)
12626 TESTINSTALLDIR="${BUILDDIR}/test-install"
12627 AC_SUBST(TESTINSTALLDIR)
12630 # ===================================================================
12631 # OAuth2 id and secrets
12632 # ===================================================================
12634 AC_MSG_CHECKING([for Google Drive client id and secret])
12635 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12636     AC_MSG_RESULT([not set])
12637     GDRIVE_CLIENT_ID="\"\""
12638     GDRIVE_CLIENT_SECRET="\"\""
12639 else
12640     AC_MSG_RESULT([set])
12641     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12642     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12644 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12645 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12647 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12648 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12649     AC_MSG_RESULT([not set])
12650     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12651     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12652 else
12653     AC_MSG_RESULT([set])
12654     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12655     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12657 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12658 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12660 AC_MSG_CHECKING([for OneDrive client id and secret])
12661 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12662     AC_MSG_RESULT([not set])
12663     ONEDRIVE_CLIENT_ID="\"\""
12664     ONEDRIVE_CLIENT_SECRET="\"\""
12665 else
12666     AC_MSG_RESULT([set])
12667     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12668     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12670 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12671 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12674 dnl ===================================================================
12675 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12676 dnl --enable-dependency-tracking configure option
12677 dnl ===================================================================
12678 AC_MSG_CHECKING([whether to enable dependency tracking])
12679 if test "$enable_dependency_tracking" = "no"; then
12680     nodep=TRUE
12681     AC_MSG_RESULT([no])
12682 else
12683     AC_MSG_RESULT([yes])
12685 AC_SUBST(nodep)
12687 dnl ===================================================================
12688 dnl Number of CPUs to use during the build
12689 dnl ===================================================================
12690 AC_MSG_CHECKING([for number of processors to use])
12691 # plain --with-parallelism is just the default
12692 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12693     if test "$with_parallelism" = "no"; then
12694         PARALLELISM=0
12695     else
12696         PARALLELISM=$with_parallelism
12697     fi
12698 else
12699     if test "$enable_icecream" = "yes"; then
12700         PARALLELISM="40"
12701     else
12702         case `uname -s` in
12704         Darwin|FreeBSD|NetBSD|OpenBSD)
12705             PARALLELISM=`sysctl -n hw.ncpu`
12706             ;;
12708         Linux)
12709             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12710         ;;
12711         # what else than above does profit here *and* has /proc?
12712         *)
12713             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12714             ;;
12715         esac
12717         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12718         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12719     fi
12722 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12723     if test -z "$with_parallelism"; then
12724             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12725             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12726             PARALLELISM="1"
12727     else
12728         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."
12729     fi
12732 if test $PARALLELISM -eq 0; then
12733     AC_MSG_RESULT([explicit make -j option needed])
12734 else
12735     AC_MSG_RESULT([$PARALLELISM])
12737 AC_SUBST(PARALLELISM)
12739 IWYU_PATH="$with_iwyu"
12740 AC_SUBST(IWYU_PATH)
12741 if test ! -z "$IWYU_PATH"; then
12742     if test ! -f "$IWYU_PATH"; then
12743         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12744     fi
12748 # Set up ILIB for MSVC build
12750 ILIB1=
12751 if test "$build_os" = "cygwin"; then
12752     ILIB="."
12753     if test -n "$JAVA_HOME"; then
12754         ILIB="$ILIB;$JAVA_HOME/lib"
12755     fi
12756     ILIB1=-link
12757     if test "$BITNESS_OVERRIDE" = 64; then
12758         ILIB="$ILIB;$COMPATH/lib/x64"
12759         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12760         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12761         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12762         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12763             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12764             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12765         fi
12766         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12767         ucrtlibpath_formatted=$formatted_path
12768         ILIB="$ILIB;$ucrtlibpath_formatted"
12769         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12770     else
12771         ILIB="$ILIB;$COMPATH/lib/x86"
12772         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12773         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12774         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12775         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12776             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12777             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12778         fi
12779         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12780         ucrtlibpath_formatted=$formatted_path
12781         ILIB="$ILIB;$ucrtlibpath_formatted"
12782         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12783     fi
12784     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12785         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12786     else
12787         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12788     fi
12790     AC_SUBST(ILIB)
12793 # ===================================================================
12794 # Creating bigger shared library to link against
12795 # ===================================================================
12796 AC_MSG_CHECKING([whether to create huge library])
12797 MERGELIBS=
12799 if test $_os = iOS -o $_os = Android; then
12800     # Never any point in mergelibs for these as we build just static
12801     # libraries anyway...
12802     enable_mergelibs=no
12805 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12806     if test $_os != Linux -a $_os != WINNT; then
12807         add_warning "--enable-mergelibs is not tested for this platform"
12808     fi
12809     MERGELIBS="TRUE"
12810     AC_MSG_RESULT([yes])
12811 else
12812     AC_MSG_RESULT([no])
12814 AC_SUBST([MERGELIBS])
12816 dnl ===================================================================
12817 dnl icerun is a wrapper that stops us spawning tens of processes
12818 dnl locally - for tools that can't be executed on the compile cluster
12819 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12820 dnl ===================================================================
12821 AC_MSG_CHECKING([whether to use icerun wrapper])
12822 ICECREAM_RUN=
12823 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12824     ICECREAM_RUN=icerun
12825     AC_MSG_RESULT([yes])
12826 else
12827     AC_MSG_RESULT([no])
12829 AC_SUBST(ICECREAM_RUN)
12831 dnl ===================================================================
12832 dnl Setup the ICECC_VERSION for the build the same way it was set for
12833 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12834 dnl ===================================================================
12835 x_ICECC_VERSION=[\#]
12836 if test -n "$ICECC_VERSION" ; then
12837     x_ICECC_VERSION=
12839 AC_SUBST(x_ICECC_VERSION)
12840 AC_SUBST(ICECC_VERSION)
12842 dnl ===================================================================
12844 AC_MSG_CHECKING([MPL subset])
12845 MPL_SUBSET=
12847 if test "$enable_mpl_subset" = "yes"; then
12848     warn_report=false
12849     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12850         warn_report=true
12851     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12852         warn_report=true
12853     fi
12854     if test "$warn_report" = "true"; then
12855         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12856     fi
12857     if test "x$enable_postgresql_sdbc" != "xno"; then
12858         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12859     fi
12860     if test "$enable_lotuswordpro" = "yes"; then
12861         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12862     fi
12863     if test "$WITH_WEBDAV" = "neon"; then
12864         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12865     fi
12866     if test -n "$ENABLE_POPPLER"; then
12867         if test "x$SYSTEM_POPPLER" = "x"; then
12868             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12869         fi
12870     fi
12871     # cf. m4/libo_check_extension.m4
12872     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12873         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12874     fi
12875     for theme in $WITH_THEMES; do
12876         case $theme in
12877         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12878             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12879         *) : ;;
12880         esac
12881     done
12883     ENABLE_OPENGL_TRANSITIONS=
12885     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12886         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12887     fi
12889     MPL_SUBSET="TRUE"
12890     AC_DEFINE(MPL_HAVE_SUBSET)
12891     AC_MSG_RESULT([only])
12892 else
12893     AC_MSG_RESULT([no restrictions])
12895 AC_SUBST(MPL_SUBSET)
12897 dnl ===================================================================
12899 AC_MSG_CHECKING([formula logger])
12900 ENABLE_FORMULA_LOGGER=
12902 if test "x$enable_formula_logger" = "xyes"; then
12903     AC_MSG_RESULT([yes])
12904     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12905     ENABLE_FORMULA_LOGGER=TRUE
12906 elif test -n "$ENABLE_DBGUTIL" ; then
12907     AC_MSG_RESULT([yes])
12908     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12909     ENABLE_FORMULA_LOGGER=TRUE
12910 else
12911     AC_MSG_RESULT([no])
12914 AC_SUBST(ENABLE_FORMULA_LOGGER)
12916 dnl ===================================================================
12917 dnl Setting up the environment.
12918 dnl ===================================================================
12919 AC_MSG_NOTICE([setting up the build environment variables...])
12921 AC_SUBST(COMPATH)
12923 if test "$build_os" = "cygwin"; then
12924     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12925         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12926         ATL_INCLUDE="$COMPATH/atlmfc/include"
12927     elif test -d "$COMPATH/atlmfc/lib"; then
12928         ATL_LIB="$COMPATH/atlmfc/lib"
12929         ATL_INCLUDE="$COMPATH/atlmfc/include"
12930     else
12931         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12932         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12933     fi
12934     if test "$BITNESS_OVERRIDE" = 64; then
12935         ATL_LIB="$ATL_LIB/x64"
12936     else
12937         ATL_LIB="$ATL_LIB/x86"
12938     fi
12939     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12940     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12942     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12943     PathFormat "/usr/bin/find.exe"
12944     FIND="$formatted_path"
12945     PathFormat "/usr/bin/sort.exe"
12946     SORT="$formatted_path"
12947     PathFormat "/usr/bin/grep.exe"
12948     WIN_GREP="$formatted_path"
12949     PathFormat "/usr/bin/ls.exe"
12950     WIN_LS="$formatted_path"
12951     PathFormat "/usr/bin/touch.exe"
12952     WIN_TOUCH="$formatted_path"
12953 else
12954     FIND=find
12955     SORT=sort
12958 AC_SUBST(ATL_INCLUDE)
12959 AC_SUBST(ATL_LIB)
12960 AC_SUBST(FIND)
12961 AC_SUBST(SORT)
12962 AC_SUBST(WIN_GREP)
12963 AC_SUBST(WIN_LS)
12964 AC_SUBST(WIN_TOUCH)
12966 AC_SUBST(BUILD_TYPE)
12968 AC_SUBST(SOLARINC)
12970 PathFormat "$PERL"
12971 PERL="$formatted_path"
12972 AC_SUBST(PERL)
12974 if test -n "$TMPDIR"; then
12975     TEMP_DIRECTORY="$TMPDIR"
12976 else
12977     TEMP_DIRECTORY="/tmp"
12979 if test "$build_os" = "cygwin"; then
12980     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12982 AC_SUBST(TEMP_DIRECTORY)
12984 # setup the PATH for the environment
12985 if test -n "$LO_PATH_FOR_BUILD"; then
12986     LO_PATH="$LO_PATH_FOR_BUILD"
12987 else
12988     LO_PATH="$PATH"
12990     case "$host_os" in
12992     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12993         if test "$ENABLE_JAVA" != ""; then
12994             pathmunge "$JAVA_HOME/bin" "after"
12995         fi
12996         ;;
12998     cygwin*)
12999         # Win32 make needs native paths
13000         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13001             LO_PATH=`cygpath -p -m "$PATH"`
13002         fi
13003         if test "$BITNESS_OVERRIDE" = 64; then
13004             # needed for msi packaging
13005             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13006         fi
13007         # .NET 4.6 and higher don't have bin directory
13008         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13009             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13010         fi
13011         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13012         pathmunge "$CSC_PATH" "before"
13013         pathmunge "$MIDL_PATH" "before"
13014         pathmunge "$AL_PATH" "before"
13015         pathmunge "$MSPDB_PATH" "before"
13016         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13017             pathmunge "$CL_PATH" "before"
13018         fi
13019         if test -n "$MSBUILD_PATH" ; then
13020             pathmunge "$MSBUILD_PATH" "before"
13021         fi
13022         if test "$BITNESS_OVERRIDE" = 64; then
13023             pathmunge "$COMPATH/bin/amd64" "before"
13024             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13025         else
13026             pathmunge "$COMPATH/bin" "before"
13027             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13028         fi
13029         if test "$ENABLE_JAVA" != ""; then
13030             if test -d "$JAVA_HOME/jre/bin/client"; then
13031                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13032             fi
13033             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13034                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13035             fi
13036             pathmunge "$JAVA_HOME/bin" "before"
13037         fi
13038         ;;
13040     solaris*)
13041         pathmunge "/usr/css/bin" "before"
13042         if test "$ENABLE_JAVA" != ""; then
13043             pathmunge "$JAVA_HOME/bin" "after"
13044         fi
13045         ;;
13046     esac
13049 AC_SUBST(LO_PATH)
13051 libo_FUZZ_SUMMARY
13053 # Generate a configuration sha256 we can use for deps
13054 if test -f config_host.mk; then
13055     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13057 if test -f config_host_lang.mk; then
13058     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13061 CFLAGS=$my_original_CFLAGS
13062 CXXFLAGS=$my_original_CXXFLAGS
13063 CPPFLAGS=$my_original_CPPFLAGS
13065 AC_CONFIG_FILES([config_host.mk
13066                  config_host_lang.mk
13067                  Makefile
13068                  bin/bffvalidator.sh
13069                  bin/odfvalidator.sh
13070                  bin/officeotron.sh
13071                  instsetoo_native/util/openoffice.lst
13072                  sysui/desktop/macosx/Info.plist])
13073 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13074 AC_CONFIG_HEADERS([config_host/config_clang.h])
13075 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13076 AC_CONFIG_HEADERS([config_host/config_eot.h])
13077 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13078 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13079 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13080 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13081 AC_CONFIG_HEADERS([config_host/config_features.h])
13082 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13083 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13084 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13085 AC_CONFIG_HEADERS([config_host/config_folders.h])
13086 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13087 AC_CONFIG_HEADERS([config_host/config_gio.h])
13088 AC_CONFIG_HEADERS([config_host/config_global.h])
13089 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13090 AC_CONFIG_HEADERS([config_host/config_java.h])
13091 AC_CONFIG_HEADERS([config_host/config_langs.h])
13092 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13093 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13094 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13095 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13096 AC_CONFIG_HEADERS([config_host/config_locales.h])
13097 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13098 AC_CONFIG_HEADERS([config_host/config_oox.h])
13099 AC_CONFIG_HEADERS([config_host/config_options.h])
13100 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13101 AC_CONFIG_HEADERS([config_host/config_skia.h])
13102 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13103 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13104 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13105 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13106 AC_CONFIG_HEADERS([config_host/config_version.h])
13107 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13108 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13109 AC_CONFIG_HEADERS([config_host/config_python.h])
13110 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13111 AC_OUTPUT
13113 if test "$CROSS_COMPILING" = TRUE; then
13114     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13117 # touch the config timestamp file
13118 if test ! -f config_host.mk.stamp; then
13119     echo > config_host.mk.stamp
13120 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13121     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13122 else
13123     echo > config_host.mk.stamp
13126 # touch the config lang timestamp file
13127 if test ! -f config_host_lang.mk.stamp; then
13128     echo > config_host_lang.mk.stamp
13129 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13130     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13131 else
13132     echo > config_host_lang.mk.stamp
13136 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13137         -a "$build_os" = "cygwin"; then
13139 cat << _EOS
13140 ****************************************************************************
13141 WARNING:
13142 Your make version is known to be horribly slow, and hard to debug
13143 problems with. To get a reasonably functional make please do:
13145 to install a pre-compiled binary make for Win32
13147  mkdir -p /opt/lo/bin
13148  cd /opt/lo/bin
13149  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13150  cp make-4.2.1-msvc.exe make
13151  chmod +x make
13153 to install from source:
13154 place yourself in a working directory of you choice.
13156  git clone git://git.savannah.gnu.org/make.git
13158  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13159  set PATH=%PATH%;C:\Cygwin\bin
13160  [or Cygwin64, if that is what you have]
13161  cd path-to-make-repo-you-cloned-above
13162  build_w32.bat --without-guile
13164 should result in a WinRel/gnumake.exe.
13165 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13167 Then re-run autogen.sh
13169 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13170 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13172 _EOS
13173 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13174     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13179 cat << _EOF
13180 ****************************************************************************
13182 To build, run:
13183 $GNUMAKE
13185 To view some help, run:
13186 $GNUMAKE help
13188 _EOF
13190 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13191     cat << _EOF
13192 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13193 _EOF
13195     if test $_os = Darwin; then
13196         echo open instdir/$PRODUCTNAME.app
13197     else
13198         echo instdir/program/soffice
13199     fi
13200     cat << _EOF
13202 If you want to run the smoketest, run:
13203 $GNUMAKE check
13205 _EOF
13208 if test -f warn; then
13209     cat warn
13210     rm warn
13213 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: