tdf#131370 chart: implement OOXML import/export of legend overlay feature
[LibreOffice.git] / configure.ac
blob5447d184fc3f52cd94d7c844eb5037b26e9f8b73
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],[7.0.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 else
355     ENABLE_LTO=""
356     AC_MSG_RESULT([no])
358 AC_SUBST(ENABLE_LTO)
360 AC_ARG_ENABLE(fuzz-options,
361     AS_HELP_STRING([--enable-fuzz-options],
362         [Randomly enable or disable each of those configurable options
363          that are supposed to be freely selectable without interdependencies,
364          or where bad interaction from interdependencies is automatically avoided.])
367 dnl ===================================================================
368 dnl When building for Android, --with-android-ndk,
369 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
370 dnl mandatory
371 dnl ===================================================================
373 AC_ARG_WITH(android-ndk,
374     AS_HELP_STRING([--with-android-ndk],
375         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
378 AC_ARG_WITH(android-ndk-toolchain-version,
379     AS_HELP_STRING([--with-android-ndk-toolchain-version],
380         [Specify which toolchain version to use, of those present in the
381         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
382         with_android_ndk_toolchain_version=clang5.0)
384 AC_ARG_WITH(android-sdk,
385     AS_HELP_STRING([--with-android-sdk],
386         [Specify location of the Android SDK. Mandatory when building for Android.]),
389 AC_ARG_WITH(android-api-level,
390     AS_HELP_STRING([--with-android-api-level],
391         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
394 ANDROID_NDK_HOME=
395 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
396     with_android_ndk="$SRC_ROOT/external/android-ndk"
398 if test -n "$with_android_ndk"; then
399     eval ANDROID_NDK_HOME=$with_android_ndk
401     # Set up a lot of pre-canned defaults
403     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
404         if test ! -f $ANDROID_NDK_HOME/source.properties; then
405             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
406         fi
407         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
408     else
409         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
410     fi
411     if test -z "$ANDROID_NDK_VERSION";  then
412         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
413     fi
414     case $ANDROID_NDK_VERSION in
415     r9*|r10*)
416         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
417         ;;
418     11.1.*|12.1.*|13.1.*|14.1.*)
419         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
420         ;;
421     16.*|17.*|18.*|19.*|20.*)
422         ;;
423     *)
424         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
425         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
426         ;;
427     esac
429     ANDROID_API_LEVEL=16
430     if test -n "$with_android_api_level" ; then
431         ANDROID_API_LEVEL="$with_android_api_level"
432     fi
434     android_cpu=$host_cpu
435     if test $host_cpu = arm; then
436         android_platform_prefix=arm-linux-androideabi
437         android_gnu_prefix=$android_platform_prefix
438         LLVM_TRIPLE=armv7a-linux-androideabi
439         ANDROID_APP_ABI=armeabi-v7a
440         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
441     elif test $host_cpu = aarch64; then
442         android_platform_prefix=aarch64-linux-android
443         android_gnu_prefix=$android_platform_prefix
444         LLVM_TRIPLE=$android_platform_prefix
445         # minimum android version that supports aarch64
446         if test "$ANDROID_API_LEVEL" -lt "21" ; then
447             ANDROID_API_LEVEL=21
448         fi
449         ANDROID_APP_ABI=arm64-v8a
450     elif test $host_cpu = x86_64; then
451         android_platform_prefix=x86_64-linux-android
452         android_gnu_prefix=$android_platform_prefix
453         LLVM_TRIPLE=$android_platform_prefix
454         # minimum android version that supports x86_64
455         ANDROID_API_LEVEL=21
456         ANDROID_APP_ABI=x86_64
457     else
458         # host_cpu is something like "i386" or "i686" I guess, NDK uses
459         # "x86" in some contexts
460         android_cpu=x86
461         android_platform_prefix=$android_cpu
462         android_gnu_prefix=i686-linux-android
463         LLVM_TRIPLE=$android_gnu_prefix
464         ANDROID_APP_ABI=x86
465     fi
467     case "$with_android_ndk_toolchain_version" in
468     clang5.0)
469         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
470         ;;
471     *)
472         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
473     esac
475     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
477     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
478     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
479     # manage to link the (app-specific) single huge .so that is built for the app in
480     # android/source/ if there is debug information in a significant part of the object files.
481     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
482     # all objects have been built with debug information.)
483     case $build_os in
484     linux-gnu*)
485         android_HOST_TAG=linux-x86_64
486         ;;
487     darwin*)
488         android_HOST_TAG=darwin-x86_64
489         ;;
490     *)
491         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
492         # ndk would also support windows and windows-x86_64
493         ;;
494     esac
495     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
496     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
497     dnl TODO: NSS build uses it...
498     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
499     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
501     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
502     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
503     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
504     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
505     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
507     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
509     if test "$ENABLE_LTO" = TRUE; then
510         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
511         # $CC and $CXX when building external libraries
512         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
513     fi
515     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
517     if test -z "$CC"; then
518         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
519         CC_BASE="clang"
520     fi
521     if test -z "$CXX"; then
522         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
523         CXX_BASE="clang++"
524     fi
526     # remember to download the ownCloud Android library later
527     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
529 AC_SUBST(ANDROID_NDK_HOME)
530 AC_SUBST(ANDROID_APP_ABI)
531 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
533 dnl ===================================================================
534 dnl --with-android-sdk
535 dnl ===================================================================
536 ANDROID_SDK_HOME=
537 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
538     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
540 if test -n "$with_android_sdk"; then
541     eval ANDROID_SDK_HOME=$with_android_sdk
542     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
544 AC_SUBST(ANDROID_SDK_HOME)
546 AC_ARG_ENABLE([android-lok],
547     AS_HELP_STRING([--enable-android-lok],
548         [The Android app from the android/ subdir needs several tweaks all
549          over the place that break the LOK when used in the Online-based
550          Android app.  This switch indicates that the intent of this build is
551          actually the Online-based, non-modified LOK.])
553 ENABLE_ANDROID_LOK=
554 if test -n "$ANDROID_NDK_HOME" ; then
555     if test "$enable_android_lok" = yes; then
556         ENABLE_ANDROID_LOK=TRUE
557         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
558         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
559     else
560         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
561     fi
563 AC_SUBST([ENABLE_ANDROID_LOK])
565 libo_FUZZ_ARG_ENABLE([android-editing],
566     AS_HELP_STRING([--enable-android-editing],
567         [Enable the experimental editing feature on Android.])
569 ENABLE_ANDROID_EDITING=
570 if test "$enable_android_editing" = yes; then
571     ENABLE_ANDROID_EDITING=TRUE
573 AC_SUBST([ENABLE_ANDROID_EDITING])
575 dnl ===================================================================
576 dnl The following is a list of supported systems.
577 dnl Sequential to keep the logic very simple
578 dnl These values may be checked and reset later.
579 dnl ===================================================================
580 #defaults unless the os test overrides this:
581 test_randr=yes
582 test_xrender=yes
583 test_cups=yes
584 test_dbus=yes
585 test_fontconfig=yes
586 test_cairo=no
587 test_gdb_index=no
588 test_split_debug=no
590 # Default values, as such probably valid just for Linux, set
591 # differently below just for Mac OSX, but at least better than
592 # hardcoding these as we used to do. Much of this is duplicated also
593 # in solenv for old build system and for gbuild, ideally we should
594 # perhaps define stuff like this only here in configure.ac?
596 LINKFLAGSSHL="-shared"
597 PICSWITCH="-fpic"
598 DLLPOST=".so"
600 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
602 INSTROOTBASESUFFIX=
603 INSTROOTCONTENTSUFFIX=
604 SDKDIRNAME=sdk
606 case "$host_os" in
608 solaris*)
609     build_gstreamer_1_0=yes
610     test_freetype=yes
611     build_skia=yes
612     _os=SunOS
614     dnl ===========================================================
615     dnl Check whether we're using Solaris 10 - SPARC or Intel.
616     dnl ===========================================================
617     AC_MSG_CHECKING([the Solaris operating system release])
618     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
619     if test "$_os_release" -lt "10"; then
620         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
621     else
622         AC_MSG_RESULT([ok ($_os_release)])
623     fi
625     dnl Check whether we're using a SPARC or i386 processor
626     AC_MSG_CHECKING([the processor type])
627     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
628         AC_MSG_RESULT([ok ($host_cpu)])
629     else
630         AC_MSG_ERROR([only SPARC and i386 processors are supported])
631     fi
632     ;;
634 linux-gnu*|k*bsd*-gnu*)
635     build_gstreamer_1_0=yes
636     test_kf5=yes
637     test_gtk3_kde5=yes
638     build_skia=yes
639     test_gdb_index=yes
640     test_split_debug=yes
641     if test "$enable_fuzzers" != yes; then
642         test_freetype=yes
643         test_fontconfig=yes
644     else
645         test_freetype=no
646         test_fontconfig=no
647         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
648     fi
649     _os=Linux
650     ;;
652 gnu)
653     test_randr=no
654     test_xrender=no
655     _os=GNU
656      ;;
658 cygwin*|interix*)
660     # When building on Windows normally with MSVC under Cygwin,
661     # configure thinks that the host platform (the platform the
662     # built code will run on) is Cygwin, even if it obviously is
663     # Windows, which in Autoconf terminology is called
664     # "mingw32". (Which is misleading as MinGW is the name of the
665     # tool-chain, not an operating system.)
667     # Somewhat confusing, yes. But this configure script doesn't
668     # look at $host etc that much, it mostly uses its own $_os
669     # variable, set here in this case statement.
671     test_cups=no
672     test_dbus=no
673     test_randr=no
674     test_xrender=no
675     test_freetype=no
676     test_fontconfig=no
677     build_skia=yes
678     _os=WINNT
680     DLLPOST=".dll"
681     LINKFLAGSNOUNDEFS=
682     ;;
684 darwin*) # macOS or iOS
685     test_randr=no
686     test_xrender=no
687     test_freetype=no
688     test_fontconfig=no
689     test_dbus=no
690     if test -n "$LODE_HOME" ; then
691         mac_sanitize_path
692         AC_MSG_NOTICE([sanitized the PATH to $PATH])
693     fi
694     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
695         build_for_ios=YES
696         _os=iOS
697         test_cups=no
698         enable_mpl_subset=yes
699         enable_lotuswordpro=no
700         enable_coinmp=no
701         enable_lpsolve=no
702         enable_postgresql_sdbc=no
703         enable_extension_integration=no
704         enable_report_builder=no
705         with_ppds=no
706         if test "$enable_ios_simulator" = "yes"; then
707             host=x86_64-apple-darwin
708         fi
709     else
710         _os=Darwin
711         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
712         INSTROOTCONTENTSUFFIX=/Contents
713         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
714     fi
715     # See comment above the case "$host_os"
716     LINKFLAGSSHL="-dynamiclib -single_module"
718     # -fPIC is default
719     PICSWITCH=""
721     DLLPOST=".dylib"
723     # -undefined error is the default
724     LINKFLAGSNOUNDEFS=""
727 freebsd*)
728     build_gstreamer_1_0=yes
729     test_kf5=yes
730     test_gtk3_kde5=yes
731     test_freetype=yes
732     build_skia=yes
733     AC_MSG_CHECKING([the FreeBSD operating system release])
734     if test -n "$with_os_version"; then
735         OSVERSION="$with_os_version"
736     else
737         OSVERSION=`/sbin/sysctl -n kern.osreldate`
738     fi
739     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
740     AC_MSG_CHECKING([which thread library to use])
741     if test "$OSVERSION" -lt "500016"; then
742         PTHREAD_CFLAGS="-D_THREAD_SAFE"
743         PTHREAD_LIBS="-pthread"
744     elif test "$OSVERSION" -lt "502102"; then
745         PTHREAD_CFLAGS="-D_THREAD_SAFE"
746         PTHREAD_LIBS="-lc_r"
747     else
748         PTHREAD_CFLAGS=""
749         PTHREAD_LIBS="-pthread"
750     fi
751     AC_MSG_RESULT([$PTHREAD_LIBS])
752     _os=FreeBSD
753     ;;
755 *netbsd*)
756     build_gstreamer_1_0=yes
757     test_kf5=yes
758     test_gtk3_kde5=yes
759     test_freetype=yes
760     build_skia=yes
761     PTHREAD_LIBS="-pthread -lpthread"
762     _os=NetBSD
763     ;;
765 aix*)
766     test_randr=no
767     test_freetype=yes
768     PTHREAD_LIBS=-pthread
769     _os=AIX
770     ;;
772 openbsd*)
773     test_freetype=yes
774     PTHREAD_CFLAGS="-D_THREAD_SAFE"
775     PTHREAD_LIBS="-pthread"
776     _os=OpenBSD
777     ;;
779 dragonfly*)
780     build_gstreamer_1_0=yes
781     test_kf5=yes
782     test_gtk3_kde5=yes
783     test_freetype=yes
784     build_skia=yes
785     PTHREAD_LIBS="-pthread"
786     _os=DragonFly
787     ;;
789 linux-android*)
790     build_gstreamer_1_0=no
791     enable_lotuswordpro=no
792     enable_mpl_subset=yes
793     enable_coinmp=yes
794     enable_lpsolve=no
795     enable_report_builder=no
796     enable_odk=no
797     enable_postgresql_sdbc=no
798     enable_python=no
799     test_cups=no
800     test_dbus=no
801     test_fontconfig=no
802     test_freetype=no
803     test_kf5=no
804     test_qt5=no
805     test_gtk3_kde5=no
806     test_randr=no
807     test_xrender=no
808     _os=Android
810     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
811     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
812     ;;
814 haiku*)
815     test_cups=no
816     test_dbus=no
817     test_randr=no
818     test_xrender=no
819     test_freetype=yes
820     enable_odk=no
821     enable_gstreamer_1_0=no
822     enable_vlc=no
823     enable_coinmp=no
824     enable_pdfium=no
825     enable_sdremote=no
826     enable_postgresql_sdbc=no
827     enable_firebird_sdbc=no
828     _os=Haiku
829     ;;
832     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
833     ;;
834 esac
836 if test "$_os" = "Android" ; then
837     # Verify that the NDK and SDK options are proper
838     if test -z "$with_android_ndk"; then
839         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
840     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
841         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
842     fi
844     if test -z "$ANDROID_SDK_HOME"; then
845         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
846     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
847         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
848     fi
850     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
851     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
852         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
853                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
854                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
855         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
856         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
857         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
858     fi
859     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
860         AC_MSG_WARN([android support repository not found - install with
861                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
862                      to allow the build to download the specified version of the android support libraries])
863         add_warning "android support repository not found - install with"
864         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
865         add_warning "to allow the build to download the specified version of the android support libraries"
866     fi
869 if test "$_os" = "AIX"; then
870     AC_PATH_PROG(GAWK, gawk)
871     if test -z "$GAWK"; then
872         AC_MSG_ERROR([gawk not found in \$PATH])
873     fi
876 AC_SUBST(SDKDIRNAME)
878 AC_SUBST(PTHREAD_CFLAGS)
879 AC_SUBST(PTHREAD_LIBS)
881 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
882 # By default use the ones specified by our build system,
883 # but explicit override is possible.
884 AC_MSG_CHECKING(for explicit AFLAGS)
885 if test -n "$AFLAGS"; then
886     AC_MSG_RESULT([$AFLAGS])
887     x_AFLAGS=
888 else
889     AC_MSG_RESULT(no)
890     x_AFLAGS=[\#]
892 AC_MSG_CHECKING(for explicit CFLAGS)
893 if test -n "$CFLAGS"; then
894     AC_MSG_RESULT([$CFLAGS])
895     x_CFLAGS=
896 else
897     AC_MSG_RESULT(no)
898     x_CFLAGS=[\#]
900 AC_MSG_CHECKING(for explicit CXXFLAGS)
901 if test -n "$CXXFLAGS"; then
902     AC_MSG_RESULT([$CXXFLAGS])
903     x_CXXFLAGS=
904 else
905     AC_MSG_RESULT(no)
906     x_CXXFLAGS=[\#]
908 AC_MSG_CHECKING(for explicit OBJCFLAGS)
909 if test -n "$OBJCFLAGS"; then
910     AC_MSG_RESULT([$OBJCFLAGS])
911     x_OBJCFLAGS=
912 else
913     AC_MSG_RESULT(no)
914     x_OBJCFLAGS=[\#]
916 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
917 if test -n "$OBJCXXFLAGS"; then
918     AC_MSG_RESULT([$OBJCXXFLAGS])
919     x_OBJCXXFLAGS=
920 else
921     AC_MSG_RESULT(no)
922     x_OBJCXXFLAGS=[\#]
924 AC_MSG_CHECKING(for explicit LDFLAGS)
925 if test -n "$LDFLAGS"; then
926     AC_MSG_RESULT([$LDFLAGS])
927     x_LDFLAGS=
928 else
929     AC_MSG_RESULT(no)
930     x_LDFLAGS=[\#]
932 AC_SUBST(AFLAGS)
933 AC_SUBST(CFLAGS)
934 AC_SUBST(CXXFLAGS)
935 AC_SUBST(OBJCFLAGS)
936 AC_SUBST(OBJCXXFLAGS)
937 AC_SUBST(LDFLAGS)
938 AC_SUBST(x_AFLAGS)
939 AC_SUBST(x_CFLAGS)
940 AC_SUBST(x_CXXFLAGS)
941 AC_SUBST(x_OBJCFLAGS)
942 AC_SUBST(x_OBJCXXFLAGS)
943 AC_SUBST(x_LDFLAGS)
945 dnl These are potentially set for MSVC, in the code checking for UCRT below:
946 my_original_CFLAGS=$CFLAGS
947 my_original_CXXFLAGS=$CXXFLAGS
948 my_original_CPPFLAGS=$CPPFLAGS
950 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
951 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
952 dnl AC_PROG_CC internally.
953 if test "$_os" != "WINNT"; then
954     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
955     save_CFLAGS=$CFLAGS
956     AC_PROG_CC
957     CFLAGS=$save_CFLAGS
958     if test -z "$CC_BASE"; then
959         CC_BASE=`first_arg_basename "$CC"`
960     fi
963 if test "$_os" != "WINNT"; then
964     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
965 else
966     ENDIANNESS=little
968 AC_SUBST(ENDIANNESS)
970 if test $_os != "WINNT"; then
971     save_LIBS="$LIBS"
972     AC_SEARCH_LIBS([dlsym], [dl],
973         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
974         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
975     LIBS="$save_LIBS"
977 AC_SUBST(DLOPEN_LIBS)
979 AC_ARG_ENABLE(ios-simulator,
980     AS_HELP_STRING([--enable-ios-simulator],
981         [build i386 or x86_64 for ios simulator])
984 AC_ARG_ENABLE(ios-libreofficelight-app,
985     AS_HELP_STRING([--enable-ios-libreofficelight-app],
986         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
987          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
988          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
991 ENABLE_IOS_LIBREOFFICELIGHT_APP=
992 if test "$enable_ios_libreofficelight_app" = yes; then
993     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
995 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
997 ###############################################################################
998 # Extensions switches --enable/--disable
999 ###############################################################################
1000 # By default these should be enabled unless having extra dependencies.
1001 # If there is extra dependency over configure options then the enable should
1002 # be automagic based on whether the requiring feature is enabled or not.
1003 # All this options change anything only with --enable-extension-integration.
1005 # The name of this option and its help string makes it sound as if
1006 # extensions are built anyway, just not integrated in the installer,
1007 # if you use --disable-extension-integration. Is that really the
1008 # case?
1010 libo_FUZZ_ARG_ENABLE(extension-integration,
1011     AS_HELP_STRING([--disable-extension-integration],
1012         [Disable integration of the built extensions in the installer of the
1013          product. Use this switch to disable the integration.])
1016 AC_ARG_ENABLE(avmedia,
1017     AS_HELP_STRING([--disable-avmedia],
1018         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1021 AC_ARG_ENABLE(database-connectivity,
1022     AS_HELP_STRING([--disable-database-connectivity],
1023         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1026 # This doesn't mean not building (or "integrating") extensions
1027 # (although it probably should; i.e. it should imply
1028 # --disable-extension-integration I guess), it means not supporting
1029 # any extension mechanism at all
1030 libo_FUZZ_ARG_ENABLE(extensions,
1031     AS_HELP_STRING([--disable-extensions],
1032         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1035 AC_ARG_ENABLE(scripting,
1036     AS_HELP_STRING([--disable-scripting],
1037         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1040 # This is mainly for Android and iOS, but could potentially be used in some
1041 # special case otherwise, too, so factored out as a separate setting
1043 AC_ARG_ENABLE(dynamic-loading,
1044     AS_HELP_STRING([--disable-dynamic-loading],
1045         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1048 libo_FUZZ_ARG_ENABLE(report-builder,
1049     AS_HELP_STRING([--disable-report-builder],
1050         [Disable the Report Builder.])
1053 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1054     AS_HELP_STRING([--enable-ext-wiki-publisher],
1055         [Enable the Wiki Publisher extension.])
1058 libo_FUZZ_ARG_ENABLE(lpsolve,
1059     AS_HELP_STRING([--disable-lpsolve],
1060         [Disable compilation of the lp solve solver ])
1062 libo_FUZZ_ARG_ENABLE(coinmp,
1063     AS_HELP_STRING([--disable-coinmp],
1064         [Disable compilation of the CoinMP solver ])
1067 libo_FUZZ_ARG_ENABLE(pdfimport,
1068     AS_HELP_STRING([--disable-pdfimport],
1069         [Disable building the PDF import feature.])
1072 libo_FUZZ_ARG_ENABLE(pdfium,
1073     AS_HELP_STRING([--disable-pdfium],
1074         [Disable building PDFium.])
1077 libo_FUZZ_ARG_ENABLE(skia,
1078     AS_HELP_STRING([--disable-skia],
1079         [Disable building Skia.])
1082 ###############################################################################
1084 dnl ---------- *** ----------
1086 libo_FUZZ_ARG_ENABLE(mergelibs,
1087     AS_HELP_STRING([--enable-mergelibs],
1088         [Merge several of the smaller libraries into one big, "merged", one.])
1091 libo_FUZZ_ARG_ENABLE(breakpad,
1092     AS_HELP_STRING([--enable-breakpad],
1093         [Enables breakpad for crash reporting.])
1096 libo_FUZZ_ARG_ENABLE(crashdump,
1097     AS_HELP_STRING([--disable-crashdump],
1098         [Disable dump.ini and dump-file, when --enable-breakpad])
1101 AC_ARG_ENABLE(fetch-external,
1102     AS_HELP_STRING([--disable-fetch-external],
1103         [Disables fetching external tarballs from web sources.])
1106 AC_ARG_ENABLE(fuzzers,
1107     AS_HELP_STRING([--enable-fuzzers],
1108         [Enables building libfuzzer targets for fuzz testing.])
1111 libo_FUZZ_ARG_ENABLE(pch,
1112     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1113         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1114          Using 'system' will include only external headers, 'base' will add also headers
1115          from base modules, 'normal' will also add all headers except from the module built,
1116          'full' will use all suitable headers even from a module itself.])
1119 libo_FUZZ_ARG_ENABLE(epm,
1120     AS_HELP_STRING([--enable-epm],
1121         [LibreOffice includes self-packaging code, that requires epm, however epm is
1122          useless for large scale package building.])
1125 libo_FUZZ_ARG_ENABLE(odk,
1126     AS_HELP_STRING([--disable-odk],
1127         [LibreOffice includes an ODK, office development kit which some packagers may
1128          wish to build without.])
1131 AC_ARG_ENABLE(mpl-subset,
1132     AS_HELP_STRING([--enable-mpl-subset],
1133         [Don't compile any pieces which are not MPL or more liberally licensed])
1136 libo_FUZZ_ARG_ENABLE(evolution2,
1137     AS_HELP_STRING([--enable-evolution2],
1138         [Allows the built-in evolution 2 addressbook connectivity build to be
1139          enabled.])
1142 AC_ARG_ENABLE(avahi,
1143     AS_HELP_STRING([--enable-avahi],
1144         [Determines whether to use Avahi to advertise Impress to remote controls.])
1147 libo_FUZZ_ARG_ENABLE(werror,
1148     AS_HELP_STRING([--enable-werror],
1149         [Turn warnings to errors. (Has no effect in modules where the treating
1150          of warnings as errors is disabled explicitly.)]),
1153 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1154     AS_HELP_STRING([--enable-assert-always-abort],
1155         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1158 libo_FUZZ_ARG_ENABLE(dbgutil,
1159     AS_HELP_STRING([--enable-dbgutil],
1160         [Provide debugging support from --enable-debug and include additional debugging
1161          utilities such as object counting or more expensive checks.
1162          This is the recommended option for developers.
1163          Note that this makes the build ABI incompatible, it is not possible to mix object
1164          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1166 libo_FUZZ_ARG_ENABLE(debug,
1167     AS_HELP_STRING([--enable-debug],
1168         [Include debugging information, disable compiler optimization and inlining plus
1169          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1171 libo_FUZZ_ARG_ENABLE(split-debug,
1172     AS_HELP_STRING([--disable-split-debug],
1173         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1174          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1176 libo_FUZZ_ARG_ENABLE(gdb-index,
1177     AS_HELP_STRING([--disable-gdb-index],
1178         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1179          The feature requires the gold or lld linker.]))
1181 libo_FUZZ_ARG_ENABLE(sal-log,
1182     AS_HELP_STRING([--enable-sal-log],
1183         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1185 libo_FUZZ_ARG_ENABLE(symbols,
1186     AS_HELP_STRING([--enable-symbols],
1187         [Generate debug information.
1188          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1189          otherwise. It is possible to explicitly specify gbuild build targets
1190          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1191          everything in the directory; there is no ordering, more specific overrides
1192          more general, and disabling takes precedence).
1193          Example: --enable-symbols="all -sw/ -Library_sc".]))
1195 libo_FUZZ_ARG_ENABLE(optimized,
1196     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1197         [Whether to compile with optimization flags.
1198          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1199          otherwise. Using 'debug' will try to use only optimizations that should
1200          not interfere with debugging.]))
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(compiler-plugins-analyzer-pch,
1226     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1227         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1228          relevant in the --disable-compiler-plugins case.]))
1230 libo_FUZZ_ARG_ENABLE(ooenv,
1231     AS_HELP_STRING([--disable-ooenv],
1232         [Disable ooenv for the instdir installation.]))
1234 libo_FUZZ_ARG_ENABLE(libnumbertext,
1235     AS_HELP_STRING([--disable-libnumbertext],
1236         [Disable use of numbertext external library.]))
1238 AC_ARG_ENABLE(lto,
1239     AS_HELP_STRING([--enable-lto],
1240         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1241          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1242          linker. For MSVC, this option is broken at the moment. This is experimental work
1243          in progress that shouldn't be used unless you are working on it.)]))
1245 AC_ARG_ENABLE(python,
1246     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1247         [Enables or disables Python support at run-time.
1248          Also specifies what Python to use. 'auto' is the default.
1249          'fully-internal' even forces the internal version for uses of Python
1250          during the build.]))
1252 libo_FUZZ_ARG_ENABLE(gtk3,
1253     AS_HELP_STRING([--disable-gtk3],
1254         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1255 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1257 AC_ARG_ENABLE(introspection,
1258     AS_HELP_STRING([--enable-introspection],
1259         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1260          Linux distributions.)]))
1262 AC_ARG_ENABLE(split-app-modules,
1263     AS_HELP_STRING([--enable-split-app-modules],
1264         [Split file lists for app modules, e.g. base, calc.
1265          Has effect only with make distro-pack-install]),
1268 AC_ARG_ENABLE(split-opt-features,
1269     AS_HELP_STRING([--enable-split-opt-features],
1270         [Split file lists for some optional features, e.g. pyuno, testtool.
1271          Has effect only with make distro-pack-install]),
1274 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1275     AS_HELP_STRING([--disable-cairo-canvas],
1276         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1279 libo_FUZZ_ARG_ENABLE(dbus,
1280     AS_HELP_STRING([--disable-dbus],
1281         [Determines whether to enable features that depend on dbus.
1282          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1283 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1285 libo_FUZZ_ARG_ENABLE(sdremote,
1286     AS_HELP_STRING([--disable-sdremote],
1287         [Determines whether to enable Impress remote control (i.e. the server component).]),
1288 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1290 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1291     AS_HELP_STRING([--disable-sdremote-bluetooth],
1292         [Determines whether to build sdremote with bluetooth support.
1293          Requires dbus on Linux.]))
1295 libo_FUZZ_ARG_ENABLE(gio,
1296     AS_HELP_STRING([--disable-gio],
1297         [Determines whether to use the GIO support.]),
1298 ,test "${enable_gio+set}" = set || enable_gio=yes)
1300 AC_ARG_ENABLE(qt5,
1301     AS_HELP_STRING([--enable-qt5],
1302         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1303          available.]),
1306 AC_ARG_ENABLE(kf5,
1307     AS_HELP_STRING([--enable-kf5],
1308         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1309          KF5 are available.]),
1312 AC_ARG_ENABLE(kde5,
1313     AS_HELP_STRING([--enable-kde5],
1314         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1317 AC_ARG_ENABLE(gtk3_kde5,
1318     AS_HELP_STRING([--enable-gtk3-kde5],
1319         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1320          platforms where Gtk3, Qt5 and Plasma is available.]),
1323 AC_ARG_ENABLE(gui,
1324     AS_HELP_STRING([--disable-gui],
1325         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1326 ,enable_gui=yes)
1328 libo_FUZZ_ARG_ENABLE(randr,
1329     AS_HELP_STRING([--disable-randr],
1330         [Disable RandR support in the vcl project.]),
1331 ,test "${enable_randr+set}" = set || enable_randr=yes)
1333 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1334     AS_HELP_STRING([--disable-gstreamer-1-0],
1335         [Disable building with the gstreamer 1.0 avmedia backend.]),
1336 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1338 libo_FUZZ_ARG_ENABLE(vlc,
1339     AS_HELP_STRING([--enable-vlc],
1340         [Enable building with the (experimental) VLC avmedia backend.]),
1341 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1343 libo_FUZZ_ARG_ENABLE(neon,
1344     AS_HELP_STRING([--disable-neon],
1345         [Disable neon and the compilation of webdav binding.]),
1348 libo_FUZZ_ARG_ENABLE([eot],
1349     [AS_HELP_STRING([--enable-eot],
1350         [Enable support for Embedded OpenType fonts.])],
1351 ,test "${enable_eot+set}" = set || enable_eot=no)
1353 libo_FUZZ_ARG_ENABLE(cve-tests,
1354     AS_HELP_STRING([--disable-cve-tests],
1355         [Prevent CVE tests to be executed]),
1358 libo_FUZZ_ARG_ENABLE(chart-tests,
1359     AS_HELP_STRING([--enable-chart-tests],
1360         [Executes chart XShape tests. In a perfect world these tests would be
1361          stable and everyone could run them, in reality it is best to run them
1362          only on a few machines that are known to work and maintained by people
1363          who can judge if a test failure is a regression or not.]),
1366 AC_ARG_ENABLE(build-unowinreg,
1367     AS_HELP_STRING([--enable-build-unowinreg],
1368         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1369          compiler is needed on Linux.]),
1372 AC_ARG_ENABLE(build-opensymbol,
1373     AS_HELP_STRING([--enable-build-opensymbol],
1374         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1375          fontforge installed.]),
1378 AC_ARG_ENABLE(dependency-tracking,
1379     AS_HELP_STRING([--enable-dependency-tracking],
1380         [Do not reject slow dependency extractors.])[
1381   --disable-dependency-tracking
1382                           Disables generation of dependency information.
1383                           Speed up one-time builds.],
1386 AC_ARG_ENABLE(icecream,
1387     AS_HELP_STRING([--enable-icecream],
1388         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1389          It defaults to /opt/icecream for the location of the icecream gcc/g++
1390          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1393 AC_ARG_ENABLE(ld,
1394     AS_HELP_STRING([--enable-ld=<linker>],
1395         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1396          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1399 libo_FUZZ_ARG_ENABLE(cups,
1400     AS_HELP_STRING([--disable-cups],
1401         [Do not build cups support.])
1404 AC_ARG_ENABLE(ccache,
1405     AS_HELP_STRING([--disable-ccache],
1406         [Do not try to use ccache automatically.
1407          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1408          CC/CXX are not yet set, and --enable-icecream is not given, we
1409          attempt to use ccache. --disable-ccache disables ccache completely.
1410          Additionally ccache's depend mode is enabled if possible,
1411          use --enable-ccache=nodepend to enable ccache without depend mode.
1415 AC_ARG_ENABLE(64-bit,
1416     AS_HELP_STRING([--enable-64-bit],
1417         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1418          At the moment meaningful only for Windows.]), ,)
1420 libo_FUZZ_ARG_ENABLE(online-update,
1421     AS_HELP_STRING([--enable-online-update],
1422         [Enable the online update service that will check for new versions of
1423          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1424          If the value is "mar", the experimental Mozilla-like update will be
1425          enabled instead of the traditional update mechanism.]),
1428 AC_ARG_WITH(update-config,
1429     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1430                    [Path to the update config ini file]))
1432 libo_FUZZ_ARG_ENABLE(extension-update,
1433     AS_HELP_STRING([--disable-extension-update],
1434         [Disable possibility to update installed extensions.]),
1437 libo_FUZZ_ARG_ENABLE(release-build,
1438     AS_HELP_STRING([--enable-release-build],
1439         [Enable release build. Note that the "release build" choice is orthogonal to
1440          whether symbols are present, debug info is generated, or optimization
1441          is done.
1442          See http://wiki.documentfoundation.org/Development/DevBuild]),
1445 AC_ARG_ENABLE(windows-build-signing,
1446     AS_HELP_STRING([--enable-windows-build-signing],
1447         [Enable signing of windows binaries (*.exe, *.dll)]),
1450 AC_ARG_ENABLE(silent-msi,
1451     AS_HELP_STRING([--enable-silent-msi],
1452         [Enable MSI with LIMITUI=1 (silent install).]),
1455 AC_ARG_ENABLE(macosx-code-signing,
1456     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1457         [Sign executables, dylibs, frameworks and the app bundle. If you
1458          don't provide an identity the first suitable certificate
1459          in your keychain is used.]),
1462 AC_ARG_ENABLE(macosx-package-signing,
1463     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1464         [Create a .pkg suitable for uploading to the Mac App Store and sign
1465          it. If you don't provide an identity the first suitable certificate
1466          in your keychain is used.]),
1469 AC_ARG_ENABLE(macosx-sandbox,
1470     AS_HELP_STRING([--enable-macosx-sandbox],
1471         [Make the app bundle run in a sandbox. Requires code signing.
1472          Is required by apps distributed in the Mac App Store, and implies
1473          adherence to App Store rules.]),
1476 AC_ARG_WITH(macosx-bundle-identifier,
1477     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1478         [Define the macOS bundle identifier. Default is the somewhat weird
1479          org.libreoffice.script ("script", huh?).]),
1480 ,with_macosx_bundle_identifier=org.libreoffice.script)
1482 AC_ARG_WITH(product-name,
1483     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1484         [Define the product name. Default is AC_PACKAGE_NAME.]),
1485 ,with_product_name=$PRODUCTNAME)
1487 AC_ARG_WITH(package-version,
1488     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1489         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1492 libo_FUZZ_ARG_ENABLE(readonly-installset,
1493     AS_HELP_STRING([--enable-readonly-installset],
1494         [Prevents any attempts by LibreOffice to write into its installation. That means
1495          at least that no "system-wide" extensions can be added. Partly experimental work in
1496          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1499 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1500     AS_HELP_STRING([--disable-postgresql-sdbc],
1501         [Disable the build of the PostgreSQL-SDBC driver.])
1504 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1505     AS_HELP_STRING([--disable-lotuswordpro],
1506         [Disable the build of the Lotus Word Pro filter.]),
1507 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1509 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1510     AS_HELP_STRING([--disable-firebird-sdbc],
1511         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1512 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1514 AC_ARG_ENABLE(bogus-pkg-config,
1515     AS_HELP_STRING([--enable-bogus-pkg-config],
1516         [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.]),
1519 AC_ARG_ENABLE(openssl,
1520     AS_HELP_STRING([--disable-openssl],
1521         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1522          components will either use GNUTLS or NSS. Work in progress,
1523          use only if you are hacking on it.]),
1524 ,enable_openssl=yes)
1526 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1527     AS_HELP_STRING([--enable-cipher-openssl-backend],
1528         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1529          Requires --enable-openssl.]))
1531 AC_ARG_ENABLE(library-bin-tar,
1532     AS_HELP_STRING([--enable-library-bin-tar],
1533         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1534         Some libraries can save their build result in a tarball
1535         stored in TARFILE_LOCATION. That binary tarball is
1536         uniquely identified by the source tarball,
1537         the content of the config_host.mk file and the content
1538         of the top-level directory in core for that library
1539         If this option is enabled, then if such a tarfile exist, it will be untarred
1540         instead of the source tarfile, and the build step will be skipped for that
1541         library.
1542         If a proper tarfile does not exist, then the normal source-based
1543         build is done for that library and a proper binary tarfile is created
1544         for the next time.]),
1547 AC_ARG_ENABLE(dconf,
1548     AS_HELP_STRING([--disable-dconf],
1549         [Disable the dconf configuration backend (enabled by default where
1550          available).]))
1552 libo_FUZZ_ARG_ENABLE(formula-logger,
1553     AS_HELP_STRING(
1554         [--enable-formula-logger],
1555         [Enable formula logger for logging formula calculation flow in Calc.]
1556     )
1559 AC_ARG_ENABLE(ldap,
1560     AS_HELP_STRING([--disable-ldap],
1561         [Disable LDAP support.]),
1562 ,enable_ldap=yes)
1564 dnl ===================================================================
1565 dnl Optional Packages (--with/without-)
1566 dnl ===================================================================
1568 AC_ARG_WITH(gcc-home,
1569     AS_HELP_STRING([--with-gcc-home],
1570         [Specify the location of gcc/g++ manually. This can be used in conjunction
1571          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1572          non-default path.]),
1575 AC_ARG_WITH(gnu-patch,
1576     AS_HELP_STRING([--with-gnu-patch],
1577         [Specify location of GNU patch on Solaris or FreeBSD.]),
1580 AC_ARG_WITH(build-platform-configure-options,
1581     AS_HELP_STRING([--with-build-platform-configure-options],
1582         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1585 AC_ARG_WITH(gnu-cp,
1586     AS_HELP_STRING([--with-gnu-cp],
1587         [Specify location of GNU cp on Solaris or FreeBSD.]),
1590 AC_ARG_WITH(external-tar,
1591     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1592         [Specify an absolute path of where to find (and store) tarfiles.]),
1593     TARFILE_LOCATION=$withval ,
1596 AC_ARG_WITH(referenced-git,
1597     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1598         [Specify another checkout directory to reference. This makes use of
1599                  git submodule update --reference, and saves a lot of diskspace
1600                  when having multiple trees side-by-side.]),
1601     GIT_REFERENCE_SRC=$withval ,
1604 AC_ARG_WITH(linked-git,
1605     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1606         [Specify a directory where the repositories of submodules are located.
1607          This uses a method similar to git-new-workdir to get submodules.]),
1608     GIT_LINK_SRC=$withval ,
1611 AC_ARG_WITH(galleries,
1612     AS_HELP_STRING([--with-galleries],
1613         [Specify how galleries should be built. It is possible either to
1614          build these internally from source ("build"),
1615          or to disable them ("no")]),
1618 AC_ARG_WITH(theme,
1619     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1620         [Choose which themes to include. By default those themes with an '*' are included.
1621          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1622          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg, *tango.]),
1625 libo_FUZZ_ARG_WITH(helppack-integration,
1626     AS_HELP_STRING([--without-helppack-integration],
1627         [It will not integrate the helppacks to the installer
1628          of the product. Please use this switch to use the online help
1629          or separate help packages.]),
1632 libo_FUZZ_ARG_WITH(fonts,
1633     AS_HELP_STRING([--without-fonts],
1634         [LibreOffice includes some third-party fonts to provide a reliable basis for
1635          help content, templates, samples, etc. When these fonts are already
1636          known to be available on the system then you should use this option.]),
1639 AC_ARG_WITH(epm,
1640     AS_HELP_STRING([--with-epm],
1641         [Decides which epm to use. Default is to use the one from the system if
1642          one is built. When either this is not there or you say =internal epm
1643          will be built.]),
1646 AC_ARG_WITH(package-format,
1647     AS_HELP_STRING([--with-package-format],
1648         [Specify package format(s) for LibreOffice installation sets. The
1649          implicit --without-package-format leads to no installation sets being
1650          generated. Possible values: aix, archive, bsd, deb, dmg,
1651          installed, msi, pkg, and rpm.
1652          Example: --with-package-format='deb rpm']),
1655 AC_ARG_WITH(tls,
1656     AS_HELP_STRING([--with-tls],
1657         [Decides which TLS/SSL and cryptographic implementations to use for
1658          LibreOffice's code. Notice that this doesn't apply for depending
1659          libraries like "neon", for example. Default is to use NSS
1660          although OpenSSL is also possible. Notice that selecting NSS restricts
1661          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1662          restrict by now the usage of NSS in LO's code. Possible values:
1663          openssl, nss. Example: --with-tls="nss"]),
1666 AC_ARG_WITH(system-libs,
1667     AS_HELP_STRING([--with-system-libs],
1668         [Use libraries already on system -- enables all --with-system-* flags.]),
1671 AC_ARG_WITH(system-bzip2,
1672     AS_HELP_STRING([--with-system-bzip2],
1673         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1674     [with_system_bzip2="$with_system_libs"])
1676 AC_ARG_WITH(system-headers,
1677     AS_HELP_STRING([--with-system-headers],
1678         [Use headers already on system -- enables all --with-system-* flags for
1679          external packages whose headers are the only entities used i.e.
1680          boost/odbc/sane-header(s).]),,
1681     [with_system_headers="$with_system_libs"])
1683 AC_ARG_WITH(system-jars,
1684     AS_HELP_STRING([--without-system-jars],
1685         [When building with --with-system-libs, also the needed jars are expected
1686          on the system. Use this to disable that]),,
1687     [with_system_jars="$with_system_libs"])
1689 AC_ARG_WITH(system-cairo,
1690     AS_HELP_STRING([--with-system-cairo],
1691         [Use cairo libraries already on system.  Happens automatically for
1692          (implicit) --enable-gtk3.]))
1694 AC_ARG_WITH(system-epoxy,
1695     AS_HELP_STRING([--with-system-epoxy],
1696         [Use epoxy libraries already on system.  Happens automatically for
1697          (implicit) --enable-gtk3.]),,
1698        [with_system_epoxy="$with_system_libs"])
1700 AC_ARG_WITH(myspell-dicts,
1701     AS_HELP_STRING([--with-myspell-dicts],
1702         [Adds myspell dictionaries to the LibreOffice installation set]),
1705 AC_ARG_WITH(system-dicts,
1706     AS_HELP_STRING([--without-system-dicts],
1707         [Do not use dictionaries from system paths.]),
1710 AC_ARG_WITH(external-dict-dir,
1711     AS_HELP_STRING([--with-external-dict-dir],
1712         [Specify external dictionary dir.]),
1715 AC_ARG_WITH(external-hyph-dir,
1716     AS_HELP_STRING([--with-external-hyph-dir],
1717         [Specify external hyphenation pattern dir.]),
1720 AC_ARG_WITH(external-thes-dir,
1721     AS_HELP_STRING([--with-external-thes-dir],
1722         [Specify external thesaurus dir.]),
1725 AC_ARG_WITH(system-zlib,
1726     AS_HELP_STRING([--with-system-zlib],
1727         [Use zlib already on system.]),,
1728     [with_system_zlib=auto])
1730 AC_ARG_WITH(system-jpeg,
1731     AS_HELP_STRING([--with-system-jpeg],
1732         [Use jpeg already on system.]),,
1733     [with_system_jpeg="$with_system_libs"])
1735 AC_ARG_WITH(system-clucene,
1736     AS_HELP_STRING([--with-system-clucene],
1737         [Use clucene already on system.]),,
1738     [with_system_clucene="$with_system_libs"])
1740 AC_ARG_WITH(system-expat,
1741     AS_HELP_STRING([--with-system-expat],
1742         [Use expat already on system.]),,
1743     [with_system_expat="$with_system_libs"])
1745 AC_ARG_WITH(system-libxml,
1746     AS_HELP_STRING([--with-system-libxml],
1747         [Use libxml/libxslt already on system.]),,
1748     [with_system_libxml=auto])
1750 AC_ARG_WITH(system-icu,
1751     AS_HELP_STRING([--with-system-icu],
1752         [Use icu already on system.]),,
1753     [with_system_icu="$with_system_libs"])
1755 AC_ARG_WITH(system-ucpp,
1756     AS_HELP_STRING([--with-system-ucpp],
1757         [Use ucpp already on system.]),,
1758     [])
1760 AC_ARG_WITH(system-openldap,
1761     AS_HELP_STRING([--with-system-openldap],
1762         [Use the OpenLDAP LDAP SDK already on system.]),,
1763     [with_system_openldap="$with_system_libs"])
1765 libo_FUZZ_ARG_ENABLE(poppler,
1766     AS_HELP_STRING([--disable-poppler],
1767         [Disable building Poppler.])
1770 AC_ARG_WITH(system-poppler,
1771     AS_HELP_STRING([--with-system-poppler],
1772         [Use system poppler (only needed for PDF import).]),,
1773     [with_system_poppler="$with_system_libs"])
1775 AC_ARG_WITH(system-gpgmepp,
1776     AS_HELP_STRING([--with-system-gpgmepp],
1777         [Use gpgmepp already on system]),,
1778     [with_system_gpgmepp="$with_system_libs"])
1780 AC_ARG_WITH(system-apache-commons,
1781     AS_HELP_STRING([--with-system-apache-commons],
1782         [Use Apache commons libraries already on system.]),,
1783     [with_system_apache_commons="$with_system_jars"])
1785 AC_ARG_WITH(system-mariadb,
1786     AS_HELP_STRING([--with-system-mariadb],
1787         [Use MariaDB/MySQL libraries already on system.]),,
1788     [with_system_mariadb="$with_system_libs"])
1790 AC_ARG_ENABLE(bundle-mariadb,
1791     AS_HELP_STRING([--enable-bundle-mariadb],
1792         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1795 AC_ARG_WITH(system-postgresql,
1796     AS_HELP_STRING([--with-system-postgresql],
1797         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1798          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1799     [with_system_postgresql="$with_system_libs"])
1801 AC_ARG_WITH(libpq-path,
1802     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1803         [Use this PostgreSQL C interface (libpq) installation for building
1804          the PostgreSQL-SDBC extension.]),
1807 AC_ARG_WITH(system-firebird,
1808     AS_HELP_STRING([--with-system-firebird],
1809         [Use Firebird libraries already on system, for building the Firebird-SDBC
1810          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1811     [with_system_firebird="$with_system_libs"])
1813 AC_ARG_WITH(system-libtommath,
1814             AS_HELP_STRING([--with-system-libtommath],
1815                            [Use libtommath already on system]),,
1816             [with_system_libtommath="$with_system_libs"])
1818 AC_ARG_WITH(system-hsqldb,
1819     AS_HELP_STRING([--with-system-hsqldb],
1820         [Use hsqldb already on system.]))
1822 AC_ARG_WITH(hsqldb-jar,
1823     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     HSQLDB_JAR=$withval)
1827 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1828     AS_HELP_STRING([--disable-scripting-beanshell],
1829         [Disable support for scripts in BeanShell.]),
1833 AC_ARG_WITH(system-beanshell,
1834     AS_HELP_STRING([--with-system-beanshell],
1835         [Use beanshell already on system.]),,
1836     [with_system_beanshell="$with_system_jars"])
1838 AC_ARG_WITH(beanshell-jar,
1839     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     BSH_JAR=$withval)
1843 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1844     AS_HELP_STRING([--disable-scripting-javascript],
1845         [Disable support for scripts in JavaScript.]),
1849 AC_ARG_WITH(system-rhino,
1850     AS_HELP_STRING([--with-system-rhino],
1851         [Use rhino already on system.]),,)
1852 #    [with_system_rhino="$with_system_jars"])
1853 # Above is not used as we have different debug interface
1854 # patched into internal rhino. This code needs to be fixed
1855 # before we can enable it by default.
1857 AC_ARG_WITH(rhino-jar,
1858     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     RHINO_JAR=$withval)
1862 AC_ARG_WITH(commons-logging-jar,
1863     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     COMMONS_LOGGING_JAR=$withval)
1867 AC_ARG_WITH(system-jfreereport,
1868     AS_HELP_STRING([--with-system-jfreereport],
1869         [Use JFreeReport already on system.]),,
1870     [with_system_jfreereport="$with_system_jars"])
1872 AC_ARG_WITH(sac-jar,
1873     AS_HELP_STRING([--with-sac-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     SAC_JAR=$withval)
1877 AC_ARG_WITH(libxml-jar,
1878     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBXML_JAR=$withval)
1882 AC_ARG_WITH(flute-jar,
1883     AS_HELP_STRING([--with-flute-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     FLUTE_JAR=$withval)
1887 AC_ARG_WITH(jfreereport-jar,
1888     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     JFREEREPORT_JAR=$withval)
1892 AC_ARG_WITH(liblayout-jar,
1893     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBLAYOUT_JAR=$withval)
1897 AC_ARG_WITH(libloader-jar,
1898     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBLOADER_JAR=$withval)
1902 AC_ARG_WITH(libformula-jar,
1903     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBFORMULA_JAR=$withval)
1907 AC_ARG_WITH(librepository-jar,
1908     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBREPOSITORY_JAR=$withval)
1912 AC_ARG_WITH(libfonts-jar,
1913     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBFONTS_JAR=$withval)
1917 AC_ARG_WITH(libserializer-jar,
1918     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1919         [Specify path to jarfile manually.]),
1920     LIBSERIALIZER_JAR=$withval)
1922 AC_ARG_WITH(libbase-jar,
1923     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1924         [Specify path to jarfile manually.]),
1925     LIBBASE_JAR=$withval)
1927 AC_ARG_WITH(system-odbc,
1928     AS_HELP_STRING([--with-system-odbc],
1929         [Use the odbc headers already on system.]),,
1930     [with_system_odbc="auto"])
1932 AC_ARG_WITH(system-sane,
1933     AS_HELP_STRING([--with-system-sane],
1934         [Use sane.h already on system.]),,
1935     [with_system_sane="$with_system_headers"])
1937 AC_ARG_WITH(system-bluez,
1938     AS_HELP_STRING([--with-system-bluez],
1939         [Use bluetooth.h already on system.]),,
1940     [with_system_bluez="$with_system_headers"])
1942 AC_ARG_WITH(system-curl,
1943     AS_HELP_STRING([--with-system-curl],
1944         [Use curl already on system.]),,
1945     [with_system_curl=auto])
1947 AC_ARG_WITH(system-boost,
1948     AS_HELP_STRING([--with-system-boost],
1949         [Use boost already on system.]),,
1950     [with_system_boost="$with_system_headers"])
1952 AC_ARG_WITH(system-glm,
1953     AS_HELP_STRING([--with-system-glm],
1954         [Use glm already on system.]),,
1955     [with_system_glm="$with_system_headers"])
1957 AC_ARG_WITH(system-hunspell,
1958     AS_HELP_STRING([--with-system-hunspell],
1959         [Use libhunspell already on system.]),,
1960     [with_system_hunspell="$with_system_libs"])
1962 AC_ARG_WITH(system-qrcodegen,
1963     AS_HELP_STRING([--with-system-qrcodegen],
1964         [Use libqrcodegen already on system.]),,
1965     [with_system_qrcodegen="$with_system_libs"])
1967 AC_ARG_WITH(system-mythes,
1968     AS_HELP_STRING([--with-system-mythes],
1969         [Use mythes already on system.]),,
1970     [with_system_mythes="$with_system_libs"])
1972 AC_ARG_WITH(system-altlinuxhyph,
1973     AS_HELP_STRING([--with-system-altlinuxhyph],
1974         [Use ALTLinuxhyph already on system.]),,
1975     [with_system_altlinuxhyph="$with_system_libs"])
1977 AC_ARG_WITH(system-lpsolve,
1978     AS_HELP_STRING([--with-system-lpsolve],
1979         [Use lpsolve already on system.]),,
1980     [with_system_lpsolve="$with_system_libs"])
1982 AC_ARG_WITH(system-coinmp,
1983     AS_HELP_STRING([--with-system-coinmp],
1984         [Use CoinMP already on system.]),,
1985     [with_system_coinmp="$with_system_libs"])
1987 AC_ARG_WITH(system-liblangtag,
1988     AS_HELP_STRING([--with-system-liblangtag],
1989         [Use liblangtag library already on system.]),,
1990     [with_system_liblangtag="$with_system_libs"])
1992 AC_ARG_WITH(webdav,
1993     AS_HELP_STRING([--with-webdav],
1994         [Specify which library to use for webdav implementation.
1995          Possible values: "neon", "serf", "no". The default value is "neon".
1996          Example: --with-webdav="serf"]),
1997     WITH_WEBDAV=$withval,
1998     WITH_WEBDAV="neon")
2000 AC_ARG_WITH(linker-hash-style,
2001     AS_HELP_STRING([--with-linker-hash-style],
2002         [Use linker with --hash-style=<style> when linking shared objects.
2003          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2004          if supported on the build system, and "sysv" otherwise.]))
2006 AC_ARG_WITH(jdk-home,
2007     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2008         [If you have installed JDK 8 or later on your system please supply the
2009          path here. Note that this is not the location of the java command but the
2010          location of the entire distribution.]),
2013 AC_ARG_WITH(help,
2014     AS_HELP_STRING([--with-help],
2015         [Enable the build of help. There is a special parameter "common" that
2016          can be used to bundle only the common part, .e.g help-specific icons.
2017          This is useful when you build the helpcontent separately.])
2018     [
2019                           Usage:     --with-help    build the old local help
2020                                  --without-help     no local help (default)
2021                                  --with-help=html   build the new HTML local help
2022                                  --with-help=online build the new HTML online help
2023     ],
2026 AC_ARG_WITH(omindex,
2027    AS_HELP_STRING([--with-omindex],
2028         [Enable the support of xapian-omega index for online help.])
2029    [
2030                          Usage: --with-omindex=server prepare the pages for omindex
2031                                 but let xapian-omega be built in server.
2032                                 --with-omindex=noxap do not prepare online pages
2033                                 for xapian-omega
2034   ],
2037 libo_FUZZ_ARG_WITH(java,
2038     AS_HELP_STRING([--with-java=<java command>],
2039         [Specify the name of the Java interpreter command. Typically "java"
2040          which is the default.
2042          To build without support for Java components, applets, accessibility
2043          or the XML filters written in Java, use --without-java or --with-java=no.]),
2044     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2045     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2048 AC_ARG_WITH(jvm-path,
2049     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2050         [Use a specific JVM search path at runtime.
2051          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2054 AC_ARG_WITH(ant-home,
2055     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2056         [If you have installed Apache Ant on your system, please supply the path here.
2057          Note that this is not the location of the Ant binary but the location
2058          of the entire distribution.]),
2061 AC_ARG_WITH(symbol-config,
2062     AS_HELP_STRING([--with-symbol-config],
2063         [Configuration for the crashreport symbol upload]),
2064         [],
2065         [with_symbol_config=no])
2067 AC_ARG_WITH(export-validation,
2068     AS_HELP_STRING([--without-export-validation],
2069         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2070 ,with_export_validation=auto)
2072 AC_ARG_WITH(bffvalidator,
2073     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2074         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2075          Requires installed Microsoft Office Binary File Format Validator.
2076          Note: export-validation (--with-export-validation) is required to be turned on.
2077          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2078 ,with_bffvalidator=no)
2080 libo_FUZZ_ARG_WITH(junit,
2081     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2082         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2083          --without-junit disables those tests. Not relevant in the --without-java case.]),
2084 ,with_junit=yes)
2086 AC_ARG_WITH(hamcrest,
2087     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2088         [Specifies the hamcrest jar file to use for JUnit-based tests.
2089          --without-junit disables those tests. Not relevant in the --without-java case.]),
2090 ,with_hamcrest=yes)
2092 AC_ARG_WITH(perl-home,
2093     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2094         [If you have installed Perl 5 Distribution, on your system, please
2095          supply the path here. Note that this is not the location of the Perl
2096          binary but the location of the entire distribution.]),
2099 libo_FUZZ_ARG_WITH(doxygen,
2100     AS_HELP_STRING(
2101         [--with-doxygen=<absolute path to doxygen executable>],
2102         [Specifies the doxygen executable to use when generating ODK C/C++
2103          documentation. --without-doxygen disables generation of ODK C/C++
2104          documentation. Not relevant in the --disable-odk case.]),
2105 ,with_doxygen=yes)
2107 AC_ARG_WITH(visual-studio,
2108     AS_HELP_STRING([--with-visual-studio=<2019>],
2109         [Specify which Visual Studio version to use in case several are
2110          installed. Currently only 2019 (default) is supported.]),
2113 AC_ARG_WITH(windows-sdk,
2114     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2115         [Specify which Windows SDK, or "Windows Kit", version to use
2116          in case the one that came with the selected Visual Studio
2117          is not what you want for some reason. Note that not all compiler/SDK
2118          combinations are supported. The intent is that this option should not
2119          be needed.]),
2122 AC_ARG_WITH(lang,
2123     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2124         [Use this option to build LibreOffice with additional UI language support.
2125          English (US) is always included by default.
2126          Separate multiple languages with space.
2127          For all languages, use --with-lang=ALL.]),
2130 AC_ARG_WITH(locales,
2131     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2132         [Use this option to limit the locale information built in.
2133          Separate multiple locales with space.
2134          Very experimental and might well break stuff.
2135          Just a desperate measure to shrink code and data size.
2136          By default all the locales available is included.
2137          This option is completely unrelated to --with-lang.])
2138     [
2139                           Affects also our character encoding conversion
2140                           tables for encodings mainly targeted for a
2141                           particular locale, like EUC-CN and EUC-TW for
2142                           zh, ISO-2022-JP for ja.
2144                           Affects also our add-on break iterator data for
2145                           some languages.
2147                           For the default, all locales, don't use this switch at all.
2148                           Specifying just the language part of a locale means all matching
2149                           locales will be included.
2150     ],
2153 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2154 libo_FUZZ_ARG_WITH(krb5,
2155     AS_HELP_STRING([--with-krb5],
2156         [Enable MIT Kerberos 5 support in modules that support it.
2157          By default automatically enabled on platforms
2158          where a good system Kerberos 5 is available.]),
2161 libo_FUZZ_ARG_WITH(gssapi,
2162     AS_HELP_STRING([--with-gssapi],
2163         [Enable GSSAPI support in modules that support it.
2164          By default automatically enabled on platforms
2165          where a good system GSSAPI is available.]),
2168 AC_ARG_WITH(iwyu,
2169     AS_HELP_STRING([--with-iwyu],
2170         [Use given IWYU binary path to check unneeded includes instead of building.
2171          Use only if you are hacking on it.]),
2174 libo_FUZZ_ARG_WITH(lxml,
2175     AS_HELP_STRING([--without-lxml],
2176         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2177          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2178          report widget classes and ids.]),
2181 dnl ===================================================================
2182 dnl Branding
2183 dnl ===================================================================
2185 AC_ARG_WITH(branding,
2186     AS_HELP_STRING([--with-branding=/path/to/images],
2187         [Use given path to retrieve branding images set.])
2188     [
2189                           Search for intro.png about.svg and flat_logo.svg.
2190                           If any is missing, default ones will be used instead.
2192                           Search also progress.conf for progress
2193                           settings on intro screen :
2195                           PROGRESSBARCOLOR="255,255,255" Set color of
2196                           progress bar. Comma separated RGB decimal values.
2197                           PROGRESSSIZE="407,6" Set size of progress bar.
2198                           Comma separated decimal values (width, height).
2199                           PROGRESSPOSITION="61,317" Set position of progress
2200                           bar from left,top. Comma separated decimal values.
2201                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2202                           bar frame. Comma separated RGB decimal values.
2203                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2204                           bar text. Comma separated RGB decimal values.
2205                           PROGRESSTEXTBASELINE="287" Set vertical position of
2206                           progress bar text from top. Decimal value.
2208                           Default values will be used if not found.
2209     ],
2213 AC_ARG_WITH(extra-buildid,
2214     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2215         [Show addition build identification in about dialog.]),
2219 AC_ARG_WITH(vendor,
2220     AS_HELP_STRING([--with-vendor="John the Builder"],
2221         [Set vendor of the build.]),
2224 AC_ARG_WITH(android-package-name,
2225     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2226         [Set Android package name of the build.]),
2229 AC_ARG_WITH(compat-oowrappers,
2230     AS_HELP_STRING([--with-compat-oowrappers],
2231         [Install oo* wrappers in parallel with
2232          lo* ones to keep backward compatibility.
2233          Has effect only with make distro-pack-install]),
2236 AC_ARG_WITH(os-version,
2237     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2238         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2241 AC_ARG_WITH(mingw-cross-compiler,
2242     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2243         [Specify the MinGW cross-compiler to use.
2244          When building on the ODK on Unix and building unowinreg.dll,
2245          specify the MinGW C++ cross-compiler.]),
2248 AC_ARG_WITH(idlc-cpp,
2249     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2250         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2253 AC_ARG_WITH(build-version,
2254     AS_HELP_STRING([--with-build-version="Built by Jim"],
2255         [Allows the builder to add a custom version tag that will appear in the
2256          Help/About box for QA purposes.]),
2257 with_build_version=$withval,
2260 AC_ARG_WITH(parallelism,
2261     AS_HELP_STRING([--with-parallelism],
2262         [Number of jobs to run simultaneously during build. Parallel builds can
2263         save a lot of time on multi-cpu machines. Defaults to the number of
2264         CPUs on the machine, unless you configure --enable-icecream - then to
2265         40.]),
2268 AC_ARG_WITH(all-tarballs,
2269     AS_HELP_STRING([--with-all-tarballs],
2270         [Download all external tarballs unconditionally]))
2272 AC_ARG_WITH(gdrive-client-id,
2273     AS_HELP_STRING([--with-gdrive-client-id],
2274         [Provides the client id of the application for OAuth2 authentication
2275         on Google Drive. If either this or --with-gdrive-client-secret is
2276         empty, the feature will be disabled]),
2279 AC_ARG_WITH(gdrive-client-secret,
2280     AS_HELP_STRING([--with-gdrive-client-secret],
2281         [Provides the client secret of the application for OAuth2
2282         authentication on Google Drive. If either this or
2283         --with-gdrive-client-id is empty, the feature will be disabled]),
2286 AC_ARG_WITH(alfresco-cloud-client-id,
2287     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2288         [Provides the client id of the application for OAuth2 authentication
2289         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2290         empty, the feature will be disabled]),
2293 AC_ARG_WITH(alfresco-cloud-client-secret,
2294     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2295         [Provides the client secret of the application for OAuth2
2296         authentication on Alfresco Cloud. If either this or
2297         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2300 AC_ARG_WITH(onedrive-client-id,
2301     AS_HELP_STRING([--with-onedrive-client-id],
2302         [Provides the client id of the application for OAuth2 authentication
2303         on OneDrive. If either this or --with-onedrive-client-secret is
2304         empty, the feature will be disabled]),
2307 AC_ARG_WITH(onedrive-client-secret,
2308     AS_HELP_STRING([--with-onedrive-client-secret],
2309         [Provides the client secret of the application for OAuth2
2310         authentication on OneDrive. If either this or
2311         --with-onedrive-client-id is empty, the feature will be disabled]),
2313 dnl ===================================================================
2314 dnl Do we want to use pre-build binary tarball for recompile
2315 dnl ===================================================================
2317 if test "$enable_library_bin_tar" = "yes" ; then
2318     USE_LIBRARY_BIN_TAR=TRUE
2319 else
2320     USE_LIBRARY_BIN_TAR=
2322 AC_SUBST(USE_LIBRARY_BIN_TAR)
2324 dnl ===================================================================
2325 dnl Test whether build target is Release Build
2326 dnl ===================================================================
2327 AC_MSG_CHECKING([whether build target is Release Build])
2328 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2329     AC_MSG_RESULT([no])
2330     ENABLE_RELEASE_BUILD=
2331 else
2332     AC_MSG_RESULT([yes])
2333     ENABLE_RELEASE_BUILD=TRUE
2335 AC_SUBST(ENABLE_RELEASE_BUILD)
2337 dnl ===================================================================
2338 dnl Test whether to sign Windows Build
2339 dnl ===================================================================
2340 AC_MSG_CHECKING([whether to sign windows build])
2341 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2342     AC_MSG_RESULT([yes])
2343     WINDOWS_BUILD_SIGNING="TRUE"
2344 else
2345     AC_MSG_RESULT([no])
2346     WINDOWS_BUILD_SIGNING="FALSE"
2348 AC_SUBST(WINDOWS_BUILD_SIGNING)
2350 dnl ===================================================================
2351 dnl MacOSX build and runtime environment options
2352 dnl ===================================================================
2354 AC_ARG_WITH(macosx-sdk,
2355     AS_HELP_STRING([--with-macosx-sdk=<version>],
2356         [Prefer a specific SDK for building.])
2357     [
2358                           If the requested SDK is not available, a search for the oldest one will be done.
2359                           With current Xcode versions, only the latest SDK is included, so this option is
2360                           not terribly useful. It works fine to build with a new SDK and run the result
2361                           on an older OS.
2363                           e. g.: --with-macosx-sdk=10.10
2365                           there are 3 options to control the MacOSX build:
2366                           --with-macosx-sdk (referred as 'sdk' below)
2367                           --with-macosx-version-min-required (referred as 'min' below)
2368                           --with-macosx-version-max-allowed (referred as 'max' below)
2370                           the connection between these value and the default they take is as follow:
2371                           ( ? means not specified on the command line, s means the SDK version found,
2372                           constraint: 8 <= x <= y <= z)
2374                           ==========================================
2375                            command line      || config result
2376                           ==========================================
2377                           min  | max  | sdk  || min   | max  | sdk  |
2378                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2379                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2380                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2381                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2382                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2383                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2384                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2385                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2388                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2389                           for a detailed technical explanation of these variables
2391                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2392     ],
2395 AC_ARG_WITH(macosx-version-min-required,
2396     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2397         [set the minimum OS version needed to run the built LibreOffice])
2398     [
2399                           e. g.: --with-macos-version-min-required=10.10
2400                           see --with-macosx-sdk for more info
2401     ],
2404 AC_ARG_WITH(macosx-version-max-allowed,
2405     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2406         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2407     [
2408                           e. g.: --with-macos-version-max-allowed=10.10
2409                           see --with-macosx-sdk for more info
2410     ],
2414 dnl ===================================================================
2415 dnl options for stuff used during cross-compilation build
2416 dnl Not quite superseded by --with-build-platform-configure-options.
2417 dnl TODO: check, if the "force" option is still needed anywhere.
2418 dnl ===================================================================
2420 AC_ARG_WITH(system-icu-for-build,
2421     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2422         [Use icu already on system for build tools (cross-compilation only).]))
2425 dnl ===================================================================
2426 dnl Check for incompatible options set by fuzzing, and reset those
2427 dnl automatically to working combinations
2428 dnl ===================================================================
2430 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2431         "$enable_dbus" != "$enable_avahi"; then
2432     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2433     enable_avahi=$enable_dbus
2436 add_lopath_after ()
2438     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2439         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2440     fi
2443 add_lopath_before ()
2445     local IFS=${P_SEP}
2446     local path_cleanup
2447     local dir
2448     for dir in $LO_PATH ; do
2449         if test "$dir" != "$1" ; then
2450             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2451         fi
2452     done
2453     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2456 dnl ===================================================================
2457 dnl check for required programs (grep, awk, sed, bash)
2458 dnl ===================================================================
2460 pathmunge ()
2462     if test -n "$1"; then
2463         if test "$build_os" = "cygwin"; then
2464             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2465                 PathFormat "$1"
2466                 new_path=`cygpath -sm "$formatted_path"`
2467             else
2468                 PathFormat "$1"
2469                 new_path=`cygpath -u "$formatted_path"`
2470             fi
2471         else
2472             new_path="$1"
2473         fi
2474         if test "$2" = "after"; then
2475             add_lopath_after "$new_path"
2476         else
2477             add_lopath_before "$new_path"
2478         fi
2479         unset new_path
2480     fi
2483 AC_PROG_AWK
2484 AC_PATH_PROG( AWK, $AWK)
2485 if test -z "$AWK"; then
2486     AC_MSG_ERROR([install awk to run this script])
2489 AC_PATH_PROG(BASH, bash)
2490 if test -z "$BASH"; then
2491     AC_MSG_ERROR([bash not found in \$PATH])
2493 AC_SUBST(BASH)
2495 AC_MSG_CHECKING([for GNU or BSD tar])
2496 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2497     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2498     if test $? -eq 0;  then
2499         GNUTAR=$a
2500         break
2501     fi
2502 done
2503 AC_MSG_RESULT($GNUTAR)
2504 if test -z "$GNUTAR"; then
2505     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2507 AC_SUBST(GNUTAR)
2509 AC_MSG_CHECKING([for tar's option to strip components])
2510 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2511 if test $? -eq 0; then
2512     STRIP_COMPONENTS="--strip-components"
2513 else
2514     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2515     if test $? -eq 0; then
2516         STRIP_COMPONENTS="--strip-path"
2517     else
2518         STRIP_COMPONENTS="unsupported"
2519     fi
2521 AC_MSG_RESULT($STRIP_COMPONENTS)
2522 if test x$STRIP_COMPONENTS = xunsupported; then
2523     AC_MSG_ERROR([you need a tar that is able to strip components.])
2525 AC_SUBST(STRIP_COMPONENTS)
2527 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2528 dnl desktop OSes from "mobile" ones.
2530 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2531 dnl In other words, that when building for an OS that is not a
2532 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2534 dnl Note the direction of the implication; there is no assumption that
2535 dnl cross-compiling would imply a non-desktop OS.
2537 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2538     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2539     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2540     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2543 # Whether to build "avmedia" functionality or not.
2545 if test -z "$enable_avmedia"; then
2546     enable_avmedia=yes
2549 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2550 if test "$enable_avmedia" = yes; then
2551     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2552 else
2553     USE_AVMEDIA_DUMMY='TRUE'
2555 AC_SUBST(USE_AVMEDIA_DUMMY)
2557 # Decide whether to build database connectivity stuff (including
2558 # Base) or not. We probably don't want to on non-desktop OSes.
2559 if test -z "$enable_database_connectivity"; then
2560     # --disable-database-connectivity is unfinished work in progress
2561     # and the iOS test app doesn't link if we actually try to use it.
2562     # if test $_os != iOS -a $_os != Android; then
2563     if test $_os != iOS; then
2564         enable_database_connectivity=yes
2565     fi
2568 if test "$enable_database_connectivity" = yes; then
2569     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2570     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2573 if test -z "$enable_extensions"; then
2574     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2575     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2576         enable_extensions=yes
2577     fi
2580 if test "$enable_extensions" = yes; then
2581     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2582     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2585 if test -z "$enable_scripting"; then
2586     # Disable scripting for iOS unless specifically overridden
2587     # with --enable-scripting.
2588     if test $_os != iOS; then
2589         enable_scripting=yes
2590     fi
2593 DISABLE_SCRIPTING=''
2594 if test "$enable_scripting" = yes; then
2595     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2596     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2597 else
2598     DISABLE_SCRIPTING='TRUE'
2599     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2602 if test $_os = iOS -o $_os = Android; then
2603     # Disable dynamic_loading always for iOS and Android
2604     enable_dynamic_loading=no
2605 elif test -z "$enable_dynamic_loading"; then
2606     # Otherwise enable it unless specifically disabled
2607     enable_dynamic_loading=yes
2610 DISABLE_DYNLOADING=''
2611 if test "$enable_dynamic_loading" = yes; then
2612     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2613 else
2614     DISABLE_DYNLOADING='TRUE'
2616 AC_SUBST(DISABLE_DYNLOADING)
2618 # remember SYSBASE value
2619 AC_SUBST(SYSBASE)
2621 dnl ===================================================================
2622 dnl  Sort out various gallery compilation options
2623 dnl ===================================================================
2624 AC_MSG_CHECKING([how to build and package galleries])
2625 if test -n "${with_galleries}"; then
2626     if test "$with_galleries" = "build"; then
2627         WITH_GALLERY_BUILD=TRUE
2628         AC_MSG_RESULT([build from source images internally])
2629     elif test "$with_galleries" = "no"; then
2630         WITH_GALLERY_BUILD=
2631         AC_MSG_RESULT([disable non-internal gallery build])
2632     else
2633         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2634     fi
2635 else
2636     if test $_os != iOS -a $_os != Android; then
2637         WITH_GALLERY_BUILD=TRUE
2638         AC_MSG_RESULT([internal src images for desktop])
2639     else
2640         WITH_GALLERY_BUILD=
2641         AC_MSG_RESULT([disable src image build])
2642     fi
2644 AC_SUBST(WITH_GALLERY_BUILD)
2646 dnl ===================================================================
2647 dnl  Checks if ccache is available
2648 dnl ===================================================================
2649 CCACHE_DEPEND_MODE=
2650 if test "$_os" = "WINNT"; then
2651     # on windows/VC build do not use ccache
2652     CCACHE=""
2653 elif test "$enable_ccache" = "no"; then
2654     CCACHE=""
2655 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2656     case "%$CC%$CXX%" in
2657     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2658     # assume that's good then
2659     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2660         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2661         CCACHE_DEPEND_MODE=1
2662         ;;
2663     *)
2664         AC_PATH_PROG([CCACHE],[ccache],[not found])
2665         if test "$CCACHE" = "not found"; then
2666             CCACHE=""
2667         else
2668             CCACHE_DEPEND_MODE=1
2669             # Need to check for ccache version: otherwise prevents
2670             # caching of the results (like "-x objective-c++" for Mac)
2671             if test $_os = Darwin -o $_os = iOS; then
2672                 # Check ccache version
2673                 AC_MSG_CHECKING([whether version of ccache is suitable])
2674                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2675                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2676                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2677                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2678                 else
2679                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2680                     CCACHE=""
2681                     CCACHE_DEPEND_MODE=
2682                 fi
2683             fi
2684         fi
2685         ;;
2686     esac
2687 else
2688     CCACHE=""
2690 if test "$enable_ccache" = "nodepend"; then
2691     CCACHE_DEPEND_MODE=""
2693 AC_SUBST(CCACHE_DEPEND_MODE)
2695 if test "$CCACHE" != ""; then
2696     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2697     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2698     if test "$ccache_size" = ""; then
2699         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2700         if test "$ccache_size" = ""; then
2701             ccache_size=0
2702         fi
2703         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2704         if test $ccache_size -lt 1024; then
2705             CCACHE=""
2706             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2707             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2708         else
2709             # warn that ccache may be too small for debug build
2710             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2711             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2712         fi
2713     else
2714         if test $ccache_size -lt 5; then
2715             #warn that ccache may be too small for debug build
2716             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2717             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2718         fi
2719     fi
2722 dnl ===================================================================
2723 dnl  Checks for C compiler,
2724 dnl  The check for the C++ compiler is later on.
2725 dnl ===================================================================
2726 if test "$_os" != "WINNT"; then
2727     GCC_HOME_SET="true"
2728     AC_MSG_CHECKING([gcc home])
2729     if test -z "$with_gcc_home"; then
2730         if test "$enable_icecream" = "yes"; then
2731             if test -d "/usr/lib/icecc/bin"; then
2732                 GCC_HOME="/usr/lib/icecc/"
2733             elif test -d "/usr/libexec/icecc/bin"; then
2734                 GCC_HOME="/usr/libexec/icecc/"
2735             elif test -d "/opt/icecream/bin"; then
2736                 GCC_HOME="/opt/icecream/"
2737             else
2738                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2740             fi
2741         else
2742             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2743             GCC_HOME_SET="false"
2744         fi
2745     else
2746         GCC_HOME="$with_gcc_home"
2747     fi
2748     AC_MSG_RESULT($GCC_HOME)
2749     AC_SUBST(GCC_HOME)
2751     if test "$GCC_HOME_SET" = "true"; then
2752         if test -z "$CC"; then
2753             CC="$GCC_HOME/bin/gcc"
2754             CC_BASE="gcc"
2755         fi
2756         if test -z "$CXX"; then
2757             CXX="$GCC_HOME/bin/g++"
2758             CXX_BASE="g++"
2759         fi
2760     fi
2763 COMPATH=`dirname "$CC"`
2764 if test "$COMPATH" = "."; then
2765     AC_PATH_PROGS(COMPATH, $CC)
2766     dnl double square bracket to get single because of M4 quote...
2767     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2769 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2771 dnl ===================================================================
2772 dnl Java support
2773 dnl ===================================================================
2774 AC_MSG_CHECKING([whether to build with Java support])
2775 if test "$with_java" != "no"; then
2776     if test "$DISABLE_SCRIPTING" = TRUE; then
2777         AC_MSG_RESULT([no, overridden by --disable-scripting])
2778         ENABLE_JAVA=""
2779         with_java=no
2780     else
2781         AC_MSG_RESULT([yes])
2782         ENABLE_JAVA="TRUE"
2783         AC_DEFINE(HAVE_FEATURE_JAVA)
2784     fi
2785 else
2786     AC_MSG_RESULT([no])
2787     ENABLE_JAVA=""
2790 AC_SUBST(ENABLE_JAVA)
2792 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2794 dnl ENABLE_JAVA="" indicate no Java support at all
2796 dnl ===================================================================
2797 dnl Check macOS SDK and compiler
2798 dnl ===================================================================
2800 if test $_os = Darwin; then
2802     # If no --with-macosx-sdk option is given, look for one
2804     # The intent is that for "most" Mac-based developers, a suitable
2805     # SDK will be found automatically without any configure options.
2807     # For developers with a current Xcode, the lowest-numbered SDK
2808     # higher than or equal to the minimum required should be found.
2810     AC_MSG_CHECKING([what macOS SDK to use])
2811     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13}; do
2812         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2813         if test -d "$MACOSX_SDK_PATH"; then
2814             with_macosx_sdk="${_macosx_sdk}"
2815             break
2816         else
2817             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2818             if test -d "$MACOSX_SDK_PATH"; then
2819                 with_macosx_sdk="${_macosx_sdk}"
2820                 break
2821             fi
2822         fi
2823     done
2824     if test ! -d "$MACOSX_SDK_PATH"; then
2825         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2826     fi
2828     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2830     case $with_macosx_sdk in
2831     10.13)
2832         MACOSX_SDK_VERSION=101300
2833         ;;
2834     10.14)
2835         MACOSX_SDK_VERSION=101400
2836         ;;
2837     10.15)
2838         MACOSX_SDK_VERSION=101500
2839         ;;
2840     *)
2841         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--15])
2842         ;;
2843     esac
2845     if test "$with_macosx_version_min_required" = "" ; then
2846         with_macosx_version_min_required="10.10";
2847     fi
2849     if test "$with_macosx_version_max_allowed" = "" ; then
2850         with_macosx_version_max_allowed="$with_macosx_sdk"
2851     fi
2853     # export this so that "xcrun" invocations later return matching values
2854     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2855     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2856     export DEVELOPER_DIR
2857     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2858     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2860     AC_MSG_CHECKING([whether Xcode is new enough])
2861     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2862     my_xcode_ver2=${my_xcode_ver1#Xcode }
2863     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2864     if test "$my_xcode_ver3" -ge 1103; then
2865         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2866     else
2867         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
2868     fi
2870     case "$with_macosx_version_min_required" in
2871     10.10)
2872         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2873         ;;
2874     10.11)
2875         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2876         ;;
2877     10.12)
2878         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2879         ;;
2880     10.13)
2881         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2882         ;;
2883     10.14)
2884         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2885         ;;
2886     10.15)
2887         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2888         ;;
2889     *)
2890         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2891         ;;
2892     esac
2894     LIBTOOL=/usr/bin/libtool
2895     INSTALL_NAME_TOOL=install_name_tool
2896     if test -z "$save_CC"; then
2897         stdlib=-stdlib=libc++
2898         if test "$ENABLE_LTO" = TRUE; then
2899             lto=-flto
2900         fi
2902         AC_MSG_CHECKING([what C compiler to use])
2903         CC="`xcrun -find clang`"
2904         CC_BASE=`first_arg_basename "$CC"`
2905         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2906         AC_MSG_RESULT([$CC])
2908         AC_MSG_CHECKING([what C++ compiler to use])
2909         CXX="`xcrun -find clang++`"
2910         CXX_BASE=`first_arg_basename "$CXX"`
2911         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2912         AC_MSG_RESULT([$CXX])
2914         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2915         AR=`xcrun -find ar`
2916         NM=`xcrun -find nm`
2917         STRIP=`xcrun -find strip`
2918         LIBTOOL=`xcrun -find libtool`
2919         RANLIB=`xcrun -find ranlib`
2920     fi
2922     case "$with_macosx_version_max_allowed" in
2923     10.10)
2924         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2925         ;;
2926     10.11)
2927         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2928         ;;
2929     10.12)
2930         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2931         ;;
2932     10.13)
2933         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2934         ;;
2935     10.14)
2936         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2937         ;;
2938     10.15)
2939         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2940         ;;
2941     *)
2942         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2943         ;;
2944     esac
2946     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2947     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2948         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])
2949     else
2950         AC_MSG_RESULT([ok])
2951     fi
2953     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2954     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2955         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2956     else
2957         AC_MSG_RESULT([ok])
2958     fi
2959     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2960     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2962     AC_MSG_CHECKING([whether to do code signing])
2964     if test "$enable_macosx_code_signing" = yes; then
2965         # By default use the first suitable certificate (?).
2967         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2968         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2969         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2970         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2971         # "Developer ID Application" one.
2973         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2974         if test -n "$identity"; then
2975             MACOSX_CODESIGNING_IDENTITY=$identity
2976             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2977             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2978         else
2979             AC_MSG_ERROR([cannot determine identity to use])
2980         fi
2981     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2982         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2983         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2984         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2985     else
2986         AC_MSG_RESULT([no])
2987     fi
2989     AC_MSG_CHECKING([whether to create a Mac App Store package])
2991     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2992         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2993     elif test "$enable_macosx_package_signing" = yes; then
2994         # By default use the first suitable certificate.
2995         # It should be a "3rd Party Mac Developer Installer" one
2997         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2998         if test -n "$identity"; then
2999             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3000             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3001             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3002         else
3003             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3004         fi
3005     elif test -n "$enable_macosx_package_signing"; then
3006         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3007         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3008         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3009     else
3010         AC_MSG_RESULT([no])
3011     fi
3013     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3014         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3015     fi
3017     AC_MSG_CHECKING([whether to sandbox the application])
3019     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3020         AC_MSG_ERROR([macOS sandboxing requires code signing])
3021     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3022         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3023     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3024         ENABLE_MACOSX_SANDBOX=TRUE
3025         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3026         AC_MSG_RESULT([yes])
3027     else
3028         AC_MSG_RESULT([no])
3029     fi
3031     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3032     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3033     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3035 AC_SUBST(MACOSX_SDK_PATH)
3036 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3037 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
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.4
3053     older_sdk_vers="13.2 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     2019)
3303         vsversion=16;;
3304     *)
3305         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3306     esac
3309 vs_versions_to_check()
3311     # Args: $1 (optional) : versions to check, in the order of preference
3312     # Return value: $vsversions
3314     unset vsversions
3316     if test -n "$1"; then
3317         map_vs_year_to_version "$1"
3318         vsversions=$vsversion
3319     else
3320         # We accept only 2019
3321         vsversions="16"
3322     fi
3325 win_get_env_from_vsvars32bat()
3327     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3328     # Also seems to be located in another directory under the same name: vsvars32.bat
3329     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3330     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3331     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3332     chmod +x $WRAPPERBATCHFILEPATH
3333     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3334     rm -f $WRAPPERBATCHFILEPATH
3335     printf '%s' "$_win_get_env_from_vsvars32bat"
3338 find_ucrt()
3340     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3341     if test -n "$regvalue"; then
3342         PathFormat "$regvalue"
3343         UCRTSDKDIR=$formatted_path
3344         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3345         UCRTVERSION=$regvalue
3346         # Rest if not exist
3347         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3348           UCRTSDKDIR=
3349         fi
3350     fi
3351     if test -z "$UCRTSDKDIR"; then
3352         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3353         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3354         if test -f "$ide_env_file"; then
3355             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3356             UCRTSDKDIR=$formatted_path
3357             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3358             dnl Hack needed at least by tml:
3359             if test "$UCRTVERSION" = 10.0.15063.0 \
3360                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3361                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3362             then
3363                 UCRTVERSION=10.0.14393.0
3364             fi
3365         else
3366           AC_MSG_ERROR([No UCRT found])
3367         fi
3368     fi
3371 find_msvc()
3373     # Find Visual C++ 2019
3374     # Args: $1 (optional) : The VS version year
3375     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3377     unset vctest vcnum vcnumwithdot vcbuildnumber
3379     vs_versions_to_check "$1"
3380     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3381     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3382     PathFormat "$vswhere"
3383     vswhere=$formatted_path
3384     for ver in $vsversions; do
3385         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3386         # Fall back to all MS products (this includes VC++ Build Tools)
3387         if ! test -n "$vswhereoutput"; then
3388             AC_MSG_CHECKING([VC++ Build Tools and similar])
3389             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3390         fi
3391         if test -n "$vswhereoutput"; then
3392             PathFormat "$vswhereoutput"
3393             vctest=$formatted_path
3394             break
3395         fi
3396     done
3398     if test -n "$vctest"; then
3399         vcnumwithdot="$ver.0"
3400         case "$vcnumwithdot" in
3401         16.0)
3402             vcyear=2019
3403             vcnum=160
3404             ;;
3405         esac
3406         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3408     fi
3411 SOLARINC=
3412 MSBUILD_PATH=
3413 DEVENV=
3414 if test "$_os" = "WINNT"; then
3415     AC_MSG_CHECKING([Visual C++])
3416     find_msvc "$with_visual_studio"
3417     if test -z "$vctest"; then
3418         if test -n "$with_visual_studio"; then
3419             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3420         else
3421             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3422         fi
3423     fi
3425     if test "$BITNESS_OVERRIDE" = ""; then
3426         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3427             VC_PRODUCT_DIR=$vctest/VC
3428         else
3429             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3430         fi
3431     else
3432         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3433             VC_PRODUCT_DIR=$vctest/VC
3434         else
3435             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3436         fi
3437     fi
3438     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3440     AC_MSG_CHECKING([for short pathname of VC product directory])
3441     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3442     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3444     UCRTSDKDIR=
3445     UCRTVERSION=
3447     AC_MSG_CHECKING([for UCRT location])
3448     find_ucrt
3449     # find_ucrt errors out if it doesn't find it
3450     AC_MSG_RESULT([found])
3451     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3452     ucrtincpath_formatted=$formatted_path
3453     # SOLARINC is used for external modules and must be set too.
3454     # And no, it's not sufficient to set SOLARINC only, as configure
3455     # itself doesn't honour it.
3456     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3457     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3458     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3459     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3461     AC_SUBST(UCRTSDKDIR)
3462     AC_SUBST(UCRTVERSION)
3464     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3465     # Find the proper version of MSBuild.exe to use based on the VS version
3466     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3467     if test -n "$regvalue" ; then
3468         AC_MSG_RESULT([found: $regvalue])
3469         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3470     else
3471         if test "$vcnumwithdot" = "16.0"; then
3472             if test "$BITNESS_OVERRIDE" = ""; then
3473                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3474             else
3475                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3476             fi
3477         else
3478             if test "$BITNESS_OVERRIDE" = ""; then
3479                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3480             else
3481                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3482             fi
3483         fi
3484         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3485         AC_MSG_RESULT([$regvalue])
3486     fi
3488     # Find the version of devenv.exe
3489     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3490     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3491     if test ! -e "$DEVENV"; then
3492         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3493     fi
3495     dnl ===========================================================
3496     dnl  Check for the corresponding mspdb*.dll
3497     dnl ===========================================================
3499     VC_HOST_DIR=
3500     MSPDB_PATH=
3501     CL_PATH=
3503     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3504         VC_HOST_DIR="HostX64"
3505         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3506     else
3507         VC_HOST_DIR="HostX86"
3508         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3509     fi
3511     if test "$BITNESS_OVERRIDE" = ""; then
3512         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3513     else
3514         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3515     fi
3517     # MSVC 15.0 has libraries from 14.0?
3518     mspdbnum="140"
3520     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3521         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3522     fi
3524     dnl The path needs to be added before cl is called
3525     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3526     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3528     AC_MSG_CHECKING([cl.exe])
3530     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3531     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3532     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3533     # is not enough?
3535     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3536     dnl needed when building CLR code:
3537     if test -z "$MSVC_CXX"; then
3538         if test -f "$CL_PATH/cl.exe"; then
3539             MSVC_CXX="$CL_PATH/cl.exe"
3540         fi
3542         # This gives us a posix path with 8.3 filename restrictions
3543         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3544     fi
3546     if test -z "$CC"; then
3547         CC=$MSVC_CXX
3548         CC_BASE=`first_arg_basename "$CC"`
3549     fi
3550     if test "$BITNESS_OVERRIDE" = ""; then
3551         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3552         MSVC_CXX="$MSVC_CXX -arch:SSE"
3553     fi
3554     if test -z "$CXX"; then
3555         CXX=$MSVC_CXX
3556         CXX_BASE=`first_arg_basename "$CXX"`
3557     fi
3559     if test -n "$CC"; then
3560         # Remove /cl.exe from CC case insensitive
3561         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3562         if test "$BITNESS_OVERRIDE" = ""; then
3563            COMPATH="$VC_PRODUCT_DIR"
3564         else
3565             if test -n "$VC_PRODUCT_DIR"; then
3566                 COMPATH=$VC_PRODUCT_DIR
3567             fi
3568         fi
3569         if test "$BITNESS_OVERRIDE" = ""; then
3570             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3571             CC="$CC -arch:SSE"
3572         fi
3574         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3576         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3578         PathFormat "$COMPATH"
3579         COMPATH=`win_short_path_for_make "$formatted_path"`
3581         VCVER=$vcnum
3583         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3584         # are always "better", we list them in reverse chronological order.
3586         case "$vcnum" in
3587         160)
3588             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3589             ;;
3590         esac
3592         # The expectation is that --with-windows-sdk should not need to be used
3593         if test -n "$with_windows_sdk"; then
3594             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3595             *" "$with_windows_sdk" "*)
3596                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3597                 ;;
3598             *)
3599                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3600                 ;;
3601             esac
3602         fi
3604         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3605         ac_objext=obj
3606         ac_exeext=exe
3608     else
3609         AC_MSG_ERROR([Visual C++ not found after all, huh])
3610     fi
3612     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
3613     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3614         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3615         // between Visual Studio versions and _MSC_VER:
3616         #if _MSC_VER < 1924
3617         #error
3618         #endif
3619     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3621     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3622     # version of the Explorer extension (and maybe other small
3623     # bits, too) needed when installing a 32-bit LibreOffice on a
3624     # 64-bit OS. The 64-bit Explorer extension is a feature that
3625     # has been present since long in OOo. Don't confuse it with
3626     # building LibreOffice itself as 64-bit code.
3628     BUILD_X64=
3629     CXX_X64_BINARY=
3631     if test "$BITNESS_OVERRIDE" = ""; then
3632         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3633         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3634              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3635             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3636                 BUILD_X64=TRUE
3637                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3638             fi
3639         fi
3640         if test "$BUILD_X64" = TRUE; then
3641             AC_MSG_RESULT([found])
3642         else
3643             AC_MSG_RESULT([not found])
3644             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3645         fi
3646     else
3647         CXX_X64_BINARY=$CXX
3648     fi
3649     AC_SUBST(BUILD_X64)
3651     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3652     AC_SUBST(CXX_X64_BINARY)
3654     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3655     # needed to support TWAIN scan on both 32- and 64-bit systems
3657     BUILD_X86=
3659     if test "$BITNESS_OVERRIDE" = "64"; then
3660         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3661         if test -n "$CXX_X86_BINARY"; then
3662             BUILD_X86=TRUE
3663             AC_MSG_RESULT([preset])
3664         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3665             BUILD_X86=TRUE
3666             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3667             CXX_X86_BINARY+=" /arch:SSE"
3668             AC_MSG_RESULT([found])
3669         else
3670             CXX_X86_BINARY=
3671             AC_MSG_RESULT([not found])
3672             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3673         fi
3674     else
3675         BUILD_X86=TRUE
3676         CXX_X86_BINARY=$MSVC_CXX
3677     fi
3678     AC_SUBST(BUILD_X86)
3679     AC_SUBST(CXX_X86_BINARY)
3681 AC_SUBST(VCVER)
3682 AC_SUBST(DEVENV)
3683 AC_SUBST(MSVC_CXX)
3686 # unowinreg.dll
3688 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3689 AC_SUBST(UNOWINREG_DLL)
3691 COM_IS_CLANG=
3692 AC_MSG_CHECKING([whether the compiler is actually Clang])
3693 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3694     #ifndef __clang__
3695     you lose
3696     #endif
3697     int foo=42;
3698     ]])],
3699     [AC_MSG_RESULT([yes])
3700      COM_IS_CLANG=TRUE],
3701     [AC_MSG_RESULT([no])])
3702 AC_SUBST(COM_IS_CLANG)
3704 CC_PLAIN=$CC
3705 CLANGVER=
3706 if test "$COM_IS_CLANG" = TRUE; then
3707     AC_MSG_CHECKING([whether Clang is new enough])
3708     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3709         #if !defined __apple_build_version__
3710         #error
3711         #endif
3712         ]])],
3713         [my_apple_clang=yes],[my_apple_clang=])
3714     if test "$my_apple_clang" = yes; then
3715         AC_MSG_RESULT([assumed yes (Apple Clang)])
3716     else
3717         if test "$_os" = WINNT; then
3718             dnl In which case, assume clang-cl:
3719             my_args="/EP /TC"
3720             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3721             dnl clang-cl:
3722             CC_PLAIN=
3723             for i in $CC; do
3724                 case $i in
3725                 -FIIntrin.h)
3726                     ;;
3727                 *)
3728                     CC_PLAIN="$CC_PLAIN $i"
3729                     ;;
3730                 esac
3731             done
3732         else
3733             my_args="-E -P"
3734         fi
3735         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3736         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3737         CLANGVER=`echo $clang_version \
3738             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3739         if test "$CLANGVER" -ge 50002; then
3740             AC_MSG_RESULT([yes ($clang_version)])
3741         else
3742             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3743         fi
3744         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3745         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3746     fi
3749 SHOWINCLUDES_PREFIX=
3750 if test "$_os" = WINNT; then
3751     dnl We need to guess the prefix of the -showIncludes output, it can be
3752     dnl localized
3753     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3754     echo "#include <stdlib.h>" > conftest.c
3755     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3756         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3757     rm -f conftest.c conftest.obj
3758     if test -z "$SHOWINCLUDES_PREFIX"; then
3759         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3760     else
3761         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3762     fi
3764 AC_SUBST(SHOWINCLUDES_PREFIX)
3767 # prefix C with ccache if needed
3769 if test "$CCACHE" != ""; then
3770     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3772     AC_LANG_PUSH([C])
3773     save_CFLAGS=$CFLAGS
3774     CFLAGS="$CFLAGS --ccache-skip -O2"
3775     dnl an empty program will do, we're checking the compiler flags
3776     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3777                       [use_ccache=yes], [use_ccache=no])
3778     if test $use_ccache = yes; then
3779         AC_MSG_RESULT([yes])
3780     else
3781         CC="$CCACHE $CC"
3782         CC_BASE="ccache $CC_BASE"
3783         AC_MSG_RESULT([no])
3784     fi
3785     CFLAGS=$save_CFLAGS
3786     AC_LANG_POP([C])
3789 # ===================================================================
3790 # check various GCC options that Clang does not support now but maybe
3791 # will somewhen in the future, check them even for GCC, so that the
3792 # flags are set
3793 # ===================================================================
3795 HAVE_GCC_GGDB2=
3796 if test "$GCC" = "yes"; then
3797     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3798     save_CFLAGS=$CFLAGS
3799     CFLAGS="$CFLAGS -Werror -ggdb2"
3800     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3801     CFLAGS=$save_CFLAGS
3802     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3803         AC_MSG_RESULT([yes])
3804     else
3805         AC_MSG_RESULT([no])
3806     fi
3808     if test "$host_cpu" = "m68k"; then
3809         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3810         save_CFLAGS=$CFLAGS
3811         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3812         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3813         CFLAGS=$save_CFLAGS
3814         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3815             AC_MSG_RESULT([yes])
3816         else
3817             AC_MSG_ERROR([no])
3818         fi
3819     fi
3821 AC_SUBST(HAVE_GCC_GGDB2)
3823 dnl ===================================================================
3824 dnl  Test the gcc version
3825 dnl ===================================================================
3826 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3827     AC_MSG_CHECKING([the GCC version])
3828     _gcc_version=`$CC -dumpversion`
3829     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3830         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3831     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3833     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3835     if test "$gcc_full_version" -lt 70000; then
3836         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3837     fi
3838 else
3839     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3840     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3841     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3842     # (which reports itself as GCC 4.2.1).
3843     GCC_VERSION=
3845 AC_SUBST(GCC_VERSION)
3847 dnl Set the ENABLE_DBGUTIL variable
3848 dnl ===================================================================
3849 AC_MSG_CHECKING([whether to build with additional debug utilities])
3850 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3851     ENABLE_DBGUTIL="TRUE"
3852     # this is an extra var so it can have different default on different MSVC
3853     # versions (in case there are version specific problems with it)
3854     MSVC_USE_DEBUG_RUNTIME="TRUE"
3856     AC_MSG_RESULT([yes])
3857     # cppunit and graphite expose STL in public headers
3858     if test "$with_system_cppunit" = "yes"; then
3859         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3860     else
3861         with_system_cppunit=no
3862     fi
3863     if test "$with_system_graphite" = "yes"; then
3864         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3865     else
3866         with_system_graphite=no
3867     fi
3868     if test "$with_system_orcus" = "yes"; then
3869         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3870     else
3871         with_system_orcus=no
3872     fi
3873     if test "$with_system_libcmis" = "yes"; then
3874         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3875     else
3876         with_system_libcmis=no
3877     fi
3878     if test "$with_system_hunspell" = "yes"; then
3879         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3880     else
3881         with_system_hunspell=no
3882     fi
3883     if test "$with_system_gpgmepp" = "yes"; then
3884         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3885     else
3886         with_system_gpgmepp=no
3887     fi
3888     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3889     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3890     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3891     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3892     # of those two is using the system variant:
3893     if test "$with_system_libnumbertext" = "yes"; then
3894         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3895     else
3896         with_system_libnumbertext=no
3897     fi
3898     if test "$with_system_libwps" = "yes"; then
3899         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3900     else
3901         with_system_libwps=no
3902     fi
3903 else
3904     ENABLE_DBGUTIL=""
3905     MSVC_USE_DEBUG_RUNTIME=""
3906     AC_MSG_RESULT([no])
3908 AC_SUBST(ENABLE_DBGUTIL)
3909 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3911 dnl Set the ENABLE_DEBUG variable.
3912 dnl ===================================================================
3913 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3914     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3916 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3917     if test -z "$libo_fuzzed_enable_debug"; then
3918         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3919     else
3920         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3921         enable_debug=yes
3922     fi
3925 AC_MSG_CHECKING([whether to do a debug build])
3926 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3927     ENABLE_DEBUG="TRUE"
3928     if test -n "$ENABLE_DBGUTIL" ; then
3929         AC_MSG_RESULT([yes (dbgutil)])
3930     else
3931         AC_MSG_RESULT([yes])
3932     fi
3933 else
3934     ENABLE_DEBUG=""
3935     AC_MSG_RESULT([no])
3937 AC_SUBST(ENABLE_DEBUG)
3939 dnl ===================================================================
3940 dnl Select the linker to use (gold/lld/ld.bfd).
3941 dnl This is done only after compiler checks (need to know if Clang is
3942 dnl used, for different defaults) and after checking if a debug build
3943 dnl is wanted (non-debug builds get the default linker if not explicitly
3944 dnl specified otherwise).
3945 dnl All checks for linker features/options should come after this.
3946 dnl ===================================================================
3947 check_use_ld()
3949     use_ld=$1
3950     use_ld_fail_if_error=$2
3951     use_ld_ok=
3952     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3953     use_ld_ldflags_save="$LDFLAGS"
3954     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3955     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3956 #include <stdio.h>
3957         ],[
3958 printf ("hello world\n");
3959         ])], USE_LD=$use_ld, [])
3960     if test -n "$USE_LD"; then
3961         AC_MSG_RESULT( yes )
3962         use_ld_ok=yes
3963     else
3964         if test -n "$use_ld_fail_if_error"; then
3965             AC_MSG_ERROR( no )
3966         else
3967             AC_MSG_RESULT( no )
3968         fi
3969     fi
3970     if test -n "$use_ld_ok"; then
3971         dnl keep the value of LDFLAGS
3972         return 0
3973     fi
3974     LDFLAGS="$use_ld_ldflags_save"
3975     return 1
3977 USE_LD=
3978 if test "$enable_ld" != "no"; then
3979     if test "$GCC" = "yes"; then
3980         if test -n "$enable_ld"; then
3981             check_use_ld "$enable_ld" fail_if_error
3982         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3983             dnl non-debug builds default to the default linker
3984             true
3985         elif test -n "$COM_IS_CLANG"; then
3986             check_use_ld lld
3987             if test $? -ne 0; then
3988                 check_use_ld gold
3989             fi
3990         else
3991             # For gcc first try gold, new versions also support lld.
3992             check_use_ld gold
3993             if test $? -ne 0; then
3994                 check_use_ld lld
3995             fi
3996         fi
3997         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
3998         rm conftest.out
3999         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4000         if test -z "$ld_used"; then
4001             ld_used="unknown"
4002         fi
4003         AC_MSG_CHECKING([for linker that is used])
4004         AC_MSG_RESULT([$ld_used])
4005         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4006             if echo "$ld_used" | grep -q "^GNU ld"; then
4007                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4008                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4009             fi
4010         fi
4011     else
4012         if test "$enable_ld" = "yes"; then
4013             AC_MSG_ERROR([--enable-ld not supported])
4014         fi
4015     fi
4017 AC_SUBST(USE_LD)
4019 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4020 if test "$GCC" = "yes"; then
4021     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4022     bsymbolic_functions_ldflags_save=$LDFLAGS
4023     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4024     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4025 #include <stdio.h>
4026         ],[
4027 printf ("hello world\n");
4028         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4029     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4030         AC_MSG_RESULT( found )
4031     else
4032         AC_MSG_RESULT( not found )
4033     fi
4034     LDFLAGS=$bsymbolic_functions_ldflags_save
4036 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4038 LD_GC_SECTIONS=
4039 if test "$GCC" = "yes"; then
4040     for flag in "--gc-sections" "-dead_strip"; do
4041         AC_MSG_CHECKING([for $flag linker support])
4042         ldflags_save=$LDFLAGS
4043         LDFLAGS="$LDFLAGS -Wl,$flag"
4044         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4045 #include <stdio.h>
4046             ],[
4047 printf ("hello world\n");
4048             ])],[
4049             LD_GC_SECTIONS="-Wl,$flag"
4050             AC_MSG_RESULT( found )
4051             ], [
4052             AC_MSG_RESULT( not found )
4053             ])
4054         LDFLAGS=$ldflags_save
4055         if test -n "$LD_GC_SECTIONS"; then
4056             break
4057         fi
4058     done
4060 AC_SUBST(LD_GC_SECTIONS)
4062 HAVE_GSPLIT_DWARF=
4063 if test "$enable_split_debug" != no; then
4064     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4065     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4066         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4067         save_CFLAGS=$CFLAGS
4068         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4069         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4070         CFLAGS=$save_CFLAGS
4071         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4072             AC_MSG_RESULT([yes])
4073         else
4074             if test "$enable_split_debug" = yes; then
4075                 AC_MSG_ERROR([no])
4076             else
4077                 AC_MSG_RESULT([no])
4078             fi
4079         fi
4080     fi
4081     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4082         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4083         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4084     fi
4086 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4088 ENABLE_GDB_INDEX=
4089 if test "$enable_gdb_index" != "no"; then
4090     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4091     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4092         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4093         save_CFLAGS=$CFLAGS
4094         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4095         have_ggnu_pubnames=
4096         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4097         if test "$have_ggnu_pubnames" != "TRUE"; then
4098             if test "$enable_gdb_index" = "yes"; then
4099                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4100             else
4101                 AC_MSG_RESULT( no )
4102             fi
4103         else
4104             AC_MSG_RESULT( yes )
4105             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4106             ldflags_save=$LDFLAGS
4107             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4108             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4109 #include <stdio.h>
4110                 ],[
4111 printf ("hello world\n");
4112                 ])], ENABLE_GDB_INDEX=TRUE, [])
4113             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4114                 AC_MSG_RESULT( yes )
4115             else
4116                 if test "$enable_gdb_index" = "yes"; then
4117                     AC_MSG_ERROR( no )
4118                 else
4119                     AC_MSG_RESULT( no )
4120                 fi
4121             fi
4122             LDFLAGS=$ldflags_save
4123         fi
4124         CFLAGS=$save_CFLAGS
4125         fi
4126     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4127         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4128         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4129     fi
4131 AC_SUBST(ENABLE_GDB_INDEX)
4133 if test "$enable_sal_log" = yes; then
4134     ENABLE_SAL_LOG=TRUE
4136 AC_SUBST(ENABLE_SAL_LOG)
4138 dnl Check for enable symbols option
4139 dnl ===================================================================
4140 AC_MSG_CHECKING([whether to generate debug information])
4141 if test -z "$enable_symbols"; then
4142     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4143         enable_symbols=yes
4144     else
4145         enable_symbols=no
4146     fi
4148 if test "$enable_symbols" = yes; then
4149     ENABLE_SYMBOLS_FOR=all
4150     AC_MSG_RESULT([yes])
4151 elif test "$enable_symbols" = no; then
4152     ENABLE_SYMBOLS_FOR=
4153     AC_MSG_RESULT([no])
4154 else
4155     # Selective debuginfo.
4156     ENABLE_SYMBOLS_FOR="$enable_symbols"
4157     AC_MSG_RESULT([for "$enable_symbols"])
4159 AC_SUBST(ENABLE_SYMBOLS_FOR)
4161 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4162     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4163     AC_MSG_CHECKING([whether enough memory is available for linking])
4164     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4165     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4166     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4167         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4168     else
4169         AC_MSG_RESULT([yes])
4170     fi
4173 ENABLE_OPTIMIZED=
4174 ENABLE_OPTIMIZED_DEBUG=
4175 AC_MSG_CHECKING([whether to compile with optimization flags])
4176 if test -z "$enable_optimized"; then
4177     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4178         enable_optimized=no
4179     else
4180         enable_optimized=yes
4181     fi
4183 if test "$enable_optimized" = yes; then
4184     ENABLE_OPTIMIZED=TRUE
4185     AC_MSG_RESULT([yes])
4186 elif test "$enable_optimized" = debug; then
4187     ENABLE_OPTIMIZED_DEBUG=TRUE
4188     AC_MSG_RESULT([yes (debug)])
4189     HAVE_GCC_OG=
4190     if test "$GCC" = "yes"; then
4191         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4192         save_CFLAGS=$CFLAGS
4193         CFLAGS="$CFLAGS -Werror -Og"
4194         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4195         CFLAGS=$save_CFLAGS
4196         if test "$HAVE_GCC_OG" = "TRUE"; then
4197             AC_MSG_RESULT([yes])
4198         else
4199             AC_MSG_RESULT([no])
4200         fi
4201     fi
4202     if test -z "$HAVE_GCC_OG"; then
4203         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4204     fi
4205 else
4206     AC_MSG_RESULT([no])
4208 AC_SUBST(ENABLE_OPTIMIZED)
4209 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4212 # determine CPUNAME, OS, ...
4213 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4215 case "$host_os" in
4217 aix*)
4218     COM=GCC
4219     CPUNAME=POWERPC
4220     USING_X11=TRUE
4221     OS=AIX
4222     RTL_OS=AIX
4223     RTL_ARCH=PowerPC
4224     PLATFORMID=aix_powerpc
4225     P_SEP=:
4226     ;;
4228 cygwin*)
4229     COM=MSC
4230     USING_X11=
4231     OS=WNT
4232     RTL_OS=Windows
4233     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4234         P_SEP=";"
4235     else
4236         P_SEP=:
4237     fi
4238     case "$host_cpu" in
4239     i*86|x86_64)
4240         if test "$BITNESS_OVERRIDE" = 64; then
4241             CPUNAME=X86_64
4242             RTL_ARCH=X86_64
4243             PLATFORMID=windows_x86_64
4244             WINDOWS_X64=1
4245             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4246         else
4247             CPUNAME=INTEL
4248             RTL_ARCH=x86
4249             PLATFORMID=windows_x86
4250         fi
4251         ;;
4252     *)
4253         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4254         ;;
4255     esac
4256     SCPDEFS="$SCPDEFS -D_MSC_VER"
4257     ;;
4259 darwin*)
4260     COM=GCC
4261     USING_X11=
4262     OS=MACOSX
4263     RTL_OS=MacOSX
4264     P_SEP=:
4266     case "$host_cpu" in
4267     arm)
4268         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4269         ;;
4270     arm64)
4271         OS=iOS
4272         RTL_OS=iOS
4273         if test "$enable_ios_simulator" = "yes"; then
4274             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4275         else
4276             CPUNAME=ARM64
4277             RTL_ARCH=ARM_EABI
4278             PLATFORMID=ios_arm64
4279         fi
4280         ;;
4281     i*86)
4282         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4283         ;;
4284     x86_64)
4285         if test "$enable_ios_simulator" = "yes"; then
4286             OS=iOS
4287         fi
4288         CPUNAME=X86_64
4289         RTL_ARCH=X86_64
4290         PLATFORMID=macosx_x86_64
4291         ;;
4292     *)
4293         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4294         ;;
4295     esac
4296     ;;
4298 dragonfly*)
4299     COM=GCC
4300     USING_X11=TRUE
4301     OS=DRAGONFLY
4302     RTL_OS=DragonFly
4303     P_SEP=:
4305     case "$host_cpu" in
4306     i*86)
4307         CPUNAME=INTEL
4308         RTL_ARCH=x86
4309         PLATFORMID=dragonfly_x86
4310         ;;
4311     x86_64)
4312         CPUNAME=X86_64
4313         RTL_ARCH=X86_64
4314         PLATFORMID=dragonfly_x86_64
4315         ;;
4316     *)
4317         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4318         ;;
4319     esac
4320     ;;
4322 freebsd*)
4323     COM=GCC
4324     USING_X11=TRUE
4325     RTL_OS=FreeBSD
4326     OS=FREEBSD
4327     P_SEP=:
4329     case "$host_cpu" in
4330     i*86)
4331         CPUNAME=INTEL
4332         RTL_ARCH=x86
4333         PLATFORMID=freebsd_x86
4334         ;;
4335     x86_64|amd64)
4336         CPUNAME=X86_64
4337         RTL_ARCH=X86_64
4338         PLATFORMID=freebsd_x86_64
4339         ;;
4340     *)
4341         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4342         ;;
4343     esac
4344     ;;
4346 haiku*)
4347     COM=GCC
4348     USING_X11=
4349     GUIBASE=haiku
4350     RTL_OS=Haiku
4351     OS=HAIKU
4352     P_SEP=:
4354     case "$host_cpu" in
4355     i*86)
4356         CPUNAME=INTEL
4357         RTL_ARCH=x86
4358         PLATFORMID=haiku_x86
4359         ;;
4360     x86_64|amd64)
4361         CPUNAME=X86_64
4362         RTL_ARCH=X86_64
4363         PLATFORMID=haiku_x86_64
4364         ;;
4365     *)
4366         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4367         ;;
4368     esac
4369     ;;
4371 kfreebsd*)
4372     COM=GCC
4373     USING_X11=TRUE
4374     OS=LINUX
4375     RTL_OS=kFreeBSD
4376     P_SEP=:
4378     case "$host_cpu" in
4380     i*86)
4381         CPUNAME=INTEL
4382         RTL_ARCH=x86
4383         PLATFORMID=kfreebsd_x86
4384         ;;
4385     x86_64)
4386         CPUNAME=X86_64
4387         RTL_ARCH=X86_64
4388         PLATFORMID=kfreebsd_x86_64
4389         ;;
4390     *)
4391         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4392         ;;
4393     esac
4394     ;;
4396 linux-gnu*)
4397     COM=GCC
4398     USING_X11=TRUE
4399     OS=LINUX
4400     RTL_OS=Linux
4401     P_SEP=:
4403     case "$host_cpu" in
4405     aarch64)
4406         CPUNAME=AARCH64
4407         PLATFORMID=linux_aarch64
4408         RTL_ARCH=AARCH64
4409         ;;
4410     alpha)
4411         CPUNAME=AXP
4412         RTL_ARCH=ALPHA
4413         PLATFORMID=linux_alpha
4414         ;;
4415     arm*)
4416         CPUNAME=ARM
4417         EPM_FLAGS="-a arm"
4418         RTL_ARCH=ARM_EABI
4419         PLATFORMID=linux_arm_eabi
4420         case "$host_cpu" in
4421         arm*-linux)
4422             RTL_ARCH=ARM_OABI
4423             PLATFORMID=linux_arm_oabi
4424             ;;
4425         esac
4426         ;;
4427     hppa)
4428         CPUNAME=HPPA
4429         RTL_ARCH=HPPA
4430         EPM_FLAGS="-a hppa"
4431         PLATFORMID=linux_hppa
4432         ;;
4433     i*86)
4434         CPUNAME=INTEL
4435         RTL_ARCH=x86
4436         PLATFORMID=linux_x86
4437         ;;
4438     ia64)
4439         CPUNAME=IA64
4440         RTL_ARCH=IA64
4441         PLATFORMID=linux_ia64
4442         ;;
4443     mips)
4444         CPUNAME=GODSON
4445         RTL_ARCH=MIPS_EB
4446         EPM_FLAGS="-a mips"
4447         PLATFORMID=linux_mips_eb
4448         ;;
4449     mips64)
4450         CPUNAME=GODSON64
4451         RTL_ARCH=MIPS64_EB
4452         EPM_FLAGS="-a mips64"
4453         PLATFORMID=linux_mips64_eb
4454         ;;
4455     mips64el)
4456         CPUNAME=GODSON64
4457         RTL_ARCH=MIPS64_EL
4458         EPM_FLAGS="-a mips64el"
4459         PLATFORMID=linux_mips64_el
4460         ;;
4461     mipsel)
4462         CPUNAME=GODSON
4463         RTL_ARCH=MIPS_EL
4464         EPM_FLAGS="-a mipsel"
4465         PLATFORMID=linux_mips_el
4466         ;;
4467     m68k)
4468         CPUNAME=M68K
4469         RTL_ARCH=M68K
4470         PLATFORMID=linux_m68k
4471         ;;
4472     powerpc)
4473         CPUNAME=POWERPC
4474         RTL_ARCH=PowerPC
4475         PLATFORMID=linux_powerpc
4476         ;;
4477     powerpc64)
4478         CPUNAME=POWERPC64
4479         RTL_ARCH=PowerPC_64
4480         PLATFORMID=linux_powerpc64
4481         ;;
4482     powerpc64le)
4483         CPUNAME=POWERPC64
4484         RTL_ARCH=PowerPC_64_LE
4485         PLATFORMID=linux_powerpc64_le
4486         ;;
4487     sparc)
4488         CPUNAME=SPARC
4489         RTL_ARCH=SPARC
4490         PLATFORMID=linux_sparc
4491         ;;
4492     sparc64)
4493         CPUNAME=SPARC64
4494         RTL_ARCH=SPARC64
4495         PLATFORMID=linux_sparc64
4496         ;;
4497     s390)
4498         CPUNAME=S390
4499         RTL_ARCH=S390
4500         PLATFORMID=linux_s390
4501         ;;
4502     s390x)
4503         CPUNAME=S390X
4504         RTL_ARCH=S390x
4505         PLATFORMID=linux_s390x
4506         ;;
4507     x86_64)
4508         CPUNAME=X86_64
4509         RTL_ARCH=X86_64
4510         PLATFORMID=linux_x86_64
4511         ;;
4512     *)
4513         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4514         ;;
4515     esac
4516     ;;
4518 linux-android*)
4519     COM=GCC
4520     USING_X11=
4521     OS=ANDROID
4522     RTL_OS=Android
4523     P_SEP=:
4525     case "$host_cpu" in
4527     arm|armel)
4528         CPUNAME=ARM
4529         RTL_ARCH=ARM_EABI
4530         PLATFORMID=android_arm_eabi
4531         ;;
4532     aarch64)
4533         CPUNAME=AARCH64
4534         RTL_ARCH=AARCH64
4535         PLATFORMID=android_aarch64
4536         ;;
4537     i*86)
4538         CPUNAME=INTEL
4539         RTL_ARCH=x86
4540         PLATFORMID=android_x86
4541         ;;
4542     x86_64)
4543         CPUNAME=X86_64
4544         RTL_ARCH=X86_64
4545         PLATFORMID=android_x86_64
4546         ;;
4547     *)
4548         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4549         ;;
4550     esac
4551     ;;
4553 *netbsd*)
4554     COM=GCC
4555     USING_X11=TRUE
4556     OS=NETBSD
4557     RTL_OS=NetBSD
4558     P_SEP=:
4560     case "$host_cpu" in
4561     i*86)
4562         CPUNAME=INTEL
4563         RTL_ARCH=x86
4564         PLATFORMID=netbsd_x86
4565         ;;
4566     powerpc)
4567         CPUNAME=POWERPC
4568         RTL_ARCH=PowerPC
4569         PLATFORMID=netbsd_powerpc
4570         ;;
4571     sparc)
4572         CPUNAME=SPARC
4573         RTL_ARCH=SPARC
4574         PLATFORMID=netbsd_sparc
4575         ;;
4576     x86_64)
4577         CPUNAME=X86_64
4578         RTL_ARCH=X86_64
4579         PLATFORMID=netbsd_x86_64
4580         ;;
4581     *)
4582         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4583         ;;
4584     esac
4585     ;;
4587 openbsd*)
4588     COM=GCC
4589     USING_X11=TRUE
4590     OS=OPENBSD
4591     RTL_OS=OpenBSD
4592     P_SEP=:
4594     case "$host_cpu" in
4595     i*86)
4596         CPUNAME=INTEL
4597         RTL_ARCH=x86
4598         PLATFORMID=openbsd_x86
4599         ;;
4600     x86_64)
4601         CPUNAME=X86_64
4602         RTL_ARCH=X86_64
4603         PLATFORMID=openbsd_x86_64
4604         ;;
4605     *)
4606         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4607         ;;
4608     esac
4609     SOLARINC="$SOLARINC -I/usr/local/include"
4610     ;;
4612 solaris*)
4613     COM=GCC
4614     USING_X11=TRUE
4615     OS=SOLARIS
4616     RTL_OS=Solaris
4617     P_SEP=:
4619     case "$host_cpu" in
4620     i*86)
4621         CPUNAME=INTEL
4622         RTL_ARCH=x86
4623         PLATFORMID=solaris_x86
4624         ;;
4625     sparc)
4626         CPUNAME=SPARC
4627         RTL_ARCH=SPARC
4628         PLATFORMID=solaris_sparc
4629         ;;
4630     sparc64)
4631         CPUNAME=SPARC64
4632         RTL_ARCH=SPARC64
4633         PLATFORMID=solaris_sparc64
4634         ;;
4635     *)
4636         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4637         ;;
4638     esac
4639     SOLARINC="$SOLARINC -I/usr/local/include"
4640     ;;
4643     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4644     ;;
4645 esac
4647 if test "$with_x" = "no"; then
4648     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4651 DISABLE_GUI=""
4652 if test "$enable_gui" = "no"; then
4653     if test "$USING_X11" != TRUE; then
4654         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4655     fi
4656     USING_X11=
4657     DISABLE_GUI=TRUE
4658     AC_DEFINE(HAVE_FEATURE_UI,0)
4659     test_cairo=yes
4661 AC_SUBST(DISABLE_GUI)
4663 WORKDIR="${BUILDDIR}/workdir"
4664 INSTDIR="${BUILDDIR}/instdir"
4665 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4666 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4667 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4668 AC_SUBST(COM)
4669 AC_SUBST(CPUNAME)
4670 AC_SUBST(RTL_OS)
4671 AC_SUBST(RTL_ARCH)
4672 AC_SUBST(EPM_FLAGS)
4673 AC_SUBST(USING_X11)
4674 AC_SUBST([INSTDIR])
4675 AC_SUBST([INSTROOT])
4676 AC_SUBST([INSTROOTBASE])
4677 AC_SUBST(OS)
4678 AC_SUBST(P_SEP)
4679 AC_SUBST(WORKDIR)
4680 AC_SUBST(PLATFORMID)
4681 AC_SUBST(WINDOWS_X64)
4682 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4684 dnl ===================================================================
4685 dnl Test which package format to use
4686 dnl ===================================================================
4687 AC_MSG_CHECKING([which package format to use])
4688 if test -n "$with_package_format" -a "$with_package_format" != no; then
4689     for i in $with_package_format; do
4690         case "$i" in
4691         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4692             ;;
4693         *)
4694             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4695 aix - AIX software distribution
4696 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4697 deb - Debian software distribution
4698 pkg - Solaris software distribution
4699 rpm - RedHat software distribution
4701 LibreOffice additionally supports:
4702 archive - .tar.gz or .zip
4703 dmg - macOS .dmg
4704 installed - installation tree
4705 msi - Windows .msi
4706         ])
4707             ;;
4708         esac
4709     done
4710     # fakeroot is needed to ensure correct file ownerships/permissions
4711     # inside deb packages and tar archives created on Linux and Solaris.
4712     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4713         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4714         if test "$FAKEROOT" = "no"; then
4715             AC_MSG_ERROR(
4716                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4717         fi
4718     fi
4719     PKGFORMAT="$with_package_format"
4720     AC_MSG_RESULT([$PKGFORMAT])
4721 else
4722     PKGFORMAT=
4723     AC_MSG_RESULT([none])
4725 AC_SUBST(PKGFORMAT)
4727 dnl ===================================================================
4728 dnl Set up a different compiler to produce tools to run on the build
4729 dnl machine when doing cross-compilation
4730 dnl ===================================================================
4732 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4733 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4734 if test "$cross_compiling" = "yes"; then
4735     AC_MSG_CHECKING([for BUILD platform configuration])
4736     echo
4737     rm -rf CONF-FOR-BUILD config_build.mk
4738     mkdir CONF-FOR-BUILD
4739     # Here must be listed all files needed when running the configure script. In particular, also
4740     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4741     # keep them in the same order as there.
4742     (cd $SRC_ROOT && tar cf - \
4743         config.guess \
4744         bin/get_config_variables \
4745         solenv/bin/getcompver.awk \
4746         solenv/inc/langlist.mk \
4747         download.lst \
4748         config_host.mk.in \
4749         config_host_lang.mk.in \
4750         Makefile.in \
4751         bin/bffvalidator.sh.in \
4752         bin/odfvalidator.sh.in \
4753         bin/officeotron.sh.in \
4754         instsetoo_native/util/openoffice.lst.in \
4755         config_host/*.in \
4756         sysui/desktop/macosx/Info.plist.in) \
4757     | (cd CONF-FOR-BUILD && tar xf -)
4758     cp configure CONF-FOR-BUILD
4759     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4760     (
4761     unset COM USING_X11 OS CPUNAME
4762     unset CC CXX SYSBASE CFLAGS
4763     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4764     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4765     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4766     if test -n "$CC_FOR_BUILD"; then
4767         export CC="$CC_FOR_BUILD"
4768         CC_BASE=`first_arg_basename "$CC"`
4769     fi
4770     if test -n "$CXX_FOR_BUILD"; then
4771         export CXX="$CXX_FOR_BUILD"
4772         CXX_BASE=`first_arg_basename "$CXX"`
4773     fi
4774     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4775     cd CONF-FOR-BUILD
4776     sub_conf_opts=""
4777     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4778     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4779     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4780     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4781     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4782     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4783     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4784     # Don't bother having configure look for stuff not needed for the build platform anyway
4785     ./configure \
4786         --disable-cups \
4787         --disable-gstreamer-1-0 \
4788         --disable-gtk3 \
4789         --disable-pdfimport \
4790         --disable-postgresql-sdbc \
4791         --enable-icecream="$enable_icecream" \
4792         --with-parallelism="$with_parallelism" \
4793         --without-doxygen \
4794         --without-java \
4795         $sub_conf_opts \
4796         --srcdir=$srcdir \
4797         2>&1 | sed -e 's/^/    /'
4798     test -f ./config_host.mk 2>/dev/null || exit
4799     cp config_host.mk ../config_build.mk
4800     cp config_host_lang.mk ../config_build_lang.mk
4801     mv config.log ../config.Build.log
4802     mkdir -p ../config_build
4803     mv config_host/*.h ../config_build
4804     . ./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
4806     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
4807         VV='$'$V
4808         VV=`eval "echo $VV"`
4809         if test -n "$VV"; then
4810             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4811             echo "$line" >>build-config
4812         fi
4813     done
4815     for V in INSTDIR INSTROOT WORKDIR; do
4816         VV='$'$V
4817         VV=`eval "echo $VV"`
4818         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4819         if test -n "$VV"; then
4820             line="${V}_FOR_BUILD='$VV'"
4821             echo "$line" >>build-config
4822         fi
4823     done
4825     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4826     echo "$line" >>build-config
4828     )
4829     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4830     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])
4831     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4832              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4834     eval `cat CONF-FOR-BUILD/build-config`
4836     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4838     rm -rf CONF-FOR-BUILD
4839 else
4840     OS_FOR_BUILD="$OS"
4841     CC_FOR_BUILD="$CC"
4842     CXX_FOR_BUILD="$CXX"
4843     INSTDIR_FOR_BUILD="$INSTDIR"
4844     INSTROOT_FOR_BUILD="$INSTROOT"
4845     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4846     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4847     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4848     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4849     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4850     WORKDIR_FOR_BUILD="$WORKDIR"
4852 AC_SUBST(OS_FOR_BUILD)
4853 AC_SUBST(INSTDIR_FOR_BUILD)
4854 AC_SUBST(INSTROOT_FOR_BUILD)
4855 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4856 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4857 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4858 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4859 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4860 AC_SUBST(WORKDIR_FOR_BUILD)
4862 dnl ===================================================================
4863 dnl Check for syslog header
4864 dnl ===================================================================
4865 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4867 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4868 dnl ===================================================================
4869 AC_MSG_CHECKING([whether to turn warnings to errors])
4870 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4871     ENABLE_WERROR="TRUE"
4872     AC_MSG_RESULT([yes])
4873 else
4874     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4875         ENABLE_WERROR="TRUE"
4876         AC_MSG_RESULT([yes])
4877     else
4878         AC_MSG_RESULT([no])
4879     fi
4881 AC_SUBST(ENABLE_WERROR)
4883 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4884 dnl ===================================================================
4885 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4886 if test -z "$enable_assert_always_abort"; then
4887    if test "$ENABLE_DEBUG" = TRUE; then
4888        enable_assert_always_abort=yes
4889    else
4890        enable_assert_always_abort=no
4891    fi
4893 if test "$enable_assert_always_abort" = "yes"; then
4894     ASSERT_ALWAYS_ABORT="TRUE"
4895     AC_MSG_RESULT([yes])
4896 else
4897     ASSERT_ALWAYS_ABORT="FALSE"
4898     AC_MSG_RESULT([no])
4900 AC_SUBST(ASSERT_ALWAYS_ABORT)
4902 # Determine whether to use ooenv for the instdir installation
4903 # ===================================================================
4904 if test $_os != "WINNT" -a $_os != "Darwin"; then
4905     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4906     if test "$enable_ooenv" = "no"; then
4907         AC_MSG_RESULT([no])
4908     else
4909         ENABLE_OOENV="TRUE"
4910         AC_MSG_RESULT([yes])
4911     fi
4913 AC_SUBST(ENABLE_OOENV)
4915 if test "$USING_X11" != TRUE; then
4916     # be sure to do not mess with unneeded stuff
4917     test_randr=no
4918     test_xrender=no
4919     test_cups=no
4920     test_dbus=no
4921     build_gstreamer_1_0=no
4922     test_kf5=no
4923     test_qt5=no
4924     test_gtk3_kde5=no
4925     enable_cairo_canvas=no
4928 if test "$OS" = "HAIKU"; then
4929     enable_cairo_canvas=yes
4930     test_kf5=yes
4933 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4934     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!])
4935     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!"
4936     enable_kf5=yes
4939 if test "$test_kf5" = "yes"; then
4940     test_qt5=yes
4943 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4944     if test "$enable_qt5" = "no"; then
4945         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4946     else
4947         enable_qt5=yes
4948     fi
4951 dnl ===================================================================
4952 dnl check for cups support
4953 dnl ===================================================================
4954 ENABLE_CUPS=""
4956 if test "$enable_cups" = "no"; then
4957     test_cups=no
4960 AC_MSG_CHECKING([whether to enable CUPS support])
4961 if test "$test_cups" = "yes"; then
4962     ENABLE_CUPS="TRUE"
4963     AC_MSG_RESULT([yes])
4965     AC_MSG_CHECKING([whether cups support is present])
4966     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4967     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4968     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4969         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4970     fi
4972 else
4973     AC_MSG_RESULT([no])
4976 AC_SUBST(ENABLE_CUPS)
4978 # fontconfig checks
4979 if test "$test_fontconfig" = "yes"; then
4980     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4981     SYSTEM_FONTCONFIG=TRUE
4982     FilterLibs "${FONTCONFIG_LIBS}"
4983     FONTCONFIG_LIBS="${filteredlibs}"
4985 AC_SUBST(FONTCONFIG_CFLAGS)
4986 AC_SUBST(FONTCONFIG_LIBS)
4987 AC_SUBST([SYSTEM_FONTCONFIG])
4989 dnl whether to find & fetch external tarballs?
4990 dnl ===================================================================
4991 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4992    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4993        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4994    else
4995        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4996    fi
4998 if test -z "$TARFILE_LOCATION"; then
4999     if test -d "$SRC_ROOT/src" ; then
5000         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5001         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5002     fi
5003     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5004 else
5005     AbsolutePath "$TARFILE_LOCATION"
5006     PathFormat "${absolute_path}"
5007     TARFILE_LOCATION="${formatted_path}"
5009 AC_SUBST(TARFILE_LOCATION)
5011 AC_MSG_CHECKING([whether we want to fetch tarballs])
5012 if test "$enable_fetch_external" != "no"; then
5013     if test "$with_all_tarballs" = "yes"; then
5014         AC_MSG_RESULT([yes, all of them])
5015         DO_FETCH_TARBALLS="ALL"
5016     else
5017         AC_MSG_RESULT([yes, if we use them])
5018         DO_FETCH_TARBALLS="TRUE"
5019     fi
5020 else
5021     AC_MSG_RESULT([no])
5022     DO_FETCH_TARBALLS=
5024 AC_SUBST(DO_FETCH_TARBALLS)
5026 AC_MSG_CHECKING([whether to build help])
5027 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5028     BUILD_TYPE="$BUILD_TYPE HELP"
5029     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5030     case "$with_help" in
5031     "html")
5032         ENABLE_HTMLHELP=TRUE
5033         SCPDEFS="$SCPDEFS -DWITH_HELP"
5034         AC_MSG_RESULT([HTML])
5035         ;;
5036     "online")
5037         ENABLE_HTMLHELP=TRUE
5038         HELP_ONLINE=TRUE
5039         AC_MSG_RESULT([HTML])
5040         ;;
5041     yes)
5042         SCPDEFS="$SCPDEFS -DWITH_HELP"
5043         AC_MSG_RESULT([yes])
5044         ;;
5045     *)
5046         AC_MSG_ERROR([Unknown --with-help=$with_help])
5047         ;;
5048     esac
5049 else
5050     AC_MSG_RESULT([no])
5052 AC_SUBST([ENABLE_HTMLHELP])
5053 AC_SUBST([HELP_ONLINE])
5055 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5056 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5057     BUILD_TYPE="$BUILD_TYPE HELP"
5058     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5059     case "$with_omindex" in
5060     "server")
5061         ENABLE_HTMLHELP=TRUE
5062         HELP_ONLINE=TRUE
5063         HELP_OMINDEX_PAGE=TRUE
5064         AC_MSG_RESULT([SERVER])
5065         ;;
5066     "noxap")
5067         ENABLE_HTMLHELP=TRUE
5068         HELP_ONLINE=TRUE
5069         HELP_OMINDEX_PAGE=FALSE
5070         AC_MSG_RESULT([NOXAP])
5071         ;;
5072     *)
5073         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5074         ;;
5075     esac
5076 else
5077     HELP_OMINDEX_PAGE=FALSE
5078     AC_MSG_RESULT([no])
5080 AC_SUBST([ENABLE_HTMLHELP])
5081 AC_SUBST([HELP_OMINDEX_PAGE])
5082 AC_SUBST([HELP_ONLINE])
5085 dnl Test whether to include MySpell dictionaries
5086 dnl ===================================================================
5087 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5088 if test "$with_myspell_dicts" = "yes"; then
5089     AC_MSG_RESULT([yes])
5090     WITH_MYSPELL_DICTS=TRUE
5091     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5092     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5093 else
5094     AC_MSG_RESULT([no])
5095     WITH_MYSPELL_DICTS=
5097 AC_SUBST(WITH_MYSPELL_DICTS)
5099 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5100 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5101     if test "$with_system_dicts" = yes; then
5102         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5103     fi
5104     with_system_dicts=no
5107 AC_MSG_CHECKING([whether to use dicts from external paths])
5108 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5109     AC_MSG_RESULT([yes])
5110     SYSTEM_DICTS=TRUE
5111     AC_MSG_CHECKING([for spelling dictionary directory])
5112     if test -n "$with_external_dict_dir"; then
5113         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5114     else
5115         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5116         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5117             DICT_SYSTEM_DIR=file:///usr/share/myspell
5118         fi
5119     fi
5120     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5121     AC_MSG_CHECKING([for hyphenation patterns directory])
5122     if test -n "$with_external_hyph_dir"; then
5123         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5124     else
5125         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5126     fi
5127     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5128     AC_MSG_CHECKING([for thesaurus directory])
5129     if test -n "$with_external_thes_dir"; then
5130         THES_SYSTEM_DIR=file://$with_external_thes_dir
5131     else
5132         THES_SYSTEM_DIR=file:///usr/share/mythes
5133     fi
5134     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5135 else
5136     AC_MSG_RESULT([no])
5137     SYSTEM_DICTS=
5139 AC_SUBST(SYSTEM_DICTS)
5140 AC_SUBST(DICT_SYSTEM_DIR)
5141 AC_SUBST(HYPH_SYSTEM_DIR)
5142 AC_SUBST(THES_SYSTEM_DIR)
5144 dnl ===================================================================
5145 dnl Precompiled headers.
5146 ENABLE_PCH=""
5147 AC_MSG_CHECKING([whether to enable pch feature])
5148 if test -z "$enable_pch"; then
5149     if test "$_os" = "WINNT"; then
5150         # Enabled by default on Windows.
5151         enable_pch=yes
5152     else
5153         enable_pch=no
5154     fi
5156 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5157     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5159 if test "$enable_pch" = "system"; then
5160     ENABLE_PCH="1"
5161     AC_MSG_RESULT([yes (system headers)])
5162 elif test "$enable_pch" = "base"; then
5163     ENABLE_PCH="2"
5164     AC_MSG_RESULT([yes (system and base headers)])
5165 elif test "$enable_pch" = "normal"; then
5166     ENABLE_PCH="3"
5167     AC_MSG_RESULT([yes (normal)])
5168 elif test "$enable_pch" = "full"; then
5169     ENABLE_PCH="4"
5170     AC_MSG_RESULT([yes (full)])
5171 elif test "$enable_pch" = "yes"; then
5172     # Pick a suitable default.
5173     if test "$GCC" = "yes"; then
5174         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5175         # while making the PCHs larger and rebuilds more likely.
5176         ENABLE_PCH="2"
5177         AC_MSG_RESULT([yes (system and base headers)])
5178     else
5179         # With MSVC the highest level makes a significant difference,
5180         # and it was the default when there used to be no PCH levels.
5181         ENABLE_PCH="4"
5182         AC_MSG_RESULT([yes (full)])
5183     fi
5184 elif test "$enable_pch" = "no"; then
5185     AC_MSG_RESULT([no])
5186 else
5187     AC_MSG_ERROR([Unknown value for --enable-pch])
5189 AC_SUBST(ENABLE_PCH)
5190 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5191 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5192     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5193     if test "$CCACHE_BIN" != "not found"; then
5194         AC_MSG_CHECKING([ccache version])
5195         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5196         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5197         AC_MSG_RESULT([$CCACHE_VERSION])
5198         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5199         if test "$CCACHE_NUMVER" -gt "030701"; then
5200             AC_MSG_RESULT([yes])
5201         else
5202             AC_MSG_RESULT([no (not newer than 3.7.1)])
5203             CCACHE_DEPEND_MODE=
5204         fi
5205     fi
5208 BUILDING_PCH_WITH_OBJ=
5209 if test -n "$ENABLE_PCH"; then
5210     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5211     save_CFLAGS=$CFLAGS
5212     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5213     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5214     CFLAGS=$save_CFLAGS
5215     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5216         AC_MSG_RESULT(yes)
5217     else
5218         AC_MSG_RESULT(no)
5219     fi
5221 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5223 PCH_MODULES_CODEGEN=
5224 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5225     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen])
5226     save_CFLAGS=$CFLAGS
5227     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen"
5228     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[])
5229     CFLAGS=$save_CFLAGS
5230     if test -n "$PCH_MODULES_CODEGEN"; then
5231         AC_MSG_RESULT(yes)
5232     else
5233         AC_MSG_RESULT(no)
5234     fi
5235     CFLAGS=$save_CFLAGS
5237 AC_SUBST(PCH_MODULES_CODEGEN)
5238 PCH_MODULES_DEBUGINFO=
5239 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5240     AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo])
5241     save_CFLAGS=$CFLAGS
5242     CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo"
5243     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[])
5244     CFLAGS=$save_CFLAGS
5245     if test -n "$PCH_MODULES_DEBUGINFO"; then
5246         AC_MSG_RESULT(yes)
5247     else
5248         AC_MSG_RESULT(no)
5249     fi
5250     CFLAGS=$save_CFLAGS
5252 AC_SUBST(PCH_MODULES_DEBUGINFO)
5254 TAB=`printf '\t'`
5256 AC_MSG_CHECKING([the GNU Make version])
5257 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5258 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5259 if test "$_make_longver" -ge "038200"; then
5260     AC_MSG_RESULT([$GNUMAKE $_make_version])
5262 elif test "$_make_longver" -ge "038100"; then
5263     if test "$build_os" = "cygwin"; then
5264         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5265     fi
5266     AC_MSG_RESULT([$GNUMAKE $_make_version])
5268     dnl ===================================================================
5269     dnl Search all the common names for sha1sum
5270     dnl ===================================================================
5271     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5272     if test -z "$SHA1SUM"; then
5273         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5274     elif test "$SHA1SUM" = "openssl"; then
5275         SHA1SUM="openssl sha1"
5276     fi
5277     AC_MSG_CHECKING([for GNU Make bug 20033])
5278     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5279     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5280 A := \$(wildcard *.a)
5282 .PHONY: all
5283 all: \$(A:.a=.b)
5284 <TAB>@echo survived bug20033.
5286 .PHONY: setup
5287 setup:
5288 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5290 define d1
5291 @echo lala \$(1)
5292 @sleep 1
5293 endef
5295 define d2
5296 @echo tyty \$(1)
5297 @sleep 1
5298 endef
5300 %.b : %.a
5301 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5302 <TAB>\$(call d1,\$(CHECKSUM)),\
5303 <TAB>\$(call d2,\$(CHECKSUM)))
5305     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5306         no_parallelism_make="YES"
5307         AC_MSG_RESULT([yes, disable parallelism])
5308     else
5309         AC_MSG_RESULT([no, keep parallelism enabled])
5310     fi
5311     rm -rf $TESTGMAKEBUG20033
5312 else
5313     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5316 # find if gnumake support file function
5317 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5318 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5319 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5320     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5322 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5323 \$(file >test.txt,Success )
5325 .PHONY: all
5326 all:
5327 <TAB>@cat test.txt
5330 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5331 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5332     HAVE_GNUMAKE_FILE_FUNC=TRUE
5333     AC_MSG_RESULT([yes])
5334 else
5335     AC_MSG_RESULT([no])
5337 rm -rf $TESTGMAKEFILEFUNC
5338 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5339 AC_SUBST(GNUMAKE_WIN_NATIVE)
5341 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5342 STALE_MAKE=
5343 if test "$_make_ver_check" = ""; then
5344    STALE_MAKE=TRUE
5347 HAVE_LD_HASH_STYLE=FALSE
5348 WITH_LINKER_HASH_STYLE=
5349 AC_MSG_CHECKING([for --hash-style gcc linker support])
5350 if test "$GCC" = "yes"; then
5351     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5352         hash_styles="gnu sysv"
5353     elif test "$with_linker_hash_style" = "no"; then
5354         hash_styles=
5355     else
5356         hash_styles="$with_linker_hash_style"
5357     fi
5359     for hash_style in $hash_styles; do
5360         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5361         hash_style_ldflags_save=$LDFLAGS
5362         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5364         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5365             [
5366 #include <stdio.h>
5367             ],[
5368 printf ("");
5369             ])],
5370             [
5371                   HAVE_LD_HASH_STYLE=TRUE
5372                   WITH_LINKER_HASH_STYLE=$hash_style
5373             ],
5374             [HAVE_LD_HASH_STYLE=FALSE],
5375             [HAVE_LD_HASH_STYLE=FALSE])
5376         LDFLAGS=$hash_style_ldflags_save
5377     done
5379     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5380         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5381     else
5382         AC_MSG_RESULT( no )
5383     fi
5384     LDFLAGS=$hash_style_ldflags_save
5385 else
5386     AC_MSG_RESULT( no )
5388 AC_SUBST(HAVE_LD_HASH_STYLE)
5389 AC_SUBST(WITH_LINKER_HASH_STYLE)
5391 dnl ===================================================================
5392 dnl Check whether there's a Perl version available.
5393 dnl ===================================================================
5394 if test -z "$with_perl_home"; then
5395     AC_PATH_PROG(PERL, perl)
5396 else
5397     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5398     _perl_path="$with_perl_home/bin/perl"
5399     if test -x "$_perl_path"; then
5400         PERL=$_perl_path
5401     else
5402         AC_MSG_ERROR([$_perl_path not found])
5403     fi
5406 dnl ===================================================================
5407 dnl Testing for Perl version 5 or greater.
5408 dnl $] is the Perl version variable, it is returned as an integer
5409 dnl ===================================================================
5410 if test "$PERL"; then
5411     AC_MSG_CHECKING([the Perl version])
5412     ${PERL} -e "exit($]);"
5413     _perl_version=$?
5414     if test "$_perl_version" -lt 5; then
5415         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5416     fi
5417     AC_MSG_RESULT([Perl $_perl_version])
5418 else
5419     AC_MSG_ERROR([Perl not found, install Perl 5])
5422 dnl ===================================================================
5423 dnl Testing for required Perl modules
5424 dnl ===================================================================
5426 AC_MSG_CHECKING([for required Perl modules])
5427 perl_use_string="use Cwd ; use Digest::MD5"
5428 if test "$_os" = "WINNT"; then
5429     if test -n "$PKGFORMAT"; then
5430         for i in $PKGFORMAT; do
5431             case "$i" in
5432             msi)
5433                 # for getting fonts versions to use in MSI
5434                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5435                 ;;
5436             esac
5437         done
5438     fi
5440 if test "$with_system_hsqldb" = "yes"; then
5441     perl_use_string="$perl_use_string ; use Archive::Zip"
5443 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5444     AC_MSG_RESULT([all modules found])
5445 else
5446     AC_MSG_RESULT([failed to find some modules])
5447     # Find out which modules are missing.
5448     for i in $perl_use_string; do
5449         if test "$i" != "use" -a "$i" != ";"; then
5450             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5451                 missing_perl_modules="$missing_perl_modules $i"
5452             fi
5453         fi
5454     done
5455     AC_MSG_ERROR([
5456     The missing Perl modules are: $missing_perl_modules
5457     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5460 dnl ===================================================================
5461 dnl Check for pkg-config
5462 dnl ===================================================================
5463 if test "$_os" != "WINNT"; then
5464     PKG_PROG_PKG_CONFIG
5467 if test "$_os" != "WINNT"; then
5469     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5470     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5471     # explicitly. Or put /path/to/compiler in PATH yourself.
5473     # Use wrappers for LTO
5474     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5475         AC_CHECK_TOOL(AR,gcc-ar)
5476         AC_CHECK_TOOL(NM,gcc-nm)
5477         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5478     else
5479         AC_CHECK_TOOL(AR,ar)
5480         AC_CHECK_TOOL(NM,nm)
5481         AC_CHECK_TOOL(RANLIB,ranlib)
5482     fi
5483     AC_CHECK_TOOL(OBJDUMP,objdump)
5484     AC_CHECK_TOOL(READELF,readelf)
5485     AC_CHECK_TOOL(STRIP,strip)
5486     if test "$_os" = "WINNT"; then
5487         AC_CHECK_TOOL(DLLTOOL,dlltool)
5488         AC_CHECK_TOOL(WINDRES,windres)
5489     fi
5491 AC_SUBST(AR)
5492 AC_SUBST(DLLTOOL)
5493 AC_SUBST(NM)
5494 AC_SUBST(OBJDUMP)
5495 AC_SUBST(PKG_CONFIG)
5496 AC_SUBST(RANLIB)
5497 AC_SUBST(READELF)
5498 AC_SUBST(STRIP)
5499 AC_SUBST(WINDRES)
5501 dnl ===================================================================
5502 dnl pkg-config checks on macOS
5503 dnl ===================================================================
5505 if test $_os = Darwin; then
5506     AC_MSG_CHECKING([for bogus pkg-config])
5507     if test -n "$PKG_CONFIG"; then
5508         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5509             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5510         else
5511             if test "$enable_bogus_pkg_config" = "yes"; then
5512                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5513             else
5514                 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.])
5515             fi
5516         fi
5517     else
5518         AC_MSG_RESULT([no, good])
5519     fi
5522 find_csc()
5524     # Return value: $csctest
5526     unset csctest
5528     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5529     if test -n "$regvalue"; then
5530         csctest=$regvalue
5531         return
5532     fi
5535 find_al()
5537     # Return value: $altest
5539     unset altest
5541     # We need this check to detect 4.6.1 or above.
5542     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5543         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5544         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5545             altest=$regvalue
5546             return
5547         fi
5548     done
5550     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5551         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5552         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5553             altest=$regvalue
5554             return
5555         fi
5556     done
5561 find_dotnetsdk46()
5563     unset frametest
5565     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5566         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5567         if test -n "$regvalue"; then
5568             frametest=$regvalue
5569             return
5570         fi
5571     done
5574 find_winsdk_version()
5576     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5577     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5579     unset winsdktest winsdkbinsubdir winsdklibsubdir
5581     case "$1" in
5582     8.0|8.0A)
5583         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5584         if test -n "$regvalue"; then
5585             winsdktest=$regvalue
5586             winsdklibsubdir=win8
5587             return
5588         fi
5589         ;;
5590     8.1|8.1A)
5591         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5592         if test -n "$regvalue"; then
5593             winsdktest=$regvalue
5594             winsdklibsubdir=winv6.3
5595             return
5596         fi
5597         ;;
5598     10.0)
5599         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5600         if test -n "$regvalue"; then
5601             winsdktest=$regvalue
5602             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5603             if test -n "$regvalue"; then
5604                 winsdkbinsubdir="$regvalue".0
5605                 winsdklibsubdir=$winsdkbinsubdir
5606                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5607                 # test exist the SDK path
5608                 if test -d "$tmppath"; then
5609                    # when path is convertible to a short path then path is okay
5610                    cygpath -d "$tmppath" >/dev/null 2>&1
5611                    if test $? -ne 0; then
5612                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5613                    fi
5614                 else
5615                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5616                 fi
5617             fi
5618             return
5619         fi
5620         ;;
5621     esac
5624 find_winsdk()
5626     # Return value: From find_winsdk_version
5628     unset winsdktest
5630     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5631         find_winsdk_version $ver
5632         if test -n "$winsdktest"; then
5633             return
5634         fi
5635     done
5638 find_msms()
5640     AC_MSG_CHECKING([for MSVC merge modules directory])
5641     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5642     case "$VCVER" in
5643         160)
5644         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5645         ;;
5646     esac
5647     for f in $my_msm_files; do
5648         echo "$as_me:$LINENO: searching for $f" >&5
5649     done
5651     msmdir=
5652     for ver in 14.0 15.0; do
5653         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5654         if test -n "$regvalue"; then
5655             for f in ${my_msm_files}; do
5656                 if test -e "$regvalue/${f}"; then
5657                     msmdir=$regvalue
5658                     break
5659                 fi
5660             done
5661         fi
5662     done
5663     dnl Is the following fallback really necessary, or was it added in response
5664     dnl to never having started Visual Studio on a given machine, so the
5665     dnl registry keys checked above had presumably not yet been created?
5666     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5667     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5668     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5669     dnl expanding to "C:\Program Files\Common Files"), which would need
5670     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5671     dnl obtain its value from cygwin:
5672     if test -z "$msmdir"; then
5673         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5674         for f in ${my_msm_files}; do
5675             if test -e "$my_msm_dir/${f}"; then
5676                 msmdir=$my_msm_dir
5677             fi
5678         done
5679     fi
5681     dnl Starting from MSVC 15.0, merge modules are located in different directory
5682     case "$VCVER" in
5683     160)
5684         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5685             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5686             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5687             for f in ${my_msm_files}; do
5688                 if test -e "$my_msm_dir/${f}"; then
5689                     msmdir=$my_msm_dir
5690                     break
5691                 fi
5692             done
5693         done
5694         ;;
5695     esac
5697     if test -n "$msmdir"; then
5698         msmdir=`cygpath -m "$msmdir"`
5699         AC_MSG_RESULT([$msmdir])
5700     else
5701         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5702             AC_MSG_FAILURE([not found])
5703         else
5704             AC_MSG_WARN([not found (check config.log)])
5705             add_warning "MSM none of ${my_msm_files} found"
5706         fi
5707     fi
5710 find_msvc_x64_dlls()
5712     AC_MSG_CHECKING([for MSVC x64 DLL path])
5713     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5714     case "$VCVER" in
5715     160)
5716         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5717             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5718             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5719                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5720                 break
5721             fi
5722             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5723             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5724                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5725                 break
5726             fi
5727         done
5728         ;;
5729     esac
5730     AC_MSG_RESULT([$msvcdllpath])
5731     AC_MSG_CHECKING([for MSVC x64 DLLs])
5732     msvcdlls="msvcp140.dll vcruntime140.dll"
5733     for dll in $msvcdlls; do
5734         if ! test -f "$msvcdllpath/$dll"; then
5735             AC_MSG_FAILURE([missing $dll])
5736         fi
5737     done
5738     AC_MSG_RESULT([found all ($msvcdlls)])
5741 dnl =========================================
5742 dnl Check for the Windows  SDK.
5743 dnl =========================================
5744 if test "$_os" = "WINNT"; then
5745     AC_MSG_CHECKING([for Windows SDK])
5746     if test "$build_os" = "cygwin"; then
5747         find_winsdk
5748         WINDOWS_SDK_HOME=$winsdktest
5750         # normalize if found
5751         if test -n "$WINDOWS_SDK_HOME"; then
5752             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5753             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5754         fi
5756         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5757     fi
5759     if test -n "$WINDOWS_SDK_HOME"; then
5760         # Remove a possible trailing backslash
5761         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5763         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5764              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5765              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5766             have_windows_sdk_headers=yes
5767         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5768              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5769              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5770             have_windows_sdk_headers=yes
5771         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5772              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5773              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5774             have_windows_sdk_headers=yes
5775         else
5776             have_windows_sdk_headers=no
5777         fi
5779         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5780             have_windows_sdk_libs=yes
5781         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5782             have_windows_sdk_libs=yes
5783         else
5784             have_windows_sdk_libs=no
5785         fi
5787         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5788             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5789 the  Windows SDK are installed.])
5790         fi
5791     fi
5793     if test -z "$WINDOWS_SDK_HOME"; then
5794         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5795     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5796         WINDOWS_SDK_VERSION=80
5797         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5798     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5799         WINDOWS_SDK_VERSION=81
5800         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5801     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5802         WINDOWS_SDK_VERSION=10
5803         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5804     else
5805         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5806     fi
5807     PathFormat "$WINDOWS_SDK_HOME"
5808     WINDOWS_SDK_HOME="$formatted_path"
5809     if test "$build_os" = "cygwin"; then
5810         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5811         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5812             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5813         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5814             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5815         fi
5816     fi
5818     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5819     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5820     dnl but not in v8.0), so allow this to be overridden with a
5821     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5822     dnl and configuration error if no WiLangId.vbs is found would arguably be
5823     dnl better, but I do not know under which conditions exactly it is needed by
5824     dnl msiglobal.pm:
5825     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5826         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5827         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5828             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5829         fi
5830         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5831             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5832         fi
5833         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5834             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5835         fi
5836     fi
5837     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5838         if test -n "$with_package_format" -a "$with_package_format" != no; then
5839             for i in "$with_package_format"; do
5840                 if test "$i" = "msi"; then
5841                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5842                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5843                     fi
5844                 fi
5845             done
5846         fi
5847     fi
5849 AC_SUBST(WINDOWS_SDK_HOME)
5850 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5851 AC_SUBST(WINDOWS_SDK_VERSION)
5852 AC_SUBST(WINDOWS_SDK_WILANGID)
5854 if test "$build_os" = "cygwin"; then
5855     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5856     dnl dir, it also determines that dir's path w/o an arch segment if any,
5857     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5858     AC_MSG_CHECKING([for midl.exe])
5860     find_winsdk
5861     if test -n "$winsdkbinsubdir" \
5862         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5863     then
5864         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5865         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5866     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5867         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5868         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5869     elif test -f "$winsdktest/Bin/midl.exe"; then
5870         MIDL_PATH=$winsdktest/Bin
5871         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5872     fi
5873     if test ! -f "$MIDL_PATH/midl.exe"; then
5874         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5875     else
5876         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5877     fi
5879     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5880     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5882     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5883          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5884          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5885          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5886     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5887          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5888          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5889          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5890     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5891          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5892          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5893          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5894     else
5895         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5896     fi
5898     dnl Check csc.exe
5899     AC_MSG_CHECKING([for csc.exe])
5900     find_csc
5901     if test -f "$csctest/csc.exe"; then
5902         CSC_PATH="$csctest"
5903     fi
5904     if test ! -f "$CSC_PATH/csc.exe"; then
5905         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5906     else
5907         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5908     fi
5910     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5912     dnl Check al.exe
5913     AC_MSG_CHECKING([for al.exe])
5914     find_winsdk
5915     if test -n "$winsdkbinsubdir" \
5916         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5917     then
5918         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5919     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5920         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5921     elif test -f "$winsdktest/Bin/al.exe"; then
5922         AL_PATH="$winsdktest/Bin"
5923     fi
5925     if test -z "$AL_PATH"; then
5926         find_al
5927         if test -f "$altest/bin/al.exe"; then
5928             AL_PATH="$altest/bin"
5929         elif test -f "$altest/al.exe"; then
5930             AL_PATH="$altest"
5931         fi
5932     fi
5933     if test ! -f "$AL_PATH/al.exe"; then
5934         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5935     else
5936         AC_MSG_RESULT([$AL_PATH/al.exe])
5937     fi
5939     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5941     dnl Check mscoree.lib / .NET Framework dir
5942     AC_MSG_CHECKING(.NET Framework)
5943     find_dotnetsdk46
5944     PathFormat "$frametest"
5945     frametest="$formatted_path"
5946     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5947         DOTNET_FRAMEWORK_HOME="$frametest"
5948     else
5949         find_winsdk
5950         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5951             DOTNET_FRAMEWORK_HOME="$winsdktest"
5952         fi
5953     fi
5954     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
5955         AC_MSG_ERROR([mscoree.lib not found])
5956     fi
5957     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5959     PathFormat "$MIDL_PATH"
5960     MIDL_PATH="$formatted_path"
5962     PathFormat "$AL_PATH"
5963     AL_PATH="$formatted_path"
5965     PathFormat "$DOTNET_FRAMEWORK_HOME"
5966     DOTNET_FRAMEWORK_HOME="$formatted_path"
5968     PathFormat "$CSC_PATH"
5969     CSC_PATH="$formatted_path"
5972 dnl ===================================================================
5973 dnl Check if stdc headers are available excluding MSVC.
5974 dnl ===================================================================
5975 if test "$_os" != "WINNT"; then
5976     AC_HEADER_STDC
5979 dnl ===================================================================
5980 dnl Testing for C++ compiler and version...
5981 dnl ===================================================================
5983 if test "$_os" != "WINNT"; then
5984     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5985     save_CXXFLAGS=$CXXFLAGS
5986     AC_PROG_CXX
5987     CXXFLAGS=$save_CXXFLAGS
5988     if test -z "$CXX_BASE"; then
5989         CXX_BASE=`first_arg_basename "$CXX"`
5990     fi
5993 dnl check for GNU C++ compiler version
5994 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5995     AC_MSG_CHECKING([the GNU C++ compiler version])
5997     _gpp_version=`$CXX -dumpversion`
5998     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6000     if test "$_gpp_majmin" -lt "700"; then
6001         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6002     else
6003         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6004     fi
6006     dnl see https://code.google.com/p/android/issues/detail?id=41770
6007         glibcxx_threads=no
6008         AC_LANG_PUSH([C++])
6009         AC_REQUIRE_CPP
6010         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6011         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6012             #include <bits/c++config.h>]],[[
6013             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6014             && !defined(_GLIBCXX__PTHREADS) \
6015             && !defined(_GLIBCXX_HAS_GTHREADS)
6016             choke me
6017             #endif
6018         ]])],[AC_MSG_RESULT([yes])
6019         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6020         AC_LANG_POP([C++])
6021         if test $glibcxx_threads = yes; then
6022             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6023         fi
6025 AC_SUBST(BOOST_CXXFLAGS)
6028 # prefx CXX with ccache if needed
6030 if test "$CCACHE" != ""; then
6031     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6032     AC_LANG_PUSH([C++])
6033     save_CXXFLAGS=$CXXFLAGS
6034     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6035     dnl an empty program will do, we're checking the compiler flags
6036     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6037                       [use_ccache=yes], [use_ccache=no])
6038     if test $use_ccache = yes; then
6039         AC_MSG_RESULT([yes])
6040     else
6041         CXX="$CCACHE $CXX"
6042         CXX_BASE="ccache $CXX_BASE"
6043         AC_MSG_RESULT([no])
6044     fi
6045     CXXFLAGS=$save_CXXFLAGS
6046     AC_LANG_POP([C++])
6049 dnl ===================================================================
6050 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6051 dnl ===================================================================
6053 if test "$_os" != "WINNT"; then
6054     AC_PROG_CXXCPP
6056     dnl Check whether there's a C pre-processor.
6057     AC_PROG_CPP
6061 dnl ===================================================================
6062 dnl Find integral type sizes and alignments
6063 dnl ===================================================================
6065 if test "$_os" != "WINNT"; then
6067 if test "$_os" = "iOS"; then
6068     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6069     ac_cv_sizeof_long=8
6070     ac_cv_sizeof_short=2
6071     ac_cv_sizeof_int=4
6072     ac_cv_sizeof_long_long=8
6073     ac_cv_sizeof_double=8
6074     ac_cv_sizeof_voidp=8
6075 else
6076     AC_CHECK_SIZEOF(long)
6077     AC_CHECK_SIZEOF(short)
6078     AC_CHECK_SIZEOF(int)
6079     AC_CHECK_SIZEOF(long long)
6080     AC_CHECK_SIZEOF(double)
6081     AC_CHECK_SIZEOF(void*)
6084     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6085     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6086     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6087     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6088     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6090     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6091     m4_pattern_allow([AC_CHECK_ALIGNOF])
6092     m4_ifdef([AC_CHECK_ALIGNOF],
6093         [
6094             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6095             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6096             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6097             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6098         ],
6099         [
6100             case "$_os-$host_cpu" in
6101             Linux-i686)
6102                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6103                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6104                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6105                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6106                 ;;
6107             Linux-x86_64)
6108                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6109                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6110                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6111                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6112                 ;;
6113             *)
6114                 if test -z "$ac_cv_alignof_short" -o \
6115                         -z "$ac_cv_alignof_int" -o \
6116                         -z "$ac_cv_alignof_long" -o \
6117                         -z "$ac_cv_alignof_double"; then
6118                    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.])
6119                 fi
6120                 ;;
6121             esac
6122         ])
6124     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6125     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6126     if test $ac_cv_sizeof_long -eq 8; then
6127         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6128     elif test $ac_cv_sizeof_double -eq 8; then
6129         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6130     else
6131         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6132     fi
6134     dnl Check for large file support
6135     AC_SYS_LARGEFILE
6136     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6137         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6138     fi
6139     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6140         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6141     fi
6142 else
6143     # Hardcode for MSVC
6144     SAL_TYPES_SIZEOFSHORT=2
6145     SAL_TYPES_SIZEOFINT=4
6146     SAL_TYPES_SIZEOFLONG=4
6147     SAL_TYPES_SIZEOFLONGLONG=8
6148     if test "$BITNESS_OVERRIDE" = ""; then
6149         SAL_TYPES_SIZEOFPOINTER=4
6150     else
6151         SAL_TYPES_SIZEOFPOINTER=8
6152     fi
6153     SAL_TYPES_ALIGNMENT2=2
6154     SAL_TYPES_ALIGNMENT4=4
6155     SAL_TYPES_ALIGNMENT8=8
6156     LFS_CFLAGS=''
6158 AC_SUBST(LFS_CFLAGS)
6160 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6161 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6162 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6163 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6164 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6165 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6166 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6167 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6169 dnl ===================================================================
6170 dnl Check whether to enable runtime optimizations
6171 dnl ===================================================================
6172 ENABLE_RUNTIME_OPTIMIZATIONS=
6173 AC_MSG_CHECKING([whether to enable runtime optimizations])
6174 if test -z "$enable_runtime_optimizations"; then
6175     for i in $CC; do
6176         case $i in
6177         -fsanitize=*)
6178             enable_runtime_optimizations=no
6179             break
6180             ;;
6181         esac
6182     done
6184 if test "$enable_runtime_optimizations" != no; then
6185     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6186     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6187     AC_MSG_RESULT([yes])
6188 else
6189     AC_MSG_RESULT([no])
6191 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6193 dnl ===================================================================
6194 dnl Check if valgrind headers are available
6195 dnl ===================================================================
6196 ENABLE_VALGRIND=
6197 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6198     prev_cppflags=$CPPFLAGS
6199     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6200     # or where does it come from?
6201     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6202     AC_CHECK_HEADER([valgrind/valgrind.h],
6203         [ENABLE_VALGRIND=TRUE])
6204     CPPFLAGS=$prev_cppflags
6206 AC_SUBST([ENABLE_VALGRIND])
6207 if test -z "$ENABLE_VALGRIND"; then
6208     if test "$with_valgrind" = yes; then
6209         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6210     fi
6211     VALGRIND_CFLAGS=
6213 AC_SUBST([VALGRIND_CFLAGS])
6216 dnl ===================================================================
6217 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6218 dnl ===================================================================
6220 # We need at least the sys/sdt.h include header.
6221 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6222 if test "$SDT_H_FOUND" = "TRUE"; then
6223     # Found sys/sdt.h header, now make sure the c++ compiler works.
6224     # Old g++ versions had problems with probes in constructors/destructors.
6225     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6226     AC_LANG_PUSH([C++])
6227     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6228     #include <sys/sdt.h>
6229     class ProbeClass
6230     {
6231     private:
6232       int& ref;
6233       const char *name;
6235     public:
6236       ProbeClass(int& v, const char *n) : ref(v), name(n)
6237       {
6238         DTRACE_PROBE2(_test_, cons, name, ref);
6239       }
6241       void method(int min)
6242       {
6243         DTRACE_PROBE3(_test_, meth, name, ref, min);
6244         ref -= min;
6245       }
6247       ~ProbeClass()
6248       {
6249         DTRACE_PROBE2(_test_, dest, name, ref);
6250       }
6251     };
6252     ]],[[
6253     int i = 64;
6254     DTRACE_PROBE1(_test_, call, i);
6255     ProbeClass inst = ProbeClass(i, "call");
6256     inst.method(24);
6257     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6258           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6259     AC_LANG_POP([C++])
6261 AC_CONFIG_HEADERS([config_host/config_probes.h])
6263 dnl ===================================================================
6264 dnl GCC features
6265 dnl ===================================================================
6266 HAVE_GCC_STACK_CLASH_PROTECTION=
6267 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6268     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6269     save_CFLAGS=$CFLAGS
6270     CFLAGS="$CFLAGS -fstack-clash-protection"
6271     AC_LINK_IFELSE(
6272         [AC_LANG_PROGRAM(, [[return 0;]])],
6273         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6274         [AC_MSG_RESULT([no])])
6275     CFLAGS=$save_CFLAGS
6277     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6278     save_CFLAGS=$CFLAGS
6279     CFLAGS="$CFLAGS -Werror -mno-avx"
6280     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6281     CFLAGS=$save_CFLAGS
6282     if test "$HAVE_GCC_AVX" = "TRUE"; then
6283         AC_MSG_RESULT([yes])
6284     else
6285         AC_MSG_RESULT([no])
6286     fi
6288     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6289     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6290     int v = 0;
6291     if (__sync_add_and_fetch(&v, 1) != 1 ||
6292         __sync_sub_and_fetch(&v, 1) != 0)
6293         return 1;
6294     __sync_synchronize();
6295     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6296         v != 1)
6297         return 1;
6298     return 0;
6299 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6300     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6301         AC_MSG_RESULT([yes])
6302         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6303     else
6304         AC_MSG_RESULT([no])
6305     fi
6307     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6308     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6309     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6310         AC_MSG_RESULT([yes])
6311         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6312     else
6313         AC_MSG_RESULT([no])
6314     fi
6316     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6317     save_CFLAGS=$CFLAGS
6318     CFLAGS="$CFLAGS -Werror"
6319     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6320             __attribute__((deprecated("test"))) void f();
6321         ])], [
6322             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6323             AC_MSG_RESULT([yes])
6324         ], [AC_MSG_RESULT([no])])
6325     CFLAGS=$save_CFLAGS
6327     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6328     AC_LANG_PUSH([C++])
6329     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6330             #include <cstddef>
6331             #include <cxxabi.h>
6332             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6333         ])], [
6334             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6335             AC_MSG_RESULT([yes])
6336         ], [AC_MSG_RESULT([no])])
6337     AC_LANG_POP([C++])
6339     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6340     AC_LANG_PUSH([C++])
6341     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6342             #include <cstddef>
6343             #include <cxxabi.h>
6344             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6345         ])], [
6346             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6347             AC_MSG_RESULT([yes])
6348         ], [AC_MSG_RESULT([no])])
6349     AC_LANG_POP([C++])
6351     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6352     AC_LANG_PUSH([C++])
6353     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6354             #include <cxxabi.h>
6355             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6356         ])], [
6357             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6358             AC_MSG_RESULT([yes])
6359         ], [AC_MSG_RESULT([no])])
6360     AC_LANG_POP([C++])
6362     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6363     AC_LANG_PUSH([C++])
6364     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6365             #include <cstddef>
6366             #include <cxxabi.h>
6367             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6368         ])], [
6369             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6370             AC_MSG_RESULT([yes])
6371         ], [AC_MSG_RESULT([no])])
6372     AC_LANG_POP([C++])
6374     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6375     AC_LANG_PUSH([C++])
6376     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6377             #include <cstddef>
6378             #include <cxxabi.h>
6379             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6380         ])], [
6381             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6382             AC_MSG_RESULT([yes])
6383         ], [AC_MSG_RESULT([no])])
6384     AC_LANG_POP([C++])
6386     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6387     AC_LANG_PUSH([C++])
6388     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6389             #include <cxxabi.h>
6390             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6391         ])], [
6392             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6393             AC_MSG_RESULT([yes])
6394         ], [AC_MSG_RESULT([no])])
6395     AC_LANG_POP([C++])
6397     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6398     AC_LANG_PUSH([C++])
6399     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6400             #include <cxxabi.h>
6401             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6402         ])], [
6403             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6404             AC_MSG_RESULT([yes])
6405         ], [AC_MSG_RESULT([no])])
6406     AC_LANG_POP([C++])
6408     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6409     AC_LANG_PUSH([C++])
6410     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6411             #include <cxxabi.h>
6412             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6413         ])], [
6414             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6415             AC_MSG_RESULT([yes])
6416         ], [AC_MSG_RESULT([no])])
6417     AC_LANG_POP([C++])
6419     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6420     AC_LANG_PUSH([C++])
6421     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6422             #include <cstddef>
6423             #include <cxxabi.h>
6424             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6425         ])], [
6426             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6427             AC_MSG_RESULT([yes])
6428         ], [AC_MSG_RESULT([no])])
6429     AC_LANG_POP([C++])
6431     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6432     AC_LANG_PUSH([C++])
6433     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6434             #include <cstddef>
6435             #include <cxxabi.h>
6436             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6437         ])], [
6438             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6439             AC_MSG_RESULT([yes])
6440         ], [AC_MSG_RESULT([no])])
6441     AC_LANG_POP([C++])
6443     dnl Available in GCC 4.9 and at least since Clang 3.4; this check can eventually be removed
6444     dnl completely (e.g., after libreoffice-6-5 branch off):
6445     AC_MSG_CHECKING([that $CXX_BASE supports __attribute__((warn_unused))])
6446     AC_LANG_PUSH([C++])
6447     save_CXXFLAGS=$CXXFLAGS
6448     CXXFLAGS="$CXXFLAGS -Werror"
6449     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6450             struct __attribute__((warn_unused)) dummy {};
6451         ])], [
6452             AC_MSG_RESULT([yes])
6453         ], [AC_MSG_ERROR([no])])
6454     CXXFLAGS=$save_CXXFLAGS
6455 AC_LANG_POP([C++])
6458 AC_SUBST(HAVE_GCC_AVX)
6459 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6460 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6461 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6463 dnl ===================================================================
6464 dnl Identify the C++ library
6465 dnl ===================================================================
6467 AC_MSG_CHECKING([what the C++ library is])
6468 AC_LANG_PUSH([C++])
6469 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6470 #include <utility>
6471 #ifndef __GLIBCXX__
6472 foo bar
6473 #endif
6474 ]])],
6475     [CPP_LIBRARY=GLIBCXX
6476      cpp_library_name="GNU libstdc++"
6477     ],
6478     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6479 #include <utility>
6480 #ifndef _LIBCPP_VERSION
6481 foo bar
6482 #endif
6483 ]])],
6484     [CPP_LIBRARY=LIBCPP
6485      cpp_library_name="LLVM libc++"
6486      AC_DEFINE([HAVE_LIBCXX])
6487     ],
6488     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6489 #include <utility>
6490 #ifndef _MSC_VER
6491 foo bar
6492 #endif
6493 ]])],
6494     [CPP_LIBRARY=MSVCRT
6495      cpp_library_name="Microsoft"
6496     ],
6497     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6498 AC_MSG_RESULT([$cpp_library_name])
6499 AC_LANG_POP([C++])
6501 dnl ===================================================================
6502 dnl Check for gperf
6503 dnl ===================================================================
6504 AC_PATH_PROG(GPERF, gperf)
6505 if test -z "$GPERF"; then
6506     AC_MSG_ERROR([gperf not found but needed. Install it.])
6508 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6509     GPERF=`cygpath -m $GPERF`
6511 AC_MSG_CHECKING([whether gperf is new enough])
6512 my_gperf_ver1=$($GPERF --version | head -n 1)
6513 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6514 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6515 if test "$my_gperf_ver3" -ge 301; then
6516     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6517 else
6518     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6520 AC_SUBST(GPERF)
6522 dnl ===================================================================
6523 dnl Check for system libcmis
6524 dnl ===================================================================
6525 # libcmis requires curl and we can't build curl for iOS
6526 if test $_os != iOS; then
6527     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6528     ENABLE_LIBCMIS=TRUE
6529 else
6530     ENABLE_LIBCMIS=
6532 AC_SUBST(ENABLE_LIBCMIS)
6534 dnl ===================================================================
6535 dnl C++11
6536 dnl ===================================================================
6538 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6539 CXXFLAGS_CXX11=
6540 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6541     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6542 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6543     my_flags='-std=c++20 -std=c++2a -std=c++17 -std=c++1z'
6544     for flag in $my_flags; do
6545         if test "$COM" = MSC; then
6546             flag="-Xclang $flag"
6547         fi
6548         save_CXXFLAGS=$CXXFLAGS
6549         CXXFLAGS="$CXXFLAGS $flag -Werror"
6550         if test "$SYSTEM_LIBCMIS" = TRUE; then
6551             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6552         fi
6553         AC_LANG_PUSH([C++])
6554         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6555             #include <algorithm>
6556             #include <functional>
6557             #include <vector>
6559             #if defined SYSTEM_LIBCMIS
6560             // See ucb/source/ucp/cmis/auth_provider.hxx:
6561             #if !defined __clang__
6562             #pragma GCC diagnostic push
6563             #pragma GCC diagnostic ignored "-Wdeprecated"
6564             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6565             #endif
6566             #include <libcmis/libcmis.hxx>
6567             #if !defined __clang__
6568             #pragma GCC diagnostic pop
6569             #endif
6570             #endif
6572             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6573                 std::sort(v.begin(), v.end(), fn);
6574             }
6575             ]])],[CXXFLAGS_CXX11=$flag])
6576         AC_LANG_POP([C++])
6577         CXXFLAGS=$save_CXXFLAGS
6578         if test -n "$CXXFLAGS_CXX11"; then
6579             break
6580         fi
6581     done
6583 if test -n "$CXXFLAGS_CXX11"; then
6584     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6585 else
6586     AC_MSG_ERROR(no)
6588 AC_SUBST(CXXFLAGS_CXX11)
6590 if test "$GCC" = "yes"; then
6591     save_CXXFLAGS=$CXXFLAGS
6592     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6593     CHECK_L_ATOMIC
6594     CXXFLAGS=$save_CXXFLAGS
6595     AC_SUBST(ATOMIC_LIB)
6598 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6599 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6600 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6601 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6602 dnl again towards 4.7.2:
6603 if test $CPP_LIBRARY = GLIBCXX; then
6604     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6605     AC_LANG_PUSH([C++])
6606     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6607 #include <list>
6608 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6609     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6610     //   GCC 4.7.0: 20120322
6611     //   GCC 4.7.1: 20120614
6612     // and using a range check is not possible as the mapping between
6613     // __GLIBCXX__ values and GCC versions is not monotonic
6614 /* ok */
6615 #else
6616 abi broken
6617 #endif
6618         ]])], [AC_MSG_RESULT(no, ok)],
6619         [AC_MSG_ERROR(yes)])
6620     AC_LANG_POP([C++])
6623 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6624 save_CXXFLAGS=$CXXFLAGS
6625 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6626 AC_LANG_PUSH([C++])
6628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6629 #include <stddef.h>
6631 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6633 namespace
6635         struct b
6636         {
6637                 int i;
6638                 int j;
6639         };
6641 ]], [[
6642 struct a
6644         int i;
6645         int j;
6647 a thinga[]={{0,0}, {1,1}};
6648 b thingb[]={{0,0}, {1,1}};
6649 size_t i = sizeof(sal_n_array_size(thinga));
6650 size_t j = sizeof(sal_n_array_size(thingb));
6651 return !(i != 0 && j != 0);
6653     ], [ AC_MSG_RESULT(yes) ],
6654     [ AC_MSG_ERROR(no)])
6655 AC_LANG_POP([C++])
6656 CXXFLAGS=$save_CXXFLAGS
6658 dnl _Pragma support (may require C++11)
6659 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6660     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6661     AC_LANG_PUSH([C++])
6662     save_CXXFLAGS=$CXXFLAGS
6663     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6664     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6665             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6666         ])], [
6667             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6668             AC_MSG_RESULT([yes])
6669         ], [AC_MSG_RESULT([no])])
6670     AC_LANG_POP([C++])
6671     CXXFLAGS=$save_CXXFLAGS
6674 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6675 if test "$GCC" = yes; then
6676     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6677     AC_LANG_PUSH([C++])
6678     save_CXXFLAGS=$CXXFLAGS
6679     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6680     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6681     CXXFLAGS=$save_CXXFLAGS
6682     AC_LANG_POP([C++])
6683     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6684         AC_MSG_RESULT([yes])
6685     else
6686         AC_MSG_RESULT([no])
6687     fi
6689 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6691 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6692 AC_LANG_PUSH([C++])
6693 save_CXXFLAGS=$CXXFLAGS
6694 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6695 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6696         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6697         // supporting it:
6698         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6699         struct S {
6700         private:
6701             S(S const &);
6702         public:
6703             S();
6704             ~S();
6705         };
6706         S copy();
6707         void f() { S c(copy()); }
6708         #endif
6709     ])], [
6710         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6711         AC_MSG_RESULT([yes])
6712     ], [AC_MSG_RESULT([no])])
6713 CXXFLAGS=$save_CXXFLAGS
6714 AC_LANG_POP([C++])
6716 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6717 AC_LANG_PUSH([C++])
6718 save_CXXFLAGS=$CXXFLAGS
6719 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6720 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6721         #include <algorithm>
6722         #include <initializer_list>
6723         #include <vector>
6724         template<typename T> class S {
6725         private:
6726             std::vector<T> v_;
6727         public:
6728             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6729         };
6730         constinit S<int> s{3, 2, 1};
6731     ])], [
6732         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6733         AC_MSG_RESULT([yes])
6734     ], [AC_MSG_RESULT([no])])
6735 CXXFLAGS=$save_CXXFLAGS
6736 AC_LANG_POP([C++])
6738 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6739 AC_LANG_PUSH([C++])
6740 save_CXXFLAGS=$CXXFLAGS
6741 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6742 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6743         #include <span>
6744         #include <type_traits>
6745         // Don't check size_type directly, as it was called index_type before P1872R0:
6746         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6747     ])], [
6748         AC_DEFINE([HAVE_CPP_SPAN],[1])
6749         AC_MSG_RESULT([yes])
6750     ], [AC_MSG_RESULT([no])])
6751 CXXFLAGS=$save_CXXFLAGS
6752 AC_LANG_POP([C++])
6754 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
6755 AC_LANG_PUSH([C++])
6756 save_CXXFLAGS=$CXXFLAGS
6757 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6758 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6759         struct S1 { S1(S1 &&); };
6760         struct S2: S1 {};
6761         S1 f(S2 s) { return s; }
6762     ])], [
6763         AC_DEFINE([HAVE_P1155R3],[1])
6764         AC_MSG_RESULT([yes])
6765     ], [AC_MSG_RESULT([no])])
6766 CXXFLAGS=$save_CXXFLAGS
6767 AC_LANG_POP([C++])
6769 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
6770 dnl which is included in -Wextra anyway):
6771 HAVE_WDEPRECATED_COPY_DTOR=
6772 if test "$GCC" = yes; then
6773     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
6774     AC_LANG_PUSH([C++])
6775     save_CXXFLAGS=$CXXFLAGS
6776     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
6777     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
6778             HAVE_WDEPRECATED_COPY_DTOR=TRUE
6779             AC_MSG_RESULT([yes])
6780         ], [AC_MSG_RESULT([no])])
6781     CXXFLAGS=$save_CXXFLAGS
6782     AC_LANG_POP([C++])
6784 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
6786 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6787 dnl uninitialized warning for code like
6789 dnl   OString f();
6790 dnl   boost::optional<OString> * g(bool b) {
6791 dnl       boost::optional<OString> o;
6792 dnl       if (b) o = f();
6793 dnl       return new boost::optional<OString>(o);
6794 dnl   }
6796 dnl (as is e.g. present, in a slightly more elaborate form, in
6797 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6798 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6799 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6800 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6801     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6802     AC_LANG_PUSH([C++])
6803     save_CXXFLAGS=$CXXFLAGS
6804     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6805     if test "$ENABLE_OPTIMIZED" = TRUE; then
6806         CXXFLAGS="$CXXFLAGS -O2"
6807     else
6808         CXXFLAGS="$CXXFLAGS -O0"
6809     fi
6810     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6811             #include <new>
6812             void f1(int);
6813             struct S1 {
6814                 ~S1() { f1(n); }
6815                 int n = 0;
6816             };
6817             struct S2 {
6818                 S2() {}
6819                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6820                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6821                 void set(S1 s) {
6822                     new (stg) S1(s);
6823                     init = true;
6824                 }
6825                 bool init = false;
6826                 char stg[sizeof (S1)];
6827             } ;
6828             S1 f2();
6829             S2 * f3(bool b) {
6830                 S2 o;
6831                 if (b) o.set(f2());
6832                 return new S2(o);
6833             }
6834         ]])], [AC_MSG_RESULT([no])], [
6835             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6836             AC_MSG_RESULT([yes])
6837         ])
6838     CXXFLAGS=$save_CXXFLAGS
6839     AC_LANG_POP([C++])
6841 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6843 dnl ===================================================================
6844 dnl CPU Intrinsics support - SSE, AVX
6845 dnl ===================================================================
6847 CXXFLAGS_INTRINSICS_SSE2=
6848 CXXFLAGS_INTRINSICS_SSSE3=
6849 CXXFLAGS_INTRINSICS_SSE41=
6850 CXXFLAGS_INTRINSICS_SSE42=
6851 CXXFLAGS_INTRINSICS_AVX=
6852 CXXFLAGS_INTRINSICS_AVX2=
6853 CXXFLAGS_INTRINSICS_F16C=
6854 CXXFLAGS_INTRINSICS_FMA=
6856 if test "$GCC" = "yes"; then
6857     flag_sse2=-msse2
6858     flag_ssse3=-mssse3
6859     flag_sse41=-msse4.1
6860     flag_sse42=-msse4.2
6861     flag_avx=-mavx
6862     flag_avx2=-mavx2
6863     flag_f16c=-mf16c
6864     flag_fma=-mfma
6865 else
6866     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
6867     # MSVC seems to differentiate only between SSE and SSE2, where in fact
6868     # SSE2 seems to be SSE2+.
6869     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
6870     # is not empty (and can be tested in gbuild), moreover we now default to SSE
6871     # for 32bit x86.
6872     flag_sse2=-arch:SSE2
6873     flag_ssse3=-arch:SSE2
6874     flag_sse41=-arch:SSE2
6875     flag_sse42=-arch:SSE2
6876     flag_avx=-arch:AVX
6877     flag_avx2=-arch:AVX2
6878     # These are part of -arch:AVX2
6879     flag_f16c=-arch:AVX2
6880     flag_fma=-arch:AVX2
6883 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6884 AC_LANG_PUSH([C++])
6885 save_CXXFLAGS=$CXXFLAGS
6886 CXXFLAGS="$CXXFLAGS $flag_sse2"
6887 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6888     #include <emmintrin.h>
6889     int main () {
6890         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6891         c = _mm_xor_si128 (a, b);
6892         return 0;
6893     }
6894     ])],
6895     [can_compile_sse2=yes],
6896     [can_compile_sse2=no])
6897 AC_LANG_POP([C++])
6898 CXXFLAGS=$save_CXXFLAGS
6899 AC_MSG_RESULT([${can_compile_sse2}])
6900 if test "${can_compile_sse2}" = "yes" ; then
6901     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
6904 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6905 AC_LANG_PUSH([C++])
6906 save_CXXFLAGS=$CXXFLAGS
6907 CXXFLAGS="$CXXFLAGS $flag_ssse3"
6908 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6909     #include <tmmintrin.h>
6910     int main () {
6911         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6912         c = _mm_maddubs_epi16 (a, b);
6913         return 0;
6914     }
6915     ])],
6916     [can_compile_ssse3=yes],
6917     [can_compile_ssse3=no])
6918 AC_LANG_POP([C++])
6919 CXXFLAGS=$save_CXXFLAGS
6920 AC_MSG_RESULT([${can_compile_ssse3}])
6921 if test "${can_compile_ssse3}" = "yes" ; then
6922     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
6925 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
6926 AC_LANG_PUSH([C++])
6927 save_CXXFLAGS=$CXXFLAGS
6928 CXXFLAGS="$CXXFLAGS $flag_sse41"
6929 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6930     #include <smmintrin.h>
6931     int main () {
6932         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6933         c = _mm_cmpeq_epi64 (a, b);
6934         return 0;
6935     }
6936     ])],
6937     [can_compile_sse41=yes],
6938     [can_compile_sse41=no])
6939 AC_LANG_POP([C++])
6940 CXXFLAGS=$save_CXXFLAGS
6941 AC_MSG_RESULT([${can_compile_sse41}])
6942 if test "${can_compile_sse41}" = "yes" ; then
6943     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
6946 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
6947 AC_LANG_PUSH([C++])
6948 save_CXXFLAGS=$CXXFLAGS
6949 CXXFLAGS="$CXXFLAGS $flag_sse42"
6950 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6951     #include <nmmintrin.h>
6952     int main () {
6953         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6954         c = _mm_cmpgt_epi64 (a, b);
6955         return 0;
6956     }
6957     ])],
6958     [can_compile_sse42=yes],
6959     [can_compile_sse42=no])
6960 AC_LANG_POP([C++])
6961 CXXFLAGS=$save_CXXFLAGS
6962 AC_MSG_RESULT([${can_compile_sse42}])
6963 if test "${can_compile_sse42}" = "yes" ; then
6964     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
6967 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6968 AC_LANG_PUSH([C++])
6969 save_CXXFLAGS=$CXXFLAGS
6970 CXXFLAGS="$CXXFLAGS $flag_avx"
6971 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6972     #include <immintrin.h>
6973     int main () {
6974         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6975         c = _mm256_xor_ps(a, b);
6976         return 0;
6977     }
6978     ])],
6979     [can_compile_avx=yes],
6980     [can_compile_avx=no])
6981 AC_LANG_POP([C++])
6982 CXXFLAGS=$save_CXXFLAGS
6983 AC_MSG_RESULT([${can_compile_avx}])
6984 if test "${can_compile_avx}" = "yes" ; then
6985     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
6988 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6989 AC_LANG_PUSH([C++])
6990 save_CXXFLAGS=$CXXFLAGS
6991 CXXFLAGS="$CXXFLAGS $flag_avx2"
6992 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6993     #include <immintrin.h>
6994     int main () {
6995         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6996         c = _mm256_maddubs_epi16(a, b);
6997         return 0;
6998     }
6999     ])],
7000     [can_compile_avx2=yes],
7001     [can_compile_avx2=no])
7002 AC_LANG_POP([C++])
7003 CXXFLAGS=$save_CXXFLAGS
7004 AC_MSG_RESULT([${can_compile_avx2}])
7005 if test "${can_compile_avx2}" = "yes" ; then
7006     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7009 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7010 AC_LANG_PUSH([C++])
7011 save_CXXFLAGS=$CXXFLAGS
7012 CXXFLAGS="$CXXFLAGS $flag_f16c"
7013 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7014     #include <immintrin.h>
7015     int main () {
7016         __m128i a = _mm_set1_epi32 (0);
7017         __m128 c;
7018         c = _mm_cvtph_ps(a);
7019         return 0;
7020     }
7021     ])],
7022     [can_compile_f16c=yes],
7023     [can_compile_f16c=no])
7024 AC_LANG_POP([C++])
7025 CXXFLAGS=$save_CXXFLAGS
7026 AC_MSG_RESULT([${can_compile_f16c}])
7027 if test "${can_compile_f16c}" = "yes" ; then
7028     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7031 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7032 AC_LANG_PUSH([C++])
7033 save_CXXFLAGS=$CXXFLAGS
7034 CXXFLAGS="$CXXFLAGS $flag_fma"
7035 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7036     #include <immintrin.h>
7037     int main () {
7038         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7039         d = _mm256_fmadd_ps(a, b, c);
7040         return 0;
7041     }
7042     ])],
7043     [can_compile_fma=yes],
7044     [can_compile_fma=no])
7045 AC_LANG_POP([C++])
7046 CXXFLAGS=$save_CXXFLAGS
7047 AC_MSG_RESULT([${can_compile_fma}])
7048 if test "${can_compile_fma}" = "yes" ; then
7049     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7052 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7053 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7054 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7055 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7056 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7057 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7058 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7059 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7061 dnl ===================================================================
7062 dnl system stl sanity tests
7063 dnl ===================================================================
7064 if test "$_os" != "WINNT"; then
7066     AC_LANG_PUSH([C++])
7068     save_CPPFLAGS="$CPPFLAGS"
7069     if test -n "$MACOSX_SDK_PATH"; then
7070         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7071     fi
7073     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7074     # only.
7075     if test "$CPP_LIBRARY" = GLIBCXX; then
7076         dnl gcc#19664, gcc#22482, rhbz#162935
7077         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7078         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7079         AC_MSG_RESULT([$stlvisok])
7080         if test "$stlvisok" = "no"; then
7081             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7082         fi
7083     fi
7085     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7086     # when we don't make any dynamic libraries?
7087     if test "$DISABLE_DYNLOADING" = ""; then
7088         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7089         cat > conftestlib1.cc <<_ACEOF
7090 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7091 struct S2: S1<int> { virtual ~S2(); };
7092 S2::~S2() {}
7093 _ACEOF
7094         cat > conftestlib2.cc <<_ACEOF
7095 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7096 struct S2: S1<int> { virtual ~S2(); };
7097 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7098 _ACEOF
7099         gccvisinlineshiddenok=yes
7100         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7101             gccvisinlineshiddenok=no
7102         else
7103             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7104             dnl known to not work with -z defs (unsetting which makes the test
7105             dnl moot, though):
7106             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7107             if test "$COM_IS_CLANG" = TRUE; then
7108                 for i in $CXX $CXXFLAGS; do
7109                     case $i in
7110                     -fsanitize=*)
7111                         my_linkflagsnoundefs=
7112                         break
7113                         ;;
7114                     esac
7115                 done
7116             fi
7117             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7118                 gccvisinlineshiddenok=no
7119             fi
7120         fi
7122         rm -fr libconftest*
7123         AC_MSG_RESULT([$gccvisinlineshiddenok])
7124         if test "$gccvisinlineshiddenok" = "no"; then
7125             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7126         fi
7127     fi
7129    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7130     cat >visibility.cxx <<_ACEOF
7131 #pragma GCC visibility push(hidden)
7132 struct __attribute__ ((visibility ("default"))) TestStruct {
7133   static void Init();
7135 __attribute__ ((visibility ("default"))) void TestFunc() {
7136   TestStruct::Init();
7138 _ACEOF
7139     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7140         gccvisbroken=yes
7141     else
7142         case "$host_cpu" in
7143         i?86|x86_64)
7144             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7145                 gccvisbroken=no
7146             else
7147                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7148                     gccvisbroken=no
7149                 else
7150                     gccvisbroken=yes
7151                 fi
7152             fi
7153             ;;
7154         *)
7155             gccvisbroken=no
7156             ;;
7157         esac
7158     fi
7159     rm -f visibility.s visibility.cxx
7161     AC_MSG_RESULT([$gccvisbroken])
7162     if test "$gccvisbroken" = "yes"; then
7163         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7164     fi
7166     CPPFLAGS="$save_CPPFLAGS"
7168     AC_LANG_POP([C++])
7171 dnl ===================================================================
7172 dnl  Clang++ tests
7173 dnl ===================================================================
7175 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7176 if test "$GCC" = "yes"; then
7177     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7178     AC_LANG_PUSH([C++])
7179     save_CXXFLAGS=$CXXFLAGS
7180     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7181     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7182     CXXFLAGS=$save_CXXFLAGS
7183     AC_LANG_POP([C++])
7184     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7185         AC_MSG_RESULT([yes])
7186     else
7187         AC_MSG_RESULT([no])
7188     fi
7190 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7192 dnl ===================================================================
7193 dnl Compiler plugins
7194 dnl ===================================================================
7196 COMPILER_PLUGINS=
7197 # currently only Clang
7199 if test "$COM_IS_CLANG" != "TRUE"; then
7200     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7201         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7202         enable_compiler_plugins=no
7203     fi
7206 COMPILER_PLUGINS_COM_IS_CLANG=
7207 if test "$COM_IS_CLANG" = "TRUE"; then
7208     if test -n "$enable_compiler_plugins"; then
7209         compiler_plugins="$enable_compiler_plugins"
7210     elif test -n "$ENABLE_DBGUTIL"; then
7211         compiler_plugins=test
7212     else
7213         compiler_plugins=no
7214     fi
7215     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7216         if test "$CLANGVER" -lt 50002; then
7217             if test "$compiler_plugins" = yes; then
7218                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7219             else
7220                 compiler_plugins=no
7221             fi
7222         fi
7223     fi
7224     if test "$compiler_plugins" != "no"; then
7225         dnl The prefix where Clang resides, override to where Clang resides if
7226         dnl using a source build:
7227         if test -z "$CLANGDIR"; then
7228             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7229         fi
7230         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7231         if test -z "$COMPILER_PLUGINS_CXX"; then
7232             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7233         fi
7234         clangbindir=$CLANGDIR/bin
7235         if test "$build_os" = "cygwin"; then
7236             clangbindir=$(cygpath -u "$clangbindir")
7237         fi
7238         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7239         if test -n "$LLVM_CONFIG"; then
7240             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7241             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7242             if test -z "$CLANGLIBDIR"; then
7243                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7244             fi
7245             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7246             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7247             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7248             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7249                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7250             fi
7251             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7252             clangobjdir=$($LLVM_CONFIG --obj-root)
7253             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7254                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7255             fi
7256         fi
7257         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7258         AC_LANG_PUSH([C++])
7259         save_CXX=$CXX
7260         save_CXXCPP=$CXXCPP
7261         save_CPPFLAGS=$CPPFLAGS
7262         save_CXXFLAGS=$CXXFLAGS
7263         save_LDFLAGS=$LDFLAGS
7264         save_LIBS=$LIBS
7265         CXX=$COMPILER_PLUGINS_CXX
7266         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7267         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7268         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7269         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7270             [COMPILER_PLUGINS=TRUE],
7271             [
7272             if test "$compiler_plugins" = "yes"; then
7273                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7274             else
7275                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7276                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7277             fi
7278             ])
7279         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7280         dnl comment in compilerplugins/Makefile-clang.mk:
7281         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7282             LDFLAGS=""
7283             AC_MSG_CHECKING([for clang libraries to use])
7284             if test -z "$CLANGTOOLLIBS"; then
7285                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7286  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7287                 AC_LINK_IFELSE([
7288                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7289                         [[ clang::FullSourceLoc().dump(); ]])
7290                 ],[CLANGTOOLLIBS="$LIBS"],[])
7291             fi
7292             if test -z "$CLANGTOOLLIBS"; then
7293                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7294                 AC_LINK_IFELSE([
7295                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7296                         [[ clang::FullSourceLoc().dump(); ]])
7297                 ],[CLANGTOOLLIBS="$LIBS"],[])
7298             fi
7299             AC_MSG_RESULT([$CLANGTOOLLIBS])
7300             if test -z "$CLANGTOOLLIBS"; then
7301                 if test "$compiler_plugins" = "yes"; then
7302                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7303                 else
7304                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7305                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7306                 fi
7307                 COMPILER_PLUGINS=
7308             fi
7309             if test -n "$COMPILER_PLUGINS"; then
7310                 if test -z "$CLANGSYSINCLUDE"; then
7311                     if test -n "$LLVM_CONFIG"; then
7312                         # Path to the clang system headers (no idea if there's a better way to get it).
7313                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7314                     fi
7315                 fi
7316             fi
7317         fi
7318         CXX=$save_CXX
7319         CXXCPP=$save_CXXCPP
7320         CPPFLAGS=$save_CPPFLAGS
7321         CXXFLAGS=$save_CXXFLAGS
7322         LDFLAGS=$save_LDFLAGS
7323         LIBS="$save_LIBS"
7324         AC_LANG_POP([C++])
7326         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7327         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7328             #ifndef __clang__
7329             you lose
7330             #endif
7331             int foo=42;
7332             ]])],
7333             [AC_MSG_RESULT([yes])
7334              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7335             [AC_MSG_RESULT([no])])
7336         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7337     fi
7338 else
7339     if test "$enable_compiler_plugins" = "yes"; then
7340         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7341     fi
7343 COMPILER_PLUGINS_ANALYZER_PCH=
7344 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7345     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7347 AC_SUBST(COMPILER_PLUGINS)
7348 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7349 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7350 AC_SUBST(COMPILER_PLUGINS_CXX)
7351 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7352 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7353 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7354 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7355 AC_SUBST(CLANGDIR)
7356 AC_SUBST(CLANGLIBDIR)
7357 AC_SUBST(CLANGTOOLLIBS)
7358 AC_SUBST(CLANGSYSINCLUDE)
7360 # Plugin to help linker.
7361 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7362 # This makes --enable-lto build with clang work.
7363 AC_SUBST(LD_PLUGIN)
7365 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7366 AC_SUBST(HAVE_POSIX_FALLOCATE)
7368 dnl ===================================================================
7369 dnl Custom build version
7370 dnl ===================================================================
7372 AC_MSG_CHECKING([whether to add custom build version])
7373 if test "$with_build_version" != ""; then
7374     BUILD_VER_STRING=$with_build_version
7375     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7376 else
7377     BUILD_VER_STRING=
7378     AC_MSG_RESULT([no])
7380 AC_SUBST(BUILD_VER_STRING)
7382 JITC_PROCESSOR_TYPE=""
7383 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7384     # IBMs JDK needs this...
7385     JITC_PROCESSOR_TYPE=6
7386     export JITC_PROCESSOR_TYPE
7388 AC_SUBST([JITC_PROCESSOR_TYPE])
7390 # Misc Windows Stuff
7391 AC_ARG_WITH(ucrt-dir,
7392     AS_HELP_STRING([--with-ucrt-dir],
7393         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7394         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7395         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7396             Windows6.1-KB2999226-x64.msu
7397             Windows6.1-KB2999226-x86.msu
7398             Windows8.1-KB2999226-x64.msu
7399             Windows8.1-KB2999226-x86.msu
7400             Windows8-RT-KB2999226-x64.msu
7401             Windows8-RT-KB2999226-x86.msu
7402         A zip archive including those files is available from Microsoft site:
7403         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7405 UCRT_REDISTDIR="$with_ucrt_dir"
7406 if test $_os = "WINNT"; then
7407     find_msvc_x64_dlls
7408     find_msms
7409     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7410     MSVC_DLLS="$msvcdlls"
7411     MSM_PATH=`win_short_path_for_make "$msmdir"`
7412     # MSVC 15.3 changed it to VC141
7413     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7414         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7415     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7416         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7417     else
7418         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7419     fi
7421     if test "$UCRT_REDISTDIR" = "no"; then
7422         dnl explicitly disabled
7423         UCRT_REDISTDIR=""
7424     else
7425         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7426                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7427                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7428                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7429                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7430                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7431             UCRT_REDISTDIR=""
7432             if test -n "$PKGFORMAT"; then
7433                for i in $PKGFORMAT; do
7434                    case "$i" in
7435                    msi)
7436                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7437                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7438                        ;;
7439                    esac
7440                done
7441             fi
7442         fi
7443     fi
7446 AC_SUBST(UCRT_REDISTDIR)
7447 AC_SUBST(MSVC_DLL_PATH)
7448 AC_SUBST(MSVC_DLLS)
7449 AC_SUBST(MSM_PATH)
7451 dnl ===================================================================
7452 dnl Checks for Java
7453 dnl ===================================================================
7454 if test "$ENABLE_JAVA" != ""; then
7456     # Windows-specific tests
7457     if test "$build_os" = "cygwin"; then
7458         if test "$BITNESS_OVERRIDE" = 64; then
7459             bitness=64
7460         else
7461             bitness=32
7462         fi
7464         if test -z "$with_jdk_home"; then
7465             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7466             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7467             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7468             if test -n "$regvalue"; then
7469                 ver=$regvalue
7470                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7471                 _jdk_home=$regvalue
7472             fi
7473             if test -z "$with_jdk_home"; then
7474                 for ver in 1.8; do
7475                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7476                     if test -n "$regvalue"; then
7477                         _jdk_home=$regvalue
7478                         break
7479                     fi
7480                 done
7481             fi
7482             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7483                 with_jdk_home="$_jdk_home"
7484                 howfound="found automatically"
7485             else
7486                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7487             fi
7488         else
7489             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7490             howfound="you passed"
7491         fi
7492     fi
7494     # 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.
7495     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7496     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7497         with_jdk_home=`/usr/libexec/java_home`
7498     fi
7500     JAVA_HOME=; export JAVA_HOME
7501     if test -z "$with_jdk_home"; then
7502         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7503     else
7504         _java_path="$with_jdk_home/bin/$with_java"
7505         dnl Check if there is a Java interpreter at all.
7506         if test -x "$_java_path"; then
7507             JAVAINTERPRETER=$_java_path
7508         else
7509             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7510         fi
7511     fi
7513     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7514     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7515     dnl loaded by java to run JunitTests:
7516     if test "$build_os" = "cygwin"; then
7517         shortjdkhome=`cygpath -d "$with_jdk_home"`
7518         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
7519             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7520             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7521         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
7522             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7523             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7524         fi
7526         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7527             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7528         fi
7529         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7530     elif test "$cross_compiling" != "yes"; then
7531         case $CPUNAME in
7532             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7533                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7534                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7535                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7536                 fi
7537                 ;;
7538             *) # assumption: everything else 32-bit
7539                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7540                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7541                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7542                 fi
7543                 ;;
7544         esac
7545     fi
7548 dnl ===================================================================
7549 dnl Checks for JDK.
7550 dnl ===================================================================
7552 # Note that JAVA_HOME as for now always means the *build* platform's
7553 # JAVA_HOME. Whether all the complexity here actually is needed any
7554 # more or not, no idea.
7556 if test "$ENABLE_JAVA" != ""; then
7557     _gij_longver=0
7558     AC_MSG_CHECKING([the installed JDK])
7559     if test -n "$JAVAINTERPRETER"; then
7560         dnl java -version sends output to stderr!
7561         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7562             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7563         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7564             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7565         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7566             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7567         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7568             JDK=ibm
7570             dnl IBM JDK specific tests
7571             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7572             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7574             if test "$_jdk_ver" -lt 10800; then
7575                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7576             fi
7578             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7580             if test "$with_jdk_home" = ""; then
7581                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7582 you must use the "--with-jdk-home" configure option explicitly])
7583             fi
7585             JAVA_HOME=$with_jdk_home
7586         else
7587             JDK=sun
7589             dnl Sun JDK specific tests
7590             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7591             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7593             if test "$_jdk_ver" -lt 10800; then
7594                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7595             fi
7596             if test "$_jdk_ver" -gt 10800; then
7597                 JAVA_CLASSPATH_NOT_SET=TRUE
7598             fi
7600             AC_MSG_RESULT([found (JDK $_jdk)])
7601             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7602             if test "$_os" = "WINNT"; then
7603                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7604             fi
7606             # set to limit VM usage for JunitTests
7607             JAVAIFLAGS=-Xmx64M
7608             # set to limit VM usage for javac
7609             JAVAFLAGS=-J-Xmx128M
7610         fi
7611     else
7612         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7613     fi
7614 else
7615     dnl Java disabled
7616     JAVA_HOME=
7617     export JAVA_HOME
7620 dnl ===================================================================
7621 dnl Checks for javac
7622 dnl ===================================================================
7623 if test "$ENABLE_JAVA" != ""; then
7624     javacompiler="javac"
7625     : ${JAVA_SOURCE_VER=8}
7626     : ${JAVA_TARGET_VER=8}
7627     if test -z "$with_jdk_home"; then
7628         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7629     else
7630         _javac_path="$with_jdk_home/bin/$javacompiler"
7631         dnl Check if there is a Java compiler at all.
7632         if test -x "$_javac_path"; then
7633             JAVACOMPILER=$_javac_path
7634         fi
7635     fi
7636     if test -z "$JAVACOMPILER"; then
7637         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7638     fi
7639     if test "$build_os" = "cygwin"; then
7640         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7641             JAVACOMPILER="${JAVACOMPILER}.exe"
7642         fi
7643         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7644     fi
7647 dnl ===================================================================
7648 dnl Checks for javadoc
7649 dnl ===================================================================
7650 if test "$ENABLE_JAVA" != ""; then
7651     if test -z "$with_jdk_home"; then
7652         AC_PATH_PROG(JAVADOC, javadoc)
7653     else
7654         _javadoc_path="$with_jdk_home/bin/javadoc"
7655         dnl Check if there is a javadoc at all.
7656         if test -x "$_javadoc_path"; then
7657             JAVADOC=$_javadoc_path
7658         else
7659             AC_PATH_PROG(JAVADOC, javadoc)
7660         fi
7661     fi
7662     if test -z "$JAVADOC"; then
7663         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7664     fi
7665     if test "$build_os" = "cygwin"; then
7666         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7667             JAVADOC="${JAVADOC}.exe"
7668         fi
7669         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7670     fi
7672     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7673     JAVADOCISGJDOC="yes"
7674     fi
7676 AC_SUBST(JAVADOCISGJDOC)
7678 if test "$ENABLE_JAVA" != ""; then
7679     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7680     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7681         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7682            # try to recover first by looking whether we have an alternative
7683            # system as in Debian or newer SuSEs where following /usr/bin/javac
7684            # over /etc/alternatives/javac leads to the right bindir where we
7685            # just need to strip a bit away to get a valid JAVA_HOME
7686            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7687         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7688             # maybe only one level of symlink (e.g. on Mac)
7689             JAVA_HOME=$(readlink $JAVACOMPILER)
7690             if test "$(dirname $JAVA_HOME)" = "."; then
7691                 # we've got no path to trim back
7692                 JAVA_HOME=""
7693             fi
7694         else
7695             # else warn
7696             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7697             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7698             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7699             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7700         fi
7701         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7702         if test "$JAVA_HOME" != "/usr"; then
7703             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7704                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7705                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7706                 dnl Tiger already returns a JDK path...
7707                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7708             else
7709                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7710                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7711                 dnl that checks which version to run
7712                 if test -f "$JAVA_HOME"; then
7713                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7714                 fi
7715             fi
7716         fi
7717     fi
7718     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7720     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7721     if test -z "$JAVA_HOME"; then
7722         if test "x$with_jdk_home" = "x"; then
7723             cat > findhome.java <<_ACEOF
7724 [import java.io.File;
7726 class findhome
7728     public static void main(String args[])
7729     {
7730         String jrelocation = System.getProperty("java.home");
7731         File jre = new File(jrelocation);
7732         System.out.println(jre.getParent());
7733     }
7735 _ACEOF
7736             AC_MSG_CHECKING([if javac works])
7737             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7738             AC_TRY_EVAL(javac_cmd)
7739             if test $? = 0 -a -f ./findhome.class; then
7740                 AC_MSG_RESULT([javac works])
7741             else
7742                 echo "configure: javac test failed" >&5
7743                 cat findhome.java >&5
7744                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7745             fi
7746             AC_MSG_CHECKING([if gij knows its java.home])
7747             JAVA_HOME=`$JAVAINTERPRETER findhome`
7748             if test $? = 0 -a "$JAVA_HOME" != ""; then
7749                 AC_MSG_RESULT([$JAVA_HOME])
7750             else
7751                 echo "configure: java test failed" >&5
7752                 cat findhome.java >&5
7753                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7754             fi
7755             # clean-up after ourselves
7756             rm -f ./findhome.java ./findhome.class
7757         else
7758             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7759         fi
7760     fi
7762     # now check if $JAVA_HOME is really valid
7763     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7764         case "${JAVA_HOME}" in
7765             /Library/Java/JavaVirtualMachines/*)
7766                 ;;
7767             *)
7768                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7769                 ;;
7770         esac
7771         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7772             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7773             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7774             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7775             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7776             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7777             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7778         fi
7779     fi
7780     PathFormat "$JAVA_HOME"
7781     JAVA_HOME="$formatted_path"
7784 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7785     "$_os" != Darwin
7786 then
7787     AC_MSG_CHECKING([for JAWT lib])
7788     if test "$_os" = WINNT; then
7789         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7790         JAWTLIB=jawt.lib
7791     else
7792         case "$host_cpu" in
7793         arm*)
7794             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7795             JAVA_ARCH=$my_java_arch
7796             ;;
7797         i*86)
7798             my_java_arch=i386
7799             ;;
7800         m68k)
7801             my_java_arch=m68k
7802             ;;
7803         powerpc)
7804             my_java_arch=ppc
7805             ;;
7806         powerpc64)
7807             my_java_arch=ppc64
7808             ;;
7809         powerpc64le)
7810             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7811             JAVA_ARCH=$my_java_arch
7812             ;;
7813         sparc64)
7814             my_java_arch=sparcv9
7815             ;;
7816         x86_64)
7817             my_java_arch=amd64
7818             ;;
7819         *)
7820             my_java_arch=$host_cpu
7821             ;;
7822         esac
7823         # This is where JDK9 puts the library
7824         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7825             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7826         else
7827             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7828         fi
7829         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7830     fi
7831     AC_MSG_RESULT([$JAWTLIB])
7833 AC_SUBST(JAWTLIB)
7835 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7836     case "$host_os" in
7838     aix*)
7839         JAVAINC="-I$JAVA_HOME/include"
7840         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7841         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7842         ;;
7844     cygwin*)
7845         JAVAINC="-I$JAVA_HOME/include/win32"
7846         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7847         ;;
7849     darwin*)
7850         if test -d "$JAVA_HOME/include/darwin"; then
7851             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7852         else
7853             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7854         fi
7855         ;;
7857     dragonfly*)
7858         JAVAINC="-I$JAVA_HOME/include"
7859         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7860         ;;
7862     freebsd*)
7863         JAVAINC="-I$JAVA_HOME/include"
7864         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7865         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7866         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7867         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7868         ;;
7870     k*bsd*-gnu*)
7871         JAVAINC="-I$JAVA_HOME/include"
7872         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7873         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7874         ;;
7876     linux-gnu*)
7877         JAVAINC="-I$JAVA_HOME/include"
7878         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7879         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7880         ;;
7882     *netbsd*)
7883         JAVAINC="-I$JAVA_HOME/include"
7884         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7885         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7886        ;;
7888     openbsd*)
7889         JAVAINC="-I$JAVA_HOME/include"
7890         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7891         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7892         ;;
7894     solaris*)
7895         JAVAINC="-I$JAVA_HOME/include"
7896         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7897         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7898         ;;
7899     esac
7901 SOLARINC="$SOLARINC $JAVAINC"
7903 AC_SUBST(JAVACOMPILER)
7904 AC_SUBST(JAVADOC)
7905 AC_SUBST(JAVAINTERPRETER)
7906 AC_SUBST(JAVAIFLAGS)
7907 AC_SUBST(JAVAFLAGS)
7908 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7909 AC_SUBST(JAVA_HOME)
7910 AC_SUBST(JAVA_SOURCE_VER)
7911 AC_SUBST(JAVA_TARGET_VER)
7912 AC_SUBST(JDK)
7915 dnl ===================================================================
7916 dnl Export file validation
7917 dnl ===================================================================
7918 AC_MSG_CHECKING([whether to enable export file validation])
7919 if test "$with_export_validation" != "no"; then
7920     if test -z "$ENABLE_JAVA"; then
7921         if test "$with_export_validation" = "yes"; then
7922             AC_MSG_ERROR([requested, but Java is disabled])
7923         else
7924             AC_MSG_RESULT([no, as Java is disabled])
7925         fi
7926     elif ! test -d "${SRC_ROOT}/schema"; then
7927         if test "$with_export_validation" = "yes"; then
7928             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7929         else
7930             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7931         fi
7932     else
7933         AC_MSG_RESULT([yes])
7934         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7936         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7937         if test -z "$ODFVALIDATOR"; then
7938             # remember to download the ODF toolkit with validator later
7939             AC_MSG_NOTICE([no odfvalidator found, will download it])
7940             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7941             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7943             # and fetch name of odfvalidator jar name from download.lst
7944             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7945             AC_SUBST(ODFVALIDATOR_JAR)
7947             if test -z "$ODFVALIDATOR_JAR"; then
7948                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7949             fi
7950         fi
7951         if test "$build_os" = "cygwin"; then
7952             # In case of Cygwin it will be executed from Windows,
7953             # so we need to run bash and absolute path to validator
7954             # so instead of "odfvalidator" it will be
7955             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7956             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7957         else
7958             ODFVALIDATOR="sh $ODFVALIDATOR"
7959         fi
7960         AC_SUBST(ODFVALIDATOR)
7963         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7964         if test -z "$OFFICEOTRON"; then
7965             # remember to download the officeotron with validator later
7966             AC_MSG_NOTICE([no officeotron found, will download it])
7967             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7968             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7970             # and fetch name of officeotron jar name from download.lst
7971             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7972             AC_SUBST(OFFICEOTRON_JAR)
7974             if test -z "$OFFICEOTRON_JAR"; then
7975                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7976             fi
7977         else
7978             # check version of existing officeotron
7979             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7980             if test 0"$OFFICEOTRON_VER" -lt 704; then
7981                 AC_MSG_ERROR([officeotron too old])
7982             fi
7983         fi
7984         if test "$build_os" = "cygwin"; then
7985             # In case of Cygwin it will be executed from Windows,
7986             # so we need to run bash and absolute path to validator
7987             # so instead of "odfvalidator" it will be
7988             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7989             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7990         else
7991             OFFICEOTRON="sh $OFFICEOTRON"
7992         fi
7993     fi
7994     AC_SUBST(OFFICEOTRON)
7995 else
7996     AC_MSG_RESULT([no])
7999 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8000 if test "$with_bffvalidator" != "no"; then
8001     AC_DEFINE(HAVE_BFFVALIDATOR)
8003     if test "$with_export_validation" = "no"; then
8004         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8005     fi
8007     if test "$with_bffvalidator" = "yes"; then
8008         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8009     else
8010         BFFVALIDATOR="$with_bffvalidator"
8011     fi
8013     if test "$build_os" = "cygwin"; then
8014         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8015             AC_MSG_RESULT($BFFVALIDATOR)
8016         else
8017             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8018         fi
8019     elif test -n "$BFFVALIDATOR"; then
8020         # We are not in Cygwin but need to run Windows binary with wine
8021         AC_PATH_PROGS(WINE, wine)
8023         # so swap in a shell wrapper that converts paths transparently
8024         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8025         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8026         AC_SUBST(BFFVALIDATOR_EXE)
8027         AC_MSG_RESULT($BFFVALIDATOR)
8028     else
8029         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8030     fi
8031     AC_SUBST(BFFVALIDATOR)
8032 else
8033     AC_MSG_RESULT([no])
8036 dnl ===================================================================
8037 dnl Check for C preprocessor to use
8038 dnl ===================================================================
8039 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8040 if test -n "$with_idlc_cpp"; then
8041     AC_MSG_RESULT([$with_idlc_cpp])
8042     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8043 else
8044     AC_MSG_RESULT([ucpp])
8045     AC_MSG_CHECKING([which ucpp tp use])
8046     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8047         AC_MSG_RESULT([external])
8048         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8049     else
8050         AC_MSG_RESULT([internal])
8051         BUILD_TYPE="$BUILD_TYPE UCPP"
8052     fi
8054 AC_SUBST(SYSTEM_UCPP)
8056 dnl ===================================================================
8057 dnl Check for epm (not needed for Windows)
8058 dnl ===================================================================
8059 AC_MSG_CHECKING([whether to enable EPM for packing])
8060 if test "$enable_epm" = "yes"; then
8061     AC_MSG_RESULT([yes])
8062     if test "$_os" != "WINNT"; then
8063         if test $_os = Darwin; then
8064             EPM=internal
8065         elif test -n "$with_epm"; then
8066             EPM=$with_epm
8067         else
8068             AC_PATH_PROG(EPM, epm, no)
8069         fi
8070         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8071             AC_MSG_NOTICE([EPM will be built.])
8072             BUILD_TYPE="$BUILD_TYPE EPM"
8073             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8074         else
8075             # Gentoo has some epm which is something different...
8076             AC_MSG_CHECKING([whether the found epm is the right epm])
8077             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8078                 AC_MSG_RESULT([yes])
8079             else
8080                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8081             fi
8082             AC_MSG_CHECKING([epm version])
8083             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8084             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8085                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8086                 AC_MSG_RESULT([OK, >= 3.7])
8087             else
8088                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8089                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8090             fi
8091         fi
8092     fi
8094     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8095         AC_MSG_CHECKING([for rpm])
8096         for a in "$RPM" rpmbuild rpm; do
8097             $a --usage >/dev/null 2> /dev/null
8098             if test $? -eq 0; then
8099                 RPM=$a
8100                 break
8101             else
8102                 $a --version >/dev/null 2> /dev/null
8103                 if test $? -eq 0; then
8104                     RPM=$a
8105                     break
8106                 fi
8107             fi
8108         done
8109         if test -z "$RPM"; then
8110             AC_MSG_ERROR([not found])
8111         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8112             RPM_PATH=`which $RPM`
8113             AC_MSG_RESULT([$RPM_PATH])
8114             SCPDEFS="$SCPDEFS -DWITH_RPM"
8115         else
8116             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8117         fi
8118     fi
8119     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8120         AC_PATH_PROG(DPKG, dpkg, no)
8121         if test "$DPKG" = "no"; then
8122             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8123         fi
8124     fi
8125     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8126        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8127         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8128             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8129                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8130                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8131                     AC_MSG_RESULT([yes])
8132                 else
8133                     AC_MSG_RESULT([no])
8134                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8135                         _pt="rpm"
8136                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8137                         add_warning "the rpms will need to be installed with --nodeps"
8138                     else
8139                         _pt="pkg"
8140                     fi
8141                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8142                     add_warning "the ${_pt}s will not be relocatable"
8143                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8144                                  relocation will work, you need to patch your epm with the
8145                                  patch in epm/epm-3.7.patch or build with
8146                                  --with-epm=internal which will build a suitable epm])
8147                 fi
8148             fi
8149         fi
8150     fi
8151     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8152         AC_PATH_PROG(PKGMK, pkgmk, no)
8153         if test "$PKGMK" = "no"; then
8154             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8155         fi
8156     fi
8157     AC_SUBST(RPM)
8158     AC_SUBST(DPKG)
8159     AC_SUBST(PKGMK)
8160 else
8161     for i in $PKGFORMAT; do
8162         case "$i" in
8163         aix | bsd | deb | pkg | rpm | native | portable)
8164             AC_MSG_ERROR(
8165                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8166             ;;
8167         esac
8168     done
8169     AC_MSG_RESULT([no])
8170     EPM=NO
8172 AC_SUBST(EPM)
8174 ENABLE_LWP=
8175 if test "$enable_lotuswordpro" = "yes"; then
8176     ENABLE_LWP="TRUE"
8178 AC_SUBST(ENABLE_LWP)
8180 dnl ===================================================================
8181 dnl Check for building ODK
8182 dnl ===================================================================
8183 if test "$enable_odk" = no; then
8184     unset DOXYGEN
8185 else
8186     if test "$with_doxygen" = no; then
8187         AC_MSG_CHECKING([for doxygen])
8188         unset DOXYGEN
8189         AC_MSG_RESULT([no])
8190     else
8191         if test "$with_doxygen" = yes; then
8192             AC_PATH_PROG([DOXYGEN], [doxygen])
8193             if test -z "$DOXYGEN"; then
8194                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8195             fi
8196             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8197                 if ! dot -V 2>/dev/null; then
8198                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8199                 fi
8200             fi
8201         else
8202             AC_MSG_CHECKING([for doxygen])
8203             DOXYGEN=$with_doxygen
8204             AC_MSG_RESULT([$DOXYGEN])
8205         fi
8206         if test -n "$DOXYGEN"; then
8207             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8208             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8209             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8210                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8211             fi
8212         fi
8213     fi
8215 AC_SUBST([DOXYGEN])
8217 AC_MSG_CHECKING([whether to build the ODK])
8218 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8219     AC_MSG_RESULT([yes])
8221     if test "$with_java" != "no"; then
8222         AC_MSG_CHECKING([whether to build unowinreg.dll])
8223         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8224             # build on Win by default
8225             enable_build_unowinreg=yes
8226         fi
8227         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8228             AC_MSG_RESULT([no])
8229             BUILD_UNOWINREG=
8230         else
8231             AC_MSG_RESULT([yes])
8232             BUILD_UNOWINREG=TRUE
8233         fi
8234         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8235             if test -z "$with_mingw_cross_compiler"; then
8236                 dnl Guess...
8237                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8238             elif test -x "$with_mingw_cross_compiler"; then
8239                  MINGWCXX="$with_mingw_cross_compiler"
8240             else
8241                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8242             fi
8244             if test "$MINGWCXX" = "false"; then
8245                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8246             fi
8248             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8249             if test -x "$mingwstrip_test"; then
8250                 MINGWSTRIP="$mingwstrip_test"
8251             else
8252                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8253             fi
8255             if test "$MINGWSTRIP" = "false"; then
8256                 AC_MSG_ERROR(MinGW32 binutils not found.)
8257             fi
8258         fi
8259     fi
8260     BUILD_TYPE="$BUILD_TYPE ODK"
8261 else
8262     AC_MSG_RESULT([no])
8263     BUILD_UNOWINREG=
8265 AC_SUBST(BUILD_UNOWINREG)
8266 AC_SUBST(MINGWCXX)
8267 AC_SUBST(MINGWSTRIP)
8269 dnl ===================================================================
8270 dnl Check for system zlib
8271 dnl ===================================================================
8272 if test "$with_system_zlib" = "auto"; then
8273     case "$_os" in
8274     WINNT)
8275         with_system_zlib="$with_system_libs"
8276         ;;
8277     *)
8278         if test "$enable_fuzzers" != "yes"; then
8279             with_system_zlib=yes
8280         else
8281             with_system_zlib=no
8282         fi
8283         ;;
8284     esac
8287 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8288 dnl and has no pkg-config for it at least on some tinderboxes,
8289 dnl so leaving that out for now
8290 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8291 AC_MSG_CHECKING([which zlib to use])
8292 if test "$with_system_zlib" = "yes"; then
8293     AC_MSG_RESULT([external])
8294     SYSTEM_ZLIB=TRUE
8295     AC_CHECK_HEADER(zlib.h, [],
8296         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8297     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8298         [AC_MSG_ERROR(zlib not found or functional)], [])
8299 else
8300     AC_MSG_RESULT([internal])
8301     SYSTEM_ZLIB=
8302     BUILD_TYPE="$BUILD_TYPE ZLIB"
8303     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8304     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8306 AC_SUBST(ZLIB_CFLAGS)
8307 AC_SUBST(ZLIB_LIBS)
8308 AC_SUBST(SYSTEM_ZLIB)
8310 dnl ===================================================================
8311 dnl Check for system jpeg
8312 dnl ===================================================================
8313 AC_MSG_CHECKING([which libjpeg to use])
8314 if test "$with_system_jpeg" = "yes"; then
8315     AC_MSG_RESULT([external])
8316     SYSTEM_LIBJPEG=TRUE
8317     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8318         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8319     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8320         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8321 else
8322     SYSTEM_LIBJPEG=
8323     AC_MSG_RESULT([internal, libjpeg-turbo])
8324     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8325     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8326     if test "$COM" = "MSC"; then
8327         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8328     else
8329         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8330     fi
8332     case "$host_cpu" in
8333     x86_64 | amd64 | i*86 | x86 | ia32)
8334         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8335         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8336             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8337                 NASM="$LODE_HOME/opt/bin/nasm"
8338             elif test -x "/opt/lo/bin/nasm"; then
8339                 NASM="/opt/lo/bin/nasm"
8340             fi
8341         fi
8343         if test -n "$NASM"; then
8344             AC_MSG_CHECKING([for object file format of host system])
8345             case "$host_os" in
8346               cygwin* | mingw* | pw32* | interix*)
8347                 case "$host_cpu" in
8348                   x86_64)
8349                     objfmt='Win64-COFF'
8350                     ;;
8351                   *)
8352                     objfmt='Win32-COFF'
8353                     ;;
8354                 esac
8355               ;;
8356               msdosdjgpp* | go32*)
8357                 objfmt='COFF'
8358               ;;
8359               os2-emx*) # not tested
8360                 objfmt='MSOMF' # obj
8361               ;;
8362               linux*coff* | linux*oldld*)
8363                 objfmt='COFF' # ???
8364               ;;
8365               linux*aout*)
8366                 objfmt='a.out'
8367               ;;
8368               linux*)
8369                 case "$host_cpu" in
8370                   x86_64)
8371                     objfmt='ELF64'
8372                     ;;
8373                   *)
8374                     objfmt='ELF'
8375                     ;;
8376                 esac
8377               ;;
8378               kfreebsd* | freebsd* | netbsd* | openbsd*)
8379                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8380                   objfmt='BSD-a.out'
8381                 else
8382                   case "$host_cpu" in
8383                     x86_64 | amd64)
8384                       objfmt='ELF64'
8385                       ;;
8386                     *)
8387                       objfmt='ELF'
8388                       ;;
8389                   esac
8390                 fi
8391               ;;
8392               solaris* | sunos* | sysv* | sco*)
8393                 case "$host_cpu" in
8394                   x86_64)
8395                     objfmt='ELF64'
8396                     ;;
8397                   *)
8398                     objfmt='ELF'
8399                     ;;
8400                 esac
8401               ;;
8402               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8403                 case "$host_cpu" in
8404                   x86_64)
8405                     objfmt='Mach-O64'
8406                     ;;
8407                   *)
8408                     objfmt='Mach-O'
8409                     ;;
8410                 esac
8411               ;;
8412               *)
8413                 objfmt='ELF ?'
8414               ;;
8415             esac
8417             AC_MSG_RESULT([$objfmt])
8418             if test "$objfmt" = 'ELF ?'; then
8419               objfmt='ELF'
8420               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8421             fi
8423             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8424             case "$objfmt" in
8425               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8426               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8427               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8428               COFF)       NAFLAGS='-fcoff -DCOFF';;
8429               a.out)      NAFLAGS='-faout -DAOUT';;
8430               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8431               ELF)        NAFLAGS='-felf -DELF';;
8432               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8433               RDF)        NAFLAGS='-frdf -DRDF';;
8434               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8435               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8436             esac
8437             AC_MSG_RESULT([$NAFLAGS])
8439             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8440             cat > conftest.asm << EOF
8441             [%line __oline__ "configure"
8442                     section .text
8443                     global  _main,main
8444             _main:
8445             main:   xor     eax,eax
8446                     ret
8447             ]
8449             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8450             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8451               AC_MSG_RESULT(yes)
8452             else
8453               echo "configure: failed program was:" >&AC_FD_CC
8454               cat conftest.asm >&AC_FD_CC
8455               rm -rf conftest*
8456               AC_MSG_RESULT(no)
8457               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8458               NASM=""
8459             fi
8461         fi
8463         if test -z "$NASM"; then
8464 cat << _EOS
8465 ****************************************************************************
8466 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8467 To get one please:
8469 _EOS
8470             if test "$build_os" = "cygwin"; then
8471 cat << _EOS
8472 install a pre-compiled binary for Win32
8474 mkdir -p /opt/lo/bin
8475 cd /opt/lo/bin
8476 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8477 chmod +x nasm
8479 or get and install one from http://www.nasm.us/
8481 Then re-run autogen.sh
8483 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8484 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8486 _EOS
8487             else
8488 cat << _EOS
8489 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8491 _EOS
8492             fi
8493             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8494             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8495         fi
8496       ;;
8497     esac
8500 AC_SUBST(NASM)
8501 AC_SUBST(LIBJPEG_CFLAGS)
8502 AC_SUBST(LIBJPEG_LIBS)
8503 AC_SUBST(SYSTEM_LIBJPEG)
8505 dnl ===================================================================
8506 dnl Check for system clucene
8507 dnl ===================================================================
8508 dnl we should rather be using
8509 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8510 dnl but the contribs-lib check seems tricky
8511 AC_MSG_CHECKING([which clucene to use])
8512 if test "$with_system_clucene" = "yes"; then
8513     AC_MSG_RESULT([external])
8514     SYSTEM_CLUCENE=TRUE
8515     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8516     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8517     FilterLibs "${CLUCENE_LIBS}"
8518     CLUCENE_LIBS="${filteredlibs}"
8519     AC_LANG_PUSH([C++])
8520     save_CXXFLAGS=$CXXFLAGS
8521     save_CPPFLAGS=$CPPFLAGS
8522     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8523     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8524     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8525     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8526     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8527                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8528     CXXFLAGS=$save_CXXFLAGS
8529     CPPFLAGS=$save_CPPFLAGS
8530     AC_LANG_POP([C++])
8532     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8533 else
8534     AC_MSG_RESULT([internal])
8535     SYSTEM_CLUCENE=
8536     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8538 AC_SUBST(SYSTEM_CLUCENE)
8539 AC_SUBST(CLUCENE_CFLAGS)
8540 AC_SUBST(CLUCENE_LIBS)
8542 dnl ===================================================================
8543 dnl Check for system expat
8544 dnl ===================================================================
8545 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8547 dnl ===================================================================
8548 dnl Check for system xmlsec
8549 dnl ===================================================================
8550 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8552 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8553 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8554     ENABLE_EOT="TRUE"
8555     AC_DEFINE([ENABLE_EOT])
8556     AC_MSG_RESULT([yes])
8558     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8559 else
8560     ENABLE_EOT=
8561     AC_MSG_RESULT([no])
8563 AC_SUBST([ENABLE_EOT])
8565 dnl ===================================================================
8566 dnl Check for DLP libs
8567 dnl ===================================================================
8568 AS_IF([test "$COM" = "MSC"],
8569       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8570       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8572 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8574 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8576 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8578 AS_IF([test "$COM" = "MSC"],
8579       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8580       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8582 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8584 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8586 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8587 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8589 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8591 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8593 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8595 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8596 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8598 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8599 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8601 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8603 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8604 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8606 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8608 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8610 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8612 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8614 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8615 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8617 dnl ===================================================================
8618 dnl Check for system lcms2
8619 dnl ===================================================================
8620 if test "$with_system_lcms2" != "yes"; then
8621     SYSTEM_LCMS2=
8623 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8624 if test "$GCC" = "yes"; then
8625     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8627 if test "$COM" = "MSC"; then # override the above
8628     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8631 dnl ===================================================================
8632 dnl Check for system cppunit
8633 dnl ===================================================================
8634 if test "$_os" != "Android" ; then
8635     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8638 dnl ===================================================================
8639 dnl Check whether freetype is available
8640 dnl ===================================================================
8641 if test  "$test_freetype" = "yes"; then
8642     AC_MSG_CHECKING([whether freetype is available])
8643     # FreeType has 3 different kinds of versions
8644     # * release, like 2.4.10
8645     # * libtool, like 13.0.7 (this what pkg-config returns)
8646     # * soname
8647     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8648     #
8649     # 9.9.3 is 2.2.0
8650     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8651     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8652     FilterLibs "${FREETYPE_LIBS}"
8653     FREETYPE_LIBS="${filteredlibs}"
8654     SYSTEM_FREETYPE=TRUE
8655 else
8656     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8657     if test "x$ac_config_site_64bit_host" = xYES; then
8658         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8659     else
8660         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8661     fi
8663 AC_SUBST(FREETYPE_CFLAGS)
8664 AC_SUBST(FREETYPE_LIBS)
8665 AC_SUBST([SYSTEM_FREETYPE])
8667 # ===================================================================
8668 # Check for system libxslt
8669 # to prevent incompatibilities between internal libxml2 and external libxslt,
8670 # or vice versa, use with_system_libxml here
8671 # ===================================================================
8672 if test "$with_system_libxml" = "auto"; then
8673     case "$_os" in
8674     WINNT|iOS|Android)
8675         with_system_libxml="$with_system_libs"
8676         ;;
8677     *)
8678         if test "$enable_fuzzers" != "yes"; then
8679             with_system_libxml=yes
8680         else
8681             with_system_libxml=no
8682         fi
8683         ;;
8684     esac
8687 AC_MSG_CHECKING([which libxslt to use])
8688 if test "$with_system_libxml" = "yes"; then
8689     AC_MSG_RESULT([external])
8690     SYSTEM_LIBXSLT=TRUE
8691     if test "$_os" = "Darwin"; then
8692         dnl make sure to use SDK path
8693         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8694         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8695         dnl omit -L/usr/lib
8696         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8697         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8698     else
8699         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8700         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8701         FilterLibs "${LIBXSLT_LIBS}"
8702         LIBXSLT_LIBS="${filteredlibs}"
8703         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8704         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8705         FilterLibs "${LIBEXSLT_LIBS}"
8706         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8707     fi
8709     dnl Check for xsltproc
8710     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8711     if test "$XSLTPROC" = "no"; then
8712         AC_MSG_ERROR([xsltproc is required])
8713     fi
8714 else
8715     AC_MSG_RESULT([internal])
8716     SYSTEM_LIBXSLT=
8717     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8719     if test "$cross_compiling" = "yes"; then
8720         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8721         if test "$XSLTPROC" = "no"; then
8722             AC_MSG_ERROR([xsltproc is required])
8723         fi
8724     fi
8726 AC_SUBST(SYSTEM_LIBXSLT)
8727 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8728     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8730 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8732 AC_SUBST(LIBEXSLT_CFLAGS)
8733 AC_SUBST(LIBEXSLT_LIBS)
8734 AC_SUBST(LIBXSLT_CFLAGS)
8735 AC_SUBST(LIBXSLT_LIBS)
8736 AC_SUBST(XSLTPROC)
8738 # ===================================================================
8739 # Check for system libxml
8740 # ===================================================================
8741 AC_MSG_CHECKING([which libxml to use])
8742 if test "$with_system_libxml" = "yes"; then
8743     AC_MSG_RESULT([external])
8744     SYSTEM_LIBXML=TRUE
8745     if test "$_os" = "Darwin"; then
8746         dnl make sure to use SDK path
8747         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8748         dnl omit -L/usr/lib
8749         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8750     elif test $_os = iOS; then
8751         dnl make sure to use SDK path
8752         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8753         LIBXML_CFLAGS="-I$usr/include/libxml2"
8754         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8755     else
8756         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8757         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8758         FilterLibs "${LIBXML_LIBS}"
8759         LIBXML_LIBS="${filteredlibs}"
8760     fi
8762     dnl Check for xmllint
8763     AC_PATH_PROG(XMLLINT, xmllint, no)
8764     if test "$XMLLINT" = "no"; then
8765         AC_MSG_ERROR([xmllint is required])
8766     fi
8767 else
8768     AC_MSG_RESULT([internal])
8769     SYSTEM_LIBXML=
8770     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8771     if test "$COM" = "MSC"; then
8772         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8773     fi
8774     if test "$COM" = "MSC"; then
8775         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8776     else
8777         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8778     fi
8779     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8781 AC_SUBST(SYSTEM_LIBXML)
8782 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8783     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8785 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8786 AC_SUBST(LIBXML_CFLAGS)
8787 AC_SUBST(LIBXML_LIBS)
8788 AC_SUBST(XMLLINT)
8790 # =====================================================================
8791 # Checking for a Python interpreter with version >= 2.7.
8792 # Build and runtime requires Python 3 compatible version (>= 2.7).
8793 # Optionally user can pass an option to configure, i. e.
8794 # ./configure PYTHON=/usr/bin/python
8795 # =====================================================================
8796 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8797     if test -n "$PYTHON"; then
8798         PYTHON_FOR_BUILD=$PYTHON
8799     else
8800         # This allows a lack of system python with no error, we use internal one in that case.
8801         AM_PATH_PYTHON([2.7],, [:])
8802         # Clean PYTHON_VERSION checked below if cross-compiling
8803         PYTHON_VERSION=""
8804         if test "$PYTHON" != ":"; then
8805             PYTHON_FOR_BUILD=$PYTHON
8806         fi
8807     fi
8809 AC_SUBST(PYTHON_FOR_BUILD)
8811 # Checks for Python to use for Pyuno
8812 AC_MSG_CHECKING([which Python to use for Pyuno])
8813 case "$enable_python" in
8814 no|disable)
8815     if test -z $PYTHON_FOR_BUILD; then
8816         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8817         # requirement from the choice whether to include Python stuff in the installer, but why
8818         # bother?
8819         AC_MSG_ERROR([Python is required at build time.])
8820     fi
8821     enable_python=no
8822     AC_MSG_RESULT([none])
8823     ;;
8824 ""|yes|auto)
8825     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8826         AC_MSG_RESULT([no, overridden by --disable-scripting])
8827         enable_python=no
8828     elif test $build_os = cygwin; then
8829         dnl When building on Windows we don't attempt to use any installed
8830         dnl "system"  Python.
8831         AC_MSG_RESULT([fully internal])
8832         enable_python=internal
8833     elif test "$cross_compiling" = yes; then
8834         AC_MSG_RESULT([system])
8835         enable_python=system
8836     else
8837         # Unset variables set by the above AM_PATH_PYTHON so that
8838         # we actually do check anew.
8839         AC_MSG_RESULT([])
8840         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
8841         AM_PATH_PYTHON([3.3],, [:])
8842         AC_MSG_CHECKING([which Python to use for Pyuno])
8843         if test "$PYTHON" = ":"; then
8844             if test -z "$PYTHON_FOR_BUILD"; then
8845                 AC_MSG_RESULT([fully internal])
8846             else
8847                 AC_MSG_RESULT([internal])
8848             fi
8849             enable_python=internal
8850         else
8851             AC_MSG_RESULT([system])
8852             enable_python=system
8853         fi
8854     fi
8855     ;;
8856 internal)
8857     AC_MSG_RESULT([internal])
8858     ;;
8859 fully-internal)
8860     AC_MSG_RESULT([fully internal])
8861     enable_python=internal
8862     ;;
8863 system)
8864     AC_MSG_RESULT([system])
8865     if test "$_os" = Darwin; then
8866         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])
8867     fi
8868     ;;
8870     AC_MSG_ERROR([Incorrect --enable-python option])
8871     ;;
8872 esac
8874 if test $enable_python != no; then
8875     BUILD_TYPE="$BUILD_TYPE PYUNO"
8878 if test $enable_python = system; then
8879     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8880         # Fallback: Accept these in the environment, or as set above
8881         # for MacOSX.
8882         :
8883     elif test "$cross_compiling" != yes; then
8884         # Unset variables set by the above AM_PATH_PYTHON so that
8885         # we actually do check anew.
8886         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
8887         # This causes an error if no python command is found
8888         AM_PATH_PYTHON([3.3])
8889         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8890         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8891         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8892         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8893         if test -z "$PKG_CONFIG"; then
8894             PYTHON_CFLAGS="-I$python_include"
8895             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8896         elif $PKG_CONFIG --exists python-$python_version-embed; then
8897             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8898             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8899         elif $PKG_CONFIG --exists python-$python_version; then
8900             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8901             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8902         else
8903             PYTHON_CFLAGS="-I$python_include"
8904             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8905         fi
8906         FilterLibs "${PYTHON_LIBS}"
8907         PYTHON_LIBS="${filteredlibs}"
8908     else
8909         dnl How to find out the cross-compilation Python installation path?
8910         AC_MSG_CHECKING([for python version])
8911         AS_IF([test -n "$PYTHON_VERSION"],
8912               [AC_MSG_RESULT([$PYTHON_VERSION])],
8913               [AC_MSG_RESULT([not found])
8914                AC_MSG_ERROR([no usable python found])])
8915         test -n "$PYTHON_CFLAGS" && break
8916     fi
8918     dnl Check if the headers really work
8919     save_CPPFLAGS="$CPPFLAGS"
8920     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8921     AC_CHECK_HEADER(Python.h)
8922     CPPFLAGS="$save_CPPFLAGS"
8924     # let the PYTHON_FOR_BUILD match the same python installation that
8925     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8926     # better for PythonTests.
8927     PYTHON_FOR_BUILD=$PYTHON
8930 if test "$with_lxml" != no; then
8931     if test -z "$PYTHON_FOR_BUILD"; then
8932         case $build_os in
8933             cygwin)
8934                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8935                 ;;
8936             *)
8937                 if test "$cross_compiling" != yes ; then
8938                     BUILD_TYPE="$BUILD_TYPE LXML"
8939                 fi
8940                 ;;
8941         esac
8942     else
8943         AC_MSG_CHECKING([for python lxml])
8944         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8945             AC_MSG_RESULT([yes])
8946         else
8947             case $build_os in
8948                 cygwin)
8949                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8950                     ;;
8951                 *)
8952                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8953                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8954                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8955                         else
8956                             BUILD_TYPE="$BUILD_TYPE LXML"
8957                             AC_MSG_RESULT([no, using internal lxml])
8958                         fi
8959                     else
8960                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8961                     fi
8962                     ;;
8963             esac
8964         fi
8965     fi
8968 dnl By now enable_python should be "system", "internal" or "no"
8969 case $enable_python in
8970 system)
8971     SYSTEM_PYTHON=TRUE
8973     if test "x$ac_cv_header_Python_h" != "xyes"; then
8974        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8975     fi
8977     AC_LANG_PUSH(C)
8978     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8979     AC_MSG_CHECKING([for correct python library version])
8980        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8981 #include <Python.h>
8983 int main(int argc, char **argv) {
8984    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8985        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8986    else return 1;
8988        ]])],[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])])
8989     CFLAGS=$save_CFLAGS
8990     AC_LANG_POP(C)
8992     dnl FIXME Check if the Python library can be linked with, too?
8993     ;;
8995 internal)
8996     SYSTEM_PYTHON=
8997     PYTHON_VERSION_MAJOR=3
8998     PYTHON_VERSION_MINOR=7
8999     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
9000     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9001         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9002     fi
9003     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9004     BUILD_TYPE="$BUILD_TYPE PYTHON"
9005     if test "$OS" = LINUX; then
9006         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9007     fi
9008     # Embedded Python dies without Home set
9009     if test "$HOME" = ""; then
9010         export HOME=""
9011     fi
9012     ;;
9014     DISABLE_PYTHON=TRUE
9015     SYSTEM_PYTHON=
9016     ;;
9018     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9019     ;;
9020 esac
9022 AC_SUBST(DISABLE_PYTHON)
9023 AC_SUBST(SYSTEM_PYTHON)
9024 AC_SUBST(PYTHON_CFLAGS)
9025 AC_SUBST(PYTHON_LIBS)
9026 AC_SUBST(PYTHON_VERSION)
9027 AC_SUBST(PYTHON_VERSION_MAJOR)
9028 AC_SUBST(PYTHON_VERSION_MINOR)
9030 ENABLE_MARIADBC=TRUE
9031 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9032     ENABLE_MARIADBC=
9034 MARIADBC_MAJOR=1
9035 MARIADBC_MINOR=0
9036 MARIADBC_MICRO=2
9037 if test "$ENABLE_MARIADBC" = "TRUE"; then
9038     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9041 AC_SUBST(ENABLE_MARIADBC)
9042 AC_SUBST(MARIADBC_MAJOR)
9043 AC_SUBST(MARIADBC_MINOR)
9044 AC_SUBST(MARIADBC_MICRO)
9046 if test "$ENABLE_MARIADBC" = "TRUE"; then
9047     dnl ===================================================================
9048     dnl Check for system MariaDB
9049     dnl ===================================================================
9050     AC_MSG_CHECKING([which MariaDB to use])
9051     if test "$with_system_mariadb" = "yes"; then
9052         AC_MSG_RESULT([external])
9053         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9054         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9055         if test -z "$MARIADBCONFIG"; then
9056             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9057             if test -z "$MARIADBCONFIG"; then
9058                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9059                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9060             fi
9061         fi
9062         AC_MSG_CHECKING([MariaDB version])
9063         MARIADB_VERSION=`$MARIADBCONFIG --version`
9064         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9065         if test "$MARIADB_MAJOR" -ge "5"; then
9066             AC_MSG_RESULT([OK])
9067         else
9068             AC_MSG_ERROR([too old, use 5.0.x or later])
9069         fi
9070         AC_MSG_CHECKING([for MariaDB Client library])
9071         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9072         if test "$COM_IS_CLANG" = TRUE; then
9073             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9074         fi
9075         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9076         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9077         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9078         dnl linux32:
9079         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9080             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9081             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9082                 | sed -e 's|/lib64/|/lib/|')
9083         fi
9084         FilterLibs "${MARIADB_LIBS}"
9085         MARIADB_LIBS="${filteredlibs}"
9086         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9087         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9088         if test "$enable_bundle_mariadb" = "yes"; then
9089             AC_MSG_RESULT([yes])
9090             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9091             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9093 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9095 /g' | grep -E '(mysqlclient|mariadb)')
9096             if test "$_os" = "Darwin"; then
9097                 LIBMARIADB=${LIBMARIADB}.dylib
9098             elif test "$_os" = "WINNT"; then
9099                 LIBMARIADB=${LIBMARIADB}.dll
9100             else
9101                 LIBMARIADB=${LIBMARIADB}.so
9102             fi
9103             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9104             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9105             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9106                 AC_MSG_RESULT([found.])
9107                 PathFormat "$LIBMARIADB_PATH"
9108                 LIBMARIADB_PATH="$formatted_path"
9109             else
9110                 AC_MSG_ERROR([not found.])
9111             fi
9112         else
9113             AC_MSG_RESULT([no])
9114             BUNDLE_MARIADB_CONNECTOR_C=
9115         fi
9116     else
9117         AC_MSG_RESULT([internal])
9118         SYSTEM_MARIADB_CONNECTOR_C=
9119         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9120         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9121         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9122     fi
9124     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9125     AC_SUBST(MARIADB_CFLAGS)
9126     AC_SUBST(MARIADB_LIBS)
9127     AC_SUBST(LIBMARIADB)
9128     AC_SUBST(LIBMARIADB_PATH)
9129     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9132 dnl ===================================================================
9133 dnl Check for system hsqldb
9134 dnl ===================================================================
9135 if test "$with_java" != "no"; then
9136     HSQLDB_USE_JDBC_4_1=
9137     AC_MSG_CHECKING([which hsqldb to use])
9138     if test "$with_system_hsqldb" = "yes"; then
9139         AC_MSG_RESULT([external])
9140         SYSTEM_HSQLDB=TRUE
9141         if test -z $HSQLDB_JAR; then
9142             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9143         fi
9144         if ! test -f $HSQLDB_JAR; then
9145                AC_MSG_ERROR(hsqldb.jar not found.)
9146         fi
9147         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9148         export HSQLDB_JAR
9149         if $PERL -e \
9150            'use Archive::Zip;
9151             my $file = "$ENV{'HSQLDB_JAR'}";
9152             my $zip = Archive::Zip->new( $file );
9153             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9154             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9155             {
9156                 push @l, split(/\n/, $mf);
9157                 foreach my $line (@l)
9158                 {
9159                     if ($line =~ m/Specification-Version:/)
9160                     {
9161                         ($t, $version) = split (/:/,$line);
9162                         $version =~ s/^\s//;
9163                         ($a, $b, $c, $d) = split (/\./,$version);
9164                         if ($c == "0" && $d > "8")
9165                         {
9166                             exit 0;
9167                         }
9168                         else
9169                         {
9170                             exit 1;
9171                         }
9172                     }
9173                 }
9174             }
9175             else
9176             {
9177                 exit 1;
9178             }'; then
9179             AC_MSG_RESULT([yes])
9180         else
9181             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9182         fi
9183     else
9184         AC_MSG_RESULT([internal])
9185         SYSTEM_HSQLDB=
9186         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9187         NEED_ANT=TRUE
9188         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9189         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9190         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9191             AC_MSG_RESULT([yes])
9192             HSQLDB_USE_JDBC_4_1=TRUE
9193         else
9194             AC_MSG_RESULT([no])
9195         fi
9196     fi
9197     AC_SUBST(SYSTEM_HSQLDB)
9198     AC_SUBST(HSQLDB_JAR)
9199     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9202 dnl ===================================================================
9203 dnl Check for PostgreSQL stuff
9204 dnl ===================================================================
9205 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9206 if test "x$enable_postgresql_sdbc" != "xno"; then
9207     AC_MSG_RESULT([yes])
9208     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9210     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9211         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9212     fi
9213     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9214         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9215     fi
9217     postgres_interface=""
9218     if test "$with_system_postgresql" = "yes"; then
9219         postgres_interface="external PostgreSQL"
9220         SYSTEM_POSTGRESQL=TRUE
9221         if test "$_os" = Darwin; then
9222             supp_path=''
9223             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9224                 pg_supp_path="$P_SEP$d$pg_supp_path"
9225             done
9226         fi
9227         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9228         if test -n "$PGCONFIG"; then
9229             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9230             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9231         else
9232             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9233               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9234               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9235             ],[
9236               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9237             ])
9238         fi
9239         FilterLibs "${POSTGRESQL_LIB}"
9240         POSTGRESQL_LIB="${filteredlibs}"
9241     else
9242         # if/when anything else than PostgreSQL uses Kerberos,
9243         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9244         WITH_KRB5=
9245         WITH_GSSAPI=
9246         case "$_os" in
9247         Darwin)
9248             # macOS has system MIT Kerberos 5 since 10.4
9249             if test "$with_krb5" != "no"; then
9250                 WITH_KRB5=TRUE
9251                 save_LIBS=$LIBS
9252                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9253                 # that the libraries where these functions are located on macOS will change, is it?
9254                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9255                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9256                 KRB5_LIBS=$LIBS
9257                 LIBS=$save_LIBS
9258                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9259                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9260                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9261                 LIBS=$save_LIBS
9262             fi
9263             if test "$with_gssapi" != "no"; then
9264                 WITH_GSSAPI=TRUE
9265                 save_LIBS=$LIBS
9266                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9267                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9268                 GSSAPI_LIBS=$LIBS
9269                 LIBS=$save_LIBS
9270             fi
9271             ;;
9272         WINNT)
9273             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9274                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9275             fi
9276             ;;
9277         Linux|GNU|*BSD|DragonFly)
9278             if test "$with_krb5" != "no"; then
9279                 WITH_KRB5=TRUE
9280                 save_LIBS=$LIBS
9281                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9282                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9283                 KRB5_LIBS=$LIBS
9284                 LIBS=$save_LIBS
9285                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9286                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9287                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9288                 LIBS=$save_LIBS
9289             fi
9290             if test "$with_gssapi" != "no"; then
9291                 WITH_GSSAPI=TRUE
9292                 save_LIBS=$LIBS
9293                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9294                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9295                 GSSAPI_LIBS=$LIBS
9296                 LIBS=$save_LIBS
9297             fi
9298             ;;
9299         *)
9300             if test "$with_krb5" = "yes"; then
9301                 WITH_KRB5=TRUE
9302                 save_LIBS=$LIBS
9303                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9304                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9305                 KRB5_LIBS=$LIBS
9306                 LIBS=$save_LIBS
9307                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9308                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9309                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9310                 LIBS=$save_LIBS
9311             fi
9312             if test "$with_gssapi" = "yes"; then
9313                 WITH_GSSAPI=TRUE
9314                 save_LIBS=$LIBS
9315                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9316                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9317                 LIBS=$save_LIBS
9318                 GSSAPI_LIBS=$LIBS
9319             fi
9320         esac
9322         if test -n "$with_libpq_path"; then
9323             SYSTEM_POSTGRESQL=TRUE
9324             postgres_interface="external libpq"
9325             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9326             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9327         else
9328             SYSTEM_POSTGRESQL=
9329             postgres_interface="internal"
9330             POSTGRESQL_LIB=""
9331             POSTGRESQL_INC="%OVERRIDE_ME%"
9332             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9333         fi
9334     fi
9336     AC_MSG_CHECKING([PostgreSQL C interface])
9337     AC_MSG_RESULT([$postgres_interface])
9339     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9340         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9341         save_CFLAGS=$CFLAGS
9342         save_CPPFLAGS=$CPPFLAGS
9343         save_LIBS=$LIBS
9344         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9345         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9346         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9347         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9348             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9349         CFLAGS=$save_CFLAGS
9350         CPPFLAGS=$save_CPPFLAGS
9351         LIBS=$save_LIBS
9352     fi
9353     BUILD_POSTGRESQL_SDBC=TRUE
9354 else
9355     AC_MSG_RESULT([no])
9357 AC_SUBST(WITH_KRB5)
9358 AC_SUBST(WITH_GSSAPI)
9359 AC_SUBST(GSSAPI_LIBS)
9360 AC_SUBST(KRB5_LIBS)
9361 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9362 AC_SUBST(SYSTEM_POSTGRESQL)
9363 AC_SUBST(POSTGRESQL_INC)
9364 AC_SUBST(POSTGRESQL_LIB)
9366 dnl ===================================================================
9367 dnl Check for Firebird stuff
9368 dnl ===================================================================
9369 ENABLE_FIREBIRD_SDBC=
9370 if test "$enable_firebird_sdbc" = "yes" ; then
9371     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9373     dnl ===================================================================
9374     dnl Check for system Firebird
9375     dnl ===================================================================
9376     AC_MSG_CHECKING([which Firebird to use])
9377     if test "$with_system_firebird" = "yes"; then
9378         AC_MSG_RESULT([external])
9379         SYSTEM_FIREBIRD=TRUE
9380         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9381         if test -z "$FIREBIRDCONFIG"; then
9382             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9383             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9384                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9385             ])
9386             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9387         else
9388             AC_MSG_NOTICE([fb_config found])
9389             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9390             AC_MSG_CHECKING([for Firebird Client library])
9391             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9392             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9393             FilterLibs "${FIREBIRD_LIBS}"
9394             FIREBIRD_LIBS="${filteredlibs}"
9395         fi
9396         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9397         AC_MSG_CHECKING([Firebird version])
9398         if test -n "${FIREBIRD_VERSION}"; then
9399             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9400             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9401             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9402                 AC_MSG_RESULT([OK])
9403             else
9404                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9405             fi
9406         else
9407             __save_CFLAGS="${CFLAGS}"
9408             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9409             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9410 #if defined(FB_API_VER) && FB_API_VER == 30
9411 int fb_api_is_30(void) { return 0; }
9412 #else
9413 #error "Wrong Firebird API version"
9414 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9415             CFLAGS="${__save_CFLAGS}"
9416         fi
9417         ENABLE_FIREBIRD_SDBC=TRUE
9418         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9419     elif test "$enable_database_connectivity" != yes; then
9420         AC_MSG_RESULT([none])
9421     elif test "$cross_compiling" = "yes"; then
9422         AC_MSG_RESULT([none])
9423     else
9424         dnl Embedded Firebird has version 3.0
9425         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9426         dnl We need libatomic_ops for any non X86/X64 system
9427         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9428             dnl ===================================================================
9429             dnl Check for system libatomic_ops
9430             dnl ===================================================================
9431             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9432             if test "$with_system_libatomic_ops" = "yes"; then
9433                 SYSTEM_LIBATOMIC_OPS=TRUE
9434                 AC_CHECK_HEADERS(atomic_ops.h, [],
9435                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9436             else
9437                 SYSTEM_LIBATOMIC_OPS=
9438                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9439                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9440                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9441             fi
9442         fi
9444         AC_MSG_RESULT([internal])
9445         SYSTEM_FIREBIRD=
9446         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9447         FIREBIRD_LIBS="-lfbclient"
9449         if test "$with_system_libtommath" = "yes"; then
9450             SYSTEM_LIBTOMMATH=TRUE
9451             dnl check for tommath presence
9452             save_LIBS=$LIBS
9453             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9454             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9455             LIBS=$save_LIBS
9456         else
9457             SYSTEM_LIBTOMMATH=
9458             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9459             LIBTOMMATH_LIBS="-ltommath"
9460             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9461         fi
9463         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9464         ENABLE_FIREBIRD_SDBC=TRUE
9465         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9466     fi
9468 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9469 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9470 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9471 AC_SUBST(LIBATOMIC_OPS_LIBS)
9472 AC_SUBST(SYSTEM_FIREBIRD)
9473 AC_SUBST(FIREBIRD_CFLAGS)
9474 AC_SUBST(FIREBIRD_LIBS)
9475 AC_SUBST([TOMMATH_CFLAGS])
9476 AC_SUBST([TOMMATH_LIBS])
9478 dnl ===================================================================
9479 dnl Check for system curl
9480 dnl ===================================================================
9481 AC_MSG_CHECKING([which libcurl to use])
9482 if test "$with_system_curl" = "auto"; then
9483     with_system_curl="$with_system_libs"
9486 if test "$with_system_curl" = "yes"; then
9487     AC_MSG_RESULT([external])
9488     SYSTEM_CURL=TRUE
9490     # First try PKGCONFIG and then fall back
9491     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9493     if test -n "$CURL_PKG_ERRORS"; then
9494         AC_PATH_PROG(CURLCONFIG, curl-config)
9495         if test -z "$CURLCONFIG"; then
9496             AC_MSG_ERROR([curl development files not found])
9497         fi
9498         CURL_LIBS=`$CURLCONFIG --libs`
9499         FilterLibs "${CURL_LIBS}"
9500         CURL_LIBS="${filteredlibs}"
9501         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9502         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9504         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9505         case $curl_version in
9506         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9507         dnl so they need to be doubled to end up in the configure script
9508         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9509             AC_MSG_RESULT([yes])
9510             ;;
9511         *)
9512             AC_MSG_ERROR([no, you have $curl_version])
9513             ;;
9514         esac
9515     fi
9517     ENABLE_CURL=TRUE
9518 elif test $_os = iOS; then
9519     # Let's see if we need curl, I think not?
9520     AC_MSG_RESULT([none])
9521     ENABLE_CURL=
9522 else
9523     AC_MSG_RESULT([internal])
9524     SYSTEM_CURL=
9525     BUILD_TYPE="$BUILD_TYPE CURL"
9526     ENABLE_CURL=TRUE
9528 AC_SUBST(SYSTEM_CURL)
9529 AC_SUBST(CURL_CFLAGS)
9530 AC_SUBST(CURL_LIBS)
9531 AC_SUBST(ENABLE_CURL)
9533 dnl ===================================================================
9534 dnl Check for system boost
9535 dnl ===================================================================
9536 AC_MSG_CHECKING([which boost to use])
9537 if test "$with_system_boost" = "yes"; then
9538     AC_MSG_RESULT([external])
9539     SYSTEM_BOOST=TRUE
9540     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
9541     AX_BOOST_DATE_TIME
9542     AX_BOOST_FILESYSTEM
9543     AX_BOOST_IOSTREAMS
9544     AX_BOOST_LOCALE
9545     AC_LANG_PUSH([C++])
9546     save_CXXFLAGS=$CXXFLAGS
9547     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9548     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9549        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9550     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9551        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9552     CXXFLAGS=$save_CXXFLAGS
9553     AC_LANG_POP([C++])
9554     # this is in m4/ax_boost_base.m4
9555     FilterLibs "${BOOST_LDFLAGS}"
9556     BOOST_LDFLAGS="${filteredlibs}"
9557 else
9558     AC_MSG_RESULT([internal])
9559     BUILD_TYPE="$BUILD_TYPE BOOST"
9560     SYSTEM_BOOST=
9561     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9562         # use warning-suppressing wrapper headers
9563         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9564     else
9565         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9566     fi
9568 AC_SUBST(SYSTEM_BOOST)
9570 dnl ===================================================================
9571 dnl Check for system mdds
9572 dnl ===================================================================
9573 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9575 dnl ===================================================================
9576 dnl Check for system glm
9577 dnl ===================================================================
9578 AC_MSG_CHECKING([which glm to use])
9579 if test "$with_system_glm" = "yes"; then
9580     AC_MSG_RESULT([external])
9581     SYSTEM_GLM=TRUE
9582     AC_LANG_PUSH([C++])
9583     AC_CHECK_HEADER([glm/glm.hpp], [],
9584        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9585     AC_LANG_POP([C++])
9586 else
9587     AC_MSG_RESULT([internal])
9588     BUILD_TYPE="$BUILD_TYPE GLM"
9589     SYSTEM_GLM=
9590     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9592 AC_SUBST([GLM_CFLAGS])
9593 AC_SUBST([SYSTEM_GLM])
9595 dnl ===================================================================
9596 dnl Check for system odbc
9597 dnl ===================================================================
9598 AC_MSG_CHECKING([which odbc headers to use])
9599 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
9600     AC_MSG_RESULT([external])
9601     SYSTEM_ODBC_HEADERS=TRUE
9603     if test "$build_os" = "cygwin"; then
9604         save_CPPFLAGS=$CPPFLAGS
9605         find_winsdk
9606         PathFormat "$winsdktest"
9607         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"
9608         AC_CHECK_HEADER(sqlext.h, [],
9609             [AC_MSG_ERROR(odbc not found. install odbc)],
9610             [#include <windows.h>])
9611         CPPFLAGS=$save_CPPFLAGS
9612     else
9613         AC_CHECK_HEADER(sqlext.h, [],
9614             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9615     fi
9616 elif test "$enable_database_connectivity" != yes; then
9617     AC_MSG_RESULT([none])
9618 else
9619     AC_MSG_RESULT([internal])
9620     SYSTEM_ODBC_HEADERS=
9622 AC_SUBST(SYSTEM_ODBC_HEADERS)
9624 dnl ===================================================================
9625 dnl Enable LDAP support
9626 dnl ===================================================================
9628 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9629 AC_MSG_CHECKING([whether to enable LDAP support])
9630     if test "$enable_ldap" != "yes"; then
9631         AC_MSG_RESULT([no])
9632         ENABLE_LDAP=""
9633         enable_ldap=no
9634     else
9635         AC_MSG_RESULT([yes])
9636         ENABLE_LDAP="TRUE"
9637     fi
9639 AC_SUBST(ENABLE_LDAP)
9641 dnl ===================================================================
9642 dnl Check for system openldap
9643 dnl ===================================================================
9645 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9646 AC_MSG_CHECKING([which openldap library to use])
9647 if test "$with_system_openldap" = "yes"; then
9648     AC_MSG_RESULT([external])
9649     SYSTEM_OPENLDAP=TRUE
9650     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9651     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9652     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9653 else
9654     AC_MSG_RESULT([internal])
9655     SYSTEM_OPENLDAP=
9656     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9659 AC_SUBST(SYSTEM_OPENLDAP)
9661 dnl ===================================================================
9662 dnl Check for system NSS
9663 dnl ===================================================================
9664 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9665     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9666     AC_DEFINE(HAVE_FEATURE_NSS)
9667     ENABLE_NSS="TRUE"
9668     AC_DEFINE(ENABLE_NSS)
9669 elif test $_os != iOS ; then
9670     with_tls=openssl
9672 AC_SUBST(ENABLE_NSS)
9674 dnl ===================================================================
9675 dnl Check for TLS/SSL and cryptographic implementation to use
9676 dnl ===================================================================
9677 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9678 if test -n "$with_tls"; then
9679     case $with_tls in
9680     openssl)
9681         AC_DEFINE(USE_TLS_OPENSSL)
9682         TLS=OPENSSL
9684         if test "$enable_openssl" != "yes"; then
9685             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9686         fi
9688         # warn that OpenSSL has been selected but not all TLS code has this option
9689         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9690         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9691         ;;
9692     nss)
9693         AC_DEFINE(USE_TLS_NSS)
9694         TLS=NSS
9695         ;;
9696     no)
9697         AC_MSG_WARN([Skipping TLS/SSL])
9698         ;;
9699     *)
9700         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9701 openssl - OpenSSL
9702 nss - Mozilla's Network Security Services (NSS)
9703     ])
9704         ;;
9705     esac
9706 else
9707     # default to using NSS, it results in smaller oox lib
9708     AC_DEFINE(USE_TLS_NSS)
9709     TLS=NSS
9711 AC_MSG_RESULT([$TLS])
9712 AC_SUBST(TLS)
9714 dnl ===================================================================
9715 dnl Check for system sane
9716 dnl ===================================================================
9717 AC_MSG_CHECKING([which sane header to use])
9718 if test "$with_system_sane" = "yes"; then
9719     AC_MSG_RESULT([external])
9720     AC_CHECK_HEADER(sane/sane.h, [],
9721       [AC_MSG_ERROR(sane not found. install sane)], [])
9722 else
9723     AC_MSG_RESULT([internal])
9724     BUILD_TYPE="$BUILD_TYPE SANE"
9727 dnl ===================================================================
9728 dnl Check for system icu
9729 dnl ===================================================================
9730 SYSTEM_GENBRK=
9731 SYSTEM_GENCCODE=
9732 SYSTEM_GENCMN=
9734 ICU_MAJOR=65
9735 ICU_MINOR=1
9736 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9737 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9738 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9739 AC_MSG_CHECKING([which icu to use])
9740 if test "$with_system_icu" = "yes"; then
9741     AC_MSG_RESULT([external])
9742     SYSTEM_ICU=TRUE
9743     AC_LANG_PUSH([C++])
9744     AC_MSG_CHECKING([for unicode/rbbi.h])
9745     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9746     AC_LANG_POP([C++])
9748     if test "$cross_compiling" != "yes"; then
9749         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9750         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9751         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9752         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9753     fi
9755     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9756         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9757         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9758         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9759         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9760         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9761             AC_MSG_RESULT([yes])
9762         else
9763             AC_MSG_RESULT([no])
9764             if test "$with_system_icu_for_build" != "force"; then
9765                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9766 You can use --with-system-icu-for-build=force to use it anyway.])
9767             fi
9768         fi
9769     fi
9771     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9772         # using the system icu tools can lead to version confusion, use the
9773         # ones from the build environment when cross-compiling
9774         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9775         if test -z "$SYSTEM_GENBRK"; then
9776             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9777         fi
9778         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9779         if test -z "$SYSTEM_GENCCODE"; then
9780             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9781         fi
9782         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9783         if test -z "$SYSTEM_GENCMN"; then
9784             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9785         fi
9786         if test "$ICU_MAJOR" -ge "49"; then
9787             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9788             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9789             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9790         else
9791             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9792             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9793             ICU_RECLASSIFIED_HEBREW_LETTER=
9794         fi
9795     fi
9797     if test "$cross_compiling" = "yes"; then
9798         if test "$ICU_MAJOR" -ge "50"; then
9799             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9800             ICU_MINOR=""
9801         fi
9802     fi
9803 else
9804     AC_MSG_RESULT([internal])
9805     SYSTEM_ICU=
9806     BUILD_TYPE="$BUILD_TYPE ICU"
9807     # surprisingly set these only for "internal" (to be used by various other
9808     # external libs): the system icu-config is quite unhelpful and spits out
9809     # dozens of weird flags and also default path -I/usr/include
9810     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9811     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9813 if test "$ICU_MAJOR" -ge "59"; then
9814     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9815     # with -std=c++11 but not all external libraries can be built with that,
9816     # for those use a bit-compatible typedef uint16_t UChar; see
9817     # icu/source/common/unicode/umachine.h
9818     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9819 else
9820     ICU_UCHAR_TYPE=""
9822 AC_SUBST(SYSTEM_ICU)
9823 AC_SUBST(SYSTEM_GENBRK)
9824 AC_SUBST(SYSTEM_GENCCODE)
9825 AC_SUBST(SYSTEM_GENCMN)
9826 AC_SUBST(ICU_MAJOR)
9827 AC_SUBST(ICU_MINOR)
9828 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9829 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9830 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9831 AC_SUBST(ICU_CFLAGS)
9832 AC_SUBST(ICU_LIBS)
9833 AC_SUBST(ICU_UCHAR_TYPE)
9835 dnl ==================================================================
9836 dnl Breakpad
9837 dnl ==================================================================
9838 DEFAULT_CRASHDUMP_VALUE="true"
9839 AC_MSG_CHECKING([whether to enable breakpad])
9840 if test "$enable_breakpad" != yes; then
9841     AC_MSG_RESULT([no])
9842 else
9843     AC_MSG_RESULT([yes])
9844     ENABLE_BREAKPAD="TRUE"
9845     AC_DEFINE(ENABLE_BREAKPAD)
9846     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9847     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9849     AC_MSG_CHECKING([for disable crash dump])
9850     if test "$enable_crashdump" = no; then
9851         DEFAULT_CRASHDUMP_VALUE="false"
9852         AC_MSG_RESULT([yes])
9853     else
9854        AC_MSG_RESULT([no])
9855     fi
9857     AC_MSG_CHECKING([for crashreport config])
9858     if test "$with_symbol_config" = "no"; then
9859         BREAKPAD_SYMBOL_CONFIG="invalid"
9860         AC_MSG_RESULT([no])
9861     else
9862         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9863         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9864         AC_MSG_RESULT([yes])
9865     fi
9866     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9868 AC_SUBST(ENABLE_BREAKPAD)
9869 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9871 dnl ==================================================================
9872 dnl libfuzzer
9873 dnl ==================================================================
9874 AC_MSG_CHECKING([whether to enable fuzzers])
9875 if test "$enable_fuzzers" != yes; then
9876     AC_MSG_RESULT([no])
9877 else
9878     AC_MSG_RESULT([yes])
9879     ENABLE_FUZZERS="TRUE"
9880     AC_DEFINE([ENABLE_FUZZERS],1)
9881     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9883 AC_SUBST(ENABLE_FUZZERS)
9885 dnl ===================================================================
9886 dnl Orcus
9887 dnl ===================================================================
9888 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9889 if test "$with_system_orcus" != "yes"; then
9890     if test "$SYSTEM_BOOST" = "TRUE"; then
9891         # ===========================================================
9892         # Determine if we are going to need to link with Boost.System
9893         # ===========================================================
9894         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9895         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9896         dnl in documentation has no effect.
9897         AC_MSG_CHECKING([if we need to link with Boost.System])
9898         AC_LANG_PUSH([C++])
9899         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9900                 @%:@include <boost/version.hpp>
9901             ]],[[
9902                 #if BOOST_VERSION >= 105000
9903                 #   error yes, we need to link with Boost.System
9904                 #endif
9905             ]])],[
9906                 AC_MSG_RESULT([no])
9907             ],[
9908                 AC_MSG_RESULT([yes])
9909                 AX_BOOST_SYSTEM
9910         ])
9911         AC_LANG_POP([C++])
9912     fi
9914 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9915 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9916 AC_SUBST([BOOST_SYSTEM_LIB])
9917 AC_SUBST(SYSTEM_LIBORCUS)
9919 dnl ===================================================================
9920 dnl HarfBuzz
9921 dnl ===================================================================
9922 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9923                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9924                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9926 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9927                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9928                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9930 if test "$COM" = "MSC"; then # override the above
9931     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9932     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9935 if test "$with_system_harfbuzz" = "yes"; then
9936     if test "$with_system_graphite" = "no"; then
9937         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9938     fi
9939     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9940     _save_libs="$LIBS"
9941     _save_cflags="$CFLAGS"
9942     LIBS="$LIBS $HARFBUZZ_LIBS"
9943     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9944     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9945     LIBS="$_save_libs"
9946     CFLAGS="$_save_cflags"
9947 else
9948     if test "$with_system_graphite" = "yes"; then
9949         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9950     fi
9953 AC_MSG_CHECKING([whether to use X11])
9954 dnl ***************************************
9955 dnl testing for X libraries and includes...
9956 dnl ***************************************
9957 if test "$USING_X11" = TRUE; then
9958     AC_DEFINE(HAVE_FEATURE_X11)
9960 AC_MSG_RESULT([$USING_X11])
9962 if test "$USING_X11" = TRUE; then
9963     AC_PATH_X
9964     AC_PATH_XTRA
9965     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9967     if test -z "$x_includes"; then
9968         x_includes="default_x_includes"
9969     fi
9970     if test -z "$x_libraries"; then
9971         x_libraries="default_x_libraries"
9972     fi
9973     CFLAGS="$CFLAGS $X_CFLAGS"
9974     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9975     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9976 else
9977     x_includes="no_x_includes"
9978     x_libraries="no_x_libraries"
9981 if test "$USING_X11" = TRUE; then
9982     dnl ===================================================================
9983     dnl Check for extension headers
9984     dnl ===================================================================
9985     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9986      [#include <X11/extensions/shape.h>])
9988     # vcl needs ICE and SM
9989     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9990     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9991         [AC_MSG_ERROR(ICE library not found)])
9992     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9993     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9994         [AC_MSG_ERROR(SM library not found)])
9997 dnl ===================================================================
9998 dnl Check for system Xrender
9999 dnl ===================================================================
10000 AC_MSG_CHECKING([whether to use Xrender])
10001 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10002     AC_MSG_RESULT([yes])
10003     PKG_CHECK_MODULES(XRENDER, xrender)
10004     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10005     FilterLibs "${XRENDER_LIBS}"
10006     XRENDER_LIBS="${filteredlibs}"
10007     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10008       [AC_MSG_ERROR(libXrender not found or functional)], [])
10009     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10010       [AC_MSG_ERROR(Xrender not found. install X)], [])
10011 else
10012     AC_MSG_RESULT([no])
10014 AC_SUBST(XRENDER_CFLAGS)
10015 AC_SUBST(XRENDER_LIBS)
10017 dnl ===================================================================
10018 dnl Check for XRandr
10019 dnl ===================================================================
10020 AC_MSG_CHECKING([whether to enable RandR support])
10021 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10022     AC_MSG_RESULT([yes])
10023     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10024     if test "$ENABLE_RANDR" != "TRUE"; then
10025         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10026                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10027         XRANDR_CFLAGS=" "
10028         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10029           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10030         XRANDR_LIBS="-lXrandr "
10031         ENABLE_RANDR="TRUE"
10032     fi
10033     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10034     FilterLibs "${XRANDR_LIBS}"
10035     XRANDR_LIBS="${filteredlibs}"
10036 else
10037     ENABLE_RANDR=""
10038     AC_MSG_RESULT([no])
10040 AC_SUBST(XRANDR_CFLAGS)
10041 AC_SUBST(XRANDR_LIBS)
10042 AC_SUBST(ENABLE_RANDR)
10044 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10045     WITH_WEBDAV="serf"
10047 if test $_os = iOS -o $_os = Android; then
10048     WITH_WEBDAV="no"
10050 AC_MSG_CHECKING([for webdav library])
10051 case "$WITH_WEBDAV" in
10052 serf)
10053     AC_MSG_RESULT([serf])
10054     # Check for system apr-util
10055     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10056                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10057                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10058     if test "$COM" = "MSC"; then
10059         APR_LIB_DIR="LibR"
10060         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10061         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10062     fi
10064     # Check for system serf
10065     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10066                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10067     if test "$COM" = "MSC"; then
10068         SERF_LIB_DIR="Release"
10069         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10070         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10071     fi
10072     ;;
10073 neon)
10074     AC_MSG_RESULT([neon])
10075     # Check for system neon
10076     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10077     if test "$with_system_neon" = "yes"; then
10078         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10079     else
10080         NEON_VERSION=0295
10081     fi
10082     AC_SUBST(NEON_VERSION)
10083     ;;
10085     AC_MSG_RESULT([none, disabled])
10086     WITH_WEBDAV=""
10087     ;;
10088 esac
10089 AC_SUBST(WITH_WEBDAV)
10091 dnl ===================================================================
10092 dnl Check for disabling cve_tests
10093 dnl ===================================================================
10094 AC_MSG_CHECKING([whether to execute CVE tests])
10095 # If not explicitly enabled or disabled, default
10096 if test -z "$enable_cve_tests"; then
10097     case "$OS" in
10098     WNT)
10099         # Default cves off for Windows with its wild and wonderful
10100         # variety of AV software kicking in and panicking
10101         enable_cve_tests=no
10102         ;;
10103     *)
10104         # otherwise yes
10105         enable_cve_tests=yes
10106         ;;
10107     esac
10109 if test "$enable_cve_tests" = "no"; then
10110     AC_MSG_RESULT([no])
10111     DISABLE_CVE_TESTS=TRUE
10112     AC_SUBST(DISABLE_CVE_TESTS)
10113 else
10114     AC_MSG_RESULT([yes])
10117 dnl ===================================================================
10118 dnl Check for enabling chart XShape tests
10119 dnl ===================================================================
10120 AC_MSG_CHECKING([whether to execute chart XShape tests])
10121 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10122     AC_MSG_RESULT([yes])
10123     ENABLE_CHART_TESTS=TRUE
10124     AC_SUBST(ENABLE_CHART_TESTS)
10125 else
10126     AC_MSG_RESULT([no])
10129 dnl ===================================================================
10130 dnl Check for system openssl
10131 dnl ===================================================================
10132 DISABLE_OPENSSL=
10133 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10134 if test "$enable_openssl" = "yes"; then
10135     AC_MSG_RESULT([no])
10136     if test "$_os" = Darwin ; then
10137         # OpenSSL is deprecated when building for 10.7 or later.
10138         #
10139         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10140         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10142         with_system_openssl=no
10143         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10144     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10145             && test "$with_system_openssl" != "no"; then
10146         with_system_openssl=yes
10147         SYSTEM_OPENSSL=TRUE
10148         OPENSSL_CFLAGS=
10149         OPENSSL_LIBS="-lssl -lcrypto"
10150     else
10151         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10152     fi
10153     if test "$with_system_openssl" = "yes"; then
10154         AC_MSG_CHECKING([whether openssl supports SHA512])
10155         AC_LANG_PUSH([C])
10156         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10157             SHA512_CTX context;
10158 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10159         AC_LANG_POP(C)
10160     fi
10161 else
10162     AC_MSG_RESULT([yes])
10163     DISABLE_OPENSSL=TRUE
10165     # warn that although OpenSSL is disabled, system libraries may depend on it
10166     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10167     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10170 AC_SUBST([DISABLE_OPENSSL])
10172 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10173     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10174         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10175         enable_cipher_openssl_backend=no
10176     else
10177         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10178     fi
10180 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10181 ENABLE_CIPHER_OPENSSL_BACKEND=
10182 if test "$enable_cipher_openssl_backend" = yes; then
10183     AC_MSG_RESULT([yes])
10184     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10185 else
10186     AC_MSG_RESULT([no])
10188 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10190 dnl ===================================================================
10191 dnl Check for building gnutls
10192 dnl ===================================================================
10193 AC_MSG_CHECKING([whether to use gnutls])
10194 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10195     AC_MSG_RESULT([yes])
10196     AM_PATH_LIBGCRYPT()
10197     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10198         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10199                       available in the system to use as replacement.]]))
10200     FilterLibs "${LIBGCRYPT_LIBS}"
10201     LIBGCRYPT_LIBS="${filteredlibs}"
10202 else
10203     AC_MSG_RESULT([no])
10206 AC_SUBST([LIBGCRYPT_CFLAGS])
10207 AC_SUBST([LIBGCRYPT_LIBS])
10209 dnl ===================================================================
10210 dnl Check for system redland
10211 dnl ===================================================================
10212 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10213 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10214 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10215 if test "$with_system_redland" = "yes"; then
10216     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10217             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10218 else
10219     RAPTOR_MAJOR="0"
10220     RASQAL_MAJOR="3"
10221     REDLAND_MAJOR="0"
10223 AC_SUBST(RAPTOR_MAJOR)
10224 AC_SUBST(RASQAL_MAJOR)
10225 AC_SUBST(REDLAND_MAJOR)
10227 dnl ===================================================================
10228 dnl Check for system hunspell
10229 dnl ===================================================================
10230 AC_MSG_CHECKING([which libhunspell to use])
10231 if test "$_os" = iOS; then
10232    AC_MSG_RESULT([none])
10233 elif test "$with_system_hunspell" = "yes"; then
10234     AC_MSG_RESULT([external])
10235     SYSTEM_HUNSPELL=TRUE
10236     AC_LANG_PUSH([C++])
10237     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10238     if test "$HUNSPELL_PC" != "TRUE"; then
10239         AC_CHECK_HEADER(hunspell.hxx, [],
10240             [
10241             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10242             [AC_MSG_ERROR(hunspell headers not found.)], [])
10243             ], [])
10244         AC_CHECK_LIB([hunspell], [main], [:],
10245            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10246         HUNSPELL_LIBS=-lhunspell
10247     fi
10248     AC_LANG_POP([C++])
10249     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10250     FilterLibs "${HUNSPELL_LIBS}"
10251     HUNSPELL_LIBS="${filteredlibs}"
10252 else
10253     AC_MSG_RESULT([internal])
10254     SYSTEM_HUNSPELL=
10255     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10256     if test "$COM" = "MSC"; then
10257         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10258     else
10259         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10260     fi
10261     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10263 AC_SUBST(SYSTEM_HUNSPELL)
10264 AC_SUBST(HUNSPELL_CFLAGS)
10265 AC_SUBST(HUNSPELL_LIBS)
10267 dnl ===================================================================
10268 dnl Check for system qrcodegen
10269 dnl ===================================================================
10270 AC_MSG_CHECKING([which libqrcodegen to use])
10271 if test "$with_system_qrcodegen" = "yes"; then
10272     AC_MSG_RESULT([external])
10273     SYSTEM_QRCODEGEN=TRUE
10274     AC_LANG_PUSH([C++])
10275     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10276         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10277     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10278         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10279     QRCODEGEN_LIBS=-lqrcodegencpp
10280     AC_LANG_POP([C++])
10281     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10282     FilterLibs "${QRCODEGEN_LIBS}"
10283     QRCODEGEN_LIBS="${filteredlibs}"
10284 else
10285     AC_MSG_RESULT([internal])
10286     SYSTEM_QRCODEGEN=
10287     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10289 AC_SUBST(SYSTEM_QRCODEGEN)
10290 AC_SUBST(QRCODEGEN_CFLAGS)
10291 AC_SUBST(QRCODEGEN_LIBS)
10293 dnl ===================================================================
10294 dnl Checking for altlinuxhyph
10295 dnl ===================================================================
10296 AC_MSG_CHECKING([which altlinuxhyph to use])
10297 if test "$with_system_altlinuxhyph" = "yes"; then
10298     AC_MSG_RESULT([external])
10299     SYSTEM_HYPH=TRUE
10300     AC_CHECK_HEADER(hyphen.h, [],
10301        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10302     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10303        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10304        [#include <hyphen.h>])
10305     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10306         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10307     if test -z "$HYPHEN_LIB"; then
10308         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10309            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10310     fi
10311     if test -z "$HYPHEN_LIB"; then
10312         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10313            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10314     fi
10315 else
10316     AC_MSG_RESULT([internal])
10317     SYSTEM_HYPH=
10318     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10319     if test "$COM" = "MSC"; then
10320         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10321     else
10322         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10323     fi
10325 AC_SUBST(SYSTEM_HYPH)
10326 AC_SUBST(HYPHEN_LIB)
10328 dnl ===================================================================
10329 dnl Checking for mythes
10330 dnl ===================================================================
10331 AC_MSG_CHECKING([which mythes to use])
10332 if test "$_os" = iOS; then
10333    AC_MSG_RESULT([none])
10334 elif test "$with_system_mythes" = "yes"; then
10335     AC_MSG_RESULT([external])
10336     SYSTEM_MYTHES=TRUE
10337     AC_LANG_PUSH([C++])
10338     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10339     if test "$MYTHES_PKGCONFIG" = "no"; then
10340         AC_CHECK_HEADER(mythes.hxx, [],
10341             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10342         AC_CHECK_LIB([mythes-1.2], [main], [:],
10343             [ MYTHES_FOUND=no], [])
10344     if test "$MYTHES_FOUND" = "no"; then
10345         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10346                 [ MYTHES_FOUND=no], [])
10347     fi
10348     if test "$MYTHES_FOUND" = "no"; then
10349         AC_MSG_ERROR([mythes library not found!.])
10350     fi
10351     fi
10352     AC_LANG_POP([C++])
10353     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10354     FilterLibs "${MYTHES_LIBS}"
10355     MYTHES_LIBS="${filteredlibs}"
10356 else
10357     AC_MSG_RESULT([internal])
10358     SYSTEM_MYTHES=
10359     BUILD_TYPE="$BUILD_TYPE MYTHES"
10360     if test "$COM" = "MSC"; then
10361         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10362     else
10363         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10364     fi
10366 AC_SUBST(SYSTEM_MYTHES)
10367 AC_SUBST(MYTHES_CFLAGS)
10368 AC_SUBST(MYTHES_LIBS)
10370 dnl ===================================================================
10371 dnl How should we build the linear programming solver ?
10372 dnl ===================================================================
10374 ENABLE_COINMP=
10375 AC_MSG_CHECKING([whether to build with CoinMP])
10376 if test "$enable_coinmp" != "no"; then
10377     ENABLE_COINMP=TRUE
10378     AC_MSG_RESULT([yes])
10379     if test "$with_system_coinmp" = "yes"; then
10380         SYSTEM_COINMP=TRUE
10381         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10382         FilterLibs "${COINMP_LIBS}"
10383         COINMP_LIBS="${filteredlibs}"
10384     else
10385         BUILD_TYPE="$BUILD_TYPE COINMP"
10386     fi
10387 else
10388     AC_MSG_RESULT([no])
10390 AC_SUBST(ENABLE_COINMP)
10391 AC_SUBST(SYSTEM_COINMP)
10392 AC_SUBST(COINMP_CFLAGS)
10393 AC_SUBST(COINMP_LIBS)
10395 ENABLE_LPSOLVE=
10396 AC_MSG_CHECKING([whether to build with lpsolve])
10397 if test "$enable_lpsolve" != "no"; then
10398     ENABLE_LPSOLVE=TRUE
10399     AC_MSG_RESULT([yes])
10400 else
10401     AC_MSG_RESULT([no])
10403 AC_SUBST(ENABLE_LPSOLVE)
10405 if test "$ENABLE_LPSOLVE" = TRUE; then
10406     AC_MSG_CHECKING([which lpsolve to use])
10407     if test "$with_system_lpsolve" = "yes"; then
10408         AC_MSG_RESULT([external])
10409         SYSTEM_LPSOLVE=TRUE
10410         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10411            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10412         save_LIBS=$LIBS
10413         # some systems need this. Like Ubuntu...
10414         AC_CHECK_LIB(m, floor)
10415         AC_CHECK_LIB(dl, dlopen)
10416         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10417             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10418         LIBS=$save_LIBS
10419     else
10420         AC_MSG_RESULT([internal])
10421         SYSTEM_LPSOLVE=
10422         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10423     fi
10425 AC_SUBST(SYSTEM_LPSOLVE)
10427 dnl ===================================================================
10428 dnl Checking for libexttextcat
10429 dnl ===================================================================
10430 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10431 if test "$with_system_libexttextcat" = "yes"; then
10432     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10434 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10436 dnl ===================================================================
10437 dnl Checking for libnumbertext
10438 dnl ===================================================================
10439 AC_MSG_CHECKING([whether to use libnumbertext])
10440 if test "$enable_libnumbertext" = "no"; then
10441     AC_MSG_RESULT([no])
10442     ENABLE_LIBNUMBERTEXT=
10443     SYSTEM_LIBNUMBERTEXT=
10444 else
10445     AC_MSG_RESULT([yes])
10446     ENABLE_LIBNUMBERTEXT=TRUE
10447     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10448     if test "$with_system_libnumbertext" = "yes"; then
10449         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10450         SYSTEM_LIBNUMBERTEXT=YES
10451     else
10452         SYSTEM_LIBNUMBERTEXT=
10453         AC_LANG_PUSH([C++])
10454         save_CPPFLAGS=$CPPFLAGS
10455         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10456         AC_CHECK_HEADERS([codecvt regex])
10457         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10458                 [ ENABLE_LIBNUMBERTEXT=''
10459                   LIBNUMBERTEXT_CFLAGS=''
10460                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10461                                Enable libnumbertext fallback (missing number to number name conversion).])
10462                 ])
10463         CPPFLAGS=$save_CPPFLAGS
10464         AC_LANG_POP([C++])
10465     fi
10466     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10467         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10468     fi
10470 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10471 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10472 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10473 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10475 dnl ***************************************
10476 dnl testing libc version for Linux...
10477 dnl ***************************************
10478 if test "$_os" = "Linux"; then
10479     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10480     exec 6>/dev/null # no output
10481     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10482     exec 6>&1 # output on again
10483     if test "$HAVE_LIBC"; then
10484         AC_MSG_RESULT([yes])
10485     else
10486         AC_MSG_ERROR([no, upgrade libc])
10487     fi
10490 dnl =========================================
10491 dnl Check for uuidgen
10492 dnl =========================================
10493 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10494     # presence is already tested above in the WINDOWS_SDK_HOME check
10495     UUIDGEN=uuidgen.exe
10496     AC_SUBST(UUIDGEN)
10497 else
10498     AC_PATH_PROG([UUIDGEN], [uuidgen])
10499     if test -z "$UUIDGEN"; then
10500         AC_MSG_WARN([uuid is needed for building installation sets])
10501     fi
10504 dnl ***************************************
10505 dnl Checking for bison and flex
10506 dnl ***************************************
10507 AC_PATH_PROG(BISON, bison)
10508 if test -z "$BISON"; then
10509     AC_MSG_ERROR([no bison found in \$PATH, install it])
10510 else
10511     AC_MSG_CHECKING([the bison version])
10512     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10513     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10514     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
10515     dnl cause
10516     dnl
10517     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]
10518     dnl   typedef union YYSTYPE
10519     dnl           ~~~~~~^~~~~~~
10520     dnl
10521     dnl while at least 3.4.1 is know to be good:
10522     if test "$COMPILER_PLUGINS" = TRUE; then
10523         if test "$_bison_longver" -lt 2004; then
10524             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
10525         fi
10526     else
10527         if test "$_bison_longver" -lt 2000; then
10528             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10529         fi
10530     fi
10532 AC_SUBST([BISON])
10534 AC_PATH_PROG(FLEX, flex)
10535 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10536     FLEX=`cygpath -m $FLEX`
10538 if test -z "$FLEX"; then
10539     AC_MSG_ERROR([no flex found in \$PATH, install it])
10540 else
10541     AC_MSG_CHECKING([the flex version])
10542     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10543     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10544         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10545     fi
10547 AC_SUBST([FLEX])
10548 dnl ***************************************
10549 dnl Checking for patch
10550 dnl ***************************************
10551 AC_PATH_PROG(PATCH, patch)
10552 if test -z "$PATCH"; then
10553     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10556 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10557 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10558     if test -z "$with_gnu_patch"; then
10559         GNUPATCH=$PATCH
10560     else
10561         if test -x "$with_gnu_patch"; then
10562             GNUPATCH=$with_gnu_patch
10563         else
10564             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10565         fi
10566     fi
10568     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10569     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10570         AC_MSG_RESULT([yes])
10571     else
10572         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10573     fi
10574 else
10575     GNUPATCH=$PATCH
10578 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10579     GNUPATCH=`cygpath -m $GNUPATCH`
10582 dnl We also need to check for --with-gnu-cp
10584 if test -z "$with_gnu_cp"; then
10585     # check the place where the good stuff is hidden on Solaris...
10586     if test -x /usr/gnu/bin/cp; then
10587         GNUCP=/usr/gnu/bin/cp
10588     else
10589         AC_PATH_PROGS(GNUCP, gnucp cp)
10590     fi
10591     if test -z $GNUCP; then
10592         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10593     fi
10594 else
10595     if test -x "$with_gnu_cp"; then
10596         GNUCP=$with_gnu_cp
10597     else
10598         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10599     fi
10602 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10603     GNUCP=`cygpath -m $GNUCP`
10606 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10607 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10608     AC_MSG_RESULT([yes])
10609 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10610     AC_MSG_RESULT([yes])
10611 else
10612     case "$build_os" in
10613     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10614         x_GNUCP=[\#]
10615         GNUCP=''
10616         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10617         ;;
10618     *)
10619         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10620         ;;
10621     esac
10624 AC_SUBST(GNUPATCH)
10625 AC_SUBST(GNUCP)
10626 AC_SUBST(x_GNUCP)
10628 dnl ***************************************
10629 dnl testing assembler path
10630 dnl ***************************************
10631 ML_EXE=""
10632 if test "$_os" = "WINNT"; then
10633     if test "$BITNESS_OVERRIDE" = ""; then
10634         assembler=ml.exe
10635     else
10636         assembler=ml64.exe
10637     fi
10639     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10640     if test -f "$CL_PATH/$assembler"; then
10641         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10642         AC_MSG_RESULT([$ML_EXE])
10643     else
10644         AC_MSG_ERROR([not found])
10645     fi
10648 AC_SUBST(ML_EXE)
10650 dnl ===================================================================
10651 dnl We need zip and unzip
10652 dnl ===================================================================
10653 AC_PATH_PROG(ZIP, zip)
10654 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10655 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10656     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],,)
10659 AC_PATH_PROG(UNZIP, unzip)
10660 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10662 dnl ===================================================================
10663 dnl Zip must be a specific type for different build types.
10664 dnl ===================================================================
10665 if test $build_os = cygwin; then
10666     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10667         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10668     fi
10671 dnl ===================================================================
10672 dnl We need touch with -h option support.
10673 dnl ===================================================================
10674 AC_PATH_PROG(TOUCH, touch)
10675 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10676 touch warn
10677 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10678     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],,)
10681 dnl ===================================================================
10682 dnl Check for system epoxy
10683 dnl ===================================================================
10684 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10686 dnl ===================================================================
10687 dnl Set vcl option: coordinate device in double or sal_Int32
10688 dnl ===================================================================
10690 dnl disabled for now, we don't want subtle differences between OSs
10691 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10692 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10693 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10694 dnl     AC_MSG_RESULT([double])
10695 dnl else
10696 dnl     AC_MSG_RESULT([sal_Int32])
10697 dnl fi
10699 dnl ===================================================================
10700 dnl Test which vclplugs have to be built.
10701 dnl ===================================================================
10702 R=""
10703 if test "$USING_X11" != TRUE; then
10704     enable_gtk3=no
10706 GTK3_CFLAGS=""
10707 GTK3_LIBS=""
10708 ENABLE_GTK3=""
10709 if test "x$enable_gtk3" = "xyes"; then
10710     if test "$with_system_cairo" = no; then
10711         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10712     fi
10713     : ${with_system_cairo:=yes}
10714     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="")
10715     if test "x$ENABLE_GTK3" = "xTRUE"; then
10716         AC_DEFINE(ENABLE_GTK3)
10717         R="gtk3"
10718     else
10719         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10720     fi
10721     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10722     FilterLibs "${GTK3_LIBS}"
10723     GTK3_LIBS="${filteredlibs}"
10725     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10726     if test "$with_system_epoxy" != "yes"; then
10727         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10728         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10729                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10730     fi
10732 AC_SUBST(GTK3_LIBS)
10733 AC_SUBST(GTK3_CFLAGS)
10734 AC_SUBST(ENABLE_GTK3)
10736 if test "$enable_introspection" = yes; then
10737     if test "$ENABLE_GTK3" = TRUE; then
10738         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10739     else
10740         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10741     fi
10744 ENABLE_QT5=""
10745 if test "x$enable_qt5" = "xyes"; then
10746     ENABLE_QT5="TRUE"
10747     AC_DEFINE(ENABLE_QT5)
10748     R="$R qt5"
10750 AC_SUBST(ENABLE_QT5)
10752 ENABLE_KF5=""
10753 if test "x$enable_kf5" = "xyes"; then
10754     ENABLE_KF5="TRUE"
10755     AC_DEFINE(ENABLE_KF5)
10756     R="$R kf5"
10758 AC_SUBST(ENABLE_KF5)
10760 ENABLE_GTK3_KDE5=""
10761 if test "x$enable_gtk3_kde5" = "xyes"; then
10762     ENABLE_GTK3_KDE5="TRUE"
10763     AC_DEFINE(ENABLE_GTK3_KDE5)
10764     R="$R gtk3_kde5"
10766 AC_SUBST(ENABLE_GTK3_KDE5)
10768 if test "$_os" = "WINNT"; then
10769     R="$R win"
10770 elif test "$_os" = "Darwin"; then
10771     R="$R osx"
10772 elif test "$_os" = "iOS"; then
10773     R="ios (builtin)"
10776 build_vcl_plugins="$R"
10777 if test -z "$build_vcl_plugins"; then
10778     build_vcl_plugins="none"
10780 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10782 dnl ===================================================================
10783 dnl check for dbus support
10784 dnl ===================================================================
10785 ENABLE_DBUS=""
10786 DBUS_CFLAGS=""
10787 DBUS_LIBS=""
10788 DBUS_GLIB_CFLAGS=""
10789 DBUS_GLIB_LIBS=""
10790 DBUS_HAVE_GLIB=""
10792 if test "$enable_dbus" = "no"; then
10793     test_dbus=no
10796 AC_MSG_CHECKING([whether to enable DBUS support])
10797 if test "$test_dbus" = "yes"; then
10798     ENABLE_DBUS="TRUE"
10799     AC_MSG_RESULT([yes])
10800     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10801     AC_DEFINE(ENABLE_DBUS)
10802     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10803     FilterLibs "${DBUS_LIBS}"
10804     DBUS_LIBS="${filteredlibs}"
10806     # Glib is needed for BluetoothServer
10807     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10808     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10809         [
10810             DBUS_HAVE_GLIB="TRUE"
10811             AC_DEFINE(DBUS_HAVE_GLIB,1)
10812         ],
10813         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10814     )
10815 else
10816     AC_MSG_RESULT([no])
10819 AC_SUBST(ENABLE_DBUS)
10820 AC_SUBST(DBUS_CFLAGS)
10821 AC_SUBST(DBUS_LIBS)
10822 AC_SUBST(DBUS_GLIB_CFLAGS)
10823 AC_SUBST(DBUS_GLIB_LIBS)
10824 AC_SUBST(DBUS_HAVE_GLIB)
10826 AC_MSG_CHECKING([whether to enable Impress remote control])
10827 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10828     AC_MSG_RESULT([yes])
10829     ENABLE_SDREMOTE=TRUE
10830     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10832     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
10833         # The Bluetooth code doesn't compile with macOS SDK 10.15
10834         if test "$enable_sdremote_bluetooth" = yes; then
10835             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
10836         fi
10837         enable_sdremote_bluetooth=no
10838     fi
10839     # If not explicitly enabled or disabled, default
10840     if test -z "$enable_sdremote_bluetooth"; then
10841         case "$OS" in
10842         LINUX|MACOSX|WNT)
10843             # Default to yes for these
10844             enable_sdremote_bluetooth=yes
10845             ;;
10846         *)
10847             # otherwise no
10848             enable_sdremote_bluetooth=no
10849             ;;
10850         esac
10851     fi
10852     # $enable_sdremote_bluetooth is guaranteed non-empty now
10854     if test "$enable_sdremote_bluetooth" != "no"; then
10855         if test "$OS" = "LINUX"; then
10856             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10857                 AC_MSG_RESULT([yes])
10858                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10859                 dnl ===================================================================
10860                 dnl Check for system bluez
10861                 dnl ===================================================================
10862                 AC_MSG_CHECKING([which Bluetooth header to use])
10863                 if test "$with_system_bluez" = "yes"; then
10864                     AC_MSG_RESULT([external])
10865                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10866                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10867                     SYSTEM_BLUEZ=TRUE
10868                 else
10869                     AC_MSG_RESULT([internal])
10870                     SYSTEM_BLUEZ=
10871                 fi
10872             else
10873                 AC_MSG_RESULT([no, dbus disabled])
10874                 ENABLE_SDREMOTE_BLUETOOTH=
10875                 SYSTEM_BLUEZ=
10876             fi
10877         else
10878             AC_MSG_RESULT([yes])
10879             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10880             SYSTEM_BLUEZ=
10881         fi
10882     else
10883         AC_MSG_RESULT([no])
10884         ENABLE_SDREMOTE_BLUETOOTH=
10885         SYSTEM_BLUEZ=
10886     fi
10887 else
10888     ENABLE_SDREMOTE=
10889     SYSTEM_BLUEZ=
10890     AC_MSG_RESULT([no])
10892 AC_SUBST(ENABLE_SDREMOTE)
10893 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10894 AC_SUBST(SYSTEM_BLUEZ)
10896 dnl ===================================================================
10897 dnl Check whether to enable GIO support
10898 dnl ===================================================================
10899 if test "$ENABLE_GTK3" = "TRUE"; then
10900     AC_MSG_CHECKING([whether to enable GIO support])
10901     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10902         dnl Need at least 2.26 for the dbus support.
10903         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10904                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10905         if test "$ENABLE_GIO" = "TRUE"; then
10906             AC_DEFINE(ENABLE_GIO)
10907             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10908             FilterLibs "${GIO_LIBS}"
10909             GIO_LIBS="${filteredlibs}"
10910         fi
10911     else
10912         AC_MSG_RESULT([no])
10913     fi
10915 AC_SUBST(ENABLE_GIO)
10916 AC_SUBST(GIO_CFLAGS)
10917 AC_SUBST(GIO_LIBS)
10920 dnl ===================================================================
10922 SPLIT_APP_MODULES=""
10923 if test "$enable_split_app_modules" = "yes"; then
10924     SPLIT_APP_MODULES="TRUE"
10926 AC_SUBST(SPLIT_APP_MODULES)
10928 SPLIT_OPT_FEATURES=""
10929 if test "$enable_split_opt_features" = "yes"; then
10930     SPLIT_OPT_FEATURES="TRUE"
10932 AC_SUBST(SPLIT_OPT_FEATURES)
10934 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10935     if test "$enable_cairo_canvas" = yes; then
10936         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10937     fi
10938     enable_cairo_canvas=no
10939 elif test -z "$enable_cairo_canvas"; then
10940     enable_cairo_canvas=yes
10943 ENABLE_CAIRO_CANVAS=""
10944 if test "$enable_cairo_canvas" = "yes"; then
10945     test_cairo=yes
10946     ENABLE_CAIRO_CANVAS="TRUE"
10947     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10949 AC_SUBST(ENABLE_CAIRO_CANVAS)
10951 dnl ===================================================================
10952 dnl Check whether the GStreamer libraries are available.
10953 dnl ===================================================================
10955 ENABLE_GSTREAMER_1_0=""
10957 if test "$build_gstreamer_1_0" = "yes"; then
10959     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10960     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10961         ENABLE_GSTREAMER_1_0="TRUE"
10962         AC_MSG_RESULT([yes])
10963         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10964         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10965         FilterLibs "${GSTREAMER_1_0_LIBS}"
10966         GSTREAMER_1_0_LIBS="${filteredlibs}"
10967         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10968     else
10969         AC_MSG_RESULT([no])
10970     fi
10972 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10973 AC_SUBST(GSTREAMER_1_0_LIBS)
10974 AC_SUBST(ENABLE_GSTREAMER_1_0)
10976 dnl ===================================================================
10977 dnl Check whether to build the VLC avmedia backend
10978 dnl ===================================================================
10980 ENABLE_VLC=""
10982 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10983 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10984     ENABLE_VLC="TRUE"
10985     AC_MSG_RESULT([yes])
10986 else
10987     AC_MSG_RESULT([no])
10989 AC_SUBST(ENABLE_VLC)
10991 ENABLE_OPENGL_TRANSITIONS=
10992 ENABLE_OPENGL_CANVAS=
10993 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10994    : # disable
10995 elif test "$_os" = "Darwin"; then
10996     # We use frameworks on macOS, no need for detail checks
10997     ENABLE_OPENGL_TRANSITIONS=TRUE
10998     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10999     ENABLE_OPENGL_CANVAS=TRUE
11000 elif test $_os = WINNT; then
11001     ENABLE_OPENGL_TRANSITIONS=TRUE
11002     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11003     ENABLE_OPENGL_CANVAS=TRUE
11004 else
11005     if test "$USING_X11" = TRUE; then
11006         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11007         ENABLE_OPENGL_TRANSITIONS=TRUE
11008         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11009         ENABLE_OPENGL_CANVAS=TRUE
11010     fi
11013 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11014 AC_SUBST(ENABLE_OPENGL_CANVAS)
11016 dnl =================================================
11017 dnl Check whether to build with OpenCL support.
11018 dnl =================================================
11020 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
11021     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11022     # platform (optional at run-time, used through clew).
11023     BUILD_TYPE="$BUILD_TYPE OPENCL"
11024     AC_DEFINE(HAVE_FEATURE_OPENCL)
11027 dnl =================================================
11028 dnl Check whether to build with dconf support.
11029 dnl =================================================
11031 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11032     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11033         if test "$enable_dconf" = yes; then
11034             AC_MSG_ERROR([dconf not found])
11035         else
11036             enable_dconf=no
11037         fi])
11039 AC_MSG_CHECKING([whether to enable dconf])
11040 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11041     DCONF_CFLAGS=
11042     DCONF_LIBS=
11043     ENABLE_DCONF=
11044     AC_MSG_RESULT([no])
11045 else
11046     ENABLE_DCONF=TRUE
11047     AC_DEFINE(ENABLE_DCONF)
11048     AC_MSG_RESULT([yes])
11050 AC_SUBST([DCONF_CFLAGS])
11051 AC_SUBST([DCONF_LIBS])
11052 AC_SUBST([ENABLE_DCONF])
11054 # pdf import?
11055 AC_MSG_CHECKING([whether to build the PDF import feature])
11056 ENABLE_PDFIMPORT=
11057 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11058     AC_MSG_RESULT([yes])
11059     ENABLE_PDFIMPORT=TRUE
11060     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11061 else
11062     AC_MSG_RESULT([no])
11065 # Pdfium?
11066 AC_MSG_CHECKING([whether to build PDFium])
11067 ENABLE_PDFIUM=
11068 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11069     AC_MSG_RESULT([yes])
11070     ENABLE_PDFIUM=TRUE
11071     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11072     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11073 else
11074     AC_MSG_RESULT([no])
11076 AC_SUBST(ENABLE_PDFIUM)
11078 dnl ===================================================================
11079 dnl Check for poppler
11080 dnl ===================================================================
11081 ENABLE_POPPLER=
11082 AC_MSG_CHECKING([whether to build Poppler])
11083 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11084     AC_MSG_RESULT([yes])
11085     ENABLE_POPPLER=TRUE
11086     AC_DEFINE(HAVE_FEATURE_POPPLER)
11087 else
11088     AC_MSG_RESULT([no])
11090 AC_SUBST(ENABLE_POPPLER)
11092 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11093     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11096 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11097     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11100 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11101     dnl ===================================================================
11102     dnl Check for system poppler
11103     dnl ===================================================================
11104     AC_MSG_CHECKING([which PDF import poppler to use])
11105     if test "$with_system_poppler" = "yes"; then
11106         AC_MSG_RESULT([external])
11107         SYSTEM_POPPLER=TRUE
11108         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11109         AC_LANG_PUSH([C++])
11110         save_CXXFLAGS=$CXXFLAGS
11111         save_CPPFLAGS=$CPPFLAGS
11112         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11113         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11114         AC_CHECK_HEADER([cpp/poppler-version.h],
11115             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11116             [])
11117         CXXFLAGS=$save_CXXFLAGS
11118         CPPFLAGS=$save_CPPFLAGS
11119         AC_LANG_POP([C++])
11120         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11122         FilterLibs "${POPPLER_LIBS}"
11123         POPPLER_LIBS="${filteredlibs}"
11124     else
11125         AC_MSG_RESULT([internal])
11126         SYSTEM_POPPLER=
11127         BUILD_TYPE="$BUILD_TYPE POPPLER"
11128         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11129     fi
11130     AC_DEFINE([ENABLE_PDFIMPORT],1)
11132 AC_SUBST(ENABLE_PDFIMPORT)
11133 AC_SUBST(SYSTEM_POPPLER)
11134 AC_SUBST(POPPLER_CFLAGS)
11135 AC_SUBST(POPPLER_LIBS)
11137 # Skia?
11138 AC_MSG_CHECKING([whether to build Skia])
11139 ENABLE_SKIA=
11140 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11141     AC_MSG_RESULT([yes])
11142     ENABLE_SKIA=TRUE
11143     AC_DEFINE(HAVE_FEATURE_SKIA)
11144     BUILD_TYPE="$BUILD_TYPE SKIA"
11145 else
11146     AC_MSG_RESULT([no])
11148 AC_SUBST(ENABLE_SKIA)
11150 SYSTEM_GPGMEPP=
11152 if test "$build_for_ios" = "YES"; then
11153     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11154     AC_MSG_RESULT([yes])
11155 elif test "$enable_mpl_subset" = "yes"; then
11156     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11157     AC_MSG_RESULT([yes])
11158 elif test "$enable_fuzzers" = "yes"; then
11159     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11160     AC_MSG_RESULT([yes])
11161 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11162     dnl ===================================================================
11163     dnl Check for system gpgme
11164     dnl ===================================================================
11165     AC_MSG_CHECKING([which gpgmepp to use])
11166     if test "$with_system_gpgmepp" = "yes"; then
11167         AC_MSG_RESULT([external])
11168         SYSTEM_GPGMEPP=TRUE
11170         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11171         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11172             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11173         # progress_callback is the only func with plain C linkage
11174         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11175         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11176             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11177         AC_CHECK_HEADER(gpgme.h, [],
11178             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11179     else
11180         AC_MSG_RESULT([internal])
11181         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11182         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11184         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11185         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11186         if test "$_os" != "WINNT"; then
11187             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11188             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11189         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11190             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11191         fi
11192     fi
11193     ENABLE_GPGMEPP=TRUE
11194     AC_DEFINE([HAVE_FEATURE_GPGME])
11195     AC_PATH_PROG(GPG, gpg)
11196     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11197     # so let's exclude that manually for the moment
11198     if test -n "$GPG" -a "$_os" != "WINNT"; then
11199         # make sure we not only have a working gpgme, but a full working
11200         # gpg installation to run OpenPGP signature verification
11201         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11202     fi
11203     if test "$_os" = "Linux"; then
11204       uid=`id -u`
11205       AC_MSG_CHECKING([for /run/user/$uid])
11206       if test -d /run/user/$uid; then
11207         AC_MSG_RESULT([yes])
11208         AC_PATH_PROG(GPGCONF, gpgconf)
11210         # Older versions of gpgconf are not working as expected, since
11211         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11212         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11213         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11214         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11215         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11216         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11217         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11218           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11219           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11220           if $GPGCONF --dump-options > /dev/null ; then
11221             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11222               AC_MSG_RESULT([yes])
11223               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11224               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11225             else
11226               AC_MSG_RESULT([no])
11227             fi
11228           else
11229             AC_MSG_RESULT([no. missing or broken gpgconf?])
11230           fi
11231         else
11232           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11233         fi
11234       else
11235         AC_MSG_RESULT([no])
11236      fi
11237    fi
11239 AC_SUBST(ENABLE_GPGMEPP)
11240 AC_SUBST(SYSTEM_GPGMEPP)
11241 AC_SUBST(GPG_ERROR_CFLAGS)
11242 AC_SUBST(GPG_ERROR_LIBS)
11243 AC_SUBST(LIBASSUAN_CFLAGS)
11244 AC_SUBST(LIBASSUAN_LIBS)
11245 AC_SUBST(GPGMEPP_CFLAGS)
11246 AC_SUBST(GPGMEPP_LIBS)
11248 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11249 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11250     AC_MSG_RESULT([yes])
11251     ENABLE_MEDIAWIKI=TRUE
11252     BUILD_TYPE="$BUILD_TYPE XSLTML"
11253     if test  "x$with_java" = "xno"; then
11254         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11255     fi
11256 else
11257     AC_MSG_RESULT([no])
11258     ENABLE_MEDIAWIKI=
11259     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11261 AC_SUBST(ENABLE_MEDIAWIKI)
11263 AC_MSG_CHECKING([whether to build the Report Builder])
11264 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11265     AC_MSG_RESULT([yes])
11266     ENABLE_REPORTBUILDER=TRUE
11267     AC_MSG_CHECKING([which jfreereport libs to use])
11268     if test "$with_system_jfreereport" = "yes"; then
11269         SYSTEM_JFREEREPORT=TRUE
11270         AC_MSG_RESULT([external])
11271         if test -z $SAC_JAR; then
11272             SAC_JAR=/usr/share/java/sac.jar
11273         fi
11274         if ! test -f $SAC_JAR; then
11275              AC_MSG_ERROR(sac.jar not found.)
11276         fi
11278         if test -z $LIBXML_JAR; then
11279             if test -f /usr/share/java/libxml-1.0.0.jar; then
11280                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11281             elif test -f /usr/share/java/libxml.jar; then
11282                 LIBXML_JAR=/usr/share/java/libxml.jar
11283             else
11284                 AC_MSG_ERROR(libxml.jar replacement not found.)
11285             fi
11286         elif ! test -f $LIBXML_JAR; then
11287             AC_MSG_ERROR(libxml.jar not found.)
11288         fi
11290         if test -z $FLUTE_JAR; then
11291             if test -f /usr/share/java/flute-1.3.0.jar; then
11292                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11293             elif test -f /usr/share/java/flute.jar; then
11294                 FLUTE_JAR=/usr/share/java/flute.jar
11295             else
11296                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11297             fi
11298         elif ! test -f $FLUTE_JAR; then
11299             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11300         fi
11302         if test -z $JFREEREPORT_JAR; then
11303             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11304                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11305             elif test -f /usr/share/java/flow-engine.jar; then
11306                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11307             else
11308                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11309             fi
11310         elif ! test -f  $JFREEREPORT_JAR; then
11311                 AC_MSG_ERROR(jfreereport.jar not found.)
11312         fi
11314         if test -z $LIBLAYOUT_JAR; then
11315             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11316                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11317             elif test -f /usr/share/java/liblayout.jar; then
11318                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11319             else
11320                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11321             fi
11322         elif ! test -f $LIBLAYOUT_JAR; then
11323                 AC_MSG_ERROR(liblayout.jar not found.)
11324         fi
11326         if test -z $LIBLOADER_JAR; then
11327             if test -f /usr/share/java/libloader-1.0.0.jar; then
11328                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11329             elif test -f /usr/share/java/libloader.jar; then
11330                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11331             else
11332                 AC_MSG_ERROR(libloader.jar replacement not found.)
11333             fi
11334         elif ! test -f  $LIBLOADER_JAR; then
11335             AC_MSG_ERROR(libloader.jar not found.)
11336         fi
11338         if test -z $LIBFORMULA_JAR; then
11339             if test -f /usr/share/java/libformula-0.2.0.jar; then
11340                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11341             elif test -f /usr/share/java/libformula.jar; then
11342                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11343             else
11344                 AC_MSG_ERROR(libformula.jar replacement not found.)
11345             fi
11346         elif ! test -f $LIBFORMULA_JAR; then
11347                 AC_MSG_ERROR(libformula.jar not found.)
11348         fi
11350         if test -z $LIBREPOSITORY_JAR; then
11351             if test -f /usr/share/java/librepository-1.0.0.jar; then
11352                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11353             elif test -f /usr/share/java/librepository.jar; then
11354                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11355             else
11356                 AC_MSG_ERROR(librepository.jar replacement not found.)
11357             fi
11358         elif ! test -f $LIBREPOSITORY_JAR; then
11359             AC_MSG_ERROR(librepository.jar not found.)
11360         fi
11362         if test -z $LIBFONTS_JAR; then
11363             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11364                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11365             elif test -f /usr/share/java/libfonts.jar; then
11366                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11367             else
11368                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11369             fi
11370         elif ! test -f $LIBFONTS_JAR; then
11371                 AC_MSG_ERROR(libfonts.jar not found.)
11372         fi
11374         if test -z $LIBSERIALIZER_JAR; then
11375             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11376                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11377             elif test -f /usr/share/java/libserializer.jar; then
11378                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11379             else
11380                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11381             fi
11382         elif ! test -f $LIBSERIALIZER_JAR; then
11383                 AC_MSG_ERROR(libserializer.jar not found.)
11384         fi
11386         if test -z $LIBBASE_JAR; then
11387             if test -f /usr/share/java/libbase-1.0.0.jar; then
11388                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11389             elif test -f /usr/share/java/libbase.jar; then
11390                 LIBBASE_JAR=/usr/share/java/libbase.jar
11391             else
11392                 AC_MSG_ERROR(libbase.jar replacement not found.)
11393             fi
11394         elif ! test -f $LIBBASE_JAR; then
11395             AC_MSG_ERROR(libbase.jar not found.)
11396         fi
11398     else
11399         AC_MSG_RESULT([internal])
11400         SYSTEM_JFREEREPORT=
11401         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11402         NEED_ANT=TRUE
11403     fi
11404 else
11405     AC_MSG_RESULT([no])
11406     ENABLE_REPORTBUILDER=
11407     SYSTEM_JFREEREPORT=
11409 AC_SUBST(ENABLE_REPORTBUILDER)
11410 AC_SUBST(SYSTEM_JFREEREPORT)
11411 AC_SUBST(SAC_JAR)
11412 AC_SUBST(LIBXML_JAR)
11413 AC_SUBST(FLUTE_JAR)
11414 AC_SUBST(JFREEREPORT_JAR)
11415 AC_SUBST(LIBBASE_JAR)
11416 AC_SUBST(LIBLAYOUT_JAR)
11417 AC_SUBST(LIBLOADER_JAR)
11418 AC_SUBST(LIBFORMULA_JAR)
11419 AC_SUBST(LIBREPOSITORY_JAR)
11420 AC_SUBST(LIBFONTS_JAR)
11421 AC_SUBST(LIBSERIALIZER_JAR)
11423 # this has to be here because both the Wiki Publisher and the SRB use
11424 # commons-logging
11425 COMMONS_LOGGING_VERSION=1.2
11426 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11427     AC_MSG_CHECKING([which Apache commons-* libs to use])
11428     if test "$with_system_apache_commons" = "yes"; then
11429         SYSTEM_APACHE_COMMONS=TRUE
11430         AC_MSG_RESULT([external])
11431         if test -z $COMMONS_LOGGING_JAR; then
11432             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11433                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11434            elif test -f /usr/share/java/commons-logging.jar; then
11435                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11436             else
11437                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11438             fi
11439         elif ! test -f $COMMONS_LOGGING_JAR; then
11440             AC_MSG_ERROR(commons-logging.jar not found.)
11441         fi
11442     else
11443         AC_MSG_RESULT([internal])
11444         SYSTEM_APACHE_COMMONS=
11445         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11446         NEED_ANT=TRUE
11447     fi
11449 AC_SUBST(SYSTEM_APACHE_COMMONS)
11450 AC_SUBST(COMMONS_LOGGING_JAR)
11451 AC_SUBST(COMMONS_LOGGING_VERSION)
11453 # scripting provider for BeanShell?
11454 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11455 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11456     AC_MSG_RESULT([yes])
11457     ENABLE_SCRIPTING_BEANSHELL=TRUE
11459     dnl ===================================================================
11460     dnl Check for system beanshell
11461     dnl ===================================================================
11462     AC_MSG_CHECKING([which beanshell to use])
11463     if test "$with_system_beanshell" = "yes"; then
11464         AC_MSG_RESULT([external])
11465         SYSTEM_BSH=TRUE
11466         if test -z $BSH_JAR; then
11467             BSH_JAR=/usr/share/java/bsh.jar
11468         fi
11469         if ! test -f $BSH_JAR; then
11470             AC_MSG_ERROR(bsh.jar not found.)
11471         fi
11472     else
11473         AC_MSG_RESULT([internal])
11474         SYSTEM_BSH=
11475         BUILD_TYPE="$BUILD_TYPE BSH"
11476     fi
11477 else
11478     AC_MSG_RESULT([no])
11479     ENABLE_SCRIPTING_BEANSHELL=
11480     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11482 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11483 AC_SUBST(SYSTEM_BSH)
11484 AC_SUBST(BSH_JAR)
11486 # scripting provider for JavaScript?
11487 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11488 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11489     AC_MSG_RESULT([yes])
11490     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11492     dnl ===================================================================
11493     dnl Check for system rhino
11494     dnl ===================================================================
11495     AC_MSG_CHECKING([which rhino to use])
11496     if test "$with_system_rhino" = "yes"; then
11497         AC_MSG_RESULT([external])
11498         SYSTEM_RHINO=TRUE
11499         if test -z $RHINO_JAR; then
11500             RHINO_JAR=/usr/share/java/js.jar
11501         fi
11502         if ! test -f $RHINO_JAR; then
11503             AC_MSG_ERROR(js.jar not found.)
11504         fi
11505     else
11506         AC_MSG_RESULT([internal])
11507         SYSTEM_RHINO=
11508         BUILD_TYPE="$BUILD_TYPE RHINO"
11509         NEED_ANT=TRUE
11510     fi
11511 else
11512     AC_MSG_RESULT([no])
11513     ENABLE_SCRIPTING_JAVASCRIPT=
11514     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11516 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11517 AC_SUBST(SYSTEM_RHINO)
11518 AC_SUBST(RHINO_JAR)
11520 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11521 # paths should be added to library search path. So lets put all 64-bit
11522 # platforms there.
11523 supports_multilib=
11524 case "$host_cpu" in
11525 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11526     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11527         supports_multilib="yes"
11528     fi
11529     ;;
11531     ;;
11532 esac
11534 dnl ===================================================================
11535 dnl QT5 Integration
11536 dnl ===================================================================
11538 QT5_CFLAGS=""
11539 QT5_LIBS=""
11540 QMAKE5="qmake"
11541 MOC5="moc"
11542 QT5_GOBJECT_CFLAGS=""
11543 QT5_GOBJECT_LIBS=""
11544 QT5_HAVE_GOBJECT=""
11545 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11546         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11547         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11548 then
11549     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11550     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11552     if test -n "$supports_multilib"; then
11553         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11554     fi
11556     qt5_test_include="QtWidgets/qapplication.h"
11557     qt5_test_library="libQt5Widgets.so"
11559     dnl Check for qmake5
11560     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11561     if test "$QMAKE5" = "no"; then
11562         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11563     else
11564         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11565         if test -z "$qmake5_test_ver"; then
11566             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11567         fi
11568         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11569         qt5_minimal_minor="6"
11570         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11571             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11572         else
11573             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11574         fi
11575     fi
11577     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11578     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11580     AC_MSG_CHECKING([for Qt5 headers])
11581     qt5_incdir="no"
11582     for inc_dir in $qt5_incdirs; do
11583         if test -r "$inc_dir/$qt5_test_include"; then
11584             qt5_incdir="$inc_dir"
11585             break
11586         fi
11587     done
11588     AC_MSG_RESULT([$qt5_incdir])
11589     if test "x$qt5_incdir" = "xno"; then
11590         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11591     fi
11593     AC_MSG_CHECKING([for Qt5 libraries])
11594     qt5_libdir="no"
11595     for lib_dir in $qt5_libdirs; do
11596         if test -r "$lib_dir/$qt5_test_library"; then
11597             qt5_libdir="$lib_dir"
11598             break
11599         fi
11600     done
11601     AC_MSG_RESULT([$qt5_libdir])
11602     if test "x$qt5_libdir" = "xno"; then
11603         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11604     fi
11606     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11607     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11608     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11610     if test "$USING_X11" = TRUE; then
11611         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11612         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11613             QT5_HAVE_XCB_ICCCM=1
11614             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11615         ],[
11616             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)])
11617             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11618         ])
11619         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11620         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11621         QT5_USING_X11=1
11622         AC_DEFINE(QT5_USING_X11)
11623     fi
11625     dnl Check for Meta Object Compiler
11627     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11628     if test "$MOC5" = "no"; then
11629         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11630 the root of your Qt installation by exporting QT5DIR before running "configure".])
11631     fi
11633     if test "$build_gstreamer_1_0" = "yes"; then
11634         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11635                 QT5_HAVE_GOBJECT=1
11636                 AC_DEFINE(QT5_HAVE_GOBJECT)
11637             ],
11638             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11639         )
11640     fi
11642 AC_SUBST(QT5_CFLAGS)
11643 AC_SUBST(QT5_LIBS)
11644 AC_SUBST(MOC5)
11645 AC_SUBST(QT5_GOBJECT_CFLAGS)
11646 AC_SUBST(QT5_GOBJECT_LIBS)
11647 AC_SUBST(QT5_HAVE_GOBJECT)
11649 dnl ===================================================================
11650 dnl KF5 Integration
11651 dnl ===================================================================
11653 KF5_CFLAGS=""
11654 KF5_LIBS=""
11655 KF5_CONFIG="kf5-config"
11656 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11657         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11658 then
11659     if test "$OS" = "HAIKU"; then
11660         haiku_arch="`echo $RTL_ARCH | tr X x`"
11661         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11662         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11663     fi
11665     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11666     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11667     if test -n "$supports_multilib"; then
11668         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11669     fi
11671     kf5_test_include="KF5/kcoreaddons_version.h"
11672     kf5_test_library="libKF5CoreAddons.so"
11673     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11675     dnl kf5 KDE4 support compatibility installed
11676     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11677     if test "$KF5_CONFIG" != "no"; then
11678         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11679         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11680     fi
11682     dnl Check for KF5 headers
11683     AC_MSG_CHECKING([for KF5 headers])
11684     kf5_incdir="no"
11685     for kf5_check in $kf5_incdirs; do
11686         if test -r "$kf5_check/$kf5_test_include"; then
11687             kf5_incdir="$kf5_check/KF5"
11688             break
11689         fi
11690     done
11691     AC_MSG_RESULT([$kf5_incdir])
11692     if test "x$kf5_incdir" = "xno"; then
11693         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11694     fi
11696     dnl Check for KF5 libraries
11697     AC_MSG_CHECKING([for KF5 libraries])
11698     kf5_libdir="no"
11699     for kf5_check in $kf5_libdirs; do
11700         if test -r "$kf5_check/$kf5_test_library"; then
11701             kf5_libdir="$kf5_check"
11702             break
11703         fi
11704     done
11706     AC_MSG_RESULT([$kf5_libdir])
11707     if test "x$kf5_libdir" = "xno"; then
11708         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11709     fi
11711     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"
11712     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11713     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11715     if test "$USING_X11" = TRUE; then
11716         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11717     fi
11719     AC_LANG_PUSH([C++])
11720     save_CXXFLAGS=$CXXFLAGS
11721     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11722     AC_MSG_CHECKING([whether KDE is >= 5.0])
11723        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11724 #include <kcoreaddons_version.h>
11726 int main(int argc, char **argv) {
11727        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11728        else return 1;
11730        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11731     CXXFLAGS=$save_CXXFLAGS
11732     AC_LANG_POP([C++])
11734 AC_SUBST(KF5_CFLAGS)
11735 AC_SUBST(KF5_LIBS)
11737 dnl ===================================================================
11738 dnl Test whether to include Evolution 2 support
11739 dnl ===================================================================
11740 AC_MSG_CHECKING([whether to enable evolution 2 support])
11741 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11742     AC_MSG_RESULT([yes])
11743     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11744     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11745     FilterLibs "${GOBJECT_LIBS}"
11746     GOBJECT_LIBS="${filteredlibs}"
11747     ENABLE_EVOAB2="TRUE"
11748 else
11749     ENABLE_EVOAB2=""
11750     AC_MSG_RESULT([no])
11752 AC_SUBST(ENABLE_EVOAB2)
11753 AC_SUBST(GOBJECT_CFLAGS)
11754 AC_SUBST(GOBJECT_LIBS)
11756 dnl ===================================================================
11757 dnl Test which themes to include
11758 dnl ===================================================================
11759 AC_MSG_CHECKING([which themes to include])
11760 # if none given use default subset of available themes
11761 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11762     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg tango"
11765 WITH_THEMES=""
11766 if test "x$with_theme" != "xno"; then
11767     for theme in $with_theme; do
11768         case $theme in
11769         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg|tango) real_theme="$theme" ;;
11770         default) real_theme=colibre ;;
11771         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11772         esac
11773         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11774     done
11776 AC_MSG_RESULT([$WITH_THEMES])
11777 AC_SUBST([WITH_THEMES])
11778 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11779 for theme in $with_theme; do
11780     case $theme in
11781     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11782     *) ;;
11783     esac
11784 done
11786 dnl ===================================================================
11787 dnl Test whether to integrate helppacks into the product's installer
11788 dnl ===================================================================
11789 AC_MSG_CHECKING([for helppack integration])
11790 if test "$with_helppack_integration" = "no"; then
11791     AC_MSG_RESULT([no integration])
11792 else
11793     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11794     AC_MSG_RESULT([integration])
11797 ###############################################################################
11798 # Extensions checking
11799 ###############################################################################
11800 AC_MSG_CHECKING([for extensions integration])
11801 if test "x$enable_extension_integration" != "xno"; then
11802     WITH_EXTENSION_INTEGRATION=TRUE
11803     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11804     AC_MSG_RESULT([yes, use integration])
11805 else
11806     WITH_EXTENSION_INTEGRATION=
11807     AC_MSG_RESULT([no, do not integrate])
11809 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11811 dnl Should any extra extensions be included?
11812 dnl There are standalone tests for each of these below.
11813 WITH_EXTRA_EXTENSIONS=
11814 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11816 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11817 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11818 if test "x$with_java" != "xno"; then
11819     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11820     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11823 AC_MSG_CHECKING([whether to build opens___.ttf])
11824 if test "$enable_build_opensymbol" = "yes"; then
11825     AC_MSG_RESULT([yes])
11826     AC_PATH_PROG(FONTFORGE, fontforge)
11827     if test -z "$FONTFORGE"; then
11828         AC_MSG_ERROR([fontforge not installed])
11829     fi
11830 else
11831     AC_MSG_RESULT([no])
11832     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11833     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11835 AC_SUBST(OPENSYMBOL_TTF)
11836 AC_SUBST(FONTFORGE)
11838 dnl ===================================================================
11839 dnl Test whether to include fonts
11840 dnl ===================================================================
11841 AC_MSG_CHECKING([whether to include third-party fonts])
11842 if test "$with_fonts" != "no"; then
11843     AC_MSG_RESULT([yes])
11844     WITH_FONTS=TRUE
11845     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11846     AC_DEFINE(HAVE_MORE_FONTS)
11847 else
11848     AC_MSG_RESULT([no])
11849     WITH_FONTS=
11850     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11852 AC_SUBST(WITH_FONTS)
11855 dnl ===================================================================
11856 dnl Test whether to enable online update service
11857 dnl ===================================================================
11858 AC_MSG_CHECKING([whether to enable online update])
11859 ENABLE_ONLINE_UPDATE=
11860 ENABLE_ONLINE_UPDATE_MAR=
11861 UPDATE_CONFIG=
11862 if test "$enable_online_update" = ""; then
11863     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11864         AC_MSG_RESULT([yes])
11865         ENABLE_ONLINE_UPDATE="TRUE"
11866     else
11867         AC_MSG_RESULT([no])
11868     fi
11869 else
11870     if test "$enable_online_update" = "mar"; then
11871         AC_MSG_RESULT([yes - MAR-based online update])
11872         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11873         if test "$with_update_config" = ""; then
11874             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11875         fi
11876         UPDATE_CONFIG="$with_update_config"
11877         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11878     elif test "$enable_online_update" = "yes"; then
11879         AC_MSG_RESULT([yes])
11880         ENABLE_ONLINE_UPDATE="TRUE"
11881     else
11882         AC_MSG_RESULT([no])
11883     fi
11885 AC_SUBST(ENABLE_ONLINE_UPDATE)
11886 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11887 AC_SUBST(UPDATE_CONFIG)
11889 dnl ===================================================================
11890 dnl Test whether we need bzip2
11891 dnl ===================================================================
11892 SYSTEM_BZIP2=
11893 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11894     AC_MSG_CHECKING([whether to use system bzip2])
11895     if test "$with_system_bzip2" = yes; then
11896         SYSTEM_BZIP2=TRUE
11897         AC_MSG_RESULT([yes])
11898         PKG_CHECK_MODULES(BZIP2, bzip2)
11899         FilterLibs "${BZIP2_LIBS}"
11900         BZIP2_LIBS="${filteredlibs}"
11901     else
11902         AC_MSG_RESULT([no])
11903         BUILD_TYPE="$BUILD_TYPE BZIP2"
11904     fi
11906 AC_SUBST(SYSTEM_BZIP2)
11907 AC_SUBST(BZIP2_CFLAGS)
11908 AC_SUBST(BZIP2_LIBS)
11910 dnl ===================================================================
11911 dnl Test whether to enable extension update
11912 dnl ===================================================================
11913 AC_MSG_CHECKING([whether to enable extension update])
11914 ENABLE_EXTENSION_UPDATE=
11915 if test "x$enable_extension_update" = "xno"; then
11916     AC_MSG_RESULT([no])
11917 else
11918     AC_MSG_RESULT([yes])
11919     ENABLE_EXTENSION_UPDATE="TRUE"
11920     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11921     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11923 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11926 dnl ===================================================================
11927 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11928 dnl ===================================================================
11929 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11930 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11931     AC_MSG_RESULT([no])
11932     ENABLE_SILENT_MSI=
11933 else
11934     AC_MSG_RESULT([yes])
11935     ENABLE_SILENT_MSI=TRUE
11936     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11938 AC_SUBST(ENABLE_SILENT_MSI)
11940 AC_MSG_CHECKING([whether and how to use Xinerama])
11941 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11942     if test "$x_libraries" = "default_x_libraries"; then
11943         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11944         if test "x$XINERAMALIB" = x; then
11945            XINERAMALIB="/usr/lib"
11946         fi
11947     else
11948         XINERAMALIB="$x_libraries"
11949     fi
11950     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11951         # we have both versions, let the user decide but use the dynamic one
11952         # per default
11953         USE_XINERAMA=TRUE
11954         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11955             XINERAMA_LINK=dynamic
11956         else
11957             XINERAMA_LINK=static
11958         fi
11959     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11960         # we have only the dynamic version
11961         USE_XINERAMA=TRUE
11962         XINERAMA_LINK=dynamic
11963     elif test -e "$XINERAMALIB/libXinerama.a"; then
11964         # static version
11965         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11966             USE_XINERAMA=TRUE
11967             XINERAMA_LINK=static
11968         else
11969             USE_XINERAMA=
11970             XINERAMA_LINK=none
11971         fi
11972     else
11973         # no Xinerama
11974         USE_XINERAMA=
11975         XINERAMA_LINK=none
11976     fi
11977     if test "$USE_XINERAMA" = "TRUE"; then
11978         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11979         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11980             [AC_MSG_ERROR(Xinerama header not found.)], [])
11981         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11982         if test "x$XEXTLIB" = x; then
11983            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11984         fi
11985         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11986         if test "$_os" = "FreeBSD"; then
11987             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11988         fi
11989         if test "$_os" = "Linux"; then
11990             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11991         fi
11992         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11993             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11994     else
11995         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11996     fi
11997 else
11998     USE_XINERAMA=
11999     XINERAMA_LINK=none
12000     AC_MSG_RESULT([no])
12002 AC_SUBST(USE_XINERAMA)
12003 AC_SUBST(XINERAMA_LINK)
12005 dnl ===================================================================
12006 dnl Test whether to build cairo or rely on the system version
12007 dnl ===================================================================
12009 if test "$USING_X11" = TRUE; then
12010     # Used in vcl/Library_vclplug_gen.mk
12011     test_cairo=yes
12014 if test "$test_cairo" = "yes"; then
12015     AC_MSG_CHECKING([whether to use the system cairo])
12017     : ${with_system_cairo:=$with_system_libs}
12018     if test "$with_system_cairo" = "yes"; then
12019         SYSTEM_CAIRO=TRUE
12020         AC_MSG_RESULT([yes])
12022         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12023         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12024         FilterLibs "${CAIRO_LIBS}"
12025         CAIRO_LIBS="${filteredlibs}"
12027         if test "$test_xrender" = "yes"; then
12028             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12029             AC_LANG_PUSH([C])
12030             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12031 #ifdef PictStandardA8
12032 #else
12033       return fail;
12034 #endif
12035 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12037             AC_LANG_POP([C])
12038         fi
12039     else
12040         SYSTEM_CAIRO=
12041         AC_MSG_RESULT([no])
12043         BUILD_TYPE="$BUILD_TYPE CAIRO"
12044     fi
12047 AC_SUBST(SYSTEM_CAIRO)
12048 AC_SUBST(CAIRO_CFLAGS)
12049 AC_SUBST(CAIRO_LIBS)
12051 dnl ===================================================================
12052 dnl Test whether to use avahi
12053 dnl ===================================================================
12054 if test "$_os" = "WINNT"; then
12055     # Windows uses bundled mDNSResponder
12056     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12057 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12058     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12059                       [ENABLE_AVAHI="TRUE"])
12060     AC_DEFINE(HAVE_FEATURE_AVAHI)
12061     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12062     FilterLibs "${AVAHI_LIBS}"
12063     AVAHI_LIBS="${filteredlibs}"
12066 AC_SUBST(ENABLE_AVAHI)
12067 AC_SUBST(AVAHI_CFLAGS)
12068 AC_SUBST(AVAHI_LIBS)
12070 dnl ===================================================================
12071 dnl Test whether to use liblangtag
12072 dnl ===================================================================
12073 SYSTEM_LIBLANGTAG=
12074 AC_MSG_CHECKING([whether to use system liblangtag])
12075 if test "$with_system_liblangtag" = yes; then
12076     SYSTEM_LIBLANGTAG=TRUE
12077     AC_MSG_RESULT([yes])
12078     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12079     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12080     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12081     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12082     FilterLibs "${LIBLANGTAG_LIBS}"
12083     LIBLANGTAG_LIBS="${filteredlibs}"
12084 else
12085     SYSTEM_LIBLANGTAG=
12086     AC_MSG_RESULT([no])
12087     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12088     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12089     if test "$COM" = "MSC"; then
12090         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12091     else
12092         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12093     fi
12095 AC_SUBST(SYSTEM_LIBLANGTAG)
12096 AC_SUBST(LIBLANGTAG_CFLAGS)
12097 AC_SUBST(LIBLANGTAG_LIBS)
12099 dnl ===================================================================
12100 dnl Test whether to build libpng or rely on the system version
12101 dnl ===================================================================
12103 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12105 dnl ===================================================================
12106 dnl Check for runtime JVM search path
12107 dnl ===================================================================
12108 if test "$ENABLE_JAVA" != ""; then
12109     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12110     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12111         AC_MSG_RESULT([yes])
12112         if ! test -d "$with_jvm_path"; then
12113             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12114         fi
12115         if ! test -d "$with_jvm_path"jvm; then
12116             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12117         fi
12118         JVM_ONE_PATH_CHECK="$with_jvm_path"
12119         AC_SUBST(JVM_ONE_PATH_CHECK)
12120     else
12121         AC_MSG_RESULT([no])
12122     fi
12125 dnl ===================================================================
12126 dnl Test for the presence of Ant and that it works
12127 dnl ===================================================================
12129 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12130     ANT_HOME=; export ANT_HOME
12131     WITH_ANT_HOME=; export WITH_ANT_HOME
12132     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12133         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12134             if test "$_os" = "WINNT"; then
12135                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12136             else
12137                 with_ant_home="$LODE_HOME/opt/ant"
12138             fi
12139         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12140             with_ant_home="$LODE_HOME/opt/ant"
12141         fi
12142     fi
12143     if test -z "$with_ant_home"; then
12144         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12145     else
12146         if test "$_os" = "WINNT"; then
12147             # AC_PATH_PROGS needs unix path
12148             with_ant_home=`cygpath -u "$with_ant_home"`
12149         fi
12150         AbsolutePath "$with_ant_home"
12151         with_ant_home=$absolute_path
12152         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12153         WITH_ANT_HOME=$with_ant_home
12154         ANT_HOME=$with_ant_home
12155     fi
12157     if test -z "$ANT"; then
12158         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12159     else
12160         # resolve relative or absolute symlink
12161         while test -h "$ANT"; do
12162             a_cwd=`pwd`
12163             a_basename=`basename "$ANT"`
12164             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12165             cd "`dirname "$ANT"`"
12166             cd "`dirname "$a_script"`"
12167             ANT="`pwd`"/"`basename "$a_script"`"
12168             cd "$a_cwd"
12169         done
12171         AC_MSG_CHECKING([if $ANT works])
12172         mkdir -p conftest.dir
12173         a_cwd=$(pwd)
12174         cd conftest.dir
12175         cat > conftest.java << EOF
12176         public class conftest {
12177             int testmethod(int a, int b) {
12178                     return a + b;
12179             }
12180         }
12183         cat > conftest.xml << EOF
12184         <project name="conftest" default="conftest">
12185         <target name="conftest">
12186             <javac srcdir="." includes="conftest.java">
12187             </javac>
12188         </target>
12189         </project>
12192         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12193         if test $? = 0 -a -f ./conftest.class; then
12194             AC_MSG_RESULT([Ant works])
12195             if test -z "$WITH_ANT_HOME"; then
12196                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12197                 if test -z "$ANT_HOME"; then
12198                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12199                 fi
12200             else
12201                 ANT_HOME="$WITH_ANT_HOME"
12202             fi
12203         else
12204             echo "configure: Ant test failed" >&5
12205             cat conftest.java >&5
12206             cat conftest.xml >&5
12207             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12208         fi
12209         cd "$a_cwd"
12210         rm -fr conftest.dir
12211     fi
12212     if test -z "$ANT_HOME"; then
12213         ANT_HOME="NO_ANT_HOME"
12214     else
12215         PathFormat "$ANT_HOME"
12216         ANT_HOME="$formatted_path"
12217         PathFormat "$ANT"
12218         ANT="$formatted_path"
12219     fi
12220     AC_SUBST(ANT_HOME)
12221     AC_SUBST(ANT)
12223     dnl Checking for ant.jar
12224     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12225         AC_MSG_CHECKING([Ant lib directory])
12226         if test -f $ANT_HOME/lib/ant.jar; then
12227             ANT_LIB="$ANT_HOME/lib"
12228         else
12229             if test -f $ANT_HOME/ant.jar; then
12230                 ANT_LIB="$ANT_HOME"
12231             else
12232                 if test -f /usr/share/java/ant.jar; then
12233                     ANT_LIB=/usr/share/java
12234                 else
12235                     if test -f /usr/share/ant-core/lib/ant.jar; then
12236                         ANT_LIB=/usr/share/ant-core/lib
12237                     else
12238                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12239                             ANT_LIB="$ANT_HOME/lib/ant"
12240                         else
12241                             if test -f /usr/share/lib/ant/ant.jar; then
12242                                 ANT_LIB=/usr/share/lib/ant
12243                             else
12244                                 AC_MSG_ERROR([Ant libraries not found!])
12245                             fi
12246                         fi
12247                     fi
12248                 fi
12249             fi
12250         fi
12251         PathFormat "$ANT_LIB"
12252         ANT_LIB="$formatted_path"
12253         AC_MSG_RESULT([Ant lib directory found.])
12254     fi
12255     AC_SUBST(ANT_LIB)
12257     ant_minver=1.6.0
12258     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12260     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12261     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12262     ant_version_major=`echo $ant_version | cut -d. -f1`
12263     ant_version_minor=`echo $ant_version | cut -d. -f2`
12264     echo "configure: ant_version $ant_version " >&5
12265     echo "configure: ant_version_major $ant_version_major " >&5
12266     echo "configure: ant_version_minor $ant_version_minor " >&5
12267     if test "$ant_version_major" -ge "2"; then
12268         AC_MSG_RESULT([yes, $ant_version])
12269     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12270         AC_MSG_RESULT([yes, $ant_version])
12271     else
12272         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12273     fi
12275     rm -f conftest* core core.* *.core
12278 OOO_JUNIT_JAR=
12279 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12280     AC_MSG_CHECKING([for JUnit 4])
12281     if test "$with_junit" = "yes"; then
12282         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12283             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12284         elif test -e /usr/share/java/junit4.jar; then
12285             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12286         else
12287            if test -e /usr/share/lib/java/junit.jar; then
12288               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12289            else
12290               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12291            fi
12292         fi
12293     else
12294         OOO_JUNIT_JAR=$with_junit
12295     fi
12296     if test "$_os" = "WINNT"; then
12297         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12298     fi
12299     printf 'import org.junit.Before;' > conftest.java
12300     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12301         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12302     else
12303         AC_MSG_ERROR(
12304 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12305  specify its pathname via --with-junit=..., or disable it via --without-junit])
12306     fi
12307     rm -f conftest.class conftest.java
12308     if test $OOO_JUNIT_JAR != ""; then
12309     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12310     fi
12312 AC_SUBST(OOO_JUNIT_JAR)
12314 HAMCREST_JAR=
12315 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12316     AC_MSG_CHECKING([for included Hamcrest])
12317     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12318     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12319         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12320     else
12321         AC_MSG_RESULT([Not included])
12322         AC_MSG_CHECKING([for standalone hamcrest jar.])
12323         if test "$with_hamcrest" = "yes"; then
12324             if test -e /usr/share/lib/java/hamcrest.jar; then
12325                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12326             elif test -e /usr/share/java/hamcrest/core.jar; then
12327                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12328             else
12329                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12330             fi
12331         else
12332             HAMCREST_JAR=$with_hamcrest
12333         fi
12334         if test "$_os" = "WINNT"; then
12335             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12336         fi
12337         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12338             AC_MSG_RESULT([$HAMCREST_JAR])
12339         else
12340             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),
12341                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12342         fi
12343     fi
12344     rm -f conftest.class conftest.java
12346 AC_SUBST(HAMCREST_JAR)
12349 AC_SUBST(SCPDEFS)
12352 # check for wget and curl
12354 WGET=
12355 CURL=
12357 if test "$enable_fetch_external" != "no"; then
12359 CURL=`which curl 2>/dev/null`
12361 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12362     # wget new enough?
12363     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12364     if test $? -eq 0; then
12365         WGET=$i
12366         break
12367     fi
12368 done
12370 if test -z "$WGET" -a -z "$CURL"; then
12371     AC_MSG_ERROR([neither wget nor curl found!])
12376 AC_SUBST(WGET)
12377 AC_SUBST(CURL)
12380 # check for sha256sum
12382 SHA256SUM=
12384 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12385     eval "$i -a 256 --version" > /dev/null 2>&1
12386     ret=$?
12387     if test $ret -eq 0; then
12388         SHA256SUM="$i -a 256"
12389         break
12390     fi
12391 done
12393 if test -z "$SHA256SUM"; then
12394     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12395         eval "$i --version" > /dev/null 2>&1
12396         ret=$?
12397         if test $ret -eq 0; then
12398             SHA256SUM=$i
12399             break
12400         fi
12401     done
12404 if test -z "$SHA256SUM"; then
12405     AC_MSG_ERROR([no sha256sum found!])
12408 AC_SUBST(SHA256SUM)
12410 dnl ===================================================================
12411 dnl Dealing with l10n options
12412 dnl ===================================================================
12413 AC_MSG_CHECKING([which languages to be built])
12414 # get list of all languages
12415 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12416 # the sed command does the following:
12417 #   + if a line ends with a backslash, append the next line to it
12418 #   + adds " on the beginning of the value (after =)
12419 #   + adds " at the end of the value
12420 #   + removes en-US; we want to put it on the beginning
12421 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12422 [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)]
12423 ALL_LANGS="en-US $completelangiso"
12424 # check the configured localizations
12425 WITH_LANG="$with_lang"
12427 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12428 # (Norwegian is "nb" and "nn".)
12429 if test "$WITH_LANG" = "no"; then
12430     WITH_LANG=
12433 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12434     AC_MSG_RESULT([en-US])
12435 else
12436     AC_MSG_RESULT([$WITH_LANG])
12437     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12438     if test -z "$MSGFMT"; then
12439         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12440             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12441         elif test -x "/opt/lo/bin/msgfmt"; then
12442             MSGFMT="/opt/lo/bin/msgfmt"
12443         else
12444             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12445             if test -z "$MSGFMT"; then
12446                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12447             fi
12448         fi
12449     fi
12450     if test -z "$MSGUNIQ"; then
12451         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12452             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12453         elif test -x "/opt/lo/bin/msguniq"; then
12454             MSGUNIQ="/opt/lo/bin/msguniq"
12455         else
12456             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12457             if test -z "$MSGUNIQ"; then
12458                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12459             fi
12460         fi
12461     fi
12463 AC_SUBST(MSGFMT)
12464 AC_SUBST(MSGUNIQ)
12465 # check that the list is valid
12466 for lang in $WITH_LANG; do
12467     test "$lang" = "ALL" && continue
12468     # need to check for the exact string, so add space before and after the list of all languages
12469     for vl in $ALL_LANGS; do
12470         if test "$vl" = "$lang"; then
12471            break
12472         fi
12473     done
12474     if test "$vl" != "$lang"; then
12475         # if you're reading this - you prolly quoted your languages remove the quotes ...
12476         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12477     fi
12478 done
12479 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12480     echo $WITH_LANG | grep -q en-US
12481     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12483 # list with substituted ALL
12484 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12485 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12486 test "$WITH_LANG" = "en-US" && WITH_LANG=
12487 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12488     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12489     ALL_LANGS=`echo $ALL_LANGS qtz`
12491 AC_SUBST(ALL_LANGS)
12492 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12493 AC_SUBST(WITH_LANG)
12494 AC_SUBST(WITH_LANG_LIST)
12495 AC_SUBST(GIT_NEEDED_SUBMODULES)
12497 WITH_POOR_HELP_LOCALIZATIONS=
12498 if test -d "$SRC_ROOT/translations/source"; then
12499     for l in `ls -1 $SRC_ROOT/translations/source`; do
12500         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12501             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12502         fi
12503     done
12505 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12507 if test -n "$with_locales"; then
12508     WITH_LOCALES="$with_locales"
12510     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12511     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12512     # config_host/config_locales.h.in
12513     for locale in $WITH_LOCALES; do
12514         lang=${locale%_*}
12516         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12518         case $lang in
12519         hi|mr*ne)
12520             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12521             ;;
12522         bg|ru)
12523             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12524             ;;
12525         esac
12526     done
12527 else
12528     AC_DEFINE(WITH_LOCALE_ALL)
12530 AC_SUBST(WITH_LOCALES)
12532 dnl git submodule update --reference
12533 dnl ===================================================================
12534 if test -n "${GIT_REFERENCE_SRC}"; then
12535     for repo in ${GIT_NEEDED_SUBMODULES}; do
12536         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12537             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12538         fi
12539     done
12541 AC_SUBST(GIT_REFERENCE_SRC)
12543 dnl git submodules linked dirs
12544 dnl ===================================================================
12545 if test -n "${GIT_LINK_SRC}"; then
12546     for repo in ${GIT_NEEDED_SUBMODULES}; do
12547         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12548             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12549         fi
12550     done
12552 AC_SUBST(GIT_LINK_SRC)
12554 dnl branding
12555 dnl ===================================================================
12556 AC_MSG_CHECKING([for alternative branding images directory])
12557 # initialize mapped arrays
12558 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12559 brand_files="$BRAND_INTRO_IMAGES about.svg"
12561 if test -z "$with_branding" -o "$with_branding" = "no"; then
12562     AC_MSG_RESULT([none])
12563     DEFAULT_BRAND_IMAGES="$brand_files"
12564 else
12565     if ! test -d $with_branding ; then
12566         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12567     else
12568         AC_MSG_RESULT([$with_branding])
12569         CUSTOM_BRAND_DIR="$with_branding"
12570         for lfile in $brand_files
12571         do
12572             if ! test -f $with_branding/$lfile ; then
12573                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12574                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12575             else
12576                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12577             fi
12578         done
12579         check_for_progress="yes"
12580     fi
12582 AC_SUBST([BRAND_INTRO_IMAGES])
12583 AC_SUBST([CUSTOM_BRAND_DIR])
12584 AC_SUBST([CUSTOM_BRAND_IMAGES])
12585 AC_SUBST([DEFAULT_BRAND_IMAGES])
12588 AC_MSG_CHECKING([for 'intro' progress settings])
12589 PROGRESSBARCOLOR=
12590 PROGRESSSIZE=
12591 PROGRESSPOSITION=
12592 PROGRESSFRAMECOLOR=
12593 PROGRESSTEXTCOLOR=
12594 PROGRESSTEXTBASELINE=
12596 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12597     source "$with_branding/progress.conf"
12598     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12599 else
12600     AC_MSG_RESULT([none])
12603 AC_SUBST(PROGRESSBARCOLOR)
12604 AC_SUBST(PROGRESSSIZE)
12605 AC_SUBST(PROGRESSPOSITION)
12606 AC_SUBST(PROGRESSFRAMECOLOR)
12607 AC_SUBST(PROGRESSTEXTCOLOR)
12608 AC_SUBST(PROGRESSTEXTBASELINE)
12611 AC_MSG_CHECKING([for extra build ID])
12612 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12613     EXTRA_BUILDID="$with_extra_buildid"
12615 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12616 if test -n "$EXTRA_BUILDID" ; then
12617     AC_MSG_RESULT([$EXTRA_BUILDID])
12618 else
12619     AC_MSG_RESULT([not set])
12621 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12623 OOO_VENDOR=
12624 AC_MSG_CHECKING([for vendor])
12625 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12626     OOO_VENDOR="$USERNAME"
12628     if test -z "$OOO_VENDOR"; then
12629         OOO_VENDOR="$USER"
12630     fi
12632     if test -z "$OOO_VENDOR"; then
12633         OOO_VENDOR="`id -u -n`"
12634     fi
12636     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12637 else
12638     OOO_VENDOR="$with_vendor"
12639     AC_MSG_RESULT([$OOO_VENDOR])
12641 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12642 AC_SUBST(OOO_VENDOR)
12644 if test "$_os" = "Android" ; then
12645     ANDROID_PACKAGE_NAME=
12646     AC_MSG_CHECKING([for Android package name])
12647     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12648         if test -n "$ENABLE_DEBUG"; then
12649             # Default to the package name that makes ndk-gdb happy.
12650             ANDROID_PACKAGE_NAME="org.libreoffice"
12651         else
12652             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12653         fi
12655         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12656     else
12657         ANDROID_PACKAGE_NAME="$with_android_package_name"
12658         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12659     fi
12660     AC_SUBST(ANDROID_PACKAGE_NAME)
12663 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12664 if test "$with_compat_oowrappers" = "yes"; then
12665     WITH_COMPAT_OOWRAPPERS=TRUE
12666     AC_MSG_RESULT(yes)
12667 else
12668     WITH_COMPAT_OOWRAPPERS=
12669     AC_MSG_RESULT(no)
12671 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12673 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12674 AC_MSG_CHECKING([for install dirname])
12675 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12676     INSTALLDIRNAME="$with_install_dirname"
12678 AC_MSG_RESULT([$INSTALLDIRNAME])
12679 AC_SUBST(INSTALLDIRNAME)
12681 AC_MSG_CHECKING([for prefix])
12682 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12683 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12684 PREFIXDIR="$prefix"
12685 AC_MSG_RESULT([$PREFIXDIR])
12686 AC_SUBST(PREFIXDIR)
12688 LIBDIR=[$(eval echo $(eval echo $libdir))]
12689 AC_SUBST(LIBDIR)
12691 DATADIR=[$(eval echo $(eval echo $datadir))]
12692 AC_SUBST(DATADIR)
12694 MANDIR=[$(eval echo $(eval echo $mandir))]
12695 AC_SUBST(MANDIR)
12697 DOCDIR=[$(eval echo $(eval echo $docdir))]
12698 AC_SUBST(DOCDIR)
12700 BINDIR=[$(eval echo $(eval echo $bindir))]
12701 AC_SUBST(BINDIR)
12703 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12704 AC_SUBST(INSTALLDIR)
12706 TESTINSTALLDIR="${BUILDDIR}/test-install"
12707 AC_SUBST(TESTINSTALLDIR)
12710 # ===================================================================
12711 # OAuth2 id and secrets
12712 # ===================================================================
12714 AC_MSG_CHECKING([for Google Drive client id and secret])
12715 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12716     AC_MSG_RESULT([not set])
12717     GDRIVE_CLIENT_ID="\"\""
12718     GDRIVE_CLIENT_SECRET="\"\""
12719 else
12720     AC_MSG_RESULT([set])
12721     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12722     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12724 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12725 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12727 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12728 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12729     AC_MSG_RESULT([not set])
12730     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12731     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12732 else
12733     AC_MSG_RESULT([set])
12734     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12735     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12737 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12738 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12740 AC_MSG_CHECKING([for OneDrive client id and secret])
12741 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12742     AC_MSG_RESULT([not set])
12743     ONEDRIVE_CLIENT_ID="\"\""
12744     ONEDRIVE_CLIENT_SECRET="\"\""
12745 else
12746     AC_MSG_RESULT([set])
12747     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12748     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12750 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12751 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12754 dnl ===================================================================
12755 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12756 dnl --enable-dependency-tracking configure option
12757 dnl ===================================================================
12758 AC_MSG_CHECKING([whether to enable dependency tracking])
12759 if test "$enable_dependency_tracking" = "no"; then
12760     nodep=TRUE
12761     AC_MSG_RESULT([no])
12762 else
12763     AC_MSG_RESULT([yes])
12765 AC_SUBST(nodep)
12767 dnl ===================================================================
12768 dnl Number of CPUs to use during the build
12769 dnl ===================================================================
12770 AC_MSG_CHECKING([for number of processors to use])
12771 # plain --with-parallelism is just the default
12772 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12773     if test "$with_parallelism" = "no"; then
12774         PARALLELISM=0
12775     else
12776         PARALLELISM=$with_parallelism
12777     fi
12778 else
12779     if test "$enable_icecream" = "yes"; then
12780         PARALLELISM="40"
12781     else
12782         case `uname -s` in
12784         Darwin|FreeBSD|NetBSD|OpenBSD)
12785             PARALLELISM=`sysctl -n hw.ncpu`
12786             ;;
12788         Linux)
12789             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12790         ;;
12791         # what else than above does profit here *and* has /proc?
12792         *)
12793             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12794             ;;
12795         esac
12797         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12798         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12799     fi
12802 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12803     if test -z "$with_parallelism"; then
12804             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12805             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12806             PARALLELISM="1"
12807     else
12808         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."
12809     fi
12812 if test $PARALLELISM -eq 0; then
12813     AC_MSG_RESULT([explicit make -j option needed])
12814 else
12815     AC_MSG_RESULT([$PARALLELISM])
12817 AC_SUBST(PARALLELISM)
12819 IWYU_PATH="$with_iwyu"
12820 AC_SUBST(IWYU_PATH)
12821 if test ! -z "$IWYU_PATH"; then
12822     if test ! -f "$IWYU_PATH"; then
12823         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12824     fi
12828 # Set up ILIB for MSVC build
12830 ILIB1=
12831 if test "$build_os" = "cygwin"; then
12832     ILIB="."
12833     if test -n "$JAVA_HOME"; then
12834         ILIB="$ILIB;$JAVA_HOME/lib"
12835     fi
12836     ILIB1=-link
12837     if test "$BITNESS_OVERRIDE" = 64; then
12838         ILIB="$ILIB;$COMPATH/lib/x64"
12839         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12840         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12841         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12842         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12843             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12844             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12845         fi
12846         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12847         ucrtlibpath_formatted=$formatted_path
12848         ILIB="$ILIB;$ucrtlibpath_formatted"
12849         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12850     else
12851         ILIB="$ILIB;$COMPATH/lib/x86"
12852         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12853         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12854         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12855         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12856             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12857             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12858         fi
12859         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12860         ucrtlibpath_formatted=$formatted_path
12861         ILIB="$ILIB;$ucrtlibpath_formatted"
12862         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12863     fi
12864     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12865         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12866     else
12867         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12868     fi
12870     AC_SUBST(ILIB)
12873 # ===================================================================
12874 # Creating bigger shared library to link against
12875 # ===================================================================
12876 AC_MSG_CHECKING([whether to create huge library])
12877 MERGELIBS=
12879 if test $_os = iOS -o $_os = Android; then
12880     # Never any point in mergelibs for these as we build just static
12881     # libraries anyway...
12882     enable_mergelibs=no
12885 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12886     if test $_os != Linux -a $_os != WINNT; then
12887         add_warning "--enable-mergelibs is not tested for this platform"
12888     fi
12889     MERGELIBS="TRUE"
12890     AC_MSG_RESULT([yes])
12891     AC_DEFINE(ENABLE_MERGELIBS)
12892 else
12893     AC_MSG_RESULT([no])
12895 AC_SUBST([MERGELIBS])
12897 dnl ===================================================================
12898 dnl icerun is a wrapper that stops us spawning tens of processes
12899 dnl locally - for tools that can't be executed on the compile cluster
12900 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12901 dnl ===================================================================
12902 AC_MSG_CHECKING([whether to use icerun wrapper])
12903 ICECREAM_RUN=
12904 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12905     ICECREAM_RUN=icerun
12906     AC_MSG_RESULT([yes])
12907 else
12908     AC_MSG_RESULT([no])
12910 AC_SUBST(ICECREAM_RUN)
12912 dnl ===================================================================
12913 dnl Setup the ICECC_VERSION for the build the same way it was set for
12914 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12915 dnl ===================================================================
12916 x_ICECC_VERSION=[\#]
12917 if test -n "$ICECC_VERSION" ; then
12918     x_ICECC_VERSION=
12920 AC_SUBST(x_ICECC_VERSION)
12921 AC_SUBST(ICECC_VERSION)
12923 dnl ===================================================================
12925 AC_MSG_CHECKING([MPL subset])
12926 MPL_SUBSET=
12928 if test "$enable_mpl_subset" = "yes"; then
12929     warn_report=false
12930     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12931         warn_report=true
12932     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12933         warn_report=true
12934     fi
12935     if test "$warn_report" = "true"; then
12936         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12937     fi
12938     if test "x$enable_postgresql_sdbc" != "xno"; then
12939         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12940     fi
12941     if test "$enable_lotuswordpro" = "yes"; then
12942         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12943     fi
12944     if test "$WITH_WEBDAV" = "neon"; then
12945         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12946     fi
12947     if test -n "$ENABLE_POPPLER"; then
12948         if test "x$SYSTEM_POPPLER" = "x"; then
12949             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12950         fi
12951     fi
12952     # cf. m4/libo_check_extension.m4
12953     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12954         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12955     fi
12956     for theme in $WITH_THEMES; do
12957         case $theme in
12958         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sukapura|sukapura_svg) #blacklist of icon themes under GPL or LGPL
12959             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12960         *) : ;;
12961         esac
12962     done
12964     ENABLE_OPENGL_TRANSITIONS=
12966     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12967         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12968     fi
12970     MPL_SUBSET="TRUE"
12971     AC_DEFINE(MPL_HAVE_SUBSET)
12972     AC_MSG_RESULT([only])
12973 else
12974     AC_MSG_RESULT([no restrictions])
12976 AC_SUBST(MPL_SUBSET)
12978 dnl ===================================================================
12980 AC_MSG_CHECKING([formula logger])
12981 ENABLE_FORMULA_LOGGER=
12983 if test "x$enable_formula_logger" = "xyes"; then
12984     AC_MSG_RESULT([yes])
12985     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12986     ENABLE_FORMULA_LOGGER=TRUE
12987 elif test -n "$ENABLE_DBGUTIL" ; then
12988     AC_MSG_RESULT([yes])
12989     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12990     ENABLE_FORMULA_LOGGER=TRUE
12991 else
12992     AC_MSG_RESULT([no])
12995 AC_SUBST(ENABLE_FORMULA_LOGGER)
12997 dnl ===================================================================
12998 dnl Checking for active Antivirus software.
12999 dnl ===================================================================
13001 if test $_os = WINNT ; then
13002     AC_MSG_CHECKING([for active Antivirus software])
13003     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13004     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13005         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13006             AC_MSG_RESULT([found])
13007             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13008             echo $EICAR_STRING > $SRC_ROOT/eicar
13009             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13010             rm $SRC_ROOT/eicar
13011             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13012                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13013             fi
13014             echo $EICAR_STRING > $BUILDDIR/eicar
13015             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13016             rm $BUILDDIR/eicar
13017             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13018                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13019             fi
13020             add_warning "To speed up builds and avoid failures in unit tests, it is highly recommended that you exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST"
13021         else
13022             AC_MSG_RESULT([not found])
13023         fi
13024     else
13025         AC_MSG_RESULT([n/a])
13026     fi
13029 dnl ===================================================================
13030 dnl Setting up the environment.
13031 dnl ===================================================================
13032 AC_MSG_NOTICE([setting up the build environment variables...])
13034 AC_SUBST(COMPATH)
13036 if test "$build_os" = "cygwin"; then
13037     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13038         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13039         ATL_INCLUDE="$COMPATH/atlmfc/include"
13040     elif test -d "$COMPATH/atlmfc/lib"; then
13041         ATL_LIB="$COMPATH/atlmfc/lib"
13042         ATL_INCLUDE="$COMPATH/atlmfc/include"
13043     else
13044         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13045         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13046     fi
13047     if test "$BITNESS_OVERRIDE" = 64; then
13048         ATL_LIB="$ATL_LIB/x64"
13049     else
13050         ATL_LIB="$ATL_LIB/x86"
13051     fi
13052     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13053     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13055     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13056     PathFormat "/usr/bin/find.exe"
13057     FIND="$formatted_path"
13058     PathFormat "/usr/bin/sort.exe"
13059     SORT="$formatted_path"
13060     PathFormat "/usr/bin/grep.exe"
13061     WIN_GREP="$formatted_path"
13062     PathFormat "/usr/bin/ls.exe"
13063     WIN_LS="$formatted_path"
13064     PathFormat "/usr/bin/touch.exe"
13065     WIN_TOUCH="$formatted_path"
13066 else
13067     FIND=find
13068     SORT=sort
13071 AC_SUBST(ATL_INCLUDE)
13072 AC_SUBST(ATL_LIB)
13073 AC_SUBST(FIND)
13074 AC_SUBST(SORT)
13075 AC_SUBST(WIN_GREP)
13076 AC_SUBST(WIN_LS)
13077 AC_SUBST(WIN_TOUCH)
13079 AC_SUBST(BUILD_TYPE)
13081 AC_SUBST(SOLARINC)
13083 PathFormat "$PERL"
13084 PERL="$formatted_path"
13085 AC_SUBST(PERL)
13087 if test -n "$TMPDIR"; then
13088     TEMP_DIRECTORY="$TMPDIR"
13089 else
13090     TEMP_DIRECTORY="/tmp"
13092 if test "$build_os" = "cygwin"; then
13093     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13095 AC_SUBST(TEMP_DIRECTORY)
13097 # setup the PATH for the environment
13098 if test -n "$LO_PATH_FOR_BUILD"; then
13099     LO_PATH="$LO_PATH_FOR_BUILD"
13100 else
13101     LO_PATH="$PATH"
13103     case "$host_os" in
13105     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13106         if test "$ENABLE_JAVA" != ""; then
13107             pathmunge "$JAVA_HOME/bin" "after"
13108         fi
13109         ;;
13111     cygwin*)
13112         # Win32 make needs native paths
13113         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13114             LO_PATH=`cygpath -p -m "$PATH"`
13115         fi
13116         if test "$BITNESS_OVERRIDE" = 64; then
13117             # needed for msi packaging
13118             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13119         fi
13120         # .NET 4.6 and higher don't have bin directory
13121         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13122             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13123         fi
13124         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13125         pathmunge "$CSC_PATH" "before"
13126         pathmunge "$MIDL_PATH" "before"
13127         pathmunge "$AL_PATH" "before"
13128         pathmunge "$MSPDB_PATH" "before"
13129         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13130             pathmunge "$CL_PATH" "before"
13131         fi
13132         if test -n "$MSBUILD_PATH" ; then
13133             pathmunge "$MSBUILD_PATH" "before"
13134         fi
13135         if test "$BITNESS_OVERRIDE" = 64; then
13136             pathmunge "$COMPATH/bin/amd64" "before"
13137             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13138         else
13139             pathmunge "$COMPATH/bin" "before"
13140             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13141         fi
13142         if test "$ENABLE_JAVA" != ""; then
13143             if test -d "$JAVA_HOME/jre/bin/client"; then
13144                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13145             fi
13146             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13147                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13148             fi
13149             pathmunge "$JAVA_HOME/bin" "before"
13150         fi
13151         ;;
13153     solaris*)
13154         pathmunge "/usr/css/bin" "before"
13155         if test "$ENABLE_JAVA" != ""; then
13156             pathmunge "$JAVA_HOME/bin" "after"
13157         fi
13158         ;;
13159     esac
13162 AC_SUBST(LO_PATH)
13164 libo_FUZZ_SUMMARY
13166 # Generate a configuration sha256 we can use for deps
13167 if test -f config_host.mk; then
13168     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13170 if test -f config_host_lang.mk; then
13171     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13174 CFLAGS=$my_original_CFLAGS
13175 CXXFLAGS=$my_original_CXXFLAGS
13176 CPPFLAGS=$my_original_CPPFLAGS
13178 AC_CONFIG_FILES([config_host.mk
13179                  config_host_lang.mk
13180                  Makefile
13181                  bin/bffvalidator.sh
13182                  bin/odfvalidator.sh
13183                  bin/officeotron.sh
13184                  instsetoo_native/util/openoffice.lst
13185                  sysui/desktop/macosx/Info.plist])
13186 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13187 AC_CONFIG_HEADERS([config_host/config_clang.h])
13188 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13189 AC_CONFIG_HEADERS([config_host/config_eot.h])
13190 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13191 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13192 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13193 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13194 AC_CONFIG_HEADERS([config_host/config_features.h])
13195 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13196 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13197 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13198 AC_CONFIG_HEADERS([config_host/config_folders.h])
13199 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13200 AC_CONFIG_HEADERS([config_host/config_gio.h])
13201 AC_CONFIG_HEADERS([config_host/config_global.h])
13202 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13203 AC_CONFIG_HEADERS([config_host/config_java.h])
13204 AC_CONFIG_HEADERS([config_host/config_langs.h])
13205 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13206 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13207 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13208 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13209 AC_CONFIG_HEADERS([config_host/config_locales.h])
13210 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13211 AC_CONFIG_HEADERS([config_host/config_oox.h])
13212 AC_CONFIG_HEADERS([config_host/config_options.h])
13213 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13214 AC_CONFIG_HEADERS([config_host/config_skia.h])
13215 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13216 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13217 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13218 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13219 AC_CONFIG_HEADERS([config_host/config_version.h])
13220 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13221 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13222 AC_CONFIG_HEADERS([config_host/config_python.h])
13223 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13224 AC_OUTPUT
13226 if test "$CROSS_COMPILING" = TRUE; then
13227     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13230 # touch the config timestamp file
13231 if test ! -f config_host.mk.stamp; then
13232     echo > config_host.mk.stamp
13233 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13234     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13235 else
13236     echo > config_host.mk.stamp
13239 # touch the config lang timestamp file
13240 if test ! -f config_host_lang.mk.stamp; then
13241     echo > config_host_lang.mk.stamp
13242 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13243     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13244 else
13245     echo > config_host_lang.mk.stamp
13249 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13250         -a "$build_os" = "cygwin"; then
13252 cat << _EOS
13253 ****************************************************************************
13254 WARNING:
13255 Your make version is known to be horribly slow, and hard to debug
13256 problems with. To get a reasonably functional make please do:
13258 to install a pre-compiled binary make for Win32
13260  mkdir -p /opt/lo/bin
13261  cd /opt/lo/bin
13262  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13263  cp make-4.2.1-msvc.exe make
13264  chmod +x make
13266 to install from source:
13267 place yourself in a working directory of you choice.
13269  git clone git://git.savannah.gnu.org/make.git
13271  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
13272  set PATH=%PATH%;C:\Cygwin\bin
13273  [or Cygwin64, if that is what you have]
13274  cd path-to-make-repo-you-cloned-above
13275  build_w32.bat --without-guile
13277 should result in a WinRel/gnumake.exe.
13278 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13280 Then re-run autogen.sh
13282 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13283 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13285 _EOS
13286 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13287     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13292 cat << _EOF
13293 ****************************************************************************
13295 To build, run:
13296 $GNUMAKE
13298 To view some help, run:
13299 $GNUMAKE help
13301 _EOF
13303 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13304     cat << _EOF
13305 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13306 _EOF
13308     if test $_os = Darwin; then
13309         echo open instdir/$PRODUCTNAME.app
13310     else
13311         echo instdir/program/soffice
13312     fi
13313     cat << _EOF
13315 If you want to run the smoketest, run:
13316 $GNUMAKE check
13318 _EOF
13321 if test -f warn; then
13322     cat warn
13323     rm warn
13326 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: