Set the original size in crop dialog to preferred DPI calc. size
[LibreOffice.git] / configure.ac
blob7145e24534871cd7a7394dc64fa709820160341f
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([Collabora Office],[6.4.10.53],[],[],[https://collaboraoffice.com/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
188     PRODUCTNAME=AC_PACKAGE_NAME
190 AC_MSG_RESULT([$PRODUCTNAME])
191 AC_SUBST(PRODUCTNAME)
192 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
193 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
195 dnl ===================================================================
196 dnl Our version is defined by the AC_INIT() at the top of this script.
197 dnl ===================================================================
199 AC_MSG_CHECKING([for package version])
200 if test -n "$with_package_version" -a "$with_package_version" != no; then
201     PACKAGE_VERSION="$with_package_version"
203 AC_MSG_RESULT([$PACKAGE_VERSION])
205 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
207 LIBO_VERSION_MAJOR=$1
208 LIBO_VERSION_MINOR=$2
209 LIBO_VERSION_MICRO=$3
210 LIBO_VERSION_PATCH=$4
212 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
213 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
214 # no way to encode that into an integer in general.
215 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
217 LIBO_VERSION_SUFFIX=$5
218 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
219 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
220 # they get undoubled before actually passed to sed.
221 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
222 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
223 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
224 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
226 AC_SUBST(LIBO_VERSION_MAJOR)
227 AC_SUBST(LIBO_VERSION_MINOR)
228 AC_SUBST(LIBO_VERSION_MICRO)
229 AC_SUBST(LIBO_VERSION_PATCH)
230 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
231 AC_SUBST(LIBO_VERSION_SUFFIX)
232 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
237 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
239 LIBO_THIS_YEAR=`date +%Y`
240 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
242 dnl ===================================================================
243 dnl Product version
244 dnl ===================================================================
245 AC_MSG_CHECKING([for product version])
246 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
247 AC_MSG_RESULT([$PRODUCTVERSION])
248 AC_SUBST(PRODUCTVERSION)
250 AC_PROG_EGREP
251 # AC_PROG_EGREP doesn't set GREP on all systems as well
252 AC_PATH_PROG(GREP, grep)
254 BUILDDIR=`pwd`
255 cd $srcdir
256 SRC_ROOT=`pwd`
257 cd $BUILDDIR
258 x_Cygwin=[\#]
260 dnl ======================================
261 dnl Required GObject introspection version
262 dnl ======================================
263 INTROSPECTION_REQUIRED_VERSION=1.32.0
265 dnl ===================================================================
266 dnl Search all the common names for GNU Make
267 dnl ===================================================================
268 AC_MSG_CHECKING([for GNU Make])
270 # try to use our own make if it is available and GNUMAKE was not already defined
271 if test -z "$GNUMAKE"; then
272     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
273         GNUMAKE="$LODE_HOME/opt/bin/make"
274     elif test -x "/opt/lo/bin/make"; then
275         GNUMAKE="/opt/lo/bin/make"
276     fi
279 GNUMAKE_WIN_NATIVE=
280 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
281     if test -n "$a"; then
282         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
283         if test $? -eq 0;  then
284             if test "$build_os" = "cygwin"; then
285                 if test -n "$($a -v | grep 'Built for Windows')" ; then
286                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
287                     GNUMAKE_WIN_NATIVE="TRUE"
288                 else
289                     GNUMAKE=`which $a`
290                 fi
291             else
292                 GNUMAKE=`which $a`
293             fi
294             break
295         fi
296     fi
297 done
298 AC_MSG_RESULT($GNUMAKE)
299 if test -z "$GNUMAKE"; then
300     AC_MSG_ERROR([not found. install GNU Make.])
301 else
302     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
303         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
304     fi
307 win_short_path_for_make()
309     local_short_path="$1"
310     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
311         cygpath -sm "$local_short_path"
312     else
313         cygpath -u "$(cygpath -d "$local_short_path")"
314     fi
318 if test "$build_os" = "cygwin"; then
319     PathFormat "$SRC_ROOT"
320     SRC_ROOT="$formatted_path"
321     PathFormat "$BUILDDIR"
322     BUILDDIR="$formatted_path"
323     x_Cygwin=
324     AC_MSG_CHECKING(for explicit COMSPEC)
325     if test -z "$COMSPEC"; then
326         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
327     else
328         AC_MSG_RESULT([found: $COMSPEC])
329     fi
332 AC_SUBST(SRC_ROOT)
333 AC_SUBST(BUILDDIR)
334 AC_SUBST(x_Cygwin)
335 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
337 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
339 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
340     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
343 # need sed in os checks...
344 AC_PATH_PROGS(SED, sed)
345 if test -z "$SED"; then
346     AC_MSG_ERROR([install sed to run this script])
349 # Set the ENABLE_LTO variable
350 # ===================================================================
351 AC_MSG_CHECKING([whether to use link-time optimization])
352 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
353     ENABLE_LTO="TRUE"
354     AC_MSG_RESULT([yes])
355     AC_DEFINE(STATIC_LINKING)
356 else
357     ENABLE_LTO=""
358     AC_MSG_RESULT([no])
360 AC_SUBST(ENABLE_LTO)
362 AC_ARG_ENABLE(fuzz-options,
363     AS_HELP_STRING([--enable-fuzz-options],
364         [Randomly enable or disable each of those configurable options
365          that are supposed to be freely selectable without interdependencies,
366          or where bad interaction from interdependencies is automatically avoided.])
369 dnl ===================================================================
370 dnl When building for Android, --with-android-ndk,
371 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
372 dnl mandatory
373 dnl ===================================================================
375 AC_ARG_WITH(android-ndk,
376     AS_HELP_STRING([--with-android-ndk],
377         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
380 AC_ARG_WITH(android-ndk-toolchain-version,
381     AS_HELP_STRING([--with-android-ndk-toolchain-version],
382         [Specify which toolchain version to use, of those present in the
383         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
384         with_android_ndk_toolchain_version=clang5.0)
386 AC_ARG_WITH(android-sdk,
387     AS_HELP_STRING([--with-android-sdk],
388         [Specify location of the Android SDK. Mandatory when building for Android.]),
391 AC_ARG_WITH(android-api-level,
392     AS_HELP_STRING([--with-android-api-level],
393         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
396 ANDROID_NDK_HOME=
397 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
398     with_android_ndk="$SRC_ROOT/external/android-ndk"
400 if test -n "$with_android_ndk"; then
401     eval ANDROID_NDK_HOME=$with_android_ndk
403     # Set up a lot of pre-canned defaults
405     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
406         if test ! -f $ANDROID_NDK_HOME/source.properties; then
407             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
408         fi
409         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
410     else
411         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
412     fi
413     if test -z "$ANDROID_NDK_VERSION";  then
414         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
415     fi
416     case $ANDROID_NDK_VERSION in
417     r9*|r10*)
418         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
419         ;;
420     11.1.*|12.1.*|13.1.*|14.1.*)
421         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
422         ;;
423     16.*|17.*|18.*|19.*|20.*)
424         ;;
425     *)
426         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
427         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
428         ;;
429     esac
431     ANDROID_API_LEVEL=16
432     if test -n "$with_android_api_level" ; then
433         ANDROID_API_LEVEL="$with_android_api_level"
434     fi
436     android_cpu=$host_cpu
437     if test $host_cpu = arm; then
438         android_platform_prefix=arm-linux-androideabi
439         android_gnu_prefix=$android_platform_prefix
440         LLVM_TRIPLE=armv7a-linux-androideabi
441         ANDROID_APP_ABI=armeabi-v7a
442         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
443     elif test $host_cpu = aarch64; then
444         android_platform_prefix=aarch64-linux-android
445         android_gnu_prefix=$android_platform_prefix
446         LLVM_TRIPLE=$android_platform_prefix
447         # minimum android version that supports aarch64
448         if test "$ANDROID_API_LEVEL" -lt "21" ; then
449             ANDROID_API_LEVEL=21
450         fi
451         ANDROID_APP_ABI=arm64-v8a
452     elif test $host_cpu = x86_64; then
453         android_platform_prefix=x86_64-linux-android
454         android_gnu_prefix=$android_platform_prefix
455         LLVM_TRIPLE=$android_platform_prefix
456         # minimum android version that supports x86_64
457         ANDROID_API_LEVEL=21
458         ANDROID_APP_ABI=x86_64
459     else
460         # host_cpu is something like "i386" or "i686" I guess, NDK uses
461         # "x86" in some contexts
462         android_cpu=x86
463         android_platform_prefix=$android_cpu
464         android_gnu_prefix=i686-linux-android
465         LLVM_TRIPLE=$android_gnu_prefix
466         ANDROID_APP_ABI=x86
467     fi
469     case "$with_android_ndk_toolchain_version" in
470     clang5.0)
471         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
472         ;;
473     *)
474         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
475     esac
477     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
479     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
480     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
481     # manage to link the (app-specific) single huge .so that is built for the app in
482     # android/source/ if there is debug information in a significant part of the object files.
483     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
484     # all objects have been built with debug information.)
485     case $build_os in
486     linux-gnu*)
487         android_HOST_TAG=linux-x86_64
488         ;;
489     darwin*)
490         android_HOST_TAG=darwin-x86_64
491         ;;
492     *)
493         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
494         # ndk would also support windows and windows-x86_64
495         ;;
496     esac
497     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
498     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
499     dnl TODO: NSS build uses it...
500     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
501     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
503     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
504     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
505     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
506     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
507     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
511     if test "$ENABLE_LTO" = TRUE; then
512         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
513         # $CC and $CXX when building external libraries
514         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
515     fi
517     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
519     if test -z "$CC"; then
520         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
521         CC_BASE="clang"
522     fi
523     if test -z "$CXX"; then
524         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
525         CXX_BASE="clang++"
526     fi
528     # remember to download the ownCloud Android library later
529     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
531 AC_SUBST(ANDROID_NDK_HOME)
532 AC_SUBST(ANDROID_APP_ABI)
533 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
535 dnl ===================================================================
536 dnl --with-android-sdk
537 dnl ===================================================================
538 ANDROID_SDK_HOME=
539 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
540     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
542 if test -n "$with_android_sdk"; then
543     eval ANDROID_SDK_HOME=$with_android_sdk
544     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
546 AC_SUBST(ANDROID_SDK_HOME)
548 AC_ARG_ENABLE([android-lok],
549     AS_HELP_STRING([--enable-android-lok],
550         [The Android app from the android/ subdir needs several tweaks all
551          over the place that break the LOK when used in the Online-based
552          Android app.  This switch indicates that the intent of this build is
553          actually the Online-based, non-modified LOK.])
555 ENABLE_ANDROID_LOK=
556 if test -n "$ANDROID_NDK_HOME" ; then
557     if test "$enable_android_lok" = yes; then
558         ENABLE_ANDROID_LOK=TRUE
559         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
560         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
561     else
562         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
563     fi
565 AC_SUBST([ENABLE_ANDROID_LOK])
567 libo_FUZZ_ARG_ENABLE([android-editing],
568     AS_HELP_STRING([--enable-android-editing],
569         [Enable the experimental editing feature on Android.])
571 ENABLE_ANDROID_EDITING=
572 if test "$enable_android_editing" = yes; then
573     ENABLE_ANDROID_EDITING=TRUE
575 AC_SUBST([ENABLE_ANDROID_EDITING])
577 dnl ===================================================================
578 dnl The following is a list of supported systems.
579 dnl Sequential to keep the logic very simple
580 dnl These values may be checked and reset later.
581 dnl ===================================================================
582 #defaults unless the os test overrides this:
583 test_randr=yes
584 test_xrender=yes
585 test_cups=yes
586 test_dbus=yes
587 test_fontconfig=yes
588 test_cairo=no
589 test_gdb_index=no
590 test_split_debug=no
592 # Default values, as such probably valid just for Linux, set
593 # differently below just for Mac OSX, but at least better than
594 # hardcoding these as we used to do. Much of this is duplicated also
595 # in solenv for old build system and for gbuild, ideally we should
596 # perhaps define stuff like this only here in configure.ac?
598 LINKFLAGSSHL="-shared"
599 PICSWITCH="-fpic"
600 DLLPOST=".so"
602 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
604 INSTROOTBASESUFFIX=
605 INSTROOTCONTENTSUFFIX=
606 SDKDIRNAME=sdk
608 HOST_PLATFORM="$host"
610 host_cpu_for_clang="$host_cpu"
612 case "$host_os" in
614 solaris*)
615     build_gstreamer_1_0=yes
616     test_freetype=yes
617     _os=SunOS
619     dnl ===========================================================
620     dnl Check whether we're using Solaris 10 - SPARC or Intel.
621     dnl ===========================================================
622     AC_MSG_CHECKING([the Solaris operating system release])
623     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
624     if test "$_os_release" -lt "10"; then
625         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
626     else
627         AC_MSG_RESULT([ok ($_os_release)])
628     fi
630     dnl Check whether we're using a SPARC or i386 processor
631     AC_MSG_CHECKING([the processor type])
632     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
633         AC_MSG_RESULT([ok ($host_cpu)])
634     else
635         AC_MSG_ERROR([only SPARC and i386 processors are supported])
636     fi
637     ;;
639 linux-gnu*|k*bsd*-gnu*)
640     build_gstreamer_1_0=yes
641     test_kf5=yes
642     test_gtk3_kde5=yes
643     test_gdb_index=yes
644     test_split_debug=yes
645     if test "$enable_fuzzers" != yes; then
646         test_freetype=yes
647         test_fontconfig=yes
648     else
649         test_freetype=no
650         test_fontconfig=no
651         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
652     fi
653     _os=Linux
654     ;;
656 gnu)
657     test_randr=no
658     test_xrender=no
659     _os=GNU
660      ;;
662 cygwin*|interix*)
664     # When building on Windows normally with MSVC under Cygwin,
665     # configure thinks that the host platform (the platform the
666     # built code will run on) is Cygwin, even if it obviously is
667     # Windows, which in Autoconf terminology is called
668     # "mingw32". (Which is misleading as MinGW is the name of the
669     # tool-chain, not an operating system.)
671     # Somewhat confusing, yes. But this configure script doesn't
672     # look at $host etc that much, it mostly uses its own $_os
673     # variable, set here in this case statement.
675     test_cups=no
676     test_dbus=no
677     test_randr=no
678     test_xrender=no
679     test_freetype=no
680     test_fontconfig=no
681     _os=WINNT
683     DLLPOST=".dll"
684     LINKFLAGSNOUNDEFS=
685     ;;
687 darwin*|macos*) # macOS
688     test_randr=no
689     test_xrender=no
690     test_freetype=no
691     test_fontconfig=no
692     test_dbus=no
693     if test -n "$LODE_HOME" ; then
694         mac_sanitize_path
695         AC_MSG_NOTICE([sanitized the PATH to $PATH])
696     fi
697     _os=Darwin
698     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
699     INSTROOTCONTENTSUFFIX=/Contents
700     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
701     # See comment above the case "$host_os"
702     LINKFLAGSSHL="-dynamiclib -single_module"
704     # -fPIC is default
705     PICSWITCH=""
707     DLLPOST=".dylib"
709     # -undefined error is the default
710     LINKFLAGSNOUNDEFS=""
711     case "$host_cpu" in
712     aarch64|arm64)
713         case "$host_os" in
714         macos*)
715             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
716             # the "macos" part so be sure to use aarch64-apple-darwin for now.
717             HOST_PLATFORM=aarch64-apple-darwin
718             ;;
719         esac
721         # Apple's Clang uses "arm64"
722         host_cpu_for_clang=arm64
723     esac
726 ios*) # iOS
727     test_randr=no
728     test_xrender=no
729     test_freetype=no
730     test_fontconfig=no
731     test_dbus=no
732     if test -n "$LODE_HOME" ; then
733         mac_sanitize_path
734         AC_MSG_NOTICE([sanitized the PATH to $PATH])
735     fi
736     build_for_ios=YES
737     _os=iOS
738     test_cups=no
739     enable_mpl_subset=yes
740     enable_lotuswordpro=no
741     enable_coinmp=no
742     enable_lpsolve=no
743     enable_postgresql_sdbc=no
744     enable_extension_integration=no
745     enable_report_builder=no
746     with_ppds=no
747     if test "$enable_ios_simulator" = "yes"; then
748         host=x86_64-apple-darwin
749     fi
750     # See comment above the case "$host_os"
751     LINKFLAGSSHL="-dynamiclib -single_module"
753     # -fPIC is default
754     PICSWITCH=""
756     DLLPOST=".dylib"
758     # -undefined error is the default
759     LINKFLAGSNOUNDEFS=""
761     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
762     # part, so use aarch64-apple-darwin for now.
763     HOST_PLATFORM=aarch64-apple-darwin
765     # Apple's Clang uses "arm64"
766     host_cpu_for_clang=arm64
769 freebsd*)
770     build_gstreamer_1_0=yes
771     test_kf5=yes
772     test_gtk3_kde5=yes
773     test_freetype=yes
774     AC_MSG_CHECKING([the FreeBSD operating system release])
775     if test -n "$with_os_version"; then
776         OSVERSION="$with_os_version"
777     else
778         OSVERSION=`/sbin/sysctl -n kern.osreldate`
779     fi
780     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
781     AC_MSG_CHECKING([which thread library to use])
782     if test "$OSVERSION" -lt "500016"; then
783         PTHREAD_CFLAGS="-D_THREAD_SAFE"
784         PTHREAD_LIBS="-pthread"
785     elif test "$OSVERSION" -lt "502102"; then
786         PTHREAD_CFLAGS="-D_THREAD_SAFE"
787         PTHREAD_LIBS="-lc_r"
788     else
789         PTHREAD_CFLAGS=""
790         PTHREAD_LIBS="-pthread"
791     fi
792     AC_MSG_RESULT([$PTHREAD_LIBS])
793     _os=FreeBSD
794     ;;
796 *netbsd*)
797     build_gstreamer_1_0=yes
798     test_kf5=yes
799     test_gtk3_kde5=yes
800     test_freetype=yes
801     PTHREAD_LIBS="-pthread -lpthread"
802     _os=NetBSD
803     ;;
805 aix*)
806     test_randr=no
807     test_freetype=yes
808     PTHREAD_LIBS=-pthread
809     _os=AIX
810     ;;
812 openbsd*)
813     test_freetype=yes
814     PTHREAD_CFLAGS="-D_THREAD_SAFE"
815     PTHREAD_LIBS="-pthread"
816     _os=OpenBSD
817     ;;
819 dragonfly*)
820     build_gstreamer_1_0=yes
821     test_kf5=yes
822     test_gtk3_kde5=yes
823     test_freetype=yes
824     PTHREAD_LIBS="-pthread"
825     _os=DragonFly
826     ;;
828 linux-android*)
829     build_gstreamer_1_0=no
830     enable_lotuswordpro=no
831     enable_mpl_subset=yes
832     enable_coinmp=yes
833     enable_lpsolve=no
834     enable_report_builder=no
835     enable_odk=no
836     enable_postgresql_sdbc=no
837     enable_python=no
838     test_cups=no
839     test_dbus=no
840     test_fontconfig=no
841     test_freetype=no
842     test_kf5=no
843     test_qt5=no
844     test_gtk3_kde5=no
845     test_randr=no
846     test_xrender=no
847     _os=Android
849     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
850     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
851     ;;
853 haiku*)
854     test_cups=no
855     test_dbus=no
856     test_randr=no
857     test_xrender=no
858     test_freetype=yes
859     enable_odk=no
860     enable_gstreamer_1_0=no
861     enable_vlc=no
862     enable_coinmp=no
863     enable_pdfium=no
864     enable_sdremote=no
865     enable_postgresql_sdbc=no
866     enable_firebird_sdbc=no
867     _os=Haiku
868     ;;
871     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
872     ;;
873 esac
875 AC_SUBST(HOST_PLATFORM)
877 if test "$_os" = "Android" ; then
878     # Verify that the NDK and SDK options are proper
879     if test -z "$with_android_ndk"; then
880         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
881     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
882         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
883     fi
885     if test -z "$ANDROID_SDK_HOME"; then
886         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
887     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
888         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
889     fi
891     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
892     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
893         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
894                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
895                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
896         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
897         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
898         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
899     fi
900     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
901         AC_MSG_WARN([android support repository not found - install with
902                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
903                      to allow the build to download the specified version of the android support libraries])
904         add_warning "android support repository not found - install with"
905         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
906         add_warning "to allow the build to download the specified version of the android support libraries"
907     fi
910 if test "$_os" = "AIX"; then
911     AC_PATH_PROG(GAWK, gawk)
912     if test -z "$GAWK"; then
913         AC_MSG_ERROR([gawk not found in \$PATH])
914     fi
917 AC_SUBST(SDKDIRNAME)
919 AC_SUBST(PTHREAD_CFLAGS)
920 AC_SUBST(PTHREAD_LIBS)
922 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
923 # By default use the ones specified by our build system,
924 # but explicit override is possible.
925 AC_MSG_CHECKING(for explicit AFLAGS)
926 if test -n "$AFLAGS"; then
927     AC_MSG_RESULT([$AFLAGS])
928     x_AFLAGS=
929 else
930     AC_MSG_RESULT(no)
931     x_AFLAGS=[\#]
933 AC_MSG_CHECKING(for explicit CFLAGS)
934 if test -n "$CFLAGS"; then
935     AC_MSG_RESULT([$CFLAGS])
936     x_CFLAGS=
937 else
938     AC_MSG_RESULT(no)
939     x_CFLAGS=[\#]
941 AC_MSG_CHECKING(for explicit CXXFLAGS)
942 if test -n "$CXXFLAGS"; then
943     AC_MSG_RESULT([$CXXFLAGS])
944     x_CXXFLAGS=
945 else
946     AC_MSG_RESULT(no)
947     x_CXXFLAGS=[\#]
949 AC_MSG_CHECKING(for explicit OBJCFLAGS)
950 if test -n "$OBJCFLAGS"; then
951     AC_MSG_RESULT([$OBJCFLAGS])
952     x_OBJCFLAGS=
953 else
954     AC_MSG_RESULT(no)
955     x_OBJCFLAGS=[\#]
957 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
958 if test -n "$OBJCXXFLAGS"; then
959     AC_MSG_RESULT([$OBJCXXFLAGS])
960     x_OBJCXXFLAGS=
961 else
962     AC_MSG_RESULT(no)
963     x_OBJCXXFLAGS=[\#]
965 AC_MSG_CHECKING(for explicit LDFLAGS)
966 if test -n "$LDFLAGS"; then
967     AC_MSG_RESULT([$LDFLAGS])
968     x_LDFLAGS=
969 else
970     AC_MSG_RESULT(no)
971     x_LDFLAGS=[\#]
973 AC_SUBST(AFLAGS)
974 AC_SUBST(CFLAGS)
975 AC_SUBST(CXXFLAGS)
976 AC_SUBST(OBJCFLAGS)
977 AC_SUBST(OBJCXXFLAGS)
978 AC_SUBST(LDFLAGS)
979 AC_SUBST(x_AFLAGS)
980 AC_SUBST(x_CFLAGS)
981 AC_SUBST(x_CXXFLAGS)
982 AC_SUBST(x_OBJCFLAGS)
983 AC_SUBST(x_OBJCXXFLAGS)
984 AC_SUBST(x_LDFLAGS)
986 dnl These are potentially set for MSVC, in the code checking for UCRT below:
987 my_original_CFLAGS=$CFLAGS
988 my_original_CXXFLAGS=$CXXFLAGS
989 my_original_CPPFLAGS=$CPPFLAGS
991 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
992 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
993 dnl AC_PROG_CC internally.
994 if test "$_os" != "WINNT"; then
995     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
996     save_CFLAGS=$CFLAGS
997     AC_PROG_CC
998     CFLAGS=$save_CFLAGS
999     if test -z "$CC_BASE"; then
1000         CC_BASE=`first_arg_basename "$CC"`
1001     fi
1004 if test "$_os" != "WINNT"; then
1005     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1006 else
1007     ENDIANNESS=little
1009 AC_SUBST(ENDIANNESS)
1011 if test $_os != "WINNT"; then
1012     save_LIBS="$LIBS"
1013     AC_SEARCH_LIBS([dlsym], [dl],
1014         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1015         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1016     LIBS="$save_LIBS"
1018 AC_SUBST(DLOPEN_LIBS)
1020 AC_ARG_ENABLE(ios-simulator,
1021     AS_HELP_STRING([--enable-ios-simulator],
1022         [build i386 or x86_64 for ios simulator])
1025 AC_ARG_ENABLE(ios-libreofficelight-app,
1026     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1027         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1028          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1029          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1032 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1033 if test "$enable_ios_libreofficelight_app" = yes; then
1034     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1036 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1038 ###############################################################################
1039 # Extensions switches --enable/--disable
1040 ###############################################################################
1041 # By default these should be enabled unless having extra dependencies.
1042 # If there is extra dependency over configure options then the enable should
1043 # be automagic based on whether the requiring feature is enabled or not.
1044 # All this options change anything only with --enable-extension-integration.
1046 # The name of this option and its help string makes it sound as if
1047 # extensions are built anyway, just not integrated in the installer,
1048 # if you use --disable-extension-integration. Is that really the
1049 # case?
1051 libo_FUZZ_ARG_ENABLE(extension-integration,
1052     AS_HELP_STRING([--disable-extension-integration],
1053         [Disable integration of the built extensions in the installer of the
1054          product. Use this switch to disable the integration.])
1057 AC_ARG_ENABLE(avmedia,
1058     AS_HELP_STRING([--disable-avmedia],
1059         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1062 AC_ARG_ENABLE(database-connectivity,
1063     AS_HELP_STRING([--disable-database-connectivity],
1064         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1067 # This doesn't mean not building (or "integrating") extensions
1068 # (although it probably should; i.e. it should imply
1069 # --disable-extension-integration I guess), it means not supporting
1070 # any extension mechanism at all
1071 libo_FUZZ_ARG_ENABLE(extensions,
1072     AS_HELP_STRING([--disable-extensions],
1073         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1076 AC_ARG_ENABLE(scripting,
1077     AS_HELP_STRING([--disable-scripting],
1078         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1081 # This is mainly for Android and iOS, but could potentially be used in some
1082 # special case otherwise, too, so factored out as a separate setting
1084 AC_ARG_ENABLE(dynamic-loading,
1085     AS_HELP_STRING([--disable-dynamic-loading],
1086         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1089 libo_FUZZ_ARG_ENABLE(report-builder,
1090     AS_HELP_STRING([--disable-report-builder],
1091         [Disable the Report Builder.])
1094 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1095     AS_HELP_STRING([--enable-ext-wiki-publisher],
1096         [Enable the Wiki Publisher extension.])
1099 libo_FUZZ_ARG_ENABLE(lpsolve,
1100     AS_HELP_STRING([--disable-lpsolve],
1101         [Disable compilation of the lp solve solver ])
1103 libo_FUZZ_ARG_ENABLE(coinmp,
1104     AS_HELP_STRING([--disable-coinmp],
1105         [Disable compilation of the CoinMP solver ])
1108 libo_FUZZ_ARG_ENABLE(pdfimport,
1109     AS_HELP_STRING([--disable-pdfimport],
1110         [Disable building the PDF import feature.])
1113 libo_FUZZ_ARG_ENABLE(pdfium,
1114     AS_HELP_STRING([--disable-pdfium],
1115         [Disable building PDFium.])
1118 ###############################################################################
1120 dnl ---------- *** ----------
1122 libo_FUZZ_ARG_ENABLE(mergelibs,
1123     AS_HELP_STRING([--enable-mergelibs],
1124         [Merge several of the smaller libraries into one big, "merged", one.])
1127 libo_FUZZ_ARG_ENABLE(breakpad,
1128     AS_HELP_STRING([--enable-breakpad],
1129         [Enables breakpad for crash reporting.])
1132 libo_FUZZ_ARG_ENABLE(crashdump,
1133     AS_HELP_STRING([--disable-crashdump],
1134         [Disable dump.ini and dump-file, when --enable-breakpad])
1137 AC_ARG_ENABLE(fetch-external,
1138     AS_HELP_STRING([--disable-fetch-external],
1139         [Disables fetching external tarballs from web sources.])
1142 AC_ARG_ENABLE(fuzzers,
1143     AS_HELP_STRING([--enable-fuzzers],
1144         [Enables building libfuzzer targets for fuzz testing.])
1147 libo_FUZZ_ARG_ENABLE(pch,
1148     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1149         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1150          Using 'system' will include only external headers, 'base' will add also headers
1151          from base modules, 'normal' will also add all headers except from the module built,
1152          'full' will use all suitable headers even from a module itself.])
1155 libo_FUZZ_ARG_ENABLE(epm,
1156     AS_HELP_STRING([--enable-epm],
1157         [LibreOffice includes self-packaging code, that requires epm, however epm is
1158          useless for large scale package building.])
1161 libo_FUZZ_ARG_ENABLE(odk,
1162     AS_HELP_STRING([--disable-odk],
1163         [LibreOffice includes an ODK, office development kit which some packagers may
1164          wish to build without.])
1167 AC_ARG_ENABLE(mpl-subset,
1168     AS_HELP_STRING([--enable-mpl-subset],
1169         [Don't compile any pieces which are not MPL or more liberally licensed])
1172 libo_FUZZ_ARG_ENABLE(evolution2,
1173     AS_HELP_STRING([--enable-evolution2],
1174         [Allows the built-in evolution 2 addressbook connectivity build to be
1175          enabled.])
1178 AC_ARG_ENABLE(avahi,
1179     AS_HELP_STRING([--enable-avahi],
1180         [Determines whether to use Avahi to advertise Impress to remote controls.])
1183 libo_FUZZ_ARG_ENABLE(werror,
1184     AS_HELP_STRING([--enable-werror],
1185         [Turn warnings to errors. (Has no effect in modules where the treating
1186          of warnings as errors is disabled explicitly.)]),
1189 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1190     AS_HELP_STRING([--enable-assert-always-abort],
1191         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1194 libo_FUZZ_ARG_ENABLE(dbgutil,
1195     AS_HELP_STRING([--enable-dbgutil],
1196         [Provide debugging support from --enable-debug and include additional debugging
1197          utilities such as object counting or more expensive checks.
1198          This is the recommended option for developers.
1199          Note that this makes the build ABI incompatible, it is not possible to mix object
1200          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1202 libo_FUZZ_ARG_ENABLE(debug,
1203     AS_HELP_STRING([--enable-debug],
1204         [Include debugging information, disable compiler optimization and inlining plus
1205          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1207 libo_FUZZ_ARG_ENABLE(split-debug,
1208     AS_HELP_STRING([--disable-split-debug],
1209         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1210          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1212 libo_FUZZ_ARG_ENABLE(gdb-index,
1213     AS_HELP_STRING([--disable-gdb-index],
1214         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1215          The feature requires the gold or lld linker.]))
1217 libo_FUZZ_ARG_ENABLE(sal-log,
1218     AS_HELP_STRING([--enable-sal-log],
1219         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1221 libo_FUZZ_ARG_ENABLE(symbols,
1222     AS_HELP_STRING([--enable-symbols],
1223         [Generate debug information.
1224          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1225          otherwise. It is possible to explicitly specify gbuild build targets
1226          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1227          everything in the directory; there is no ordering, more specific overrides
1228          more general, and disabling takes precedence).
1229          Example: --enable-symbols="all -sw/ -Library_sc".]))
1231 libo_FUZZ_ARG_ENABLE(optimized,
1232     AS_HELP_STRING([--disable-optimized],
1233         [Whether to compile with optimization flags.
1234          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1235          otherwise.]))
1237 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1238     AS_HELP_STRING([--disable-runtime-optimizations],
1239         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1240          JVM JIT) that are known to interact badly with certain dynamic analysis
1241          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1242          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1243          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1245 AC_ARG_WITH(valgrind,
1246     AS_HELP_STRING([--with-valgrind],
1247         [Make availability of Valgrind headers a hard requirement.]))
1249 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1250     AS_HELP_STRING([--enable-compiler-plugins],
1251         [Enable compiler plugins that will perform additional checks during
1252          building. Enabled automatically by --enable-dbgutil.
1253          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1254 COMPILER_PLUGINS_DEBUG=
1255 if test "$enable_compiler_plugins" = debug; then
1256     enable_compiler_plugins=yes
1257     COMPILER_PLUGINS_DEBUG=TRUE
1260 libo_FUZZ_ARG_ENABLE(ooenv,
1261     AS_HELP_STRING([--disable-ooenv],
1262         [Disable ooenv for the instdir installation.]))
1264 libo_FUZZ_ARG_ENABLE(libnumbertext,
1265     AS_HELP_STRING([--disable-libnumbertext],
1266         [Disable use of numbertext external library.]))
1268 AC_ARG_ENABLE(lto,
1269     AS_HELP_STRING([--enable-lto],
1270         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1271          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1272          linker. For MSVC, this option is broken at the moment. This is experimental work
1273          in progress that shouldn't be used unless you are working on it.)]))
1275 AC_ARG_ENABLE(python,
1276     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1277         [Enables or disables Python support at run-time.
1278          Also specifies what Python to use. 'auto' is the default.
1279          'fully-internal' even forces the internal version for uses of Python
1280          during the build.]))
1282 libo_FUZZ_ARG_ENABLE(gtk3,
1283     AS_HELP_STRING([--disable-gtk3],
1284         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1285 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1287 AC_ARG_ENABLE(introspection,
1288     AS_HELP_STRING([--enable-introspection],
1289         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1290          Linux distributions.)]))
1292 AC_ARG_ENABLE(split-app-modules,
1293     AS_HELP_STRING([--enable-split-app-modules],
1294         [Split file lists for app modules, e.g. base, calc.
1295          Has effect only with make distro-pack-install]),
1298 AC_ARG_ENABLE(split-opt-features,
1299     AS_HELP_STRING([--enable-split-opt-features],
1300         [Split file lists for some optional features, e.g. pyuno, testtool.
1301          Has effect only with make distro-pack-install]),
1304 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1305     AS_HELP_STRING([--disable-cairo-canvas],
1306         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1309 libo_FUZZ_ARG_ENABLE(dbus,
1310     AS_HELP_STRING([--disable-dbus],
1311         [Determines whether to enable features that depend on dbus.
1312          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1313 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1315 libo_FUZZ_ARG_ENABLE(sdremote,
1316     AS_HELP_STRING([--disable-sdremote],
1317         [Determines whether to enable Impress remote control (i.e. the server component).]),
1318 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1320 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1321     AS_HELP_STRING([--disable-sdremote-bluetooth],
1322         [Determines whether to build sdremote with bluetooth support.
1323          Requires dbus on Linux.]))
1325 libo_FUZZ_ARG_ENABLE(gio,
1326     AS_HELP_STRING([--disable-gio],
1327         [Determines whether to use the GIO support.]),
1328 ,test "${enable_gio+set}" = set || enable_gio=yes)
1330 AC_ARG_ENABLE(qt5,
1331     AS_HELP_STRING([--enable-qt5],
1332         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1333          available.]),
1336 AC_ARG_ENABLE(kf5,
1337     AS_HELP_STRING([--enable-kf5],
1338         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1339          KF5 are available.]),
1342 AC_ARG_ENABLE(kde5,
1343     AS_HELP_STRING([--enable-kde5],
1344         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1347 AC_ARG_ENABLE(gtk3_kde5,
1348     AS_HELP_STRING([--enable-gtk3-kde5],
1349         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1350          platforms where Gtk3, Qt5 and Plasma is available.]),
1353 AC_ARG_ENABLE(gui,
1354     AS_HELP_STRING([--disable-gui],
1355         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1356 ,enable_gui=yes)
1358 libo_FUZZ_ARG_ENABLE(randr,
1359     AS_HELP_STRING([--disable-randr],
1360         [Disable RandR support in the vcl project.]),
1361 ,test "${enable_randr+set}" = set || enable_randr=yes)
1363 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1364     AS_HELP_STRING([--disable-gstreamer-1-0],
1365         [Disable building with the gstreamer 1.0 avmedia backend.]),
1366 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1368 libo_FUZZ_ARG_ENABLE(vlc,
1369     AS_HELP_STRING([--enable-vlc],
1370         [Enable building with the (experimental) VLC avmedia backend.]),
1371 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1373 libo_FUZZ_ARG_ENABLE(neon,
1374     AS_HELP_STRING([--disable-neon],
1375         [Disable neon and the compilation of webdav binding.]),
1378 libo_FUZZ_ARG_ENABLE([eot],
1379     [AS_HELP_STRING([--enable-eot],
1380         [Enable support for Embedded OpenType fonts.])],
1381 ,test "${enable_eot+set}" = set || enable_eot=no)
1383 libo_FUZZ_ARG_ENABLE(cve-tests,
1384     AS_HELP_STRING([--disable-cve-tests],
1385         [Prevent CVE tests to be executed]),
1388 libo_FUZZ_ARG_ENABLE(chart-tests,
1389     AS_HELP_STRING([--enable-chart-tests],
1390         [Executes chart XShape tests. In a perfect world these tests would be
1391          stable and everyone could run them, in reality it is best to run them
1392          only on a few machines that are known to work and maintained by people
1393          who can judge if a test failure is a regression or not.]),
1396 AC_ARG_ENABLE(build-unowinreg,
1397     AS_HELP_STRING([--enable-build-unowinreg],
1398         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1399          compiler is needed on Linux.]),
1402 AC_ARG_ENABLE(build-opensymbol,
1403     AS_HELP_STRING([--enable-build-opensymbol],
1404         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1405          fontforge installed.]),
1408 AC_ARG_ENABLE(dependency-tracking,
1409     AS_HELP_STRING([--enable-dependency-tracking],
1410         [Do not reject slow dependency extractors.])[
1411   --disable-dependency-tracking
1412                           Disables generation of dependency information.
1413                           Speed up one-time builds.],
1416 AC_ARG_ENABLE(icecream,
1417     AS_HELP_STRING([--enable-icecream],
1418         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1419          It defaults to /opt/icecream for the location of the icecream gcc/g++
1420          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1423 AC_ARG_ENABLE(ld,
1424     AS_HELP_STRING([--enable-ld=<linker>],
1425         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1426          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1429 libo_FUZZ_ARG_ENABLE(cups,
1430     AS_HELP_STRING([--disable-cups],
1431         [Do not build cups support.])
1434 AC_ARG_ENABLE(ccache,
1435     AS_HELP_STRING([--disable-ccache],
1436         [Do not try to use ccache automatically.
1437          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1438          CC/CXX are not yet set, and --enable-icecream is not given, we
1439          attempt to use ccache. --disable-ccache disables ccache completely.
1440          Additionally ccache's depend mode is enabled if possible,
1441          use --enable-ccache=nodepend to enable ccache without depend mode.
1445 AC_ARG_ENABLE(64-bit,
1446     AS_HELP_STRING([--enable-64-bit],
1447         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1448          At the moment meaningful only for Windows.]), ,)
1450 libo_FUZZ_ARG_ENABLE(online-update,
1451     AS_HELP_STRING([--enable-online-update],
1452         [Enable the online update service that will check for new versions of
1453          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1454          If the value is "mar", the experimental Mozilla-like update will be
1455          enabled instead of the traditional update mechanism.]),
1458 AC_ARG_WITH(update-config,
1459     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1460                    [Path to the update config ini file]))
1462 libo_FUZZ_ARG_ENABLE(extension-update,
1463     AS_HELP_STRING([--disable-extension-update],
1464         [Disable possibility to update installed extensions.]),
1467 libo_FUZZ_ARG_ENABLE(release-build,
1468     AS_HELP_STRING([--enable-release-build],
1469         [Enable release build. Note that the "release build" choice is orthogonal to
1470          whether symbols are present, debug info is generated, or optimization
1471          is done.
1472          See http://wiki.documentfoundation.org/Development/DevBuild]),
1475 AC_ARG_ENABLE(windows-build-signing,
1476     AS_HELP_STRING([--enable-windows-build-signing],
1477         [Enable signing of windows binaries (*.exe, *.dll)]),
1480 AC_ARG_ENABLE(silent-msi,
1481     AS_HELP_STRING([--enable-silent-msi],
1482         [Enable MSI with LIMITUI=1 (silent install).]),
1485 AC_ARG_ENABLE(macosx-code-signing,
1486     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1487         [Sign executables, dylibs, frameworks and the app bundle. If you
1488          don't provide an identity the first suitable certificate
1489          in your keychain is used.]),
1492 AC_ARG_ENABLE(macosx-package-signing,
1493     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1494         [Create a .pkg suitable for uploading to the Mac App Store and sign
1495          it. If you don't provide an identity the first suitable certificate
1496          in your keychain is used.]),
1499 AC_ARG_ENABLE(macosx-sandbox,
1500     AS_HELP_STRING([--enable-macosx-sandbox],
1501         [Make the app bundle run in a sandbox. Requires code signing.
1502          Is required by apps distributed in the Mac App Store, and implies
1503          adherence to App Store rules.]),
1506 AC_ARG_WITH(macosx-bundle-identifier,
1507     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1508         [Define the macOS bundle identifier. Default is the somewhat weird
1509          org.libreoffice.script ("script", huh?).]),
1510 ,with_macosx_bundle_identifier=org.libreoffice.script)
1512 AC_ARG_WITH(product-name,
1513     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1514         [Define the product name. Default is AC_PACKAGE_NAME.]),
1515 ,with_product_name=$PRODUCTNAME)
1517 AC_ARG_WITH(package-version,
1518     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1519         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1522 libo_FUZZ_ARG_ENABLE(readonly-installset,
1523     AS_HELP_STRING([--enable-readonly-installset],
1524         [Prevents any attempts by LibreOffice to write into its installation. That means
1525          at least that no "system-wide" extensions can be added. Partly experimental work in
1526          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1529 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1530     AS_HELP_STRING([--disable-postgresql-sdbc],
1531         [Disable the build of the PostgreSQL-SDBC driver.])
1534 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1535     AS_HELP_STRING([--disable-lotuswordpro],
1536         [Disable the build of the Lotus Word Pro filter.]),
1537 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1539 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1540     AS_HELP_STRING([--disable-firebird-sdbc],
1541         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1542 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1544 AC_ARG_ENABLE(bogus-pkg-config,
1545     AS_HELP_STRING([--enable-bogus-pkg-config],
1546         [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.]),
1549 AC_ARG_ENABLE(openssl,
1550     AS_HELP_STRING([--disable-openssl],
1551         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1552          components will either use GNUTLS or NSS. Work in progress,
1553          use only if you are hacking on it.]),
1554 ,enable_openssl=yes)
1556 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1557     AS_HELP_STRING([--enable-cipher-openssl-backend],
1558         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1559          Requires --enable-openssl.]))
1561 AC_ARG_ENABLE(library-bin-tar,
1562     AS_HELP_STRING([--enable-library-bin-tar],
1563         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1564         Some libraries can save their build result in a tarball
1565         stored in TARFILE_LOCATION. That binary tarball is
1566         uniquely identified by the source tarball,
1567         the content of the config_host.mk file and the content
1568         of the top-level directory in core for that library
1569         If this option is enabled, then if such a tarfile exist, it will be untarred
1570         instead of the source tarfile, and the build step will be skipped for that
1571         library.
1572         If a proper tarfile does not exist, then the normal source-based
1573         build is done for that library and a proper binary tarfile is created
1574         for the next time.]),
1577 AC_ARG_ENABLE(dconf,
1578     AS_HELP_STRING([--disable-dconf],
1579         [Disable the dconf configuration backend (enabled by default where
1580          available).]))
1582 libo_FUZZ_ARG_ENABLE(formula-logger,
1583     AS_HELP_STRING(
1584         [--enable-formula-logger],
1585         [Enable formula logger for logging formula calculation flow in Calc.]
1586     )
1589 AC_ARG_ENABLE(ldap,
1590     AS_HELP_STRING([--disable-ldap],
1591         [Disable LDAP support.]),
1592 ,enable_ldap=yes)
1594 dnl ===================================================================
1595 dnl Optional Packages (--with/without-)
1596 dnl ===================================================================
1598 AC_ARG_WITH(gcc-home,
1599     AS_HELP_STRING([--with-gcc-home],
1600         [Specify the location of gcc/g++ manually. This can be used in conjunction
1601          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1602          non-default path.]),
1605 AC_ARG_WITH(gnu-patch,
1606     AS_HELP_STRING([--with-gnu-patch],
1607         [Specify location of GNU patch on Solaris or FreeBSD.]),
1610 AC_ARG_WITH(build-platform-configure-options,
1611     AS_HELP_STRING([--with-build-platform-configure-options],
1612         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1615 AC_ARG_WITH(gnu-cp,
1616     AS_HELP_STRING([--with-gnu-cp],
1617         [Specify location of GNU cp on Solaris or FreeBSD.]),
1620 AC_ARG_WITH(external-tar,
1621     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1622         [Specify an absolute path of where to find (and store) tarfiles.]),
1623     TARFILE_LOCATION=$withval ,
1626 AC_ARG_WITH(referenced-git,
1627     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1628         [Specify another checkout directory to reference. This makes use of
1629                  git submodule update --reference, and saves a lot of diskspace
1630                  when having multiple trees side-by-side.]),
1631     GIT_REFERENCE_SRC=$withval ,
1634 AC_ARG_WITH(linked-git,
1635     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1636         [Specify a directory where the repositories of submodules are located.
1637          This uses a method similar to git-new-workdir to get submodules.]),
1638     GIT_LINK_SRC=$withval ,
1641 AC_ARG_WITH(galleries,
1642     AS_HELP_STRING([--with-galleries],
1643         [Specify how galleries should be built. It is possible either to
1644          build these internally from source ("build"),
1645          or to disable them ("no")]),
1648 AC_ARG_WITH(theme,
1649     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1650         [Choose which themes to include. By default those themes with an '*' are included.
1651          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1652          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1655 libo_FUZZ_ARG_WITH(helppack-integration,
1656     AS_HELP_STRING([--without-helppack-integration],
1657         [It will not integrate the helppacks to the installer
1658          of the product. Please use this switch to use the online help
1659          or separate help packages.]),
1662 libo_FUZZ_ARG_WITH(fonts,
1663     AS_HELP_STRING([--without-fonts],
1664         [LibreOffice includes some third-party fonts to provide a reliable basis for
1665          help content, templates, samples, etc. When these fonts are already
1666          known to be available on the system then you should use this option.]),
1669 AC_ARG_ENABLE(noto-font,
1670     AS_HELP_STRING([--enable-noto-font],
1671         [Add more Google Noto fonts.]),
1674 AC_ARG_WITH(epm,
1675     AS_HELP_STRING([--with-epm],
1676         [Decides which epm to use. Default is to use the one from the system if
1677          one is built. When either this is not there or you say =internal epm
1678          will be built.]),
1681 AC_ARG_WITH(package-format,
1682     AS_HELP_STRING([--with-package-format],
1683         [Specify package format(s) for LibreOffice installation sets. The
1684          implicit --without-package-format leads to no installation sets being
1685          generated. Possible values: aix, archive, bsd, deb, dmg,
1686          installed, msi, pkg, and rpm.
1687          Example: --with-package-format='deb rpm']),
1690 AC_ARG_WITH(tls,
1691     AS_HELP_STRING([--with-tls],
1692         [Decides which TLS/SSL and cryptographic implementations to use for
1693          LibreOffice's code. Notice that this doesn't apply for depending
1694          libraries like "neon", for example. Default is to use OpenSSL
1695          although NSS is also possible. Notice that selecting NSS restricts
1696          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1697          restrict by now the usage of NSS in LO's code. Possible values:
1698          openssl, nss. Example: --with-tls="nss"]),
1701 AC_ARG_WITH(system-libs,
1702     AS_HELP_STRING([--with-system-libs],
1703         [Use libraries already on system -- enables all --with-system-* flags.]),
1706 AC_ARG_WITH(system-bzip2,
1707     AS_HELP_STRING([--with-system-bzip2],
1708         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1709     [with_system_bzip2="$with_system_libs"])
1711 AC_ARG_WITH(system-headers,
1712     AS_HELP_STRING([--with-system-headers],
1713         [Use headers already on system -- enables all --with-system-* flags for
1714          external packages whose headers are the only entities used i.e.
1715          boost/odbc/sane-header(s).]),,
1716     [with_system_headers="$with_system_libs"])
1718 AC_ARG_WITH(system-jars,
1719     AS_HELP_STRING([--without-system-jars],
1720         [When building with --with-system-libs, also the needed jars are expected
1721          on the system. Use this to disable that]),,
1722     [with_system_jars="$with_system_libs"])
1724 AC_ARG_WITH(system-cairo,
1725     AS_HELP_STRING([--with-system-cairo],
1726         [Use cairo libraries already on system.  Happens automatically for
1727          (implicit) --enable-gtk3.]))
1729 AC_ARG_WITH(system-epoxy,
1730     AS_HELP_STRING([--with-system-epoxy],
1731         [Use epoxy libraries already on system.  Happens automatically for
1732          (implicit) --enable-gtk3.]),,
1733        [with_system_epoxy="$with_system_libs"])
1735 AC_ARG_WITH(myspell-dicts,
1736     AS_HELP_STRING([--with-myspell-dicts],
1737         [Adds myspell dictionaries to the LibreOffice installation set]),
1740 AC_ARG_WITH(system-dicts,
1741     AS_HELP_STRING([--without-system-dicts],
1742         [Do not use dictionaries from system paths.]),
1745 AC_ARG_WITH(external-dict-dir,
1746     AS_HELP_STRING([--with-external-dict-dir],
1747         [Specify external dictionary dir.]),
1750 AC_ARG_WITH(external-hyph-dir,
1751     AS_HELP_STRING([--with-external-hyph-dir],
1752         [Specify external hyphenation pattern dir.]),
1755 AC_ARG_WITH(external-thes-dir,
1756     AS_HELP_STRING([--with-external-thes-dir],
1757         [Specify external thesaurus dir.]),
1760 AC_ARG_WITH(system-zlib,
1761     AS_HELP_STRING([--with-system-zlib],
1762         [Use zlib already on system.]),,
1763     [with_system_zlib=auto])
1765 AC_ARG_WITH(system-jpeg,
1766     AS_HELP_STRING([--with-system-jpeg],
1767         [Use jpeg already on system.]),,
1768     [with_system_jpeg="$with_system_libs"])
1770 AC_ARG_WITH(system-clucene,
1771     AS_HELP_STRING([--with-system-clucene],
1772         [Use clucene already on system.]),,
1773     [with_system_clucene="$with_system_libs"])
1775 AC_ARG_WITH(system-expat,
1776     AS_HELP_STRING([--with-system-expat],
1777         [Use expat already on system.]),,
1778     [with_system_expat="$with_system_libs"])
1780 AC_ARG_WITH(system-libxml,
1781     AS_HELP_STRING([--with-system-libxml],
1782         [Use libxml/libxslt already on system.]),,
1783     [with_system_libxml=auto])
1785 AC_ARG_WITH(system-icu,
1786     AS_HELP_STRING([--with-system-icu],
1787         [Use icu already on system.]),,
1788     [with_system_icu="$with_system_libs"])
1790 AC_ARG_WITH(system-ucpp,
1791     AS_HELP_STRING([--with-system-ucpp],
1792         [Use ucpp already on system.]),,
1793     [])
1795 AC_ARG_WITH(system-openldap,
1796     AS_HELP_STRING([--with-system-openldap],
1797         [Use the OpenLDAP LDAP SDK already on system.]),,
1798     [with_system_openldap="$with_system_libs"])
1800 libo_FUZZ_ARG_ENABLE(poppler,
1801     AS_HELP_STRING([--disable-poppler],
1802         [Disable building Poppler.])
1805 AC_ARG_WITH(system-poppler,
1806     AS_HELP_STRING([--with-system-poppler],
1807         [Use system poppler (only needed for PDF import).]),,
1808     [with_system_poppler="$with_system_libs"])
1810 AC_ARG_WITH(system-gpgmepp,
1811     AS_HELP_STRING([--with-system-gpgmepp],
1812         [Use gpgmepp already on system]),,
1813     [with_system_gpgmepp="$with_system_libs"])
1815 AC_ARG_WITH(system-apache-commons,
1816     AS_HELP_STRING([--with-system-apache-commons],
1817         [Use Apache commons libraries already on system.]),,
1818     [with_system_apache_commons="$with_system_jars"])
1820 AC_ARG_WITH(system-mariadb,
1821     AS_HELP_STRING([--with-system-mariadb],
1822         [Use MariaDB/MySQL libraries already on system.]),,
1823     [with_system_mariadb="$with_system_libs"])
1825 AC_ARG_ENABLE(bundle-mariadb,
1826     AS_HELP_STRING([--enable-bundle-mariadb],
1827         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1830 AC_ARG_WITH(system-postgresql,
1831     AS_HELP_STRING([--with-system-postgresql],
1832         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1833          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1834     [with_system_postgresql="$with_system_libs"])
1836 AC_ARG_WITH(libpq-path,
1837     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1838         [Use this PostgreSQL C interface (libpq) installation for building
1839          the PostgreSQL-SDBC extension.]),
1842 AC_ARG_WITH(system-firebird,
1843     AS_HELP_STRING([--with-system-firebird],
1844         [Use Firebird libraries already on system, for building the Firebird-SDBC
1845          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1846     [with_system_firebird="$with_system_libs"])
1848 AC_ARG_WITH(system-libtommath,
1849             AS_HELP_STRING([--with-system-libtommath],
1850                            [Use libtommath already on system]),,
1851             [with_system_libtommath="$with_system_libs"])
1853 AC_ARG_WITH(system-hsqldb,
1854     AS_HELP_STRING([--with-system-hsqldb],
1855         [Use hsqldb already on system.]))
1857 AC_ARG_WITH(hsqldb-jar,
1858     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     HSQLDB_JAR=$withval)
1862 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1863     AS_HELP_STRING([--disable-scripting-beanshell],
1864         [Disable support for scripts in BeanShell.]),
1868 AC_ARG_WITH(system-beanshell,
1869     AS_HELP_STRING([--with-system-beanshell],
1870         [Use beanshell already on system.]),,
1871     [with_system_beanshell="$with_system_jars"])
1873 AC_ARG_WITH(beanshell-jar,
1874     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     BSH_JAR=$withval)
1878 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1879     AS_HELP_STRING([--disable-scripting-javascript],
1880         [Disable support for scripts in JavaScript.]),
1884 AC_ARG_WITH(system-rhino,
1885     AS_HELP_STRING([--with-system-rhino],
1886         [Use rhino already on system.]),,)
1887 #    [with_system_rhino="$with_system_jars"])
1888 # Above is not used as we have different debug interface
1889 # patched into internal rhino. This code needs to be fixed
1890 # before we can enable it by default.
1892 AC_ARG_WITH(rhino-jar,
1893     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     RHINO_JAR=$withval)
1897 AC_ARG_WITH(commons-logging-jar,
1898     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     COMMONS_LOGGING_JAR=$withval)
1902 AC_ARG_WITH(system-jfreereport,
1903     AS_HELP_STRING([--with-system-jfreereport],
1904         [Use JFreeReport already on system.]),,
1905     [with_system_jfreereport="$with_system_jars"])
1907 AC_ARG_WITH(sac-jar,
1908     AS_HELP_STRING([--with-sac-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     SAC_JAR=$withval)
1912 AC_ARG_WITH(libxml-jar,
1913     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBXML_JAR=$withval)
1917 AC_ARG_WITH(flute-jar,
1918     AS_HELP_STRING([--with-flute-jar=JARFILE],
1919         [Specify path to jarfile manually.]),
1920     FLUTE_JAR=$withval)
1922 AC_ARG_WITH(jfreereport-jar,
1923     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1924         [Specify path to jarfile manually.]),
1925     JFREEREPORT_JAR=$withval)
1927 AC_ARG_WITH(liblayout-jar,
1928     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1929         [Specify path to jarfile manually.]),
1930     LIBLAYOUT_JAR=$withval)
1932 AC_ARG_WITH(libloader-jar,
1933     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1934         [Specify path to jarfile manually.]),
1935     LIBLOADER_JAR=$withval)
1937 AC_ARG_WITH(libformula-jar,
1938     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1939         [Specify path to jarfile manually.]),
1940     LIBFORMULA_JAR=$withval)
1942 AC_ARG_WITH(librepository-jar,
1943     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1944         [Specify path to jarfile manually.]),
1945     LIBREPOSITORY_JAR=$withval)
1947 AC_ARG_WITH(libfonts-jar,
1948     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1949         [Specify path to jarfile manually.]),
1950     LIBFONTS_JAR=$withval)
1952 AC_ARG_WITH(libserializer-jar,
1953     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1954         [Specify path to jarfile manually.]),
1955     LIBSERIALIZER_JAR=$withval)
1957 AC_ARG_WITH(libbase-jar,
1958     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1959         [Specify path to jarfile manually.]),
1960     LIBBASE_JAR=$withval)
1962 AC_ARG_WITH(system-odbc,
1963     AS_HELP_STRING([--with-system-odbc],
1964         [Use the odbc headers already on system.]),,
1965     [with_system_odbc="auto"])
1967 AC_ARG_WITH(system-sane,
1968     AS_HELP_STRING([--with-system-sane],
1969         [Use sane.h already on system.]),,
1970     [with_system_sane="$with_system_headers"])
1972 AC_ARG_WITH(system-bluez,
1973     AS_HELP_STRING([--with-system-bluez],
1974         [Use bluetooth.h already on system.]),,
1975     [with_system_bluez="$with_system_headers"])
1977 AC_ARG_WITH(system-curl,
1978     AS_HELP_STRING([--with-system-curl],
1979         [Use curl already on system.]),,
1980     [with_system_curl=auto])
1982 AC_ARG_WITH(system-boost,
1983     AS_HELP_STRING([--with-system-boost],
1984         [Use boost already on system.]),,
1985     [with_system_boost="$with_system_headers"])
1987 AC_ARG_WITH(system-glm,
1988     AS_HELP_STRING([--with-system-glm],
1989         [Use glm already on system.]),,
1990     [with_system_glm="$with_system_headers"])
1992 AC_ARG_WITH(system-hunspell,
1993     AS_HELP_STRING([--with-system-hunspell],
1994         [Use libhunspell already on system.]),,
1995     [with_system_hunspell="$with_system_libs"])
1997 libo_FUZZ_ARG_ENABLE(qrcodegen,
1998     AS_HELP_STRING([--disable-qrcodegen],
1999         [Disable use of qrcodegen external library.]))
2001 AC_ARG_WITH(system-qrcodegen,
2002     AS_HELP_STRING([--with-system-qrcodegen],
2003         [Use libqrcodegen already on system.]),,
2004     [with_system_qrcodegen="$with_system_libs"])
2006 AC_ARG_WITH(system-mythes,
2007     AS_HELP_STRING([--with-system-mythes],
2008         [Use mythes already on system.]),,
2009     [with_system_mythes="$with_system_libs"])
2011 AC_ARG_WITH(system-altlinuxhyph,
2012     AS_HELP_STRING([--with-system-altlinuxhyph],
2013         [Use ALTLinuxhyph already on system.]),,
2014     [with_system_altlinuxhyph="$with_system_libs"])
2016 AC_ARG_WITH(system-lpsolve,
2017     AS_HELP_STRING([--with-system-lpsolve],
2018         [Use lpsolve already on system.]),,
2019     [with_system_lpsolve="$with_system_libs"])
2021 AC_ARG_WITH(system-coinmp,
2022     AS_HELP_STRING([--with-system-coinmp],
2023         [Use CoinMP already on system.]),,
2024     [with_system_coinmp="$with_system_libs"])
2026 AC_ARG_WITH(system-liblangtag,
2027     AS_HELP_STRING([--with-system-liblangtag],
2028         [Use liblangtag library already on system.]),,
2029     [with_system_liblangtag="$with_system_libs"])
2031 AC_ARG_WITH(webdav,
2032     AS_HELP_STRING([--with-webdav],
2033         [Specify which library to use for webdav implementation.
2034          Possible values: "neon", "serf", "no". The default value is "neon".
2035          Example: --with-webdav="serf"]),
2036     WITH_WEBDAV=$withval,
2037     WITH_WEBDAV="neon")
2039 AC_ARG_WITH(linker-hash-style,
2040     AS_HELP_STRING([--with-linker-hash-style],
2041         [Use linker with --hash-style=<style> when linking shared objects.
2042          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2043          if supported on the build system, and "sysv" otherwise.]))
2045 AC_ARG_WITH(jdk-home,
2046     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2047         [If you have installed JDK 8 or later on your system please supply the
2048          path here. Note that this is not the location of the java command but the
2049          location of the entire distribution.]),
2052 AC_ARG_WITH(help,
2053     AS_HELP_STRING([--with-help],
2054         [Enable the build of help. There is a special parameter "common" that
2055          can be used to bundle only the common part, .e.g help-specific icons.
2056          This is useful when you build the helpcontent separately.])
2057     [
2058                           Usage:     --with-help    build the old local help
2059                                  --without-help     no local help (default)
2060                                  --with-help=html   build the new HTML local help
2061                                  --with-help=online build the new HTML online help
2062     ],
2065 AC_ARG_WITH(omindex,
2066    AS_HELP_STRING([--with-omindex],
2067         [Enable the support of xapian-omega index for online help.])
2068    [
2069                          Usage: --with-omindex=server prepare the pages for omindex
2070                                 but let xapian-omega be built in server.
2071                                 --with-omindex=noxap do not prepare online pages
2072                                 for xapian-omega
2073   ],
2076 libo_FUZZ_ARG_WITH(java,
2077     AS_HELP_STRING([--with-java=<java command>],
2078         [Specify the name of the Java interpreter command. Typically "java"
2079          which is the default.
2081          To build without support for Java components, applets, accessibility
2082          or the XML filters written in Java, use --without-java or --with-java=no.]),
2083     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2084     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2087 AC_ARG_WITH(jvm-path,
2088     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2089         [Use a specific JVM search path at runtime.
2090          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2093 AC_ARG_WITH(ant-home,
2094     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2095         [If you have installed Apache Ant on your system, please supply the path here.
2096          Note that this is not the location of the Ant binary but the location
2097          of the entire distribution.]),
2100 AC_ARG_WITH(symbol-config,
2101     AS_HELP_STRING([--with-symbol-config],
2102         [Configuration for the crashreport symbol upload]),
2103         [],
2104         [with_symbol_config=no])
2106 AC_ARG_WITH(export-validation,
2107     AS_HELP_STRING([--without-export-validation],
2108         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2109 ,with_export_validation=auto)
2111 AC_ARG_WITH(bffvalidator,
2112     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2113         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2114          Requires installed Microsoft Office Binary File Format Validator.
2115          Note: export-validation (--with-export-validation) is required to be turned on.
2116          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2117 ,with_bffvalidator=no)
2119 libo_FUZZ_ARG_WITH(junit,
2120     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2121         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2122          --without-junit disables those tests. Not relevant in the --without-java case.]),
2123 ,with_junit=yes)
2125 AC_ARG_WITH(hamcrest,
2126     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2127         [Specifies the hamcrest jar file to use for JUnit-based tests.
2128          --without-junit disables those tests. Not relevant in the --without-java case.]),
2129 ,with_hamcrest=yes)
2131 AC_ARG_WITH(perl-home,
2132     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2133         [If you have installed Perl 5 Distribution, on your system, please
2134          supply the path here. Note that this is not the location of the Perl
2135          binary but the location of the entire distribution.]),
2138 libo_FUZZ_ARG_WITH(doxygen,
2139     AS_HELP_STRING(
2140         [--with-doxygen=<absolute path to doxygen executable>],
2141         [Specifies the doxygen executable to use when generating ODK C/C++
2142          documentation. --without-doxygen disables generation of ODK C/C++
2143          documentation. Not relevant in the --disable-odk case.]),
2144 ,with_doxygen=yes)
2146 AC_ARG_WITH(visual-studio,
2147     AS_HELP_STRING([--with-visual-studio=<2017>],
2148         [Specify which Visual Studio version to use in case several are
2149          installed. Currently only 2017 is supported.]),
2152 AC_ARG_WITH(windows-sdk,
2153     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2154         [Specify which Windows SDK, or "Windows Kit", version to use
2155          in case the one that came with the selected Visual Studio
2156          is not what you want for some reason. Note that not all compiler/SDK
2157          combinations are supported. The intent is that this option should not
2158          be needed.]),
2161 AC_ARG_WITH(lang,
2162     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2163         [Use this option to build LibreOffice with additional UI language support.
2164          English (US) is always included by default.
2165          Separate multiple languages with space.
2166          For all languages, use --with-lang=ALL.]),
2169 AC_ARG_WITH(locales,
2170     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2171         [Use this option to limit the locale information built in.
2172          Separate multiple locales with space.
2173          Very experimental and might well break stuff.
2174          Just a desperate measure to shrink code and data size.
2175          By default all the locales available is included.
2176          This option is completely unrelated to --with-lang.])
2177     [
2178                           Affects also our character encoding conversion
2179                           tables for encodings mainly targeted for a
2180                           particular locale, like EUC-CN and EUC-TW for
2181                           zh, ISO-2022-JP for ja.
2183                           Affects also our add-on break iterator data for
2184                           some languages.
2186                           For the default, all locales, don't use this switch at all.
2187                           Specifying just the language part of a locale means all matching
2188                           locales will be included.
2189     ],
2192 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2193 libo_FUZZ_ARG_WITH(krb5,
2194     AS_HELP_STRING([--with-krb5],
2195         [Enable MIT Kerberos 5 support in modules that support it.
2196          By default automatically enabled on platforms
2197          where a good system Kerberos 5 is available.]),
2200 libo_FUZZ_ARG_WITH(gssapi,
2201     AS_HELP_STRING([--with-gssapi],
2202         [Enable GSSAPI support in modules that support it.
2203          By default automatically enabled on platforms
2204          where a good system GSSAPI is available.]),
2207 AC_ARG_WITH(iwyu,
2208     AS_HELP_STRING([--with-iwyu],
2209         [Use given IWYU binary path to check unneeded includes instead of building.
2210          Use only if you are hacking on it.]),
2213 libo_FUZZ_ARG_WITH(lxml,
2214     AS_HELP_STRING([--without-lxml],
2215         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2216          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2217          report widget classes and ids.]),
2220 libo_FUZZ_ARG_WITH(latest-c++,
2221     AS_HELP_STRING([--with-latest-c++],
2222         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2223          published standard.]),,
2224         [with_latest_c__=no])
2226 dnl ===================================================================
2227 dnl Branding
2228 dnl ===================================================================
2230 AC_ARG_WITH(branding,
2231     AS_HELP_STRING([--with-branding=/path/to/images],
2232         [Use given path to retrieve branding images set.])
2233     [
2234                           Search for intro.png about.svg and flat_logo.svg.
2235                           If any is missing, default ones will be used instead.
2237                           Search also progress.conf for progress
2238                           settings on intro screen :
2240                           PROGRESSBARCOLOR="255,255,255" Set color of
2241                           progress bar. Comma separated RGB decimal values.
2242                           PROGRESSSIZE="407,6" Set size of progress bar.
2243                           Comma separated decimal values (width, height).
2244                           PROGRESSPOSITION="61,317" Set position of progress
2245                           bar from left,top. Comma separated decimal values.
2246                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2247                           bar frame. Comma separated RGB decimal values.
2248                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2249                           bar text. Comma separated RGB decimal values.
2250                           PROGRESSTEXTBASELINE="287" Set vertical position of
2251                           progress bar text from top. Decimal value.
2253                           Default values will be used if not found.
2254     ],
2258 AC_ARG_WITH(extra-buildid,
2259     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2260         [Show addition build identification in about dialog.]),
2264 AC_ARG_WITH(vendor,
2265     AS_HELP_STRING([--with-vendor="John the Builder"],
2266         [Set vendor of the build.]),
2269 AC_ARG_WITH(android-package-name,
2270     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2271         [Set Android package name of the build.]),
2274 AC_ARG_WITH(compat-oowrappers,
2275     AS_HELP_STRING([--with-compat-oowrappers],
2276         [Install oo* wrappers in parallel with
2277          lo* ones to keep backward compatibility.
2278          Has effect only with make distro-pack-install]),
2281 AC_ARG_WITH(os-version,
2282     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2283         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2286 AC_ARG_WITH(mingw-cross-compiler,
2287     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2288         [Specify the MinGW cross-compiler to use.
2289          When building on the ODK on Unix and building unowinreg.dll,
2290          specify the MinGW C++ cross-compiler.]),
2293 AC_ARG_WITH(idlc-cpp,
2294     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2295         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2298 AC_ARG_WITH(build-version,
2299     AS_HELP_STRING([--with-build-version="Built by Jim"],
2300         [Allows the builder to add a custom version tag that will appear in the
2301          Help/About box for QA purposes.]),
2302 with_build_version=$withval,
2305 AC_ARG_WITH(parallelism,
2306     AS_HELP_STRING([--with-parallelism],
2307         [Number of jobs to run simultaneously during build. Parallel builds can
2308         save a lot of time on multi-cpu machines. Defaults to the number of
2309         CPUs on the machine, unless you configure --enable-icecream - then to
2310         40.]),
2313 AC_ARG_WITH(all-tarballs,
2314     AS_HELP_STRING([--with-all-tarballs],
2315         [Download all external tarballs unconditionally]))
2317 AC_ARG_WITH(gdrive-client-id,
2318     AS_HELP_STRING([--with-gdrive-client-id],
2319         [Provides the client id of the application for OAuth2 authentication
2320         on Google Drive. If either this or --with-gdrive-client-secret is
2321         empty, the feature will be disabled]),
2324 AC_ARG_WITH(gdrive-client-secret,
2325     AS_HELP_STRING([--with-gdrive-client-secret],
2326         [Provides the client secret of the application for OAuth2
2327         authentication on Google Drive. If either this or
2328         --with-gdrive-client-id is empty, the feature will be disabled]),
2331 AC_ARG_WITH(alfresco-cloud-client-id,
2332     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2333         [Provides the client id of the application for OAuth2 authentication
2334         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2335         empty, the feature will be disabled]),
2338 AC_ARG_WITH(alfresco-cloud-client-secret,
2339     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2340         [Provides the client secret of the application for OAuth2
2341         authentication on Alfresco Cloud. If either this or
2342         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2345 AC_ARG_WITH(onedrive-client-id,
2346     AS_HELP_STRING([--with-onedrive-client-id],
2347         [Provides the client id of the application for OAuth2 authentication
2348         on OneDrive. If either this or --with-onedrive-client-secret is
2349         empty, the feature will be disabled]),
2352 AC_ARG_WITH(onedrive-client-secret,
2353     AS_HELP_STRING([--with-onedrive-client-secret],
2354         [Provides the client secret of the application for OAuth2
2355         authentication on OneDrive. If either this or
2356         --with-onedrive-client-id is empty, the feature will be disabled]),
2358 dnl ===================================================================
2359 dnl Do we want to use pre-build binary tarball for recompile
2360 dnl ===================================================================
2362 if test "$enable_library_bin_tar" = "yes" ; then
2363     USE_LIBRARY_BIN_TAR=TRUE
2364 else
2365     USE_LIBRARY_BIN_TAR=
2367 AC_SUBST(USE_LIBRARY_BIN_TAR)
2369 dnl ===================================================================
2370 dnl Test whether build target is Release Build
2371 dnl ===================================================================
2372 AC_MSG_CHECKING([whether build target is Release Build])
2373 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2374     AC_MSG_RESULT([no])
2375     ENABLE_RELEASE_BUILD=
2376 else
2377     AC_MSG_RESULT([yes])
2378     ENABLE_RELEASE_BUILD=TRUE
2380 AC_SUBST(ENABLE_RELEASE_BUILD)
2382 dnl ===================================================================
2383 dnl Test whether to sign Windows Build
2384 dnl ===================================================================
2385 AC_MSG_CHECKING([whether to sign windows build])
2386 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2387     AC_MSG_RESULT([yes])
2388     WINDOWS_BUILD_SIGNING="TRUE"
2389 else
2390     AC_MSG_RESULT([no])
2391     WINDOWS_BUILD_SIGNING="FALSE"
2393 AC_SUBST(WINDOWS_BUILD_SIGNING)
2395 dnl ===================================================================
2396 dnl MacOSX build and runtime environment options
2397 dnl ===================================================================
2399 AC_ARG_WITH(macosx-sdk,
2400     AS_HELP_STRING([--with-macosx-sdk=<version>],
2401         [Prefer a specific SDK for building.])
2402     [
2403                           If the requested SDK is not available, a search for the oldest one will be done.
2404                           With current Xcode versions, only the latest SDK is included, so this option is
2405                           not terribly useful. It works fine to build with a new SDK and run the result
2406                           on an older OS.
2408                           e. g.: --with-macosx-sdk=10.10
2410                           there are 3 options to control the MacOSX build:
2411                           --with-macosx-sdk (referred as 'sdk' below)
2412                           --with-macosx-version-min-required (referred as 'min' below)
2413                           --with-macosx-version-max-allowed (referred as 'max' below)
2415                           the connection between these value and the default they take is as follow:
2416                           ( ? means not specified on the command line, s means the SDK version found,
2417                           constraint: 8 <= x <= y <= z)
2419                           ==========================================
2420                            command line      || config result
2421                           ==========================================
2422                           min  | max  | sdk  || min   | max  | sdk  |
2423                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2424                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2425                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2426                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2427                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2428                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2429                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2430                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2433                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2434                           for a detailed technical explanation of these variables
2436                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2437     ],
2440 AC_ARG_WITH(macosx-version-min-required,
2441     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2442         [set the minimum OS version needed to run the built LibreOffice])
2443     [
2444                           e. g.: --with-macos-version-min-required=10.10
2445                           see --with-macosx-sdk for more info
2446     ],
2449 AC_ARG_WITH(macosx-version-max-allowed,
2450     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2451         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2452     [
2453                           e. g.: --with-macos-version-max-allowed=10.10
2454                           see --with-macosx-sdk for more info
2455     ],
2459 dnl ===================================================================
2460 dnl options for stuff used during cross-compilation build
2461 dnl Not quite superseded by --with-build-platform-configure-options.
2462 dnl TODO: check, if the "force" option is still needed anywhere.
2463 dnl ===================================================================
2465 AC_ARG_WITH(system-icu-for-build,
2466     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2467         [Use icu already on system for build tools (cross-compilation only).]))
2470 dnl ===================================================================
2471 dnl Check for incompatible options set by fuzzing, and reset those
2472 dnl automatically to working combinations
2473 dnl ===================================================================
2475 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2476         "$enable_dbus" != "$enable_avahi"; then
2477     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2478     enable_avahi=$enable_dbus
2481 add_lopath_after ()
2483     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2484         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2485     fi
2488 add_lopath_before ()
2490     local IFS=${P_SEP}
2491     local path_cleanup
2492     local dir
2493     for dir in $LO_PATH ; do
2494         if test "$dir" != "$1" ; then
2495             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2496         fi
2497     done
2498     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2501 dnl ===================================================================
2502 dnl check for required programs (grep, awk, sed, bash)
2503 dnl ===================================================================
2505 pathmunge ()
2507     if test -n "$1"; then
2508         if test "$build_os" = "cygwin"; then
2509             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2510                 PathFormat "$1"
2511                 new_path=`cygpath -sm "$formatted_path"`
2512             else
2513                 PathFormat "$1"
2514                 new_path=`cygpath -u "$formatted_path"`
2515             fi
2516         else
2517             new_path="$1"
2518         fi
2519         if test "$2" = "after"; then
2520             add_lopath_after "$new_path"
2521         else
2522             add_lopath_before "$new_path"
2523         fi
2524         unset new_path
2525     fi
2528 AC_PROG_AWK
2529 AC_PATH_PROG( AWK, $AWK)
2530 if test -z "$AWK"; then
2531     AC_MSG_ERROR([install awk to run this script])
2534 AC_PATH_PROG(BASH, bash)
2535 if test -z "$BASH"; then
2536     AC_MSG_ERROR([bash not found in \$PATH])
2538 AC_SUBST(BASH)
2540 AC_MSG_CHECKING([for GNU or BSD tar])
2541 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2542     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2543     if test $? -eq 0;  then
2544         GNUTAR=$a
2545         break
2546     fi
2547 done
2548 AC_MSG_RESULT($GNUTAR)
2549 if test -z "$GNUTAR"; then
2550     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2552 AC_SUBST(GNUTAR)
2554 AC_MSG_CHECKING([for tar's option to strip components])
2555 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2556 if test $? -eq 0; then
2557     STRIP_COMPONENTS="--strip-components"
2558 else
2559     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2560     if test $? -eq 0; then
2561         STRIP_COMPONENTS="--strip-path"
2562     else
2563         STRIP_COMPONENTS="unsupported"
2564     fi
2566 AC_MSG_RESULT($STRIP_COMPONENTS)
2567 if test x$STRIP_COMPONENTS = xunsupported; then
2568     AC_MSG_ERROR([you need a tar that is able to strip components.])
2570 AC_SUBST(STRIP_COMPONENTS)
2572 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2573 dnl desktop OSes from "mobile" ones.
2575 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2576 dnl In other words, that when building for an OS that is not a
2577 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2579 dnl Note the direction of the implication; there is no assumption that
2580 dnl cross-compiling would imply a non-desktop OS.
2582 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2583     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2584     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2585     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2588 # Whether to build "avmedia" functionality or not.
2590 if test -z "$enable_avmedia"; then
2591     enable_avmedia=yes
2594 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2595 if test "$enable_avmedia" = yes; then
2596     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2597 else
2598     USE_AVMEDIA_DUMMY='TRUE'
2600 AC_SUBST(USE_AVMEDIA_DUMMY)
2602 # Decide whether to build database connectivity stuff (including
2603 # Base) or not. We probably don't want to on non-desktop OSes.
2604 if test -z "$enable_database_connectivity"; then
2605     # --disable-database-connectivity is unfinished work in progress
2606     # and the iOS test app doesn't link if we actually try to use it.
2607     # if test $_os != iOS -a $_os != Android; then
2608     if test $_os != iOS; then
2609         enable_database_connectivity=yes
2610     fi
2613 if test "$enable_database_connectivity" = yes; then
2614     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2615     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2618 if test -z "$enable_extensions"; then
2619     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2620     if test $_os != iOS; then
2621         enable_extensions=yes
2622     fi
2625 if test "$enable_extensions" = yes; then
2626     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2627     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2630 if test -z "$enable_scripting"; then
2631     enable_scripting=yes
2634 DISABLE_SCRIPTING=''
2635 if test "$enable_scripting" = yes; then
2636     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2637     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2638 else
2639     DISABLE_SCRIPTING='TRUE'
2640     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2643 if test $_os = iOS -o $_os = Android; then
2644     # Disable dynamic_loading always for iOS and Android
2645     enable_dynamic_loading=no
2646 elif test -z "$enable_dynamic_loading"; then
2647     # Otherwise enable it unless specifically disabled
2648     enable_dynamic_loading=yes
2651 DISABLE_DYNLOADING=''
2652 if test "$enable_dynamic_loading" = yes; then
2653     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2654 else
2655     DISABLE_DYNLOADING='TRUE'
2657 AC_SUBST(DISABLE_DYNLOADING)
2659 # remember SYSBASE value
2660 AC_SUBST(SYSBASE)
2662 dnl ===================================================================
2663 dnl  Sort out various gallery compilation options
2664 dnl ===================================================================
2665 AC_MSG_CHECKING([how to build and package galleries])
2666 if test -n "${with_galleries}"; then
2667     if test "$with_galleries" = "build"; then
2668         WITH_GALLERY_BUILD=TRUE
2669         AC_MSG_RESULT([build from source images internally])
2670     elif test "$with_galleries" = "no"; then
2671         WITH_GALLERY_BUILD=
2672         AC_MSG_RESULT([disable non-internal gallery build])
2673     else
2674         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2675     fi
2676 else
2677     if test $_os != iOS -a $_os != Android; then
2678         WITH_GALLERY_BUILD=TRUE
2679         AC_MSG_RESULT([internal src images for desktop])
2680     else
2681         WITH_GALLERY_BUILD=
2682         AC_MSG_RESULT([disable src image build])
2683     fi
2685 AC_SUBST(WITH_GALLERY_BUILD)
2687 dnl ===================================================================
2688 dnl  Checks if ccache is available
2689 dnl ===================================================================
2690 CCACHE_DEPEND_MODE=
2691 if test "$_os" = "WINNT"; then
2692     # on windows/VC build do not use ccache
2693     CCACHE=""
2694 elif test "$enable_ccache" = "no"; then
2695     CCACHE=""
2696 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2697     case "%$CC%$CXX%" in
2698     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2699     # assume that's good then
2700     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2701         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2702         CCACHE_DEPEND_MODE=1
2703         ;;
2704     *)
2705         AC_PATH_PROG([CCACHE],[ccache],[not found])
2706         if test "$CCACHE" = "not found"; then
2707             CCACHE=""
2708         else
2709             CCACHE_DEPEND_MODE=1
2710             # Need to check for ccache version: otherwise prevents
2711             # caching of the results (like "-x objective-c++" for Mac)
2712             if test $_os = Darwin -o $_os = iOS; then
2713                 # Check ccache version
2714                 AC_MSG_CHECKING([whether version of ccache is suitable])
2715                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2716                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2717                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2718                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2719                 else
2720                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2721                     CCACHE=""
2722                     CCACHE_DEPEND_MODE=
2723                 fi
2724             fi
2725         fi
2726         ;;
2727     esac
2728 else
2729     CCACHE=""
2731 if test "$enable_ccache" = "nodepend"; then
2732     CCACHE_DEPEND_MODE=""
2734 AC_SUBST(CCACHE_DEPEND_MODE)
2736 if test "$CCACHE" != ""; then
2737     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2738     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2739     if test "$ccache_size" = ""; then
2740         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2741         if test "$ccache_size" = ""; then
2742             ccache_size=0
2743         fi
2744         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2745         if test $ccache_size -lt 1024; then
2746             CCACHE=""
2747             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2748             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2749         else
2750             # warn that ccache may be too small for debug build
2751             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2752             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2753         fi
2754     else
2755         if test $ccache_size -lt 5; then
2756             #warn that ccache may be too small for debug build
2757             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2758             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2759         fi
2760     fi
2763 dnl ===================================================================
2764 dnl  Checks for C compiler,
2765 dnl  The check for the C++ compiler is later on.
2766 dnl ===================================================================
2767 if test "$_os" != "WINNT"; then
2768     GCC_HOME_SET="true"
2769     AC_MSG_CHECKING([gcc home])
2770     if test -z "$with_gcc_home"; then
2771         if test "$enable_icecream" = "yes"; then
2772             if test -d "/usr/lib/icecc/bin"; then
2773                 GCC_HOME="/usr/lib/icecc/"
2774             elif test -d "/usr/libexec/icecc/bin"; then
2775                 GCC_HOME="/usr/libexec/icecc/"
2776             elif test -d "/opt/icecream/bin"; then
2777                 GCC_HOME="/opt/icecream/"
2778             else
2779                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2781             fi
2782         else
2783             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2784             GCC_HOME_SET="false"
2785         fi
2786     else
2787         GCC_HOME="$with_gcc_home"
2788     fi
2789     AC_MSG_RESULT($GCC_HOME)
2790     AC_SUBST(GCC_HOME)
2792     if test "$GCC_HOME_SET" = "true"; then
2793         if test -z "$CC"; then
2794             CC="$GCC_HOME/bin/gcc"
2795             CC_BASE="gcc"
2796         fi
2797         if test -z "$CXX"; then
2798             CXX="$GCC_HOME/bin/g++"
2799             CXX_BASE="g++"
2800         fi
2801     fi
2804 COMPATH=`dirname "$CC"`
2805 if test "$COMPATH" = "."; then
2806     AC_PATH_PROGS(COMPATH, $CC)
2807     dnl double square bracket to get single because of M4 quote...
2808     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2810 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2812 dnl ===================================================================
2813 dnl Java support
2814 dnl ===================================================================
2815 AC_MSG_CHECKING([whether to build with Java support])
2816 if test "$with_java" != "no"; then
2817     if test "$DISABLE_SCRIPTING" = TRUE; then
2818         AC_MSG_RESULT([no, overridden by --disable-scripting])
2819         ENABLE_JAVA=""
2820         with_java=no
2821     else
2822         AC_MSG_RESULT([yes])
2823         ENABLE_JAVA="TRUE"
2824         AC_DEFINE(HAVE_FEATURE_JAVA)
2825     fi
2826 else
2827     AC_MSG_RESULT([no])
2828     ENABLE_JAVA=""
2831 AC_SUBST(ENABLE_JAVA)
2833 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2835 dnl ENABLE_JAVA="" indicate no Java support at all
2837 dnl ===================================================================
2838 dnl Check macOS SDK and compiler
2839 dnl ===================================================================
2841 HAVE_MACOS_LD_PLATFORMVERSION=
2842 if test $_os = Darwin; then
2844     # If no --with-macosx-sdk option is given, look for one
2846     # The intent is that for "most" Mac-based developers, a suitable
2847     # SDK will be found automatically without any configure options.
2849     # For developers with a current Xcode, the lowest-numbered SDK
2850     # higher than or equal to the minimum required should be found.
2852     AC_MSG_CHECKING([what macOS SDK to use])
2853     for _macosx_sdk in ${with_macosx_sdk-12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13 10.12}; do
2854         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2855         if test -d "$MACOSX_SDK_PATH"; then
2856             with_macosx_sdk="${_macosx_sdk}"
2857             break
2858         else
2859             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2860             if test -d "$MACOSX_SDK_PATH"; then
2861                 with_macosx_sdk="${_macosx_sdk}"
2862                 break
2863             fi
2864         fi
2865     done
2866     if test ! -d "$MACOSX_SDK_PATH"; then
2867         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2868     fi
2870     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2872     case $with_macosx_sdk in
2873     10.12)
2874         MACOSX_SDK_VERSION=101200
2875         ;;
2876     10.13)
2877         MACOSX_SDK_VERSION=101300
2878         ;;
2879     10.14)
2880         MACOSX_SDK_VERSION=101400
2881         ;;
2882     10.15)
2883         MACOSX_SDK_VERSION=101500
2884         ;;
2885     11.0)
2886         MACOSX_SDK_VERSION=110000
2887         ;;
2888     11.1)
2889         MACOSX_SDK_VERSION=110100
2890         ;;
2891     11.3)
2892         MACOSX_SDK_VERSION=110300
2893         ;;
2894     12.0)
2895         MACOSX_SDK_VERSION=120000
2896         ;;
2897     12.1)
2898         MACOSX_SDK_VERSION=120100
2899         ;;
2900     *)
2901         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--12.1])
2902         ;;
2903     esac
2905     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2906         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2907     fi
2909     if test "$with_macosx_version_min_required" = "" ; then
2910         if test "$host_cpu" = x86_64; then
2911             with_macosx_version_min_required="10.10";
2912         else
2913             with_macosx_version_min_required="11.0";
2914         fi
2915     fi
2917     if test "$with_macosx_version_max_allowed" = "" ; then
2918         with_macosx_version_max_allowed="$with_macosx_sdk"
2919     fi
2921     # export this so that "xcrun" invocations later return matching values
2922     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2923     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2924     export DEVELOPER_DIR
2925     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2926     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2928     AC_MSG_CHECKING([whether Xcode is new enough])
2929     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2930     my_xcode_ver2=${my_xcode_ver1#Xcode }
2931     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2932     if test "$my_xcode_ver3" -ge 903; then
2933         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2934     else
2935         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2936     fi
2938     case "$with_macosx_version_min_required" in
2939     10.10)
2940         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2941         ;;
2942     10.11)
2943         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2944         ;;
2945     10.12)
2946         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2947         ;;
2948     10.13)
2949         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2950         ;;
2951     10.14)
2952         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2953         ;;
2954     10.15)
2955         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2956         ;;
2957     10.16)
2958         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
2959         ;;
2960     11.0)
2961         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2962         ;;
2963     11.1)
2964         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
2965         ;;
2966     11.3)
2967         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
2968         ;;
2969     12.0)
2970         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
2971         ;;
2972     12.1)
2973         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
2974         ;;
2975     *)
2976         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.1])
2977         ;;
2978     esac
2979     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2981     LIBTOOL=/usr/bin/libtool
2982     INSTALL_NAME_TOOL=install_name_tool
2983     if test -z "$save_CC"; then
2984         stdlib=-stdlib=libc++
2985         if test "$ENABLE_LTO" = TRUE; then
2986             lto=-flto
2987         fi
2989         AC_MSG_CHECKING([what C compiler to use])
2990         CC="`xcrun -find clang`"
2991         CC_BASE=`first_arg_basename "$CC"`
2992         if test "$host_cpu" = x86_64; then
2993             CC+=" -target x86_64-apple-macos"
2994         else
2995             CC+=" -target arm64-apple-macos"
2996         fi
2997         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2998         AC_MSG_RESULT([$CC])
3000         AC_MSG_CHECKING([what C++ compiler to use])
3001         CXX="`xcrun -find clang++`"
3002         CXX_BASE=`first_arg_basename "$CXX"`
3003         if test "$host_cpu" = x86_64; then
3004             CXX+=" -target x86_64-apple-macos"
3005         else
3006             CXX+=" -target arm64-apple-macos"
3007         fi
3008         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3009         AC_MSG_RESULT([$CXX])
3011         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3012         AR=`xcrun -find ar`
3013         NM=`xcrun -find nm`
3014         STRIP=`xcrun -find strip`
3015         LIBTOOL=`xcrun -find libtool`
3016         RANLIB=`xcrun -find ranlib`
3017     fi
3019     case "$with_macosx_version_max_allowed" in
3020     10.10)
3021         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3022         ;;
3023     10.11)
3024         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3025         ;;
3026     10.12)
3027         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3028         ;;
3029     10.13)
3030         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3031         ;;
3032     10.14)
3033         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3034         ;;
3035     10.15)
3036         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3037         ;;
3038     11.0)
3039         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3040         ;;
3041     11.1)
3042         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3043         ;;
3044     11.3)
3045         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3046         ;;
3047     12.0)
3048         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3049         ;;
3050     12.1)
3051         MAC_OS_X_VERSION_MAX_ALLOWED="120100"
3052         ;;
3053     *)
3054         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.1])
3055         ;;
3056     esac
3058     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3059     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3060         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])
3061     else
3062         AC_MSG_RESULT([ok])
3063     fi
3065     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3066     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3067         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3068     else
3069         AC_MSG_RESULT([ok])
3070     fi
3071     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3072     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3074     AC_MSG_CHECKING([whether to do code signing])
3076     if test "$enable_macosx_code_signing" = yes; then
3077         # By default use the first suitable certificate (?).
3079         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3080         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3081         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3082         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3083         # "Developer ID Application" one.
3085         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3086         if test -n "$identity"; then
3087             MACOSX_CODESIGNING_IDENTITY=$identity
3088             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3089             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3090         else
3091             AC_MSG_ERROR([cannot determine identity to use])
3092         fi
3093     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3094         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3095         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3096         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3097     else
3098         AC_MSG_RESULT([no])
3099     fi
3101     AC_MSG_CHECKING([whether to create a Mac App Store package])
3103     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3104         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3105     elif test "$enable_macosx_package_signing" = yes; then
3106         # By default use the first suitable certificate.
3107         # It should be a "3rd Party Mac Developer Installer" one
3109         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3110         if test -n "$identity"; then
3111             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3112             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3113             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3114         else
3115             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3116         fi
3117     elif test -n "$enable_macosx_package_signing"; then
3118         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3119         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3120         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3121     else
3122         AC_MSG_RESULT([no])
3123     fi
3125     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3126         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3127     fi
3129     AC_MSG_CHECKING([whether to sandbox the application])
3131     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3132         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3133     elif test "$enable_macosx_sandbox" = yes; then
3134         ENABLE_MACOSX_SANDBOX=TRUE
3135         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3136         AC_MSG_RESULT([yes])
3137     else
3138         AC_MSG_RESULT([no])
3139     fi
3141     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3142     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3143     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3145     AC_MSG_CHECKING([whether the linker supports -platform_version])
3146     save_LDFLAGS=$LDFLAGS
3147     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3148         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3149     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3150         [AC_MSG_RESULT([yes])
3151          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3152         [AC_MSG_RESULT([no])])
3153     LDFLAGS=$save_LDFLAGS
3155 AC_SUBST(MACOSX_SDK_PATH)
3156 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3157 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3158 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3159 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3160 AC_SUBST(INSTALL_NAME_TOOL)
3161 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3162 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3163 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3164 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3165 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3166 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3168 dnl ===================================================================
3169 dnl Check iOS SDK and compiler
3170 dnl ===================================================================
3172 if test $_os = iOS; then
3173     AC_MSG_CHECKING([what iOS SDK to use])
3174     current_sdk_ver=15.2
3175     older_sdk_vers="15.0 14.5 14.0"
3176     if test "$enable_ios_simulator" = "yes"; then
3177         platform=iPhoneSimulator
3178         versionmin=-mios-simulator-version-min=12.2
3179     else
3180         platform=iPhoneOS
3181         versionmin=-miphoneos-version-min=12.2
3182     fi
3183     xcode_developer=`xcode-select -print-path`
3185     for sdkver in $current_sdk_ver $older_sdk_vers; do
3186         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3187         if test -d $t; then
3188             sysroot=$t
3189             break
3190         fi
3191     done
3193     if test -z "$sysroot"; then
3194         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3195     fi
3197     AC_MSG_RESULT($sysroot)
3199     # LTO is not really recommended for iOS builds,
3200     # the link time will be astronomical
3201     if test "$ENABLE_LTO" = TRUE; then
3202         lto=-flto
3203     fi
3205     stdlib="-stdlib=libc++"
3207     AC_MSG_CHECKING([what C compiler to use])
3208     CC="`xcrun -find clang`"
3209     CC_BASE=`first_arg_basename "$CC"`
3210     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
3211     AC_MSG_RESULT([$CC])
3213     AC_MSG_CHECKING([what C++ compiler to use])
3214     CXX="`xcrun -find clang++`"
3215     CXX_BASE=`first_arg_basename "$CXX"`
3216     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
3217     AC_MSG_RESULT([$CXX])
3219     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3220     AR=`xcrun -find ar`
3221     NM=`xcrun -find nm`
3222     STRIP=`xcrun -find strip`
3223     LIBTOOL=`xcrun -find libtool`
3224     RANLIB=`xcrun -find ranlib`
3227 AC_MSG_CHECKING([whether to treat the installation as read-only])
3229 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3230         "$enable_extensions" != yes; then
3231     enable_readonly_installset=yes
3233 if test "$enable_readonly_installset" = yes; then
3234     AC_MSG_RESULT([yes])
3235     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3236 else
3237     AC_MSG_RESULT([no])
3240 dnl ===================================================================
3241 dnl Structure of install set
3242 dnl ===================================================================
3244 if test $_os = Darwin; then
3245     LIBO_BIN_FOLDER=MacOS
3246     LIBO_ETC_FOLDER=Resources
3247     LIBO_LIBEXEC_FOLDER=MacOS
3248     LIBO_LIB_FOLDER=Frameworks
3249     LIBO_LIB_PYUNO_FOLDER=Resources
3250     LIBO_SHARE_FOLDER=Resources
3251     LIBO_SHARE_HELP_FOLDER=Resources/help
3252     LIBO_SHARE_JAVA_FOLDER=Resources/java
3253     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3254     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3255     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3256     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3257     LIBO_URE_BIN_FOLDER=MacOS
3258     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3259     LIBO_URE_LIB_FOLDER=Frameworks
3260     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3261     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3262 elif test $_os = WINNT; then
3263     LIBO_BIN_FOLDER=program
3264     LIBO_ETC_FOLDER=program
3265     LIBO_LIBEXEC_FOLDER=program
3266     LIBO_LIB_FOLDER=program
3267     LIBO_LIB_PYUNO_FOLDER=program
3268     LIBO_SHARE_FOLDER=share
3269     LIBO_SHARE_HELP_FOLDER=help
3270     LIBO_SHARE_JAVA_FOLDER=program/classes
3271     LIBO_SHARE_PRESETS_FOLDER=presets
3272     LIBO_SHARE_READMES_FOLDER=readmes
3273     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3274     LIBO_SHARE_SHELL_FOLDER=program/shell
3275     LIBO_URE_BIN_FOLDER=program
3276     LIBO_URE_ETC_FOLDER=program
3277     LIBO_URE_LIB_FOLDER=program
3278     LIBO_URE_MISC_FOLDER=program
3279     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3280 else
3281     LIBO_BIN_FOLDER=program
3282     LIBO_ETC_FOLDER=program
3283     LIBO_LIBEXEC_FOLDER=program
3284     LIBO_LIB_FOLDER=program
3285     LIBO_LIB_PYUNO_FOLDER=program
3286     LIBO_SHARE_FOLDER=share
3287     LIBO_SHARE_HELP_FOLDER=help
3288     LIBO_SHARE_JAVA_FOLDER=program/classes
3289     LIBO_SHARE_PRESETS_FOLDER=presets
3290     LIBO_SHARE_READMES_FOLDER=readmes
3291     if test "$enable_fuzzers" != yes; then
3292         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3293     else
3294         LIBO_SHARE_RESOURCE_FOLDER=resource
3295     fi
3296     LIBO_SHARE_SHELL_FOLDER=program/shell
3297     LIBO_URE_BIN_FOLDER=program
3298     LIBO_URE_ETC_FOLDER=program
3299     LIBO_URE_LIB_FOLDER=program
3300     LIBO_URE_MISC_FOLDER=program
3301     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3303 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3304 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3305 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3306 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3307 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3308 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3309 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3310 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3311 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3312 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3313 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3314 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3315 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3316 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3317 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3318 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3320 # Not all of them needed in config_host.mk, add more if need arises
3321 AC_SUBST(LIBO_BIN_FOLDER)
3322 AC_SUBST(LIBO_ETC_FOLDER)
3323 AC_SUBST(LIBO_LIB_FOLDER)
3324 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3325 AC_SUBST(LIBO_SHARE_FOLDER)
3326 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3327 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3328 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3329 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3330 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3331 AC_SUBST(LIBO_URE_BIN_FOLDER)
3332 AC_SUBST(LIBO_URE_ETC_FOLDER)
3333 AC_SUBST(LIBO_URE_LIB_FOLDER)
3334 AC_SUBST(LIBO_URE_MISC_FOLDER)
3335 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3337 dnl ===================================================================
3338 dnl Windows specific tests and stuff
3339 dnl ===================================================================
3341 reg_get_value()
3343     # Return value: $regvalue
3344     unset regvalue
3346     local _regentry="/proc/registry${1}/${2}"
3347     if test -f "$_regentry"; then
3348         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3349         # Registry keys read via /proc/registry* are always \0 terminated!
3350         local _regvalue=$(tr -d '\0' < "$_regentry")
3351         if test $? -eq 0; then
3352             regvalue=$_regvalue
3353         fi
3354     fi
3357 # Get a value from the 32-bit side of the Registry
3358 reg_get_value_32()
3360     reg_get_value "32" "$1"
3363 # Get a value from the 64-bit side of the Registry
3364 reg_get_value_64()
3366     reg_get_value "64" "$1"
3369 if test "$_os" = "WINNT"; then
3370     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3371     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3372         AC_MSG_RESULT([no])
3373         WINDOWS_SDK_ARCH="x86"
3374     else
3375         AC_MSG_RESULT([yes])
3376         WINDOWS_SDK_ARCH="x64"
3377         BITNESS_OVERRIDE=64
3378     fi
3380 AC_SUBST(WINDOWS_SDK_ARCH)
3381 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3382     cross_compiling="yes"
3384 if test "$cross_compiling" = "yes"; then
3385     export CROSS_COMPILING=TRUE
3386 else
3387     CROSS_COMPILING=
3388     BUILD_TYPE="$BUILD_TYPE NATIVE"
3390 AC_SUBST(CROSS_COMPILING)
3392 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3393 # NOTE: must _not_ be used for bundled external libraries!
3394 ISYSTEM=
3395 if test "$GCC" = "yes"; then
3396     AC_MSG_CHECKING( for -isystem )
3397     save_CFLAGS=$CFLAGS
3398     CFLAGS="$CFLAGS -Werror"
3399     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3400     CFLAGS=$save_CFLAGS
3401     if test -n "$ISYSTEM"; then
3402         AC_MSG_RESULT(yes)
3403     else
3404         AC_MSG_RESULT(no)
3405     fi
3407 if test -z "$ISYSTEM"; then
3408     # fall back to using -I
3409     ISYSTEM=-I
3411 AC_SUBST(ISYSTEM)
3413 dnl ===================================================================
3414 dnl  Check which Visual Studio compiler is used
3415 dnl ===================================================================
3417 map_vs_year_to_version()
3419     # Return value: $vsversion
3421     unset vsversion
3423     case $1 in
3424     2017)
3425         vsversion=15;;
3426     2019)
3427         vsversion=16;;
3428     *)
3429         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3430     esac
3433 vs_versions_to_check()
3435     # Args: $1 (optional) : versions to check, in the order of preference
3436     # Return value: $vsversions
3438     unset vsversions
3440     if test -n "$1"; then
3441         map_vs_year_to_version "$1"
3442         vsversions=$vsversion
3443     else
3444         # We accept only 2017
3445         vsversions="15"
3446     fi
3449 win_get_env_from_vsvars32bat()
3451     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3452     # Also seems to be located in another directory under the same name: vsvars32.bat
3453     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3454     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3455     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3456     chmod +x $WRAPPERBATCHFILEPATH
3457     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3458     rm -f $WRAPPERBATCHFILEPATH
3459     printf '%s' "$_win_get_env_from_vsvars32bat"
3462 find_ucrt()
3464     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3465     if test -n "$regvalue"; then
3466         PathFormat "$regvalue"
3467         UCRTSDKDIR=$formatted_path
3468         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3469         UCRTVERSION=$regvalue
3470         # Rest if not exist
3471         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3472           UCRTSDKDIR=
3473         fi
3474     fi
3475     if test -z "$UCRTSDKDIR"; then
3476         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3477         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3478         if test -f "$ide_env_file"; then
3479             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3480             UCRTSDKDIR=$formatted_path
3481             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3482             dnl Hack needed at least by tml:
3483             if test "$UCRTVERSION" = 10.0.15063.0 \
3484                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3485                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3486             then
3487                 UCRTVERSION=10.0.14393.0
3488             fi
3489         else
3490           AC_MSG_ERROR([No UCRT found])
3491         fi
3492     fi
3495 find_msvc()
3497     # Find Visual C++ 2017/2019
3498     # Args: $1 (optional) : The VS version year
3499     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3501     unset vctest vcnum vcnumwithdot vcbuildnumber
3503     vs_versions_to_check "$1"
3504     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3505     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3506     PathFormat "$vswhere"
3507     vswhere=$formatted_path
3508     for ver in $vsversions; do
3509         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3510         if test -n "$vswhereoutput"; then
3511             PathFormat "$vswhereoutput"
3512             vctest=$formatted_path
3513             break
3514         fi
3515     done
3517     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3518     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3519     # should be removed when upgrading baseline.
3520     if ! test -n "$vctest"; then
3521         for ver in $vsversions; do
3522             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3523             if test -n "$regvalue"; then
3524                 vctest=$regvalue
3525                 break
3526             fi
3527             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3528             if test -n "$regvalue"; then
3529                 AC_MSG_RESULT([found: $regvalue])
3530                 PathFormat "$regvalue"
3531                 vctest=$formatted_path
3532                 break
3533             fi
3534         done
3535     fi
3537     if test -n "$vctest"; then
3538         vcnumwithdot="$ver.0"
3539         case "$vcnumwithdot" in
3540         15.0)
3541             vcyear=2017
3542             vcnum=150
3543             ;;
3544         16.0)
3545             vcyear=2019
3546             vcnum=160
3547             ;;
3548         esac
3549         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3551     fi
3554 SOLARINC=
3555 MSBUILD_PATH=
3556 DEVENV=
3557 if test "$_os" = "WINNT"; then
3558     AC_MSG_CHECKING([Visual C++])
3559     find_msvc "$with_visual_studio"
3560     if test -z "$vctest"; then
3561         if test -n "$with_visual_studio"; then
3562             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3563         else
3564             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3565         fi
3566     fi
3568     if test "$BITNESS_OVERRIDE" = ""; then
3569         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3570             VC_PRODUCT_DIR=$vctest/VC
3571         else
3572             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3573         fi
3574     else
3575         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3576             VC_PRODUCT_DIR=$vctest/VC
3577         else
3578             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3579         fi
3580     fi
3581     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3583     AC_MSG_CHECKING([for short pathname of VC product directory])
3584     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3585     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3587     UCRTSDKDIR=
3588     UCRTVERSION=
3590     AC_MSG_CHECKING([for UCRT location])
3591     find_ucrt
3592     # find_ucrt errors out if it doesn't find it
3593     AC_MSG_RESULT([found])
3594     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3595     ucrtincpath_formatted=$formatted_path
3596     # SOLARINC is used for external modules and must be set too.
3597     # And no, it's not sufficient to set SOLARINC only, as configure
3598     # itself doesn't honour it.
3599     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3600     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3601     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3602     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3604     AC_SUBST(UCRTSDKDIR)
3605     AC_SUBST(UCRTVERSION)
3607     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3608     # Find the proper version of MSBuild.exe to use based on the VS version
3609     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3610     if test -n "$regvalue" ; then
3611         AC_MSG_RESULT([found: $regvalue])
3612         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3613     else
3614         if test "$vcnumwithdot" = "16.0"; then
3615             if test "$BITNESS_OVERRIDE" = ""; then
3616                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3617             else
3618                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3619             fi
3620         else
3621             if test "$BITNESS_OVERRIDE" = ""; then
3622                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3623             else
3624                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3625             fi
3626         fi
3627         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3628         AC_MSG_RESULT([$regvalue])
3629     fi
3631     # Find the version of devenv.exe
3632     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3633     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3634     if test ! -e "$DEVENV"; then
3635         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3636     fi
3638     dnl ===========================================================
3639     dnl  Check for the corresponding mspdb*.dll
3640     dnl ===========================================================
3642     VC_HOST_DIR=
3643     MSPDB_PATH=
3644     CL_PATH=
3646     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3647         VC_HOST_DIR="HostX64"
3648         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3649     else
3650         VC_HOST_DIR="HostX86"
3651         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3652     fi
3654     if test "$BITNESS_OVERRIDE" = ""; then
3655         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3656     else
3657         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3658     fi
3660     # MSVC 15.0 has libraries from 14.0?
3661     mspdbnum="140"
3663     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3664         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3665     fi
3667     dnl The path needs to be added before cl is called
3668     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3669     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3671     AC_MSG_CHECKING([cl.exe])
3673     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3674     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3675     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3676     # is not enough?
3678     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3679     dnl needed when building CLR code:
3680     if test -z "$MSVC_CXX"; then
3681         if test -f "$CL_PATH/cl.exe"; then
3682             MSVC_CXX="$CL_PATH/cl.exe"
3683         fi
3685         # This gives us a posix path with 8.3 filename restrictions
3686         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3687     fi
3689     if test -z "$CC"; then
3690         CC=$MSVC_CXX
3691         CC_BASE=`first_arg_basename "$CC"`
3692     fi
3693     if test "$BITNESS_OVERRIDE" = ""; then
3694         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3695         MSVC_CXX="$MSVC_CXX -arch:SSE"
3696     fi
3697     if test -z "$CXX"; then
3698         CXX=$MSVC_CXX
3699         CXX_BASE=`first_arg_basename "$CXX"`
3700     fi
3702     if test -n "$CC"; then
3703         # Remove /cl.exe from CC case insensitive
3704         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3705         if test "$BITNESS_OVERRIDE" = ""; then
3706            COMPATH="$VC_PRODUCT_DIR"
3707         else
3708             if test -n "$VC_PRODUCT_DIR"; then
3709                 COMPATH=$VC_PRODUCT_DIR
3710             fi
3711         fi
3712         if test "$BITNESS_OVERRIDE" = ""; then
3713             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3714             CC="$CC -arch:SSE"
3715         fi
3717         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3719         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3721         PathFormat "$COMPATH"
3722         COMPATH=`win_short_path_for_make "$formatted_path"`
3724         VCVER=$vcnum
3725         MSVSVER=$vcyear
3727         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3728         # are always "better", we list them in reverse chronological order.
3730         case "$vcnum" in
3731         150|160)
3732             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3733             ;;
3734         esac
3736         # The expectation is that --with-windows-sdk should not need to be used
3737         if test -n "$with_windows_sdk"; then
3738             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3739             *" "$with_windows_sdk" "*)
3740                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3741                 ;;
3742             *)
3743                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3744                 ;;
3745             esac
3746         fi
3748         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3749         ac_objext=obj
3750         ac_exeext=exe
3752     else
3753         AC_MSG_ERROR([Visual C++ not found after all, huh])
3754     fi
3756     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3757     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3758         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3759         // between Visual Studio versions and _MSC_VER:
3760         #if _MSC_VER < 1914
3761         #error
3762         #endif
3763     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3765     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3766     # version of the Explorer extension (and maybe other small
3767     # bits, too) needed when installing a 32-bit LibreOffice on a
3768     # 64-bit OS. The 64-bit Explorer extension is a feature that
3769     # has been present since long in OOo. Don't confuse it with
3770     # building LibreOffice itself as 64-bit code.
3772     BUILD_X64=
3773     CXX_X64_BINARY=
3775     if test "$BITNESS_OVERRIDE" = ""; then
3776         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3777         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3778              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3779             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3780                 BUILD_X64=TRUE
3781                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3782             fi
3783         fi
3784         if test "$BUILD_X64" = TRUE; then
3785             AC_MSG_RESULT([found])
3786         else
3787             AC_MSG_RESULT([not found])
3788             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3789         fi
3790     else
3791         CXX_X64_BINARY=$CXX
3792     fi
3793     AC_SUBST(BUILD_X64)
3795     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3796     AC_SUBST(CXX_X64_BINARY)
3798     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3799     # needed to support TWAIN scan on both 32- and 64-bit systems
3801     BUILD_X86=
3803     if test "$BITNESS_OVERRIDE" = "64"; then
3804         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3805         if test -n "$CXX_X86_BINARY"; then
3806             BUILD_X86=TRUE
3807             AC_MSG_RESULT([preset])
3808         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3809             BUILD_X86=TRUE
3810             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3811             CXX_X86_BINARY+=" /arch:SSE"
3812             AC_MSG_RESULT([found])
3813         else
3814             CXX_X86_BINARY=
3815             AC_MSG_RESULT([not found])
3816             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3817         fi
3818     else
3819         BUILD_X86=TRUE
3820         CXX_X86_BINARY=$MSVC_CXX
3821     fi
3822     AC_SUBST(BUILD_X86)
3823     AC_SUBST(CXX_X86_BINARY)
3825 AC_SUBST(VCVER)
3826 AC_SUBST(DEVENV)
3827 AC_SUBST(MSVC_CXX)
3830 # unowinreg.dll
3832 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3833 AC_SUBST(UNOWINREG_DLL)
3835 COM_IS_CLANG=
3836 AC_MSG_CHECKING([whether the compiler is actually Clang])
3837 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3838     #ifndef __clang__
3839     you lose
3840     #endif
3841     int foo=42;
3842     ]])],
3843     [AC_MSG_RESULT([yes])
3844      COM_IS_CLANG=TRUE],
3845     [AC_MSG_RESULT([no])])
3846 AC_SUBST(COM_IS_CLANG)
3848 CC_PLAIN=$CC
3849 CLANGVER=
3850 if test "$COM_IS_CLANG" = TRUE; then
3851     AC_MSG_CHECKING([whether Clang is new enough])
3852     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3853         #if !defined __apple_build_version__
3854         #error
3855         #endif
3856         ]])],
3857         [my_apple_clang=yes],[my_apple_clang=])
3858     if test "$my_apple_clang" = yes; then
3859         AC_MSG_RESULT([assumed yes (Apple Clang)])
3860     else
3861         if test "$_os" = WINNT; then
3862             dnl In which case, assume clang-cl:
3863             my_args="/EP /TC"
3864             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3865             dnl clang-cl:
3866             CC_PLAIN=
3867             for i in $CC; do
3868                 case $i in
3869                 -FIIntrin.h)
3870                     ;;
3871                 *)
3872                     CC_PLAIN="$CC_PLAIN $i"
3873                     ;;
3874                 esac
3875             done
3876         else
3877             my_args="-E -P"
3878         fi
3879         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3880         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3881         CLANGVER=`echo $clang_version \
3882             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3883         if test "$CLANGVER" -ge 50002; then
3884             AC_MSG_RESULT([yes ($clang_version)])
3885         else
3886             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3887         fi
3888         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3889         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3890     fi
3893 SHOWINCLUDES_PREFIX=
3894 if test "$_os" = WINNT; then
3895     dnl We need to guess the prefix of the -showIncludes output, it can be
3896     dnl localized
3897     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3898     echo "#include <stdlib.h>" > conftest.c
3899     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3900         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3901     rm -f conftest.c conftest.obj
3902     if test -z "$SHOWINCLUDES_PREFIX"; then
3903         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3904     else
3905         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3906     fi
3908 AC_SUBST(SHOWINCLUDES_PREFIX)
3911 # prefix C with ccache if needed
3913 if test "$CCACHE" != ""; then
3914     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3916     AC_LANG_PUSH([C])
3917     save_CFLAGS=$CFLAGS
3918     CFLAGS="$CFLAGS --ccache-skip -O2"
3919     dnl an empty program will do, we're checking the compiler flags
3920     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3921                       [use_ccache=yes], [use_ccache=no])
3922     if test $use_ccache = yes; then
3923         AC_MSG_RESULT([yes])
3924     else
3925         CC="$CCACHE $CC"
3926         CC_BASE="ccache $CC_BASE"
3927         AC_MSG_RESULT([no])
3928     fi
3929     CFLAGS=$save_CFLAGS
3930     AC_LANG_POP([C])
3933 # ===================================================================
3934 # check various GCC options that Clang does not support now but maybe
3935 # will somewhen in the future, check them even for GCC, so that the
3936 # flags are set
3937 # ===================================================================
3939 HAVE_GCC_GGDB2=
3940 if test "$GCC" = "yes"; then
3941     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3942     save_CFLAGS=$CFLAGS
3943     CFLAGS="$CFLAGS -Werror -ggdb2"
3944     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3945     CFLAGS=$save_CFLAGS
3946     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3947         AC_MSG_RESULT([yes])
3948     else
3949         AC_MSG_RESULT([no])
3950     fi
3952     if test "$host_cpu" = "m68k"; then
3953         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3954         save_CFLAGS=$CFLAGS
3955         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3956         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3957         CFLAGS=$save_CFLAGS
3958         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3959             AC_MSG_RESULT([yes])
3960         else
3961             AC_MSG_ERROR([no])
3962         fi
3963     fi
3965 AC_SUBST(HAVE_GCC_GGDB2)
3967 dnl ===================================================================
3968 dnl  Test the gcc version
3969 dnl ===================================================================
3970 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3971     AC_MSG_CHECKING([the GCC version])
3972     _gcc_version=`$CC -dumpversion`
3973     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3974         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3975     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3977     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3979     if test "$gcc_full_version" -lt 70000; then
3980         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3981     fi
3982 else
3983     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3984     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3985     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3986     # (which reports itself as GCC 4.2.1).
3987     GCC_VERSION=
3989 AC_SUBST(GCC_VERSION)
3991 dnl Set the ENABLE_DBGUTIL variable
3992 dnl ===================================================================
3993 AC_MSG_CHECKING([whether to build with additional debug utilities])
3994 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3995     ENABLE_DBGUTIL="TRUE"
3996     # this is an extra var so it can have different default on different MSVC
3997     # versions (in case there are version specific problems with it)
3998     MSVC_USE_DEBUG_RUNTIME="TRUE"
4000     AC_MSG_RESULT([yes])
4001     # cppunit and graphite expose STL in public headers
4002     if test "$with_system_cppunit" = "yes"; then
4003         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4004     else
4005         with_system_cppunit=no
4006     fi
4007     if test "$with_system_graphite" = "yes"; then
4008         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4009     else
4010         with_system_graphite=no
4011     fi
4012     if test "$with_system_orcus" = "yes"; then
4013         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4014     else
4015         with_system_orcus=no
4016     fi
4017     if test "$with_system_libcmis" = "yes"; then
4018         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4019     else
4020         with_system_libcmis=no
4021     fi
4022     if test "$with_system_hunspell" = "yes"; then
4023         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4024     else
4025         with_system_hunspell=no
4026     fi
4027     if test "$with_system_gpgmepp" = "yes"; then
4028         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4029     else
4030         with_system_gpgmepp=no
4031     fi
4032     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4033     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4034     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4035     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4036     # of those two is using the system variant:
4037     if test "$with_system_libnumbertext" = "yes"; then
4038         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4039     else
4040         with_system_libnumbertext=no
4041     fi
4042     if test "$with_system_libwps" = "yes"; then
4043         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4044     else
4045         with_system_libwps=no
4046     fi
4047 else
4048     ENABLE_DBGUTIL=""
4049     MSVC_USE_DEBUG_RUNTIME=""
4050     AC_MSG_RESULT([no])
4052 AC_SUBST(ENABLE_DBGUTIL)
4053 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4055 dnl Set the ENABLE_DEBUG variable.
4056 dnl ===================================================================
4057 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4058     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4060 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4061     if test -z "$libo_fuzzed_enable_debug"; then
4062         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4063     else
4064         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4065         enable_debug=yes
4066     fi
4069 AC_MSG_CHECKING([whether to do a debug build])
4070 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4071     ENABLE_DEBUG="TRUE"
4072     if test -n "$ENABLE_DBGUTIL" ; then
4073         AC_MSG_RESULT([yes (dbgutil)])
4074     else
4075         AC_MSG_RESULT([yes])
4076     fi
4077 else
4078     ENABLE_DEBUG=""
4079     AC_MSG_RESULT([no])
4081 AC_SUBST(ENABLE_DEBUG)
4083 dnl ===================================================================
4084 dnl Select the linker to use (gold/lld/ld.bfd).
4085 dnl This is done only after compiler checks (need to know if Clang is
4086 dnl used, for different defaults) and after checking if a debug build
4087 dnl is wanted (non-debug builds get the default linker if not explicitly
4088 dnl specified otherwise).
4089 dnl All checks for linker features/options should come after this.
4090 dnl ===================================================================
4091 check_use_ld()
4093     use_ld=$1
4094     use_ld_fail_if_error=$2
4095     use_ld_ok=
4096     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
4097     use_ld_ldflags_save="$LDFLAGS"
4098     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
4099     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4100 #include <stdio.h>
4101         ],[
4102 printf ("hello world\n");
4103         ])], USE_LD=$use_ld, [])
4104     if test -n "$USE_LD"; then
4105         AC_MSG_RESULT( yes )
4106         use_ld_ok=yes
4107     else
4108         if test -n "$use_ld_fail_if_error"; then
4109             AC_MSG_ERROR( no )
4110         else
4111             AC_MSG_RESULT( no )
4112         fi
4113     fi
4114     if test -n "$use_ld_ok"; then
4115         dnl keep the value of LDFLAGS
4116         return 0
4117     fi
4118     LDFLAGS="$use_ld_ldflags_save"
4119     return 1
4121 USE_LD=
4122 if test "$enable_ld" != "no"; then
4123     if test "$GCC" = "yes"; then
4124         if test -n "$enable_ld"; then
4125             check_use_ld "$enable_ld" fail_if_error
4126         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4127             dnl non-debug builds default to the default linker
4128             true
4129         elif test -n "$COM_IS_CLANG"; then
4130             check_use_ld lld
4131             if test $? -ne 0; then
4132                 check_use_ld gold
4133             fi
4134         else
4135             # For gcc first try gold, new versions also support lld.
4136             check_use_ld gold
4137             if test $? -ne 0; then
4138                 check_use_ld lld
4139             fi
4140         fi
4141         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4142         rm conftest.out
4143         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4144         if test -z "$ld_used"; then
4145             ld_used="unknown"
4146         fi
4147         AC_MSG_CHECKING([for linker that is used])
4148         AC_MSG_RESULT([$ld_used])
4149         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4150             if echo "$ld_used" | grep -q "^GNU ld"; then
4151                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4152                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4153             fi
4154         fi
4155     else
4156         if test "$enable_ld" = "yes"; then
4157             AC_MSG_ERROR([--enable-ld not supported])
4158         fi
4159     fi
4161 AC_SUBST(USE_LD)
4163 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4164 if test "$GCC" = "yes"; then
4165     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4166     bsymbolic_functions_ldflags_save=$LDFLAGS
4167     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4168     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4169 #include <stdio.h>
4170         ],[
4171 printf ("hello world\n");
4172         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4173     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4174         AC_MSG_RESULT( found )
4175     else
4176         AC_MSG_RESULT( not found )
4177     fi
4178     LDFLAGS=$bsymbolic_functions_ldflags_save
4180 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4183 HAVE_GSPLIT_DWARF=
4184 if test "$enable_split_debug" != no; then
4185     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4186     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4187         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4188         save_CFLAGS=$CFLAGS
4189         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4190         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4191         CFLAGS=$save_CFLAGS
4192         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4193             AC_MSG_RESULT([yes])
4194         else
4195             if test "$enable_split_debug" = yes; then
4196                 AC_MSG_ERROR([no])
4197             else
4198                 AC_MSG_RESULT([no])
4199             fi
4200         fi
4201     fi
4202     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4203         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4204         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4205     fi
4207 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4209 ENABLE_GDB_INDEX=
4210 if test "$enable_gdb_index" != "no"; then
4211     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4212     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4213         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4214         save_CFLAGS=$CFLAGS
4215         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4216         have_ggnu_pubnames=
4217         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4218         if test "$have_ggnu_pubnames" != "TRUE"; then
4219             if test "$enable_gdb_index" = "yes"; then
4220                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4221             else
4222                 AC_MSG_RESULT( no )
4223             fi
4224         else
4225             AC_MSG_RESULT( yes )
4226             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4227             ldflags_save=$LDFLAGS
4228             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4229             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4230 #include <stdio.h>
4231                 ],[
4232 printf ("hello world\n");
4233                 ])], ENABLE_GDB_INDEX=TRUE, [])
4234             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4235                 AC_MSG_RESULT( yes )
4236             else
4237                 if test "$enable_gdb_index" = "yes"; then
4238                     AC_MSG_ERROR( no )
4239                 else
4240                     AC_MSG_RESULT( no )
4241                 fi
4242             fi
4243             LDFLAGS=$ldflags_save
4244         fi
4245         CFLAGS=$save_CFLAGS
4246         fi
4247     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4248         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4249         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4250     fi
4252 AC_SUBST(ENABLE_GDB_INDEX)
4254 if test "$enable_sal_log" = yes; then
4255     ENABLE_SAL_LOG=TRUE
4257 AC_SUBST(ENABLE_SAL_LOG)
4259 dnl Check for enable symbols option
4260 dnl ===================================================================
4261 AC_MSG_CHECKING([whether to generate debug information])
4262 if test -z "$enable_symbols"; then
4263     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4264         enable_symbols=yes
4265     else
4266         enable_symbols=no
4267     fi
4269 if test "$enable_symbols" = yes; then
4270     ENABLE_SYMBOLS_FOR=all
4271     AC_MSG_RESULT([yes])
4272 elif test "$enable_symbols" = no; then
4273     ENABLE_SYMBOLS_FOR=
4274     AC_MSG_RESULT([no])
4275 else
4276     # Selective debuginfo.
4277     ENABLE_SYMBOLS_FOR="$enable_symbols"
4278     AC_MSG_RESULT([for "$enable_symbols"])
4280 AC_SUBST(ENABLE_SYMBOLS_FOR)
4282 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4283     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4284     AC_MSG_CHECKING([whether enough memory is available for linking])
4285     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4286     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4287     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4288         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4289     else
4290         AC_MSG_RESULT([yes])
4291     fi
4294 AC_MSG_CHECKING([whether to compile with optimization flags])
4295 if test -z "$enable_optimized"; then
4296     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4297         enable_optimized=no
4298     else
4299         enable_optimized=yes
4300     fi
4302 if test "$enable_optimized" != no; then
4303     ENABLE_OPTIMIZED=TRUE
4304     AC_MSG_RESULT([yes])
4305 else
4306     ENABLE_OPTIMIZED=
4307     AC_MSG_RESULT([no])
4309 AC_SUBST(ENABLE_OPTIMIZED)
4312 # determine CPUNAME, OS, ...
4313 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4315 case "$host_os" in
4317 aix*)
4318     COM=GCC
4319     CPUNAME=POWERPC
4320     USING_X11=TRUE
4321     OS=AIX
4322     RTL_OS=AIX
4323     RTL_ARCH=PowerPC
4324     PLATFORMID=aix_powerpc
4325     P_SEP=:
4326     ;;
4328 cygwin*)
4329     COM=MSC
4330     USING_X11=
4331     OS=WNT
4332     RTL_OS=Windows
4333     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4334         P_SEP=";"
4335     else
4336         P_SEP=:
4337     fi
4338     case "$host_cpu" in
4339     i*86|x86_64)
4340         if test "$BITNESS_OVERRIDE" = 64; then
4341             CPUNAME=X86_64
4342             RTL_ARCH=X86_64
4343             PLATFORMID=windows_x86_64
4344             WINDOWS_X64=1
4345             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4346         else
4347             CPUNAME=INTEL
4348             RTL_ARCH=x86
4349             PLATFORMID=windows_x86
4350         fi
4351         ;;
4352     *)
4353         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4354         ;;
4355     esac
4356     SCPDEFS="$SCPDEFS -D_MSC_VER"
4357     ;;
4359 darwin*|macos*)
4360     COM=GCC
4361     USING_X11=
4362     OS=MACOSX
4363     RTL_OS=MacOSX
4364     P_SEP=:
4366     case "$host_cpu" in
4367     aarch64|arm64)
4368         if test "$enable_ios_simulator" = "yes"; then
4369             OS=iOS
4370         else
4371             CPUNAME=AARCH64
4372             RTL_ARCH=AARCH64
4373             PLATFORMID=macosx_arm64
4374         fi
4375         ;;
4376     x86_64)
4377         if test "$enable_ios_simulator" = "yes"; then
4378             OS=iOS
4379         fi
4380         CPUNAME=X86_64
4381         RTL_ARCH=X86_64
4382         PLATFORMID=macosx_x86_64
4383         ;;
4384     *)
4385         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4386         ;;
4387     esac
4388     ;;
4390 ios*)
4391     COM=GCC
4392     USING_X11=
4393     OS=iOS
4394     RTL_OS=iOS
4395     P_SEP=:
4397     case "$host_cpu" in
4398     aarch64|arm64)
4399         if test "$enable_ios_simulator" = "yes"; then
4400             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4401         fi
4402         ;;
4403     *)
4404         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4405         ;;
4406     esac
4407     CPUNAME=AARCH64
4408     RTL_ARCH=AARCH64
4409     PLATFORMID=ios_arm64
4410     ;;
4412 dragonfly*)
4413     COM=GCC
4414     USING_X11=TRUE
4415     OS=DRAGONFLY
4416     RTL_OS=DragonFly
4417     P_SEP=:
4419     case "$host_cpu" in
4420     i*86)
4421         CPUNAME=INTEL
4422         RTL_ARCH=x86
4423         PLATFORMID=dragonfly_x86
4424         ;;
4425     x86_64)
4426         CPUNAME=X86_64
4427         RTL_ARCH=X86_64
4428         PLATFORMID=dragonfly_x86_64
4429         ;;
4430     *)
4431         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4432         ;;
4433     esac
4434     ;;
4436 freebsd*)
4437     COM=GCC
4438     USING_X11=TRUE
4439     RTL_OS=FreeBSD
4440     OS=FREEBSD
4441     P_SEP=:
4443     case "$host_cpu" in
4444     i*86)
4445         CPUNAME=INTEL
4446         RTL_ARCH=x86
4447         PLATFORMID=freebsd_x86
4448         ;;
4449     x86_64|amd64)
4450         CPUNAME=X86_64
4451         RTL_ARCH=X86_64
4452         PLATFORMID=freebsd_x86_64
4453         ;;
4454     *)
4455         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4456         ;;
4457     esac
4458     ;;
4460 haiku*)
4461     COM=GCC
4462     USING_X11=
4463     GUIBASE=haiku
4464     RTL_OS=Haiku
4465     OS=HAIKU
4466     P_SEP=:
4468     case "$host_cpu" in
4469     i*86)
4470         CPUNAME=INTEL
4471         RTL_ARCH=x86
4472         PLATFORMID=haiku_x86
4473         ;;
4474     x86_64|amd64)
4475         CPUNAME=X86_64
4476         RTL_ARCH=X86_64
4477         PLATFORMID=haiku_x86_64
4478         ;;
4479     *)
4480         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4481         ;;
4482     esac
4483     ;;
4485 kfreebsd*)
4486     COM=GCC
4487     USING_X11=TRUE
4488     OS=LINUX
4489     RTL_OS=kFreeBSD
4490     P_SEP=:
4492     case "$host_cpu" in
4494     i*86)
4495         CPUNAME=INTEL
4496         RTL_ARCH=x86
4497         PLATFORMID=kfreebsd_x86
4498         ;;
4499     x86_64)
4500         CPUNAME=X86_64
4501         RTL_ARCH=X86_64
4502         PLATFORMID=kfreebsd_x86_64
4503         ;;
4504     *)
4505         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4506         ;;
4507     esac
4508     ;;
4510 linux-gnu*)
4511     COM=GCC
4512     USING_X11=TRUE
4513     OS=LINUX
4514     RTL_OS=Linux
4515     P_SEP=:
4517     case "$host_cpu" in
4519     aarch64)
4520         CPUNAME=AARCH64
4521         PLATFORMID=linux_aarch64
4522         RTL_ARCH=AARCH64
4523         EPM_FLAGS="-a arm64"
4524         ;;
4525     alpha)
4526         CPUNAME=AXP
4527         RTL_ARCH=ALPHA
4528         PLATFORMID=linux_alpha
4529         ;;
4530     arm*)
4531         CPUNAME=ARM
4532         EPM_FLAGS="-a arm"
4533         RTL_ARCH=ARM_EABI
4534         PLATFORMID=linux_arm_eabi
4535         case "$host_cpu" in
4536         arm*-linux)
4537             RTL_ARCH=ARM_OABI
4538             PLATFORMID=linux_arm_oabi
4539             ;;
4540         esac
4541         ;;
4542     hppa)
4543         CPUNAME=HPPA
4544         RTL_ARCH=HPPA
4545         EPM_FLAGS="-a hppa"
4546         PLATFORMID=linux_hppa
4547         ;;
4548     i*86)
4549         CPUNAME=INTEL
4550         RTL_ARCH=x86
4551         PLATFORMID=linux_x86
4552         ;;
4553     ia64)
4554         CPUNAME=IA64
4555         RTL_ARCH=IA64
4556         PLATFORMID=linux_ia64
4557         ;;
4558     mips)
4559         CPUNAME=GODSON
4560         RTL_ARCH=MIPS_EB
4561         EPM_FLAGS="-a mips"
4562         PLATFORMID=linux_mips_eb
4563         ;;
4564     mips64)
4565         CPUNAME=GODSON64
4566         RTL_ARCH=MIPS64_EB
4567         EPM_FLAGS="-a mips64"
4568         PLATFORMID=linux_mips64_eb
4569         ;;
4570     mips64el)
4571         CPUNAME=GODSON64
4572         RTL_ARCH=MIPS64_EL
4573         EPM_FLAGS="-a mips64el"
4574         PLATFORMID=linux_mips64_el
4575         ;;
4576     mipsel)
4577         CPUNAME=GODSON
4578         RTL_ARCH=MIPS_EL
4579         EPM_FLAGS="-a mipsel"
4580         PLATFORMID=linux_mips_el
4581         ;;
4582     m68k)
4583         CPUNAME=M68K
4584         RTL_ARCH=M68K
4585         PLATFORMID=linux_m68k
4586         ;;
4587     powerpc)
4588         CPUNAME=POWERPC
4589         RTL_ARCH=PowerPC
4590         PLATFORMID=linux_powerpc
4591         ;;
4592     powerpc64)
4593         CPUNAME=POWERPC64
4594         RTL_ARCH=PowerPC_64
4595         PLATFORMID=linux_powerpc64
4596         ;;
4597     powerpc64le)
4598         CPUNAME=POWERPC64
4599         RTL_ARCH=PowerPC_64_LE
4600         PLATFORMID=linux_powerpc64_le
4601         ;;
4602     sparc)
4603         CPUNAME=SPARC
4604         RTL_ARCH=SPARC
4605         PLATFORMID=linux_sparc
4606         ;;
4607     sparc64)
4608         CPUNAME=SPARC64
4609         RTL_ARCH=SPARC64
4610         PLATFORMID=linux_sparc64
4611         ;;
4612     s390)
4613         CPUNAME=S390
4614         RTL_ARCH=S390
4615         PLATFORMID=linux_s390
4616         ;;
4617     s390x)
4618         CPUNAME=S390X
4619         RTL_ARCH=S390x
4620         PLATFORMID=linux_s390x
4621         ;;
4622     x86_64)
4623         CPUNAME=X86_64
4624         RTL_ARCH=X86_64
4625         PLATFORMID=linux_x86_64
4626         ;;
4627     *)
4628         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4629         ;;
4630     esac
4631     ;;
4633 linux-android*)
4634     COM=GCC
4635     USING_X11=
4636     OS=ANDROID
4637     RTL_OS=Android
4638     P_SEP=:
4640     case "$host_cpu" in
4642     arm|armel)
4643         CPUNAME=ARM
4644         RTL_ARCH=ARM_EABI
4645         PLATFORMID=android_arm_eabi
4646         ;;
4647     aarch64)
4648         CPUNAME=AARCH64
4649         RTL_ARCH=AARCH64
4650         PLATFORMID=android_aarch64
4651         ;;
4652     i*86)
4653         CPUNAME=INTEL
4654         RTL_ARCH=x86
4655         PLATFORMID=android_x86
4656         ;;
4657     x86_64)
4658         CPUNAME=X86_64
4659         RTL_ARCH=X86_64
4660         PLATFORMID=android_x86_64
4661         ;;
4662     *)
4663         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4664         ;;
4665     esac
4666     ;;
4668 *netbsd*)
4669     COM=GCC
4670     USING_X11=TRUE
4671     OS=NETBSD
4672     RTL_OS=NetBSD
4673     P_SEP=:
4675     case "$host_cpu" in
4676     i*86)
4677         CPUNAME=INTEL
4678         RTL_ARCH=x86
4679         PLATFORMID=netbsd_x86
4680         ;;
4681     powerpc)
4682         CPUNAME=POWERPC
4683         RTL_ARCH=PowerPC
4684         PLATFORMID=netbsd_powerpc
4685         ;;
4686     sparc)
4687         CPUNAME=SPARC
4688         RTL_ARCH=SPARC
4689         PLATFORMID=netbsd_sparc
4690         ;;
4691     x86_64)
4692         CPUNAME=X86_64
4693         RTL_ARCH=X86_64
4694         PLATFORMID=netbsd_x86_64
4695         ;;
4696     *)
4697         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4698         ;;
4699     esac
4700     ;;
4702 openbsd*)
4703     COM=GCC
4704     USING_X11=TRUE
4705     OS=OPENBSD
4706     RTL_OS=OpenBSD
4707     P_SEP=:
4709     case "$host_cpu" in
4710     i*86)
4711         CPUNAME=INTEL
4712         RTL_ARCH=x86
4713         PLATFORMID=openbsd_x86
4714         ;;
4715     x86_64)
4716         CPUNAME=X86_64
4717         RTL_ARCH=X86_64
4718         PLATFORMID=openbsd_x86_64
4719         ;;
4720     *)
4721         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4722         ;;
4723     esac
4724     SOLARINC="$SOLARINC -I/usr/local/include"
4725     ;;
4727 solaris*)
4728     COM=GCC
4729     USING_X11=TRUE
4730     OS=SOLARIS
4731     RTL_OS=Solaris
4732     P_SEP=:
4734     case "$host_cpu" in
4735     i*86)
4736         CPUNAME=INTEL
4737         RTL_ARCH=x86
4738         PLATFORMID=solaris_x86
4739         ;;
4740     sparc)
4741         CPUNAME=SPARC
4742         RTL_ARCH=SPARC
4743         PLATFORMID=solaris_sparc
4744         ;;
4745     sparc64)
4746         CPUNAME=SPARC64
4747         RTL_ARCH=SPARC64
4748         PLATFORMID=solaris_sparc64
4749         ;;
4750     *)
4751         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4752         ;;
4753     esac
4754     SOLARINC="$SOLARINC -I/usr/local/include"
4755     ;;
4758     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4759     ;;
4760 esac
4762 if test "$with_x" = "no"; then
4763     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4766 DISABLE_GUI=""
4767 if test "$enable_gui" = "no"; then
4768     if test "$USING_X11" != TRUE; then
4769         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4770     fi
4771     USING_X11=
4772     DISABLE_GUI=TRUE
4773     AC_DEFINE(HAVE_FEATURE_UI,0)
4774     test_cairo=yes
4776 AC_SUBST(DISABLE_GUI)
4778 WORKDIR="${BUILDDIR}/workdir"
4779 INSTDIR="${BUILDDIR}/instdir"
4780 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4781 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4782 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4783 AC_SUBST(COM)
4784 AC_SUBST(CPUNAME)
4785 AC_SUBST(RTL_OS)
4786 AC_SUBST(RTL_ARCH)
4787 AC_SUBST(EPM_FLAGS)
4788 AC_SUBST(USING_X11)
4789 AC_SUBST([INSTDIR])
4790 AC_SUBST([INSTROOT])
4791 AC_SUBST([INSTROOTBASE])
4792 AC_SUBST(OS)
4793 AC_SUBST(P_SEP)
4794 AC_SUBST(WORKDIR)
4795 AC_SUBST(PLATFORMID)
4796 AC_SUBST(WINDOWS_X64)
4797 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4799 dnl ===================================================================
4800 dnl Test which package format to use
4801 dnl ===================================================================
4802 AC_MSG_CHECKING([which package format to use])
4803 if test -n "$with_package_format" -a "$with_package_format" != no; then
4804     for i in $with_package_format; do
4805         case "$i" in
4806         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4807             ;;
4808         *)
4809             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4810 aix - AIX software distribution
4811 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4812 deb - Debian software distribution
4813 pkg - Solaris software distribution
4814 rpm - RedHat software distribution
4816 LibreOffice additionally supports:
4817 archive - .tar.gz or .zip
4818 dmg - macOS .dmg
4819 installed - installation tree
4820 msi - Windows .msi
4821         ])
4822             ;;
4823         esac
4824     done
4825     # fakeroot is needed to ensure correct file ownerships/permissions
4826     # inside deb packages and tar archives created on Linux and Solaris.
4827     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4828         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4829         if test "$FAKEROOT" = "no"; then
4830             AC_MSG_ERROR(
4831                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4832         fi
4833     fi
4834     PKGFORMAT="$with_package_format"
4835     AC_MSG_RESULT([$PKGFORMAT])
4836 else
4837     PKGFORMAT=
4838     AC_MSG_RESULT([none])
4840 AC_SUBST(PKGFORMAT)
4842 dnl ===================================================================
4843 dnl Set up a different compiler to produce tools to run on the build
4844 dnl machine when doing cross-compilation
4845 dnl ===================================================================
4847 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4848 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4849 if test "$cross_compiling" = "yes"; then
4850     AC_MSG_CHECKING([for BUILD platform configuration])
4851     echo
4852     rm -rf CONF-FOR-BUILD config_build.mk
4853     mkdir CONF-FOR-BUILD
4854     # Here must be listed all files needed when running the configure script. In particular, also
4855     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4856     # keep them in the same order as there.
4857     (cd $SRC_ROOT && tar cf - \
4858         config.guess \
4859         bin/get_config_variables \
4860         solenv/bin/getcompver.awk \
4861         solenv/inc/langlist.mk \
4862         download.lst \
4863         config_host.mk.in \
4864         config_host_lang.mk.in \
4865         Makefile.in \
4866         bin/bffvalidator.sh.in \
4867         bin/odfvalidator.sh.in \
4868         bin/officeotron.sh.in \
4869         instsetoo_native/util/openoffice.lst.in \
4870         setup_native/source/packinfo/finals_instsetoo.txt.in \
4871         config_host/*.in \
4872         sysui/desktop/macosx/Info.plist.in) \
4873     | (cd CONF-FOR-BUILD && tar xf -)
4874     cp configure CONF-FOR-BUILD
4875     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4876     (
4877     unset COM USING_X11 OS CPUNAME
4878     unset CC CXX SYSBASE CFLAGS
4879     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4880     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4881     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4882     if test -n "$CC_FOR_BUILD"; then
4883         export CC="$CC_FOR_BUILD"
4884         CC_BASE=`first_arg_basename "$CC"`
4885     fi
4886     if test -n "$CXX_FOR_BUILD"; then
4887         export CXX="$CXX_FOR_BUILD"
4888         CXX_BASE=`first_arg_basename "$CXX"`
4889     fi
4890     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4891     cd CONF-FOR-BUILD
4892     sub_conf_opts=""
4893     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4894     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4895     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4896     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4897     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4898     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4899     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4900     # Don't bother having configure look for stuff not needed for the build platform anyway
4901     ./configure \
4902         --disable-cups \
4903         --disable-gstreamer-1-0 \
4904         --disable-gtk3 \
4905         --disable-pdfimport \
4906         --disable-postgresql-sdbc \
4907         --enable-icecream="$enable_icecream" \
4908         --with-parallelism="$with_parallelism" \
4909         --without-doxygen \
4910         --without-java \
4911         $sub_conf_opts \
4912         --srcdir=$srcdir \
4913         2>&1 | sed -e 's/^/    /'
4914     test -f ./config_host.mk 2>/dev/null || exit
4915     cp config_host.mk ../config_build.mk
4916     cp config_host_lang.mk ../config_build_lang.mk
4917     mv config.log ../config.Build.log
4918     mkdir -p ../config_build
4919     mv config_host/*.h ../config_build
4920     . ./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
4922     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
4923         VV='$'$V
4924         VV=`eval "echo $VV"`
4925         if test -n "$VV"; then
4926             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4927             echo "$line" >>build-config
4928         fi
4929     done
4931     for V in INSTDIR INSTROOT WORKDIR; do
4932         VV='$'$V
4933         VV=`eval "echo $VV"`
4934         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4935         if test -n "$VV"; then
4936             line="${V}_FOR_BUILD='$VV'"
4937             echo "$line" >>build-config
4938         fi
4939     done
4941     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4942     echo "$line" >>build-config
4944     )
4945     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4946     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])
4947     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4948              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4950     eval `cat CONF-FOR-BUILD/build-config`
4952     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4954     rm -rf CONF-FOR-BUILD
4955 else
4956     OS_FOR_BUILD="$OS"
4957     CC_FOR_BUILD="$CC"
4958     CXX_FOR_BUILD="$CXX"
4959     INSTDIR_FOR_BUILD="$INSTDIR"
4960     INSTROOT_FOR_BUILD="$INSTROOT"
4961     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4962     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4963     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4964     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4965     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4966     WORKDIR_FOR_BUILD="$WORKDIR"
4968 AC_SUBST(OS_FOR_BUILD)
4969 AC_SUBST(INSTDIR_FOR_BUILD)
4970 AC_SUBST(INSTROOT_FOR_BUILD)
4971 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4972 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4973 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4974 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4975 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4976 AC_SUBST(WORKDIR_FOR_BUILD)
4978 dnl ===================================================================
4979 dnl Check for syslog header
4980 dnl ===================================================================
4981 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4983 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4984 dnl ===================================================================
4985 AC_MSG_CHECKING([whether to turn warnings to errors])
4986 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4987     ENABLE_WERROR="TRUE"
4988     AC_MSG_RESULT([yes])
4989 else
4990     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4991         ENABLE_WERROR="TRUE"
4992         AC_MSG_RESULT([yes])
4993     else
4994         AC_MSG_RESULT([no])
4995     fi
4997 AC_SUBST(ENABLE_WERROR)
4999 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5000 dnl ===================================================================
5001 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5002 if test -z "$enable_assert_always_abort"; then
5003    if test "$ENABLE_DEBUG" = TRUE; then
5004        enable_assert_always_abort=yes
5005    else
5006        enable_assert_always_abort=no
5007    fi
5009 if test "$enable_assert_always_abort" = "yes"; then
5010     ASSERT_ALWAYS_ABORT="TRUE"
5011     AC_MSG_RESULT([yes])
5012 else
5013     ASSERT_ALWAYS_ABORT="FALSE"
5014     AC_MSG_RESULT([no])
5016 AC_SUBST(ASSERT_ALWAYS_ABORT)
5018 # Determine whether to use ooenv for the instdir installation
5019 # ===================================================================
5020 if test $_os != "WINNT" -a $_os != "Darwin"; then
5021     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5022     if test "$enable_ooenv" = "no"; then
5023         AC_MSG_RESULT([no])
5024     else
5025         ENABLE_OOENV="TRUE"
5026         AC_MSG_RESULT([yes])
5027     fi
5029 AC_SUBST(ENABLE_OOENV)
5031 if test "$USING_X11" != TRUE; then
5032     # be sure to do not mess with unneeded stuff
5033     test_randr=no
5034     test_xrender=no
5035     test_cups=no
5036     test_dbus=no
5037     build_gstreamer_1_0=no
5038     test_kf5=no
5039     test_qt5=no
5040     test_gtk3_kde5=no
5041     enable_cairo_canvas=no
5044 if test "$OS" = "HAIKU"; then
5045     enable_cairo_canvas=yes
5046     test_kf5=yes
5049 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5050     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!])
5051     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!"
5052     enable_kf5=yes
5055 if test "$test_kf5" = "yes"; then
5056     test_qt5=yes
5059 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5060     if test "$enable_qt5" = "no"; then
5061         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5062     else
5063         enable_qt5=yes
5064     fi
5067 dnl ===================================================================
5068 dnl check for cups support
5069 dnl ===================================================================
5070 ENABLE_CUPS=""
5072 if test "$enable_cups" = "no"; then
5073     test_cups=no
5076 AC_MSG_CHECKING([whether to enable CUPS support])
5077 if test "$test_cups" = "yes"; then
5078     ENABLE_CUPS="TRUE"
5079     AC_MSG_RESULT([yes])
5081     AC_MSG_CHECKING([whether cups support is present])
5082     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5083     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5084     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5085         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5086     fi
5088 else
5089     AC_MSG_RESULT([no])
5092 AC_SUBST(ENABLE_CUPS)
5094 # fontconfig checks
5095 if test "$test_fontconfig" = "yes"; then
5096     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5097     SYSTEM_FONTCONFIG=TRUE
5098     FilterLibs "${FONTCONFIG_LIBS}"
5099     FONTCONFIG_LIBS="${filteredlibs}"
5101 AC_SUBST(FONTCONFIG_CFLAGS)
5102 AC_SUBST(FONTCONFIG_LIBS)
5103 AC_SUBST([SYSTEM_FONTCONFIG])
5105 dnl whether to find & fetch external tarballs?
5106 dnl ===================================================================
5107 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5108    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5109        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5110    else
5111        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5112    fi
5114 if test -z "$TARFILE_LOCATION"; then
5115     if test -d "$SRC_ROOT/src" ; then
5116         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5117         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5118     fi
5119     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5120 else
5121     AbsolutePath "$TARFILE_LOCATION"
5122     PathFormat "${absolute_path}"
5123     TARFILE_LOCATION="${formatted_path}"
5125 AC_SUBST(TARFILE_LOCATION)
5127 AC_MSG_CHECKING([whether we want to fetch tarballs])
5128 if test "$enable_fetch_external" != "no"; then
5129     if test "$with_all_tarballs" = "yes"; then
5130         AC_MSG_RESULT([yes, all of them])
5131         DO_FETCH_TARBALLS="ALL"
5132     else
5133         AC_MSG_RESULT([yes, if we use them])
5134         DO_FETCH_TARBALLS="TRUE"
5135     fi
5136 else
5137     AC_MSG_RESULT([no])
5138     DO_FETCH_TARBALLS=
5140 AC_SUBST(DO_FETCH_TARBALLS)
5142 AC_MSG_CHECKING([whether to build help])
5143 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5144     BUILD_TYPE="$BUILD_TYPE HELP"
5145     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5146     case "$with_help" in
5147     "html")
5148         ENABLE_HTMLHELP=TRUE
5149         SCPDEFS="$SCPDEFS -DWITH_HELP"
5150         AC_MSG_RESULT([HTML])
5151         ;;
5152     "online")
5153         ENABLE_HTMLHELP=TRUE
5154         HELP_ONLINE=TRUE
5155         AC_MSG_RESULT([HTML])
5156         ;;
5157     yes)
5158         SCPDEFS="$SCPDEFS -DWITH_HELP"
5159         AC_MSG_RESULT([yes])
5160         ;;
5161     *)
5162         AC_MSG_ERROR([Unknown --with-help=$with_help])
5163         ;;
5164     esac
5165 else
5166     AC_MSG_RESULT([no])
5168 AC_SUBST([ENABLE_HTMLHELP])
5169 AC_SUBST([HELP_ONLINE])
5171 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5172 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5173     BUILD_TYPE="$BUILD_TYPE HELP"
5174     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5175     case "$with_omindex" in
5176     "server")
5177         ENABLE_HTMLHELP=TRUE
5178         HELP_ONLINE=TRUE
5179         HELP_OMINDEX_PAGE=TRUE
5180         AC_MSG_RESULT([SERVER])
5181         ;;
5182     "noxap")
5183         ENABLE_HTMLHELP=TRUE
5184         HELP_ONLINE=TRUE
5185         HELP_OMINDEX_PAGE=FALSE
5186         AC_MSG_RESULT([NOXAP])
5187         ;;
5188     *)
5189         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5190         ;;
5191     esac
5192 else
5193     HELP_OMINDEX_PAGE=FALSE
5194     AC_MSG_RESULT([no])
5196 AC_SUBST([ENABLE_HTMLHELP])
5197 AC_SUBST([HELP_OMINDEX_PAGE])
5198 AC_SUBST([HELP_ONLINE])
5201 dnl Test whether to include MySpell dictionaries
5202 dnl ===================================================================
5203 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5204 if test "$with_myspell_dicts" = "yes"; then
5205     AC_MSG_RESULT([yes])
5206     WITH_MYSPELL_DICTS=TRUE
5207     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5208     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5209 else
5210     AC_MSG_RESULT([no])
5211     WITH_MYSPELL_DICTS=
5213 AC_SUBST(WITH_MYSPELL_DICTS)
5215 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5216 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5217     if test "$with_system_dicts" = yes; then
5218         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5219     fi
5220     with_system_dicts=no
5223 AC_MSG_CHECKING([whether to use dicts from external paths])
5224 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5225     AC_MSG_RESULT([yes])
5226     SYSTEM_DICTS=TRUE
5227     AC_MSG_CHECKING([for spelling dictionary directory])
5228     if test -n "$with_external_dict_dir"; then
5229         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5230     else
5231         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5232         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5233             DICT_SYSTEM_DIR=file:///usr/share/myspell
5234         fi
5235     fi
5236     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5237     AC_MSG_CHECKING([for hyphenation patterns directory])
5238     if test -n "$with_external_hyph_dir"; then
5239         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5240     else
5241         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5242     fi
5243     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5244     AC_MSG_CHECKING([for thesaurus directory])
5245     if test -n "$with_external_thes_dir"; then
5246         THES_SYSTEM_DIR=file://$with_external_thes_dir
5247     else
5248         THES_SYSTEM_DIR=file:///usr/share/mythes
5249     fi
5250     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5251 else
5252     AC_MSG_RESULT([no])
5253     SYSTEM_DICTS=
5255 AC_SUBST(SYSTEM_DICTS)
5256 AC_SUBST(DICT_SYSTEM_DIR)
5257 AC_SUBST(HYPH_SYSTEM_DIR)
5258 AC_SUBST(THES_SYSTEM_DIR)
5260 dnl ===================================================================
5261 dnl Precompiled headers.
5262 ENABLE_PCH=""
5263 AC_MSG_CHECKING([whether to enable pch feature])
5264 if test -z "$enable_pch"; then
5265     if test "$_os" = "WINNT"; then
5266         # Enabled by default on Windows.
5267         enable_pch=yes
5268     else
5269         enable_pch=no
5270     fi
5272 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5273     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5275 if test "$enable_pch" = "system"; then
5276     ENABLE_PCH="1"
5277     AC_MSG_RESULT([yes (system headers)])
5278 elif test "$enable_pch" = "base"; then
5279     ENABLE_PCH="2"
5280     AC_MSG_RESULT([yes (system and base headers)])
5281 elif test "$enable_pch" = "normal"; then
5282     ENABLE_PCH="3"
5283     AC_MSG_RESULT([yes (normal)])
5284 elif test "$enable_pch" = "full"; then
5285     ENABLE_PCH="4"
5286     AC_MSG_RESULT([yes (full)])
5287 elif test "$enable_pch" = "yes"; then
5288     # Pick a suitable default.
5289     if test "$GCC" = "yes"; then
5290         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5291         # while making the PCHs larger and rebuilds more likely.
5292         ENABLE_PCH="2"
5293         AC_MSG_RESULT([yes (system and base headers)])
5294     else
5295         # With MSVC the highest level makes a significant difference,
5296         # and it was the default when there used to be no PCH levels.
5297         ENABLE_PCH="4"
5298         AC_MSG_RESULT([yes (full)])
5299     fi
5300 elif test "$enable_pch" = "no"; then
5301     AC_MSG_RESULT([no])
5302 else
5303     AC_MSG_ERROR([Unknown value for --enable-pch])
5305 AC_SUBST(ENABLE_PCH)
5306 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5307 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5308     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5309     if test "$CCACHE_BIN" != "not found"; then
5310         AC_MSG_CHECKING([ccache version])
5311         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5312         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5313         AC_MSG_RESULT([$CCACHE_VERSION])
5314         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5315         if test "$CCACHE_NUMVER" -gt "030701"; then
5316             AC_MSG_RESULT([yes])
5317         else
5318             AC_MSG_RESULT([no (not newer than 3.7.1)])
5319             CCACHE_DEPEND_MODE=
5320         fi
5321     fi
5324 TAB=`printf '\t'`
5326 AC_MSG_CHECKING([the GNU Make version])
5327 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5328 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5329 if test "$_make_longver" -ge "038200"; then
5330     AC_MSG_RESULT([$GNUMAKE $_make_version])
5332 elif test "$_make_longver" -ge "038100"; then
5333     if test "$build_os" = "cygwin"; then
5334         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5335     fi
5336     AC_MSG_RESULT([$GNUMAKE $_make_version])
5338     dnl ===================================================================
5339     dnl Search all the common names for sha1sum
5340     dnl ===================================================================
5341     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5342     if test -z "$SHA1SUM"; then
5343         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5344     elif test "$SHA1SUM" = "openssl"; then
5345         SHA1SUM="openssl sha1"
5346     fi
5347     AC_MSG_CHECKING([for GNU Make bug 20033])
5348     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5349     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5350 A := \$(wildcard *.a)
5352 .PHONY: all
5353 all: \$(A:.a=.b)
5354 <TAB>@echo survived bug20033.
5356 .PHONY: setup
5357 setup:
5358 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5360 define d1
5361 @echo lala \$(1)
5362 @sleep 1
5363 endef
5365 define d2
5366 @echo tyty \$(1)
5367 @sleep 1
5368 endef
5370 %.b : %.a
5371 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5372 <TAB>\$(call d1,\$(CHECKSUM)),\
5373 <TAB>\$(call d2,\$(CHECKSUM)))
5375     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5376         no_parallelism_make="YES"
5377         AC_MSG_RESULT([yes, disable parallelism])
5378     else
5379         AC_MSG_RESULT([no, keep parallelism enabled])
5380     fi
5381     rm -rf $TESTGMAKEBUG20033
5382 else
5383     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5386 # find if gnumake support file function
5387 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5388 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5389 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5390     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5392 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5393 \$(file >test.txt,Success )
5395 .PHONY: all
5396 all:
5397 <TAB>@cat test.txt
5400 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5401 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5402     HAVE_GNUMAKE_FILE_FUNC=TRUE
5403     AC_MSG_RESULT([yes])
5404 else
5405     AC_MSG_RESULT([no])
5407 rm -rf $TESTGMAKEFILEFUNC
5408 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5409 AC_SUBST(GNUMAKE_WIN_NATIVE)
5411 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5412 STALE_MAKE=
5413 if test "$_make_ver_check" = ""; then
5414    STALE_MAKE=TRUE
5417 HAVE_LD_HASH_STYLE=FALSE
5418 WITH_LINKER_HASH_STYLE=
5419 AC_MSG_CHECKING([for --hash-style gcc linker support])
5420 if test "$GCC" = "yes"; then
5421     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5422         hash_styles="gnu sysv"
5423     elif test "$with_linker_hash_style" = "no"; then
5424         hash_styles=
5425     else
5426         hash_styles="$with_linker_hash_style"
5427     fi
5429     for hash_style in $hash_styles; do
5430         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5431         hash_style_ldflags_save=$LDFLAGS
5432         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5434         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5435             [
5436 #include <stdio.h>
5437             ],[
5438 printf ("");
5439             ])],
5440             [
5441                   HAVE_LD_HASH_STYLE=TRUE
5442                   WITH_LINKER_HASH_STYLE=$hash_style
5443             ],
5444             [HAVE_LD_HASH_STYLE=FALSE],
5445             [HAVE_LD_HASH_STYLE=FALSE])
5446         LDFLAGS=$hash_style_ldflags_save
5447     done
5449     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5450         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5451     else
5452         AC_MSG_RESULT( no )
5453     fi
5454     LDFLAGS=$hash_style_ldflags_save
5455 else
5456     AC_MSG_RESULT( no )
5458 AC_SUBST(HAVE_LD_HASH_STYLE)
5459 AC_SUBST(WITH_LINKER_HASH_STYLE)
5461 dnl ===================================================================
5462 dnl Check whether there's a Perl version available.
5463 dnl ===================================================================
5464 if test -z "$with_perl_home"; then
5465     AC_PATH_PROG(PERL, perl)
5466 else
5467     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5468     _perl_path="$with_perl_home/bin/perl"
5469     if test -x "$_perl_path"; then
5470         PERL=$_perl_path
5471     else
5472         AC_MSG_ERROR([$_perl_path not found])
5473     fi
5476 dnl ===================================================================
5477 dnl Testing for Perl version 5 or greater.
5478 dnl $] is the Perl version variable, it is returned as an integer
5479 dnl ===================================================================
5480 if test "$PERL"; then
5481     AC_MSG_CHECKING([the Perl version])
5482     ${PERL} -e "exit($]);"
5483     _perl_version=$?
5484     if test "$_perl_version" -lt 5; then
5485         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5486     fi
5487     AC_MSG_RESULT([Perl $_perl_version])
5488 else
5489     AC_MSG_ERROR([Perl not found, install Perl 5])
5492 dnl ===================================================================
5493 dnl Testing for required Perl modules
5494 dnl ===================================================================
5496 AC_MSG_CHECKING([for required Perl modules])
5497 perl_use_string="use Cwd ; use Digest::MD5"
5498 if test "$_os" = "WINNT"; then
5499     if test -n "$PKGFORMAT"; then
5500         for i in $PKGFORMAT; do
5501             case "$i" in
5502             msi)
5503                 # for getting fonts versions to use in MSI
5504                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5505                 ;;
5506             esac
5507         done
5508     fi
5510 if test "$with_system_hsqldb" = "yes"; then
5511     perl_use_string="$perl_use_string ; use Archive::Zip"
5513 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5514     AC_MSG_RESULT([all modules found])
5515 else
5516     AC_MSG_RESULT([failed to find some modules])
5517     # Find out which modules are missing.
5518     for i in $perl_use_string; do
5519         if test "$i" != "use" -a "$i" != ";"; then
5520             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5521                 missing_perl_modules="$missing_perl_modules $i"
5522             fi
5523         fi
5524     done
5525     AC_MSG_ERROR([
5526     The missing Perl modules are: $missing_perl_modules
5527     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5530 dnl ===================================================================
5531 dnl Check for pkg-config
5532 dnl ===================================================================
5533 if test "$_os" != "WINNT"; then
5534     PKG_PROG_PKG_CONFIG
5537 if test "$_os" != "WINNT"; then
5539     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5540     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5541     # explicitly. Or put /path/to/compiler in PATH yourself.
5543     # Use wrappers for LTO
5544     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5545         AC_CHECK_TOOL(AR,gcc-ar)
5546         AC_CHECK_TOOL(NM,gcc-nm)
5547         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5548     else
5549         AC_CHECK_TOOL(AR,ar)
5550         AC_CHECK_TOOL(NM,nm)
5551         AC_CHECK_TOOL(RANLIB,ranlib)
5552     fi
5553     AC_CHECK_TOOL(OBJDUMP,objdump)
5554     AC_CHECK_TOOL(READELF,readelf)
5555     AC_CHECK_TOOL(STRIP,strip)
5556     if test "$_os" = "WINNT"; then
5557         AC_CHECK_TOOL(DLLTOOL,dlltool)
5558         AC_CHECK_TOOL(WINDRES,windres)
5559     fi
5561 AC_SUBST(AR)
5562 AC_SUBST(DLLTOOL)
5563 AC_SUBST(NM)
5564 AC_SUBST(OBJDUMP)
5565 AC_SUBST(PKG_CONFIG)
5566 AC_SUBST(RANLIB)
5567 AC_SUBST(READELF)
5568 AC_SUBST(STRIP)
5569 AC_SUBST(WINDRES)
5571 dnl ===================================================================
5572 dnl pkg-config checks on macOS
5573 dnl ===================================================================
5575 if test $_os = Darwin; then
5576     AC_MSG_CHECKING([for bogus pkg-config])
5577     if test -n "$PKG_CONFIG"; then
5578         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5579             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5580         else
5581             if test "$enable_bogus_pkg_config" = "yes"; then
5582                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5583             else
5584                 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.])
5585             fi
5586         fi
5587     else
5588         AC_MSG_RESULT([no, good])
5589     fi
5592 find_csc()
5594     # Return value: $csctest
5596     unset csctest
5598     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5599     if test -n "$regvalue"; then
5600         csctest=$regvalue
5601         return
5602     fi
5605 find_al()
5607     # Return value: $altest
5609     unset altest
5611     # We need this check to detect 4.6.1 or above.
5612     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5613         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5614         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5615             altest=$regvalue
5616             return
5617         fi
5618     done
5620     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5621         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5622         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5623             altest=$regvalue
5624             return
5625         fi
5626     done
5631 find_dotnetsdk46()
5633     unset frametest
5635     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5636         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5637         if test -n "$regvalue"; then
5638             frametest=$regvalue
5639             return
5640         fi
5641     done
5644 find_winsdk_version()
5646     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5647     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5649     unset winsdktest winsdkbinsubdir winsdklibsubdir
5651     case "$1" in
5652     8.0|8.0A)
5653         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5654         if test -n "$regvalue"; then
5655             winsdktest=$regvalue
5656             winsdklibsubdir=win8
5657             return
5658         fi
5659         ;;
5660     8.1|8.1A)
5661         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5662         if test -n "$regvalue"; then
5663             winsdktest=$regvalue
5664             winsdklibsubdir=winv6.3
5665             return
5666         fi
5667         ;;
5668     10.0)
5669         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5670         if test -n "$regvalue"; then
5671             winsdktest=$regvalue
5672             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5673             if test -n "$regvalue"; then
5674                 winsdkbinsubdir="$regvalue".0
5675                 winsdklibsubdir=$winsdkbinsubdir
5676                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5677                 # test exist the SDK path
5678                 if test -d "$tmppath"; then
5679                    # when path is convertible to a short path then path is okay
5680                    cygpath -d "$tmppath" >/dev/null 2>&1
5681                    if test $? -ne 0; then
5682                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5683                    fi
5684                 else
5685                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5686                 fi
5687             fi
5688             return
5689         fi
5690         ;;
5691     esac
5694 find_winsdk()
5696     # Return value: From find_winsdk_version
5698     unset winsdktest
5700     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5701         find_winsdk_version $ver
5702         if test -n "$winsdktest"; then
5703             return
5704         fi
5705     done
5708 find_msms()
5710     AC_MSG_CHECKING([for MSVC merge modules directory])
5711     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5712     case "$VCVER" in
5713         150|160)
5714         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5715         ;;
5716     esac
5717     for f in $my_msm_files; do
5718         echo "$as_me:$LINENO: searching for $f" >&5
5719     done
5721     msmdir=
5722     for ver in 14.0 15.0; do
5723         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5724         if test -n "$regvalue"; then
5725             for f in ${my_msm_files}; do
5726                 if test -e "$regvalue/${f}"; then
5727                     msmdir=$regvalue
5728                     break
5729                 fi
5730             done
5731         fi
5732     done
5733     dnl Is the following fallback really necessary, or was it added in response
5734     dnl to never having started Visual Studio on a given machine, so the
5735     dnl registry keys checked above had presumably not yet been created?
5736     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5737     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5738     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5739     dnl expanding to "C:\Program Files\Common Files"), which would need
5740     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5741     dnl obtain its value from cygwin:
5742     if test -z "$msmdir"; then
5743         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5744         for f in ${my_msm_files}; do
5745             if test -e "$my_msm_dir/${f}"; then
5746                 msmdir=$my_msm_dir
5747             fi
5748         done
5749     fi
5751     dnl Starting from MSVC 15.0, merge modules are located in different directory
5752     case "$VCVER" in
5753     150|160)
5754         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5755             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5756             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5757             for f in ${my_msm_files}; do
5758                 if test -e "$my_msm_dir/${f}"; then
5759                     msmdir=$my_msm_dir
5760                     break
5761                 fi
5762             done
5763         done
5764         ;;
5765     esac
5767     if test -n "$msmdir"; then
5768         msmdir=`cygpath -m "$msmdir"`
5769         AC_MSG_RESULT([$msmdir])
5770     else
5771         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5772             AC_MSG_FAILURE([not found])
5773         else
5774             AC_MSG_WARN([not found (check config.log)])
5775             add_warning "MSM none of ${my_msm_files} found"
5776         fi
5777     fi
5780 find_msvc_x64_dlls()
5782     AC_MSG_CHECKING([for MSVC x64 DLL path])
5783     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5784     case "$VCVER" in
5785     150|160)
5786         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5787             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5788             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5789                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5790                 break
5791             fi
5792             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5793             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5794                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5795                 break
5796             fi
5797             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5798             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5799                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5800                 break
5801             fi
5802         done
5803         ;;
5804     esac
5805     AC_MSG_RESULT([$msvcdllpath])
5806     AC_MSG_CHECKING([for MSVC x64 DLLs])
5807     msvcdlls="msvcp140.dll vcruntime140.dll"
5808     for dll in $msvcdlls; do
5809         if ! test -f "$msvcdllpath/$dll"; then
5810             AC_MSG_FAILURE([missing $dll])
5811         fi
5812     done
5813     AC_MSG_RESULT([found all ($msvcdlls)])
5816 dnl =========================================
5817 dnl Check for the Windows  SDK.
5818 dnl =========================================
5819 if test "$_os" = "WINNT"; then
5820     AC_MSG_CHECKING([for Windows SDK])
5821     if test "$build_os" = "cygwin"; then
5822         find_winsdk
5823         WINDOWS_SDK_HOME=$winsdktest
5825         # normalize if found
5826         if test -n "$WINDOWS_SDK_HOME"; then
5827             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5828             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5829         fi
5831         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5832     fi
5834     if test -n "$WINDOWS_SDK_HOME"; then
5835         # Remove a possible trailing backslash
5836         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5838         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5839              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5840              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5841             have_windows_sdk_headers=yes
5842         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5843              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5844              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5845             have_windows_sdk_headers=yes
5846         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5847              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5848              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5849             have_windows_sdk_headers=yes
5850         else
5851             have_windows_sdk_headers=no
5852         fi
5854         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5855             have_windows_sdk_libs=yes
5856         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5857             have_windows_sdk_libs=yes
5858         else
5859             have_windows_sdk_libs=no
5860         fi
5862         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5863             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5864 the  Windows SDK are installed.])
5865         fi
5866     fi
5868     if test -z "$WINDOWS_SDK_HOME"; then
5869         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5870     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5871         WINDOWS_SDK_VERSION=80
5872         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5873     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5874         WINDOWS_SDK_VERSION=81
5875         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5876     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5877         WINDOWS_SDK_VERSION=10
5878         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5879     else
5880         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5881     fi
5882     PathFormat "$WINDOWS_SDK_HOME"
5883     WINDOWS_SDK_HOME="$formatted_path"
5884     if test "$build_os" = "cygwin"; then
5885         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5886         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5887             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5888         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5889             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5890         fi
5891     fi
5893     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5894     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5895     dnl but not in v8.0), so allow this to be overridden with a
5896     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5897     dnl and configuration error if no WiLangId.vbs is found would arguably be
5898     dnl better, but I do not know under which conditions exactly it is needed by
5899     dnl msiglobal.pm:
5900     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5901         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5902         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5903             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5904         fi
5905         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5906             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5907         fi
5908         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5909             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5910         fi
5911     fi
5912     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5913         if test -n "$with_package_format" -a "$with_package_format" != no; then
5914             for i in "$with_package_format"; do
5915                 if test "$i" = "msi"; then
5916                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5917                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5918                     fi
5919                 fi
5920             done
5921         fi
5922     fi
5924 AC_SUBST(WINDOWS_SDK_HOME)
5925 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5926 AC_SUBST(WINDOWS_SDK_VERSION)
5927 AC_SUBST(WINDOWS_SDK_WILANGID)
5929 if test "$build_os" = "cygwin"; then
5930     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5931     dnl dir, it also determines that dir's path w/o an arch segment if any,
5932     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5933     AC_MSG_CHECKING([for midl.exe])
5935     find_winsdk
5936     if test -n "$winsdkbinsubdir" \
5937         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5938     then
5939         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5940         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5941     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5942         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5943         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5944     elif test -f "$winsdktest/Bin/midl.exe"; then
5945         MIDL_PATH=$winsdktest/Bin
5946         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5947     fi
5948     if test ! -f "$MIDL_PATH/midl.exe"; then
5949         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5950     else
5951         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5952     fi
5954     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5955     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5957     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5958          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5959          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5960          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5961     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5962          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5963          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5964          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5965     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5966          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5967          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5968          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5969     else
5970         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5971     fi
5973     dnl Check csc.exe
5974     AC_MSG_CHECKING([for csc.exe])
5975     find_csc
5976     if test -f "$csctest/csc.exe"; then
5977         CSC_PATH="$csctest"
5978     fi
5979     if test ! -f "$CSC_PATH/csc.exe"; then
5980         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5981     else
5982         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5983     fi
5985     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5987     dnl Check al.exe
5988     AC_MSG_CHECKING([for al.exe])
5989     find_winsdk
5990     if test -n "$winsdkbinsubdir" \
5991         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5992     then
5993         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5994     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5995         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5996     elif test -f "$winsdktest/Bin/al.exe"; then
5997         AL_PATH="$winsdktest/Bin"
5998     fi
6000     if test -z "$AL_PATH"; then
6001         find_al
6002         if test -f "$altest/bin/al.exe"; then
6003             AL_PATH="$altest/bin"
6004         elif test -f "$altest/al.exe"; then
6005             AL_PATH="$altest"
6006         fi
6007     fi
6008     if test ! -f "$AL_PATH/al.exe"; then
6009         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6010     else
6011         AC_MSG_RESULT([$AL_PATH/al.exe])
6012     fi
6014     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6016     dnl Check mscoree.lib / .NET Framework dir
6017     AC_MSG_CHECKING(.NET Framework)
6018     find_dotnetsdk46
6019     PathFormat "$frametest"
6020     frametest="$formatted_path"
6021     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6022         DOTNET_FRAMEWORK_HOME="$frametest"
6023     else
6024         find_winsdk
6025         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6026             DOTNET_FRAMEWORK_HOME="$winsdktest"
6027         fi
6028     fi
6029     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
6030         AC_MSG_ERROR([mscoree.lib not found])
6031     fi
6032     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6034     PathFormat "$MIDL_PATH"
6035     MIDL_PATH="$formatted_path"
6037     PathFormat "$AL_PATH"
6038     AL_PATH="$formatted_path"
6040     PathFormat "$DOTNET_FRAMEWORK_HOME"
6041     DOTNET_FRAMEWORK_HOME="$formatted_path"
6043     PathFormat "$CSC_PATH"
6044     CSC_PATH="$formatted_path"
6047 dnl ===================================================================
6048 dnl Check if stdc headers are available excluding MSVC.
6049 dnl ===================================================================
6050 if test "$_os" != "WINNT"; then
6051     AC_HEADER_STDC
6054 dnl ===================================================================
6055 dnl Testing for C++ compiler and version...
6056 dnl ===================================================================
6058 if test "$_os" != "WINNT"; then
6059     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6060     save_CXXFLAGS=$CXXFLAGS
6061     AC_PROG_CXX
6062     CXXFLAGS=$save_CXXFLAGS
6063     if test -z "$CXX_BASE"; then
6064         CXX_BASE=`first_arg_basename "$CXX"`
6065     fi
6068 dnl check for GNU C++ compiler version
6069 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6070     AC_MSG_CHECKING([the GNU C++ compiler version])
6072     _gpp_version=`$CXX -dumpversion`
6073     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6075     if test "$_gpp_majmin" -lt "700"; then
6076         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6077     else
6078         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6079     fi
6081     dnl see https://code.google.com/p/android/issues/detail?id=41770
6082         glibcxx_threads=no
6083         AC_LANG_PUSH([C++])
6084         AC_REQUIRE_CPP
6085         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6086         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6087             #include <bits/c++config.h>]],[[
6088             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6089             && !defined(_GLIBCXX__PTHREADS) \
6090             && !defined(_GLIBCXX_HAS_GTHREADS)
6091             choke me
6092             #endif
6093         ]])],[AC_MSG_RESULT([yes])
6094         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6095         AC_LANG_POP([C++])
6096         if test $glibcxx_threads = yes; then
6097             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6098         fi
6100 AC_SUBST(BOOST_CXXFLAGS)
6103 # prefx CXX with ccache if needed
6105 if test "$CCACHE" != ""; then
6106     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6107     AC_LANG_PUSH([C++])
6108     save_CXXFLAGS=$CXXFLAGS
6109     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6110     dnl an empty program will do, we're checking the compiler flags
6111     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6112                       [use_ccache=yes], [use_ccache=no])
6113     if test $use_ccache = yes; then
6114         AC_MSG_RESULT([yes])
6115     else
6116         CXX="$CCACHE $CXX"
6117         CXX_BASE="ccache $CXX_BASE"
6118         AC_MSG_RESULT([no])
6119     fi
6120     CXXFLAGS=$save_CXXFLAGS
6121     AC_LANG_POP([C++])
6124 dnl ===================================================================
6125 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6126 dnl ===================================================================
6128 if test "$_os" != "WINNT"; then
6129     AC_PROG_CXXCPP
6131     dnl Check whether there's a C pre-processor.
6132     AC_PROG_CPP
6136 dnl ===================================================================
6137 dnl Find integral type sizes and alignments
6138 dnl ===================================================================
6140 if test "$_os" != "WINNT"; then
6142 if test "$_os" = "iOS"; then
6143     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6144     ac_cv_sizeof_long=8
6145     ac_cv_sizeof_short=2
6146     ac_cv_sizeof_int=4
6147     ac_cv_sizeof_long_long=8
6148     ac_cv_sizeof_double=8
6149     ac_cv_sizeof_voidp=8
6150 else
6151     AC_CHECK_SIZEOF(long)
6152     AC_CHECK_SIZEOF(short)
6153     AC_CHECK_SIZEOF(int)
6154     AC_CHECK_SIZEOF(long long)
6155     AC_CHECK_SIZEOF(double)
6156     AC_CHECK_SIZEOF(void*)
6159     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6160     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6161     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6162     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6163     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6165     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6166     m4_pattern_allow([AC_CHECK_ALIGNOF])
6167     m4_ifdef([AC_CHECK_ALIGNOF],
6168         [
6169             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6170             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6171             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6172             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6173         ],
6174         [
6175             case "$_os-$host_cpu" in
6176             Linux-i686)
6177                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6178                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6179                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6180                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6181                 ;;
6182             Linux-x86_64)
6183                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6184                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6185                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6186                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6187                 ;;
6188             *)
6189                 if test -z "$ac_cv_alignof_short" -o \
6190                         -z "$ac_cv_alignof_int" -o \
6191                         -z "$ac_cv_alignof_long" -o \
6192                         -z "$ac_cv_alignof_double"; then
6193                    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.])
6194                 fi
6195                 ;;
6196             esac
6197         ])
6199     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6200     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6201     if test $ac_cv_sizeof_long -eq 8; then
6202         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6203     elif test $ac_cv_sizeof_double -eq 8; then
6204         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6205     else
6206         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6207     fi
6209     dnl Check for large file support
6210     AC_SYS_LARGEFILE
6211     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6212         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6213     fi
6214     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6215         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6216     fi
6217 else
6218     # Hardcode for MSVC
6219     SAL_TYPES_SIZEOFSHORT=2
6220     SAL_TYPES_SIZEOFINT=4
6221     SAL_TYPES_SIZEOFLONG=4
6222     SAL_TYPES_SIZEOFLONGLONG=8
6223     if test "$BITNESS_OVERRIDE" = ""; then
6224         SAL_TYPES_SIZEOFPOINTER=4
6225     else
6226         SAL_TYPES_SIZEOFPOINTER=8
6227     fi
6228     SAL_TYPES_ALIGNMENT2=2
6229     SAL_TYPES_ALIGNMENT4=4
6230     SAL_TYPES_ALIGNMENT8=8
6231     LFS_CFLAGS=''
6233 AC_SUBST(LFS_CFLAGS)
6235 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6236 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6237 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6238 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6239 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6240 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6241 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6242 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6244 dnl ===================================================================
6245 dnl Check whether to enable runtime optimizations
6246 dnl ===================================================================
6247 ENABLE_RUNTIME_OPTIMIZATIONS=
6248 AC_MSG_CHECKING([whether to enable runtime optimizations])
6249 if test -z "$enable_runtime_optimizations"; then
6250     for i in $CC; do
6251         case $i in
6252         -fsanitize=*)
6253             enable_runtime_optimizations=no
6254             break
6255             ;;
6256         esac
6257     done
6259 if test "$enable_runtime_optimizations" != no; then
6260     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6261     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6262     AC_MSG_RESULT([yes])
6263 else
6264     AC_MSG_RESULT([no])
6266 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6268 dnl ===================================================================
6269 dnl Check if valgrind headers are available
6270 dnl ===================================================================
6271 ENABLE_VALGRIND=
6272 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6273     prev_cppflags=$CPPFLAGS
6274     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6275     # or where does it come from?
6276     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6277     AC_CHECK_HEADER([valgrind/valgrind.h],
6278         [ENABLE_VALGRIND=TRUE])
6279     CPPFLAGS=$prev_cppflags
6281 AC_SUBST([ENABLE_VALGRIND])
6282 if test -z "$ENABLE_VALGRIND"; then
6283     if test "$with_valgrind" = yes; then
6284         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6285     fi
6286     VALGRIND_CFLAGS=
6288 AC_SUBST([VALGRIND_CFLAGS])
6291 dnl ===================================================================
6292 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6293 dnl ===================================================================
6295 # We need at least the sys/sdt.h include header.
6296 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6297 if test "$SDT_H_FOUND" = "TRUE"; then
6298     # Found sys/sdt.h header, now make sure the c++ compiler works.
6299     # Old g++ versions had problems with probes in constructors/destructors.
6300     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6301     AC_LANG_PUSH([C++])
6302     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6303     #include <sys/sdt.h>
6304     class ProbeClass
6305     {
6306     private:
6307       int& ref;
6308       const char *name;
6310     public:
6311       ProbeClass(int& v, const char *n) : ref(v), name(n)
6312       {
6313         DTRACE_PROBE2(_test_, cons, name, ref);
6314       }
6316       void method(int min)
6317       {
6318         DTRACE_PROBE3(_test_, meth, name, ref, min);
6319         ref -= min;
6320       }
6322       ~ProbeClass()
6323       {
6324         DTRACE_PROBE2(_test_, dest, name, ref);
6325       }
6326     };
6327     ]],[[
6328     int i = 64;
6329     DTRACE_PROBE1(_test_, call, i);
6330     ProbeClass inst = ProbeClass(i, "call");
6331     inst.method(24);
6332     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6333           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6334     AC_LANG_POP([C++])
6336 AC_CONFIG_HEADERS([config_host/config_probes.h])
6338 dnl ===================================================================
6339 dnl GCC features
6340 dnl ===================================================================
6341 HAVE_GCC_STACK_CLASH_PROTECTION=
6342 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6343     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6344     save_CFLAGS=$CFLAGS
6345     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6346     AC_LINK_IFELSE(
6347         [AC_LANG_PROGRAM(, [[return 0;]])],
6348         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6349         [AC_MSG_RESULT([no])])
6350     CFLAGS=$save_CFLAGS
6352     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6353     save_CFLAGS=$CFLAGS
6354     CFLAGS="$CFLAGS -Werror -mno-avx"
6355     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6356     CFLAGS=$save_CFLAGS
6357     if test "$HAVE_GCC_AVX" = "TRUE"; then
6358         AC_MSG_RESULT([yes])
6359     else
6360         AC_MSG_RESULT([no])
6361     fi
6363     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6364     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6365     int v = 0;
6366     if (__sync_add_and_fetch(&v, 1) != 1 ||
6367         __sync_sub_and_fetch(&v, 1) != 0)
6368         return 1;
6369     __sync_synchronize();
6370     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6371         v != 1)
6372         return 1;
6373     return 0;
6374 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6375     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6376         AC_MSG_RESULT([yes])
6377         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6378     else
6379         AC_MSG_RESULT([no])
6380     fi
6382     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6383     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6384     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6385         AC_MSG_RESULT([yes])
6386         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6387     else
6388         AC_MSG_RESULT([no])
6389     fi
6391     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6392     save_CFLAGS=$CFLAGS
6393     CFLAGS="$CFLAGS -Werror"
6394     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6395             __attribute__((deprecated("test"))) void f();
6396         ])], [
6397             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6398             AC_MSG_RESULT([yes])
6399         ], [AC_MSG_RESULT([no])])
6400     CFLAGS=$save_CFLAGS
6402     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6403     AC_LANG_PUSH([C++])
6404     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6405             #include <cstddef>
6406             #include <cxxabi.h>
6407             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6408         ])], [
6409             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6410             AC_MSG_RESULT([yes])
6411         ], [AC_MSG_RESULT([no])])
6412     AC_LANG_POP([C++])
6414     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6415     AC_LANG_PUSH([C++])
6416     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6417             #include <cstddef>
6418             #include <cxxabi.h>
6419             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6420         ])], [
6421             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6422             AC_MSG_RESULT([yes])
6423         ], [AC_MSG_RESULT([no])])
6424     AC_LANG_POP([C++])
6426     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6427     AC_LANG_PUSH([C++])
6428     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6429             #include <cxxabi.h>
6430             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6431         ])], [
6432             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6433             AC_MSG_RESULT([yes])
6434         ], [AC_MSG_RESULT([no])])
6435     AC_LANG_POP([C++])
6437     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6438     AC_LANG_PUSH([C++])
6439     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6440             #include <cstddef>
6441             #include <cxxabi.h>
6442             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6443         ])], [
6444             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6445             AC_MSG_RESULT([yes])
6446         ], [AC_MSG_RESULT([no])])
6447     AC_LANG_POP([C++])
6449     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6450     AC_LANG_PUSH([C++])
6451     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6452             #include <cstddef>
6453             #include <cxxabi.h>
6454             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6455         ])], [
6456             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6457             AC_MSG_RESULT([yes])
6458         ], [AC_MSG_RESULT([no])])
6459     AC_LANG_POP([C++])
6461     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6462     AC_LANG_PUSH([C++])
6463     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6464             #include <cxxabi.h>
6465             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6466         ])], [
6467             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6468             AC_MSG_RESULT([yes])
6469         ], [AC_MSG_RESULT([no])])
6470     AC_LANG_POP([C++])
6472     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6473     AC_LANG_PUSH([C++])
6474     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6475             #include <cxxabi.h>
6476             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6477         ])], [
6478             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6479             AC_MSG_RESULT([yes])
6480         ], [AC_MSG_RESULT([no])])
6481     AC_LANG_POP([C++])
6483     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6484     AC_LANG_PUSH([C++])
6485     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6486             #include <cxxabi.h>
6487             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6488         ])], [
6489             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6490             AC_MSG_RESULT([yes])
6491         ], [AC_MSG_RESULT([no])])
6492     AC_LANG_POP([C++])
6494     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6495     AC_LANG_PUSH([C++])
6496     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6497             #include <cstddef>
6498             #include <cxxabi.h>
6499             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6500         ])], [
6501             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6502             AC_MSG_RESULT([yes])
6503         ], [AC_MSG_RESULT([no])])
6504     AC_LANG_POP([C++])
6506     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6507     AC_LANG_PUSH([C++])
6508     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6509             #include <cstddef>
6510             #include <cxxabi.h>
6511             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6512         ])], [
6513             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6514             AC_MSG_RESULT([yes])
6515         ], [AC_MSG_RESULT([no])])
6516     AC_LANG_POP([C++])
6518     dnl Available in GCC 4.9 and at least since Clang 3.4:
6519     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6520     AC_LANG_PUSH([C++])
6521     save_CXXFLAGS=$CXXFLAGS
6522     CXXFLAGS="$CXXFLAGS -Werror"
6523     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6524             struct __attribute__((warn_unused)) dummy {};
6525         ])], [
6526             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6527             AC_MSG_RESULT([yes])
6528         ], [AC_MSG_RESULT([no])])
6529     CXXFLAGS=$save_CXXFLAGS
6530 AC_LANG_POP([C++])
6533 AC_SUBST(HAVE_GCC_AVX)
6534 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6535 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6536 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6538 dnl ===================================================================
6539 dnl Identify the C++ library
6540 dnl ===================================================================
6542 AC_MSG_CHECKING([what the C++ library is])
6543 AC_LANG_PUSH([C++])
6544 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6545 #include <utility>
6546 #ifndef __GLIBCXX__
6547 foo bar
6548 #endif
6549 ]])],
6550     [CPP_LIBRARY=GLIBCXX
6551      cpp_library_name="GNU libstdc++"
6552     ],
6553     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6554 #include <utility>
6555 #ifndef _LIBCPP_VERSION
6556 foo bar
6557 #endif
6558 ]])],
6559     [CPP_LIBRARY=LIBCPP
6560      cpp_library_name="LLVM libc++"
6561      AC_DEFINE([HAVE_LIBCXX])
6562     ],
6563     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6564 #include <utility>
6565 #ifndef _MSC_VER
6566 foo bar
6567 #endif
6568 ]])],
6569     [CPP_LIBRARY=MSVCRT
6570      cpp_library_name="Microsoft"
6571     ],
6572     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6573 AC_MSG_RESULT([$cpp_library_name])
6574 AC_LANG_POP([C++])
6576 dnl ===================================================================
6577 dnl Check for gperf
6578 dnl ===================================================================
6579 AC_PATH_PROG(GPERF, gperf)
6580 if test -z "$GPERF"; then
6581     AC_MSG_ERROR([gperf not found but needed. Install it.])
6583 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6584     GPERF=`cygpath -m $GPERF`
6586 AC_MSG_CHECKING([whether gperf is new enough])
6587 my_gperf_ver1=$($GPERF --version | head -n 1)
6588 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6589 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6590 if test "$my_gperf_ver3" -ge 301; then
6591     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6592 else
6593     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6595 AC_SUBST(GPERF)
6597 dnl ===================================================================
6598 dnl Check for system libcmis
6599 dnl ===================================================================
6600 # libcmis requires curl and we can't build curl for iOS
6601 if test $_os != iOS; then
6602     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6603     ENABLE_LIBCMIS=TRUE
6604 else
6605     ENABLE_LIBCMIS=
6607 AC_SUBST(ENABLE_LIBCMIS)
6609 dnl ===================================================================
6610 dnl C++11
6611 dnl ===================================================================
6613 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6614 CXXFLAGS_CXX11=
6615 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6616     if test "$with_latest_c__" = yes; then
6617         CXXFLAGS_CXX11=-std:c++latest
6618     else
6619         CXXFLAGS_CXX11=-std:c++17
6620     fi
6621     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6622 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6623     my_flags='-std=c++17 -std=c++1z'
6624     if test "$with_latest_c__" = yes; then
6625         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6626     fi
6627     for flag in $my_flags; do
6628         if test "$COM" = MSC; then
6629             flag="-Xclang $flag"
6630         fi
6631         save_CXXFLAGS=$CXXFLAGS
6632         CXXFLAGS="$CXXFLAGS $flag -Werror"
6633         if test "$SYSTEM_LIBCMIS" = TRUE; then
6634             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6635         fi
6636         AC_LANG_PUSH([C++])
6637         dnl Clang 3.9 supports __float128 since
6638         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6639         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6640         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6641         dnl $flag is supported below, so check this first):
6642         my_float128hack=
6643         my_float128hack_impl=-D__float128=void
6644         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6645             #include <vector>
6646             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6647             // (__float128)
6648             ]])
6649         ],,[
6650             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6651             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6652             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6653             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6654             dnl place where __float128 is used is in a template specialization, -D__float128=void
6655             dnl will avoid the problem there while still causing a problem if somebody actually uses
6656             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6657             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6658             dnl "fixed" with this hack):
6659             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6660             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6661                 #include <vector>
6662                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6663                 // (__float128)
6664                 ]])
6665             ],[my_float128hack=$my_float128hack_impl])
6666         ])
6667         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6668             #include <algorithm>
6669             #include <functional>
6670             #include <vector>
6672             #if defined SYSTEM_LIBCMIS
6673             // See ucb/source/ucp/cmis/auth_provider.hxx:
6674             #if !defined __clang__
6675             #pragma GCC diagnostic push
6676             #pragma GCC diagnostic ignored "-Wdeprecated"
6677             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6678             #endif
6679             #include <libcmis/libcmis.hxx>
6680             #if !defined __clang__
6681             #pragma GCC diagnostic pop
6682             #endif
6683             #endif
6685             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6686                 std::sort(v.begin(), v.end(), fn);
6687             }
6688             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6689         AC_LANG_POP([C++])
6690         CXXFLAGS=$save_CXXFLAGS
6691         if test -n "$CXXFLAGS_CXX11"; then
6692             break
6693         fi
6694     done
6696 if test -n "$CXXFLAGS_CXX11"; then
6697     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6698 else
6699     AC_MSG_ERROR(no)
6701 AC_SUBST(CXXFLAGS_CXX11)
6703 if test "$GCC" = "yes"; then
6704     save_CXXFLAGS=$CXXFLAGS
6705     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6706     CHECK_L_ATOMIC
6707     CXXFLAGS=$save_CXXFLAGS
6708     AC_SUBST(ATOMIC_LIB)
6711 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6712 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6713 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6714 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6715 dnl again towards 4.7.2:
6716 if test $CPP_LIBRARY = GLIBCXX; then
6717     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6718     AC_LANG_PUSH([C++])
6719     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6720 #include <list>
6721 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6722     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6723     //   GCC 4.7.0: 20120322
6724     //   GCC 4.7.1: 20120614
6725     // and using a range check is not possible as the mapping between
6726     // __GLIBCXX__ values and GCC versions is not monotonic
6727 /* ok */
6728 #else
6729 abi broken
6730 #endif
6731         ]])], [AC_MSG_RESULT(no, ok)],
6732         [AC_MSG_ERROR(yes)])
6733     AC_LANG_POP([C++])
6736 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6737 save_CXXFLAGS=$CXXFLAGS
6738 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6739 AC_LANG_PUSH([C++])
6741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6742 #include <stddef.h>
6744 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6746 namespace
6748         struct b
6749         {
6750                 int i;
6751                 int j;
6752         };
6754 ]], [[
6755 struct a
6757         int i;
6758         int j;
6760 a thinga[]={{0,0}, {1,1}};
6761 b thingb[]={{0,0}, {1,1}};
6762 size_t i = sizeof(sal_n_array_size(thinga));
6763 size_t j = sizeof(sal_n_array_size(thingb));
6764 return !(i != 0 && j != 0);
6766     ], [ AC_MSG_RESULT(yes) ],
6767     [ AC_MSG_ERROR(no)])
6768 AC_LANG_POP([C++])
6769 CXXFLAGS=$save_CXXFLAGS
6771 dnl _Pragma support (may require C++11)
6772 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6773     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6774     AC_LANG_PUSH([C++])
6775     save_CXXFLAGS=$CXXFLAGS
6776     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6777     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6778             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6779         ])], [
6780             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6781             AC_MSG_RESULT([yes])
6782         ], [AC_MSG_RESULT([no])])
6783     AC_LANG_POP([C++])
6784     CXXFLAGS=$save_CXXFLAGS
6787 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6788 if test "$GCC" = yes; then
6789     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6790     AC_LANG_PUSH([C++])
6791     save_CXXFLAGS=$CXXFLAGS
6792     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6793     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6794     CXXFLAGS=$save_CXXFLAGS
6795     AC_LANG_POP([C++])
6796     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6797         AC_MSG_RESULT([yes])
6798     else
6799         AC_MSG_RESULT([no])
6800     fi
6802 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6804 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6805 AC_LANG_PUSH([C++])
6806 save_CXXFLAGS=$CXXFLAGS
6807 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6808 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6809         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6810         // supporting it:
6811         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6812         struct S {
6813         private:
6814             S(S const &);
6815         public:
6816             S();
6817             ~S();
6818         };
6819         S copy();
6820         void f() { S c(copy()); }
6821         #endif
6822     ])], [
6823         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6824         AC_MSG_RESULT([yes])
6825     ], [AC_MSG_RESULT([no])])
6826 CXXFLAGS=$save_CXXFLAGS
6827 AC_LANG_POP([C++])
6829 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6830 AC_LANG_PUSH([C++])
6831 save_CXXFLAGS=$CXXFLAGS
6832 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6833 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6834         #include <algorithm>
6835         #include <initializer_list>
6836         #include <vector>
6837         template<typename T> class S {
6838         private:
6839             std::vector<T> v_;
6840         public:
6841             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6842         };
6843         constinit S<int> s{3, 2, 1};
6844     ])], [
6845         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6846         AC_MSG_RESULT([yes])
6847     ], [AC_MSG_RESULT([no])])
6848 CXXFLAGS=$save_CXXFLAGS
6849 AC_LANG_POP([C++])
6851 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6852 AC_LANG_PUSH([C++])
6853 save_CXXFLAGS=$CXXFLAGS
6854 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6855 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6856         #include <span>
6857         #include <type_traits>
6858         // Don't check size_type directly, as it was called index_type before P1872R0:
6859         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6860     ])], [
6861         AC_DEFINE([HAVE_CPP_SPAN],[1])
6862         AC_MSG_RESULT([yes])
6863     ], [AC_MSG_RESULT([no])])
6864 CXXFLAGS=$save_CXXFLAGS
6865 AC_LANG_POP([C++])
6867 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6868 AC_LANG_PUSH([C++])
6869 save_CXXFLAGS=$CXXFLAGS
6870 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6871 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6872         struct S1 { S1(S1 &&); };
6873         struct S2: S1 {};
6874         S1 f(S2 s) { return s; }
6875     ])], [
6876         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6877         AC_MSG_RESULT([yes])
6878     ], [AC_MSG_RESULT([no])])
6879 CXXFLAGS=$save_CXXFLAGS
6880 AC_LANG_POP([C++])
6882 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6883 dnl uninitialized warning for code like
6885 dnl   OString f();
6886 dnl   boost::optional<OString> * g(bool b) {
6887 dnl       boost::optional<OString> o;
6888 dnl       if (b) o = f();
6889 dnl       return new boost::optional<OString>(o);
6890 dnl   }
6892 dnl (as is e.g. present, in a slightly more elaborate form, in
6893 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6894 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6895 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6896 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6897     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6898     AC_LANG_PUSH([C++])
6899     save_CXXFLAGS=$CXXFLAGS
6900     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6901     if test "$ENABLE_OPTIMIZED" = TRUE; then
6902         CXXFLAGS="$CXXFLAGS -O2"
6903     else
6904         CXXFLAGS="$CXXFLAGS -O0"
6905     fi
6906     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6907             #include <new>
6908             void f1(int);
6909             struct S1 {
6910                 ~S1() { f1(n); }
6911                 int n = 0;
6912             };
6913             struct S2 {
6914                 S2() {}
6915                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6916                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6917                 void set(S1 s) {
6918                     new (stg) S1(s);
6919                     init = true;
6920                 }
6921                 bool init = false;
6922                 char stg[sizeof (S1)];
6923             } ;
6924             S1 f2();
6925             S2 * f3(bool b) {
6926                 S2 o;
6927                 if (b) o.set(f2());
6928                 return new S2(o);
6929             }
6930         ]])], [AC_MSG_RESULT([no])], [
6931             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6932             AC_MSG_RESULT([yes])
6933         ])
6934     CXXFLAGS=$save_CXXFLAGS
6935     AC_LANG_POP([C++])
6937 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6939 dnl ===================================================================
6940 dnl CPU Intrinsics support - SSE, AVX
6941 dnl ===================================================================
6943 INTRINSICS_CXXFLAGS=""
6945 if test "$GCC" = "yes"; then
6946     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6947     AC_LANG_PUSH([C++])
6948     save_CXXFLAGS=$CXXFLAGS
6949     CXXFLAGS="$CXXFLAGS -msse2"
6950     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6951         #include <emmintrin.h>
6952         int main () {
6953             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6954             c = _mm_xor_si128 (a, b);
6955             return 0;
6956         }
6957         ])],
6958         [can_compile_sse2=yes],
6959         [can_compile_sse2=no])
6960     AC_LANG_POP([C++])
6961     CXXFLAGS=$save_CXXFLAGS
6962     AC_MSG_RESULT([${can_compile_sse2}])
6963     if test "${can_compile_sse2}" = "yes" ; then
6964         INTRINSICS_CXXFLAGS="-msse2"
6965     else
6966         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6967     fi
6969     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6970     AC_LANG_PUSH([C++])
6971     save_CXXFLAGS=$CXXFLAGS
6972     CXXFLAGS="$CXXFLAGS -mssse3"
6973     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6974         #include <tmmintrin.h>
6975         int main () {
6976             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6977             c = _mm_maddubs_epi16 (a, b);
6978             return 0;
6979         }
6980         ])],
6981         [can_compile_ssse3=yes],
6982         [can_compile_ssse3=no])
6983     AC_LANG_POP([C++])
6984     CXXFLAGS=$save_CXXFLAGS
6985     AC_MSG_RESULT([${can_compile_ssse3}])
6986     if test "${can_compile_ssse3}" = "yes" ; then
6987         INTRINSICS_CXXFLAGS="-mssse3"
6988     else
6989         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6990     fi
6992     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6993     AC_LANG_PUSH([C++])
6994     save_CXXFLAGS=$CXXFLAGS
6995     CXXFLAGS="$CXXFLAGS -mavx"
6996     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6997         #include <immintrin.h>
6998         int main () {
6999             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7000             c = _mm256_xor_ps(a, b);
7001             return 0;
7002         }
7003         ])],
7004         [can_compile_avx=yes],
7005         [can_compile_avx=no])
7006     AC_LANG_POP([C++])
7007     CXXFLAGS=$save_CXXFLAGS
7008     AC_MSG_RESULT([${can_compile_avx}])
7009     if test "${can_compile_avx}" = "yes" ; then
7010         INTRINSICS_CXXFLAGS="-mavx"
7011     else
7012         AC_MSG_WARN([cannot compile AVX intrinsics])
7013     fi
7015     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7016     AC_LANG_PUSH([C++])
7017     save_CXXFLAGS=$CXXFLAGS
7018     CXXFLAGS="$CXXFLAGS -mavx2"
7019     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7020         #include <immintrin.h>
7021         int main () {
7022             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7023             c = _mm256_maddubs_epi16(a, b);
7024             return 0;
7025         }
7026         ])],
7027         [can_compile_avx2=yes],
7028         [can_compile_avx2=no])
7029     AC_LANG_POP([C++])
7030     CXXFLAGS=$save_CXXFLAGS
7031     AC_MSG_RESULT([${can_compile_avx2}])
7032     if test "${can_compile_avx2}" = "yes" ; then
7033         INTRINSICS_CXXFLAGS="-mavx2"
7034     else
7035         AC_MSG_WARN([cannot compile AVX2 intrinsics])
7036     fi
7039 AC_SUBST([INTRINSICS_CXXFLAGS])
7041 dnl ===================================================================
7042 dnl system stl sanity tests
7043 dnl ===================================================================
7044 if test "$_os" != "WINNT"; then
7046     AC_LANG_PUSH([C++])
7048     save_CPPFLAGS="$CPPFLAGS"
7049     if test -n "$MACOSX_SDK_PATH"; then
7050         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7051     fi
7053     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7054     # only.
7055     if test "$CPP_LIBRARY" = GLIBCXX; then
7056         dnl gcc#19664, gcc#22482, rhbz#162935
7057         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7058         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7059         AC_MSG_RESULT([$stlvisok])
7060         if test "$stlvisok" = "no"; then
7061             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7062         fi
7063     fi
7065     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7066     # when we don't make any dynamic libraries?
7067     if test "$DISABLE_DYNLOADING" = ""; then
7068         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7069         cat > conftestlib1.cc <<_ACEOF
7070 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7071 struct S2: S1<int> { virtual ~S2(); };
7072 S2::~S2() {}
7073 _ACEOF
7074         cat > conftestlib2.cc <<_ACEOF
7075 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7076 struct S2: S1<int> { virtual ~S2(); };
7077 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7078 _ACEOF
7079         gccvisinlineshiddenok=yes
7080         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7081             gccvisinlineshiddenok=no
7082         else
7083             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7084             dnl known to not work with -z defs (unsetting which makes the test
7085             dnl moot, though):
7086             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7087             if test "$COM_IS_CLANG" = TRUE; then
7088                 for i in $CXX $CXXFLAGS; do
7089                     case $i in
7090                     -fsanitize=*)
7091                         my_linkflagsnoundefs=
7092                         break
7093                         ;;
7094                     esac
7095                 done
7096             fi
7097             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7098                 gccvisinlineshiddenok=no
7099             fi
7100         fi
7102         rm -fr libconftest*
7103         AC_MSG_RESULT([$gccvisinlineshiddenok])
7104         if test "$gccvisinlineshiddenok" = "no"; then
7105             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7106         fi
7107     fi
7109    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7110     cat >visibility.cxx <<_ACEOF
7111 #pragma GCC visibility push(hidden)
7112 struct __attribute__ ((visibility ("default"))) TestStruct {
7113   static void Init();
7115 __attribute__ ((visibility ("default"))) void TestFunc() {
7116   TestStruct::Init();
7118 _ACEOF
7119     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7120         gccvisbroken=yes
7121     else
7122         case "$host_cpu" in
7123         i?86|x86_64)
7124             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7125                 gccvisbroken=no
7126             else
7127                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7128                     gccvisbroken=no
7129                 else
7130                     gccvisbroken=yes
7131                 fi
7132             fi
7133             ;;
7134         *)
7135             gccvisbroken=no
7136             ;;
7137         esac
7138     fi
7139     rm -f visibility.s visibility.cxx
7141     AC_MSG_RESULT([$gccvisbroken])
7142     if test "$gccvisbroken" = "yes"; then
7143         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7144     fi
7146     CPPFLAGS="$save_CPPFLAGS"
7148     AC_LANG_POP([C++])
7151 dnl ===================================================================
7152 dnl  Clang++ tests
7153 dnl ===================================================================
7155 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7156 if test "$GCC" = "yes"; then
7157     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7158     AC_LANG_PUSH([C++])
7159     save_CXXFLAGS=$CXXFLAGS
7160     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7161     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7162     CXXFLAGS=$save_CXXFLAGS
7163     AC_LANG_POP([C++])
7164     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7165         AC_MSG_RESULT([yes])
7166     else
7167         AC_MSG_RESULT([no])
7168     fi
7170 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7172 dnl ===================================================================
7173 dnl Compiler plugins
7174 dnl ===================================================================
7176 COMPILER_PLUGINS=
7177 # currently only Clang
7179 if test "$COM_IS_CLANG" != "TRUE"; then
7180     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7181         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7182         enable_compiler_plugins=no
7183     fi
7186 if test "$COM_IS_CLANG" = "TRUE"; then
7187     if test -n "$enable_compiler_plugins"; then
7188         compiler_plugins="$enable_compiler_plugins"
7189     elif test -n "$ENABLE_DBGUTIL"; then
7190         compiler_plugins=test
7191     else
7192         compiler_plugins=no
7193     fi
7194     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7195         if test "$CLANGVER" -lt 50002; then
7196             if test "$compiler_plugins" = yes; then
7197                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7198             else
7199                 compiler_plugins=no
7200             fi
7201         fi
7202     fi
7203     if test "$compiler_plugins" != "no"; then
7204         dnl The prefix where Clang resides, override to where Clang resides if
7205         dnl using a source build:
7206         if test -z "$CLANGDIR"; then
7207             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7208         fi
7209         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7210         if test -z "$COMPILER_PLUGINS_CXX"; then
7211             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7212         fi
7213         clangbindir=$CLANGDIR/bin
7214         if test "$build_os" = "cygwin"; then
7215             clangbindir=$(cygpath -u "$clangbindir")
7216         fi
7217         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7218         if test -n "$LLVM_CONFIG"; then
7219             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7220             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7221             if test -z "$CLANGLIBDIR"; then
7222                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7223             fi
7224             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7225             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7226             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7227             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7228                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7229             fi
7230             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7231             clangobjdir=$($LLVM_CONFIG --obj-root)
7232             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7233                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7234             fi
7235         fi
7236         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7237         AC_LANG_PUSH([C++])
7238         save_CXX=$CXX
7239         save_CXXCPP=$CXXCPP
7240         save_CPPFLAGS=$CPPFLAGS
7241         save_CXXFLAGS=$CXXFLAGS
7242         save_LDFLAGS=$LDFLAGS
7243         save_LIBS=$LIBS
7244         CXX=$COMPILER_PLUGINS_CXX
7245         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7246         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7247         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7248         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7249             [COMPILER_PLUGINS=TRUE],
7250             [
7251             if test "$compiler_plugins" = "yes"; then
7252                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7253             else
7254                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7255                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7256             fi
7257             ])
7258         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7259         dnl comment in compilerplugins/Makefile-clang.mk:
7260         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7261             LDFLAGS=""
7262             AC_MSG_CHECKING([for clang libraries to use])
7263             if test -z "$CLANGTOOLLIBS"; then
7264                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7265  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7266                 AC_LINK_IFELSE([
7267                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7268                         [[ clang::FullSourceLoc().dump(); ]])
7269                 ],[CLANGTOOLLIBS="$LIBS"],[])
7270             fi
7271             if test -z "$CLANGTOOLLIBS"; then
7272                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7273                 AC_LINK_IFELSE([
7274                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7275                         [[ clang::FullSourceLoc().dump(); ]])
7276                 ],[CLANGTOOLLIBS="$LIBS"],[])
7277             fi
7278             AC_MSG_RESULT([$CLANGTOOLLIBS])
7279             if test -z "$CLANGTOOLLIBS"; then
7280                 if test "$compiler_plugins" = "yes"; then
7281                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7282                 else
7283                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7284                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7285                 fi
7286                 COMPILER_PLUGINS=
7287             fi
7288             if test -n "$COMPILER_PLUGINS"; then
7289                 if test -z "$CLANGSYSINCLUDE"; then
7290                     if test -n "$LLVM_CONFIG"; then
7291                         # Path to the clang system headers (no idea if there's a better way to get it).
7292                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7293                     fi
7294                 fi
7295             fi
7296         fi
7297         CXX=$save_CXX
7298         CXXCPP=$save_CXXCPP
7299         CPPFLAGS=$save_CPPFLAGS
7300         CXXFLAGS=$save_CXXFLAGS
7301         LDFLAGS=$save_LDFLAGS
7302         LIBS="$save_LIBS"
7303         AC_LANG_POP([C++])
7304     fi
7305 else
7306     if test "$enable_compiler_plugins" = "yes"; then
7307         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7308     fi
7310 AC_SUBST(COMPILER_PLUGINS)
7311 AC_SUBST(COMPILER_PLUGINS_CXX)
7312 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7313 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7314 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7315 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7316 AC_SUBST(CLANGDIR)
7317 AC_SUBST(CLANGLIBDIR)
7318 AC_SUBST(CLANGTOOLLIBS)
7319 AC_SUBST(CLANGSYSINCLUDE)
7321 # Plugin to help linker.
7322 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7323 # This makes --enable-lto build with clang work.
7324 AC_SUBST(LD_PLUGIN)
7326 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7327 AC_SUBST(HAVE_POSIX_FALLOCATE)
7329 dnl ===================================================================
7330 dnl Custom build version
7331 dnl ===================================================================
7333 AC_MSG_CHECKING([whether to add custom build version])
7334 if test "$with_build_version" != ""; then
7335     BUILD_VER_STRING=$with_build_version
7336     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7337 else
7338     BUILD_VER_STRING=
7339     AC_MSG_RESULT([no])
7341 AC_SUBST(BUILD_VER_STRING)
7343 JITC_PROCESSOR_TYPE=""
7344 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7345     # IBMs JDK needs this...
7346     JITC_PROCESSOR_TYPE=6
7347     export JITC_PROCESSOR_TYPE
7349 AC_SUBST([JITC_PROCESSOR_TYPE])
7351 # Misc Windows Stuff
7352 AC_ARG_WITH(ucrt-dir,
7353     AS_HELP_STRING([--with-ucrt-dir],
7354         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7355         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7356         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7357             Windows6.1-KB2999226-x64.msu
7358             Windows6.1-KB2999226-x86.msu
7359             Windows8.1-KB2999226-x64.msu
7360             Windows8.1-KB2999226-x86.msu
7361             Windows8-RT-KB2999226-x64.msu
7362             Windows8-RT-KB2999226-x86.msu
7363         A zip archive including those files is available from Microsoft site:
7364         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7366 UCRT_REDISTDIR="$with_ucrt_dir"
7367 if test $_os = "WINNT"; then
7368     find_msvc_x64_dlls
7369     find_msms
7370     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7371     MSVC_DLLS="$msvcdlls"
7372     MSM_PATH=`win_short_path_for_make "$msmdir"`
7373     # MSVC 15.3 changed it to VC141
7374     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7375         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7376     else
7377         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7378     fi
7380     if test "$UCRT_REDISTDIR" = "no"; then
7381         dnl explicitly disabled
7382         UCRT_REDISTDIR=""
7383     else
7384         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7385                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7386                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7387                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7388                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7389                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7390             UCRT_REDISTDIR=""
7391             if test -n "$PKGFORMAT"; then
7392                for i in $PKGFORMAT; do
7393                    case "$i" in
7394                    msi)
7395                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7396                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7397                        ;;
7398                    esac
7399                done
7400             fi
7401         fi
7402     fi
7405 AC_SUBST(UCRT_REDISTDIR)
7406 AC_SUBST(MSVC_DLL_PATH)
7407 AC_SUBST(MSVC_DLLS)
7408 AC_SUBST(MSM_PATH)
7410 dnl ===================================================================
7411 dnl Checks for Java
7412 dnl ===================================================================
7413 if test "$ENABLE_JAVA" != ""; then
7415     # Windows-specific tests
7416     if test "$build_os" = "cygwin"; then
7417         if test "$BITNESS_OVERRIDE" = 64; then
7418             bitness=64
7419         else
7420             bitness=32
7421         fi
7423         if test -z "$with_jdk_home"; then
7424             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7425             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7426             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7427             if test -n "$regvalue"; then
7428                 ver=$regvalue
7429                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7430                 _jdk_home=$regvalue
7431             fi
7432             if test -z "$with_jdk_home"; then
7433                 for ver in 1.8; do
7434                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7435                     if test -n "$regvalue"; then
7436                         _jdk_home=$regvalue
7437                         break
7438                     fi
7439                 done
7440             fi
7441             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7442                 with_jdk_home="$_jdk_home"
7443                 howfound="found automatically"
7444             else
7445                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7446             fi
7447         else
7448             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7449             howfound="you passed"
7450         fi
7451     fi
7453     # 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.
7454     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7455     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7456         with_jdk_home=`/usr/libexec/java_home`
7457     fi
7459     JAVA_HOME=; export JAVA_HOME
7460     if test -z "$with_jdk_home"; then
7461         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7462     else
7463         _java_path="$with_jdk_home/bin/$with_java"
7464         dnl Check if there is a Java interpreter at all.
7465         if test -x "$_java_path"; then
7466             JAVAINTERPRETER=$_java_path
7467         else
7468             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7469         fi
7470     fi
7472     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7473     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7474     dnl loaded by java to run JunitTests:
7475     if test "$build_os" = "cygwin"; then
7476         shortjdkhome=`cygpath -d "$with_jdk_home"`
7477         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
7478             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7479             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7480         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
7481             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7482             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7483         fi
7485         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7486             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7487         fi
7488         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7489     elif test "$cross_compiling" != "yes"; then
7490         case $CPUNAME in
7491             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7492                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7493                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7494                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7495                 fi
7496                 ;;
7497             *) # assumption: everything else 32-bit
7498                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7499                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7500                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7501                 fi
7502                 ;;
7503         esac
7504     fi
7507 dnl ===================================================================
7508 dnl Checks for JDK.
7509 dnl ===================================================================
7511 # Note that JAVA_HOME as for now always means the *build* platform's
7512 # JAVA_HOME. Whether all the complexity here actually is needed any
7513 # more or not, no idea.
7515 if test "$ENABLE_JAVA" != ""; then
7516     _gij_longver=0
7517     AC_MSG_CHECKING([the installed JDK])
7518     if test -n "$JAVAINTERPRETER"; then
7519         dnl java -version sends output to stderr!
7520         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7521             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7522         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7523             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7524         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7525             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7526         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7527             JDK=ibm
7529             dnl IBM JDK specific tests
7530             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7531             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7533             if test "$_jdk_ver" -lt 10800; then
7534                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7535             fi
7537             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7539             if test "$with_jdk_home" = ""; then
7540                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7541 you must use the "--with-jdk-home" configure option explicitly])
7542             fi
7544             JAVA_HOME=$with_jdk_home
7545         else
7546             JDK=sun
7548             dnl Sun JDK specific tests
7549             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7550             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7552             if test "$_jdk_ver" -lt 10800; then
7553                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7554             fi
7555             if test "$_jdk_ver" -gt 10800; then
7556                 JAVA_CLASSPATH_NOT_SET=TRUE
7557             fi
7559             AC_MSG_RESULT([found (JDK $_jdk)])
7560             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7561             if test "$_os" = "WINNT"; then
7562                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7563             fi
7565             # set to limit VM usage for JunitTests
7566             JAVAIFLAGS=-Xmx64M
7567             # set to limit VM usage for javac
7568             JAVAFLAGS=-J-Xmx128M
7569         fi
7570     else
7571         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7572     fi
7573 else
7574     dnl Java disabled
7575     JAVA_HOME=
7576     export JAVA_HOME
7579 dnl ===================================================================
7580 dnl Checks for javac
7581 dnl ===================================================================
7582 if test "$ENABLE_JAVA" != ""; then
7583     javacompiler="javac"
7584     : ${JAVA_SOURCE_VER=8}
7585     : ${JAVA_TARGET_VER=8}
7586     if test -z "$with_jdk_home"; then
7587         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7588     else
7589         _javac_path="$with_jdk_home/bin/$javacompiler"
7590         dnl Check if there is a Java compiler at all.
7591         if test -x "$_javac_path"; then
7592             JAVACOMPILER=$_javac_path
7593         fi
7594     fi
7595     if test -z "$JAVACOMPILER"; then
7596         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7597     fi
7598     if test "$build_os" = "cygwin"; then
7599         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7600             JAVACOMPILER="${JAVACOMPILER}.exe"
7601         fi
7602         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7603     fi
7606 dnl ===================================================================
7607 dnl Checks for javadoc
7608 dnl ===================================================================
7609 if test "$ENABLE_JAVA" != ""; then
7610     if test -z "$with_jdk_home"; then
7611         AC_PATH_PROG(JAVADOC, javadoc)
7612     else
7613         _javadoc_path="$with_jdk_home/bin/javadoc"
7614         dnl Check if there is a javadoc at all.
7615         if test -x "$_javadoc_path"; then
7616             JAVADOC=$_javadoc_path
7617         else
7618             AC_PATH_PROG(JAVADOC, javadoc)
7619         fi
7620     fi
7621     if test -z "$JAVADOC"; then
7622         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7623     fi
7624     if test "$build_os" = "cygwin"; then
7625         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7626             JAVADOC="${JAVADOC}.exe"
7627         fi
7628         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7629     fi
7631     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7632     JAVADOCISGJDOC="yes"
7633     fi
7635 AC_SUBST(JAVADOCISGJDOC)
7637 if test "$ENABLE_JAVA" != ""; then
7638     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7639     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7640         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7641            # try to recover first by looking whether we have an alternative
7642            # system as in Debian or newer SuSEs where following /usr/bin/javac
7643            # over /etc/alternatives/javac leads to the right bindir where we
7644            # just need to strip a bit away to get a valid JAVA_HOME
7645            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7646         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7647             # maybe only one level of symlink (e.g. on Mac)
7648             JAVA_HOME=$(readlink $JAVACOMPILER)
7649             if test "$(dirname $JAVA_HOME)" = "."; then
7650                 # we've got no path to trim back
7651                 JAVA_HOME=""
7652             fi
7653         else
7654             # else warn
7655             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7656             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7657             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7658             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7659         fi
7660         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7661         if test "$JAVA_HOME" != "/usr"; then
7662             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7663                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7664                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7665                 dnl Tiger already returns a JDK path...
7666                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7667             else
7668                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7669                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7670                 dnl that checks which version to run
7671                 if test -f "$JAVA_HOME"; then
7672                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7673                 fi
7674             fi
7675         fi
7676     fi
7677     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7679     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7680     if test -z "$JAVA_HOME"; then
7681         if test "x$with_jdk_home" = "x"; then
7682             cat > findhome.java <<_ACEOF
7683 [import java.io.File;
7685 class findhome
7687     public static void main(String args[])
7688     {
7689         String jrelocation = System.getProperty("java.home");
7690         File jre = new File(jrelocation);
7691         System.out.println(jre.getParent());
7692     }
7694 _ACEOF
7695             AC_MSG_CHECKING([if javac works])
7696             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7697             AC_TRY_EVAL(javac_cmd)
7698             if test $? = 0 -a -f ./findhome.class; then
7699                 AC_MSG_RESULT([javac works])
7700             else
7701                 echo "configure: javac test failed" >&5
7702                 cat findhome.java >&5
7703                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7704             fi
7705             AC_MSG_CHECKING([if gij knows its java.home])
7706             JAVA_HOME=`$JAVAINTERPRETER findhome`
7707             if test $? = 0 -a "$JAVA_HOME" != ""; then
7708                 AC_MSG_RESULT([$JAVA_HOME])
7709             else
7710                 echo "configure: java test failed" >&5
7711                 cat findhome.java >&5
7712                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7713             fi
7714             # clean-up after ourselves
7715             rm -f ./findhome.java ./findhome.class
7716         else
7717             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7718         fi
7719     fi
7721     # now check if $JAVA_HOME is really valid
7722     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7723         case "${JAVA_HOME}" in
7724             /Library/Java/JavaVirtualMachines/*)
7725                 ;;
7726             *)
7727                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7728                 ;;
7729         esac
7730         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7731             JAVA_HOME_OK="NO"
7732         fi
7733     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7734         JAVA_HOME_OK="NO"
7735     fi
7736     if test "$JAVA_HOME_OK" = "NO"; then
7737         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7738         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7739         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7740         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7741         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7742         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7743     fi
7744     PathFormat "$JAVA_HOME"
7745     JAVA_HOME="$formatted_path"
7748 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7749     "$_os" != Darwin
7750 then
7751     AC_MSG_CHECKING([for JAWT lib])
7752     if test "$_os" = WINNT; then
7753         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7754         JAWTLIB=jawt.lib
7755     else
7756         case "$host_cpu" in
7757         arm*)
7758             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7759             JAVA_ARCH=$my_java_arch
7760             ;;
7761         i*86)
7762             my_java_arch=i386
7763             ;;
7764         m68k)
7765             my_java_arch=m68k
7766             ;;
7767         powerpc)
7768             my_java_arch=ppc
7769             ;;
7770         powerpc64)
7771             my_java_arch=ppc64
7772             ;;
7773         powerpc64le)
7774             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7775             JAVA_ARCH=$my_java_arch
7776             ;;
7777         sparc64)
7778             my_java_arch=sparcv9
7779             ;;
7780         x86_64)
7781             my_java_arch=amd64
7782             ;;
7783         *)
7784             my_java_arch=$host_cpu
7785             ;;
7786         esac
7787         # This is where JDK9 puts the library
7788         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7789             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7790         else
7791             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7792         fi
7793         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7794     fi
7795     AC_MSG_RESULT([$JAWTLIB])
7797 AC_SUBST(JAWTLIB)
7799 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7800     case "$host_os" in
7802     aix*)
7803         JAVAINC="-I$JAVA_HOME/include"
7804         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7805         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7806         ;;
7808     cygwin*)
7809         JAVAINC="-I$JAVA_HOME/include/win32"
7810         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7811         ;;
7813     darwin*)
7814         if test -d "$JAVA_HOME/include/darwin"; then
7815             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7816         else
7817             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7818         fi
7819         ;;
7821     dragonfly*)
7822         JAVAINC="-I$JAVA_HOME/include"
7823         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7824         ;;
7826     freebsd*)
7827         JAVAINC="-I$JAVA_HOME/include"
7828         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7829         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7830         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7831         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7832         ;;
7834     k*bsd*-gnu*)
7835         JAVAINC="-I$JAVA_HOME/include"
7836         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7837         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7838         ;;
7840     linux-gnu*)
7841         JAVAINC="-I$JAVA_HOME/include"
7842         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7843         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7844         ;;
7846     *netbsd*)
7847         JAVAINC="-I$JAVA_HOME/include"
7848         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7849         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7850        ;;
7852     openbsd*)
7853         JAVAINC="-I$JAVA_HOME/include"
7854         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7855         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7856         ;;
7858     solaris*)
7859         JAVAINC="-I$JAVA_HOME/include"
7860         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7861         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7862         ;;
7863     esac
7865 SOLARINC="$SOLARINC $JAVAINC"
7867 AC_SUBST(JAVACOMPILER)
7868 AC_SUBST(JAVADOC)
7869 AC_SUBST(JAVAINTERPRETER)
7870 AC_SUBST(JAVAIFLAGS)
7871 AC_SUBST(JAVAFLAGS)
7872 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7873 AC_SUBST(JAVA_HOME)
7874 AC_SUBST(JAVA_SOURCE_VER)
7875 AC_SUBST(JAVA_TARGET_VER)
7876 AC_SUBST(JDK)
7879 dnl ===================================================================
7880 dnl Export file validation
7881 dnl ===================================================================
7882 AC_MSG_CHECKING([whether to enable export file validation])
7883 if test "$with_export_validation" != "no"; then
7884     if test -z "$ENABLE_JAVA"; then
7885         if test "$with_export_validation" = "yes"; then
7886             AC_MSG_ERROR([requested, but Java is disabled])
7887         else
7888             AC_MSG_RESULT([no, as Java is disabled])
7889         fi
7890     elif ! test -d "${SRC_ROOT}/schema"; then
7891         if test "$with_export_validation" = "yes"; then
7892             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7893         else
7894             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7895         fi
7896     else
7897         AC_MSG_RESULT([yes])
7898         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7900         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7901         if test -z "$ODFVALIDATOR"; then
7902             # remember to download the ODF toolkit with validator later
7903             AC_MSG_NOTICE([no odfvalidator found, will download it])
7904             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7905             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7907             # and fetch name of odfvalidator jar name from download.lst
7908             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7909             AC_SUBST(ODFVALIDATOR_JAR)
7911             if test -z "$ODFVALIDATOR_JAR"; then
7912                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7913             fi
7914         fi
7915         if test "$build_os" = "cygwin"; then
7916             # In case of Cygwin it will be executed from Windows,
7917             # so we need to run bash and absolute path to validator
7918             # so instead of "odfvalidator" it will be
7919             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7920             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7921         else
7922             ODFVALIDATOR="sh $ODFVALIDATOR"
7923         fi
7924         AC_SUBST(ODFVALIDATOR)
7927         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7928         if test -z "$OFFICEOTRON"; then
7929             # remember to download the officeotron with validator later
7930             AC_MSG_NOTICE([no officeotron found, will download it])
7931             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7932             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7934             # and fetch name of officeotron jar name from download.lst
7935             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7936             AC_SUBST(OFFICEOTRON_JAR)
7938             if test -z "$OFFICEOTRON_JAR"; then
7939                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7940             fi
7941         else
7942             # check version of existing officeotron
7943             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7944             if test 0"$OFFICEOTRON_VER" -lt 704; then
7945                 AC_MSG_ERROR([officeotron too old])
7946             fi
7947         fi
7948         if test "$build_os" = "cygwin"; then
7949             # In case of Cygwin it will be executed from Windows,
7950             # so we need to run bash and absolute path to validator
7951             # so instead of "odfvalidator" it will be
7952             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7953             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7954         else
7955             OFFICEOTRON="sh $OFFICEOTRON"
7956         fi
7957     fi
7958     AC_SUBST(OFFICEOTRON)
7959 else
7960     AC_MSG_RESULT([no])
7963 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7964 if test "$with_bffvalidator" != "no"; then
7965     AC_DEFINE(HAVE_BFFVALIDATOR)
7967     if test "$with_export_validation" = "no"; then
7968         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7969     fi
7971     if test "$with_bffvalidator" = "yes"; then
7972         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7973     else
7974         BFFVALIDATOR="$with_bffvalidator"
7975     fi
7977     if test "$build_os" = "cygwin"; then
7978         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7979             AC_MSG_RESULT($BFFVALIDATOR)
7980         else
7981             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7982         fi
7983     elif test -n "$BFFVALIDATOR"; then
7984         # We are not in Cygwin but need to run Windows binary with wine
7985         AC_PATH_PROGS(WINE, wine)
7987         # so swap in a shell wrapper that converts paths transparently
7988         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7989         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7990         AC_SUBST(BFFVALIDATOR_EXE)
7991         AC_MSG_RESULT($BFFVALIDATOR)
7992     else
7993         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7994     fi
7995     AC_SUBST(BFFVALIDATOR)
7996 else
7997     AC_MSG_RESULT([no])
8000 dnl ===================================================================
8001 dnl Check for C preprocessor to use
8002 dnl ===================================================================
8003 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8004 if test -n "$with_idlc_cpp"; then
8005     AC_MSG_RESULT([$with_idlc_cpp])
8006     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8007 else
8008     AC_MSG_RESULT([ucpp])
8009     AC_MSG_CHECKING([which ucpp tp use])
8010     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8011         AC_MSG_RESULT([external])
8012         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8013     else
8014         AC_MSG_RESULT([internal])
8015         BUILD_TYPE="$BUILD_TYPE UCPP"
8016     fi
8018 AC_SUBST(SYSTEM_UCPP)
8020 dnl ===================================================================
8021 dnl Check for epm (not needed for Windows)
8022 dnl ===================================================================
8023 AC_MSG_CHECKING([whether to enable EPM for packing])
8024 if test "$enable_epm" = "yes"; then
8025     AC_MSG_RESULT([yes])
8026     if test "$_os" != "WINNT"; then
8027         if test $_os = Darwin; then
8028             EPM=internal
8029         elif test -n "$with_epm"; then
8030             EPM=$with_epm
8031         else
8032             AC_PATH_PROG(EPM, epm, no)
8033         fi
8034         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8035             AC_MSG_NOTICE([EPM will be built.])
8036             BUILD_TYPE="$BUILD_TYPE EPM"
8037             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8038         else
8039             # Gentoo has some epm which is something different...
8040             AC_MSG_CHECKING([whether the found epm is the right epm])
8041             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8042                 AC_MSG_RESULT([yes])
8043             else
8044                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8045             fi
8046             AC_MSG_CHECKING([epm version])
8047             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8048             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8049                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8050                 AC_MSG_RESULT([OK, >= 3.7])
8051             else
8052                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8053                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8054             fi
8055         fi
8056     fi
8058     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8059         AC_MSG_CHECKING([for rpm])
8060         for a in "$RPM" rpmbuild rpm; do
8061             $a --usage >/dev/null 2> /dev/null
8062             if test $? -eq 0; then
8063                 RPM=$a
8064                 break
8065             else
8066                 $a --version >/dev/null 2> /dev/null
8067                 if test $? -eq 0; then
8068                     RPM=$a
8069                     break
8070                 fi
8071             fi
8072         done
8073         if test -z "$RPM"; then
8074             AC_MSG_ERROR([not found])
8075         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8076             RPM_PATH=`which $RPM`
8077             AC_MSG_RESULT([$RPM_PATH])
8078             SCPDEFS="$SCPDEFS -DWITH_RPM"
8079         else
8080             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8081         fi
8082     fi
8083     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8084         AC_PATH_PROG(DPKG, dpkg, no)
8085         if test "$DPKG" = "no"; then
8086             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8087         fi
8088     fi
8089     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8090        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8091         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8092             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8093                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8094                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8095                     AC_MSG_RESULT([yes])
8096                 else
8097                     AC_MSG_RESULT([no])
8098                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8099                         _pt="rpm"
8100                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8101                         add_warning "the rpms will need to be installed with --nodeps"
8102                     else
8103                         _pt="pkg"
8104                     fi
8105                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8106                     add_warning "the ${_pt}s will not be relocatable"
8107                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8108                                  relocation will work, you need to patch your epm with the
8109                                  patch in epm/epm-3.7.patch or build with
8110                                  --with-epm=internal which will build a suitable epm])
8111                 fi
8112             fi
8113         fi
8114     fi
8115     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8116         AC_PATH_PROG(PKGMK, pkgmk, no)
8117         if test "$PKGMK" = "no"; then
8118             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8119         fi
8120     fi
8121     AC_SUBST(RPM)
8122     AC_SUBST(DPKG)
8123     AC_SUBST(PKGMK)
8124 else
8125     for i in $PKGFORMAT; do
8126         case "$i" in
8127         aix | bsd | deb | pkg | rpm | native | portable)
8128             AC_MSG_ERROR(
8129                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8130             ;;
8131         esac
8132     done
8133     AC_MSG_RESULT([no])
8134     EPM=NO
8136 AC_SUBST(EPM)
8138 ENABLE_LWP=
8139 if test "$enable_lotuswordpro" = "yes"; then
8140     ENABLE_LWP="TRUE"
8142 AC_SUBST(ENABLE_LWP)
8144 dnl ===================================================================
8145 dnl Check for building ODK
8146 dnl ===================================================================
8147 if test "$enable_odk" = no; then
8148     unset DOXYGEN
8149 else
8150     if test "$with_doxygen" = no; then
8151         AC_MSG_CHECKING([for doxygen])
8152         unset DOXYGEN
8153         AC_MSG_RESULT([no])
8154     else
8155         if test "$with_doxygen" = yes; then
8156             AC_PATH_PROG([DOXYGEN], [doxygen])
8157             if test -z "$DOXYGEN"; then
8158                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8159             fi
8160             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8161                 if ! dot -V 2>/dev/null; then
8162                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8163                 fi
8164             fi
8165         else
8166             AC_MSG_CHECKING([for doxygen])
8167             DOXYGEN=$with_doxygen
8168             AC_MSG_RESULT([$DOXYGEN])
8169         fi
8170         if test -n "$DOXYGEN"; then
8171             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8172             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8173             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8174                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8175             fi
8176         fi
8177     fi
8179 AC_SUBST([DOXYGEN])
8181 AC_MSG_CHECKING([whether to build the ODK])
8182 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8183     AC_MSG_RESULT([yes])
8185     if test "$with_java" != "no"; then
8186         AC_MSG_CHECKING([whether to build unowinreg.dll])
8187         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8188             # build on Win by default
8189             enable_build_unowinreg=yes
8190         fi
8191         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8192             AC_MSG_RESULT([no])
8193             BUILD_UNOWINREG=
8194         else
8195             AC_MSG_RESULT([yes])
8196             BUILD_UNOWINREG=TRUE
8197         fi
8198         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8199             if test -z "$with_mingw_cross_compiler"; then
8200                 dnl Guess...
8201                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8202             elif test -x "$with_mingw_cross_compiler"; then
8203                  MINGWCXX="$with_mingw_cross_compiler"
8204             else
8205                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8206             fi
8208             if test "$MINGWCXX" = "false"; then
8209                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8210             fi
8212             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8213             if test -x "$mingwstrip_test"; then
8214                 MINGWSTRIP="$mingwstrip_test"
8215             else
8216                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8217             fi
8219             if test "$MINGWSTRIP" = "false"; then
8220                 AC_MSG_ERROR(MinGW32 binutils not found.)
8221             fi
8222         fi
8223     fi
8224     BUILD_TYPE="$BUILD_TYPE ODK"
8225 else
8226     AC_MSG_RESULT([no])
8227     BUILD_UNOWINREG=
8229 AC_SUBST(BUILD_UNOWINREG)
8230 AC_SUBST(MINGWCXX)
8231 AC_SUBST(MINGWSTRIP)
8233 dnl ===================================================================
8234 dnl Check for system zlib
8235 dnl ===================================================================
8236 if test "$with_system_zlib" = "auto"; then
8237     case "$_os" in
8238     WINNT)
8239         with_system_zlib="$with_system_libs"
8240         ;;
8241     *)
8242         if test "$enable_fuzzers" != "yes"; then
8243             with_system_zlib=yes
8244         else
8245             with_system_zlib=no
8246         fi
8247         ;;
8248     esac
8251 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8252 dnl and has no pkg-config for it at least on some tinderboxes,
8253 dnl so leaving that out for now
8254 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8255 AC_MSG_CHECKING([which zlib to use])
8256 if test "$with_system_zlib" = "yes"; then
8257     AC_MSG_RESULT([external])
8258     SYSTEM_ZLIB=TRUE
8259     AC_CHECK_HEADER(zlib.h, [],
8260         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8261     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8262         [AC_MSG_ERROR(zlib not found or functional)], [])
8263 else
8264     AC_MSG_RESULT([internal])
8265     SYSTEM_ZLIB=
8266     BUILD_TYPE="$BUILD_TYPE ZLIB"
8267     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8268     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8270 AC_SUBST(ZLIB_CFLAGS)
8271 AC_SUBST(ZLIB_LIBS)
8272 AC_SUBST(SYSTEM_ZLIB)
8274 dnl ===================================================================
8275 dnl Check for system jpeg
8276 dnl ===================================================================
8277 AC_MSG_CHECKING([which libjpeg to use])
8278 if test "$with_system_jpeg" = "yes"; then
8279     AC_MSG_RESULT([external])
8280     SYSTEM_LIBJPEG=TRUE
8281     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8282         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8283     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8284         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8285 else
8286     SYSTEM_LIBJPEG=
8287     AC_MSG_RESULT([internal, libjpeg-turbo])
8288     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8289     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8290     if test "$COM" = "MSC"; then
8291         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8292     else
8293         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8294     fi
8296     case "$host_cpu" in
8297     x86_64 | amd64 | i*86 | x86 | ia32)
8298         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8299         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8300             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8301                 NASM="$LODE_HOME/opt/bin/nasm"
8302             elif test -x "/opt/lo/bin/nasm"; then
8303                 NASM="/opt/lo/bin/nasm"
8304             fi
8305         fi
8307         if test -n "$NASM"; then
8308             AC_MSG_CHECKING([for object file format of host system])
8309             case "$host_os" in
8310               cygwin* | mingw* | pw32* | interix*)
8311                 case "$host_cpu" in
8312                   x86_64)
8313                     objfmt='Win64-COFF'
8314                     ;;
8315                   *)
8316                     objfmt='Win32-COFF'
8317                     ;;
8318                 esac
8319               ;;
8320               msdosdjgpp* | go32*)
8321                 objfmt='COFF'
8322               ;;
8323               os2-emx*) # not tested
8324                 objfmt='MSOMF' # obj
8325               ;;
8326               linux*coff* | linux*oldld*)
8327                 objfmt='COFF' # ???
8328               ;;
8329               linux*aout*)
8330                 objfmt='a.out'
8331               ;;
8332               linux*)
8333                 case "$host_cpu" in
8334                   x86_64)
8335                     objfmt='ELF64'
8336                     ;;
8337                   *)
8338                     objfmt='ELF'
8339                     ;;
8340                 esac
8341               ;;
8342               kfreebsd* | freebsd* | netbsd* | openbsd*)
8343                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8344                   objfmt='BSD-a.out'
8345                 else
8346                   case "$host_cpu" in
8347                     x86_64 | amd64)
8348                       objfmt='ELF64'
8349                       ;;
8350                     *)
8351                       objfmt='ELF'
8352                       ;;
8353                   esac
8354                 fi
8355               ;;
8356               solaris* | sunos* | sysv* | sco*)
8357                 case "$host_cpu" in
8358                   x86_64)
8359                     objfmt='ELF64'
8360                     ;;
8361                   *)
8362                     objfmt='ELF'
8363                     ;;
8364                 esac
8365               ;;
8366               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8367                 case "$host_cpu" in
8368                   x86_64)
8369                     objfmt='Mach-O64'
8370                     ;;
8371                   *)
8372                     objfmt='Mach-O'
8373                     ;;
8374                 esac
8375               ;;
8376               *)
8377                 objfmt='ELF ?'
8378               ;;
8379             esac
8381             AC_MSG_RESULT([$objfmt])
8382             if test "$objfmt" = 'ELF ?'; then
8383               objfmt='ELF'
8384               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8385             fi
8387             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8388             case "$objfmt" in
8389               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8390               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8391               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8392               COFF)       NAFLAGS='-fcoff -DCOFF';;
8393               a.out)      NAFLAGS='-faout -DAOUT';;
8394               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8395               ELF)        NAFLAGS='-felf -DELF';;
8396               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8397               RDF)        NAFLAGS='-frdf -DRDF';;
8398               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8399               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8400             esac
8401             AC_MSG_RESULT([$NAFLAGS])
8403             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8404             cat > conftest.asm << EOF
8405             [%line __oline__ "configure"
8406                     section .text
8407                     global  _main,main
8408             _main:
8409             main:   xor     eax,eax
8410                     ret
8411             ]
8413             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8414             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8415               AC_MSG_RESULT(yes)
8416             else
8417               echo "configure: failed program was:" >&AC_FD_CC
8418               cat conftest.asm >&AC_FD_CC
8419               rm -rf conftest*
8420               AC_MSG_RESULT(no)
8421               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8422               NASM=""
8423             fi
8425         fi
8427         if test -z "$NASM"; then
8428 cat << _EOS
8429 ****************************************************************************
8430 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8431 To get one please:
8433 _EOS
8434             if test "$build_os" = "cygwin"; then
8435 cat << _EOS
8436 install a pre-compiled binary for Win32
8438 mkdir -p /opt/lo/bin
8439 cd /opt/lo/bin
8440 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8441 chmod +x nasm
8443 or get and install one from http://www.nasm.us/
8445 Then re-run autogen.sh
8447 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8448 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8450 _EOS
8451             else
8452 cat << _EOS
8453 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8455 _EOS
8456             fi
8457             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8458             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8459         fi
8460       ;;
8461     esac
8464 AC_SUBST(NASM)
8465 AC_SUBST(LIBJPEG_CFLAGS)
8466 AC_SUBST(LIBJPEG_LIBS)
8467 AC_SUBST(SYSTEM_LIBJPEG)
8469 dnl ===================================================================
8470 dnl Check for system clucene
8471 dnl ===================================================================
8472 dnl we should rather be using
8473 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8474 dnl but the contribs-lib check seems tricky
8475 AC_MSG_CHECKING([which clucene to use])
8476 if test "$with_system_clucene" = "yes"; then
8477     AC_MSG_RESULT([external])
8478     SYSTEM_CLUCENE=TRUE
8479     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8480     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8481     FilterLibs "${CLUCENE_LIBS}"
8482     CLUCENE_LIBS="${filteredlibs}"
8483     AC_LANG_PUSH([C++])
8484     save_CXXFLAGS=$CXXFLAGS
8485     save_CPPFLAGS=$CPPFLAGS
8486     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8487     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8488     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8489     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8490     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8491                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8492     CXXFLAGS=$save_CXXFLAGS
8493     CPPFLAGS=$save_CPPFLAGS
8494     AC_LANG_POP([C++])
8496     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8497 else
8498     AC_MSG_RESULT([internal])
8499     SYSTEM_CLUCENE=
8500     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8502 AC_SUBST(SYSTEM_CLUCENE)
8503 AC_SUBST(CLUCENE_CFLAGS)
8504 AC_SUBST(CLUCENE_LIBS)
8506 dnl ===================================================================
8507 dnl Check for system expat
8508 dnl ===================================================================
8509 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8511 dnl ===================================================================
8512 dnl Check for system xmlsec
8513 dnl ===================================================================
8514 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8516 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8517 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8518     ENABLE_EOT="TRUE"
8519     AC_DEFINE([ENABLE_EOT])
8520     AC_MSG_RESULT([yes])
8522     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8523 else
8524     ENABLE_EOT=
8525     AC_MSG_RESULT([no])
8527 AC_SUBST([ENABLE_EOT])
8529 dnl ===================================================================
8530 dnl Check for DLP libs
8531 dnl ===================================================================
8532 AS_IF([test "$COM" = "MSC"],
8533       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8534       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8536 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8538 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8540 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8542 AS_IF([test "$COM" = "MSC"],
8543       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8544       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8546 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8548 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8550 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8551 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8553 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8555 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8557 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8559 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8560 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8562 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8563 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
8565 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8567 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8568 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8570 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8572 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8574 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8576 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8578 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8579 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8581 dnl ===================================================================
8582 dnl Check for system lcms2
8583 dnl ===================================================================
8584 if test "$with_system_lcms2" != "yes"; then
8585     SYSTEM_LCMS2=
8587 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8588 if test "$GCC" = "yes"; then
8589     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8591 if test "$COM" = "MSC"; then # override the above
8592     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8595 dnl ===================================================================
8596 dnl Check for system cppunit
8597 dnl ===================================================================
8598 if test "$_os" != "Android" ; then
8599     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8602 dnl ===================================================================
8603 dnl Check whether freetype is available
8604 dnl ===================================================================
8605 if test  "$test_freetype" = "yes"; then
8606     AC_MSG_CHECKING([whether freetype is available])
8607     # FreeType has 3 different kinds of versions
8608     # * release, like 2.4.10
8609     # * libtool, like 13.0.7 (this what pkg-config returns)
8610     # * soname
8611     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8612     #
8613     # 9.9.3 is 2.2.0
8614     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8615     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8616     FilterLibs "${FREETYPE_LIBS}"
8617     FREETYPE_LIBS="${filteredlibs}"
8618     SYSTEM_FREETYPE=TRUE
8619 else
8620     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8621     if test "x$ac_config_site_64bit_host" = xYES; then
8622         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8623     else
8624         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8625     fi
8627 AC_SUBST(FREETYPE_CFLAGS)
8628 AC_SUBST(FREETYPE_LIBS)
8629 AC_SUBST([SYSTEM_FREETYPE])
8631 # ===================================================================
8632 # Check for system libxslt
8633 # to prevent incompatibilities between internal libxml2 and external libxslt,
8634 # or vice versa, use with_system_libxml here
8635 # ===================================================================
8636 if test "$with_system_libxml" = "auto"; then
8637     case "$_os" in
8638     WINNT|iOS|Android)
8639         with_system_libxml="$with_system_libs"
8640         ;;
8641     *)
8642         if test "$enable_fuzzers" != "yes"; then
8643             with_system_libxml=yes
8644         else
8645             with_system_libxml=no
8646         fi
8647         ;;
8648     esac
8651 AC_MSG_CHECKING([which libxslt to use])
8652 if test "$with_system_libxml" = "yes"; then
8653     AC_MSG_RESULT([external])
8654     SYSTEM_LIBXSLT=TRUE
8655     if test "$_os" = "Darwin"; then
8656         dnl make sure to use SDK path
8657         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8658         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8659         dnl omit -L/usr/lib
8660         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8661         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8662     else
8663         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8664         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8665         FilterLibs "${LIBXSLT_LIBS}"
8666         LIBXSLT_LIBS="${filteredlibs}"
8667         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8668         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8669         FilterLibs "${LIBEXSLT_LIBS}"
8670         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8671     fi
8673     dnl Check for xsltproc
8674     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8675     if test "$XSLTPROC" = "no"; then
8676         AC_MSG_ERROR([xsltproc is required])
8677     fi
8678 else
8679     AC_MSG_RESULT([internal])
8680     SYSTEM_LIBXSLT=
8681     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8683     if test "$cross_compiling" = "yes"; then
8684         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8685         if test "$XSLTPROC" = "no"; then
8686             AC_MSG_ERROR([xsltproc is required])
8687         fi
8688     fi
8690 AC_SUBST(SYSTEM_LIBXSLT)
8691 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8692     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8694 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8696 AC_SUBST(LIBEXSLT_CFLAGS)
8697 AC_SUBST(LIBEXSLT_LIBS)
8698 AC_SUBST(LIBXSLT_CFLAGS)
8699 AC_SUBST(LIBXSLT_LIBS)
8700 AC_SUBST(XSLTPROC)
8702 # ===================================================================
8703 # Check for system libxml
8704 # ===================================================================
8705 AC_MSG_CHECKING([which libxml to use])
8706 if test "$with_system_libxml" = "yes"; then
8707     AC_MSG_RESULT([external])
8708     SYSTEM_LIBXML=TRUE
8709     if test "$_os" = "Darwin"; then
8710         dnl make sure to use SDK path
8711         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8712         dnl omit -L/usr/lib
8713         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8714     elif test $_os = iOS; then
8715         dnl make sure to use SDK path
8716         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8717         LIBXML_CFLAGS="-I$usr/include/libxml2"
8718         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8719     else
8720         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8721         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8722         FilterLibs "${LIBXML_LIBS}"
8723         LIBXML_LIBS="${filteredlibs}"
8724     fi
8726     dnl Check for xmllint
8727     AC_PATH_PROG(XMLLINT, xmllint, no)
8728     if test "$XMLLINT" = "no"; then
8729         AC_MSG_ERROR([xmllint is required])
8730     fi
8731 else
8732     AC_MSG_RESULT([internal])
8733     SYSTEM_LIBXML=
8734     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8735     if test "$COM" = "MSC"; then
8736         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8737     fi
8738     if test "$COM" = "MSC"; then
8739         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8740     else
8741         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8742     fi
8743     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8745 AC_SUBST(SYSTEM_LIBXML)
8746 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8747     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8749 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8750 AC_SUBST(LIBXML_CFLAGS)
8751 AC_SUBST(LIBXML_LIBS)
8752 AC_SUBST(XMLLINT)
8754 # =====================================================================
8755 # Checking for a Python interpreter with version >= 2.7.
8756 # Build and runtime requires Python 3 compatible version (>= 2.7).
8757 # Optionally user can pass an option to configure, i. e.
8758 # ./configure PYTHON=/usr/bin/python
8759 # =====================================================================
8760 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8761     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
8762     enable_python=internal
8764 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8765     if test -n "$PYTHON"; then
8766         PYTHON_FOR_BUILD=$PYTHON
8767     else
8768         # This allows a lack of system python with no error, we use internal one in that case.
8769         AM_PATH_PYTHON([2.7],, [:])
8770         # Clean PYTHON_VERSION checked below if cross-compiling
8771         PYTHON_VERSION=""
8772         if test "$PYTHON" != ":"; then
8773             PYTHON_FOR_BUILD=$PYTHON
8774         fi
8775     fi
8777 AC_SUBST(PYTHON_FOR_BUILD)
8779 # Checks for Python to use for Pyuno
8780 AC_MSG_CHECKING([which Python to use for Pyuno])
8781 case "$enable_python" in
8782 no|disable)
8783     if test -z $PYTHON_FOR_BUILD; then
8784         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8785         # requirement from the choice whether to include Python stuff in the installer, but why
8786         # bother?
8787         AC_MSG_ERROR([Python is required at build time.])
8788     fi
8789     enable_python=no
8790     AC_MSG_RESULT([none])
8791     ;;
8792 ""|yes|auto)
8793     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8794         AC_MSG_RESULT([no, overridden by --disable-scripting])
8795         enable_python=no
8796     elif test $build_os = cygwin; then
8797         dnl When building on Windows we don't attempt to use any installed
8798         dnl "system"  Python.
8799         AC_MSG_RESULT([fully internal])
8800         enable_python=internal
8801     elif test "$cross_compiling" = yes; then
8802         AC_MSG_RESULT([system])
8803         enable_python=system
8804     else
8805         # Unset variables set by the above AM_PATH_PYTHON so that
8806         # we actually do check anew.
8807         AC_MSG_RESULT([])
8808         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
8809         AM_PATH_PYTHON([3.3],, [:])
8810         AC_MSG_CHECKING([which Python to use for Pyuno])
8811         if test "$PYTHON" = ":"; then
8812             if test -z "$PYTHON_FOR_BUILD"; then
8813                 AC_MSG_RESULT([fully internal])
8814             else
8815                 AC_MSG_RESULT([internal])
8816             fi
8817             enable_python=internal
8818         else
8819             AC_MSG_RESULT([system])
8820             enable_python=system
8821         fi
8822     fi
8823     ;;
8824 internal)
8825     AC_MSG_RESULT([internal])
8826     ;;
8827 fully-internal)
8828     AC_MSG_RESULT([fully internal])
8829     enable_python=internal
8830     ;;
8831 system)
8832     AC_MSG_RESULT([system])
8833     if test "$_os" = Darwin; then
8834         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])
8835     fi
8836     ;;
8838     AC_MSG_ERROR([Incorrect --enable-python option])
8839     ;;
8840 esac
8842 if test $enable_python != no; then
8843     BUILD_TYPE="$BUILD_TYPE PYUNO"
8846 if test $enable_python = system; then
8847     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8848         # Fallback: Accept these in the environment, or as set above
8849         # for MacOSX.
8850         :
8851     elif test "$cross_compiling" != yes; then
8852         # Unset variables set by the above AM_PATH_PYTHON so that
8853         # we actually do check anew.
8854         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
8855         # This causes an error if no python command is found
8856         AM_PATH_PYTHON([3.3])
8857         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8858         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8859         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8860         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8861         if test -z "$PKG_CONFIG"; then
8862             PYTHON_CFLAGS="-I$python_include"
8863             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8864         elif $PKG_CONFIG --exists python-$python_version-embed; then
8865             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8866             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8867         elif $PKG_CONFIG --exists python-$python_version; then
8868             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8869             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8870         else
8871             PYTHON_CFLAGS="-I$python_include"
8872             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8873         fi
8874         FilterLibs "${PYTHON_LIBS}"
8875         PYTHON_LIBS="${filteredlibs}"
8876     else
8877         dnl How to find out the cross-compilation Python installation path?
8878         AC_MSG_CHECKING([for python version])
8879         AS_IF([test -n "$PYTHON_VERSION"],
8880               [AC_MSG_RESULT([$PYTHON_VERSION])],
8881               [AC_MSG_RESULT([not found])
8882                AC_MSG_ERROR([no usable python found])])
8883         test -n "$PYTHON_CFLAGS" && break
8884     fi
8886     dnl Check if the headers really work
8887     save_CPPFLAGS="$CPPFLAGS"
8888     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8889     AC_CHECK_HEADER(Python.h)
8890     CPPFLAGS="$save_CPPFLAGS"
8892     # let the PYTHON_FOR_BUILD match the same python installation that
8893     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8894     # better for PythonTests.
8895     PYTHON_FOR_BUILD=$PYTHON
8898 if test "$with_lxml" != no; then
8899     if test -z "$PYTHON_FOR_BUILD"; then
8900         case $build_os in
8901             cygwin)
8902                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8903                 ;;
8904             *)
8905                 if test "$cross_compiling" != yes ; then
8906                     BUILD_TYPE="$BUILD_TYPE LXML"
8907                 fi
8908                 ;;
8909         esac
8910     else
8911         AC_MSG_CHECKING([for python lxml])
8912         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8913             AC_MSG_RESULT([yes])
8914         else
8915             case $build_os in
8916                 cygwin)
8917                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8918                     ;;
8919                 *)
8920                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8921                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8922                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8923                         else
8924                             BUILD_TYPE="$BUILD_TYPE LXML"
8925                             AC_MSG_RESULT([no, using internal lxml])
8926                         fi
8927                     else
8928                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8929                     fi
8930                     ;;
8931             esac
8932         fi
8933     fi
8936 dnl By now enable_python should be "system", "internal" or "no"
8937 case $enable_python in
8938 system)
8939     SYSTEM_PYTHON=TRUE
8941     if test "x$ac_cv_header_Python_h" != "xyes"; then
8942        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8943     fi
8945     AC_LANG_PUSH(C)
8946     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8947     AC_MSG_CHECKING([for correct python library version])
8948        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8949 #include <Python.h>
8951 int main(int argc, char **argv) {
8952    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8953        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8954    else return 1;
8956        ]])],[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])])
8957     CFLAGS=$save_CFLAGS
8958     AC_LANG_POP(C)
8960     dnl FIXME Check if the Python library can be linked with, too?
8961     ;;
8963 internal)
8964     SYSTEM_PYTHON=
8965     PYTHON_VERSION_MAJOR=3
8966     PYTHON_VERSION_MINOR=7
8967     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
8968     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8969         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8970     fi
8971     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"3.7.7"])
8972     BUILD_TYPE="$BUILD_TYPE PYTHON"
8973     if test "$OS" = LINUX; then
8974         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8975     fi
8976     # Embedded Python dies without Home set
8977     if test "$HOME" = ""; then
8978         export HOME=""
8979     fi
8980     ;;
8982     DISABLE_PYTHON=TRUE
8983     SYSTEM_PYTHON=
8984     ;;
8986     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8987     ;;
8988 esac
8990 AC_SUBST(DISABLE_PYTHON)
8991 AC_SUBST(SYSTEM_PYTHON)
8992 AC_SUBST(PYTHON_CFLAGS)
8993 AC_SUBST(PYTHON_LIBS)
8994 AC_SUBST(PYTHON_VERSION)
8995 AC_SUBST(PYTHON_VERSION_MAJOR)
8996 AC_SUBST(PYTHON_VERSION_MINOR)
8998 ENABLE_MARIADBC=TRUE
8999 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9000     ENABLE_MARIADBC=
9002 MARIADBC_MAJOR=1
9003 MARIADBC_MINOR=0
9004 MARIADBC_MICRO=2
9005 if test "$ENABLE_MARIADBC" = "TRUE"; then
9006     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9009 AC_SUBST(ENABLE_MARIADBC)
9010 AC_SUBST(MARIADBC_MAJOR)
9011 AC_SUBST(MARIADBC_MINOR)
9012 AC_SUBST(MARIADBC_MICRO)
9014 if test "$ENABLE_MARIADBC" = "TRUE"; then
9015     dnl ===================================================================
9016     dnl Check for system MariaDB
9017     dnl ===================================================================
9018     AC_MSG_CHECKING([which MariaDB to use])
9019     if test "$with_system_mariadb" = "yes"; then
9020         AC_MSG_RESULT([external])
9021         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9022         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9023         if test -z "$MARIADBCONFIG"; then
9024             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9025             if test -z "$MARIADBCONFIG"; then
9026                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9027                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9028             fi
9029         fi
9030         AC_MSG_CHECKING([MariaDB version])
9031         MARIADB_VERSION=`$MARIADBCONFIG --version`
9032         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9033         if test "$MARIADB_MAJOR" -ge "5"; then
9034             AC_MSG_RESULT([OK])
9035         else
9036             AC_MSG_ERROR([too old, use 5.0.x or later])
9037         fi
9038         AC_MSG_CHECKING([for MariaDB Client library])
9039         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9040         if test "$COM_IS_CLANG" = TRUE; then
9041             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9042         fi
9043         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9044         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9045         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9046         dnl linux32:
9047         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9048             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9049             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9050                 | sed -e 's|/lib64/|/lib/|')
9051         fi
9052         FilterLibs "${MARIADB_LIBS}"
9053         MARIADB_LIBS="${filteredlibs}"
9054         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9055         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9056         if test "$enable_bundle_mariadb" = "yes"; then
9057             AC_MSG_RESULT([yes])
9058             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9059             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9061 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9063 /g' | grep -E '(mysqlclient|mariadb)')
9064             if test "$_os" = "Darwin"; then
9065                 LIBMARIADB=${LIBMARIADB}.dylib
9066             elif test "$_os" = "WINNT"; then
9067                 LIBMARIADB=${LIBMARIADB}.dll
9068             else
9069                 LIBMARIADB=${LIBMARIADB}.so
9070             fi
9071             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9072             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9073             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9074                 AC_MSG_RESULT([found.])
9075                 PathFormat "$LIBMARIADB_PATH"
9076                 LIBMARIADB_PATH="$formatted_path"
9077             else
9078                 AC_MSG_ERROR([not found.])
9079             fi
9080         else
9081             AC_MSG_RESULT([no])
9082             BUNDLE_MARIADB_CONNECTOR_C=
9083         fi
9084     else
9085         AC_MSG_RESULT([internal])
9086         SYSTEM_MARIADB_CONNECTOR_C=
9087         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9088         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9089         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9090     fi
9092     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9093     AC_SUBST(MARIADB_CFLAGS)
9094     AC_SUBST(MARIADB_LIBS)
9095     AC_SUBST(LIBMARIADB)
9096     AC_SUBST(LIBMARIADB_PATH)
9097     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9100 dnl ===================================================================
9101 dnl Check for system hsqldb
9102 dnl ===================================================================
9103 if test "$with_java" != "no"; then
9104     HSQLDB_USE_JDBC_4_1=
9105     AC_MSG_CHECKING([which hsqldb to use])
9106     if test "$with_system_hsqldb" = "yes"; then
9107         AC_MSG_RESULT([external])
9108         SYSTEM_HSQLDB=TRUE
9109         if test -z $HSQLDB_JAR; then
9110             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9111         fi
9112         if ! test -f $HSQLDB_JAR; then
9113                AC_MSG_ERROR(hsqldb.jar not found.)
9114         fi
9115         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9116         export HSQLDB_JAR
9117         if $PERL -e \
9118            'use Archive::Zip;
9119             my $file = "$ENV{'HSQLDB_JAR'}";
9120             my $zip = Archive::Zip->new( $file );
9121             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9122             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9123             {
9124                 push @l, split(/\n/, $mf);
9125                 foreach my $line (@l)
9126                 {
9127                     if ($line =~ m/Specification-Version:/)
9128                     {
9129                         ($t, $version) = split (/:/,$line);
9130                         $version =~ s/^\s//;
9131                         ($a, $b, $c, $d) = split (/\./,$version);
9132                         if ($c == "0" && $d > "8")
9133                         {
9134                             exit 0;
9135                         }
9136                         else
9137                         {
9138                             exit 1;
9139                         }
9140                     }
9141                 }
9142             }
9143             else
9144             {
9145                 exit 1;
9146             }'; then
9147             AC_MSG_RESULT([yes])
9148         else
9149             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9150         fi
9151     else
9152         AC_MSG_RESULT([internal])
9153         SYSTEM_HSQLDB=
9154         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9155         NEED_ANT=TRUE
9156         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9157         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9158         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9159             AC_MSG_RESULT([yes])
9160             HSQLDB_USE_JDBC_4_1=TRUE
9161         else
9162             AC_MSG_RESULT([no])
9163         fi
9164     fi
9165     AC_SUBST(SYSTEM_HSQLDB)
9166     AC_SUBST(HSQLDB_JAR)
9167     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9170 dnl ===================================================================
9171 dnl Check for PostgreSQL stuff
9172 dnl ===================================================================
9173 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9174 if test "x$enable_postgresql_sdbc" != "xno"; then
9175     AC_MSG_RESULT([yes])
9176     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9178     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9179         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9180     fi
9181     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9182         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9183     fi
9185     postgres_interface=""
9186     if test "$with_system_postgresql" = "yes"; then
9187         postgres_interface="external PostgreSQL"
9188         SYSTEM_POSTGRESQL=TRUE
9189         if test "$_os" = Darwin; then
9190             supp_path=''
9191             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9192                 pg_supp_path="$P_SEP$d$pg_supp_path"
9193             done
9194         fi
9195         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9196         if test -n "$PGCONFIG"; then
9197             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9198             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9199         else
9200             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9201               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9202               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9203             ],[
9204               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9205             ])
9206         fi
9207         FilterLibs "${POSTGRESQL_LIB}"
9208         POSTGRESQL_LIB="${filteredlibs}"
9209     else
9210         # if/when anything else than PostgreSQL uses Kerberos,
9211         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9212         WITH_KRB5=
9213         WITH_GSSAPI=
9214         case "$_os" in
9215         Darwin)
9216             # macOS has system MIT Kerberos 5 since 10.4
9217             if test "$with_krb5" != "no"; then
9218                 WITH_KRB5=TRUE
9219                 save_LIBS=$LIBS
9220                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9221                 # that the libraries where these functions are located on macOS will change, is it?
9222                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9223                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9224                 KRB5_LIBS=$LIBS
9225                 LIBS=$save_LIBS
9226                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9227                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9228                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9229                 LIBS=$save_LIBS
9230             fi
9231             if test "$with_gssapi" != "no"; then
9232                 WITH_GSSAPI=TRUE
9233                 save_LIBS=$LIBS
9234                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9235                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9236                 GSSAPI_LIBS=$LIBS
9237                 LIBS=$save_LIBS
9238             fi
9239             ;;
9240         WINNT)
9241             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9242                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9243             fi
9244             ;;
9245         Linux|GNU|*BSD|DragonFly)
9246             if test "$with_krb5" != "no"; then
9247                 WITH_KRB5=TRUE
9248                 save_LIBS=$LIBS
9249                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9250                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9251                 KRB5_LIBS=$LIBS
9252                 LIBS=$save_LIBS
9253                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9254                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9255                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9256                 LIBS=$save_LIBS
9257             fi
9258             if test "$with_gssapi" != "no"; then
9259                 WITH_GSSAPI=TRUE
9260                 save_LIBS=$LIBS
9261                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9262                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9263                 GSSAPI_LIBS=$LIBS
9264                 LIBS=$save_LIBS
9265             fi
9266             ;;
9267         *)
9268             if test "$with_krb5" = "yes"; then
9269                 WITH_KRB5=TRUE
9270                 save_LIBS=$LIBS
9271                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9272                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9273                 KRB5_LIBS=$LIBS
9274                 LIBS=$save_LIBS
9275                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9276                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9277                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9278                 LIBS=$save_LIBS
9279             fi
9280             if test "$with_gssapi" = "yes"; then
9281                 WITH_GSSAPI=TRUE
9282                 save_LIBS=$LIBS
9283                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9284                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9285                 LIBS=$save_LIBS
9286                 GSSAPI_LIBS=$LIBS
9287             fi
9288         esac
9290         if test -n "$with_libpq_path"; then
9291             SYSTEM_POSTGRESQL=TRUE
9292             postgres_interface="external libpq"
9293             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9294             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9295         else
9296             SYSTEM_POSTGRESQL=
9297             postgres_interface="internal"
9298             POSTGRESQL_LIB=""
9299             POSTGRESQL_INC="%OVERRIDE_ME%"
9300             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9301         fi
9302     fi
9304     AC_MSG_CHECKING([PostgreSQL C interface])
9305     AC_MSG_RESULT([$postgres_interface])
9307     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9308         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9309         save_CFLAGS=$CFLAGS
9310         save_CPPFLAGS=$CPPFLAGS
9311         save_LIBS=$LIBS
9312         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9313         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9314         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9315         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9316             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9317         CFLAGS=$save_CFLAGS
9318         CPPFLAGS=$save_CPPFLAGS
9319         LIBS=$save_LIBS
9320     fi
9321     BUILD_POSTGRESQL_SDBC=TRUE
9322 else
9323     AC_MSG_RESULT([no])
9325 AC_SUBST(WITH_KRB5)
9326 AC_SUBST(WITH_GSSAPI)
9327 AC_SUBST(GSSAPI_LIBS)
9328 AC_SUBST(KRB5_LIBS)
9329 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9330 AC_SUBST(SYSTEM_POSTGRESQL)
9331 AC_SUBST(POSTGRESQL_INC)
9332 AC_SUBST(POSTGRESQL_LIB)
9334 dnl ===================================================================
9335 dnl Check for Firebird stuff
9336 dnl ===================================================================
9337 ENABLE_FIREBIRD_SDBC=
9338 if test "$enable_firebird_sdbc" = "yes" ; then
9339     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9341     dnl ===================================================================
9342     dnl Check for system Firebird
9343     dnl ===================================================================
9344     AC_MSG_CHECKING([which Firebird to use])
9345     if test "$with_system_firebird" = "yes"; then
9346         AC_MSG_RESULT([external])
9347         SYSTEM_FIREBIRD=TRUE
9348         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9349         if test -z "$FIREBIRDCONFIG"; then
9350             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9351             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9352                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9353             ])
9354             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9355         else
9356             AC_MSG_NOTICE([fb_config found])
9357             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9358             AC_MSG_CHECKING([for Firebird Client library])
9359             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9360             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9361             FilterLibs "${FIREBIRD_LIBS}"
9362             FIREBIRD_LIBS="${filteredlibs}"
9363         fi
9364         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9365         AC_MSG_CHECKING([Firebird version])
9366         if test -n "${FIREBIRD_VERSION}"; then
9367             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9368             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9369             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9370                 AC_MSG_RESULT([OK])
9371             else
9372                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9373             fi
9374         else
9375             __save_CFLAGS="${CFLAGS}"
9376             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9377             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9378 #if defined(FB_API_VER) && FB_API_VER == 30
9379 int fb_api_is_30(void) { return 0; }
9380 #else
9381 #error "Wrong Firebird API version"
9382 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9383             CFLAGS="${__save_CFLAGS}"
9384         fi
9385         ENABLE_FIREBIRD_SDBC=TRUE
9386         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9387     elif test "$enable_database_connectivity" != yes; then
9388         AC_MSG_RESULT([none])
9389     elif test "$cross_compiling" = "yes"; then
9390         AC_MSG_RESULT([none])
9391     else
9392         dnl Embedded Firebird has version 3.0
9393         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9394         dnl We need libatomic_ops for any non X86/X64 system
9395         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9396             dnl ===================================================================
9397             dnl Check for system libatomic_ops
9398             dnl ===================================================================
9399             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9400             if test "$with_system_libatomic_ops" = "yes"; then
9401                 SYSTEM_LIBATOMIC_OPS=TRUE
9402                 AC_CHECK_HEADERS(atomic_ops.h, [],
9403                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9404             else
9405                 SYSTEM_LIBATOMIC_OPS=
9406                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9407                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9408                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9409             fi
9410         fi
9412         AC_MSG_RESULT([internal])
9413         SYSTEM_FIREBIRD=
9414         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9415         FIREBIRD_LIBS="-lfbclient"
9417         if test "$with_system_libtommath" = "yes"; then
9418             SYSTEM_LIBTOMMATH=TRUE
9419             dnl check for tommath presence
9420             save_LIBS=$LIBS
9421             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9422             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9423             LIBS=$save_LIBS
9424         else
9425             SYSTEM_LIBTOMMATH=
9426             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9427             LIBTOMMATH_LIBS="-ltommath"
9428             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9429         fi
9431         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9432         ENABLE_FIREBIRD_SDBC=TRUE
9433         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9434     fi
9436 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9437 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9438 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9439 AC_SUBST(LIBATOMIC_OPS_LIBS)
9440 AC_SUBST(SYSTEM_FIREBIRD)
9441 AC_SUBST(FIREBIRD_CFLAGS)
9442 AC_SUBST(FIREBIRD_LIBS)
9443 AC_SUBST([TOMMATH_CFLAGS])
9444 AC_SUBST([TOMMATH_LIBS])
9446 dnl ===================================================================
9447 dnl Check for system curl
9448 dnl ===================================================================
9449 AC_MSG_CHECKING([which libcurl to use])
9450 if test "$with_system_curl" = "auto"; then
9451     with_system_curl="$with_system_libs"
9454 if test "$with_system_curl" = "yes"; then
9455     AC_MSG_RESULT([external])
9456     SYSTEM_CURL=TRUE
9458     # First try PKGCONFIG and then fall back
9459     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9461     if test -n "$CURL_PKG_ERRORS"; then
9462         AC_PATH_PROG(CURLCONFIG, curl-config)
9463         if test -z "$CURLCONFIG"; then
9464             AC_MSG_ERROR([curl development files not found])
9465         fi
9466         CURL_LIBS=`$CURLCONFIG --libs`
9467         FilterLibs "${CURL_LIBS}"
9468         CURL_LIBS="${filteredlibs}"
9469         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9470         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9472         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9473         case $curl_version in
9474         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9475         dnl so they need to be doubled to end up in the configure script
9476         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9477             AC_MSG_RESULT([yes])
9478             ;;
9479         *)
9480             AC_MSG_ERROR([no, you have $curl_version])
9481             ;;
9482         esac
9483     fi
9485     ENABLE_CURL=TRUE
9486 else
9487     AC_MSG_RESULT([internal])
9488     SYSTEM_CURL=
9489     BUILD_TYPE="$BUILD_TYPE CURL"
9490     ENABLE_CURL=TRUE
9492 AC_SUBST(SYSTEM_CURL)
9493 AC_SUBST(CURL_CFLAGS)
9494 AC_SUBST(CURL_LIBS)
9495 AC_SUBST(ENABLE_CURL)
9497 dnl ===================================================================
9498 dnl Check for system boost
9499 dnl ===================================================================
9500 AC_MSG_CHECKING([which boost to use])
9501 if test "$with_system_boost" = "yes"; then
9502     AC_MSG_RESULT([external])
9503     SYSTEM_BOOST=TRUE
9504     AX_BOOST_BASE(1.47)
9505     AX_BOOST_DATE_TIME
9506     AX_BOOST_FILESYSTEM
9507     AX_BOOST_IOSTREAMS
9508     AX_BOOST_LOCALE
9509     AC_LANG_PUSH([C++])
9510     save_CXXFLAGS=$CXXFLAGS
9511     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9512     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9513        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9514     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9515        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9516     CXXFLAGS=$save_CXXFLAGS
9517     AC_LANG_POP([C++])
9518     # this is in m4/ax_boost_base.m4
9519     FilterLibs "${BOOST_LDFLAGS}"
9520     BOOST_LDFLAGS="${filteredlibs}"
9521 else
9522     AC_MSG_RESULT([internal])
9523     BUILD_TYPE="$BUILD_TYPE BOOST"
9524     SYSTEM_BOOST=
9525     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9526         # use warning-suppressing wrapper headers
9527         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9528     else
9529         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9530     fi
9532 AC_SUBST(SYSTEM_BOOST)
9534 dnl ===================================================================
9535 dnl Check for system mdds
9536 dnl ===================================================================
9537 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9539 dnl ===================================================================
9540 dnl Check for system glm
9541 dnl ===================================================================
9542 AC_MSG_CHECKING([which glm to use])
9543 if test "$with_system_glm" = "yes"; then
9544     AC_MSG_RESULT([external])
9545     SYSTEM_GLM=TRUE
9546     AC_LANG_PUSH([C++])
9547     AC_CHECK_HEADER([glm/glm.hpp], [],
9548        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9549     AC_LANG_POP([C++])
9550 else
9551     AC_MSG_RESULT([internal])
9552     BUILD_TYPE="$BUILD_TYPE GLM"
9553     SYSTEM_GLM=
9554     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9556 AC_SUBST([GLM_CFLAGS])
9557 AC_SUBST([SYSTEM_GLM])
9559 dnl ===================================================================
9560 dnl Check for system odbc
9561 dnl ===================================================================
9562 AC_MSG_CHECKING([which odbc headers to use])
9563 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
9564     AC_MSG_RESULT([external])
9565     SYSTEM_ODBC_HEADERS=TRUE
9567     if test "$build_os" = "cygwin"; then
9568         save_CPPFLAGS=$CPPFLAGS
9569         find_winsdk
9570         PathFormat "$winsdktest"
9571         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"
9572         AC_CHECK_HEADER(sqlext.h, [],
9573             [AC_MSG_ERROR(odbc not found. install odbc)],
9574             [#include <windows.h>])
9575         CPPFLAGS=$save_CPPFLAGS
9576     else
9577         AC_CHECK_HEADER(sqlext.h, [],
9578             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9579     fi
9580 elif test "$enable_database_connectivity" != yes; then
9581     AC_MSG_RESULT([none])
9582 else
9583     AC_MSG_RESULT([internal])
9584     SYSTEM_ODBC_HEADERS=
9586 AC_SUBST(SYSTEM_ODBC_HEADERS)
9588 dnl ===================================================================
9589 dnl Enable LDAP support
9590 dnl ===================================================================
9592 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9593 AC_MSG_CHECKING([whether to enable LDAP support])
9594     if test "$enable_ldap" != "yes"; then
9595         AC_MSG_RESULT([no])
9596         ENABLE_LDAP=""
9597         enable_ldap=no
9598     else
9599         AC_MSG_RESULT([yes])
9600         ENABLE_LDAP="TRUE"
9601         AC_DEFINE(HAVE_FEATURE_LDAP)
9602     fi
9604 AC_SUBST(ENABLE_LDAP)
9606 dnl ===================================================================
9607 dnl Check for system openldap
9608 dnl ===================================================================
9610 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9611 AC_MSG_CHECKING([which openldap library to use])
9612 if test "$with_system_openldap" = "yes"; then
9613     AC_MSG_RESULT([external])
9614     SYSTEM_OPENLDAP=TRUE
9615     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9616     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9617     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9618 else
9619     AC_MSG_RESULT([internal])
9620     SYSTEM_OPENLDAP=
9621     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9624 AC_SUBST(SYSTEM_OPENLDAP)
9626 dnl ===================================================================
9627 dnl Check for system NSS
9628 dnl ===================================================================
9629 if test "$enable_fuzzers" != "yes"; then
9630     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9631     AC_DEFINE(HAVE_FEATURE_NSS)
9632     ENABLE_NSS="TRUE"
9633     AC_DEFINE(ENABLE_NSS)
9634 elif test $_os != iOS ; then
9635     with_tls=openssl
9637 AC_SUBST(ENABLE_NSS)
9639 dnl ===================================================================
9640 dnl Check for TLS/SSL and cryptographic implementation to use
9641 dnl ===================================================================
9642 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9643 if test -n "$with_tls"; then
9644     case $with_tls in
9645     openssl)
9646         AC_DEFINE(USE_TLS_OPENSSL)
9647         TLS=OPENSSL
9649         if test "$enable_openssl" != "yes"; then
9650             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9651         fi
9653         # warn that OpenSSL has been selected but not all TLS code has this option
9654         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9655         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9656         ;;
9657     nss)
9658         AC_DEFINE(USE_TLS_NSS)
9659         TLS=NSS
9660         ;;
9661     no)
9662         AC_MSG_WARN([Skipping TLS/SSL])
9663         ;;
9664     *)
9665         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9666 openssl - OpenSSL
9667 nss - Mozilla's Network Security Services (NSS)
9668     ])
9669         ;;
9670     esac
9671 else
9672     # default to using NSS, it results in smaller oox lib
9673     AC_DEFINE(USE_TLS_NSS)
9674     TLS=NSS
9676 AC_MSG_RESULT([$TLS])
9677 AC_SUBST(TLS)
9679 dnl ===================================================================
9680 dnl Check for system sane
9681 dnl ===================================================================
9682 AC_MSG_CHECKING([which sane header to use])
9683 if test "$with_system_sane" = "yes"; then
9684     AC_MSG_RESULT([external])
9685     AC_CHECK_HEADER(sane/sane.h, [],
9686       [AC_MSG_ERROR(sane not found. install sane)], [])
9687 else
9688     AC_MSG_RESULT([internal])
9689     BUILD_TYPE="$BUILD_TYPE SANE"
9692 dnl ===================================================================
9693 dnl Check for system icu
9694 dnl ===================================================================
9695 SYSTEM_GENBRK=
9696 SYSTEM_GENCCODE=
9697 SYSTEM_GENCMN=
9699 ICU_MAJOR=65
9700 ICU_MINOR=1
9701 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9702 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9703 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9704 AC_MSG_CHECKING([which icu to use])
9705 if test "$with_system_icu" = "yes"; then
9706     AC_MSG_RESULT([external])
9707     SYSTEM_ICU=TRUE
9708     AC_LANG_PUSH([C++])
9709     AC_MSG_CHECKING([for unicode/rbbi.h])
9710     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9711     AC_LANG_POP([C++])
9713     if test "$cross_compiling" != "yes"; then
9714         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9715         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9716         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9717         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9718     fi
9720     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9721         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9722         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9723         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9724         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9725         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9726             AC_MSG_RESULT([yes])
9727         else
9728             AC_MSG_RESULT([no])
9729             if test "$with_system_icu_for_build" != "force"; then
9730                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9731 You can use --with-system-icu-for-build=force to use it anyway.])
9732             fi
9733         fi
9734     fi
9736     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9737         # using the system icu tools can lead to version confusion, use the
9738         # ones from the build environment when cross-compiling
9739         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9740         if test -z "$SYSTEM_GENBRK"; then
9741             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9742         fi
9743         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9744         if test -z "$SYSTEM_GENCCODE"; then
9745             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9746         fi
9747         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9748         if test -z "$SYSTEM_GENCMN"; then
9749             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9750         fi
9751         if test "$ICU_MAJOR" -ge "49"; then
9752             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9753             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9754             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9755         else
9756             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9757             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9758             ICU_RECLASSIFIED_HEBREW_LETTER=
9759         fi
9760     fi
9762     if test "$cross_compiling" = "yes"; then
9763         if test "$ICU_MAJOR" -ge "50"; then
9764             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9765             ICU_MINOR=""
9766         fi
9767     fi
9768 else
9769     AC_MSG_RESULT([internal])
9770     SYSTEM_ICU=
9771     BUILD_TYPE="$BUILD_TYPE ICU"
9772     # surprisingly set these only for "internal" (to be used by various other
9773     # external libs): the system icu-config is quite unhelpful and spits out
9774     # dozens of weird flags and also default path -I/usr/include
9775     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9776     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9778 if test "$ICU_MAJOR" -ge "59"; then
9779     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9780     # with -std=c++11 but not all external libraries can be built with that,
9781     # for those use a bit-compatible typedef uint16_t UChar; see
9782     # icu/source/common/unicode/umachine.h
9783     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9784 else
9785     ICU_UCHAR_TYPE=""
9787 AC_SUBST(SYSTEM_ICU)
9788 AC_SUBST(SYSTEM_GENBRK)
9789 AC_SUBST(SYSTEM_GENCCODE)
9790 AC_SUBST(SYSTEM_GENCMN)
9791 AC_SUBST(ICU_MAJOR)
9792 AC_SUBST(ICU_MINOR)
9793 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9794 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9795 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9796 AC_SUBST(ICU_CFLAGS)
9797 AC_SUBST(ICU_LIBS)
9798 AC_SUBST(ICU_UCHAR_TYPE)
9800 dnl ==================================================================
9801 dnl Breakpad
9802 dnl ==================================================================
9803 DEFAULT_CRASHDUMP_VALUE="true"
9804 AC_MSG_CHECKING([whether to enable breakpad])
9805 if test "$enable_breakpad" != yes; then
9806     AC_MSG_RESULT([no])
9807 else
9808     AC_MSG_RESULT([yes])
9809     ENABLE_BREAKPAD="TRUE"
9810     AC_DEFINE(ENABLE_BREAKPAD)
9811     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9812     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9814     AC_MSG_CHECKING([for disable crash dump])
9815     if test "$enable_crashdump" = no; then
9816         DEFAULT_CRASHDUMP_VALUE="false"
9817         AC_MSG_RESULT([yes])
9818     else
9819        AC_MSG_RESULT([no])
9820     fi
9822     AC_MSG_CHECKING([for crashreport config])
9823     if test "$with_symbol_config" = "no"; then
9824         BREAKPAD_SYMBOL_CONFIG="invalid"
9825         AC_MSG_RESULT([no])
9826     else
9827         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9828         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9829         AC_MSG_RESULT([yes])
9830     fi
9831     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9833 AC_SUBST(ENABLE_BREAKPAD)
9834 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9836 dnl ==================================================================
9837 dnl libfuzzer
9838 dnl ==================================================================
9839 AC_MSG_CHECKING([whether to enable fuzzers])
9840 if test "$enable_fuzzers" != yes; then
9841     AC_MSG_RESULT([no])
9842 else
9843     AC_MSG_RESULT([yes])
9844     ENABLE_FUZZERS="TRUE"
9845     AC_DEFINE([ENABLE_FUZZERS],1)
9846     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9848 AC_SUBST(ENABLE_FUZZERS)
9850 dnl ===================================================================
9851 dnl Orcus
9852 dnl ===================================================================
9853 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9854 if test "$with_system_orcus" != "yes"; then
9855     if test "$SYSTEM_BOOST" = "TRUE"; then
9856         # ===========================================================
9857         # Determine if we are going to need to link with Boost.System
9858         # ===========================================================
9859         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9860         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9861         dnl in documentation has no effect.
9862         AC_MSG_CHECKING([if we need to link with Boost.System])
9863         AC_LANG_PUSH([C++])
9864         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9865                 @%:@include <boost/version.hpp>
9866             ]],[[
9867                 #if BOOST_VERSION >= 105000
9868                 #   error yes, we need to link with Boost.System
9869                 #endif
9870             ]])],[
9871                 AC_MSG_RESULT([no])
9872             ],[
9873                 AC_MSG_RESULT([yes])
9874                 AX_BOOST_SYSTEM
9875         ])
9876         AC_LANG_POP([C++])
9877     fi
9879 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9880 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9881 AC_SUBST([BOOST_SYSTEM_LIB])
9882 AC_SUBST(SYSTEM_LIBORCUS)
9884 dnl ===================================================================
9885 dnl HarfBuzz
9886 dnl ===================================================================
9887 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9888                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9889                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9891 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9892                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9893                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9895 if test "$COM" = "MSC"; then # override the above
9896     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9897     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9900 if test "$with_system_harfbuzz" = "yes"; then
9901     if test "$with_system_graphite" = "no"; then
9902         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9903     fi
9904     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9905     _save_libs="$LIBS"
9906     _save_cflags="$CFLAGS"
9907     LIBS="$LIBS $HARFBUZZ_LIBS"
9908     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9909     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9910     LIBS="$_save_libs"
9911     CFLAGS="$_save_cflags"
9912 else
9913     if test "$with_system_graphite" = "yes"; then
9914         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9915     fi
9918 AC_MSG_CHECKING([whether to use X11])
9919 dnl ***************************************
9920 dnl testing for X libraries and includes...
9921 dnl ***************************************
9922 if test "$USING_X11" = TRUE; then
9923     AC_DEFINE(HAVE_FEATURE_X11)
9925 AC_MSG_RESULT([$USING_X11])
9927 if test "$USING_X11" = TRUE; then
9928     AC_PATH_X
9929     AC_PATH_XTRA
9930     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9932     if test -z "$x_includes"; then
9933         x_includes="default_x_includes"
9934     fi
9935     if test -z "$x_libraries"; then
9936         x_libraries="default_x_libraries"
9937     fi
9938     CFLAGS="$CFLAGS $X_CFLAGS"
9939     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9940     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9941 else
9942     x_includes="no_x_includes"
9943     x_libraries="no_x_libraries"
9946 if test "$USING_X11" = TRUE; then
9947     dnl ===================================================================
9948     dnl Check for extension headers
9949     dnl ===================================================================
9950     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9951      [#include <X11/extensions/shape.h>])
9953     # vcl needs ICE and SM
9954     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9955     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9956         [AC_MSG_ERROR(ICE library not found)])
9957     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9958     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9959         [AC_MSG_ERROR(SM library not found)])
9962 dnl ===================================================================
9963 dnl Check for system Xrender
9964 dnl ===================================================================
9965 AC_MSG_CHECKING([whether to use Xrender])
9966 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9967     AC_MSG_RESULT([yes])
9968     PKG_CHECK_MODULES(XRENDER, xrender)
9969     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9970     FilterLibs "${XRENDER_LIBS}"
9971     XRENDER_LIBS="${filteredlibs}"
9972     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9973       [AC_MSG_ERROR(libXrender not found or functional)], [])
9974     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9975       [AC_MSG_ERROR(Xrender not found. install X)], [])
9976 else
9977     AC_MSG_RESULT([no])
9979 AC_SUBST(XRENDER_CFLAGS)
9980 AC_SUBST(XRENDER_LIBS)
9982 dnl ===================================================================
9983 dnl Check for XRandr
9984 dnl ===================================================================
9985 AC_MSG_CHECKING([whether to enable RandR support])
9986 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9987     AC_MSG_RESULT([yes])
9988     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9989     if test "$ENABLE_RANDR" != "TRUE"; then
9990         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9991                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9992         XRANDR_CFLAGS=" "
9993         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9994           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9995         XRANDR_LIBS="-lXrandr "
9996         ENABLE_RANDR="TRUE"
9997     fi
9998     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9999     FilterLibs "${XRANDR_LIBS}"
10000     XRANDR_LIBS="${filteredlibs}"
10001 else
10002     ENABLE_RANDR=""
10003     AC_MSG_RESULT([no])
10005 AC_SUBST(XRANDR_CFLAGS)
10006 AC_SUBST(XRANDR_LIBS)
10007 AC_SUBST(ENABLE_RANDR)
10009 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10010     if test -z "$WITH_WEBDAV"; then
10011         WITH_WEBDAV="serf"
10012     fi
10014 if test $_os = iOS -o $_os = Android; then
10015     WITH_WEBDAV="no"
10017 AC_MSG_CHECKING([for webdav library])
10018 case "$WITH_WEBDAV" in
10019 serf)
10020     AC_MSG_RESULT([serf])
10021     # Check for system apr-util
10022     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10023                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10024                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10025     if test "$COM" = "MSC"; then
10026         APR_LIB_DIR="LibR"
10027         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10028         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10029     fi
10031     # Check for system serf
10032     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10033     ;;
10034 neon)
10035     AC_MSG_RESULT([neon])
10036     # Check for system neon
10037     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10038     if test "$with_system_neon" = "yes"; then
10039         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10040     else
10041         NEON_VERSION=0295
10042     fi
10043     AC_SUBST(NEON_VERSION)
10044     ;;
10046     AC_MSG_RESULT([none, disabled])
10047     WITH_WEBDAV=""
10048     ;;
10049 esac
10050 AC_SUBST(WITH_WEBDAV)
10052 dnl ===================================================================
10053 dnl Check for disabling cve_tests
10054 dnl ===================================================================
10055 AC_MSG_CHECKING([whether to execute CVE tests])
10056 # If not explicitly enabled or disabled, default
10057 if test -z "$enable_cve_tests"; then
10058     case "$OS" in
10059     WNT)
10060         # Default cves off for Windows with its wild and wonderful
10061         # variety of AV software kicking in and panicking
10062         enable_cve_tests=no
10063         ;;
10064     *)
10065         # otherwise yes
10066         enable_cve_tests=yes
10067         ;;
10068     esac
10070 if test "$enable_cve_tests" = "no"; then
10071     AC_MSG_RESULT([no])
10072     DISABLE_CVE_TESTS=TRUE
10073     AC_SUBST(DISABLE_CVE_TESTS)
10074 else
10075     AC_MSG_RESULT([yes])
10078 dnl ===================================================================
10079 dnl Check for enabling chart XShape tests
10080 dnl ===================================================================
10081 AC_MSG_CHECKING([whether to execute chart XShape tests])
10082 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10083     AC_MSG_RESULT([yes])
10084     ENABLE_CHART_TESTS=TRUE
10085     AC_SUBST(ENABLE_CHART_TESTS)
10086 else
10087     AC_MSG_RESULT([no])
10090 dnl ===================================================================
10091 dnl Check for system openssl
10092 dnl ===================================================================
10093 DISABLE_OPENSSL=
10094 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10095 if test "$enable_openssl" = "yes"; then
10096     AC_MSG_RESULT([no])
10097     if test "$_os" = Darwin ; then
10098         # OpenSSL is deprecated when building for 10.7 or later.
10099         #
10100         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10101         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10103         with_system_openssl=no
10104         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10105     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10106             && test "$with_system_openssl" != "no"; then
10107         with_system_openssl=yes
10108         SYSTEM_OPENSSL=TRUE
10109         OPENSSL_CFLAGS=
10110         OPENSSL_LIBS="-lssl -lcrypto"
10111     else
10112         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10113     fi
10114     if test "$with_system_openssl" = "yes"; then
10115         AC_MSG_CHECKING([whether openssl supports SHA512])
10116         AC_LANG_PUSH([C])
10117         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10118             SHA512_CTX context;
10119 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10120         AC_LANG_POP(C)
10121     fi
10122 else
10123     AC_MSG_RESULT([yes])
10124     DISABLE_OPENSSL=TRUE
10126     # warn that although OpenSSL is disabled, system libraries may depend on it
10127     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10128     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10131 AC_SUBST([DISABLE_OPENSSL])
10133 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10134     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10135         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10136         enable_cipher_openssl_backend=no
10137     else
10138         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10139     fi
10141 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10142 ENABLE_CIPHER_OPENSSL_BACKEND=
10143 if test "$enable_cipher_openssl_backend" = yes; then
10144     AC_MSG_RESULT([yes])
10145     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10146 else
10147     AC_MSG_RESULT([no])
10149 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10151 dnl ===================================================================
10152 dnl Check for building gnutls
10153 dnl ===================================================================
10154 AC_MSG_CHECKING([whether to use gnutls])
10155 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10156     AC_MSG_RESULT([yes])
10157     AM_PATH_LIBGCRYPT()
10158     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10159         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10160                       available in the system to use as replacement.]]))
10161     FilterLibs "${LIBGCRYPT_LIBS}"
10162     LIBGCRYPT_LIBS="${filteredlibs}"
10163 else
10164     AC_MSG_RESULT([no])
10167 AC_SUBST([LIBGCRYPT_CFLAGS])
10168 AC_SUBST([LIBGCRYPT_LIBS])
10170 dnl ===================================================================
10171 dnl Check for system redland
10172 dnl ===================================================================
10173 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10174 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10175 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10176 if test "$with_system_redland" = "yes"; then
10177     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10178             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10179 else
10180     RAPTOR_MAJOR="0"
10181     RASQAL_MAJOR="3"
10182     REDLAND_MAJOR="0"
10184 AC_SUBST(RAPTOR_MAJOR)
10185 AC_SUBST(RASQAL_MAJOR)
10186 AC_SUBST(REDLAND_MAJOR)
10188 dnl ===================================================================
10189 dnl Check for system hunspell
10190 dnl ===================================================================
10191 AC_MSG_CHECKING([which libhunspell to use])
10192 if test "$with_system_hunspell" = "yes"; then
10193     AC_MSG_RESULT([external])
10194     SYSTEM_HUNSPELL=TRUE
10195     AC_LANG_PUSH([C++])
10196     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10197     if test "$HUNSPELL_PC" != "TRUE"; then
10198         AC_CHECK_HEADER(hunspell.hxx, [],
10199             [
10200             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10201             [AC_MSG_ERROR(hunspell headers not found.)], [])
10202             ], [])
10203         AC_CHECK_LIB([hunspell], [main], [:],
10204            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10205         HUNSPELL_LIBS=-lhunspell
10206     fi
10207     AC_LANG_POP([C++])
10208     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10209     FilterLibs "${HUNSPELL_LIBS}"
10210     HUNSPELL_LIBS="${filteredlibs}"
10211 else
10212     AC_MSG_RESULT([internal])
10213     SYSTEM_HUNSPELL=
10214     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10215     if test "$COM" = "MSC"; then
10216         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10217     else
10218         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10219     fi
10220     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10222 AC_SUBST(SYSTEM_HUNSPELL)
10223 AC_SUBST(HUNSPELL_CFLAGS)
10224 AC_SUBST(HUNSPELL_LIBS)
10226 dnl ===================================================================
10227 dnl Check for system qrcodegen
10228 dnl ===================================================================
10229 AC_MSG_CHECKING([whether to use libqrcodegen])
10230 if test "$enable_qrcodegen" = "no"; then
10231     AC_MSG_RESULT([no])
10232     ENABLE_QRCODEGEN=
10233     SYSTEM_QRCODEGEN=
10234 else
10235     AC_MSG_RESULT([yes])
10236     ENABLE_QRCODEGEN=TRUE
10237     AC_MSG_CHECKING([which libqrcodegen to use])
10238     if test "$with_system_qrcodegen" = "yes"; then
10239         AC_MSG_RESULT([external])
10240         SYSTEM_QRCODEGEN=TRUE
10241         AC_LANG_PUSH([C++])
10242         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10243             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10244         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10245             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10246         QRCODEGEN_LIBS=-lqrcodegencpp
10247         AC_LANG_POP([C++])
10248         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10249         FilterLibs "${QRCODEGEN_LIBS}"
10250         QRCODEGEN_LIBS="${filteredlibs}"
10251     else
10252         AC_MSG_RESULT([internal])
10253         SYSTEM_QRCODEGEN=
10254         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10255     fi
10256     if test "$ENABLE_QRCODEGEN" = TRUE; then
10257         AC_DEFINE(ENABLE_QRCODEGEN)
10258     fi
10260 AC_SUBST(SYSTEM_QRCODEGEN)
10261 AC_SUBST(ENABLE_QRCODEGEN)
10262 AC_SUBST(QRCODEGEN_CFLAGS)
10263 AC_SUBST(QRCODEGEN_LIBS)
10265 dnl ===================================================================
10266 dnl Checking for altlinuxhyph
10267 dnl ===================================================================
10268 AC_MSG_CHECKING([which altlinuxhyph to use])
10269 if test "$with_system_altlinuxhyph" = "yes"; then
10270     AC_MSG_RESULT([external])
10271     SYSTEM_HYPH=TRUE
10272     AC_CHECK_HEADER(hyphen.h, [],
10273        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10274     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10275        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10276        [#include <hyphen.h>])
10277     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10278         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10279     if test -z "$HYPHEN_LIB"; then
10280         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10281            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10282     fi
10283     if test -z "$HYPHEN_LIB"; then
10284         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10285            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10286     fi
10287 else
10288     AC_MSG_RESULT([internal])
10289     SYSTEM_HYPH=
10290     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10291     if test "$COM" = "MSC"; then
10292         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10293     else
10294         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10295     fi
10297 AC_SUBST(SYSTEM_HYPH)
10298 AC_SUBST(HYPHEN_LIB)
10300 dnl ===================================================================
10301 dnl Checking for mythes
10302 dnl ===================================================================
10303 AC_MSG_CHECKING([which mythes to use])
10304 if test "$with_system_mythes" = "yes"; then
10305     AC_MSG_RESULT([external])
10306     SYSTEM_MYTHES=TRUE
10307     AC_LANG_PUSH([C++])
10308     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10309     if test "$MYTHES_PKGCONFIG" = "no"; then
10310         AC_CHECK_HEADER(mythes.hxx, [],
10311             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10312         AC_CHECK_LIB([mythes-1.2], [main], [:],
10313             [ MYTHES_FOUND=no], [])
10314     if test "$MYTHES_FOUND" = "no"; then
10315         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10316                 [ MYTHES_FOUND=no], [])
10317     fi
10318     if test "$MYTHES_FOUND" = "no"; then
10319         AC_MSG_ERROR([mythes library not found!.])
10320     fi
10321     fi
10322     AC_LANG_POP([C++])
10323     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10324     FilterLibs "${MYTHES_LIBS}"
10325     MYTHES_LIBS="${filteredlibs}"
10326 else
10327     AC_MSG_RESULT([internal])
10328     SYSTEM_MYTHES=
10329     BUILD_TYPE="$BUILD_TYPE MYTHES"
10330     if test "$COM" = "MSC"; then
10331         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10332     else
10333         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10334     fi
10336 AC_SUBST(SYSTEM_MYTHES)
10337 AC_SUBST(MYTHES_CFLAGS)
10338 AC_SUBST(MYTHES_LIBS)
10340 dnl ===================================================================
10341 dnl How should we build the linear programming solver ?
10342 dnl ===================================================================
10344 ENABLE_COINMP=
10345 AC_MSG_CHECKING([whether to build with CoinMP])
10346 if test "$enable_coinmp" != "no"; then
10347     ENABLE_COINMP=TRUE
10348     AC_MSG_RESULT([yes])
10349     if test "$with_system_coinmp" = "yes"; then
10350         SYSTEM_COINMP=TRUE
10351         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10352         FilterLibs "${COINMP_LIBS}"
10353         COINMP_LIBS="${filteredlibs}"
10354     else
10355         BUILD_TYPE="$BUILD_TYPE COINMP"
10356     fi
10357 else
10358     AC_MSG_RESULT([no])
10360 AC_SUBST(ENABLE_COINMP)
10361 AC_SUBST(SYSTEM_COINMP)
10362 AC_SUBST(COINMP_CFLAGS)
10363 AC_SUBST(COINMP_LIBS)
10365 ENABLE_LPSOLVE=
10366 AC_MSG_CHECKING([whether to build with lpsolve])
10367 if test "$enable_lpsolve" != "no"; then
10368     ENABLE_LPSOLVE=TRUE
10369     AC_MSG_RESULT([yes])
10370 else
10371     AC_MSG_RESULT([no])
10373 AC_SUBST(ENABLE_LPSOLVE)
10375 if test "$ENABLE_LPSOLVE" = TRUE; then
10376     AC_MSG_CHECKING([which lpsolve to use])
10377     if test "$with_system_lpsolve" = "yes"; then
10378         AC_MSG_RESULT([external])
10379         SYSTEM_LPSOLVE=TRUE
10380         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10381            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10382         save_LIBS=$LIBS
10383         # some systems need this. Like Ubuntu...
10384         AC_CHECK_LIB(m, floor)
10385         AC_CHECK_LIB(dl, dlopen)
10386         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10387             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10388         LIBS=$save_LIBS
10389     else
10390         AC_MSG_RESULT([internal])
10391         SYSTEM_LPSOLVE=
10392         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10393     fi
10395 AC_SUBST(SYSTEM_LPSOLVE)
10397 dnl ===================================================================
10398 dnl Checking for libexttextcat
10399 dnl ===================================================================
10400 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10401 if test "$with_system_libexttextcat" = "yes"; then
10402     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10404 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10406 dnl ===================================================================
10407 dnl Checking for libnumbertext
10408 dnl ===================================================================
10409 AC_MSG_CHECKING([whether to use libnumbertext])
10410 if test "$enable_libnumbertext" = "no"; then
10411     AC_MSG_RESULT([no])
10412     ENABLE_LIBNUMBERTEXT=
10413     SYSTEM_LIBNUMBERTEXT=
10414 else
10415     AC_MSG_RESULT([yes])
10416     ENABLE_LIBNUMBERTEXT=TRUE
10417     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10418     if test "$with_system_libnumbertext" = "yes"; then
10419         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10420         SYSTEM_LIBNUMBERTEXT=YES
10421     else
10422         SYSTEM_LIBNUMBERTEXT=
10423         AC_LANG_PUSH([C++])
10424         save_CPPFLAGS=$CPPFLAGS
10425         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10426         AC_CHECK_HEADERS([codecvt regex])
10427         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10428                 [ ENABLE_LIBNUMBERTEXT=''
10429                   LIBNUMBERTEXT_CFLAGS=''
10430                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10431                                Enable libnumbertext fallback (missing number to number name conversion).])
10432                 ])
10433         CPPFLAGS=$save_CPPFLAGS
10434         AC_LANG_POP([C++])
10435     fi
10436     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10437         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10438     fi
10440 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10441 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10442 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10443 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10445 dnl ***************************************
10446 dnl testing libc version for Linux...
10447 dnl ***************************************
10448 if test "$_os" = "Linux"; then
10449     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10450     exec 6>/dev/null # no output
10451     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10452     exec 6>&1 # output on again
10453     if test "$HAVE_LIBC"; then
10454         AC_MSG_RESULT([yes])
10455     else
10456         AC_MSG_ERROR([no, upgrade libc])
10457     fi
10460 dnl =========================================
10461 dnl Check for uuidgen
10462 dnl =========================================
10463 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10464     # presence is already tested above in the WINDOWS_SDK_HOME check
10465     UUIDGEN=uuidgen.exe
10466     AC_SUBST(UUIDGEN)
10467 else
10468     AC_PATH_PROG([UUIDGEN], [uuidgen])
10469     if test -z "$UUIDGEN"; then
10470         AC_MSG_WARN([uuid is needed for building installation sets])
10471     fi
10474 dnl ***************************************
10475 dnl Checking for bison and flex
10476 dnl ***************************************
10477 AC_PATH_PROG(BISON, bison)
10478 if test -z "$BISON"; then
10479     AC_MSG_ERROR([no bison found in \$PATH, install it])
10480 else
10481     AC_MSG_CHECKING([the bison version])
10482     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10483     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10484     # Accept newer than 2.0
10485     if test "$_bison_longver" -lt 2000; then
10486         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10487     fi
10490 AC_PATH_PROG(FLEX, flex)
10491 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10492     FLEX=`cygpath -m $FLEX`
10494 if test -z "$FLEX"; then
10495     AC_MSG_ERROR([no flex found in \$PATH, install it])
10496 else
10497     AC_MSG_CHECKING([the flex version])
10498     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10499     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10500         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10501     fi
10503 AC_SUBST([FLEX])
10504 dnl ***************************************
10505 dnl Checking for patch
10506 dnl ***************************************
10507 AC_PATH_PROG(PATCH, patch)
10508 if test -z "$PATCH"; then
10509     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10512 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10513 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10514     if test -z "$with_gnu_patch"; then
10515         GNUPATCH=$PATCH
10516     else
10517         if test -x "$with_gnu_patch"; then
10518             GNUPATCH=$with_gnu_patch
10519         else
10520             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10521         fi
10522     fi
10524     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10525     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10526         AC_MSG_RESULT([yes])
10527     else
10528         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10529     fi
10530 else
10531     GNUPATCH=$PATCH
10534 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10535     GNUPATCH=`cygpath -m $GNUPATCH`
10538 dnl We also need to check for --with-gnu-cp
10540 if test -z "$with_gnu_cp"; then
10541     # check the place where the good stuff is hidden on Solaris...
10542     if test -x /usr/gnu/bin/cp; then
10543         GNUCP=/usr/gnu/bin/cp
10544     else
10545         AC_PATH_PROGS(GNUCP, gnucp cp)
10546     fi
10547     if test -z $GNUCP; then
10548         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10549     fi
10550 else
10551     if test -x "$with_gnu_cp"; then
10552         GNUCP=$with_gnu_cp
10553     else
10554         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10555     fi
10558 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10559     GNUCP=`cygpath -m $GNUCP`
10562 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10563 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10564     AC_MSG_RESULT([yes])
10565 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10566     AC_MSG_RESULT([yes])
10567 else
10568     case "$build_os" in
10569     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10570         x_GNUCP=[\#]
10571         GNUCP=''
10572         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10573         ;;
10574     *)
10575         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10576         ;;
10577     esac
10580 AC_SUBST(GNUPATCH)
10581 AC_SUBST(GNUCP)
10582 AC_SUBST(x_GNUCP)
10584 dnl ***************************************
10585 dnl testing assembler path
10586 dnl ***************************************
10587 ML_EXE=""
10588 if test "$_os" = "WINNT"; then
10589     if test "$BITNESS_OVERRIDE" = ""; then
10590         assembler=ml.exe
10591     else
10592         assembler=ml64.exe
10593     fi
10595     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10596     if test -f "$CL_PATH/$assembler"; then
10597         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10598         AC_MSG_RESULT([$ML_EXE])
10599     else
10600         AC_MSG_ERROR([not found])
10601     fi
10604 AC_SUBST(ML_EXE)
10606 dnl ===================================================================
10607 dnl We need zip and unzip
10608 dnl ===================================================================
10609 AC_PATH_PROG(ZIP, zip)
10610 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10611 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10612     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],,)
10615 AC_PATH_PROG(UNZIP, unzip)
10616 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10618 dnl ===================================================================
10619 dnl Zip must be a specific type for different build types.
10620 dnl ===================================================================
10621 if test $build_os = cygwin; then
10622     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10623         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10624     fi
10627 dnl ===================================================================
10628 dnl We need touch with -h option support.
10629 dnl ===================================================================
10630 AC_PATH_PROG(TOUCH, touch)
10631 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10632 touch warn
10633 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10634     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],,)
10637 dnl ===================================================================
10638 dnl Check for system epoxy
10639 dnl ===================================================================
10640 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10642 dnl ===================================================================
10643 dnl Set vcl option: coordinate device in double or sal_Int32
10644 dnl ===================================================================
10646 dnl disabled for now, we don't want subtle differences between OSs
10647 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10648 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10649 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10650 dnl     AC_MSG_RESULT([double])
10651 dnl else
10652 dnl     AC_MSG_RESULT([sal_Int32])
10653 dnl fi
10655 dnl ===================================================================
10656 dnl Test which vclplugs have to be built.
10657 dnl ===================================================================
10658 R=""
10659 if test "$USING_X11" != TRUE; then
10660     enable_gtk3=no
10662 GTK3_CFLAGS=""
10663 GTK3_LIBS=""
10664 ENABLE_GTK3=""
10665 if test "x$enable_gtk3" = "xyes"; then
10666     if test "$with_system_cairo" = no; then
10667         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10668     fi
10669     : ${with_system_cairo:=yes}
10670     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="")
10671     if test "x$ENABLE_GTK3" = "xTRUE"; then
10672         AC_DEFINE(ENABLE_GTK3)
10673         R="gtk3"
10674     else
10675         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10676     fi
10677     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10678     FilterLibs "${GTK3_LIBS}"
10679     GTK3_LIBS="${filteredlibs}"
10681     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10682     if test "$with_system_epoxy" != "yes"; then
10683         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10684         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10685                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10686     fi
10688 AC_SUBST(GTK3_LIBS)
10689 AC_SUBST(GTK3_CFLAGS)
10690 AC_SUBST(ENABLE_GTK3)
10692 if test "$enable_introspection" = yes; then
10693     if test "$ENABLE_GTK3" = TRUE; then
10694         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10695     else
10696         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10697     fi
10700 ENABLE_QT5=""
10701 if test "x$enable_qt5" = "xyes"; then
10702     ENABLE_QT5="TRUE"
10703     AC_DEFINE(ENABLE_QT5)
10704     R="$R qt5"
10706 AC_SUBST(ENABLE_QT5)
10708 ENABLE_KF5=""
10709 if test "x$enable_kf5" = "xyes"; then
10710     ENABLE_KF5="TRUE"
10711     AC_DEFINE(ENABLE_KF5)
10712     R="$R kf5"
10714 AC_SUBST(ENABLE_KF5)
10716 ENABLE_GTK3_KDE5=""
10717 if test "x$enable_gtk3_kde5" = "xyes"; then
10718     ENABLE_GTK3_KDE5="TRUE"
10719     AC_DEFINE(ENABLE_GTK3_KDE5)
10720     R="$R gtk3_kde5"
10722 AC_SUBST(ENABLE_GTK3_KDE5)
10724 if test "$_os" = "WINNT"; then
10725     R="$R win"
10726 elif test "$_os" = "Darwin"; then
10727     R="$R osx"
10728 elif test "$_os" = "iOS"; then
10729     R="ios (builtin)"
10732 build_vcl_plugins="$R"
10733 if test -z "$build_vcl_plugins"; then
10734     build_vcl_plugins="none"
10736 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10738 dnl ===================================================================
10739 dnl check for dbus support
10740 dnl ===================================================================
10741 ENABLE_DBUS=""
10742 DBUS_CFLAGS=""
10743 DBUS_LIBS=""
10744 DBUS_GLIB_CFLAGS=""
10745 DBUS_GLIB_LIBS=""
10746 DBUS_HAVE_GLIB=""
10748 if test "$enable_dbus" = "no"; then
10749     test_dbus=no
10752 AC_MSG_CHECKING([whether to enable DBUS support])
10753 if test "$test_dbus" = "yes"; then
10754     ENABLE_DBUS="TRUE"
10755     AC_MSG_RESULT([yes])
10756     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10757     AC_DEFINE(ENABLE_DBUS)
10758     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10759     FilterLibs "${DBUS_LIBS}"
10760     DBUS_LIBS="${filteredlibs}"
10762     # Glib is needed for BluetoothServer
10763     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10764     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10765         [
10766             DBUS_HAVE_GLIB="TRUE"
10767             AC_DEFINE(DBUS_HAVE_GLIB,1)
10768         ],
10769         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10770     )
10771 else
10772     AC_MSG_RESULT([no])
10775 AC_SUBST(ENABLE_DBUS)
10776 AC_SUBST(DBUS_CFLAGS)
10777 AC_SUBST(DBUS_LIBS)
10778 AC_SUBST(DBUS_GLIB_CFLAGS)
10779 AC_SUBST(DBUS_GLIB_LIBS)
10780 AC_SUBST(DBUS_HAVE_GLIB)
10782 AC_MSG_CHECKING([whether to enable Impress remote control])
10783 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10784     AC_MSG_RESULT([yes])
10785     ENABLE_SDREMOTE=TRUE
10786     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10788     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10789         # The Bluetooth code doesn't compile with macOS SDK 10.15
10790         enable_sdremote_bluetooth=no
10791     fi
10792     # If not explicitly enabled or disabled, default
10793     if test -z "$enable_sdremote_bluetooth"; then
10794         case "$OS" in
10795         LINUX|MACOSX|WNT)
10796             # Default to yes for these
10797             enable_sdremote_bluetooth=yes
10798             ;;
10799         *)
10800             # otherwise no
10801             enable_sdremote_bluetooth=no
10802             ;;
10803         esac
10804     fi
10805     # $enable_sdremote_bluetooth is guaranteed non-empty now
10807     if test "$enable_sdremote_bluetooth" != "no"; then
10808         if test "$OS" = "LINUX"; then
10809             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10810                 AC_MSG_RESULT([yes])
10811                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10812                 dnl ===================================================================
10813                 dnl Check for system bluez
10814                 dnl ===================================================================
10815                 AC_MSG_CHECKING([which Bluetooth header to use])
10816                 if test "$with_system_bluez" = "yes"; then
10817                     AC_MSG_RESULT([external])
10818                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10819                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10820                     SYSTEM_BLUEZ=TRUE
10821                 else
10822                     AC_MSG_RESULT([internal])
10823                     SYSTEM_BLUEZ=
10824                 fi
10825             else
10826                 AC_MSG_RESULT([no, dbus disabled])
10827                 ENABLE_SDREMOTE_BLUETOOTH=
10828                 SYSTEM_BLUEZ=
10829             fi
10830         else
10831             AC_MSG_RESULT([yes])
10832             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10833             SYSTEM_BLUEZ=
10834         fi
10835     else
10836         AC_MSG_RESULT([no])
10837         ENABLE_SDREMOTE_BLUETOOTH=
10838         SYSTEM_BLUEZ=
10839     fi
10840 else
10841     ENABLE_SDREMOTE=
10842     SYSTEM_BLUEZ=
10843     AC_MSG_RESULT([no])
10845 AC_SUBST(ENABLE_SDREMOTE)
10846 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10847 AC_SUBST(SYSTEM_BLUEZ)
10849 dnl ===================================================================
10850 dnl Check whether to enable GIO support
10851 dnl ===================================================================
10852 if test "$ENABLE_GTK3" = "TRUE"; then
10853     AC_MSG_CHECKING([whether to enable GIO support])
10854     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10855         dnl Need at least 2.26 for the dbus support.
10856         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10857                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10858         if test "$ENABLE_GIO" = "TRUE"; then
10859             AC_DEFINE(ENABLE_GIO)
10860             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10861             FilterLibs "${GIO_LIBS}"
10862             GIO_LIBS="${filteredlibs}"
10863         fi
10864     else
10865         AC_MSG_RESULT([no])
10866     fi
10868 AC_SUBST(ENABLE_GIO)
10869 AC_SUBST(GIO_CFLAGS)
10870 AC_SUBST(GIO_LIBS)
10873 dnl ===================================================================
10875 SPLIT_APP_MODULES=""
10876 if test "$enable_split_app_modules" = "yes"; then
10877     SPLIT_APP_MODULES="TRUE"
10879 AC_SUBST(SPLIT_APP_MODULES)
10881 SPLIT_OPT_FEATURES=""
10882 if test "$enable_split_opt_features" = "yes"; then
10883     SPLIT_OPT_FEATURES="TRUE"
10885 AC_SUBST(SPLIT_OPT_FEATURES)
10887 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10888     if test "$enable_cairo_canvas" = yes; then
10889         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10890     fi
10891     enable_cairo_canvas=no
10892 elif test -z "$enable_cairo_canvas"; then
10893     enable_cairo_canvas=yes
10896 ENABLE_CAIRO_CANVAS=""
10897 if test "$enable_cairo_canvas" = "yes"; then
10898     test_cairo=yes
10899     ENABLE_CAIRO_CANVAS="TRUE"
10900     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10902 AC_SUBST(ENABLE_CAIRO_CANVAS)
10904 dnl ===================================================================
10905 dnl Check whether the GStreamer libraries are available.
10906 dnl ===================================================================
10908 ENABLE_GSTREAMER_1_0=""
10910 if test "$build_gstreamer_1_0" = "yes"; then
10912     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10913     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10914         ENABLE_GSTREAMER_1_0="TRUE"
10915         AC_MSG_RESULT([yes])
10916         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10917         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10918         FilterLibs "${GSTREAMER_1_0_LIBS}"
10919         GSTREAMER_1_0_LIBS="${filteredlibs}"
10920         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10921     else
10922         AC_MSG_RESULT([no])
10923     fi
10925 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10926 AC_SUBST(GSTREAMER_1_0_LIBS)
10927 AC_SUBST(ENABLE_GSTREAMER_1_0)
10929 dnl ===================================================================
10930 dnl Check whether to build the VLC avmedia backend
10931 dnl ===================================================================
10933 ENABLE_VLC=""
10935 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10936 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10937     ENABLE_VLC="TRUE"
10938     AC_MSG_RESULT([yes])
10939 else
10940     AC_MSG_RESULT([no])
10942 AC_SUBST(ENABLE_VLC)
10944 ENABLE_OPENGL_TRANSITIONS=
10945 ENABLE_OPENGL_CANVAS=
10946 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10947    : # disable
10948 elif test "$_os" = "Darwin"; then
10949     # We use frameworks on macOS, no need for detail checks
10950     ENABLE_OPENGL_TRANSITIONS=TRUE
10951     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10952     ENABLE_OPENGL_CANVAS=TRUE
10953 elif test $_os = WINNT; then
10954     ENABLE_OPENGL_TRANSITIONS=TRUE
10955     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10956     ENABLE_OPENGL_CANVAS=TRUE
10957 else
10958     if test "$USING_X11" = TRUE; then
10959         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10960         ENABLE_OPENGL_TRANSITIONS=TRUE
10961         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10962         ENABLE_OPENGL_CANVAS=TRUE
10963     fi
10966 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10967 AC_SUBST(ENABLE_OPENGL_CANVAS)
10969 dnl =================================================
10970 dnl Check whether to build with OpenCL support.
10971 dnl =================================================
10973 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10974     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10975     # platform (optional at run-time, used through clew).
10976     BUILD_TYPE="$BUILD_TYPE OPENCL"
10977     AC_DEFINE(HAVE_FEATURE_OPENCL)
10980 dnl =================================================
10981 dnl Check whether to build with dconf support.
10982 dnl =================================================
10984 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10985     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10986         if test "$enable_dconf" = yes; then
10987             AC_MSG_ERROR([dconf not found])
10988         else
10989             enable_dconf=no
10990         fi])
10992 AC_MSG_CHECKING([whether to enable dconf])
10993 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10994     DCONF_CFLAGS=
10995     DCONF_LIBS=
10996     ENABLE_DCONF=
10997     AC_MSG_RESULT([no])
10998 else
10999     ENABLE_DCONF=TRUE
11000     AC_DEFINE(ENABLE_DCONF)
11001     AC_MSG_RESULT([yes])
11003 AC_SUBST([DCONF_CFLAGS])
11004 AC_SUBST([DCONF_LIBS])
11005 AC_SUBST([ENABLE_DCONF])
11007 # pdf import?
11008 AC_MSG_CHECKING([whether to build the PDF import feature])
11009 ENABLE_PDFIMPORT=
11010 if test \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11011     AC_MSG_RESULT([yes])
11012     ENABLE_PDFIMPORT=TRUE
11013     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11014 else
11015     AC_MSG_RESULT([no])
11018 # Pdfium?
11019 AC_MSG_CHECKING([whether to build PDFium])
11020 ENABLE_PDFIUM=
11021 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11022     AC_MSG_RESULT([yes])
11023     ENABLE_PDFIUM=TRUE
11024     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11025     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11026 else
11027     AC_MSG_RESULT([no])
11029 AC_SUBST(ENABLE_PDFIUM)
11031 dnl ===================================================================
11032 dnl Check for poppler
11033 dnl ===================================================================
11034 ENABLE_POPPLER=
11035 AC_MSG_CHECKING([whether to build Poppler])
11036 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11037     AC_MSG_RESULT([yes])
11038     ENABLE_POPPLER=TRUE
11039     AC_DEFINE(HAVE_FEATURE_POPPLER)
11040 else
11041     AC_MSG_RESULT([no])
11043 AC_SUBST(ENABLE_POPPLER)
11045 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11046     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11049 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11050     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11053 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11054     dnl ===================================================================
11055     dnl Check for system poppler
11056     dnl ===================================================================
11057     AC_MSG_CHECKING([which PDF import poppler to use])
11058     if test "$with_system_poppler" = "yes"; then
11059         AC_MSG_RESULT([external])
11060         SYSTEM_POPPLER=TRUE
11061         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11062         AC_LANG_PUSH([C++])
11063         save_CXXFLAGS=$CXXFLAGS
11064         save_CPPFLAGS=$CPPFLAGS
11065         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11066         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11067         AC_CHECK_HEADER([cpp/poppler-version.h],
11068             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11069             [])
11070         CXXFLAGS=$save_CXXFLAGS
11071         CPPFLAGS=$save_CPPFLAGS
11072         AC_LANG_POP([C++])
11073         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11075         FilterLibs "${POPPLER_LIBS}"
11076         POPPLER_LIBS="${filteredlibs}"
11077     else
11078         AC_MSG_RESULT([internal])
11079         SYSTEM_POPPLER=
11080         BUILD_TYPE="$BUILD_TYPE POPPLER"
11081         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11082     fi
11083     AC_DEFINE([ENABLE_PDFIMPORT],1)
11085 AC_SUBST(ENABLE_PDFIMPORT)
11086 AC_SUBST(SYSTEM_POPPLER)
11087 AC_SUBST(POPPLER_CFLAGS)
11088 AC_SUBST(POPPLER_LIBS)
11090 SYSTEM_GPGMEPP=
11092 if test "$build_for_ios" = "YES"; then
11093     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11094     AC_MSG_RESULT([yes])
11095 elif test "$enable_mpl_subset" = "yes"; then
11096     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11097     AC_MSG_RESULT([yes])
11098 elif test "$enable_fuzzers" = "yes"; then
11099     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11100     AC_MSG_RESULT([yes])
11101 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11102     dnl ===================================================================
11103     dnl Check for system gpgme
11104     dnl ===================================================================
11105     AC_MSG_CHECKING([which gpgmepp to use])
11106     if test "$with_system_gpgmepp" = "yes"; then
11107         AC_MSG_RESULT([external])
11108         SYSTEM_GPGMEPP=TRUE
11110         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11111         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11112             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11113         # progress_callback is the only func with plain C linkage
11114         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11115         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11116             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11117         AC_CHECK_HEADER(gpgme.h, [],
11118             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11119     else
11120         AC_MSG_RESULT([internal])
11121         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11122         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11124         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11125         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11126         if test "$_os" != "WINNT"; then
11127             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11128             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11129         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11130             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11131         fi
11132     fi
11133     ENABLE_GPGMEPP=TRUE
11134     AC_DEFINE([HAVE_FEATURE_GPGME])
11135     AC_PATH_PROG(GPG, gpg)
11136     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11137     # so let's exclude that manually for the moment
11138     if test -n "$GPG" -a "$_os" != "WINNT"; then
11139         # make sure we not only have a working gpgme, but a full working
11140         # gpg installation to run OpenPGP signature verification
11141         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11142     fi
11143     if test "$_os" = "Linux"; then
11144       uid=`id -u`
11145       AC_MSG_CHECKING([for /run/user/$uid])
11146       if test -d /run/user/$uid; then
11147         AC_MSG_RESULT([yes])
11148         AC_PATH_PROG(GPGCONF, gpgconf)
11150         # Older versions of gpgconf are not working as expected, since
11151         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11152         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11153         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11154         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11155         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11156         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11157         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11158           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11159           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11160           if $GPGCONF --dump-options > /dev/null ; then
11161             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11162               AC_MSG_RESULT([yes])
11163               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11164               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11165             else
11166               AC_MSG_RESULT([no])
11167             fi
11168           else
11169             AC_MSG_RESULT([no. missing or broken gpgconf?])
11170           fi
11171         else
11172           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11173         fi
11174       else
11175         AC_MSG_RESULT([no])
11176      fi
11177    fi
11179 AC_SUBST(ENABLE_GPGMEPP)
11180 AC_SUBST(SYSTEM_GPGMEPP)
11181 AC_SUBST(GPG_ERROR_CFLAGS)
11182 AC_SUBST(GPG_ERROR_LIBS)
11183 AC_SUBST(LIBASSUAN_CFLAGS)
11184 AC_SUBST(LIBASSUAN_LIBS)
11185 AC_SUBST(GPGMEPP_CFLAGS)
11186 AC_SUBST(GPGMEPP_LIBS)
11188 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11189 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11190     AC_MSG_RESULT([yes])
11191     ENABLE_MEDIAWIKI=TRUE
11192     BUILD_TYPE="$BUILD_TYPE XSLTML"
11193     if test  "x$with_java" = "xno"; then
11194         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11195     fi
11196 else
11197     AC_MSG_RESULT([no])
11198     ENABLE_MEDIAWIKI=
11199     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11201 AC_SUBST(ENABLE_MEDIAWIKI)
11203 AC_MSG_CHECKING([whether to build the Report Builder])
11204 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11205     AC_MSG_RESULT([yes])
11206     ENABLE_REPORTBUILDER=TRUE
11207     AC_MSG_CHECKING([which jfreereport libs to use])
11208     if test "$with_system_jfreereport" = "yes"; then
11209         SYSTEM_JFREEREPORT=TRUE
11210         AC_MSG_RESULT([external])
11211         if test -z $SAC_JAR; then
11212             SAC_JAR=/usr/share/java/sac.jar
11213         fi
11214         if ! test -f $SAC_JAR; then
11215              AC_MSG_ERROR(sac.jar not found.)
11216         fi
11218         if test -z $LIBXML_JAR; then
11219             if test -f /usr/share/java/libxml-1.0.0.jar; then
11220                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11221             elif test -f /usr/share/java/libxml.jar; then
11222                 LIBXML_JAR=/usr/share/java/libxml.jar
11223             else
11224                 AC_MSG_ERROR(libxml.jar replacement not found.)
11225             fi
11226         elif ! test -f $LIBXML_JAR; then
11227             AC_MSG_ERROR(libxml.jar not found.)
11228         fi
11230         if test -z $FLUTE_JAR; then
11231             if test -f/usr/share/java/flute-1.3.0.jar; then
11232                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11233             elif test -f /usr/share/java/flute.jar; then
11234                 FLUTE_JAR=/usr/share/java/flute.jar
11235             else
11236                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11237             fi
11238         elif ! test -f $FLUTE_JAR; then
11239             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11240         fi
11242         if test -z $JFREEREPORT_JAR; then
11243             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11244                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11245             elif test -f /usr/share/java/flow-engine.jar; then
11246                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11247             else
11248                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11249             fi
11250         elif ! test -f  $JFREEREPORT_JAR; then
11251                 AC_MSG_ERROR(jfreereport.jar not found.)
11252         fi
11254         if test -z $LIBLAYOUT_JAR; then
11255             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11256                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11257             elif test -f /usr/share/java/liblayout.jar; then
11258                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11259             else
11260                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11261             fi
11262         elif ! test -f $LIBLAYOUT_JAR; then
11263                 AC_MSG_ERROR(liblayout.jar not found.)
11264         fi
11266         if test -z $LIBLOADER_JAR; then
11267             if test -f /usr/share/java/libloader-1.0.0.jar; then
11268                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11269             elif test -f /usr/share/java/libloader.jar; then
11270                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11271             else
11272                 AC_MSG_ERROR(libloader.jar replacement not found.)
11273             fi
11274         elif ! test -f  $LIBLOADER_JAR; then
11275             AC_MSG_ERROR(libloader.jar not found.)
11276         fi
11278         if test -z $LIBFORMULA_JAR; then
11279             if test -f /usr/share/java/libformula-0.2.0.jar; then
11280                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11281             elif test -f /usr/share/java/libformula.jar; then
11282                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11283             else
11284                 AC_MSG_ERROR(libformula.jar replacement not found.)
11285             fi
11286         elif ! test -f $LIBFORMULA_JAR; then
11287                 AC_MSG_ERROR(libformula.jar not found.)
11288         fi
11290         if test -z $LIBREPOSITORY_JAR; then
11291             if test -f /usr/share/java/librepository-1.0.0.jar; then
11292                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11293             elif test -f /usr/share/java/librepository.jar; then
11294                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11295             else
11296                 AC_MSG_ERROR(librepository.jar replacement not found.)
11297             fi
11298         elif ! test -f $LIBREPOSITORY_JAR; then
11299             AC_MSG_ERROR(librepository.jar not found.)
11300         fi
11302         if test -z $LIBFONTS_JAR; then
11303             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11304                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11305             elif test -f /usr/share/java/libfonts.jar; then
11306                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11307             else
11308                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11309             fi
11310         elif ! test -f $LIBFONTS_JAR; then
11311                 AC_MSG_ERROR(libfonts.jar not found.)
11312         fi
11314         if test -z $LIBSERIALIZER_JAR; then
11315             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11316                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11317             elif test -f /usr/share/java/libserializer.jar; then
11318                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11319             else
11320                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11321             fi
11322         elif ! test -f $LIBSERIALIZER_JAR; then
11323                 AC_MSG_ERROR(libserializer.jar not found.)
11324         fi
11326         if test -z $LIBBASE_JAR; then
11327             if test -f /usr/share/java/libbase-1.0.0.jar; then
11328                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11329             elif test -f /usr/share/java/libbase.jar; then
11330                 LIBBASE_JAR=/usr/share/java/libbase.jar
11331             else
11332                 AC_MSG_ERROR(libbase.jar replacement not found.)
11333             fi
11334         elif ! test -f $LIBBASE_JAR; then
11335             AC_MSG_ERROR(libbase.jar not found.)
11336         fi
11338     else
11339         AC_MSG_RESULT([internal])
11340         SYSTEM_JFREEREPORT=
11341         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11342         NEED_ANT=TRUE
11343     fi
11344 else
11345     AC_MSG_RESULT([no])
11346     ENABLE_REPORTBUILDER=
11347     SYSTEM_JFREEREPORT=
11349 AC_SUBST(ENABLE_REPORTBUILDER)
11350 AC_SUBST(SYSTEM_JFREEREPORT)
11351 AC_SUBST(SAC_JAR)
11352 AC_SUBST(LIBXML_JAR)
11353 AC_SUBST(FLUTE_JAR)
11354 AC_SUBST(JFREEREPORT_JAR)
11355 AC_SUBST(LIBBASE_JAR)
11356 AC_SUBST(LIBLAYOUT_JAR)
11357 AC_SUBST(LIBLOADER_JAR)
11358 AC_SUBST(LIBFORMULA_JAR)
11359 AC_SUBST(LIBREPOSITORY_JAR)
11360 AC_SUBST(LIBFONTS_JAR)
11361 AC_SUBST(LIBSERIALIZER_JAR)
11363 # this has to be here because both the Wiki Publisher and the SRB use
11364 # commons-logging
11365 COMMONS_LOGGING_VERSION=1.2
11366 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11367     AC_MSG_CHECKING([which Apache commons-* libs to use])
11368     if test "$with_system_apache_commons" = "yes"; then
11369         SYSTEM_APACHE_COMMONS=TRUE
11370         AC_MSG_RESULT([external])
11371         if test -z $COMMONS_LOGGING_JAR; then
11372             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11373                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11374            elif test -f /usr/share/java/commons-logging.jar; then
11375                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11376             else
11377                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11378             fi
11379         elif ! test -f $COMMONS_LOGGING_JAR; then
11380             AC_MSG_ERROR(commons-logging.jar not found.)
11381         fi
11382     else
11383         AC_MSG_RESULT([internal])
11384         SYSTEM_APACHE_COMMONS=
11385         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11386         NEED_ANT=TRUE
11387     fi
11389 AC_SUBST(SYSTEM_APACHE_COMMONS)
11390 AC_SUBST(COMMONS_LOGGING_JAR)
11391 AC_SUBST(COMMONS_LOGGING_VERSION)
11393 # scripting provider for BeanShell?
11394 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11395 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11396     AC_MSG_RESULT([yes])
11397     ENABLE_SCRIPTING_BEANSHELL=TRUE
11399     dnl ===================================================================
11400     dnl Check for system beanshell
11401     dnl ===================================================================
11402     AC_MSG_CHECKING([which beanshell to use])
11403     if test "$with_system_beanshell" = "yes"; then
11404         AC_MSG_RESULT([external])
11405         SYSTEM_BSH=TRUE
11406         if test -z $BSH_JAR; then
11407             BSH_JAR=/usr/share/java/bsh.jar
11408         fi
11409         if ! test -f $BSH_JAR; then
11410             AC_MSG_ERROR(bsh.jar not found.)
11411         fi
11412     else
11413         AC_MSG_RESULT([internal])
11414         SYSTEM_BSH=
11415         BUILD_TYPE="$BUILD_TYPE BSH"
11416     fi
11417 else
11418     AC_MSG_RESULT([no])
11419     ENABLE_SCRIPTING_BEANSHELL=
11420     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11422 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11423 AC_SUBST(SYSTEM_BSH)
11424 AC_SUBST(BSH_JAR)
11426 # scripting provider for JavaScript?
11427 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11428 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11429     AC_MSG_RESULT([yes])
11430     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11432     dnl ===================================================================
11433     dnl Check for system rhino
11434     dnl ===================================================================
11435     AC_MSG_CHECKING([which rhino to use])
11436     if test "$with_system_rhino" = "yes"; then
11437         AC_MSG_RESULT([external])
11438         SYSTEM_RHINO=TRUE
11439         if test -z $RHINO_JAR; then
11440             RHINO_JAR=/usr/share/java/js.jar
11441         fi
11442         if ! test -f $RHINO_JAR; then
11443             AC_MSG_ERROR(js.jar not found.)
11444         fi
11445     else
11446         AC_MSG_RESULT([internal])
11447         SYSTEM_RHINO=
11448         BUILD_TYPE="$BUILD_TYPE RHINO"
11449         NEED_ANT=TRUE
11450     fi
11451 else
11452     AC_MSG_RESULT([no])
11453     ENABLE_SCRIPTING_JAVASCRIPT=
11454     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11456 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11457 AC_SUBST(SYSTEM_RHINO)
11458 AC_SUBST(RHINO_JAR)
11460 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11461 # paths should be added to library search path. So lets put all 64-bit
11462 # platforms there.
11463 supports_multilib=
11464 case "$host_cpu" in
11465 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11466     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11467         supports_multilib="yes"
11468     fi
11469     ;;
11471     ;;
11472 esac
11474 dnl ===================================================================
11475 dnl QT5 Integration
11476 dnl ===================================================================
11478 QT5_CFLAGS=""
11479 QT5_LIBS=""
11480 QMAKE5="qmake"
11481 MOC5="moc"
11482 QT5_GOBJECT_CFLAGS=""
11483 QT5_GOBJECT_LIBS=""
11484 QT5_HAVE_GOBJECT=""
11485 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11486         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11487         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11488 then
11489     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11490     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11492     if test -n "$supports_multilib"; then
11493         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11494     fi
11496     qt5_test_include="QtWidgets/qapplication.h"
11497     qt5_test_library="libQt5Widgets.so"
11499     dnl Check for qmake5
11500     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11501     if test "$QMAKE5" = "no"; then
11502         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11503     else
11504         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11505         if test -z "$qmake5_test_ver"; then
11506             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11507         fi
11508         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11509         qt5_minimal_minor="6"
11510         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11511             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11512         else
11513             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11514         fi
11515     fi
11517     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11518     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11520     AC_MSG_CHECKING([for Qt5 headers])
11521     qt5_incdir="no"
11522     for inc_dir in $qt5_incdirs; do
11523         if test -r "$inc_dir/$qt5_test_include"; then
11524             qt5_incdir="$inc_dir"
11525             break
11526         fi
11527     done
11528     AC_MSG_RESULT([$qt5_incdir])
11529     if test "x$qt5_incdir" = "xno"; then
11530         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11531     fi
11533     AC_MSG_CHECKING([for Qt5 libraries])
11534     qt5_libdir="no"
11535     for lib_dir in $qt5_libdirs; do
11536         if test -r "$lib_dir/$qt5_test_library"; then
11537             qt5_libdir="$lib_dir"
11538             break
11539         fi
11540     done
11541     AC_MSG_RESULT([$qt5_libdir])
11542     if test "x$qt5_libdir" = "xno"; then
11543         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11544     fi
11546     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11547     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11548     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11550     if test "$USING_X11" = TRUE; then
11551         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11552         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11553             QT5_HAVE_XCB_ICCCM=1
11554             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11555         ],[
11556             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)])
11557             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11558         ])
11559         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11560         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11561         QT5_USING_X11=1
11562         AC_DEFINE(QT5_USING_X11)
11563     fi
11565     dnl Check for Meta Object Compiler
11567     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11568     if test "$MOC5" = "no"; then
11569         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11570 the root of your Qt installation by exporting QT5DIR before running "configure".])
11571     fi
11573     if test "$build_gstreamer_1_0" = "yes"; then
11574         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11575                 QT5_HAVE_GOBJECT=1
11576                 AC_DEFINE(QT5_HAVE_GOBJECT)
11577             ],
11578             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11579         )
11580     fi
11582 AC_SUBST(QT5_CFLAGS)
11583 AC_SUBST(QT5_LIBS)
11584 AC_SUBST(MOC5)
11585 AC_SUBST(QT5_GOBJECT_CFLAGS)
11586 AC_SUBST(QT5_GOBJECT_LIBS)
11587 AC_SUBST(QT5_HAVE_GOBJECT)
11589 dnl ===================================================================
11590 dnl KF5 Integration
11591 dnl ===================================================================
11593 KF5_CFLAGS=""
11594 KF5_LIBS=""
11595 KF5_CONFIG="kf5-config"
11596 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11597         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11598 then
11599     if test "$OS" = "HAIKU"; then
11600         haiku_arch="`echo $RTL_ARCH | tr X x`"
11601         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11602         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11603     fi
11605     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11606     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11607     if test -n "$supports_multilib"; then
11608         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11609     fi
11611     kf5_test_include="KF5/kcoreaddons_version.h"
11612     kf5_test_library="libKF5CoreAddons.so"
11613     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11615     dnl kf5 KDE4 support compatibility installed
11616     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11617     if test "$KF5_CONFIG" != "no"; then
11618         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11619         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11620     fi
11622     dnl Check for KF5 headers
11623     AC_MSG_CHECKING([for KF5 headers])
11624     kf5_incdir="no"
11625     for kf5_check in $kf5_incdirs; do
11626         if test -r "$kf5_check/$kf5_test_include"; then
11627             kf5_incdir="$kf5_check/KF5"
11628             break
11629         fi
11630     done
11631     AC_MSG_RESULT([$kf5_incdir])
11632     if test "x$kf5_incdir" = "xno"; then
11633         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11634     fi
11636     dnl Check for KF5 libraries
11637     AC_MSG_CHECKING([for KF5 libraries])
11638     kf5_libdir="no"
11639     for kf5_check in $kf5_libdirs; do
11640         if test -r "$kf5_check/$kf5_test_library"; then
11641             kf5_libdir="$kf5_check"
11642             break
11643         fi
11644     done
11646     AC_MSG_RESULT([$kf5_libdir])
11647     if test "x$kf5_libdir" = "xno"; then
11648         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11649     fi
11651     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"
11652     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11653     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11655     if test "$USING_X11" = TRUE; then
11656         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11657     fi
11659     AC_LANG_PUSH([C++])
11660     save_CXXFLAGS=$CXXFLAGS
11661     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11662     AC_MSG_CHECKING([whether KDE is >= 5.0])
11663        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11664 #include <kcoreaddons_version.h>
11666 int main(int argc, char **argv) {
11667        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11668        else return 1;
11670        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11671     CXXFLAGS=$save_CXXFLAGS
11672     AC_LANG_POP([C++])
11674 AC_SUBST(KF5_CFLAGS)
11675 AC_SUBST(KF5_LIBS)
11677 dnl ===================================================================
11678 dnl Test whether to include Evolution 2 support
11679 dnl ===================================================================
11680 AC_MSG_CHECKING([whether to enable evolution 2 support])
11681 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11682     AC_MSG_RESULT([yes])
11683     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11684     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11685     FilterLibs "${GOBJECT_LIBS}"
11686     GOBJECT_LIBS="${filteredlibs}"
11687     ENABLE_EVOAB2="TRUE"
11688 else
11689     ENABLE_EVOAB2=""
11690     AC_MSG_RESULT([no])
11692 AC_SUBST(ENABLE_EVOAB2)
11693 AC_SUBST(GOBJECT_CFLAGS)
11694 AC_SUBST(GOBJECT_LIBS)
11696 dnl ===================================================================
11697 dnl Test which themes to include
11698 dnl ===================================================================
11699 AC_MSG_CHECKING([which themes to include])
11700 # if none given use default subset of available themes
11701 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11702     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg tango"
11705 WITH_THEMES=""
11706 if test "x$with_theme" != "xno"; then
11707     for theme in $with_theme; do
11708         case $theme in
11709         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|tango) real_theme="$theme" ;;
11710         default) real_theme=colibre ;;
11711         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11712         esac
11713         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11714     done
11716 AC_MSG_RESULT([$WITH_THEMES])
11717 AC_SUBST([WITH_THEMES])
11718 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11719 for theme in $with_theme; do
11720     case $theme in
11721     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11722     *) ;;
11723     esac
11724 done
11726 dnl ===================================================================
11727 dnl Test whether to integrate helppacks into the product's installer
11728 dnl ===================================================================
11729 AC_MSG_CHECKING([for helppack integration])
11730 if test "$with_helppack_integration" = "no"; then
11731     AC_MSG_RESULT([no integration])
11732 else
11733     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11734     AC_MSG_RESULT([integration])
11737 ###############################################################################
11738 # Extensions checking
11739 ###############################################################################
11740 AC_MSG_CHECKING([for extensions integration])
11741 if test "x$enable_extension_integration" != "xno"; then
11742     WITH_EXTENSION_INTEGRATION=TRUE
11743     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11744     AC_MSG_RESULT([yes, use integration])
11745 else
11746     WITH_EXTENSION_INTEGRATION=
11747     AC_MSG_RESULT([no, do not integrate])
11749 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11751 dnl Should any extra extensions be included?
11752 dnl There are standalone tests for each of these below.
11753 WITH_EXTRA_EXTENSIONS=
11754 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11756 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11757 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11758 if test "x$with_java" != "xno"; then
11759     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11760     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11763 AC_MSG_CHECKING([whether to build opens___.ttf])
11764 if test "$enable_build_opensymbol" = "yes"; then
11765     AC_MSG_RESULT([yes])
11766     AC_PATH_PROG(FONTFORGE, fontforge)
11767     if test -z "$FONTFORGE"; then
11768         AC_MSG_ERROR([fontforge not installed])
11769     fi
11770 else
11771     AC_MSG_RESULT([no])
11772     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11773     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11775 AC_SUBST(OPENSYMBOL_TTF)
11776 AC_SUBST(FONTFORGE)
11778 dnl ===================================================================
11779 dnl Test whether to include fonts
11780 dnl ===================================================================
11781 AC_MSG_CHECKING([whether to include third-party fonts])
11782 if test "$with_fonts" != "no"; then
11783     AC_MSG_RESULT([yes])
11784     WITH_FONTS=TRUE
11785     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11786     AC_DEFINE(HAVE_MORE_FONTS)
11787 else
11788     AC_MSG_RESULT([no])
11789     WITH_FONTS=
11790     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11792 AC_SUBST(WITH_FONTS)
11794 dnl Test whether to include more Google Noto fonts
11795 dnl ===================================================================
11796 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11797 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11798     AC_MSG_RESULT([no])
11799     WITH_NOTO_FONT=
11800 else
11801     AC_MSG_RESULT([yes])
11802     WITH_NOTO_FONT=TRUE
11803     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11804     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11806 AC_SUBST(WITH_NOTO_FONT)
11808 dnl ===================================================================
11809 dnl Test whether to enable online update service
11810 dnl ===================================================================
11811 AC_MSG_CHECKING([whether to enable online update])
11812 ENABLE_ONLINE_UPDATE=
11813 ENABLE_ONLINE_UPDATE_MAR=
11814 UPDATE_CONFIG=
11815 if test "$enable_online_update" = ""; then
11816     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11817         AC_MSG_RESULT([yes])
11818         ENABLE_ONLINE_UPDATE="TRUE"
11819     else
11820         AC_MSG_RESULT([no])
11821     fi
11822 else
11823     if test "$enable_online_update" = "mar"; then
11824         AC_MSG_RESULT([yes - MAR-based online update])
11825         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11826         if test "$with_update_config" = ""; then
11827             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11828         fi
11829         UPDATE_CONFIG="$with_update_config"
11830         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11831     elif test "$enable_online_update" = "yes"; then
11832         AC_MSG_RESULT([yes])
11833         ENABLE_ONLINE_UPDATE="TRUE"
11834     else
11835         AC_MSG_RESULT([no])
11836     fi
11838 AC_SUBST(ENABLE_ONLINE_UPDATE)
11839 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11840 AC_SUBST(UPDATE_CONFIG)
11842 dnl ===================================================================
11843 dnl Test whether we need bzip2
11844 dnl ===================================================================
11845 SYSTEM_BZIP2=
11846 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11847     AC_MSG_CHECKING([whether to use system bzip2])
11848     if test "$with_system_bzip2" = yes; then
11849         SYSTEM_BZIP2=TRUE
11850         AC_MSG_RESULT([yes])
11851         PKG_CHECK_MODULES(BZIP2, bzip2)
11852         FilterLibs "${BZIP2_LIBS}"
11853         BZIP2_LIBS="${filteredlibs}"
11854     else
11855         AC_MSG_RESULT([no])
11856         BUILD_TYPE="$BUILD_TYPE BZIP2"
11857     fi
11859 AC_SUBST(SYSTEM_BZIP2)
11860 AC_SUBST(BZIP2_CFLAGS)
11861 AC_SUBST(BZIP2_LIBS)
11863 dnl ===================================================================
11864 dnl Test whether to enable extension update
11865 dnl ===================================================================
11866 AC_MSG_CHECKING([whether to enable extension update])
11867 ENABLE_EXTENSION_UPDATE=
11868 if test "x$enable_extension_update" = "xno"; then
11869     AC_MSG_RESULT([no])
11870 else
11871     AC_MSG_RESULT([yes])
11872     ENABLE_EXTENSION_UPDATE="TRUE"
11873     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11874     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11876 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11879 dnl ===================================================================
11880 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11881 dnl ===================================================================
11882 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11883 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11884     AC_MSG_RESULT([no])
11885     ENABLE_SILENT_MSI=
11886 else
11887     AC_MSG_RESULT([yes])
11888     ENABLE_SILENT_MSI=TRUE
11889     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11891 AC_SUBST(ENABLE_SILENT_MSI)
11893 AC_MSG_CHECKING([whether and how to use Xinerama])
11894 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11895     if test "$x_libraries" = "default_x_libraries"; then
11896         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11897         if test "x$XINERAMALIB" = x; then
11898            XINERAMALIB="/usr/lib"
11899         fi
11900     else
11901         XINERAMALIB="$x_libraries"
11902     fi
11903     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11904         # we have both versions, let the user decide but use the dynamic one
11905         # per default
11906         USE_XINERAMA=TRUE
11907         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11908             XINERAMA_LINK=dynamic
11909         else
11910             XINERAMA_LINK=static
11911         fi
11912     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11913         # we have only the dynamic version
11914         USE_XINERAMA=TRUE
11915         XINERAMA_LINK=dynamic
11916     elif test -e "$XINERAMALIB/libXinerama.a"; then
11917         # static version
11918         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11919             USE_XINERAMA=TRUE
11920             XINERAMA_LINK=static
11921         else
11922             USE_XINERAMA=
11923             XINERAMA_LINK=none
11924         fi
11925     else
11926         # no Xinerama
11927         USE_XINERAMA=
11928         XINERAMA_LINK=none
11929     fi
11930     if test "$USE_XINERAMA" = "TRUE"; then
11931         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11932         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11933             [AC_MSG_ERROR(Xinerama header not found.)], [])
11934         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11935         if test "x$XEXTLIB" = x; then
11936            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11937         fi
11938         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11939         if test "$_os" = "FreeBSD"; then
11940             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11941         fi
11942         if test "$_os" = "Linux"; then
11943             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11944         fi
11945         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11946             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11947     else
11948         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11949     fi
11950 else
11951     USE_XINERAMA=
11952     XINERAMA_LINK=none
11953     AC_MSG_RESULT([no])
11955 AC_SUBST(USE_XINERAMA)
11956 AC_SUBST(XINERAMA_LINK)
11958 dnl ===================================================================
11959 dnl Test whether to build cairo or rely on the system version
11960 dnl ===================================================================
11962 if test "$USING_X11" = TRUE; then
11963     # Used in vcl/Library_vclplug_gen.mk
11964     test_cairo=yes
11967 if test "$test_cairo" = "yes"; then
11968     AC_MSG_CHECKING([whether to use the system cairo])
11970     : ${with_system_cairo:=$with_system_libs}
11971     if test "$with_system_cairo" = "yes"; then
11972         SYSTEM_CAIRO=TRUE
11973         AC_MSG_RESULT([yes])
11975         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11976         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11977         FilterLibs "${CAIRO_LIBS}"
11978         CAIRO_LIBS="${filteredlibs}"
11980         if test "$test_xrender" = "yes"; then
11981             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11982             AC_LANG_PUSH([C])
11983             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11984 #ifdef PictStandardA8
11985 #else
11986       return fail;
11987 #endif
11988 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11990             AC_LANG_POP([C])
11991         fi
11992     else
11993         SYSTEM_CAIRO=
11994         AC_MSG_RESULT([no])
11996         BUILD_TYPE="$BUILD_TYPE CAIRO"
11997     fi
12000 AC_SUBST(SYSTEM_CAIRO)
12001 AC_SUBST(CAIRO_CFLAGS)
12002 AC_SUBST(CAIRO_LIBS)
12004 dnl ===================================================================
12005 dnl Test whether to use avahi
12006 dnl ===================================================================
12007 if test "$_os" = "WINNT"; then
12008     # Windows uses bundled mDNSResponder
12009     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12010 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12011     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12012                       [ENABLE_AVAHI="TRUE"])
12013     AC_DEFINE(HAVE_FEATURE_AVAHI)
12014     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12015     FilterLibs "${AVAHI_LIBS}"
12016     AVAHI_LIBS="${filteredlibs}"
12019 AC_SUBST(ENABLE_AVAHI)
12020 AC_SUBST(AVAHI_CFLAGS)
12021 AC_SUBST(AVAHI_LIBS)
12023 dnl ===================================================================
12024 dnl Test whether to use liblangtag
12025 dnl ===================================================================
12026 SYSTEM_LIBLANGTAG=
12027 AC_MSG_CHECKING([whether to use system liblangtag])
12028 if test "$with_system_liblangtag" = yes; then
12029     SYSTEM_LIBLANGTAG=TRUE
12030     AC_MSG_RESULT([yes])
12031     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12032     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12033     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12034     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12035     FilterLibs "${LIBLANGTAG_LIBS}"
12036     LIBLANGTAG_LIBS="${filteredlibs}"
12037 else
12038     SYSTEM_LIBLANGTAG=
12039     AC_MSG_RESULT([no])
12040     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12041     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12042     if test "$COM" = "MSC"; then
12043         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12044     else
12045         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12046     fi
12048 AC_SUBST(SYSTEM_LIBLANGTAG)
12049 AC_SUBST(LIBLANGTAG_CFLAGS)
12050 AC_SUBST(LIBLANGTAG_LIBS)
12052 dnl ===================================================================
12053 dnl Test whether to build libpng or rely on the system version
12054 dnl ===================================================================
12056 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12058 dnl ===================================================================
12059 dnl Check for runtime JVM search path
12060 dnl ===================================================================
12061 if test "$ENABLE_JAVA" != ""; then
12062     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12063     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12064         AC_MSG_RESULT([yes])
12065         if ! test -d "$with_jvm_path"; then
12066             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12067         fi
12068         if ! test -d "$with_jvm_path"jvm; then
12069             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12070         fi
12071         JVM_ONE_PATH_CHECK="$with_jvm_path"
12072         AC_SUBST(JVM_ONE_PATH_CHECK)
12073     else
12074         AC_MSG_RESULT([no])
12075     fi
12078 dnl ===================================================================
12079 dnl Test for the presence of Ant and that it works
12080 dnl ===================================================================
12082 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12083     ANT_HOME=; export ANT_HOME
12084     WITH_ANT_HOME=; export WITH_ANT_HOME
12085     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12086         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12087             if test "$_os" = "WINNT"; then
12088                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12089             else
12090                 with_ant_home="$LODE_HOME/opt/ant"
12091             fi
12092         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12093             with_ant_home="$LODE_HOME/opt/ant"
12094         fi
12095     fi
12096     if test -z "$with_ant_home"; then
12097         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12098     else
12099         if test "$_os" = "WINNT"; then
12100             # AC_PATH_PROGS needs unix path
12101             with_ant_home=`cygpath -u "$with_ant_home"`
12102         fi
12103         AbsolutePath "$with_ant_home"
12104         with_ant_home=$absolute_path
12105         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12106         WITH_ANT_HOME=$with_ant_home
12107         ANT_HOME=$with_ant_home
12108     fi
12110     if test -z "$ANT"; then
12111         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12112     else
12113         # resolve relative or absolute symlink
12114         while test -h "$ANT"; do
12115             a_cwd=`pwd`
12116             a_basename=`basename "$ANT"`
12117             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12118             cd "`dirname "$ANT"`"
12119             cd "`dirname "$a_script"`"
12120             ANT="`pwd`"/"`basename "$a_script"`"
12121             cd "$a_cwd"
12122         done
12124         AC_MSG_CHECKING([if $ANT works])
12125         mkdir -p conftest.dir
12126         a_cwd=$(pwd)
12127         cd conftest.dir
12128         cat > conftest.java << EOF
12129         public class conftest {
12130             int testmethod(int a, int b) {
12131                     return a + b;
12132             }
12133         }
12136         cat > conftest.xml << EOF
12137         <project name="conftest" default="conftest">
12138         <target name="conftest">
12139             <javac srcdir="." includes="conftest.java">
12140             </javac>
12141         </target>
12142         </project>
12145         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12146         if test $? = 0 -a -f ./conftest.class; then
12147             AC_MSG_RESULT([Ant works])
12148             if test -z "$WITH_ANT_HOME"; then
12149                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12150                 if test -z "$ANT_HOME"; then
12151                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12152                 fi
12153             else
12154                 ANT_HOME="$WITH_ANT_HOME"
12155             fi
12156         else
12157             echo "configure: Ant test failed" >&5
12158             cat conftest.java >&5
12159             cat conftest.xml >&5
12160             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12161         fi
12162         cd "$a_cwd"
12163         rm -fr conftest.dir
12164     fi
12165     if test -z "$ANT_HOME"; then
12166         ANT_HOME="NO_ANT_HOME"
12167     else
12168         PathFormat "$ANT_HOME"
12169         ANT_HOME="$formatted_path"
12170         PathFormat "$ANT"
12171         ANT="$formatted_path"
12172     fi
12173     AC_SUBST(ANT_HOME)
12174     AC_SUBST(ANT)
12176     dnl Checking for ant.jar
12177     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12178         AC_MSG_CHECKING([Ant lib directory])
12179         if test -f $ANT_HOME/lib/ant.jar; then
12180             ANT_LIB="$ANT_HOME/lib"
12181         else
12182             if test -f $ANT_HOME/ant.jar; then
12183                 ANT_LIB="$ANT_HOME"
12184             else
12185                 if test -f /usr/share/java/ant.jar; then
12186                     ANT_LIB=/usr/share/java
12187                 else
12188                     if test -f /usr/share/ant-core/lib/ant.jar; then
12189                         ANT_LIB=/usr/share/ant-core/lib
12190                     else
12191                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12192                             ANT_LIB="$ANT_HOME/lib/ant"
12193                         else
12194                             if test -f /usr/share/lib/ant/ant.jar; then
12195                                 ANT_LIB=/usr/share/lib/ant
12196                             else
12197                                 AC_MSG_ERROR([Ant libraries not found!])
12198                             fi
12199                         fi
12200                     fi
12201                 fi
12202             fi
12203         fi
12204         PathFormat "$ANT_LIB"
12205         ANT_LIB="$formatted_path"
12206         AC_MSG_RESULT([Ant lib directory found.])
12207     fi
12208     AC_SUBST(ANT_LIB)
12210     ant_minver=1.6.0
12211     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12213     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12214     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12215     ant_version_major=`echo $ant_version | cut -d. -f1`
12216     ant_version_minor=`echo $ant_version | cut -d. -f2`
12217     echo "configure: ant_version $ant_version " >&5
12218     echo "configure: ant_version_major $ant_version_major " >&5
12219     echo "configure: ant_version_minor $ant_version_minor " >&5
12220     if test "$ant_version_major" -ge "2"; then
12221         AC_MSG_RESULT([yes, $ant_version])
12222     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12223         AC_MSG_RESULT([yes, $ant_version])
12224     else
12225         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12226     fi
12228     rm -f conftest* core core.* *.core
12231 OOO_JUNIT_JAR=
12232 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12233     AC_MSG_CHECKING([for JUnit 4])
12234     if test "$with_junit" = "yes"; then
12235         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12236             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12237         elif test -e /usr/share/java/junit4.jar; then
12238             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12239         else
12240            if test -e /usr/share/lib/java/junit.jar; then
12241               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12242            else
12243               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12244            fi
12245         fi
12246     else
12247         OOO_JUNIT_JAR=$with_junit
12248     fi
12249     if test "$_os" = "WINNT"; then
12250         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12251     fi
12252     printf 'import org.junit.Before;' > conftest.java
12253     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12254         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12255     else
12256         AC_MSG_ERROR(
12257 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12258  specify its pathname via --with-junit=..., or disable it via --without-junit])
12259     fi
12260     rm -f conftest.class conftest.java
12261     if test $OOO_JUNIT_JAR != ""; then
12262     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12263     fi
12265 AC_SUBST(OOO_JUNIT_JAR)
12267 HAMCREST_JAR=
12268 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12269     AC_MSG_CHECKING([for included Hamcrest])
12270     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12271     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12272         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12273     else
12274         AC_MSG_RESULT([Not included])
12275         AC_MSG_CHECKING([for standalone hamcrest jar.])
12276         if test "$with_hamcrest" = "yes"; then
12277             if test -e /usr/share/lib/java/hamcrest.jar; then
12278                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12279             elif test -e /usr/share/java/hamcrest/core.jar; then
12280                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12281             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
12282                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
12283             else
12284                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12285             fi
12286         else
12287             HAMCREST_JAR=$with_hamcrest
12288         fi
12289         if test "$_os" = "WINNT"; then
12290             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12291         fi
12292         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12293             AC_MSG_RESULT([$HAMCREST_JAR])
12294         else
12295             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),
12296                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12297         fi
12298     fi
12299     rm -f conftest.class conftest.java
12301 AC_SUBST(HAMCREST_JAR)
12304 AC_SUBST(SCPDEFS)
12307 # check for wget and curl
12309 WGET=
12310 CURL=
12312 if test "$enable_fetch_external" != "no"; then
12314 CURL=`which curl 2>/dev/null`
12316 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12317     # wget new enough?
12318     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12319     if test $? -eq 0; then
12320         WGET=$i
12321         break
12322     fi
12323 done
12325 if test -z "$WGET" -a -z "$CURL"; then
12326     AC_MSG_ERROR([neither wget nor curl found!])
12331 AC_SUBST(WGET)
12332 AC_SUBST(CURL)
12335 # check for sha256sum
12337 SHA256SUM=
12339 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12340     eval "$i -a 256 --version" > /dev/null 2>&1
12341     ret=$?
12342     if test $ret -eq 0; then
12343         SHA256SUM="$i -a 256"
12344         break
12345     fi
12346 done
12348 if test -z "$SHA256SUM"; then
12349     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12350         eval "$i --version" > /dev/null 2>&1
12351         ret=$?
12352         if test $ret -eq 0; then
12353             SHA256SUM=$i
12354             break
12355         fi
12356     done
12359 if test -z "$SHA256SUM"; then
12360     AC_MSG_ERROR([no sha256sum found!])
12363 AC_SUBST(SHA256SUM)
12365 dnl ===================================================================
12366 dnl Dealing with l10n options
12367 dnl ===================================================================
12368 AC_MSG_CHECKING([which languages to be built])
12369 # get list of all languages
12370 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12371 # the sed command does the following:
12372 #   + if a line ends with a backslash, append the next line to it
12373 #   + adds " on the beginning of the value (after =)
12374 #   + adds " at the end of the value
12375 #   + removes en-US; we want to put it on the beginning
12376 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12377 [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)]
12378 ALL_LANGS="en-US $completelangiso"
12379 # check the configured localizations
12380 WITH_LANG="$with_lang"
12382 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12383 # (Norwegian is "nb" and "nn".)
12384 if test "$WITH_LANG" = "no"; then
12385     WITH_LANG=
12388 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12389     AC_MSG_RESULT([en-US])
12390 else
12391     AC_MSG_RESULT([$WITH_LANG])
12392     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12393     if test -z "$MSGFMT"; then
12394         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12395             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12396         elif test -x "/opt/lo/bin/msgfmt"; then
12397             MSGFMT="/opt/lo/bin/msgfmt"
12398         else
12399             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12400             if test -z "$MSGFMT"; then
12401                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12402             fi
12403         fi
12404     fi
12405     if test -z "$MSGUNIQ"; then
12406         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12407             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12408         elif test -x "/opt/lo/bin/msguniq"; then
12409             MSGUNIQ="/opt/lo/bin/msguniq"
12410         else
12411             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12412             if test -z "$MSGUNIQ"; then
12413                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12414             fi
12415         fi
12416     fi
12418 AC_SUBST(MSGFMT)
12419 AC_SUBST(MSGUNIQ)
12420 # check that the list is valid
12421 for lang in $WITH_LANG; do
12422     test "$lang" = "ALL" && continue
12423     # need to check for the exact string, so add space before and after the list of all languages
12424     for vl in $ALL_LANGS; do
12425         if test "$vl" = "$lang"; then
12426            break
12427         fi
12428     done
12429     if test "$vl" != "$lang"; then
12430         # if you're reading this - you prolly quoted your languages remove the quotes ...
12431         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12432     fi
12433 done
12434 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12435     echo $WITH_LANG | grep -q en-US
12436     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12438 # list with substituted ALL
12439 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12440 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12441 test "$WITH_LANG" = "en-US" && WITH_LANG=
12442 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12443     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12444     ALL_LANGS=`echo $ALL_LANGS qtz`
12446 AC_SUBST(ALL_LANGS)
12447 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12448 AC_SUBST(WITH_LANG)
12449 AC_SUBST(WITH_LANG_LIST)
12450 AC_SUBST(GIT_NEEDED_SUBMODULES)
12452 WITH_POOR_HELP_LOCALIZATIONS=
12453 if test -d "$SRC_ROOT/translations/source"; then
12454     for l in `ls -1 $SRC_ROOT/translations/source`; do
12455         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12456             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12457         fi
12458     done
12460 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12462 if test -n "$with_locales"; then
12463     WITH_LOCALES="$with_locales"
12465     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12466     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12467     # config_host/config_locales.h.in
12468     for locale in $WITH_LOCALES; do
12469         lang=${locale%_*}
12471         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12473         case $lang in
12474         hi|mr*ne)
12475             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12476             ;;
12477         bg|ru)
12478             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12479             ;;
12480         esac
12481     done
12482 else
12483     AC_DEFINE(WITH_LOCALE_ALL)
12485 AC_SUBST(WITH_LOCALES)
12487 dnl git submodule update --reference
12488 dnl ===================================================================
12489 if test -n "${GIT_REFERENCE_SRC}"; then
12490     for repo in ${GIT_NEEDED_SUBMODULES}; do
12491         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12492             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12493         fi
12494     done
12496 AC_SUBST(GIT_REFERENCE_SRC)
12498 dnl git submodules linked dirs
12499 dnl ===================================================================
12500 if test -n "${GIT_LINK_SRC}"; then
12501     for repo in ${GIT_NEEDED_SUBMODULES}; do
12502         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12503             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12504         fi
12505     done
12507 AC_SUBST(GIT_LINK_SRC)
12509 dnl branding
12510 dnl ===================================================================
12511 AC_MSG_CHECKING([for alternative branding images directory])
12512 # initialize mapped arrays
12513 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12514 brand_files="$BRAND_INTRO_IMAGES about.svg"
12516 if test -z "$with_branding" -o "$with_branding" = "no"; then
12517     AC_MSG_RESULT([none])
12518     DEFAULT_BRAND_IMAGES="$brand_files"
12519 else
12520     if ! test -d $with_branding ; then
12521         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12522     else
12523         AC_MSG_RESULT([$with_branding])
12524         CUSTOM_BRAND_DIR="$with_branding"
12525         for lfile in $brand_files
12526         do
12527             if ! test -f $with_branding/$lfile ; then
12528                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12529                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12530             else
12531                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12532             fi
12533         done
12534         check_for_progress="yes"
12535     fi
12537 AC_SUBST([BRAND_INTRO_IMAGES])
12538 AC_SUBST([CUSTOM_BRAND_DIR])
12539 AC_SUBST([CUSTOM_BRAND_IMAGES])
12540 AC_SUBST([DEFAULT_BRAND_IMAGES])
12543 AC_MSG_CHECKING([for 'intro' progress settings])
12544 PROGRESSBARCOLOR=
12545 PROGRESSSIZE=
12546 PROGRESSPOSITION=
12547 PROGRESSFRAMECOLOR=
12548 PROGRESSTEXTCOLOR=
12549 PROGRESSTEXTBASELINE=
12551 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12552     source "$with_branding/progress.conf"
12553     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12554 else
12555     AC_MSG_RESULT([none])
12558 AC_SUBST(PROGRESSBARCOLOR)
12559 AC_SUBST(PROGRESSSIZE)
12560 AC_SUBST(PROGRESSPOSITION)
12561 AC_SUBST(PROGRESSFRAMECOLOR)
12562 AC_SUBST(PROGRESSTEXTCOLOR)
12563 AC_SUBST(PROGRESSTEXTBASELINE)
12566 AC_MSG_CHECKING([for extra build ID])
12567 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12568     EXTRA_BUILDID="$with_extra_buildid"
12570 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12571 if test -n "$EXTRA_BUILDID" ; then
12572     AC_MSG_RESULT([$EXTRA_BUILDID])
12573 else
12574     AC_MSG_RESULT([not set])
12576 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12578 OOO_VENDOR=
12579 AC_MSG_CHECKING([for vendor])
12580 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12581     OOO_VENDOR="$USERNAME"
12583     if test -z "$OOO_VENDOR"; then
12584         OOO_VENDOR="$USER"
12585     fi
12587     if test -z "$OOO_VENDOR"; then
12588         OOO_VENDOR="`id -u -n`"
12589     fi
12591     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12592 else
12593     OOO_VENDOR="$with_vendor"
12594     AC_MSG_RESULT([$OOO_VENDOR])
12596 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12597 AC_SUBST(OOO_VENDOR)
12599 if test "$_os" = "Android" ; then
12600     ANDROID_PACKAGE_NAME=
12601     AC_MSG_CHECKING([for Android package name])
12602     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12603         if test -n "$ENABLE_DEBUG"; then
12604             # Default to the package name that makes ndk-gdb happy.
12605             ANDROID_PACKAGE_NAME="org.libreoffice"
12606         else
12607             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12608         fi
12610         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12611     else
12612         ANDROID_PACKAGE_NAME="$with_android_package_name"
12613         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12614     fi
12615     AC_SUBST(ANDROID_PACKAGE_NAME)
12618 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12619 if test "$with_compat_oowrappers" = "yes"; then
12620     WITH_COMPAT_OOWRAPPERS=TRUE
12621     AC_MSG_RESULT(yes)
12622 else
12623     WITH_COMPAT_OOWRAPPERS=
12624     AC_MSG_RESULT(no)
12626 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12628 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12629 AC_MSG_CHECKING([for install dirname])
12630 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12631     INSTALLDIRNAME="$with_install_dirname"
12633 AC_MSG_RESULT([$INSTALLDIRNAME])
12634 AC_SUBST(INSTALLDIRNAME)
12636 AC_MSG_CHECKING([for prefix])
12637 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12638 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12639 PREFIXDIR="$prefix"
12640 AC_MSG_RESULT([$PREFIXDIR])
12641 AC_SUBST(PREFIXDIR)
12643 LIBDIR=[$(eval echo $(eval echo $libdir))]
12644 AC_SUBST(LIBDIR)
12646 DATADIR=[$(eval echo $(eval echo $datadir))]
12647 AC_SUBST(DATADIR)
12649 MANDIR=[$(eval echo $(eval echo $mandir))]
12650 AC_SUBST(MANDIR)
12652 DOCDIR=[$(eval echo $(eval echo $docdir))]
12653 AC_SUBST(DOCDIR)
12655 BINDIR=[$(eval echo $(eval echo $bindir))]
12656 AC_SUBST(BINDIR)
12658 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12659 AC_SUBST(INSTALLDIR)
12661 TESTINSTALLDIR="${BUILDDIR}/test-install"
12662 AC_SUBST(TESTINSTALLDIR)
12665 # ===================================================================
12666 # OAuth2 id and secrets
12667 # ===================================================================
12669 AC_MSG_CHECKING([for Google Drive client id and secret])
12670 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12671     AC_MSG_RESULT([not set])
12672     GDRIVE_CLIENT_ID="\"\""
12673     GDRIVE_CLIENT_SECRET="\"\""
12674 else
12675     AC_MSG_RESULT([set])
12676     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12677     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12679 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12680 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12682 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12683 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12684     AC_MSG_RESULT([not set])
12685     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12686     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12687 else
12688     AC_MSG_RESULT([set])
12689     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12690     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12692 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12693 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12695 AC_MSG_CHECKING([for OneDrive client id and secret])
12696 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12697     AC_MSG_RESULT([not set])
12698     ONEDRIVE_CLIENT_ID="\"\""
12699     ONEDRIVE_CLIENT_SECRET="\"\""
12700 else
12701     AC_MSG_RESULT([set])
12702     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12703     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12705 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12706 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12709 dnl ===================================================================
12710 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12711 dnl --enable-dependency-tracking configure option
12712 dnl ===================================================================
12713 AC_MSG_CHECKING([whether to enable dependency tracking])
12714 if test "$enable_dependency_tracking" = "no"; then
12715     nodep=TRUE
12716     AC_MSG_RESULT([no])
12717 else
12718     AC_MSG_RESULT([yes])
12720 AC_SUBST(nodep)
12722 dnl ===================================================================
12723 dnl Number of CPUs to use during the build
12724 dnl ===================================================================
12725 AC_MSG_CHECKING([for number of processors to use])
12726 # plain --with-parallelism is just the default
12727 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12728     if test "$with_parallelism" = "no"; then
12729         PARALLELISM=0
12730     else
12731         PARALLELISM=$with_parallelism
12732     fi
12733 else
12734     if test "$enable_icecream" = "yes"; then
12735         PARALLELISM="40"
12736     else
12737         case `uname -s` in
12739         Darwin|FreeBSD|NetBSD|OpenBSD)
12740             PARALLELISM=`sysctl -n hw.ncpu`
12741             ;;
12743         Linux)
12744             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12745         ;;
12746         # what else than above does profit here *and* has /proc?
12747         *)
12748             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12749             ;;
12750         esac
12752         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12753         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12754     fi
12757 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12758     if test -z "$with_parallelism"; then
12759             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12760             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12761             PARALLELISM="1"
12762     else
12763         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."
12764     fi
12767 if test $PARALLELISM -eq 0; then
12768     AC_MSG_RESULT([explicit make -j option needed])
12769 else
12770     AC_MSG_RESULT([$PARALLELISM])
12772 AC_SUBST(PARALLELISM)
12774 IWYU_PATH="$with_iwyu"
12775 AC_SUBST(IWYU_PATH)
12776 if test ! -z "$IWYU_PATH"; then
12777     if test ! -f "$IWYU_PATH"; then
12778         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12779     fi
12783 # Set up ILIB for MSVC build
12785 ILIB1=
12786 if test "$build_os" = "cygwin"; then
12787     ILIB="."
12788     if test -n "$JAVA_HOME"; then
12789         ILIB="$ILIB;$JAVA_HOME/lib"
12790     fi
12791     ILIB1=-link
12792     if test "$BITNESS_OVERRIDE" = 64; then
12793         ILIB="$ILIB;$COMPATH/lib/x64"
12794         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12795         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12796         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12797         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12798             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12799             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12800         fi
12801         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12802         ucrtlibpath_formatted=$formatted_path
12803         ILIB="$ILIB;$ucrtlibpath_formatted"
12804         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12805     else
12806         ILIB="$ILIB;$COMPATH/lib/x86"
12807         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12808         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12809         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12810         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12811             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12812             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12813         fi
12814         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12815         ucrtlibpath_formatted=$formatted_path
12816         ILIB="$ILIB;$ucrtlibpath_formatted"
12817         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12818     fi
12819     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12820         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12821     else
12822         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12823     fi
12825     AC_SUBST(ILIB)
12828 # ===================================================================
12829 # Creating bigger shared library to link against
12830 # ===================================================================
12831 AC_MSG_CHECKING([whether to create huge library])
12832 MERGELIBS=
12834 if test $_os = iOS -o $_os = Android; then
12835     # Never any point in mergelibs for these as we build just static
12836     # libraries anyway...
12837     enable_mergelibs=no
12840 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12841     if test $_os != Linux -a $_os != WINNT; then
12842         add_warning "--enable-mergelibs is not tested for this platform"
12843     fi
12844     MERGELIBS="TRUE"
12845     AC_MSG_RESULT([yes])
12846 else
12847     AC_MSG_RESULT([no])
12849 AC_SUBST([MERGELIBS])
12851 dnl ===================================================================
12852 dnl icerun is a wrapper that stops us spawning tens of processes
12853 dnl locally - for tools that can't be executed on the compile cluster
12854 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12855 dnl ===================================================================
12856 AC_MSG_CHECKING([whether to use icerun wrapper])
12857 ICECREAM_RUN=
12858 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12859     ICECREAM_RUN=icerun
12860     AC_MSG_RESULT([yes])
12861 else
12862     AC_MSG_RESULT([no])
12864 AC_SUBST(ICECREAM_RUN)
12866 dnl ===================================================================
12867 dnl Setup the ICECC_VERSION for the build the same way it was set for
12868 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12869 dnl ===================================================================
12870 x_ICECC_VERSION=[\#]
12871 if test -n "$ICECC_VERSION" ; then
12872     x_ICECC_VERSION=
12874 AC_SUBST(x_ICECC_VERSION)
12875 AC_SUBST(ICECC_VERSION)
12877 dnl ===================================================================
12879 AC_MSG_CHECKING([MPL subset])
12880 MPL_SUBSET=
12882 if test "$enable_mpl_subset" = "yes"; then
12883     warn_report=false
12884     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12885         warn_report=true
12886     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12887         warn_report=true
12888     fi
12889     if test "$warn_report" = "true"; then
12890         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12891     fi
12892     if test "x$enable_postgresql_sdbc" != "xno"; then
12893         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12894     fi
12895     if test "$enable_lotuswordpro" = "yes"; then
12896         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12897     fi
12898     if test "$WITH_WEBDAV" = "neon"; then
12899         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12900     fi
12901     if test -n "$ENABLE_POPPLER"; then
12902         if test "x$SYSTEM_POPPLER" = "x"; then
12903             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12904         fi
12905     fi
12906     # cf. m4/libo_check_extension.m4
12907     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12908         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12909     fi
12910     for theme in $WITH_THEMES; do
12911         case $theme in
12912         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12913             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12914         *) : ;;
12915         esac
12916     done
12918     ENABLE_OPENGL_TRANSITIONS=
12920     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12921         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12922     fi
12924     MPL_SUBSET="TRUE"
12925     AC_DEFINE(MPL_HAVE_SUBSET)
12926     AC_MSG_RESULT([only])
12927 else
12928     AC_MSG_RESULT([no restrictions])
12930 AC_SUBST(MPL_SUBSET)
12932 dnl ===================================================================
12934 AC_MSG_CHECKING([formula logger])
12935 ENABLE_FORMULA_LOGGER=
12937 if test "x$enable_formula_logger" = "xyes"; then
12938     AC_MSG_RESULT([yes])
12939     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12940     ENABLE_FORMULA_LOGGER=TRUE
12941 elif test -n "$ENABLE_DBGUTIL" ; then
12942     AC_MSG_RESULT([yes])
12943     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12944     ENABLE_FORMULA_LOGGER=TRUE
12945 else
12946     AC_MSG_RESULT([no])
12949 AC_SUBST(ENABLE_FORMULA_LOGGER)
12951 dnl ===================================================================
12952 dnl Setting up the environment.
12953 dnl ===================================================================
12954 AC_MSG_NOTICE([setting up the build environment variables...])
12956 AC_SUBST(COMPATH)
12958 if test "$build_os" = "cygwin"; then
12959     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12960         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12961         ATL_INCLUDE="$COMPATH/atlmfc/include"
12962     elif test -d "$COMPATH/atlmfc/lib"; then
12963         ATL_LIB="$COMPATH/atlmfc/lib"
12964         ATL_INCLUDE="$COMPATH/atlmfc/include"
12965     else
12966         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12967         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12968     fi
12969     if test "$BITNESS_OVERRIDE" = 64; then
12970         ATL_LIB="$ATL_LIB/x64"
12971     else
12972         ATL_LIB="$ATL_LIB/x86"
12973     fi
12974     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12975     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12977     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12978     PathFormat "/usr/bin/find.exe"
12979     FIND="$formatted_path"
12980     PathFormat "/usr/bin/sort.exe"
12981     SORT="$formatted_path"
12982     PathFormat "/usr/bin/grep.exe"
12983     WIN_GREP="$formatted_path"
12984     PathFormat "/usr/bin/ls.exe"
12985     WIN_LS="$formatted_path"
12986     PathFormat "/usr/bin/touch.exe"
12987     WIN_TOUCH="$formatted_path"
12988 else
12989     FIND=find
12990     SORT=sort
12993 AC_SUBST(ATL_INCLUDE)
12994 AC_SUBST(ATL_LIB)
12995 AC_SUBST(FIND)
12996 AC_SUBST(SORT)
12997 AC_SUBST(WIN_GREP)
12998 AC_SUBST(WIN_LS)
12999 AC_SUBST(WIN_TOUCH)
13001 AC_SUBST(BUILD_TYPE)
13003 AC_SUBST(SOLARINC)
13005 PathFormat "$PERL"
13006 PERL="$formatted_path"
13007 AC_SUBST(PERL)
13009 if test -n "$TMPDIR"; then
13010     TEMP_DIRECTORY="$TMPDIR"
13011 else
13012     TEMP_DIRECTORY="/tmp"
13014 if test "$build_os" = "cygwin"; then
13015     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13017 AC_SUBST(TEMP_DIRECTORY)
13019 # setup the PATH for the environment
13020 if test -n "$LO_PATH_FOR_BUILD"; then
13021     LO_PATH="$LO_PATH_FOR_BUILD"
13022 else
13023     LO_PATH="$PATH"
13025     case "$host_os" in
13027     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13028         if test "$ENABLE_JAVA" != ""; then
13029             pathmunge "$JAVA_HOME/bin" "after"
13030         fi
13031         ;;
13033     cygwin*)
13034         # Win32 make needs native paths
13035         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13036             LO_PATH=`cygpath -p -m "$PATH"`
13037         fi
13038         if test "$BITNESS_OVERRIDE" = 64; then
13039             # needed for msi packaging
13040             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13041         fi
13042         # .NET 4.6 and higher don't have bin directory
13043         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13044             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13045         fi
13046         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13047         pathmunge "$CSC_PATH" "before"
13048         pathmunge "$MIDL_PATH" "before"
13049         pathmunge "$AL_PATH" "before"
13050         pathmunge "$MSPDB_PATH" "before"
13051         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13052             pathmunge "$CL_PATH" "before"
13053         fi
13054         if test -n "$MSBUILD_PATH" ; then
13055             pathmunge "$MSBUILD_PATH" "before"
13056         fi
13057         if test "$BITNESS_OVERRIDE" = 64; then
13058             pathmunge "$COMPATH/bin/amd64" "before"
13059             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13060         else
13061             pathmunge "$COMPATH/bin" "before"
13062             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13063         fi
13064         if test "$ENABLE_JAVA" != ""; then
13065             if test -d "$JAVA_HOME/jre/bin/client"; then
13066                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13067             fi
13068             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13069                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13070             fi
13071             pathmunge "$JAVA_HOME/bin" "before"
13072         fi
13073         ;;
13075     solaris*)
13076         pathmunge "/usr/css/bin" "before"
13077         if test "$ENABLE_JAVA" != ""; then
13078             pathmunge "$JAVA_HOME/bin" "after"
13079         fi
13080         ;;
13081     esac
13084 AC_SUBST(LO_PATH)
13086 libo_FUZZ_SUMMARY
13088 # Generate a configuration sha256 we can use for deps
13089 if test -f config_host.mk; then
13090     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13092 if test -f config_host_lang.mk; then
13093     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13096 CFLAGS=$my_original_CFLAGS
13097 CXXFLAGS=$my_original_CXXFLAGS
13098 CPPFLAGS=$my_original_CPPFLAGS
13100 AC_CONFIG_LINKS([include:include])
13101 AC_CONFIG_FILES([config_host.mk
13102                  config_host_lang.mk
13103                  Makefile
13104                  bin/bffvalidator.sh
13105                  bin/odfvalidator.sh
13106                  bin/officeotron.sh
13107                  instsetoo_native/util/openoffice.lst
13108                  setup_native/source/packinfo/finals_instsetoo.txt
13109                  sysui/desktop/macosx/Info.plist])
13110 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13111 AC_CONFIG_HEADERS([config_host/config_clang.h])
13112 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13113 AC_CONFIG_HEADERS([config_host/config_eot.h])
13114 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13115 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13116 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13117 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13118 AC_CONFIG_HEADERS([config_host/config_features.h])
13119 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13120 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13121 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13122 AC_CONFIG_HEADERS([config_host/config_folders.h])
13123 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13124 AC_CONFIG_HEADERS([config_host/config_gio.h])
13125 AC_CONFIG_HEADERS([config_host/config_global.h])
13126 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13127 AC_CONFIG_HEADERS([config_host/config_java.h])
13128 AC_CONFIG_HEADERS([config_host/config_langs.h])
13129 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13130 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13131 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13132 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13133 AC_CONFIG_HEADERS([config_host/config_locales.h])
13134 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13135 AC_CONFIG_HEADERS([config_host/config_oox.h])
13136 AC_CONFIG_HEADERS([config_host/config_options.h])
13137 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13138 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
13139 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13140 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13141 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13142 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13143 AC_CONFIG_HEADERS([config_host/config_version.h])
13144 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13145 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13146 AC_CONFIG_HEADERS([config_host/config_python.h])
13147 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13148 AC_OUTPUT
13150 if test "$CROSS_COMPILING" = TRUE; then
13151     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13154 # touch the config timestamp file
13155 if test ! -f config_host.mk.stamp; then
13156     echo > config_host.mk.stamp
13157 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13158     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13159 else
13160     echo > config_host.mk.stamp
13163 # touch the config lang timestamp file
13164 if test ! -f config_host_lang.mk.stamp; then
13165     echo > config_host_lang.mk.stamp
13166 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13167     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13168 else
13169     echo > config_host_lang.mk.stamp
13173 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13174         -a "$build_os" = "cygwin"; then
13176 cat << _EOS
13177 ****************************************************************************
13178 WARNING:
13179 Your make version is known to be horribly slow, and hard to debug
13180 problems with. To get a reasonably functional make please do:
13182 to install a pre-compiled binary make for Win32
13184  mkdir -p /opt/lo/bin
13185  cd /opt/lo/bin
13186  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13187  cp make-4.2.1-msvc.exe make
13188  chmod +x make
13190 to install from source:
13191 place yourself in a working directory of you choice.
13193  git clone git://git.savannah.gnu.org/make.git
13195  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13196  set PATH=%PATH%;C:\Cygwin\bin
13197  [or Cygwin64, if that is what you have]
13198  cd path-to-make-repo-you-cloned-above
13199  build_w32.bat --without-guile
13201 should result in a WinRel/gnumake.exe.
13202 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13204 Then re-run autogen.sh
13206 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13207 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13209 _EOS
13210 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13211     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13216 cat << _EOF
13217 ****************************************************************************
13219 To build, run:
13220 $GNUMAKE
13222 To view some help, run:
13223 $GNUMAKE help
13225 _EOF
13227 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13228     cat << _EOF
13229 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13230 _EOF
13232     if test $_os = Darwin; then
13233         echo open instdir/$PRODUCTNAME.app
13234     else
13235         echo instdir/program/soffice
13236     fi
13237     cat << _EOF
13239 If you want to run the smoketest, run:
13240 $GNUMAKE check
13242 _EOF
13245 if test -f warn; then
13246     cat warn
13247     rm warn
13250 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: