Bump version to 6.4-38
[LibreOffice.git] / configure.ac
blob8de90a3052d50232338c9d4525c886721ad4da5a
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.38],[],[],[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     # Disable scripting for iOS unless specifically overridden
2632     # with --enable-scripting.
2633     if test $_os != iOS; then
2634         enable_scripting=yes
2635     fi
2638 DISABLE_SCRIPTING=''
2639 if test "$enable_scripting" = yes; then
2640     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2641     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2642 else
2643     DISABLE_SCRIPTING='TRUE'
2644     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2647 if test $_os = iOS -o $_os = Android; then
2648     # Disable dynamic_loading always for iOS and Android
2649     enable_dynamic_loading=no
2650 elif test -z "$enable_dynamic_loading"; then
2651     # Otherwise enable it unless specifically disabled
2652     enable_dynamic_loading=yes
2655 DISABLE_DYNLOADING=''
2656 if test "$enable_dynamic_loading" = yes; then
2657     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2658 else
2659     DISABLE_DYNLOADING='TRUE'
2661 AC_SUBST(DISABLE_DYNLOADING)
2663 # remember SYSBASE value
2664 AC_SUBST(SYSBASE)
2666 dnl ===================================================================
2667 dnl  Sort out various gallery compilation options
2668 dnl ===================================================================
2669 AC_MSG_CHECKING([how to build and package galleries])
2670 if test -n "${with_galleries}"; then
2671     if test "$with_galleries" = "build"; then
2672         WITH_GALLERY_BUILD=TRUE
2673         AC_MSG_RESULT([build from source images internally])
2674     elif test "$with_galleries" = "no"; then
2675         WITH_GALLERY_BUILD=
2676         AC_MSG_RESULT([disable non-internal gallery build])
2677     else
2678         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2679     fi
2680 else
2681     if test $_os != iOS -a $_os != Android; then
2682         WITH_GALLERY_BUILD=TRUE
2683         AC_MSG_RESULT([internal src images for desktop])
2684     else
2685         WITH_GALLERY_BUILD=
2686         AC_MSG_RESULT([disable src image build])
2687     fi
2689 AC_SUBST(WITH_GALLERY_BUILD)
2691 dnl ===================================================================
2692 dnl  Checks if ccache is available
2693 dnl ===================================================================
2694 CCACHE_DEPEND_MODE=
2695 if test "$_os" = "WINNT"; then
2696     # on windows/VC build do not use ccache
2697     CCACHE=""
2698 elif test "$enable_ccache" = "no"; then
2699     CCACHE=""
2700 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2701     case "%$CC%$CXX%" in
2702     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2703     # assume that's good then
2704     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2705         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2706         CCACHE_DEPEND_MODE=1
2707         ;;
2708     *)
2709         AC_PATH_PROG([CCACHE],[ccache],[not found])
2710         if test "$CCACHE" = "not found"; then
2711             CCACHE=""
2712         else
2713             CCACHE_DEPEND_MODE=1
2714             # Need to check for ccache version: otherwise prevents
2715             # caching of the results (like "-x objective-c++" for Mac)
2716             if test $_os = Darwin -o $_os = iOS; then
2717                 # Check ccache version
2718                 AC_MSG_CHECKING([whether version of ccache is suitable])
2719                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2720                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2721                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2722                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2723                 else
2724                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2725                     CCACHE=""
2726                     CCACHE_DEPEND_MODE=
2727                 fi
2728             fi
2729         fi
2730         ;;
2731     esac
2732 else
2733     CCACHE=""
2735 if test "$enable_ccache" = "nodepend"; then
2736     CCACHE_DEPEND_MODE=""
2738 AC_SUBST(CCACHE_DEPEND_MODE)
2740 if test "$CCACHE" != ""; then
2741     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2742     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2743     if test "$ccache_size" = ""; then
2744         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2745         if test "$ccache_size" = ""; then
2746             ccache_size=0
2747         fi
2748         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2749         if test $ccache_size -lt 1024; then
2750             CCACHE=""
2751             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2752             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2753         else
2754             # warn that ccache may be too small for debug build
2755             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2756             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2757         fi
2758     else
2759         if test $ccache_size -lt 5; then
2760             #warn that ccache may be too small for debug build
2761             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2762             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2763         fi
2764     fi
2767 dnl ===================================================================
2768 dnl  Checks for C compiler,
2769 dnl  The check for the C++ compiler is later on.
2770 dnl ===================================================================
2771 if test "$_os" != "WINNT"; then
2772     GCC_HOME_SET="true"
2773     AC_MSG_CHECKING([gcc home])
2774     if test -z "$with_gcc_home"; then
2775         if test "$enable_icecream" = "yes"; then
2776             if test -d "/usr/lib/icecc/bin"; then
2777                 GCC_HOME="/usr/lib/icecc/"
2778             elif test -d "/usr/libexec/icecc/bin"; then
2779                 GCC_HOME="/usr/libexec/icecc/"
2780             elif test -d "/opt/icecream/bin"; then
2781                 GCC_HOME="/opt/icecream/"
2782             else
2783                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2785             fi
2786         else
2787             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2788             GCC_HOME_SET="false"
2789         fi
2790     else
2791         GCC_HOME="$with_gcc_home"
2792     fi
2793     AC_MSG_RESULT($GCC_HOME)
2794     AC_SUBST(GCC_HOME)
2796     if test "$GCC_HOME_SET" = "true"; then
2797         if test -z "$CC"; then
2798             CC="$GCC_HOME/bin/gcc"
2799             CC_BASE="gcc"
2800         fi
2801         if test -z "$CXX"; then
2802             CXX="$GCC_HOME/bin/g++"
2803             CXX_BASE="g++"
2804         fi
2805     fi
2808 COMPATH=`dirname "$CC"`
2809 if test "$COMPATH" = "."; then
2810     AC_PATH_PROGS(COMPATH, $CC)
2811     dnl double square bracket to get single because of M4 quote...
2812     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2814 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2816 dnl ===================================================================
2817 dnl Java support
2818 dnl ===================================================================
2819 AC_MSG_CHECKING([whether to build with Java support])
2820 if test "$with_java" != "no"; then
2821     if test "$DISABLE_SCRIPTING" = TRUE; then
2822         AC_MSG_RESULT([no, overridden by --disable-scripting])
2823         ENABLE_JAVA=""
2824         with_java=no
2825     else
2826         AC_MSG_RESULT([yes])
2827         ENABLE_JAVA="TRUE"
2828         AC_DEFINE(HAVE_FEATURE_JAVA)
2829     fi
2830 else
2831     AC_MSG_RESULT([no])
2832     ENABLE_JAVA=""
2835 AC_SUBST(ENABLE_JAVA)
2837 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2839 dnl ENABLE_JAVA="" indicate no Java support at all
2841 dnl ===================================================================
2842 dnl Check macOS SDK and compiler
2843 dnl ===================================================================
2845 HAVE_MACOS_LD_PLATFORMVERSION=
2846 if test $_os = Darwin; then
2848     # If no --with-macosx-sdk option is given, look for one
2850     # The intent is that for "most" Mac-based developers, a suitable
2851     # SDK will be found automatically without any configure options.
2853     # For developers with a current Xcode, the lowest-numbered SDK
2854     # higher than or equal to the minimum required should be found.
2856     AC_MSG_CHECKING([what macOS SDK to use])
2857     for _macosx_sdk in ${with_macosx_sdk-11.1 11.0 10.15 10.14 10.13 10.12}; do
2858         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2859         if test -d "$MACOSX_SDK_PATH"; then
2860             with_macosx_sdk="${_macosx_sdk}"
2861             break
2862         else
2863             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2864             if test -d "$MACOSX_SDK_PATH"; then
2865                 with_macosx_sdk="${_macosx_sdk}"
2866                 break
2867             fi
2868         fi
2869     done
2870     if test ! -d "$MACOSX_SDK_PATH"; then
2871         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2872     fi
2874     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2876     case $with_macosx_sdk in
2877     10.12)
2878         MACOSX_SDK_VERSION=101200
2879         ;;
2880     10.13)
2881         MACOSX_SDK_VERSION=101300
2882         ;;
2883     10.14)
2884         MACOSX_SDK_VERSION=101400
2885         ;;
2886     10.15)
2887         MACOSX_SDK_VERSION=101500
2888         ;;
2889     11.0)
2890         MACOSX_SDK_VERSION=110000
2891         ;;
2892     11.1)
2893         MACOSX_SDK_VERSION=110100
2894         ;;
2895     *)
2896         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--11.1])
2897         ;;
2898     esac
2900     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2901         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2902     fi
2904     if test "$with_macosx_version_min_required" = "" ; then
2905         if test "$host_cpu" = x86_64; then
2906             with_macosx_version_min_required="10.10";
2907         else
2908             with_macosx_version_min_required="11.0";
2909         fi
2910     fi
2912     if test "$with_macosx_version_max_allowed" = "" ; then
2913         with_macosx_version_max_allowed="$with_macosx_sdk"
2914     fi
2916     # export this so that "xcrun" invocations later return matching values
2917     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2918     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2919     export DEVELOPER_DIR
2920     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2921     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2923     AC_MSG_CHECKING([whether Xcode is new enough])
2924     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2925     my_xcode_ver2=${my_xcode_ver1#Xcode }
2926     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2927     if test "$my_xcode_ver3" -ge 903; then
2928         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2929     else
2930         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2931     fi
2933     case "$with_macosx_version_min_required" in
2934     10.10)
2935         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2936         ;;
2937     10.11)
2938         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2939         ;;
2940     10.12)
2941         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2942         ;;
2943     10.13)
2944         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2945         ;;
2946     10.14)
2947         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2948         ;;
2949     10.15)
2950         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2951         ;;
2952     10.16)
2953         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
2954         ;;
2955     11.0)
2956         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2957         ;;
2958     11.1)
2959         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
2960         ;;
2961     *)
2962         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.1])
2963         ;;
2964     esac
2965     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2967     LIBTOOL=/usr/bin/libtool
2968     INSTALL_NAME_TOOL=install_name_tool
2969     if test -z "$save_CC"; then
2970         stdlib=-stdlib=libc++
2971         if test "$ENABLE_LTO" = TRUE; then
2972             lto=-flto
2973         fi
2975         AC_MSG_CHECKING([what C compiler to use])
2976         CC="`xcrun -find clang`"
2977         CC_BASE=`first_arg_basename "$CC"`
2978         if test "$host_cpu" = x86_64; then
2979             CC+=" -target x86_64-apple-macos"
2980         else
2981             CC+=" -target arm64-apple-macos"
2982         fi
2983         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2984         AC_MSG_RESULT([$CC])
2986         AC_MSG_CHECKING([what C++ compiler to use])
2987         CXX="`xcrun -find clang++`"
2988         CXX_BASE=`first_arg_basename "$CXX"`
2989         if test "$host_cpu" = x86_64; then
2990             CXX+=" -target x86_64-apple-macos"
2991         else
2992             CXX+=" -target arm64-apple-macos"
2993         fi
2994         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2995         AC_MSG_RESULT([$CXX])
2997         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2998         AR=`xcrun -find ar`
2999         NM=`xcrun -find nm`
3000         STRIP=`xcrun -find strip`
3001         LIBTOOL=`xcrun -find libtool`
3002         RANLIB=`xcrun -find ranlib`
3003     fi
3005     case "$with_macosx_version_max_allowed" in
3006     10.10)
3007         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3008         ;;
3009     10.11)
3010         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3011         ;;
3012     10.12)
3013         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3014         ;;
3015     10.13)
3016         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3017         ;;
3018     10.14)
3019         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3020         ;;
3021     10.15)
3022         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3023         ;;
3024     11.0)
3025         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3026         ;;
3027     11.1)
3028         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3029         ;;
3030     *)
3031         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.1])
3032         ;;
3033     esac
3035     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3036     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3037         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])
3038     else
3039         AC_MSG_RESULT([ok])
3040     fi
3042     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3043     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3044         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3045     else
3046         AC_MSG_RESULT([ok])
3047     fi
3048     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3049     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3051     AC_MSG_CHECKING([whether to do code signing])
3053     if test "$enable_macosx_code_signing" = yes; then
3054         # By default use the first suitable certificate (?).
3056         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3057         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3058         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3059         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3060         # "Developer ID Application" one.
3062         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3063         if test -n "$identity"; then
3064             MACOSX_CODESIGNING_IDENTITY=$identity
3065             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3066             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3067         else
3068             AC_MSG_ERROR([cannot determine identity to use])
3069         fi
3070     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3071         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3072         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3073         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3074     else
3075         AC_MSG_RESULT([no])
3076     fi
3078     AC_MSG_CHECKING([whether to create a Mac App Store package])
3080     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3081         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3082     elif test "$enable_macosx_package_signing" = yes; then
3083         # By default use the first suitable certificate.
3084         # It should be a "3rd Party Mac Developer Installer" one
3086         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3087         if test -n "$identity"; then
3088             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3089             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3090             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3091         else
3092             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3093         fi
3094     elif test -n "$enable_macosx_package_signing"; then
3095         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3096         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3097         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3098     else
3099         AC_MSG_RESULT([no])
3100     fi
3102     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3103         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3104     fi
3106     AC_MSG_CHECKING([whether to sandbox the application])
3108     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3109         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3110     elif test "$enable_macosx_sandbox" = yes; then
3111         ENABLE_MACOSX_SANDBOX=TRUE
3112         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3113         AC_MSG_RESULT([yes])
3114     else
3115         AC_MSG_RESULT([no])
3116     fi
3118     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3119     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3120     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3122     AC_MSG_CHECKING([whether the linker supports -platform_version])
3123     save_LDFLAGS=$LDFLAGS
3124     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3125         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3126     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3127         [AC_MSG_RESULT([yes])
3128          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3129         [AC_MSG_RESULT([no])])
3130     LDFLAGS=$save_LDFLAGS
3132 AC_SUBST(MACOSX_SDK_PATH)
3133 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3134 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3135 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3136 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3137 AC_SUBST(INSTALL_NAME_TOOL)
3138 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3139 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3140 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3141 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3142 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3143 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3145 dnl ===================================================================
3146 dnl Check iOS SDK and compiler
3147 dnl ===================================================================
3149 if test $_os = iOS; then
3150     AC_MSG_CHECKING([what iOS SDK to use])
3151     current_sdk_ver=14.4
3152     older_sdk_vers="14.3 14.2 14.1 14.0 13.7 13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3153     if test "$enable_ios_simulator" = "yes"; then
3154         platform=iPhoneSimulator
3155         versionmin=-mios-simulator-version-min=12.2
3156     else
3157         platform=iPhoneOS
3158         versionmin=-miphoneos-version-min=12.2
3159     fi
3160     xcode_developer=`xcode-select -print-path`
3162     for sdkver in $current_sdk_ver $older_sdk_vers; do
3163         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3164         if test -d $t; then
3165             sysroot=$t
3166             break
3167         fi
3168     done
3170     if test -z "$sysroot"; then
3171         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3172     fi
3174     AC_MSG_RESULT($sysroot)
3176     # LTO is not really recommended for iOS builds,
3177     # the link time will be astronomical
3178     if test "$ENABLE_LTO" = TRUE; then
3179         lto=-flto
3180     fi
3182     stdlib="-stdlib=libc++"
3184     AC_MSG_CHECKING([what C compiler to use])
3185     CC="`xcrun -find clang`"
3186     CC_BASE=`first_arg_basename "$CC"`
3187     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
3188     AC_MSG_RESULT([$CC])
3190     AC_MSG_CHECKING([what C++ compiler to use])
3191     CXX="`xcrun -find clang++`"
3192     CXX_BASE=`first_arg_basename "$CXX"`
3193     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
3194     AC_MSG_RESULT([$CXX])
3196     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3197     AR=`xcrun -find ar`
3198     NM=`xcrun -find nm`
3199     STRIP=`xcrun -find strip`
3200     LIBTOOL=`xcrun -find libtool`
3201     RANLIB=`xcrun -find ranlib`
3204 AC_MSG_CHECKING([whether to treat the installation as read-only])
3206 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3207         "$enable_extensions" != yes; then
3208     enable_readonly_installset=yes
3210 if test "$enable_readonly_installset" = yes; then
3211     AC_MSG_RESULT([yes])
3212     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3213 else
3214     AC_MSG_RESULT([no])
3217 dnl ===================================================================
3218 dnl Structure of install set
3219 dnl ===================================================================
3221 if test $_os = Darwin; then
3222     LIBO_BIN_FOLDER=MacOS
3223     LIBO_ETC_FOLDER=Resources
3224     LIBO_LIBEXEC_FOLDER=MacOS
3225     LIBO_LIB_FOLDER=Frameworks
3226     LIBO_LIB_PYUNO_FOLDER=Resources
3227     LIBO_SHARE_FOLDER=Resources
3228     LIBO_SHARE_HELP_FOLDER=Resources/help
3229     LIBO_SHARE_JAVA_FOLDER=Resources/java
3230     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3231     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3232     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3233     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3234     LIBO_URE_BIN_FOLDER=MacOS
3235     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3236     LIBO_URE_LIB_FOLDER=Frameworks
3237     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3238     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3239 elif test $_os = WINNT; then
3240     LIBO_BIN_FOLDER=program
3241     LIBO_ETC_FOLDER=program
3242     LIBO_LIBEXEC_FOLDER=program
3243     LIBO_LIB_FOLDER=program
3244     LIBO_LIB_PYUNO_FOLDER=program
3245     LIBO_SHARE_FOLDER=share
3246     LIBO_SHARE_HELP_FOLDER=help
3247     LIBO_SHARE_JAVA_FOLDER=program/classes
3248     LIBO_SHARE_PRESETS_FOLDER=presets
3249     LIBO_SHARE_READMES_FOLDER=readmes
3250     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3251     LIBO_SHARE_SHELL_FOLDER=program/shell
3252     LIBO_URE_BIN_FOLDER=program
3253     LIBO_URE_ETC_FOLDER=program
3254     LIBO_URE_LIB_FOLDER=program
3255     LIBO_URE_MISC_FOLDER=program
3256     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3257 else
3258     LIBO_BIN_FOLDER=program
3259     LIBO_ETC_FOLDER=program
3260     LIBO_LIBEXEC_FOLDER=program
3261     LIBO_LIB_FOLDER=program
3262     LIBO_LIB_PYUNO_FOLDER=program
3263     LIBO_SHARE_FOLDER=share
3264     LIBO_SHARE_HELP_FOLDER=help
3265     LIBO_SHARE_JAVA_FOLDER=program/classes
3266     LIBO_SHARE_PRESETS_FOLDER=presets
3267     LIBO_SHARE_READMES_FOLDER=readmes
3268     if test "$enable_fuzzers" != yes; then
3269         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3270     else
3271         LIBO_SHARE_RESOURCE_FOLDER=resource
3272     fi
3273     LIBO_SHARE_SHELL_FOLDER=program/shell
3274     LIBO_URE_BIN_FOLDER=program
3275     LIBO_URE_ETC_FOLDER=program
3276     LIBO_URE_LIB_FOLDER=program
3277     LIBO_URE_MISC_FOLDER=program
3278     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3280 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3281 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3282 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3283 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3284 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3285 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3286 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3287 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3288 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3289 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3290 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3291 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3292 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3293 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3294 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3295 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3297 # Not all of them needed in config_host.mk, add more if need arises
3298 AC_SUBST(LIBO_BIN_FOLDER)
3299 AC_SUBST(LIBO_ETC_FOLDER)
3300 AC_SUBST(LIBO_LIB_FOLDER)
3301 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3302 AC_SUBST(LIBO_SHARE_FOLDER)
3303 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3304 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3305 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3306 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3307 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3308 AC_SUBST(LIBO_URE_BIN_FOLDER)
3309 AC_SUBST(LIBO_URE_ETC_FOLDER)
3310 AC_SUBST(LIBO_URE_LIB_FOLDER)
3311 AC_SUBST(LIBO_URE_MISC_FOLDER)
3312 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3314 dnl ===================================================================
3315 dnl Windows specific tests and stuff
3316 dnl ===================================================================
3318 reg_get_value()
3320     # Return value: $regvalue
3321     unset regvalue
3323     local _regentry="/proc/registry${1}/${2}"
3324     if test -f "$_regentry"; then
3325         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3326         # Registry keys read via /proc/registry* are always \0 terminated!
3327         local _regvalue=$(tr -d '\0' < "$_regentry")
3328         if test $? -eq 0; then
3329             regvalue=$_regvalue
3330         fi
3331     fi
3334 # Get a value from the 32-bit side of the Registry
3335 reg_get_value_32()
3337     reg_get_value "32" "$1"
3340 # Get a value from the 64-bit side of the Registry
3341 reg_get_value_64()
3343     reg_get_value "64" "$1"
3346 if test "$_os" = "WINNT"; then
3347     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3348     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3349         AC_MSG_RESULT([no])
3350         WINDOWS_SDK_ARCH="x86"
3351     else
3352         AC_MSG_RESULT([yes])
3353         WINDOWS_SDK_ARCH="x64"
3354         BITNESS_OVERRIDE=64
3355     fi
3357 AC_SUBST(WINDOWS_SDK_ARCH)
3358 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3359     cross_compiling="yes"
3361 if test "$cross_compiling" = "yes"; then
3362     export CROSS_COMPILING=TRUE
3363 else
3364     CROSS_COMPILING=
3365     BUILD_TYPE="$BUILD_TYPE NATIVE"
3367 AC_SUBST(CROSS_COMPILING)
3369 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3370 # NOTE: must _not_ be used for bundled external libraries!
3371 ISYSTEM=
3372 if test "$GCC" = "yes"; then
3373     AC_MSG_CHECKING( for -isystem )
3374     save_CFLAGS=$CFLAGS
3375     CFLAGS="$CFLAGS -Werror"
3376     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3377     CFLAGS=$save_CFLAGS
3378     if test -n "$ISYSTEM"; then
3379         AC_MSG_RESULT(yes)
3380     else
3381         AC_MSG_RESULT(no)
3382     fi
3384 if test -z "$ISYSTEM"; then
3385     # fall back to using -I
3386     ISYSTEM=-I
3388 AC_SUBST(ISYSTEM)
3390 dnl ===================================================================
3391 dnl  Check which Visual Studio compiler is used
3392 dnl ===================================================================
3394 map_vs_year_to_version()
3396     # Return value: $vsversion
3398     unset vsversion
3400     case $1 in
3401     2017)
3402         vsversion=15;;
3403     2019)
3404         vsversion=16;;
3405     *)
3406         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3407     esac
3410 vs_versions_to_check()
3412     # Args: $1 (optional) : versions to check, in the order of preference
3413     # Return value: $vsversions
3415     unset vsversions
3417     if test -n "$1"; then
3418         map_vs_year_to_version "$1"
3419         vsversions=$vsversion
3420     else
3421         # We accept only 2017
3422         vsversions="15"
3423     fi
3426 win_get_env_from_vsvars32bat()
3428     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3429     # Also seems to be located in another directory under the same name: vsvars32.bat
3430     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3431     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3432     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3433     chmod +x $WRAPPERBATCHFILEPATH
3434     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3435     rm -f $WRAPPERBATCHFILEPATH
3436     printf '%s' "$_win_get_env_from_vsvars32bat"
3439 find_ucrt()
3441     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3442     if test -n "$regvalue"; then
3443         PathFormat "$regvalue"
3444         UCRTSDKDIR=$formatted_path
3445         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3446         UCRTVERSION=$regvalue
3447         # Rest if not exist
3448         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3449           UCRTSDKDIR=
3450         fi
3451     fi
3452     if test -z "$UCRTSDKDIR"; then
3453         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3454         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3455         if test -f "$ide_env_file"; then
3456             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3457             UCRTSDKDIR=$formatted_path
3458             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3459             dnl Hack needed at least by tml:
3460             if test "$UCRTVERSION" = 10.0.15063.0 \
3461                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3462                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3463             then
3464                 UCRTVERSION=10.0.14393.0
3465             fi
3466         else
3467           AC_MSG_ERROR([No UCRT found])
3468         fi
3469     fi
3472 find_msvc()
3474     # Find Visual C++ 2017/2019
3475     # Args: $1 (optional) : The VS version year
3476     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3478     unset vctest vcnum vcnumwithdot vcbuildnumber
3480     vs_versions_to_check "$1"
3481     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3482     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3483     PathFormat "$vswhere"
3484     vswhere=$formatted_path
3485     for ver in $vsversions; do
3486         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3487         if test -n "$vswhereoutput"; then
3488             PathFormat "$vswhereoutput"
3489             vctest=$formatted_path
3490             break
3491         fi
3492     done
3494     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3495     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3496     # should be removed when upgrading baseline.
3497     if ! test -n "$vctest"; then
3498         for ver in $vsversions; do
3499             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3500             if test -n "$regvalue"; then
3501                 vctest=$regvalue
3502                 break
3503             fi
3504             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3505             if test -n "$regvalue"; then
3506                 AC_MSG_RESULT([found: $regvalue])
3507                 PathFormat "$regvalue"
3508                 vctest=$formatted_path
3509                 break
3510             fi
3511         done
3512     fi
3514     if test -n "$vctest"; then
3515         vcnumwithdot="$ver.0"
3516         case "$vcnumwithdot" in
3517         15.0)
3518             vcyear=2017
3519             vcnum=150
3520             ;;
3521         16.0)
3522             vcyear=2019
3523             vcnum=160
3524             ;;
3525         esac
3526         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3528     fi
3531 SOLARINC=
3532 MSBUILD_PATH=
3533 DEVENV=
3534 if test "$_os" = "WINNT"; then
3535     AC_MSG_CHECKING([Visual C++])
3536     find_msvc "$with_visual_studio"
3537     if test -z "$vctest"; then
3538         if test -n "$with_visual_studio"; then
3539             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3540         else
3541             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3542         fi
3543     fi
3545     if test "$BITNESS_OVERRIDE" = ""; then
3546         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3547             VC_PRODUCT_DIR=$vctest/VC
3548         else
3549             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3550         fi
3551     else
3552         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3553             VC_PRODUCT_DIR=$vctest/VC
3554         else
3555             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3556         fi
3557     fi
3558     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3560     AC_MSG_CHECKING([for short pathname of VC product directory])
3561     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3562     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3564     UCRTSDKDIR=
3565     UCRTVERSION=
3567     AC_MSG_CHECKING([for UCRT location])
3568     find_ucrt
3569     # find_ucrt errors out if it doesn't find it
3570     AC_MSG_RESULT([found])
3571     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3572     ucrtincpath_formatted=$formatted_path
3573     # SOLARINC is used for external modules and must be set too.
3574     # And no, it's not sufficient to set SOLARINC only, as configure
3575     # itself doesn't honour it.
3576     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3577     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3578     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3579     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3581     AC_SUBST(UCRTSDKDIR)
3582     AC_SUBST(UCRTVERSION)
3584     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3585     # Find the proper version of MSBuild.exe to use based on the VS version
3586     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3587     if test -n "$regvalue" ; then
3588         AC_MSG_RESULT([found: $regvalue])
3589         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3590     else
3591         if test "$vcnumwithdot" = "16.0"; then
3592             if test "$BITNESS_OVERRIDE" = ""; then
3593                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3594             else
3595                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3596             fi
3597         else
3598             if test "$BITNESS_OVERRIDE" = ""; then
3599                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3600             else
3601                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3602             fi
3603         fi
3604         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3605         AC_MSG_RESULT([$regvalue])
3606     fi
3608     # Find the version of devenv.exe
3609     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3610     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3611     if test ! -e "$DEVENV"; then
3612         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3613     fi
3615     dnl ===========================================================
3616     dnl  Check for the corresponding mspdb*.dll
3617     dnl ===========================================================
3619     VC_HOST_DIR=
3620     MSPDB_PATH=
3621     CL_PATH=
3623     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3624         VC_HOST_DIR="HostX64"
3625         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3626     else
3627         VC_HOST_DIR="HostX86"
3628         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3629     fi
3631     if test "$BITNESS_OVERRIDE" = ""; then
3632         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3633     else
3634         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3635     fi
3637     # MSVC 15.0 has libraries from 14.0?
3638     mspdbnum="140"
3640     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3641         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3642     fi
3644     dnl The path needs to be added before cl is called
3645     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3646     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3648     AC_MSG_CHECKING([cl.exe])
3650     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3651     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3652     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3653     # is not enough?
3655     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3656     dnl needed when building CLR code:
3657     if test -z "$MSVC_CXX"; then
3658         if test -f "$CL_PATH/cl.exe"; then
3659             MSVC_CXX="$CL_PATH/cl.exe"
3660         fi
3662         # This gives us a posix path with 8.3 filename restrictions
3663         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3664     fi
3666     if test -z "$CC"; then
3667         CC=$MSVC_CXX
3668         CC_BASE=`first_arg_basename "$CC"`
3669     fi
3670     if test "$BITNESS_OVERRIDE" = ""; then
3671         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3672         MSVC_CXX="$MSVC_CXX -arch:SSE"
3673     fi
3674     if test -z "$CXX"; then
3675         CXX=$MSVC_CXX
3676         CXX_BASE=`first_arg_basename "$CXX"`
3677     fi
3679     if test -n "$CC"; then
3680         # Remove /cl.exe from CC case insensitive
3681         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3682         if test "$BITNESS_OVERRIDE" = ""; then
3683            COMPATH="$VC_PRODUCT_DIR"
3684         else
3685             if test -n "$VC_PRODUCT_DIR"; then
3686                 COMPATH=$VC_PRODUCT_DIR
3687             fi
3688         fi
3689         if test "$BITNESS_OVERRIDE" = ""; then
3690             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3691             CC="$CC -arch:SSE"
3692         fi
3694         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3696         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3698         PathFormat "$COMPATH"
3699         COMPATH=`win_short_path_for_make "$formatted_path"`
3701         VCVER=$vcnum
3702         MSVSVER=$vcyear
3704         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3705         # are always "better", we list them in reverse chronological order.
3707         case "$vcnum" in
3708         150|160)
3709             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3710             ;;
3711         esac
3713         # The expectation is that --with-windows-sdk should not need to be used
3714         if test -n "$with_windows_sdk"; then
3715             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3716             *" "$with_windows_sdk" "*)
3717                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3718                 ;;
3719             *)
3720                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3721                 ;;
3722             esac
3723         fi
3725         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3726         ac_objext=obj
3727         ac_exeext=exe
3729     else
3730         AC_MSG_ERROR([Visual C++ not found after all, huh])
3731     fi
3733     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3734     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3735         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3736         // between Visual Studio versions and _MSC_VER:
3737         #if _MSC_VER < 1914
3738         #error
3739         #endif
3740     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3742     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3743     # version of the Explorer extension (and maybe other small
3744     # bits, too) needed when installing a 32-bit LibreOffice on a
3745     # 64-bit OS. The 64-bit Explorer extension is a feature that
3746     # has been present since long in OOo. Don't confuse it with
3747     # building LibreOffice itself as 64-bit code.
3749     BUILD_X64=
3750     CXX_X64_BINARY=
3752     if test "$BITNESS_OVERRIDE" = ""; then
3753         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3754         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3755              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3756             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3757                 BUILD_X64=TRUE
3758                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3759             fi
3760         fi
3761         if test "$BUILD_X64" = TRUE; then
3762             AC_MSG_RESULT([found])
3763         else
3764             AC_MSG_RESULT([not found])
3765             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3766         fi
3767     else
3768         CXX_X64_BINARY=$CXX
3769     fi
3770     AC_SUBST(BUILD_X64)
3772     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3773     AC_SUBST(CXX_X64_BINARY)
3775     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3776     # needed to support TWAIN scan on both 32- and 64-bit systems
3778     BUILD_X86=
3780     if test "$BITNESS_OVERRIDE" = "64"; then
3781         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3782         if test -n "$CXX_X86_BINARY"; then
3783             BUILD_X86=TRUE
3784             AC_MSG_RESULT([preset])
3785         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3786             BUILD_X86=TRUE
3787             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3788             CXX_X86_BINARY+=" /arch:SSE"
3789             AC_MSG_RESULT([found])
3790         else
3791             CXX_X86_BINARY=
3792             AC_MSG_RESULT([not found])
3793             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3794         fi
3795     else
3796         BUILD_X86=TRUE
3797         CXX_X86_BINARY=$MSVC_CXX
3798     fi
3799     AC_SUBST(BUILD_X86)
3800     AC_SUBST(CXX_X86_BINARY)
3802 AC_SUBST(VCVER)
3803 AC_SUBST(DEVENV)
3804 AC_SUBST(MSVC_CXX)
3807 # unowinreg.dll
3809 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3810 AC_SUBST(UNOWINREG_DLL)
3812 COM_IS_CLANG=
3813 AC_MSG_CHECKING([whether the compiler is actually Clang])
3814 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3815     #ifndef __clang__
3816     you lose
3817     #endif
3818     int foo=42;
3819     ]])],
3820     [AC_MSG_RESULT([yes])
3821      COM_IS_CLANG=TRUE],
3822     [AC_MSG_RESULT([no])])
3823 AC_SUBST(COM_IS_CLANG)
3825 CC_PLAIN=$CC
3826 CLANGVER=
3827 if test "$COM_IS_CLANG" = TRUE; then
3828     AC_MSG_CHECKING([whether Clang is new enough])
3829     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3830         #if !defined __apple_build_version__
3831         #error
3832         #endif
3833         ]])],
3834         [my_apple_clang=yes],[my_apple_clang=])
3835     if test "$my_apple_clang" = yes; then
3836         AC_MSG_RESULT([assumed yes (Apple Clang)])
3837     else
3838         if test "$_os" = WINNT; then
3839             dnl In which case, assume clang-cl:
3840             my_args="/EP /TC"
3841             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3842             dnl clang-cl:
3843             CC_PLAIN=
3844             for i in $CC; do
3845                 case $i in
3846                 -FIIntrin.h)
3847                     ;;
3848                 *)
3849                     CC_PLAIN="$CC_PLAIN $i"
3850                     ;;
3851                 esac
3852             done
3853         else
3854             my_args="-E -P"
3855         fi
3856         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3857         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3858         CLANGVER=`echo $clang_version \
3859             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3860         if test "$CLANGVER" -ge 50002; then
3861             AC_MSG_RESULT([yes ($clang_version)])
3862         else
3863             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3864         fi
3865         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3866         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3867     fi
3870 SHOWINCLUDES_PREFIX=
3871 if test "$_os" = WINNT; then
3872     dnl We need to guess the prefix of the -showIncludes output, it can be
3873     dnl localized
3874     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3875     echo "#include <stdlib.h>" > conftest.c
3876     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3877         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3878     rm -f conftest.c conftest.obj
3879     if test -z "$SHOWINCLUDES_PREFIX"; then
3880         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3881     else
3882         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3883     fi
3885 AC_SUBST(SHOWINCLUDES_PREFIX)
3888 # prefix C with ccache if needed
3890 if test "$CCACHE" != ""; then
3891     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3893     AC_LANG_PUSH([C])
3894     save_CFLAGS=$CFLAGS
3895     CFLAGS="$CFLAGS --ccache-skip -O2"
3896     dnl an empty program will do, we're checking the compiler flags
3897     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3898                       [use_ccache=yes], [use_ccache=no])
3899     if test $use_ccache = yes; then
3900         AC_MSG_RESULT([yes])
3901     else
3902         CC="$CCACHE $CC"
3903         CC_BASE="ccache $CC_BASE"
3904         AC_MSG_RESULT([no])
3905     fi
3906     CFLAGS=$save_CFLAGS
3907     AC_LANG_POP([C])
3910 # ===================================================================
3911 # check various GCC options that Clang does not support now but maybe
3912 # will somewhen in the future, check them even for GCC, so that the
3913 # flags are set
3914 # ===================================================================
3916 HAVE_GCC_GGDB2=
3917 if test "$GCC" = "yes"; then
3918     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3919     save_CFLAGS=$CFLAGS
3920     CFLAGS="$CFLAGS -Werror -ggdb2"
3921     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3922     CFLAGS=$save_CFLAGS
3923     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3924         AC_MSG_RESULT([yes])
3925     else
3926         AC_MSG_RESULT([no])
3927     fi
3929     if test "$host_cpu" = "m68k"; then
3930         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3931         save_CFLAGS=$CFLAGS
3932         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3933         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3934         CFLAGS=$save_CFLAGS
3935         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3936             AC_MSG_RESULT([yes])
3937         else
3938             AC_MSG_ERROR([no])
3939         fi
3940     fi
3942 AC_SUBST(HAVE_GCC_GGDB2)
3944 dnl ===================================================================
3945 dnl  Test the gcc version
3946 dnl ===================================================================
3947 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3948     AC_MSG_CHECKING([the GCC version])
3949     _gcc_version=`$CC -dumpversion`
3950     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3951         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3952     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3954     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3956     if test "$gcc_full_version" -lt 70000; then
3957         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3958     fi
3959 else
3960     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3961     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3962     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3963     # (which reports itself as GCC 4.2.1).
3964     GCC_VERSION=
3966 AC_SUBST(GCC_VERSION)
3968 dnl Set the ENABLE_DBGUTIL variable
3969 dnl ===================================================================
3970 AC_MSG_CHECKING([whether to build with additional debug utilities])
3971 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3972     ENABLE_DBGUTIL="TRUE"
3973     # this is an extra var so it can have different default on different MSVC
3974     # versions (in case there are version specific problems with it)
3975     MSVC_USE_DEBUG_RUNTIME="TRUE"
3977     AC_MSG_RESULT([yes])
3978     # cppunit and graphite expose STL in public headers
3979     if test "$with_system_cppunit" = "yes"; then
3980         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3981     else
3982         with_system_cppunit=no
3983     fi
3984     if test "$with_system_graphite" = "yes"; then
3985         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3986     else
3987         with_system_graphite=no
3988     fi
3989     if test "$with_system_orcus" = "yes"; then
3990         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3991     else
3992         with_system_orcus=no
3993     fi
3994     if test "$with_system_libcmis" = "yes"; then
3995         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3996     else
3997         with_system_libcmis=no
3998     fi
3999     if test "$with_system_hunspell" = "yes"; then
4000         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4001     else
4002         with_system_hunspell=no
4003     fi
4004     if test "$with_system_gpgmepp" = "yes"; then
4005         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4006     else
4007         with_system_gpgmepp=no
4008     fi
4009     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4010     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4011     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4012     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4013     # of those two is using the system variant:
4014     if test "$with_system_libnumbertext" = "yes"; then
4015         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4016     else
4017         with_system_libnumbertext=no
4018     fi
4019     if test "$with_system_libwps" = "yes"; then
4020         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4021     else
4022         with_system_libwps=no
4023     fi
4024 else
4025     ENABLE_DBGUTIL=""
4026     MSVC_USE_DEBUG_RUNTIME=""
4027     AC_MSG_RESULT([no])
4029 AC_SUBST(ENABLE_DBGUTIL)
4030 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4032 dnl Set the ENABLE_DEBUG variable.
4033 dnl ===================================================================
4034 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4035     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4037 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4038     if test -z "$libo_fuzzed_enable_debug"; then
4039         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4040     else
4041         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4042         enable_debug=yes
4043     fi
4046 AC_MSG_CHECKING([whether to do a debug build])
4047 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4048     ENABLE_DEBUG="TRUE"
4049     if test -n "$ENABLE_DBGUTIL" ; then
4050         AC_MSG_RESULT([yes (dbgutil)])
4051     else
4052         AC_MSG_RESULT([yes])
4053     fi
4054 else
4055     ENABLE_DEBUG=""
4056     AC_MSG_RESULT([no])
4058 AC_SUBST(ENABLE_DEBUG)
4060 dnl ===================================================================
4061 dnl Select the linker to use (gold/lld/ld.bfd).
4062 dnl This is done only after compiler checks (need to know if Clang is
4063 dnl used, for different defaults) and after checking if a debug build
4064 dnl is wanted (non-debug builds get the default linker if not explicitly
4065 dnl specified otherwise).
4066 dnl All checks for linker features/options should come after this.
4067 dnl ===================================================================
4068 check_use_ld()
4070     use_ld=$1
4071     use_ld_fail_if_error=$2
4072     use_ld_ok=
4073     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
4074     use_ld_ldflags_save="$LDFLAGS"
4075     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
4076     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4077 #include <stdio.h>
4078         ],[
4079 printf ("hello world\n");
4080         ])], USE_LD=$use_ld, [])
4081     if test -n "$USE_LD"; then
4082         AC_MSG_RESULT( yes )
4083         use_ld_ok=yes
4084     else
4085         if test -n "$use_ld_fail_if_error"; then
4086             AC_MSG_ERROR( no )
4087         else
4088             AC_MSG_RESULT( no )
4089         fi
4090     fi
4091     if test -n "$use_ld_ok"; then
4092         dnl keep the value of LDFLAGS
4093         return 0
4094     fi
4095     LDFLAGS="$use_ld_ldflags_save"
4096     return 1
4098 USE_LD=
4099 if test "$enable_ld" != "no"; then
4100     if test "$GCC" = "yes"; then
4101         if test -n "$enable_ld"; then
4102             check_use_ld "$enable_ld" fail_if_error
4103         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4104             dnl non-debug builds default to the default linker
4105             true
4106         elif test -n "$COM_IS_CLANG"; then
4107             check_use_ld lld
4108             if test $? -ne 0; then
4109                 check_use_ld gold
4110             fi
4111         else
4112             # For gcc first try gold, new versions also support lld.
4113             check_use_ld gold
4114             if test $? -ne 0; then
4115                 check_use_ld lld
4116             fi
4117         fi
4118         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4119         rm conftest.out
4120         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4121         if test -z "$ld_used"; then
4122             ld_used="unknown"
4123         fi
4124         AC_MSG_CHECKING([for linker that is used])
4125         AC_MSG_RESULT([$ld_used])
4126         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4127             if echo "$ld_used" | grep -q "^GNU ld"; then
4128                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4129                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4130             fi
4131         fi
4132     else
4133         if test "$enable_ld" = "yes"; then
4134             AC_MSG_ERROR([--enable-ld not supported])
4135         fi
4136     fi
4138 AC_SUBST(USE_LD)
4140 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4141 if test "$GCC" = "yes"; then
4142     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4143     bsymbolic_functions_ldflags_save=$LDFLAGS
4144     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4145     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4146 #include <stdio.h>
4147         ],[
4148 printf ("hello world\n");
4149         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4150     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4151         AC_MSG_RESULT( found )
4152     else
4153         AC_MSG_RESULT( not found )
4154     fi
4155     LDFLAGS=$bsymbolic_functions_ldflags_save
4157 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4160 HAVE_GSPLIT_DWARF=
4161 if test "$enable_split_debug" != no; then
4162     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4163     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4164         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4165         save_CFLAGS=$CFLAGS
4166         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4167         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4168         CFLAGS=$save_CFLAGS
4169         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4170             AC_MSG_RESULT([yes])
4171         else
4172             if test "$enable_split_debug" = yes; then
4173                 AC_MSG_ERROR([no])
4174             else
4175                 AC_MSG_RESULT([no])
4176             fi
4177         fi
4178     fi
4179     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4180         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4181         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4182     fi
4184 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4186 ENABLE_GDB_INDEX=
4187 if test "$enable_gdb_index" != "no"; then
4188     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4189     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4190         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4191         save_CFLAGS=$CFLAGS
4192         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4193         have_ggnu_pubnames=
4194         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4195         if test "$have_ggnu_pubnames" != "TRUE"; then
4196             if test "$enable_gdb_index" = "yes"; then
4197                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4198             else
4199                 AC_MSG_RESULT( no )
4200             fi
4201         else
4202             AC_MSG_RESULT( yes )
4203             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4204             ldflags_save=$LDFLAGS
4205             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4206             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4207 #include <stdio.h>
4208                 ],[
4209 printf ("hello world\n");
4210                 ])], ENABLE_GDB_INDEX=TRUE, [])
4211             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4212                 AC_MSG_RESULT( yes )
4213             else
4214                 if test "$enable_gdb_index" = "yes"; then
4215                     AC_MSG_ERROR( no )
4216                 else
4217                     AC_MSG_RESULT( no )
4218                 fi
4219             fi
4220             LDFLAGS=$ldflags_save
4221         fi
4222         CFLAGS=$save_CFLAGS
4223         fi
4224     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4225         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4226         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4227     fi
4229 AC_SUBST(ENABLE_GDB_INDEX)
4231 if test "$enable_sal_log" = yes; then
4232     ENABLE_SAL_LOG=TRUE
4234 AC_SUBST(ENABLE_SAL_LOG)
4236 dnl Check for enable symbols option
4237 dnl ===================================================================
4238 AC_MSG_CHECKING([whether to generate debug information])
4239 if test -z "$enable_symbols"; then
4240     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4241         enable_symbols=yes
4242     else
4243         enable_symbols=no
4244     fi
4246 if test "$enable_symbols" = yes; then
4247     ENABLE_SYMBOLS_FOR=all
4248     AC_MSG_RESULT([yes])
4249 elif test "$enable_symbols" = no; then
4250     ENABLE_SYMBOLS_FOR=
4251     AC_MSG_RESULT([no])
4252 else
4253     # Selective debuginfo.
4254     ENABLE_SYMBOLS_FOR="$enable_symbols"
4255     AC_MSG_RESULT([for "$enable_symbols"])
4257 AC_SUBST(ENABLE_SYMBOLS_FOR)
4259 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4260     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4261     AC_MSG_CHECKING([whether enough memory is available for linking])
4262     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4263     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4264     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4265         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4266     else
4267         AC_MSG_RESULT([yes])
4268     fi
4271 AC_MSG_CHECKING([whether to compile with optimization flags])
4272 if test -z "$enable_optimized"; then
4273     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4274         enable_optimized=no
4275     else
4276         enable_optimized=yes
4277     fi
4279 if test "$enable_optimized" != no; then
4280     ENABLE_OPTIMIZED=TRUE
4281     AC_MSG_RESULT([yes])
4282 else
4283     ENABLE_OPTIMIZED=
4284     AC_MSG_RESULT([no])
4286 AC_SUBST(ENABLE_OPTIMIZED)
4289 # determine CPUNAME, OS, ...
4290 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4292 case "$host_os" in
4294 aix*)
4295     COM=GCC
4296     CPUNAME=POWERPC
4297     USING_X11=TRUE
4298     OS=AIX
4299     RTL_OS=AIX
4300     RTL_ARCH=PowerPC
4301     PLATFORMID=aix_powerpc
4302     P_SEP=:
4303     ;;
4305 cygwin*)
4306     COM=MSC
4307     USING_X11=
4308     OS=WNT
4309     RTL_OS=Windows
4310     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4311         P_SEP=";"
4312     else
4313         P_SEP=:
4314     fi
4315     case "$host_cpu" in
4316     i*86|x86_64)
4317         if test "$BITNESS_OVERRIDE" = 64; then
4318             CPUNAME=X86_64
4319             RTL_ARCH=X86_64
4320             PLATFORMID=windows_x86_64
4321             WINDOWS_X64=1
4322             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4323         else
4324             CPUNAME=INTEL
4325             RTL_ARCH=x86
4326             PLATFORMID=windows_x86
4327         fi
4328         ;;
4329     *)
4330         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4331         ;;
4332     esac
4333     SCPDEFS="$SCPDEFS -D_MSC_VER"
4334     ;;
4336 darwin*|macos*)
4337     COM=GCC
4338     USING_X11=
4339     OS=MACOSX
4340     RTL_OS=MacOSX
4341     P_SEP=:
4343     case "$host_cpu" in
4344     aarch64|arm64)
4345         if test "$enable_ios_simulator" = "yes"; then
4346             OS=iOS
4347         else
4348             CPUNAME=AARCH64
4349             RTL_ARCH=AARCH64
4350             PLATFORMID=macosx_arm64
4351         fi
4352         ;;
4353     x86_64)
4354         if test "$enable_ios_simulator" = "yes"; then
4355             OS=iOS
4356         fi
4357         CPUNAME=X86_64
4358         RTL_ARCH=X86_64
4359         PLATFORMID=macosx_x86_64
4360         ;;
4361     *)
4362         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4363         ;;
4364     esac
4365     ;;
4367 ios*)
4368     COM=GCC
4369     USING_X11=
4370     OS=iOS
4371     RTL_OS=iOS
4372     P_SEP=:
4374     case "$host_cpu" in
4375     aarch64|arm64)
4376         if test "$enable_ios_simulator" = "yes"; then
4377             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4378         fi
4379         ;;
4380     *)
4381         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4382         ;;
4383     esac
4384     CPUNAME=AARCH64
4385     RTL_ARCH=AARCH64
4386     PLATFORMID=ios_arm64
4387     ;;
4389 dragonfly*)
4390     COM=GCC
4391     USING_X11=TRUE
4392     OS=DRAGONFLY
4393     RTL_OS=DragonFly
4394     P_SEP=:
4396     case "$host_cpu" in
4397     i*86)
4398         CPUNAME=INTEL
4399         RTL_ARCH=x86
4400         PLATFORMID=dragonfly_x86
4401         ;;
4402     x86_64)
4403         CPUNAME=X86_64
4404         RTL_ARCH=X86_64
4405         PLATFORMID=dragonfly_x86_64
4406         ;;
4407     *)
4408         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4409         ;;
4410     esac
4411     ;;
4413 freebsd*)
4414     COM=GCC
4415     USING_X11=TRUE
4416     RTL_OS=FreeBSD
4417     OS=FREEBSD
4418     P_SEP=:
4420     case "$host_cpu" in
4421     i*86)
4422         CPUNAME=INTEL
4423         RTL_ARCH=x86
4424         PLATFORMID=freebsd_x86
4425         ;;
4426     x86_64|amd64)
4427         CPUNAME=X86_64
4428         RTL_ARCH=X86_64
4429         PLATFORMID=freebsd_x86_64
4430         ;;
4431     *)
4432         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4433         ;;
4434     esac
4435     ;;
4437 haiku*)
4438     COM=GCC
4439     USING_X11=
4440     GUIBASE=haiku
4441     RTL_OS=Haiku
4442     OS=HAIKU
4443     P_SEP=:
4445     case "$host_cpu" in
4446     i*86)
4447         CPUNAME=INTEL
4448         RTL_ARCH=x86
4449         PLATFORMID=haiku_x86
4450         ;;
4451     x86_64|amd64)
4452         CPUNAME=X86_64
4453         RTL_ARCH=X86_64
4454         PLATFORMID=haiku_x86_64
4455         ;;
4456     *)
4457         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4458         ;;
4459     esac
4460     ;;
4462 kfreebsd*)
4463     COM=GCC
4464     USING_X11=TRUE
4465     OS=LINUX
4466     RTL_OS=kFreeBSD
4467     P_SEP=:
4469     case "$host_cpu" in
4471     i*86)
4472         CPUNAME=INTEL
4473         RTL_ARCH=x86
4474         PLATFORMID=kfreebsd_x86
4475         ;;
4476     x86_64)
4477         CPUNAME=X86_64
4478         RTL_ARCH=X86_64
4479         PLATFORMID=kfreebsd_x86_64
4480         ;;
4481     *)
4482         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4483         ;;
4484     esac
4485     ;;
4487 linux-gnu*)
4488     COM=GCC
4489     USING_X11=TRUE
4490     OS=LINUX
4491     RTL_OS=Linux
4492     P_SEP=:
4494     case "$host_cpu" in
4496     aarch64)
4497         CPUNAME=AARCH64
4498         PLATFORMID=linux_aarch64
4499         RTL_ARCH=AARCH64
4500         EPM_FLAGS="-a arm64"
4501         ;;
4502     alpha)
4503         CPUNAME=AXP
4504         RTL_ARCH=ALPHA
4505         PLATFORMID=linux_alpha
4506         ;;
4507     arm*)
4508         CPUNAME=ARM
4509         EPM_FLAGS="-a arm"
4510         RTL_ARCH=ARM_EABI
4511         PLATFORMID=linux_arm_eabi
4512         case "$host_cpu" in
4513         arm*-linux)
4514             RTL_ARCH=ARM_OABI
4515             PLATFORMID=linux_arm_oabi
4516             ;;
4517         esac
4518         ;;
4519     hppa)
4520         CPUNAME=HPPA
4521         RTL_ARCH=HPPA
4522         EPM_FLAGS="-a hppa"
4523         PLATFORMID=linux_hppa
4524         ;;
4525     i*86)
4526         CPUNAME=INTEL
4527         RTL_ARCH=x86
4528         PLATFORMID=linux_x86
4529         ;;
4530     ia64)
4531         CPUNAME=IA64
4532         RTL_ARCH=IA64
4533         PLATFORMID=linux_ia64
4534         ;;
4535     mips)
4536         CPUNAME=GODSON
4537         RTL_ARCH=MIPS_EB
4538         EPM_FLAGS="-a mips"
4539         PLATFORMID=linux_mips_eb
4540         ;;
4541     mips64)
4542         CPUNAME=GODSON64
4543         RTL_ARCH=MIPS64_EB
4544         EPM_FLAGS="-a mips64"
4545         PLATFORMID=linux_mips64_eb
4546         ;;
4547     mips64el)
4548         CPUNAME=GODSON64
4549         RTL_ARCH=MIPS64_EL
4550         EPM_FLAGS="-a mips64el"
4551         PLATFORMID=linux_mips64_el
4552         ;;
4553     mipsel)
4554         CPUNAME=GODSON
4555         RTL_ARCH=MIPS_EL
4556         EPM_FLAGS="-a mipsel"
4557         PLATFORMID=linux_mips_el
4558         ;;
4559     m68k)
4560         CPUNAME=M68K
4561         RTL_ARCH=M68K
4562         PLATFORMID=linux_m68k
4563         ;;
4564     powerpc)
4565         CPUNAME=POWERPC
4566         RTL_ARCH=PowerPC
4567         PLATFORMID=linux_powerpc
4568         ;;
4569     powerpc64)
4570         CPUNAME=POWERPC64
4571         RTL_ARCH=PowerPC_64
4572         PLATFORMID=linux_powerpc64
4573         ;;
4574     powerpc64le)
4575         CPUNAME=POWERPC64
4576         RTL_ARCH=PowerPC_64_LE
4577         PLATFORMID=linux_powerpc64_le
4578         ;;
4579     sparc)
4580         CPUNAME=SPARC
4581         RTL_ARCH=SPARC
4582         PLATFORMID=linux_sparc
4583         ;;
4584     sparc64)
4585         CPUNAME=SPARC64
4586         RTL_ARCH=SPARC64
4587         PLATFORMID=linux_sparc64
4588         ;;
4589     s390)
4590         CPUNAME=S390
4591         RTL_ARCH=S390
4592         PLATFORMID=linux_s390
4593         ;;
4594     s390x)
4595         CPUNAME=S390X
4596         RTL_ARCH=S390x
4597         PLATFORMID=linux_s390x
4598         ;;
4599     x86_64)
4600         CPUNAME=X86_64
4601         RTL_ARCH=X86_64
4602         PLATFORMID=linux_x86_64
4603         ;;
4604     *)
4605         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4606         ;;
4607     esac
4608     ;;
4610 linux-android*)
4611     COM=GCC
4612     USING_X11=
4613     OS=ANDROID
4614     RTL_OS=Android
4615     P_SEP=:
4617     case "$host_cpu" in
4619     arm|armel)
4620         CPUNAME=ARM
4621         RTL_ARCH=ARM_EABI
4622         PLATFORMID=android_arm_eabi
4623         ;;
4624     aarch64)
4625         CPUNAME=AARCH64
4626         RTL_ARCH=AARCH64
4627         PLATFORMID=android_aarch64
4628         ;;
4629     i*86)
4630         CPUNAME=INTEL
4631         RTL_ARCH=x86
4632         PLATFORMID=android_x86
4633         ;;
4634     x86_64)
4635         CPUNAME=X86_64
4636         RTL_ARCH=X86_64
4637         PLATFORMID=android_x86_64
4638         ;;
4639     *)
4640         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4641         ;;
4642     esac
4643     ;;
4645 *netbsd*)
4646     COM=GCC
4647     USING_X11=TRUE
4648     OS=NETBSD
4649     RTL_OS=NetBSD
4650     P_SEP=:
4652     case "$host_cpu" in
4653     i*86)
4654         CPUNAME=INTEL
4655         RTL_ARCH=x86
4656         PLATFORMID=netbsd_x86
4657         ;;
4658     powerpc)
4659         CPUNAME=POWERPC
4660         RTL_ARCH=PowerPC
4661         PLATFORMID=netbsd_powerpc
4662         ;;
4663     sparc)
4664         CPUNAME=SPARC
4665         RTL_ARCH=SPARC
4666         PLATFORMID=netbsd_sparc
4667         ;;
4668     x86_64)
4669         CPUNAME=X86_64
4670         RTL_ARCH=X86_64
4671         PLATFORMID=netbsd_x86_64
4672         ;;
4673     *)
4674         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4675         ;;
4676     esac
4677     ;;
4679 openbsd*)
4680     COM=GCC
4681     USING_X11=TRUE
4682     OS=OPENBSD
4683     RTL_OS=OpenBSD
4684     P_SEP=:
4686     case "$host_cpu" in
4687     i*86)
4688         CPUNAME=INTEL
4689         RTL_ARCH=x86
4690         PLATFORMID=openbsd_x86
4691         ;;
4692     x86_64)
4693         CPUNAME=X86_64
4694         RTL_ARCH=X86_64
4695         PLATFORMID=openbsd_x86_64
4696         ;;
4697     *)
4698         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4699         ;;
4700     esac
4701     SOLARINC="$SOLARINC -I/usr/local/include"
4702     ;;
4704 solaris*)
4705     COM=GCC
4706     USING_X11=TRUE
4707     OS=SOLARIS
4708     RTL_OS=Solaris
4709     P_SEP=:
4711     case "$host_cpu" in
4712     i*86)
4713         CPUNAME=INTEL
4714         RTL_ARCH=x86
4715         PLATFORMID=solaris_x86
4716         ;;
4717     sparc)
4718         CPUNAME=SPARC
4719         RTL_ARCH=SPARC
4720         PLATFORMID=solaris_sparc
4721         ;;
4722     sparc64)
4723         CPUNAME=SPARC64
4724         RTL_ARCH=SPARC64
4725         PLATFORMID=solaris_sparc64
4726         ;;
4727     *)
4728         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4729         ;;
4730     esac
4731     SOLARINC="$SOLARINC -I/usr/local/include"
4732     ;;
4735     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4736     ;;
4737 esac
4739 if test "$with_x" = "no"; then
4740     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4743 DISABLE_GUI=""
4744 if test "$enable_gui" = "no"; then
4745     if test "$USING_X11" != TRUE; then
4746         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4747     fi
4748     USING_X11=
4749     DISABLE_GUI=TRUE
4750     AC_DEFINE(HAVE_FEATURE_UI,0)
4751     test_cairo=yes
4753 AC_SUBST(DISABLE_GUI)
4755 WORKDIR="${BUILDDIR}/workdir"
4756 INSTDIR="${BUILDDIR}/instdir"
4757 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4758 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4759 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4760 AC_SUBST(COM)
4761 AC_SUBST(CPUNAME)
4762 AC_SUBST(RTL_OS)
4763 AC_SUBST(RTL_ARCH)
4764 AC_SUBST(EPM_FLAGS)
4765 AC_SUBST(USING_X11)
4766 AC_SUBST([INSTDIR])
4767 AC_SUBST([INSTROOT])
4768 AC_SUBST([INSTROOTBASE])
4769 AC_SUBST(OS)
4770 AC_SUBST(P_SEP)
4771 AC_SUBST(WORKDIR)
4772 AC_SUBST(PLATFORMID)
4773 AC_SUBST(WINDOWS_X64)
4774 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4776 dnl ===================================================================
4777 dnl Test which package format to use
4778 dnl ===================================================================
4779 AC_MSG_CHECKING([which package format to use])
4780 if test -n "$with_package_format" -a "$with_package_format" != no; then
4781     for i in $with_package_format; do
4782         case "$i" in
4783         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4784             ;;
4785         *)
4786             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4787 aix - AIX software distribution
4788 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4789 deb - Debian software distribution
4790 pkg - Solaris software distribution
4791 rpm - RedHat software distribution
4793 LibreOffice additionally supports:
4794 archive - .tar.gz or .zip
4795 dmg - macOS .dmg
4796 installed - installation tree
4797 msi - Windows .msi
4798         ])
4799             ;;
4800         esac
4801     done
4802     # fakeroot is needed to ensure correct file ownerships/permissions
4803     # inside deb packages and tar archives created on Linux and Solaris.
4804     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4805         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4806         if test "$FAKEROOT" = "no"; then
4807             AC_MSG_ERROR(
4808                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4809         fi
4810     fi
4811     PKGFORMAT="$with_package_format"
4812     AC_MSG_RESULT([$PKGFORMAT])
4813 else
4814     PKGFORMAT=
4815     AC_MSG_RESULT([none])
4817 AC_SUBST(PKGFORMAT)
4819 dnl ===================================================================
4820 dnl Set up a different compiler to produce tools to run on the build
4821 dnl machine when doing cross-compilation
4822 dnl ===================================================================
4824 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4825 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4826 if test "$cross_compiling" = "yes"; then
4827     AC_MSG_CHECKING([for BUILD platform configuration])
4828     echo
4829     rm -rf CONF-FOR-BUILD config_build.mk
4830     mkdir CONF-FOR-BUILD
4831     # Here must be listed all files needed when running the configure script. In particular, also
4832     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4833     # keep them in the same order as there.
4834     (cd $SRC_ROOT && tar cf - \
4835         config.guess \
4836         bin/get_config_variables \
4837         solenv/bin/getcompver.awk \
4838         solenv/inc/langlist.mk \
4839         download.lst \
4840         config_host.mk.in \
4841         config_host_lang.mk.in \
4842         Makefile.in \
4843         bin/bffvalidator.sh.in \
4844         bin/odfvalidator.sh.in \
4845         bin/officeotron.sh.in \
4846         instsetoo_native/util/openoffice.lst.in \
4847         setup_native/source/packinfo/finals_instsetoo.txt.in \
4848         config_host/*.in \
4849         sysui/desktop/macosx/Info.plist.in) \
4850     | (cd CONF-FOR-BUILD && tar xf -)
4851     cp configure CONF-FOR-BUILD
4852     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4853     (
4854     unset COM USING_X11 OS CPUNAME
4855     unset CC CXX SYSBASE CFLAGS
4856     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4857     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4858     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4859     if test -n "$CC_FOR_BUILD"; then
4860         export CC="$CC_FOR_BUILD"
4861         CC_BASE=`first_arg_basename "$CC"`
4862     fi
4863     if test -n "$CXX_FOR_BUILD"; then
4864         export CXX="$CXX_FOR_BUILD"
4865         CXX_BASE=`first_arg_basename "$CXX"`
4866     fi
4867     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4868     cd CONF-FOR-BUILD
4869     sub_conf_opts=""
4870     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4871     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4872     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4873     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4874     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4875     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4876     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4877     # Don't bother having configure look for stuff not needed for the build platform anyway
4878     ./configure \
4879         --disable-cups \
4880         --disable-gstreamer-1-0 \
4881         --disable-gtk3 \
4882         --disable-pdfimport \
4883         --disable-postgresql-sdbc \
4884         --enable-icecream="$enable_icecream" \
4885         --with-parallelism="$with_parallelism" \
4886         --without-doxygen \
4887         --without-java \
4888         $sub_conf_opts \
4889         --srcdir=$srcdir \
4890         2>&1 | sed -e 's/^/    /'
4891     test -f ./config_host.mk 2>/dev/null || exit
4892     cp config_host.mk ../config_build.mk
4893     cp config_host_lang.mk ../config_build_lang.mk
4894     mv config.log ../config.Build.log
4895     mkdir -p ../config_build
4896     mv config_host/*.h ../config_build
4897     . ./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
4899     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
4900         VV='$'$V
4901         VV=`eval "echo $VV"`
4902         if test -n "$VV"; then
4903             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4904             echo "$line" >>build-config
4905         fi
4906     done
4908     for V in INSTDIR INSTROOT WORKDIR; do
4909         VV='$'$V
4910         VV=`eval "echo $VV"`
4911         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4912         if test -n "$VV"; then
4913             line="${V}_FOR_BUILD='$VV'"
4914             echo "$line" >>build-config
4915         fi
4916     done
4918     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4919     echo "$line" >>build-config
4921     )
4922     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4923     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])
4924     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4925              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4927     eval `cat CONF-FOR-BUILD/build-config`
4929     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4931     rm -rf CONF-FOR-BUILD
4932 else
4933     OS_FOR_BUILD="$OS"
4934     CC_FOR_BUILD="$CC"
4935     CXX_FOR_BUILD="$CXX"
4936     INSTDIR_FOR_BUILD="$INSTDIR"
4937     INSTROOT_FOR_BUILD="$INSTROOT"
4938     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4939     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4940     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4941     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4942     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4943     WORKDIR_FOR_BUILD="$WORKDIR"
4945 AC_SUBST(OS_FOR_BUILD)
4946 AC_SUBST(INSTDIR_FOR_BUILD)
4947 AC_SUBST(INSTROOT_FOR_BUILD)
4948 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4949 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4950 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4951 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4952 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4953 AC_SUBST(WORKDIR_FOR_BUILD)
4955 dnl ===================================================================
4956 dnl Check for syslog header
4957 dnl ===================================================================
4958 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4960 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4961 dnl ===================================================================
4962 AC_MSG_CHECKING([whether to turn warnings to errors])
4963 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4964     ENABLE_WERROR="TRUE"
4965     AC_MSG_RESULT([yes])
4966 else
4967     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4968         ENABLE_WERROR="TRUE"
4969         AC_MSG_RESULT([yes])
4970     else
4971         AC_MSG_RESULT([no])
4972     fi
4974 AC_SUBST(ENABLE_WERROR)
4976 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4977 dnl ===================================================================
4978 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4979 if test -z "$enable_assert_always_abort"; then
4980    if test "$ENABLE_DEBUG" = TRUE; then
4981        enable_assert_always_abort=yes
4982    else
4983        enable_assert_always_abort=no
4984    fi
4986 if test "$enable_assert_always_abort" = "yes"; then
4987     ASSERT_ALWAYS_ABORT="TRUE"
4988     AC_MSG_RESULT([yes])
4989 else
4990     ASSERT_ALWAYS_ABORT="FALSE"
4991     AC_MSG_RESULT([no])
4993 AC_SUBST(ASSERT_ALWAYS_ABORT)
4995 # Determine whether to use ooenv for the instdir installation
4996 # ===================================================================
4997 if test $_os != "WINNT" -a $_os != "Darwin"; then
4998     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4999     if test "$enable_ooenv" = "no"; then
5000         AC_MSG_RESULT([no])
5001     else
5002         ENABLE_OOENV="TRUE"
5003         AC_MSG_RESULT([yes])
5004     fi
5006 AC_SUBST(ENABLE_OOENV)
5008 if test "$USING_X11" != TRUE; then
5009     # be sure to do not mess with unneeded stuff
5010     test_randr=no
5011     test_xrender=no
5012     test_cups=no
5013     test_dbus=no
5014     build_gstreamer_1_0=no
5015     test_kf5=no
5016     test_qt5=no
5017     test_gtk3_kde5=no
5018     enable_cairo_canvas=no
5021 if test "$OS" = "HAIKU"; then
5022     enable_cairo_canvas=yes
5023     test_kf5=yes
5026 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5027     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!])
5028     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!"
5029     enable_kf5=yes
5032 if test "$test_kf5" = "yes"; then
5033     test_qt5=yes
5036 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5037     if test "$enable_qt5" = "no"; then
5038         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5039     else
5040         enable_qt5=yes
5041     fi
5044 dnl ===================================================================
5045 dnl check for cups support
5046 dnl ===================================================================
5047 ENABLE_CUPS=""
5049 if test "$enable_cups" = "no"; then
5050     test_cups=no
5053 AC_MSG_CHECKING([whether to enable CUPS support])
5054 if test "$test_cups" = "yes"; then
5055     ENABLE_CUPS="TRUE"
5056     AC_MSG_RESULT([yes])
5058     AC_MSG_CHECKING([whether cups support is present])
5059     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5060     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5061     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5062         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5063     fi
5065 else
5066     AC_MSG_RESULT([no])
5069 AC_SUBST(ENABLE_CUPS)
5071 # fontconfig checks
5072 if test "$test_fontconfig" = "yes"; then
5073     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5074     SYSTEM_FONTCONFIG=TRUE
5075     FilterLibs "${FONTCONFIG_LIBS}"
5076     FONTCONFIG_LIBS="${filteredlibs}"
5078 AC_SUBST(FONTCONFIG_CFLAGS)
5079 AC_SUBST(FONTCONFIG_LIBS)
5080 AC_SUBST([SYSTEM_FONTCONFIG])
5082 dnl whether to find & fetch external tarballs?
5083 dnl ===================================================================
5084 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5085    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5086        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5087    else
5088        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5089    fi
5091 if test -z "$TARFILE_LOCATION"; then
5092     if test -d "$SRC_ROOT/src" ; then
5093         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5094         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5095     fi
5096     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5097 else
5098     AbsolutePath "$TARFILE_LOCATION"
5099     PathFormat "${absolute_path}"
5100     TARFILE_LOCATION="${formatted_path}"
5102 AC_SUBST(TARFILE_LOCATION)
5104 AC_MSG_CHECKING([whether we want to fetch tarballs])
5105 if test "$enable_fetch_external" != "no"; then
5106     if test "$with_all_tarballs" = "yes"; then
5107         AC_MSG_RESULT([yes, all of them])
5108         DO_FETCH_TARBALLS="ALL"
5109     else
5110         AC_MSG_RESULT([yes, if we use them])
5111         DO_FETCH_TARBALLS="TRUE"
5112     fi
5113 else
5114     AC_MSG_RESULT([no])
5115     DO_FETCH_TARBALLS=
5117 AC_SUBST(DO_FETCH_TARBALLS)
5119 AC_MSG_CHECKING([whether to build help])
5120 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5121     BUILD_TYPE="$BUILD_TYPE HELP"
5122     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5123     case "$with_help" in
5124     "html")
5125         ENABLE_HTMLHELP=TRUE
5126         SCPDEFS="$SCPDEFS -DWITH_HELP"
5127         AC_MSG_RESULT([HTML])
5128         ;;
5129     "online")
5130         ENABLE_HTMLHELP=TRUE
5131         HELP_ONLINE=TRUE
5132         AC_MSG_RESULT([HTML])
5133         ;;
5134     yes)
5135         SCPDEFS="$SCPDEFS -DWITH_HELP"
5136         AC_MSG_RESULT([yes])
5137         ;;
5138     *)
5139         AC_MSG_ERROR([Unknown --with-help=$with_help])
5140         ;;
5141     esac
5142 else
5143     AC_MSG_RESULT([no])
5145 AC_SUBST([ENABLE_HTMLHELP])
5146 AC_SUBST([HELP_ONLINE])
5148 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5149 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5150     BUILD_TYPE="$BUILD_TYPE HELP"
5151     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5152     case "$with_omindex" in
5153     "server")
5154         ENABLE_HTMLHELP=TRUE
5155         HELP_ONLINE=TRUE
5156         HELP_OMINDEX_PAGE=TRUE
5157         AC_MSG_RESULT([SERVER])
5158         ;;
5159     "noxap")
5160         ENABLE_HTMLHELP=TRUE
5161         HELP_ONLINE=TRUE
5162         HELP_OMINDEX_PAGE=FALSE
5163         AC_MSG_RESULT([NOXAP])
5164         ;;
5165     *)
5166         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5167         ;;
5168     esac
5169 else
5170     HELP_OMINDEX_PAGE=FALSE
5171     AC_MSG_RESULT([no])
5173 AC_SUBST([ENABLE_HTMLHELP])
5174 AC_SUBST([HELP_OMINDEX_PAGE])
5175 AC_SUBST([HELP_ONLINE])
5178 dnl Test whether to include MySpell dictionaries
5179 dnl ===================================================================
5180 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5181 if test "$with_myspell_dicts" = "yes"; then
5182     AC_MSG_RESULT([yes])
5183     WITH_MYSPELL_DICTS=TRUE
5184     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5185     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5186 else
5187     AC_MSG_RESULT([no])
5188     WITH_MYSPELL_DICTS=
5190 AC_SUBST(WITH_MYSPELL_DICTS)
5192 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5193 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5194     if test "$with_system_dicts" = yes; then
5195         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5196     fi
5197     with_system_dicts=no
5200 AC_MSG_CHECKING([whether to use dicts from external paths])
5201 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5202     AC_MSG_RESULT([yes])
5203     SYSTEM_DICTS=TRUE
5204     AC_MSG_CHECKING([for spelling dictionary directory])
5205     if test -n "$with_external_dict_dir"; then
5206         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5207     else
5208         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5209         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5210             DICT_SYSTEM_DIR=file:///usr/share/myspell
5211         fi
5212     fi
5213     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5214     AC_MSG_CHECKING([for hyphenation patterns directory])
5215     if test -n "$with_external_hyph_dir"; then
5216         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5217     else
5218         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5219     fi
5220     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5221     AC_MSG_CHECKING([for thesaurus directory])
5222     if test -n "$with_external_thes_dir"; then
5223         THES_SYSTEM_DIR=file://$with_external_thes_dir
5224     else
5225         THES_SYSTEM_DIR=file:///usr/share/mythes
5226     fi
5227     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5228 else
5229     AC_MSG_RESULT([no])
5230     SYSTEM_DICTS=
5232 AC_SUBST(SYSTEM_DICTS)
5233 AC_SUBST(DICT_SYSTEM_DIR)
5234 AC_SUBST(HYPH_SYSTEM_DIR)
5235 AC_SUBST(THES_SYSTEM_DIR)
5237 dnl ===================================================================
5238 dnl Precompiled headers.
5239 ENABLE_PCH=""
5240 AC_MSG_CHECKING([whether to enable pch feature])
5241 if test -z "$enable_pch"; then
5242     if test "$_os" = "WINNT"; then
5243         # Enabled by default on Windows.
5244         enable_pch=yes
5245     else
5246         enable_pch=no
5247     fi
5249 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5250     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5252 if test "$enable_pch" = "system"; then
5253     ENABLE_PCH="1"
5254     AC_MSG_RESULT([yes (system headers)])
5255 elif test "$enable_pch" = "base"; then
5256     ENABLE_PCH="2"
5257     AC_MSG_RESULT([yes (system and base headers)])
5258 elif test "$enable_pch" = "normal"; then
5259     ENABLE_PCH="3"
5260     AC_MSG_RESULT([yes (normal)])
5261 elif test "$enable_pch" = "full"; then
5262     ENABLE_PCH="4"
5263     AC_MSG_RESULT([yes (full)])
5264 elif test "$enable_pch" = "yes"; then
5265     # Pick a suitable default.
5266     if test "$GCC" = "yes"; then
5267         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5268         # while making the PCHs larger and rebuilds more likely.
5269         ENABLE_PCH="2"
5270         AC_MSG_RESULT([yes (system and base headers)])
5271     else
5272         # With MSVC the highest level makes a significant difference,
5273         # and it was the default when there used to be no PCH levels.
5274         ENABLE_PCH="4"
5275         AC_MSG_RESULT([yes (full)])
5276     fi
5277 elif test "$enable_pch" = "no"; then
5278     AC_MSG_RESULT([no])
5279 else
5280     AC_MSG_ERROR([Unknown value for --enable-pch])
5282 AC_SUBST(ENABLE_PCH)
5283 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5284 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5285     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5286     if test "$CCACHE_BIN" != "not found"; then
5287         AC_MSG_CHECKING([ccache version])
5288         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5289         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5290         AC_MSG_RESULT([$CCACHE_VERSION])
5291         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5292         if test "$CCACHE_NUMVER" -gt "030701"; then
5293             AC_MSG_RESULT([yes])
5294         else
5295             AC_MSG_RESULT([no (not newer than 3.7.1)])
5296             CCACHE_DEPEND_MODE=
5297         fi
5298     fi
5301 TAB=`printf '\t'`
5303 AC_MSG_CHECKING([the GNU Make version])
5304 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5305 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5306 if test "$_make_longver" -ge "038200"; then
5307     AC_MSG_RESULT([$GNUMAKE $_make_version])
5309 elif test "$_make_longver" -ge "038100"; then
5310     if test "$build_os" = "cygwin"; then
5311         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5312     fi
5313     AC_MSG_RESULT([$GNUMAKE $_make_version])
5315     dnl ===================================================================
5316     dnl Search all the common names for sha1sum
5317     dnl ===================================================================
5318     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5319     if test -z "$SHA1SUM"; then
5320         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5321     elif test "$SHA1SUM" = "openssl"; then
5322         SHA1SUM="openssl sha1"
5323     fi
5324     AC_MSG_CHECKING([for GNU Make bug 20033])
5325     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5326     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5327 A := \$(wildcard *.a)
5329 .PHONY: all
5330 all: \$(A:.a=.b)
5331 <TAB>@echo survived bug20033.
5333 .PHONY: setup
5334 setup:
5335 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5337 define d1
5338 @echo lala \$(1)
5339 @sleep 1
5340 endef
5342 define d2
5343 @echo tyty \$(1)
5344 @sleep 1
5345 endef
5347 %.b : %.a
5348 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5349 <TAB>\$(call d1,\$(CHECKSUM)),\
5350 <TAB>\$(call d2,\$(CHECKSUM)))
5352     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5353         no_parallelism_make="YES"
5354         AC_MSG_RESULT([yes, disable parallelism])
5355     else
5356         AC_MSG_RESULT([no, keep parallelism enabled])
5357     fi
5358     rm -rf $TESTGMAKEBUG20033
5359 else
5360     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5363 # find if gnumake support file function
5364 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5365 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5366 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5367     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5369 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5370 \$(file >test.txt,Success )
5372 .PHONY: all
5373 all:
5374 <TAB>@cat test.txt
5377 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5378 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5379     HAVE_GNUMAKE_FILE_FUNC=TRUE
5380     AC_MSG_RESULT([yes])
5381 else
5382     AC_MSG_RESULT([no])
5384 rm -rf $TESTGMAKEFILEFUNC
5385 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5386 AC_SUBST(GNUMAKE_WIN_NATIVE)
5388 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5389 STALE_MAKE=
5390 if test "$_make_ver_check" = ""; then
5391    STALE_MAKE=TRUE
5394 HAVE_LD_HASH_STYLE=FALSE
5395 WITH_LINKER_HASH_STYLE=
5396 AC_MSG_CHECKING([for --hash-style gcc linker support])
5397 if test "$GCC" = "yes"; then
5398     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5399         hash_styles="gnu sysv"
5400     elif test "$with_linker_hash_style" = "no"; then
5401         hash_styles=
5402     else
5403         hash_styles="$with_linker_hash_style"
5404     fi
5406     for hash_style in $hash_styles; do
5407         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5408         hash_style_ldflags_save=$LDFLAGS
5409         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5411         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5412             [
5413 #include <stdio.h>
5414             ],[
5415 printf ("");
5416             ])],
5417             [
5418                   HAVE_LD_HASH_STYLE=TRUE
5419                   WITH_LINKER_HASH_STYLE=$hash_style
5420             ],
5421             [HAVE_LD_HASH_STYLE=FALSE],
5422             [HAVE_LD_HASH_STYLE=FALSE])
5423         LDFLAGS=$hash_style_ldflags_save
5424     done
5426     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5427         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5428     else
5429         AC_MSG_RESULT( no )
5430     fi
5431     LDFLAGS=$hash_style_ldflags_save
5432 else
5433     AC_MSG_RESULT( no )
5435 AC_SUBST(HAVE_LD_HASH_STYLE)
5436 AC_SUBST(WITH_LINKER_HASH_STYLE)
5438 dnl ===================================================================
5439 dnl Check whether there's a Perl version available.
5440 dnl ===================================================================
5441 if test -z "$with_perl_home"; then
5442     AC_PATH_PROG(PERL, perl)
5443 else
5444     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5445     _perl_path="$with_perl_home/bin/perl"
5446     if test -x "$_perl_path"; then
5447         PERL=$_perl_path
5448     else
5449         AC_MSG_ERROR([$_perl_path not found])
5450     fi
5453 dnl ===================================================================
5454 dnl Testing for Perl version 5 or greater.
5455 dnl $] is the Perl version variable, it is returned as an integer
5456 dnl ===================================================================
5457 if test "$PERL"; then
5458     AC_MSG_CHECKING([the Perl version])
5459     ${PERL} -e "exit($]);"
5460     _perl_version=$?
5461     if test "$_perl_version" -lt 5; then
5462         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5463     fi
5464     AC_MSG_RESULT([Perl $_perl_version])
5465 else
5466     AC_MSG_ERROR([Perl not found, install Perl 5])
5469 dnl ===================================================================
5470 dnl Testing for required Perl modules
5471 dnl ===================================================================
5473 AC_MSG_CHECKING([for required Perl modules])
5474 perl_use_string="use Cwd ; use Digest::MD5"
5475 if test "$_os" = "WINNT"; then
5476     if test -n "$PKGFORMAT"; then
5477         for i in $PKGFORMAT; do
5478             case "$i" in
5479             msi)
5480                 # for getting fonts versions to use in MSI
5481                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5482                 ;;
5483             esac
5484         done
5485     fi
5487 if test "$with_system_hsqldb" = "yes"; then
5488     perl_use_string="$perl_use_string ; use Archive::Zip"
5490 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5491     AC_MSG_RESULT([all modules found])
5492 else
5493     AC_MSG_RESULT([failed to find some modules])
5494     # Find out which modules are missing.
5495     for i in $perl_use_string; do
5496         if test "$i" != "use" -a "$i" != ";"; then
5497             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5498                 missing_perl_modules="$missing_perl_modules $i"
5499             fi
5500         fi
5501     done
5502     AC_MSG_ERROR([
5503     The missing Perl modules are: $missing_perl_modules
5504     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5507 dnl ===================================================================
5508 dnl Check for pkg-config
5509 dnl ===================================================================
5510 if test "$_os" != "WINNT"; then
5511     PKG_PROG_PKG_CONFIG
5514 if test "$_os" != "WINNT"; then
5516     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5517     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5518     # explicitly. Or put /path/to/compiler in PATH yourself.
5520     # Use wrappers for LTO
5521     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5522         AC_CHECK_TOOL(AR,gcc-ar)
5523         AC_CHECK_TOOL(NM,gcc-nm)
5524         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5525     else
5526         AC_CHECK_TOOL(AR,ar)
5527         AC_CHECK_TOOL(NM,nm)
5528         AC_CHECK_TOOL(RANLIB,ranlib)
5529     fi
5530     AC_CHECK_TOOL(OBJDUMP,objdump)
5531     AC_CHECK_TOOL(READELF,readelf)
5532     AC_CHECK_TOOL(STRIP,strip)
5533     if test "$_os" = "WINNT"; then
5534         AC_CHECK_TOOL(DLLTOOL,dlltool)
5535         AC_CHECK_TOOL(WINDRES,windres)
5536     fi
5538 AC_SUBST(AR)
5539 AC_SUBST(DLLTOOL)
5540 AC_SUBST(NM)
5541 AC_SUBST(OBJDUMP)
5542 AC_SUBST(PKG_CONFIG)
5543 AC_SUBST(RANLIB)
5544 AC_SUBST(READELF)
5545 AC_SUBST(STRIP)
5546 AC_SUBST(WINDRES)
5548 dnl ===================================================================
5549 dnl pkg-config checks on macOS
5550 dnl ===================================================================
5552 if test $_os = Darwin; then
5553     AC_MSG_CHECKING([for bogus pkg-config])
5554     if test -n "$PKG_CONFIG"; then
5555         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5556             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5557         else
5558             if test "$enable_bogus_pkg_config" = "yes"; then
5559                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5560             else
5561                 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.])
5562             fi
5563         fi
5564     else
5565         AC_MSG_RESULT([no, good])
5566     fi
5569 find_csc()
5571     # Return value: $csctest
5573     unset csctest
5575     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5576     if test -n "$regvalue"; then
5577         csctest=$regvalue
5578         return
5579     fi
5582 find_al()
5584     # Return value: $altest
5586     unset altest
5588     # We need this check to detect 4.6.1 or above.
5589     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5590         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5591         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5592             altest=$regvalue
5593             return
5594         fi
5595     done
5597     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5598         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5599         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5600             altest=$regvalue
5601             return
5602         fi
5603     done
5608 find_dotnetsdk46()
5610     unset frametest
5612     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5613         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5614         if test -n "$regvalue"; then
5615             frametest=$regvalue
5616             return
5617         fi
5618     done
5621 find_winsdk_version()
5623     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5624     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5626     unset winsdktest winsdkbinsubdir winsdklibsubdir
5628     case "$1" in
5629     8.0|8.0A)
5630         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5631         if test -n "$regvalue"; then
5632             winsdktest=$regvalue
5633             winsdklibsubdir=win8
5634             return
5635         fi
5636         ;;
5637     8.1|8.1A)
5638         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5639         if test -n "$regvalue"; then
5640             winsdktest=$regvalue
5641             winsdklibsubdir=winv6.3
5642             return
5643         fi
5644         ;;
5645     10.0)
5646         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5647         if test -n "$regvalue"; then
5648             winsdktest=$regvalue
5649             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5650             if test -n "$regvalue"; then
5651                 winsdkbinsubdir="$regvalue".0
5652                 winsdklibsubdir=$winsdkbinsubdir
5653                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5654                 # test exist the SDK path
5655                 if test -d "$tmppath"; then
5656                    # when path is convertible to a short path then path is okay
5657                    cygpath -d "$tmppath" >/dev/null 2>&1
5658                    if test $? -ne 0; then
5659                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5660                    fi
5661                 else
5662                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5663                 fi
5664             fi
5665             return
5666         fi
5667         ;;
5668     esac
5671 find_winsdk()
5673     # Return value: From find_winsdk_version
5675     unset winsdktest
5677     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5678         find_winsdk_version $ver
5679         if test -n "$winsdktest"; then
5680             return
5681         fi
5682     done
5685 find_msms()
5687     AC_MSG_CHECKING([for MSVC merge modules directory])
5688     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5689     case "$VCVER" in
5690         150|160)
5691         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5692         ;;
5693     esac
5694     for f in $my_msm_files; do
5695         echo "$as_me:$LINENO: searching for $f" >&5
5696     done
5698     msmdir=
5699     for ver in 14.0 15.0; do
5700         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5701         if test -n "$regvalue"; then
5702             for f in ${my_msm_files}; do
5703                 if test -e "$regvalue/${f}"; then
5704                     msmdir=$regvalue
5705                     break
5706                 fi
5707             done
5708         fi
5709     done
5710     dnl Is the following fallback really necessary, or was it added in response
5711     dnl to never having started Visual Studio on a given machine, so the
5712     dnl registry keys checked above had presumably not yet been created?
5713     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5714     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5715     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5716     dnl expanding to "C:\Program Files\Common Files"), which would need
5717     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5718     dnl obtain its value from cygwin:
5719     if test -z "$msmdir"; then
5720         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5721         for f in ${my_msm_files}; do
5722             if test -e "$my_msm_dir/${f}"; then
5723                 msmdir=$my_msm_dir
5724             fi
5725         done
5726     fi
5728     dnl Starting from MSVC 15.0, merge modules are located in different directory
5729     case "$VCVER" in
5730     150|160)
5731         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5732             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5733             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5734             for f in ${my_msm_files}; do
5735                 if test -e "$my_msm_dir/${f}"; then
5736                     msmdir=$my_msm_dir
5737                     break
5738                 fi
5739             done
5740         done
5741         ;;
5742     esac
5744     if test -n "$msmdir"; then
5745         msmdir=`cygpath -m "$msmdir"`
5746         AC_MSG_RESULT([$msmdir])
5747     else
5748         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5749             AC_MSG_FAILURE([not found])
5750         else
5751             AC_MSG_WARN([not found (check config.log)])
5752             add_warning "MSM none of ${my_msm_files} found"
5753         fi
5754     fi
5757 find_msvc_x64_dlls()
5759     AC_MSG_CHECKING([for MSVC x64 DLL path])
5760     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5761     case "$VCVER" in
5762     150|160)
5763         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5764             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5765             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5766                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5767                 break
5768             fi
5769             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5770             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5771                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5772                 break
5773             fi
5774             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5775             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5776                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5777                 break
5778             fi
5779         done
5780         ;;
5781     esac
5782     AC_MSG_RESULT([$msvcdllpath])
5783     AC_MSG_CHECKING([for MSVC x64 DLLs])
5784     msvcdlls="msvcp140.dll vcruntime140.dll"
5785     for dll in $msvcdlls; do
5786         if ! test -f "$msvcdllpath/$dll"; then
5787             AC_MSG_FAILURE([missing $dll])
5788         fi
5789     done
5790     AC_MSG_RESULT([found all ($msvcdlls)])
5793 dnl =========================================
5794 dnl Check for the Windows  SDK.
5795 dnl =========================================
5796 if test "$_os" = "WINNT"; then
5797     AC_MSG_CHECKING([for Windows SDK])
5798     if test "$build_os" = "cygwin"; then
5799         find_winsdk
5800         WINDOWS_SDK_HOME=$winsdktest
5802         # normalize if found
5803         if test -n "$WINDOWS_SDK_HOME"; then
5804             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5805             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5806         fi
5808         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5809     fi
5811     if test -n "$WINDOWS_SDK_HOME"; then
5812         # Remove a possible trailing backslash
5813         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5815         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5816              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5817              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5818             have_windows_sdk_headers=yes
5819         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5820              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5821              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5822             have_windows_sdk_headers=yes
5823         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5824              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5825              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5826             have_windows_sdk_headers=yes
5827         else
5828             have_windows_sdk_headers=no
5829         fi
5831         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5832             have_windows_sdk_libs=yes
5833         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5834             have_windows_sdk_libs=yes
5835         else
5836             have_windows_sdk_libs=no
5837         fi
5839         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5840             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5841 the  Windows SDK are installed.])
5842         fi
5843     fi
5845     if test -z "$WINDOWS_SDK_HOME"; then
5846         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5847     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5848         WINDOWS_SDK_VERSION=80
5849         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5850     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5851         WINDOWS_SDK_VERSION=81
5852         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5853     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5854         WINDOWS_SDK_VERSION=10
5855         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5856     else
5857         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5858     fi
5859     PathFormat "$WINDOWS_SDK_HOME"
5860     WINDOWS_SDK_HOME="$formatted_path"
5861     if test "$build_os" = "cygwin"; then
5862         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5863         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5864             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5865         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5866             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5867         fi
5868     fi
5870     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5871     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5872     dnl but not in v8.0), so allow this to be overridden with a
5873     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5874     dnl and configuration error if no WiLangId.vbs is found would arguably be
5875     dnl better, but I do not know under which conditions exactly it is needed by
5876     dnl msiglobal.pm:
5877     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5878         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5879         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5880             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5881         fi
5882         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5883             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5884         fi
5885         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5886             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5887         fi
5888     fi
5889     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5890         if test -n "$with_package_format" -a "$with_package_format" != no; then
5891             for i in "$with_package_format"; do
5892                 if test "$i" = "msi"; then
5893                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5894                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5895                     fi
5896                 fi
5897             done
5898         fi
5899     fi
5901 AC_SUBST(WINDOWS_SDK_HOME)
5902 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5903 AC_SUBST(WINDOWS_SDK_VERSION)
5904 AC_SUBST(WINDOWS_SDK_WILANGID)
5906 if test "$build_os" = "cygwin"; then
5907     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5908     dnl dir, it also determines that dir's path w/o an arch segment if any,
5909     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5910     AC_MSG_CHECKING([for midl.exe])
5912     find_winsdk
5913     if test -n "$winsdkbinsubdir" \
5914         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5915     then
5916         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5917         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5918     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5919         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5920         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5921     elif test -f "$winsdktest/Bin/midl.exe"; then
5922         MIDL_PATH=$winsdktest/Bin
5923         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5924     fi
5925     if test ! -f "$MIDL_PATH/midl.exe"; then
5926         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5927     else
5928         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5929     fi
5931     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5932     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5934     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5935          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5936          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5937          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5938     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5939          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5940          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5941          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5942     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5943          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5944          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5945          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5946     else
5947         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5948     fi
5950     dnl Check csc.exe
5951     AC_MSG_CHECKING([for csc.exe])
5952     find_csc
5953     if test -f "$csctest/csc.exe"; then
5954         CSC_PATH="$csctest"
5955     fi
5956     if test ! -f "$CSC_PATH/csc.exe"; then
5957         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5958     else
5959         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5960     fi
5962     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5964     dnl Check al.exe
5965     AC_MSG_CHECKING([for al.exe])
5966     find_winsdk
5967     if test -n "$winsdkbinsubdir" \
5968         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5969     then
5970         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5971     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5972         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5973     elif test -f "$winsdktest/Bin/al.exe"; then
5974         AL_PATH="$winsdktest/Bin"
5975     fi
5977     if test -z "$AL_PATH"; then
5978         find_al
5979         if test -f "$altest/bin/al.exe"; then
5980             AL_PATH="$altest/bin"
5981         elif test -f "$altest/al.exe"; then
5982             AL_PATH="$altest"
5983         fi
5984     fi
5985     if test ! -f "$AL_PATH/al.exe"; then
5986         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5987     else
5988         AC_MSG_RESULT([$AL_PATH/al.exe])
5989     fi
5991     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5993     dnl Check mscoree.lib / .NET Framework dir
5994     AC_MSG_CHECKING(.NET Framework)
5995     find_dotnetsdk46
5996     PathFormat "$frametest"
5997     frametest="$formatted_path"
5998     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5999         DOTNET_FRAMEWORK_HOME="$frametest"
6000     else
6001         find_winsdk
6002         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6003             DOTNET_FRAMEWORK_HOME="$winsdktest"
6004         fi
6005     fi
6006     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
6007         AC_MSG_ERROR([mscoree.lib not found])
6008     fi
6009     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6011     PathFormat "$MIDL_PATH"
6012     MIDL_PATH="$formatted_path"
6014     PathFormat "$AL_PATH"
6015     AL_PATH="$formatted_path"
6017     PathFormat "$DOTNET_FRAMEWORK_HOME"
6018     DOTNET_FRAMEWORK_HOME="$formatted_path"
6020     PathFormat "$CSC_PATH"
6021     CSC_PATH="$formatted_path"
6024 dnl ===================================================================
6025 dnl Check if stdc headers are available excluding MSVC.
6026 dnl ===================================================================
6027 if test "$_os" != "WINNT"; then
6028     AC_HEADER_STDC
6031 dnl ===================================================================
6032 dnl Testing for C++ compiler and version...
6033 dnl ===================================================================
6035 if test "$_os" != "WINNT"; then
6036     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6037     save_CXXFLAGS=$CXXFLAGS
6038     AC_PROG_CXX
6039     CXXFLAGS=$save_CXXFLAGS
6040     if test -z "$CXX_BASE"; then
6041         CXX_BASE=`first_arg_basename "$CXX"`
6042     fi
6045 dnl check for GNU C++ compiler version
6046 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6047     AC_MSG_CHECKING([the GNU C++ compiler version])
6049     _gpp_version=`$CXX -dumpversion`
6050     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6052     if test "$_gpp_majmin" -lt "700"; then
6053         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6054     else
6055         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6056     fi
6058     dnl see https://code.google.com/p/android/issues/detail?id=41770
6059         glibcxx_threads=no
6060         AC_LANG_PUSH([C++])
6061         AC_REQUIRE_CPP
6062         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6063         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6064             #include <bits/c++config.h>]],[[
6065             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6066             && !defined(_GLIBCXX__PTHREADS) \
6067             && !defined(_GLIBCXX_HAS_GTHREADS)
6068             choke me
6069             #endif
6070         ]])],[AC_MSG_RESULT([yes])
6071         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6072         AC_LANG_POP([C++])
6073         if test $glibcxx_threads = yes; then
6074             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6075         fi
6077 AC_SUBST(BOOST_CXXFLAGS)
6080 # prefx CXX with ccache if needed
6082 if test "$CCACHE" != ""; then
6083     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6084     AC_LANG_PUSH([C++])
6085     save_CXXFLAGS=$CXXFLAGS
6086     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6087     dnl an empty program will do, we're checking the compiler flags
6088     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6089                       [use_ccache=yes], [use_ccache=no])
6090     if test $use_ccache = yes; then
6091         AC_MSG_RESULT([yes])
6092     else
6093         CXX="$CCACHE $CXX"
6094         CXX_BASE="ccache $CXX_BASE"
6095         AC_MSG_RESULT([no])
6096     fi
6097     CXXFLAGS=$save_CXXFLAGS
6098     AC_LANG_POP([C++])
6101 dnl ===================================================================
6102 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6103 dnl ===================================================================
6105 if test "$_os" != "WINNT"; then
6106     AC_PROG_CXXCPP
6108     dnl Check whether there's a C pre-processor.
6109     AC_PROG_CPP
6113 dnl ===================================================================
6114 dnl Find integral type sizes and alignments
6115 dnl ===================================================================
6117 if test "$_os" != "WINNT"; then
6119 if test "$_os" = "iOS"; then
6120     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6121     ac_cv_sizeof_long=8
6122     ac_cv_sizeof_short=2
6123     ac_cv_sizeof_int=4
6124     ac_cv_sizeof_long_long=8
6125     ac_cv_sizeof_double=8
6126     ac_cv_sizeof_voidp=8
6127 else
6128     AC_CHECK_SIZEOF(long)
6129     AC_CHECK_SIZEOF(short)
6130     AC_CHECK_SIZEOF(int)
6131     AC_CHECK_SIZEOF(long long)
6132     AC_CHECK_SIZEOF(double)
6133     AC_CHECK_SIZEOF(void*)
6136     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6137     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6138     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6139     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6140     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6142     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6143     m4_pattern_allow([AC_CHECK_ALIGNOF])
6144     m4_ifdef([AC_CHECK_ALIGNOF],
6145         [
6146             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6147             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6148             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6149             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6150         ],
6151         [
6152             case "$_os-$host_cpu" in
6153             Linux-i686)
6154                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6155                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6156                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6157                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6158                 ;;
6159             Linux-x86_64)
6160                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6161                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6162                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6163                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6164                 ;;
6165             *)
6166                 if test -z "$ac_cv_alignof_short" -o \
6167                         -z "$ac_cv_alignof_int" -o \
6168                         -z "$ac_cv_alignof_long" -o \
6169                         -z "$ac_cv_alignof_double"; then
6170                    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.])
6171                 fi
6172                 ;;
6173             esac
6174         ])
6176     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6177     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6178     if test $ac_cv_sizeof_long -eq 8; then
6179         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6180     elif test $ac_cv_sizeof_double -eq 8; then
6181         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6182     else
6183         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6184     fi
6186     dnl Check for large file support
6187     AC_SYS_LARGEFILE
6188     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6189         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6190     fi
6191     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6192         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6193     fi
6194 else
6195     # Hardcode for MSVC
6196     SAL_TYPES_SIZEOFSHORT=2
6197     SAL_TYPES_SIZEOFINT=4
6198     SAL_TYPES_SIZEOFLONG=4
6199     SAL_TYPES_SIZEOFLONGLONG=8
6200     if test "$BITNESS_OVERRIDE" = ""; then
6201         SAL_TYPES_SIZEOFPOINTER=4
6202     else
6203         SAL_TYPES_SIZEOFPOINTER=8
6204     fi
6205     SAL_TYPES_ALIGNMENT2=2
6206     SAL_TYPES_ALIGNMENT4=4
6207     SAL_TYPES_ALIGNMENT8=8
6208     LFS_CFLAGS=''
6210 AC_SUBST(LFS_CFLAGS)
6212 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6213 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6214 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6215 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6216 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6217 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6218 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6219 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6221 dnl ===================================================================
6222 dnl Check whether to enable runtime optimizations
6223 dnl ===================================================================
6224 ENABLE_RUNTIME_OPTIMIZATIONS=
6225 AC_MSG_CHECKING([whether to enable runtime optimizations])
6226 if test -z "$enable_runtime_optimizations"; then
6227     for i in $CC; do
6228         case $i in
6229         -fsanitize=*)
6230             enable_runtime_optimizations=no
6231             break
6232             ;;
6233         esac
6234     done
6236 if test "$enable_runtime_optimizations" != no; then
6237     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6238     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6239     AC_MSG_RESULT([yes])
6240 else
6241     AC_MSG_RESULT([no])
6243 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6245 dnl ===================================================================
6246 dnl Check if valgrind headers are available
6247 dnl ===================================================================
6248 ENABLE_VALGRIND=
6249 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6250     prev_cppflags=$CPPFLAGS
6251     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6252     # or where does it come from?
6253     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6254     AC_CHECK_HEADER([valgrind/valgrind.h],
6255         [ENABLE_VALGRIND=TRUE])
6256     CPPFLAGS=$prev_cppflags
6258 AC_SUBST([ENABLE_VALGRIND])
6259 if test -z "$ENABLE_VALGRIND"; then
6260     if test "$with_valgrind" = yes; then
6261         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6262     fi
6263     VALGRIND_CFLAGS=
6265 AC_SUBST([VALGRIND_CFLAGS])
6268 dnl ===================================================================
6269 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6270 dnl ===================================================================
6272 # We need at least the sys/sdt.h include header.
6273 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6274 if test "$SDT_H_FOUND" = "TRUE"; then
6275     # Found sys/sdt.h header, now make sure the c++ compiler works.
6276     # Old g++ versions had problems with probes in constructors/destructors.
6277     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6278     AC_LANG_PUSH([C++])
6279     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6280     #include <sys/sdt.h>
6281     class ProbeClass
6282     {
6283     private:
6284       int& ref;
6285       const char *name;
6287     public:
6288       ProbeClass(int& v, const char *n) : ref(v), name(n)
6289       {
6290         DTRACE_PROBE2(_test_, cons, name, ref);
6291       }
6293       void method(int min)
6294       {
6295         DTRACE_PROBE3(_test_, meth, name, ref, min);
6296         ref -= min;
6297       }
6299       ~ProbeClass()
6300       {
6301         DTRACE_PROBE2(_test_, dest, name, ref);
6302       }
6303     };
6304     ]],[[
6305     int i = 64;
6306     DTRACE_PROBE1(_test_, call, i);
6307     ProbeClass inst = ProbeClass(i, "call");
6308     inst.method(24);
6309     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6310           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6311     AC_LANG_POP([C++])
6313 AC_CONFIG_HEADERS([config_host/config_probes.h])
6315 dnl ===================================================================
6316 dnl GCC features
6317 dnl ===================================================================
6318 HAVE_GCC_STACK_CLASH_PROTECTION=
6319 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6320     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6321     save_CFLAGS=$CFLAGS
6322     CFLAGS="$CFLAGS -fstack-clash-protection"
6323     AC_LINK_IFELSE(
6324         [AC_LANG_PROGRAM(, [[return 0;]])],
6325         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6326         [AC_MSG_RESULT([no])])
6327     CFLAGS=$save_CFLAGS
6329     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6330     save_CFLAGS=$CFLAGS
6331     CFLAGS="$CFLAGS -Werror -mno-avx"
6332     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6333     CFLAGS=$save_CFLAGS
6334     if test "$HAVE_GCC_AVX" = "TRUE"; then
6335         AC_MSG_RESULT([yes])
6336     else
6337         AC_MSG_RESULT([no])
6338     fi
6340     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6341     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6342     int v = 0;
6343     if (__sync_add_and_fetch(&v, 1) != 1 ||
6344         __sync_sub_and_fetch(&v, 1) != 0)
6345         return 1;
6346     __sync_synchronize();
6347     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6348         v != 1)
6349         return 1;
6350     return 0;
6351 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6352     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6353         AC_MSG_RESULT([yes])
6354         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6355     else
6356         AC_MSG_RESULT([no])
6357     fi
6359     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6360     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6361     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6362         AC_MSG_RESULT([yes])
6363         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6364     else
6365         AC_MSG_RESULT([no])
6366     fi
6368     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6369     save_CFLAGS=$CFLAGS
6370     CFLAGS="$CFLAGS -Werror"
6371     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6372             __attribute__((deprecated("test"))) void f();
6373         ])], [
6374             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6375             AC_MSG_RESULT([yes])
6376         ], [AC_MSG_RESULT([no])])
6377     CFLAGS=$save_CFLAGS
6379     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6380     AC_LANG_PUSH([C++])
6381     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6382             #include <cstddef>
6383             #include <cxxabi.h>
6384             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6385         ])], [
6386             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6387             AC_MSG_RESULT([yes])
6388         ], [AC_MSG_RESULT([no])])
6389     AC_LANG_POP([C++])
6391     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6392     AC_LANG_PUSH([C++])
6393     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6394             #include <cstddef>
6395             #include <cxxabi.h>
6396             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6397         ])], [
6398             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6399             AC_MSG_RESULT([yes])
6400         ], [AC_MSG_RESULT([no])])
6401     AC_LANG_POP([C++])
6403     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6404     AC_LANG_PUSH([C++])
6405     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6406             #include <cxxabi.h>
6407             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6408         ])], [
6409             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6410             AC_MSG_RESULT([yes])
6411         ], [AC_MSG_RESULT([no])])
6412     AC_LANG_POP([C++])
6414     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals 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::__cxa_eh_globals); }
6420         ])], [
6421             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6422             AC_MSG_RESULT([yes])
6423         ], [AC_MSG_RESULT([no])])
6424     AC_LANG_POP([C++])
6426     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6427     AC_LANG_PUSH([C++])
6428     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6429             #include <cstddef>
6430             #include <cxxabi.h>
6431             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6432         ])], [
6433             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6434             AC_MSG_RESULT([yes])
6435         ], [AC_MSG_RESULT([no])])
6436     AC_LANG_POP([C++])
6438     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6439     AC_LANG_PUSH([C++])
6440     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6441             #include <cxxabi.h>
6442             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6443         ])], [
6444             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6445             AC_MSG_RESULT([yes])
6446         ], [AC_MSG_RESULT([no])])
6447     AC_LANG_POP([C++])
6449     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6450     AC_LANG_PUSH([C++])
6451     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6452             #include <cxxabi.h>
6453             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6454         ])], [
6455             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6456             AC_MSG_RESULT([yes])
6457         ], [AC_MSG_RESULT([no])])
6458     AC_LANG_POP([C++])
6460     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6461     AC_LANG_PUSH([C++])
6462     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6463             #include <cxxabi.h>
6464             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6465         ])], [
6466             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6467             AC_MSG_RESULT([yes])
6468         ], [AC_MSG_RESULT([no])])
6469     AC_LANG_POP([C++])
6471     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6472     AC_LANG_PUSH([C++])
6473     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6474             #include <cstddef>
6475             #include <cxxabi.h>
6476             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6477         ])], [
6478             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6479             AC_MSG_RESULT([yes])
6480         ], [AC_MSG_RESULT([no])])
6481     AC_LANG_POP([C++])
6483     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6484     AC_LANG_PUSH([C++])
6485     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6486             #include <cstddef>
6487             #include <cxxabi.h>
6488             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6489         ])], [
6490             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6491             AC_MSG_RESULT([yes])
6492         ], [AC_MSG_RESULT([no])])
6493     AC_LANG_POP([C++])
6495     dnl Available in GCC 4.9 and at least since Clang 3.4:
6496     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6497     AC_LANG_PUSH([C++])
6498     save_CXXFLAGS=$CXXFLAGS
6499     CXXFLAGS="$CXXFLAGS -Werror"
6500     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6501             struct __attribute__((warn_unused)) dummy {};
6502         ])], [
6503             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6504             AC_MSG_RESULT([yes])
6505         ], [AC_MSG_RESULT([no])])
6506     CXXFLAGS=$save_CXXFLAGS
6507 AC_LANG_POP([C++])
6510 AC_SUBST(HAVE_GCC_AVX)
6511 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6512 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6513 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6515 dnl ===================================================================
6516 dnl Identify the C++ library
6517 dnl ===================================================================
6519 AC_MSG_CHECKING([what the C++ library is])
6520 AC_LANG_PUSH([C++])
6521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6522 #include <utility>
6523 #ifndef __GLIBCXX__
6524 foo bar
6525 #endif
6526 ]])],
6527     [CPP_LIBRARY=GLIBCXX
6528      cpp_library_name="GNU libstdc++"
6529     ],
6530     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6531 #include <utility>
6532 #ifndef _LIBCPP_VERSION
6533 foo bar
6534 #endif
6535 ]])],
6536     [CPP_LIBRARY=LIBCPP
6537      cpp_library_name="LLVM libc++"
6538      AC_DEFINE([HAVE_LIBCXX])
6539     ],
6540     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6541 #include <utility>
6542 #ifndef _MSC_VER
6543 foo bar
6544 #endif
6545 ]])],
6546     [CPP_LIBRARY=MSVCRT
6547      cpp_library_name="Microsoft"
6548     ],
6549     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6550 AC_MSG_RESULT([$cpp_library_name])
6551 AC_LANG_POP([C++])
6553 dnl ===================================================================
6554 dnl Check for gperf
6555 dnl ===================================================================
6556 AC_PATH_PROG(GPERF, gperf)
6557 if test -z "$GPERF"; then
6558     AC_MSG_ERROR([gperf not found but needed. Install it.])
6560 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6561     GPERF=`cygpath -m $GPERF`
6563 AC_MSG_CHECKING([whether gperf is new enough])
6564 my_gperf_ver1=$($GPERF --version | head -n 1)
6565 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6566 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6567 if test "$my_gperf_ver3" -ge 301; then
6568     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6569 else
6570     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6572 AC_SUBST(GPERF)
6574 dnl ===================================================================
6575 dnl Check for system libcmis
6576 dnl ===================================================================
6577 # libcmis requires curl and we can't build curl for iOS
6578 if test $_os != iOS; then
6579     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6580     ENABLE_LIBCMIS=TRUE
6581 else
6582     ENABLE_LIBCMIS=
6584 AC_SUBST(ENABLE_LIBCMIS)
6586 dnl ===================================================================
6587 dnl C++11
6588 dnl ===================================================================
6590 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6591 CXXFLAGS_CXX11=
6592 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6593     if test "$with_latest_c__" = yes; then
6594         CXXFLAGS_CXX11=-std:c++latest
6595     else
6596         CXXFLAGS_CXX11=-std:c++17
6597     fi
6598     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6599 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6600     my_flags='-std=c++17 -std=c++1z'
6601     if test "$with_latest_c__" = yes; then
6602         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6603     fi
6604     for flag in $my_flags; do
6605         if test "$COM" = MSC; then
6606             flag="-Xclang $flag"
6607         fi
6608         save_CXXFLAGS=$CXXFLAGS
6609         CXXFLAGS="$CXXFLAGS $flag -Werror"
6610         if test "$SYSTEM_LIBCMIS" = TRUE; then
6611             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6612         fi
6613         AC_LANG_PUSH([C++])
6614         dnl Clang 3.9 supports __float128 since
6615         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6616         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6617         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6618         dnl $flag is supported below, so check this first):
6619         my_float128hack=
6620         my_float128hack_impl=-D__float128=void
6621         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6622             #include <vector>
6623             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6624             // (__float128)
6625             ]])
6626         ],,[
6627             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6628             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6629             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6630             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6631             dnl place where __float128 is used is in a template specialization, -D__float128=void
6632             dnl will avoid the problem there while still causing a problem if somebody actually uses
6633             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6634             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6635             dnl "fixed" with this hack):
6636             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6637             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6638                 #include <vector>
6639                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6640                 // (__float128)
6641                 ]])
6642             ],[my_float128hack=$my_float128hack_impl])
6643         ])
6644         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6645             #include <algorithm>
6646             #include <functional>
6647             #include <vector>
6649             #if defined SYSTEM_LIBCMIS
6650             // See ucb/source/ucp/cmis/auth_provider.hxx:
6651             #if !defined __clang__
6652             #pragma GCC diagnostic push
6653             #pragma GCC diagnostic ignored "-Wdeprecated"
6654             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6655             #endif
6656             #include <libcmis/libcmis.hxx>
6657             #if !defined __clang__
6658             #pragma GCC diagnostic pop
6659             #endif
6660             #endif
6662             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6663                 std::sort(v.begin(), v.end(), fn);
6664             }
6665             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6666         AC_LANG_POP([C++])
6667         CXXFLAGS=$save_CXXFLAGS
6668         if test -n "$CXXFLAGS_CXX11"; then
6669             break
6670         fi
6671     done
6673 if test -n "$CXXFLAGS_CXX11"; then
6674     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6675 else
6676     AC_MSG_ERROR(no)
6678 AC_SUBST(CXXFLAGS_CXX11)
6680 if test "$GCC" = "yes"; then
6681     save_CXXFLAGS=$CXXFLAGS
6682     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6683     CHECK_L_ATOMIC
6684     CXXFLAGS=$save_CXXFLAGS
6685     AC_SUBST(ATOMIC_LIB)
6688 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6689 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6690 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6691 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6692 dnl again towards 4.7.2:
6693 if test $CPP_LIBRARY = GLIBCXX; then
6694     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6695     AC_LANG_PUSH([C++])
6696     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6697 #include <list>
6698 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6699     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6700     //   GCC 4.7.0: 20120322
6701     //   GCC 4.7.1: 20120614
6702     // and using a range check is not possible as the mapping between
6703     // __GLIBCXX__ values and GCC versions is not monotonic
6704 /* ok */
6705 #else
6706 abi broken
6707 #endif
6708         ]])], [AC_MSG_RESULT(no, ok)],
6709         [AC_MSG_ERROR(yes)])
6710     AC_LANG_POP([C++])
6713 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6714 save_CXXFLAGS=$CXXFLAGS
6715 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6716 AC_LANG_PUSH([C++])
6718 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6719 #include <stddef.h>
6721 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6723 namespace
6725         struct b
6726         {
6727                 int i;
6728                 int j;
6729         };
6731 ]], [[
6732 struct a
6734         int i;
6735         int j;
6737 a thinga[]={{0,0}, {1,1}};
6738 b thingb[]={{0,0}, {1,1}};
6739 size_t i = sizeof(sal_n_array_size(thinga));
6740 size_t j = sizeof(sal_n_array_size(thingb));
6741 return !(i != 0 && j != 0);
6743     ], [ AC_MSG_RESULT(yes) ],
6744     [ AC_MSG_ERROR(no)])
6745 AC_LANG_POP([C++])
6746 CXXFLAGS=$save_CXXFLAGS
6748 dnl _Pragma support (may require C++11)
6749 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6750     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6751     AC_LANG_PUSH([C++])
6752     save_CXXFLAGS=$CXXFLAGS
6753     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6754     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6755             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6756         ])], [
6757             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6758             AC_MSG_RESULT([yes])
6759         ], [AC_MSG_RESULT([no])])
6760     AC_LANG_POP([C++])
6761     CXXFLAGS=$save_CXXFLAGS
6764 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6765 if test "$GCC" = yes; then
6766     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6767     AC_LANG_PUSH([C++])
6768     save_CXXFLAGS=$CXXFLAGS
6769     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6770     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6771     CXXFLAGS=$save_CXXFLAGS
6772     AC_LANG_POP([C++])
6773     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6774         AC_MSG_RESULT([yes])
6775     else
6776         AC_MSG_RESULT([no])
6777     fi
6779 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6781 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6782 AC_LANG_PUSH([C++])
6783 save_CXXFLAGS=$CXXFLAGS
6784 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6785 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6786         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6787         // supporting it:
6788         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6789         struct S {
6790         private:
6791             S(S const &);
6792         public:
6793             S();
6794             ~S();
6795         };
6796         S copy();
6797         void f() { S c(copy()); }
6798         #endif
6799     ])], [
6800         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6801         AC_MSG_RESULT([yes])
6802     ], [AC_MSG_RESULT([no])])
6803 CXXFLAGS=$save_CXXFLAGS
6804 AC_LANG_POP([C++])
6806 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6807 AC_LANG_PUSH([C++])
6808 save_CXXFLAGS=$CXXFLAGS
6809 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6810 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6811         #include <algorithm>
6812         #include <initializer_list>
6813         #include <vector>
6814         template<typename T> class S {
6815         private:
6816             std::vector<T> v_;
6817         public:
6818             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6819         };
6820         constinit S<int> s{3, 2, 1};
6821     ])], [
6822         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6823         AC_MSG_RESULT([yes])
6824     ], [AC_MSG_RESULT([no])])
6825 CXXFLAGS=$save_CXXFLAGS
6826 AC_LANG_POP([C++])
6828 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6829 AC_LANG_PUSH([C++])
6830 save_CXXFLAGS=$CXXFLAGS
6831 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6832 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6833         #include <span>
6834         #include <type_traits>
6835         // Don't check size_type directly, as it was called index_type before P1872R0:
6836         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6837     ])], [
6838         AC_DEFINE([HAVE_CPP_SPAN],[1])
6839         AC_MSG_RESULT([yes])
6840     ], [AC_MSG_RESULT([no])])
6841 CXXFLAGS=$save_CXXFLAGS
6842 AC_LANG_POP([C++])
6844 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6845 AC_LANG_PUSH([C++])
6846 save_CXXFLAGS=$CXXFLAGS
6847 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6848 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6849         struct S1 { S1(S1 &&); };
6850         struct S2: S1 {};
6851         S1 f(S2 s) { return s; }
6852     ])], [
6853         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6854         AC_MSG_RESULT([yes])
6855     ], [AC_MSG_RESULT([no])])
6856 CXXFLAGS=$save_CXXFLAGS
6857 AC_LANG_POP([C++])
6859 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6860 dnl uninitialized warning for code like
6862 dnl   OString f();
6863 dnl   boost::optional<OString> * g(bool b) {
6864 dnl       boost::optional<OString> o;
6865 dnl       if (b) o = f();
6866 dnl       return new boost::optional<OString>(o);
6867 dnl   }
6869 dnl (as is e.g. present, in a slightly more elaborate form, in
6870 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6871 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6872 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6873 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6874     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6875     AC_LANG_PUSH([C++])
6876     save_CXXFLAGS=$CXXFLAGS
6877     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6878     if test "$ENABLE_OPTIMIZED" = TRUE; then
6879         CXXFLAGS="$CXXFLAGS -O2"
6880     else
6881         CXXFLAGS="$CXXFLAGS -O0"
6882     fi
6883     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6884             #include <new>
6885             void f1(int);
6886             struct S1 {
6887                 ~S1() { f1(n); }
6888                 int n = 0;
6889             };
6890             struct S2 {
6891                 S2() {}
6892                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6893                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6894                 void set(S1 s) {
6895                     new (stg) S1(s);
6896                     init = true;
6897                 }
6898                 bool init = false;
6899                 char stg[sizeof (S1)];
6900             } ;
6901             S1 f2();
6902             S2 * f3(bool b) {
6903                 S2 o;
6904                 if (b) o.set(f2());
6905                 return new S2(o);
6906             }
6907         ]])], [AC_MSG_RESULT([no])], [
6908             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6909             AC_MSG_RESULT([yes])
6910         ])
6911     CXXFLAGS=$save_CXXFLAGS
6912     AC_LANG_POP([C++])
6914 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6916 dnl ===================================================================
6917 dnl CPU Intrinsics support - SSE, AVX
6918 dnl ===================================================================
6920 INTRINSICS_CXXFLAGS=""
6922 if test "$GCC" = "yes"; then
6923     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6924     AC_LANG_PUSH([C++])
6925     save_CXXFLAGS=$CXXFLAGS
6926     CXXFLAGS="$CXXFLAGS -msse2"
6927     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6928         #include <emmintrin.h>
6929         int main () {
6930             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6931             c = _mm_xor_si128 (a, b);
6932             return 0;
6933         }
6934         ])],
6935         [can_compile_sse2=yes],
6936         [can_compile_sse2=no])
6937     AC_LANG_POP([C++])
6938     CXXFLAGS=$save_CXXFLAGS
6939     AC_MSG_RESULT([${can_compile_sse2}])
6940     if test "${can_compile_sse2}" = "yes" ; then
6941         INTRINSICS_CXXFLAGS="-msse2"
6942     else
6943         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6944     fi
6946     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6947     AC_LANG_PUSH([C++])
6948     save_CXXFLAGS=$CXXFLAGS
6949     CXXFLAGS="$CXXFLAGS -mssse3"
6950     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6951         #include <tmmintrin.h>
6952         int main () {
6953             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6954             c = _mm_maddubs_epi16 (a, b);
6955             return 0;
6956         }
6957         ])],
6958         [can_compile_ssse3=yes],
6959         [can_compile_ssse3=no])
6960     AC_LANG_POP([C++])
6961     CXXFLAGS=$save_CXXFLAGS
6962     AC_MSG_RESULT([${can_compile_ssse3}])
6963     if test "${can_compile_ssse3}" = "yes" ; then
6964         INTRINSICS_CXXFLAGS="-mssse3"
6965     else
6966         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6967     fi
6969     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6970     AC_LANG_PUSH([C++])
6971     save_CXXFLAGS=$CXXFLAGS
6972     CXXFLAGS="$CXXFLAGS -mavx"
6973     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6974         #include <immintrin.h>
6975         int main () {
6976             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6977             c = _mm256_xor_ps(a, b);
6978             return 0;
6979         }
6980         ])],
6981         [can_compile_avx=yes],
6982         [can_compile_avx=no])
6983     AC_LANG_POP([C++])
6984     CXXFLAGS=$save_CXXFLAGS
6985     AC_MSG_RESULT([${can_compile_avx}])
6986     if test "${can_compile_avx}" = "yes" ; then
6987         INTRINSICS_CXXFLAGS="-mavx"
6988     else
6989         AC_MSG_WARN([cannot compile AVX intrinsics])
6990     fi
6992     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6993     AC_LANG_PUSH([C++])
6994     save_CXXFLAGS=$CXXFLAGS
6995     CXXFLAGS="$CXXFLAGS -mavx2"
6996     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6997         #include <immintrin.h>
6998         int main () {
6999             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7000             c = _mm256_maddubs_epi16(a, b);
7001             return 0;
7002         }
7003         ])],
7004         [can_compile_avx2=yes],
7005         [can_compile_avx2=no])
7006     AC_LANG_POP([C++])
7007     CXXFLAGS=$save_CXXFLAGS
7008     AC_MSG_RESULT([${can_compile_avx2}])
7009     if test "${can_compile_avx2}" = "yes" ; then
7010         INTRINSICS_CXXFLAGS="-mavx2"
7011     else
7012         AC_MSG_WARN([cannot compile AVX2 intrinsics])
7013     fi
7016 AC_SUBST([INTRINSICS_CXXFLAGS])
7018 dnl ===================================================================
7019 dnl system stl sanity tests
7020 dnl ===================================================================
7021 if test "$_os" != "WINNT"; then
7023     AC_LANG_PUSH([C++])
7025     save_CPPFLAGS="$CPPFLAGS"
7026     if test -n "$MACOSX_SDK_PATH"; then
7027         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7028     fi
7030     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7031     # only.
7032     if test "$CPP_LIBRARY" = GLIBCXX; then
7033         dnl gcc#19664, gcc#22482, rhbz#162935
7034         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7035         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7036         AC_MSG_RESULT([$stlvisok])
7037         if test "$stlvisok" = "no"; then
7038             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7039         fi
7040     fi
7042     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7043     # when we don't make any dynamic libraries?
7044     if test "$DISABLE_DYNLOADING" = ""; then
7045         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7046         cat > conftestlib1.cc <<_ACEOF
7047 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7048 struct S2: S1<int> { virtual ~S2(); };
7049 S2::~S2() {}
7050 _ACEOF
7051         cat > conftestlib2.cc <<_ACEOF
7052 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7053 struct S2: S1<int> { virtual ~S2(); };
7054 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7055 _ACEOF
7056         gccvisinlineshiddenok=yes
7057         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7058             gccvisinlineshiddenok=no
7059         else
7060             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7061             dnl known to not work with -z defs (unsetting which makes the test
7062             dnl moot, though):
7063             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7064             if test "$COM_IS_CLANG" = TRUE; then
7065                 for i in $CXX $CXXFLAGS; do
7066                     case $i in
7067                     -fsanitize=*)
7068                         my_linkflagsnoundefs=
7069                         break
7070                         ;;
7071                     esac
7072                 done
7073             fi
7074             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7075                 gccvisinlineshiddenok=no
7076             fi
7077         fi
7079         rm -fr libconftest*
7080         AC_MSG_RESULT([$gccvisinlineshiddenok])
7081         if test "$gccvisinlineshiddenok" = "no"; then
7082             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7083         fi
7084     fi
7086    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7087     cat >visibility.cxx <<_ACEOF
7088 #pragma GCC visibility push(hidden)
7089 struct __attribute__ ((visibility ("default"))) TestStruct {
7090   static void Init();
7092 __attribute__ ((visibility ("default"))) void TestFunc() {
7093   TestStruct::Init();
7095 _ACEOF
7096     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7097         gccvisbroken=yes
7098     else
7099         case "$host_cpu" in
7100         i?86|x86_64)
7101             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7102                 gccvisbroken=no
7103             else
7104                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7105                     gccvisbroken=no
7106                 else
7107                     gccvisbroken=yes
7108                 fi
7109             fi
7110             ;;
7111         *)
7112             gccvisbroken=no
7113             ;;
7114         esac
7115     fi
7116     rm -f visibility.s visibility.cxx
7118     AC_MSG_RESULT([$gccvisbroken])
7119     if test "$gccvisbroken" = "yes"; then
7120         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7121     fi
7123     CPPFLAGS="$save_CPPFLAGS"
7125     AC_LANG_POP([C++])
7128 dnl ===================================================================
7129 dnl  Clang++ tests
7130 dnl ===================================================================
7132 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7133 if test "$GCC" = "yes"; then
7134     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7135     AC_LANG_PUSH([C++])
7136     save_CXXFLAGS=$CXXFLAGS
7137     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7138     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7139     CXXFLAGS=$save_CXXFLAGS
7140     AC_LANG_POP([C++])
7141     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7142         AC_MSG_RESULT([yes])
7143     else
7144         AC_MSG_RESULT([no])
7145     fi
7147 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7149 dnl ===================================================================
7150 dnl Compiler plugins
7151 dnl ===================================================================
7153 COMPILER_PLUGINS=
7154 # currently only Clang
7156 if test "$COM_IS_CLANG" != "TRUE"; then
7157     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7158         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7159         enable_compiler_plugins=no
7160     fi
7163 if test "$COM_IS_CLANG" = "TRUE"; then
7164     if test -n "$enable_compiler_plugins"; then
7165         compiler_plugins="$enable_compiler_plugins"
7166     elif test -n "$ENABLE_DBGUTIL"; then
7167         compiler_plugins=test
7168     else
7169         compiler_plugins=no
7170     fi
7171     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7172         if test "$CLANGVER" -lt 50002; then
7173             if test "$compiler_plugins" = yes; then
7174                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7175             else
7176                 compiler_plugins=no
7177             fi
7178         fi
7179     fi
7180     if test "$compiler_plugins" != "no"; then
7181         dnl The prefix where Clang resides, override to where Clang resides if
7182         dnl using a source build:
7183         if test -z "$CLANGDIR"; then
7184             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7185         fi
7186         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7187         if test -z "$COMPILER_PLUGINS_CXX"; then
7188             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7189         fi
7190         clangbindir=$CLANGDIR/bin
7191         if test "$build_os" = "cygwin"; then
7192             clangbindir=$(cygpath -u "$clangbindir")
7193         fi
7194         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7195         if test -n "$LLVM_CONFIG"; then
7196             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7197             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7198             if test -z "$CLANGLIBDIR"; then
7199                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7200             fi
7201             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7202             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7203             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7204             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7205                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7206             fi
7207             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7208             clangobjdir=$($LLVM_CONFIG --obj-root)
7209             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7210                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7211             fi
7212         fi
7213         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7214         AC_LANG_PUSH([C++])
7215         save_CXX=$CXX
7216         save_CXXCPP=$CXXCPP
7217         save_CPPFLAGS=$CPPFLAGS
7218         save_CXXFLAGS=$CXXFLAGS
7219         save_LDFLAGS=$LDFLAGS
7220         save_LIBS=$LIBS
7221         CXX=$COMPILER_PLUGINS_CXX
7222         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7223         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7224         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7225         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7226             [COMPILER_PLUGINS=TRUE],
7227             [
7228             if test "$compiler_plugins" = "yes"; then
7229                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7230             else
7231                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7232                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7233             fi
7234             ])
7235         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7236         dnl comment in compilerplugins/Makefile-clang.mk:
7237         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7238             LDFLAGS=""
7239             AC_MSG_CHECKING([for clang libraries to use])
7240             if test -z "$CLANGTOOLLIBS"; then
7241                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7242  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7243                 AC_LINK_IFELSE([
7244                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7245                         [[ clang::FullSourceLoc().dump(); ]])
7246                 ],[CLANGTOOLLIBS="$LIBS"],[])
7247             fi
7248             if test -z "$CLANGTOOLLIBS"; then
7249                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7250                 AC_LINK_IFELSE([
7251                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7252                         [[ clang::FullSourceLoc().dump(); ]])
7253                 ],[CLANGTOOLLIBS="$LIBS"],[])
7254             fi
7255             AC_MSG_RESULT([$CLANGTOOLLIBS])
7256             if test -z "$CLANGTOOLLIBS"; then
7257                 if test "$compiler_plugins" = "yes"; then
7258                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7259                 else
7260                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7261                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7262                 fi
7263                 COMPILER_PLUGINS=
7264             fi
7265             if test -n "$COMPILER_PLUGINS"; then
7266                 if test -z "$CLANGSYSINCLUDE"; then
7267                     if test -n "$LLVM_CONFIG"; then
7268                         # Path to the clang system headers (no idea if there's a better way to get it).
7269                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7270                     fi
7271                 fi
7272             fi
7273         fi
7274         CXX=$save_CXX
7275         CXXCPP=$save_CXXCPP
7276         CPPFLAGS=$save_CPPFLAGS
7277         CXXFLAGS=$save_CXXFLAGS
7278         LDFLAGS=$save_LDFLAGS
7279         LIBS="$save_LIBS"
7280         AC_LANG_POP([C++])
7281     fi
7282 else
7283     if test "$enable_compiler_plugins" = "yes"; then
7284         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7285     fi
7287 AC_SUBST(COMPILER_PLUGINS)
7288 AC_SUBST(COMPILER_PLUGINS_CXX)
7289 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7290 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7291 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7292 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7293 AC_SUBST(CLANGDIR)
7294 AC_SUBST(CLANGLIBDIR)
7295 AC_SUBST(CLANGTOOLLIBS)
7296 AC_SUBST(CLANGSYSINCLUDE)
7298 # Plugin to help linker.
7299 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7300 # This makes --enable-lto build with clang work.
7301 AC_SUBST(LD_PLUGIN)
7303 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7304 AC_SUBST(HAVE_POSIX_FALLOCATE)
7306 dnl ===================================================================
7307 dnl Custom build version
7308 dnl ===================================================================
7310 AC_MSG_CHECKING([whether to add custom build version])
7311 if test "$with_build_version" != ""; then
7312     BUILD_VER_STRING=$with_build_version
7313     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7314 else
7315     BUILD_VER_STRING=
7316     AC_MSG_RESULT([no])
7318 AC_SUBST(BUILD_VER_STRING)
7320 JITC_PROCESSOR_TYPE=""
7321 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7322     # IBMs JDK needs this...
7323     JITC_PROCESSOR_TYPE=6
7324     export JITC_PROCESSOR_TYPE
7326 AC_SUBST([JITC_PROCESSOR_TYPE])
7328 # Misc Windows Stuff
7329 AC_ARG_WITH(ucrt-dir,
7330     AS_HELP_STRING([--with-ucrt-dir],
7331         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7332         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7333         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7334             Windows6.1-KB2999226-x64.msu
7335             Windows6.1-KB2999226-x86.msu
7336             Windows8.1-KB2999226-x64.msu
7337             Windows8.1-KB2999226-x86.msu
7338             Windows8-RT-KB2999226-x64.msu
7339             Windows8-RT-KB2999226-x86.msu
7340         A zip archive including those files is available from Microsoft site:
7341         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7343 UCRT_REDISTDIR="$with_ucrt_dir"
7344 if test $_os = "WINNT"; then
7345     find_msvc_x64_dlls
7346     find_msms
7347     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7348     MSVC_DLLS="$msvcdlls"
7349     MSM_PATH=`win_short_path_for_make "$msmdir"`
7350     # MSVC 15.3 changed it to VC141
7351     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7352         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7353     else
7354         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7355     fi
7357     if test "$UCRT_REDISTDIR" = "no"; then
7358         dnl explicitly disabled
7359         UCRT_REDISTDIR=""
7360     else
7361         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7362                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7363                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7364                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7365                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7366                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7367             UCRT_REDISTDIR=""
7368             if test -n "$PKGFORMAT"; then
7369                for i in $PKGFORMAT; do
7370                    case "$i" in
7371                    msi)
7372                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7373                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7374                        ;;
7375                    esac
7376                done
7377             fi
7378         fi
7379     fi
7382 AC_SUBST(UCRT_REDISTDIR)
7383 AC_SUBST(MSVC_DLL_PATH)
7384 AC_SUBST(MSVC_DLLS)
7385 AC_SUBST(MSM_PATH)
7387 dnl ===================================================================
7388 dnl Checks for Java
7389 dnl ===================================================================
7390 if test "$ENABLE_JAVA" != ""; then
7392     # Windows-specific tests
7393     if test "$build_os" = "cygwin"; then
7394         if test "$BITNESS_OVERRIDE" = 64; then
7395             bitness=64
7396         else
7397             bitness=32
7398         fi
7400         if test -z "$with_jdk_home"; then
7401             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7402             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7403             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7404             if test -n "$regvalue"; then
7405                 ver=$regvalue
7406                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7407                 _jdk_home=$regvalue
7408             fi
7409             if test -z "$with_jdk_home"; then
7410                 for ver in 1.8; do
7411                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7412                     if test -n "$regvalue"; then
7413                         _jdk_home=$regvalue
7414                         break
7415                     fi
7416                 done
7417             fi
7418             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7419                 with_jdk_home="$_jdk_home"
7420                 howfound="found automatically"
7421             else
7422                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7423             fi
7424         else
7425             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7426             howfound="you passed"
7427         fi
7428     fi
7430     # 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.
7431     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7432     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7433         with_jdk_home=`/usr/libexec/java_home`
7434     fi
7436     JAVA_HOME=; export JAVA_HOME
7437     if test -z "$with_jdk_home"; then
7438         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7439     else
7440         _java_path="$with_jdk_home/bin/$with_java"
7441         dnl Check if there is a Java interpreter at all.
7442         if test -x "$_java_path"; then
7443             JAVAINTERPRETER=$_java_path
7444         else
7445             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7446         fi
7447     fi
7449     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7450     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7451     dnl loaded by java to run JunitTests:
7452     if test "$build_os" = "cygwin"; then
7453         shortjdkhome=`cygpath -d "$with_jdk_home"`
7454         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
7455             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7456             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7457         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
7458             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7459             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7460         fi
7462         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7463             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7464         fi
7465         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7466     elif test "$cross_compiling" != "yes"; then
7467         case $CPUNAME in
7468             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7469                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7470                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7471                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7472                 fi
7473                 ;;
7474             *) # assumption: everything else 32-bit
7475                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7476                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7477                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7478                 fi
7479                 ;;
7480         esac
7481     fi
7484 dnl ===================================================================
7485 dnl Checks for JDK.
7486 dnl ===================================================================
7488 # Note that JAVA_HOME as for now always means the *build* platform's
7489 # JAVA_HOME. Whether all the complexity here actually is needed any
7490 # more or not, no idea.
7492 if test "$ENABLE_JAVA" != ""; then
7493     _gij_longver=0
7494     AC_MSG_CHECKING([the installed JDK])
7495     if test -n "$JAVAINTERPRETER"; then
7496         dnl java -version sends output to stderr!
7497         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7498             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7499         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7500             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7501         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7502             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7503         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7504             JDK=ibm
7506             dnl IBM JDK specific tests
7507             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7508             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7510             if test "$_jdk_ver" -lt 10800; then
7511                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7512             fi
7514             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7516             if test "$with_jdk_home" = ""; then
7517                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7518 you must use the "--with-jdk-home" configure option explicitly])
7519             fi
7521             JAVA_HOME=$with_jdk_home
7522         else
7523             JDK=sun
7525             dnl Sun JDK specific tests
7526             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7527             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7529             if test "$_jdk_ver" -lt 10800; then
7530                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7531             fi
7532             if test "$_jdk_ver" -gt 10800; then
7533                 JAVA_CLASSPATH_NOT_SET=TRUE
7534             fi
7536             AC_MSG_RESULT([found (JDK $_jdk)])
7537             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7538             if test "$_os" = "WINNT"; then
7539                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7540             fi
7542             # set to limit VM usage for JunitTests
7543             JAVAIFLAGS=-Xmx64M
7544             # set to limit VM usage for javac
7545             JAVAFLAGS=-J-Xmx128M
7546         fi
7547     else
7548         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7549     fi
7550 else
7551     dnl Java disabled
7552     JAVA_HOME=
7553     export JAVA_HOME
7556 dnl ===================================================================
7557 dnl Checks for javac
7558 dnl ===================================================================
7559 if test "$ENABLE_JAVA" != ""; then
7560     javacompiler="javac"
7561     : ${JAVA_SOURCE_VER=8}
7562     : ${JAVA_TARGET_VER=8}
7563     if test -z "$with_jdk_home"; then
7564         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7565     else
7566         _javac_path="$with_jdk_home/bin/$javacompiler"
7567         dnl Check if there is a Java compiler at all.
7568         if test -x "$_javac_path"; then
7569             JAVACOMPILER=$_javac_path
7570         fi
7571     fi
7572     if test -z "$JAVACOMPILER"; then
7573         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7574     fi
7575     if test "$build_os" = "cygwin"; then
7576         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7577             JAVACOMPILER="${JAVACOMPILER}.exe"
7578         fi
7579         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7580     fi
7583 dnl ===================================================================
7584 dnl Checks for javadoc
7585 dnl ===================================================================
7586 if test "$ENABLE_JAVA" != ""; then
7587     if test -z "$with_jdk_home"; then
7588         AC_PATH_PROG(JAVADOC, javadoc)
7589     else
7590         _javadoc_path="$with_jdk_home/bin/javadoc"
7591         dnl Check if there is a javadoc at all.
7592         if test -x "$_javadoc_path"; then
7593             JAVADOC=$_javadoc_path
7594         else
7595             AC_PATH_PROG(JAVADOC, javadoc)
7596         fi
7597     fi
7598     if test -z "$JAVADOC"; then
7599         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7600     fi
7601     if test "$build_os" = "cygwin"; then
7602         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7603             JAVADOC="${JAVADOC}.exe"
7604         fi
7605         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7606     fi
7608     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7609     JAVADOCISGJDOC="yes"
7610     fi
7612 AC_SUBST(JAVADOCISGJDOC)
7614 if test "$ENABLE_JAVA" != ""; then
7615     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7616     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7617         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7618            # try to recover first by looking whether we have an alternative
7619            # system as in Debian or newer SuSEs where following /usr/bin/javac
7620            # over /etc/alternatives/javac leads to the right bindir where we
7621            # just need to strip a bit away to get a valid JAVA_HOME
7622            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7623         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7624             # maybe only one level of symlink (e.g. on Mac)
7625             JAVA_HOME=$(readlink $JAVACOMPILER)
7626             if test "$(dirname $JAVA_HOME)" = "."; then
7627                 # we've got no path to trim back
7628                 JAVA_HOME=""
7629             fi
7630         else
7631             # else warn
7632             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7633             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7634             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7635             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7636         fi
7637         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7638         if test "$JAVA_HOME" != "/usr"; then
7639             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7640                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7641                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7642                 dnl Tiger already returns a JDK path...
7643                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7644             else
7645                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7646                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7647                 dnl that checks which version to run
7648                 if test -f "$JAVA_HOME"; then
7649                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7650                 fi
7651             fi
7652         fi
7653     fi
7654     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7656     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7657     if test -z "$JAVA_HOME"; then
7658         if test "x$with_jdk_home" = "x"; then
7659             cat > findhome.java <<_ACEOF
7660 [import java.io.File;
7662 class findhome
7664     public static void main(String args[])
7665     {
7666         String jrelocation = System.getProperty("java.home");
7667         File jre = new File(jrelocation);
7668         System.out.println(jre.getParent());
7669     }
7671 _ACEOF
7672             AC_MSG_CHECKING([if javac works])
7673             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7674             AC_TRY_EVAL(javac_cmd)
7675             if test $? = 0 -a -f ./findhome.class; then
7676                 AC_MSG_RESULT([javac works])
7677             else
7678                 echo "configure: javac test failed" >&5
7679                 cat findhome.java >&5
7680                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7681             fi
7682             AC_MSG_CHECKING([if gij knows its java.home])
7683             JAVA_HOME=`$JAVAINTERPRETER findhome`
7684             if test $? = 0 -a "$JAVA_HOME" != ""; then
7685                 AC_MSG_RESULT([$JAVA_HOME])
7686             else
7687                 echo "configure: java test failed" >&5
7688                 cat findhome.java >&5
7689                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7690             fi
7691             # clean-up after ourselves
7692             rm -f ./findhome.java ./findhome.class
7693         else
7694             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7695         fi
7696     fi
7698     # now check if $JAVA_HOME is really valid
7699     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7700         case "${JAVA_HOME}" in
7701             /Library/Java/JavaVirtualMachines/*)
7702                 ;;
7703             *)
7704                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7705                 ;;
7706         esac
7707         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7708             JAVA_HOME_OK="NO"
7709         fi
7710     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7711         JAVA_HOME_OK="NO"
7712     fi
7713     if test "$JAVA_HOME_OK" = "NO"; then
7714         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7715         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7716         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7717         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7718         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7719         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7720     fi
7721     PathFormat "$JAVA_HOME"
7722     JAVA_HOME="$formatted_path"
7725 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7726     "$_os" != Darwin
7727 then
7728     AC_MSG_CHECKING([for JAWT lib])
7729     if test "$_os" = WINNT; then
7730         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7731         JAWTLIB=jawt.lib
7732     else
7733         case "$host_cpu" in
7734         arm*)
7735             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7736             JAVA_ARCH=$my_java_arch
7737             ;;
7738         i*86)
7739             my_java_arch=i386
7740             ;;
7741         m68k)
7742             my_java_arch=m68k
7743             ;;
7744         powerpc)
7745             my_java_arch=ppc
7746             ;;
7747         powerpc64)
7748             my_java_arch=ppc64
7749             ;;
7750         powerpc64le)
7751             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7752             JAVA_ARCH=$my_java_arch
7753             ;;
7754         sparc64)
7755             my_java_arch=sparcv9
7756             ;;
7757         x86_64)
7758             my_java_arch=amd64
7759             ;;
7760         *)
7761             my_java_arch=$host_cpu
7762             ;;
7763         esac
7764         # This is where JDK9 puts the library
7765         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7766             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7767         else
7768             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7769         fi
7770         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7771     fi
7772     AC_MSG_RESULT([$JAWTLIB])
7774 AC_SUBST(JAWTLIB)
7776 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7777     case "$host_os" in
7779     aix*)
7780         JAVAINC="-I$JAVA_HOME/include"
7781         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7782         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7783         ;;
7785     cygwin*)
7786         JAVAINC="-I$JAVA_HOME/include/win32"
7787         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7788         ;;
7790     darwin*)
7791         if test -d "$JAVA_HOME/include/darwin"; then
7792             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7793         else
7794             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7795         fi
7796         ;;
7798     dragonfly*)
7799         JAVAINC="-I$JAVA_HOME/include"
7800         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7801         ;;
7803     freebsd*)
7804         JAVAINC="-I$JAVA_HOME/include"
7805         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7806         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7807         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7808         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7809         ;;
7811     k*bsd*-gnu*)
7812         JAVAINC="-I$JAVA_HOME/include"
7813         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7814         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7815         ;;
7817     linux-gnu*)
7818         JAVAINC="-I$JAVA_HOME/include"
7819         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7820         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7821         ;;
7823     *netbsd*)
7824         JAVAINC="-I$JAVA_HOME/include"
7825         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7826         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7827        ;;
7829     openbsd*)
7830         JAVAINC="-I$JAVA_HOME/include"
7831         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7832         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7833         ;;
7835     solaris*)
7836         JAVAINC="-I$JAVA_HOME/include"
7837         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7838         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7839         ;;
7840     esac
7842 SOLARINC="$SOLARINC $JAVAINC"
7844 AC_SUBST(JAVACOMPILER)
7845 AC_SUBST(JAVADOC)
7846 AC_SUBST(JAVAINTERPRETER)
7847 AC_SUBST(JAVAIFLAGS)
7848 AC_SUBST(JAVAFLAGS)
7849 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7850 AC_SUBST(JAVA_HOME)
7851 AC_SUBST(JAVA_SOURCE_VER)
7852 AC_SUBST(JAVA_TARGET_VER)
7853 AC_SUBST(JDK)
7856 dnl ===================================================================
7857 dnl Export file validation
7858 dnl ===================================================================
7859 AC_MSG_CHECKING([whether to enable export file validation])
7860 if test "$with_export_validation" != "no"; then
7861     if test -z "$ENABLE_JAVA"; then
7862         if test "$with_export_validation" = "yes"; then
7863             AC_MSG_ERROR([requested, but Java is disabled])
7864         else
7865             AC_MSG_RESULT([no, as Java is disabled])
7866         fi
7867     elif ! test -d "${SRC_ROOT}/schema"; then
7868         if test "$with_export_validation" = "yes"; then
7869             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7870         else
7871             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7872         fi
7873     else
7874         AC_MSG_RESULT([yes])
7875         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7877         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7878         if test -z "$ODFVALIDATOR"; then
7879             # remember to download the ODF toolkit with validator later
7880             AC_MSG_NOTICE([no odfvalidator found, will download it])
7881             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7882             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7884             # and fetch name of odfvalidator jar name from download.lst
7885             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7886             AC_SUBST(ODFVALIDATOR_JAR)
7888             if test -z "$ODFVALIDATOR_JAR"; then
7889                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7890             fi
7891         fi
7892         if test "$build_os" = "cygwin"; then
7893             # In case of Cygwin it will be executed from Windows,
7894             # so we need to run bash and absolute path to validator
7895             # so instead of "odfvalidator" it will be
7896             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7897             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7898         else
7899             ODFVALIDATOR="sh $ODFVALIDATOR"
7900         fi
7901         AC_SUBST(ODFVALIDATOR)
7904         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7905         if test -z "$OFFICEOTRON"; then
7906             # remember to download the officeotron with validator later
7907             AC_MSG_NOTICE([no officeotron found, will download it])
7908             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7909             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7911             # and fetch name of officeotron jar name from download.lst
7912             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7913             AC_SUBST(OFFICEOTRON_JAR)
7915             if test -z "$OFFICEOTRON_JAR"; then
7916                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7917             fi
7918         else
7919             # check version of existing officeotron
7920             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7921             if test 0"$OFFICEOTRON_VER" -lt 704; then
7922                 AC_MSG_ERROR([officeotron too old])
7923             fi
7924         fi
7925         if test "$build_os" = "cygwin"; then
7926             # In case of Cygwin it will be executed from Windows,
7927             # so we need to run bash and absolute path to validator
7928             # so instead of "odfvalidator" it will be
7929             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7930             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7931         else
7932             OFFICEOTRON="sh $OFFICEOTRON"
7933         fi
7934     fi
7935     AC_SUBST(OFFICEOTRON)
7936 else
7937     AC_MSG_RESULT([no])
7940 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7941 if test "$with_bffvalidator" != "no"; then
7942     AC_DEFINE(HAVE_BFFVALIDATOR)
7944     if test "$with_export_validation" = "no"; then
7945         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7946     fi
7948     if test "$with_bffvalidator" = "yes"; then
7949         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7950     else
7951         BFFVALIDATOR="$with_bffvalidator"
7952     fi
7954     if test "$build_os" = "cygwin"; then
7955         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7956             AC_MSG_RESULT($BFFVALIDATOR)
7957         else
7958             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7959         fi
7960     elif test -n "$BFFVALIDATOR"; then
7961         # We are not in Cygwin but need to run Windows binary with wine
7962         AC_PATH_PROGS(WINE, wine)
7964         # so swap in a shell wrapper that converts paths transparently
7965         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7966         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7967         AC_SUBST(BFFVALIDATOR_EXE)
7968         AC_MSG_RESULT($BFFVALIDATOR)
7969     else
7970         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7971     fi
7972     AC_SUBST(BFFVALIDATOR)
7973 else
7974     AC_MSG_RESULT([no])
7977 dnl ===================================================================
7978 dnl Check for C preprocessor to use
7979 dnl ===================================================================
7980 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7981 if test -n "$with_idlc_cpp"; then
7982     AC_MSG_RESULT([$with_idlc_cpp])
7983     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7984 else
7985     AC_MSG_RESULT([ucpp])
7986     AC_MSG_CHECKING([which ucpp tp use])
7987     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7988         AC_MSG_RESULT([external])
7989         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7990     else
7991         AC_MSG_RESULT([internal])
7992         BUILD_TYPE="$BUILD_TYPE UCPP"
7993     fi
7995 AC_SUBST(SYSTEM_UCPP)
7997 dnl ===================================================================
7998 dnl Check for epm (not needed for Windows)
7999 dnl ===================================================================
8000 AC_MSG_CHECKING([whether to enable EPM for packing])
8001 if test "$enable_epm" = "yes"; then
8002     AC_MSG_RESULT([yes])
8003     if test "$_os" != "WINNT"; then
8004         if test $_os = Darwin; then
8005             EPM=internal
8006         elif test -n "$with_epm"; then
8007             EPM=$with_epm
8008         else
8009             AC_PATH_PROG(EPM, epm, no)
8010         fi
8011         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8012             AC_MSG_NOTICE([EPM will be built.])
8013             BUILD_TYPE="$BUILD_TYPE EPM"
8014             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8015         else
8016             # Gentoo has some epm which is something different...
8017             AC_MSG_CHECKING([whether the found epm is the right epm])
8018             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8019                 AC_MSG_RESULT([yes])
8020             else
8021                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8022             fi
8023             AC_MSG_CHECKING([epm version])
8024             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8025             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8026                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8027                 AC_MSG_RESULT([OK, >= 3.7])
8028             else
8029                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8030                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8031             fi
8032         fi
8033     fi
8035     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8036         AC_MSG_CHECKING([for rpm])
8037         for a in "$RPM" rpmbuild rpm; do
8038             $a --usage >/dev/null 2> /dev/null
8039             if test $? -eq 0; then
8040                 RPM=$a
8041                 break
8042             else
8043                 $a --version >/dev/null 2> /dev/null
8044                 if test $? -eq 0; then
8045                     RPM=$a
8046                     break
8047                 fi
8048             fi
8049         done
8050         if test -z "$RPM"; then
8051             AC_MSG_ERROR([not found])
8052         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8053             RPM_PATH=`which $RPM`
8054             AC_MSG_RESULT([$RPM_PATH])
8055             SCPDEFS="$SCPDEFS -DWITH_RPM"
8056         else
8057             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8058         fi
8059     fi
8060     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8061         AC_PATH_PROG(DPKG, dpkg, no)
8062         if test "$DPKG" = "no"; then
8063             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8064         fi
8065     fi
8066     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8067        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8068         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8069             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8070                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8071                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8072                     AC_MSG_RESULT([yes])
8073                 else
8074                     AC_MSG_RESULT([no])
8075                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8076                         _pt="rpm"
8077                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8078                         add_warning "the rpms will need to be installed with --nodeps"
8079                     else
8080                         _pt="pkg"
8081                     fi
8082                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8083                     add_warning "the ${_pt}s will not be relocatable"
8084                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8085                                  relocation will work, you need to patch your epm with the
8086                                  patch in epm/epm-3.7.patch or build with
8087                                  --with-epm=internal which will build a suitable epm])
8088                 fi
8089             fi
8090         fi
8091     fi
8092     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8093         AC_PATH_PROG(PKGMK, pkgmk, no)
8094         if test "$PKGMK" = "no"; then
8095             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8096         fi
8097     fi
8098     AC_SUBST(RPM)
8099     AC_SUBST(DPKG)
8100     AC_SUBST(PKGMK)
8101 else
8102     for i in $PKGFORMAT; do
8103         case "$i" in
8104         aix | bsd | deb | pkg | rpm | native | portable)
8105             AC_MSG_ERROR(
8106                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8107             ;;
8108         esac
8109     done
8110     AC_MSG_RESULT([no])
8111     EPM=NO
8113 AC_SUBST(EPM)
8115 ENABLE_LWP=
8116 if test "$enable_lotuswordpro" = "yes"; then
8117     ENABLE_LWP="TRUE"
8119 AC_SUBST(ENABLE_LWP)
8121 dnl ===================================================================
8122 dnl Check for building ODK
8123 dnl ===================================================================
8124 if test "$enable_odk" = no; then
8125     unset DOXYGEN
8126 else
8127     if test "$with_doxygen" = no; then
8128         AC_MSG_CHECKING([for doxygen])
8129         unset DOXYGEN
8130         AC_MSG_RESULT([no])
8131     else
8132         if test "$with_doxygen" = yes; then
8133             AC_PATH_PROG([DOXYGEN], [doxygen])
8134             if test -z "$DOXYGEN"; then
8135                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8136             fi
8137             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8138                 if ! dot -V 2>/dev/null; then
8139                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8140                 fi
8141             fi
8142         else
8143             AC_MSG_CHECKING([for doxygen])
8144             DOXYGEN=$with_doxygen
8145             AC_MSG_RESULT([$DOXYGEN])
8146         fi
8147         if test -n "$DOXYGEN"; then
8148             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8149             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8150             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8151                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8152             fi
8153         fi
8154     fi
8156 AC_SUBST([DOXYGEN])
8158 AC_MSG_CHECKING([whether to build the ODK])
8159 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8160     AC_MSG_RESULT([yes])
8162     if test "$with_java" != "no"; then
8163         AC_MSG_CHECKING([whether to build unowinreg.dll])
8164         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8165             # build on Win by default
8166             enable_build_unowinreg=yes
8167         fi
8168         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8169             AC_MSG_RESULT([no])
8170             BUILD_UNOWINREG=
8171         else
8172             AC_MSG_RESULT([yes])
8173             BUILD_UNOWINREG=TRUE
8174         fi
8175         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8176             if test -z "$with_mingw_cross_compiler"; then
8177                 dnl Guess...
8178                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8179             elif test -x "$with_mingw_cross_compiler"; then
8180                  MINGWCXX="$with_mingw_cross_compiler"
8181             else
8182                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8183             fi
8185             if test "$MINGWCXX" = "false"; then
8186                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8187             fi
8189             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8190             if test -x "$mingwstrip_test"; then
8191                 MINGWSTRIP="$mingwstrip_test"
8192             else
8193                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8194             fi
8196             if test "$MINGWSTRIP" = "false"; then
8197                 AC_MSG_ERROR(MinGW32 binutils not found.)
8198             fi
8199         fi
8200     fi
8201     BUILD_TYPE="$BUILD_TYPE ODK"
8202 else
8203     AC_MSG_RESULT([no])
8204     BUILD_UNOWINREG=
8206 AC_SUBST(BUILD_UNOWINREG)
8207 AC_SUBST(MINGWCXX)
8208 AC_SUBST(MINGWSTRIP)
8210 dnl ===================================================================
8211 dnl Check for system zlib
8212 dnl ===================================================================
8213 if test "$with_system_zlib" = "auto"; then
8214     case "$_os" in
8215     WINNT)
8216         with_system_zlib="$with_system_libs"
8217         ;;
8218     *)
8219         if test "$enable_fuzzers" != "yes"; then
8220             with_system_zlib=yes
8221         else
8222             with_system_zlib=no
8223         fi
8224         ;;
8225     esac
8228 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8229 dnl and has no pkg-config for it at least on some tinderboxes,
8230 dnl so leaving that out for now
8231 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8232 AC_MSG_CHECKING([which zlib to use])
8233 if test "$with_system_zlib" = "yes"; then
8234     AC_MSG_RESULT([external])
8235     SYSTEM_ZLIB=TRUE
8236     AC_CHECK_HEADER(zlib.h, [],
8237         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8238     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8239         [AC_MSG_ERROR(zlib not found or functional)], [])
8240 else
8241     AC_MSG_RESULT([internal])
8242     SYSTEM_ZLIB=
8243     BUILD_TYPE="$BUILD_TYPE ZLIB"
8244     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8245     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8247 AC_SUBST(ZLIB_CFLAGS)
8248 AC_SUBST(ZLIB_LIBS)
8249 AC_SUBST(SYSTEM_ZLIB)
8251 dnl ===================================================================
8252 dnl Check for system jpeg
8253 dnl ===================================================================
8254 AC_MSG_CHECKING([which libjpeg to use])
8255 if test "$with_system_jpeg" = "yes"; then
8256     AC_MSG_RESULT([external])
8257     SYSTEM_LIBJPEG=TRUE
8258     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8259         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8260     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8261         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8262 else
8263     SYSTEM_LIBJPEG=
8264     AC_MSG_RESULT([internal, libjpeg-turbo])
8265     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8266     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8267     if test "$COM" = "MSC"; then
8268         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8269     else
8270         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8271     fi
8273     case "$host_cpu" in
8274     x86_64 | amd64 | i*86 | x86 | ia32)
8275         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8276         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8277             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8278                 NASM="$LODE_HOME/opt/bin/nasm"
8279             elif test -x "/opt/lo/bin/nasm"; then
8280                 NASM="/opt/lo/bin/nasm"
8281             fi
8282         fi
8284         if test -n "$NASM"; then
8285             AC_MSG_CHECKING([for object file format of host system])
8286             case "$host_os" in
8287               cygwin* | mingw* | pw32* | interix*)
8288                 case "$host_cpu" in
8289                   x86_64)
8290                     objfmt='Win64-COFF'
8291                     ;;
8292                   *)
8293                     objfmt='Win32-COFF'
8294                     ;;
8295                 esac
8296               ;;
8297               msdosdjgpp* | go32*)
8298                 objfmt='COFF'
8299               ;;
8300               os2-emx*) # not tested
8301                 objfmt='MSOMF' # obj
8302               ;;
8303               linux*coff* | linux*oldld*)
8304                 objfmt='COFF' # ???
8305               ;;
8306               linux*aout*)
8307                 objfmt='a.out'
8308               ;;
8309               linux*)
8310                 case "$host_cpu" in
8311                   x86_64)
8312                     objfmt='ELF64'
8313                     ;;
8314                   *)
8315                     objfmt='ELF'
8316                     ;;
8317                 esac
8318               ;;
8319               kfreebsd* | freebsd* | netbsd* | openbsd*)
8320                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8321                   objfmt='BSD-a.out'
8322                 else
8323                   case "$host_cpu" in
8324                     x86_64 | amd64)
8325                       objfmt='ELF64'
8326                       ;;
8327                     *)
8328                       objfmt='ELF'
8329                       ;;
8330                   esac
8331                 fi
8332               ;;
8333               solaris* | sunos* | sysv* | sco*)
8334                 case "$host_cpu" in
8335                   x86_64)
8336                     objfmt='ELF64'
8337                     ;;
8338                   *)
8339                     objfmt='ELF'
8340                     ;;
8341                 esac
8342               ;;
8343               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8344                 case "$host_cpu" in
8345                   x86_64)
8346                     objfmt='Mach-O64'
8347                     ;;
8348                   *)
8349                     objfmt='Mach-O'
8350                     ;;
8351                 esac
8352               ;;
8353               *)
8354                 objfmt='ELF ?'
8355               ;;
8356             esac
8358             AC_MSG_RESULT([$objfmt])
8359             if test "$objfmt" = 'ELF ?'; then
8360               objfmt='ELF'
8361               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8362             fi
8364             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8365             case "$objfmt" in
8366               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8367               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8368               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8369               COFF)       NAFLAGS='-fcoff -DCOFF';;
8370               a.out)      NAFLAGS='-faout -DAOUT';;
8371               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8372               ELF)        NAFLAGS='-felf -DELF';;
8373               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8374               RDF)        NAFLAGS='-frdf -DRDF';;
8375               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8376               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8377             esac
8378             AC_MSG_RESULT([$NAFLAGS])
8380             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8381             cat > conftest.asm << EOF
8382             [%line __oline__ "configure"
8383                     section .text
8384                     global  _main,main
8385             _main:
8386             main:   xor     eax,eax
8387                     ret
8388             ]
8390             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8391             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8392               AC_MSG_RESULT(yes)
8393             else
8394               echo "configure: failed program was:" >&AC_FD_CC
8395               cat conftest.asm >&AC_FD_CC
8396               rm -rf conftest*
8397               AC_MSG_RESULT(no)
8398               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8399               NASM=""
8400             fi
8402         fi
8404         if test -z "$NASM"; then
8405 cat << _EOS
8406 ****************************************************************************
8407 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8408 To get one please:
8410 _EOS
8411             if test "$build_os" = "cygwin"; then
8412 cat << _EOS
8413 install a pre-compiled binary for Win32
8415 mkdir -p /opt/lo/bin
8416 cd /opt/lo/bin
8417 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8418 chmod +x nasm
8420 or get and install one from http://www.nasm.us/
8422 Then re-run autogen.sh
8424 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8425 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8427 _EOS
8428             else
8429 cat << _EOS
8430 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8432 _EOS
8433             fi
8434             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8435             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8436         fi
8437       ;;
8438     esac
8441 AC_SUBST(NASM)
8442 AC_SUBST(LIBJPEG_CFLAGS)
8443 AC_SUBST(LIBJPEG_LIBS)
8444 AC_SUBST(SYSTEM_LIBJPEG)
8446 dnl ===================================================================
8447 dnl Check for system clucene
8448 dnl ===================================================================
8449 dnl we should rather be using
8450 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8451 dnl but the contribs-lib check seems tricky
8452 AC_MSG_CHECKING([which clucene to use])
8453 if test "$with_system_clucene" = "yes"; then
8454     AC_MSG_RESULT([external])
8455     SYSTEM_CLUCENE=TRUE
8456     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8457     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8458     FilterLibs "${CLUCENE_LIBS}"
8459     CLUCENE_LIBS="${filteredlibs}"
8460     AC_LANG_PUSH([C++])
8461     save_CXXFLAGS=$CXXFLAGS
8462     save_CPPFLAGS=$CPPFLAGS
8463     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8464     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8465     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8466     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8467     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8468                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8469     CXXFLAGS=$save_CXXFLAGS
8470     CPPFLAGS=$save_CPPFLAGS
8471     AC_LANG_POP([C++])
8473     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8474 else
8475     AC_MSG_RESULT([internal])
8476     SYSTEM_CLUCENE=
8477     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8479 AC_SUBST(SYSTEM_CLUCENE)
8480 AC_SUBST(CLUCENE_CFLAGS)
8481 AC_SUBST(CLUCENE_LIBS)
8483 dnl ===================================================================
8484 dnl Check for system expat
8485 dnl ===================================================================
8486 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8488 dnl ===================================================================
8489 dnl Check for system xmlsec
8490 dnl ===================================================================
8491 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8493 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8494 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8495     ENABLE_EOT="TRUE"
8496     AC_DEFINE([ENABLE_EOT])
8497     AC_MSG_RESULT([yes])
8499     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8500 else
8501     ENABLE_EOT=
8502     AC_MSG_RESULT([no])
8504 AC_SUBST([ENABLE_EOT])
8506 dnl ===================================================================
8507 dnl Check for DLP libs
8508 dnl ===================================================================
8509 AS_IF([test "$COM" = "MSC"],
8510       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8511       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8513 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8515 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8517 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8519 AS_IF([test "$COM" = "MSC"],
8520       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8521       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8523 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8525 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8527 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8528 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8530 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8532 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8534 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8536 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8537 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8539 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8540 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8542 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8544 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8545 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8547 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8549 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8551 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8553 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8555 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8556 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8558 dnl ===================================================================
8559 dnl Check for system lcms2
8560 dnl ===================================================================
8561 if test "$with_system_lcms2" != "yes"; then
8562     SYSTEM_LCMS2=
8564 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8565 if test "$GCC" = "yes"; then
8566     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8568 if test "$COM" = "MSC"; then # override the above
8569     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8572 dnl ===================================================================
8573 dnl Check for system cppunit
8574 dnl ===================================================================
8575 if test "$_os" != "Android" ; then
8576     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8579 dnl ===================================================================
8580 dnl Check whether freetype is available
8581 dnl ===================================================================
8582 if test  "$test_freetype" = "yes"; then
8583     AC_MSG_CHECKING([whether freetype is available])
8584     # FreeType has 3 different kinds of versions
8585     # * release, like 2.4.10
8586     # * libtool, like 13.0.7 (this what pkg-config returns)
8587     # * soname
8588     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8589     #
8590     # 9.9.3 is 2.2.0
8591     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8592     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8593     FilterLibs "${FREETYPE_LIBS}"
8594     FREETYPE_LIBS="${filteredlibs}"
8595     SYSTEM_FREETYPE=TRUE
8596 else
8597     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8598     if test "x$ac_config_site_64bit_host" = xYES; then
8599         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8600     else
8601         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8602     fi
8604 AC_SUBST(FREETYPE_CFLAGS)
8605 AC_SUBST(FREETYPE_LIBS)
8606 AC_SUBST([SYSTEM_FREETYPE])
8608 # ===================================================================
8609 # Check for system libxslt
8610 # to prevent incompatibilities between internal libxml2 and external libxslt,
8611 # or vice versa, use with_system_libxml here
8612 # ===================================================================
8613 if test "$with_system_libxml" = "auto"; then
8614     case "$_os" in
8615     WINNT|iOS|Android)
8616         with_system_libxml="$with_system_libs"
8617         ;;
8618     *)
8619         if test "$enable_fuzzers" != "yes"; then
8620             with_system_libxml=yes
8621         else
8622             with_system_libxml=no
8623         fi
8624         ;;
8625     esac
8628 AC_MSG_CHECKING([which libxslt to use])
8629 if test "$with_system_libxml" = "yes"; then
8630     AC_MSG_RESULT([external])
8631     SYSTEM_LIBXSLT=TRUE
8632     if test "$_os" = "Darwin"; then
8633         dnl make sure to use SDK path
8634         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8635         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8636         dnl omit -L/usr/lib
8637         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8638         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8639     else
8640         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8641         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8642         FilterLibs "${LIBXSLT_LIBS}"
8643         LIBXSLT_LIBS="${filteredlibs}"
8644         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8645         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8646         FilterLibs "${LIBEXSLT_LIBS}"
8647         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8648     fi
8650     dnl Check for xsltproc
8651     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8652     if test "$XSLTPROC" = "no"; then
8653         AC_MSG_ERROR([xsltproc is required])
8654     fi
8655 else
8656     AC_MSG_RESULT([internal])
8657     SYSTEM_LIBXSLT=
8658     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8660     if test "$cross_compiling" = "yes"; then
8661         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8662         if test "$XSLTPROC" = "no"; then
8663             AC_MSG_ERROR([xsltproc is required])
8664         fi
8665     fi
8667 AC_SUBST(SYSTEM_LIBXSLT)
8668 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8669     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8671 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8673 AC_SUBST(LIBEXSLT_CFLAGS)
8674 AC_SUBST(LIBEXSLT_LIBS)
8675 AC_SUBST(LIBXSLT_CFLAGS)
8676 AC_SUBST(LIBXSLT_LIBS)
8677 AC_SUBST(XSLTPROC)
8679 # ===================================================================
8680 # Check for system libxml
8681 # ===================================================================
8682 AC_MSG_CHECKING([which libxml to use])
8683 if test "$with_system_libxml" = "yes"; then
8684     AC_MSG_RESULT([external])
8685     SYSTEM_LIBXML=TRUE
8686     if test "$_os" = "Darwin"; then
8687         dnl make sure to use SDK path
8688         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8689         dnl omit -L/usr/lib
8690         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8691     elif test $_os = iOS; then
8692         dnl make sure to use SDK path
8693         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8694         LIBXML_CFLAGS="-I$usr/include/libxml2"
8695         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8696     else
8697         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8698         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8699         FilterLibs "${LIBXML_LIBS}"
8700         LIBXML_LIBS="${filteredlibs}"
8701     fi
8703     dnl Check for xmllint
8704     AC_PATH_PROG(XMLLINT, xmllint, no)
8705     if test "$XMLLINT" = "no"; then
8706         AC_MSG_ERROR([xmllint is required])
8707     fi
8708 else
8709     AC_MSG_RESULT([internal])
8710     SYSTEM_LIBXML=
8711     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8712     if test "$COM" = "MSC"; then
8713         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8714     fi
8715     if test "$COM" = "MSC"; then
8716         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8717     else
8718         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8719     fi
8720     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8722 AC_SUBST(SYSTEM_LIBXML)
8723 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8724     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8726 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8727 AC_SUBST(LIBXML_CFLAGS)
8728 AC_SUBST(LIBXML_LIBS)
8729 AC_SUBST(XMLLINT)
8731 # =====================================================================
8732 # Checking for a Python interpreter with version >= 2.7.
8733 # Build and runtime requires Python 3 compatible version (>= 2.7).
8734 # Optionally user can pass an option to configure, i. e.
8735 # ./configure PYTHON=/usr/bin/python
8736 # =====================================================================
8737 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8738     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
8739     enable_python=internal
8741 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8742     if test -n "$PYTHON"; then
8743         PYTHON_FOR_BUILD=$PYTHON
8744     else
8745         # This allows a lack of system python with no error, we use internal one in that case.
8746         AM_PATH_PYTHON([2.7],, [:])
8747         # Clean PYTHON_VERSION checked below if cross-compiling
8748         PYTHON_VERSION=""
8749         if test "$PYTHON" != ":"; then
8750             PYTHON_FOR_BUILD=$PYTHON
8751         fi
8752     fi
8754 AC_SUBST(PYTHON_FOR_BUILD)
8756 # Checks for Python to use for Pyuno
8757 AC_MSG_CHECKING([which Python to use for Pyuno])
8758 case "$enable_python" in
8759 no|disable)
8760     if test -z $PYTHON_FOR_BUILD; then
8761         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8762         # requirement from the choice whether to include Python stuff in the installer, but why
8763         # bother?
8764         AC_MSG_ERROR([Python is required at build time.])
8765     fi
8766     enable_python=no
8767     AC_MSG_RESULT([none])
8768     ;;
8769 ""|yes|auto)
8770     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8771         AC_MSG_RESULT([no, overridden by --disable-scripting])
8772         enable_python=no
8773     elif test $build_os = cygwin; then
8774         dnl When building on Windows we don't attempt to use any installed
8775         dnl "system"  Python.
8776         AC_MSG_RESULT([fully internal])
8777         enable_python=internal
8778     elif test "$cross_compiling" = yes; then
8779         AC_MSG_RESULT([system])
8780         enable_python=system
8781     else
8782         # Unset variables set by the above AM_PATH_PYTHON so that
8783         # we actually do check anew.
8784         AC_MSG_RESULT([])
8785         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
8786         AM_PATH_PYTHON([3.3],, [:])
8787         AC_MSG_CHECKING([which Python to use for Pyuno])
8788         if test "$PYTHON" = ":"; then
8789             if test -z "$PYTHON_FOR_BUILD"; then
8790                 AC_MSG_RESULT([fully internal])
8791             else
8792                 AC_MSG_RESULT([internal])
8793             fi
8794             enable_python=internal
8795         else
8796             AC_MSG_RESULT([system])
8797             enable_python=system
8798         fi
8799     fi
8800     ;;
8801 internal)
8802     AC_MSG_RESULT([internal])
8803     ;;
8804 fully-internal)
8805     AC_MSG_RESULT([fully internal])
8806     enable_python=internal
8807     ;;
8808 system)
8809     AC_MSG_RESULT([system])
8810     if test "$_os" = Darwin; then
8811         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])
8812     fi
8813     ;;
8815     AC_MSG_ERROR([Incorrect --enable-python option])
8816     ;;
8817 esac
8819 if test $enable_python != no; then
8820     BUILD_TYPE="$BUILD_TYPE PYUNO"
8823 if test $enable_python = system; then
8824     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8825         # Fallback: Accept these in the environment, or as set above
8826         # for MacOSX.
8827         :
8828     elif test "$cross_compiling" != yes; then
8829         # Unset variables set by the above AM_PATH_PYTHON so that
8830         # we actually do check anew.
8831         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
8832         # This causes an error if no python command is found
8833         AM_PATH_PYTHON([3.3])
8834         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8835         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8836         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8837         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8838         if test -z "$PKG_CONFIG"; then
8839             PYTHON_CFLAGS="-I$python_include"
8840             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8841         elif $PKG_CONFIG --exists python-$python_version-embed; then
8842             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8843             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8844         elif $PKG_CONFIG --exists python-$python_version; then
8845             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8846             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8847         else
8848             PYTHON_CFLAGS="-I$python_include"
8849             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8850         fi
8851         FilterLibs "${PYTHON_LIBS}"
8852         PYTHON_LIBS="${filteredlibs}"
8853     else
8854         dnl How to find out the cross-compilation Python installation path?
8855         AC_MSG_CHECKING([for python version])
8856         AS_IF([test -n "$PYTHON_VERSION"],
8857               [AC_MSG_RESULT([$PYTHON_VERSION])],
8858               [AC_MSG_RESULT([not found])
8859                AC_MSG_ERROR([no usable python found])])
8860         test -n "$PYTHON_CFLAGS" && break
8861     fi
8863     dnl Check if the headers really work
8864     save_CPPFLAGS="$CPPFLAGS"
8865     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8866     AC_CHECK_HEADER(Python.h)
8867     CPPFLAGS="$save_CPPFLAGS"
8869     # let the PYTHON_FOR_BUILD match the same python installation that
8870     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8871     # better for PythonTests.
8872     PYTHON_FOR_BUILD=$PYTHON
8875 if test "$with_lxml" != no; then
8876     if test -z "$PYTHON_FOR_BUILD"; then
8877         case $build_os in
8878             cygwin)
8879                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8880                 ;;
8881             *)
8882                 if test "$cross_compiling" != yes ; then
8883                     BUILD_TYPE="$BUILD_TYPE LXML"
8884                 fi
8885                 ;;
8886         esac
8887     else
8888         AC_MSG_CHECKING([for python lxml])
8889         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8890             AC_MSG_RESULT([yes])
8891         else
8892             case $build_os in
8893                 cygwin)
8894                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8895                     ;;
8896                 *)
8897                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8898                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8899                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8900                         else
8901                             BUILD_TYPE="$BUILD_TYPE LXML"
8902                             AC_MSG_RESULT([no, using internal lxml])
8903                         fi
8904                     else
8905                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8906                     fi
8907                     ;;
8908             esac
8909         fi
8910     fi
8913 dnl By now enable_python should be "system", "internal" or "no"
8914 case $enable_python in
8915 system)
8916     SYSTEM_PYTHON=TRUE
8918     if test "x$ac_cv_header_Python_h" != "xyes"; then
8919        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8920     fi
8922     AC_LANG_PUSH(C)
8923     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8924     AC_MSG_CHECKING([for correct python library version])
8925        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8926 #include <Python.h>
8928 int main(int argc, char **argv) {
8929    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8930        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8931    else return 1;
8933        ]])],[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])])
8934     CFLAGS=$save_CFLAGS
8935     AC_LANG_POP(C)
8937     dnl FIXME Check if the Python library can be linked with, too?
8938     ;;
8940 internal)
8941     SYSTEM_PYTHON=
8942     PYTHON_VERSION_MAJOR=3
8943     PYTHON_VERSION_MINOR=7
8944     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
8945     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8946         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8947     fi
8948     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"3.7.7"])
8949     BUILD_TYPE="$BUILD_TYPE PYTHON"
8950     if test "$OS" = LINUX; then
8951         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8952     fi
8953     # Embedded Python dies without Home set
8954     if test "$HOME" = ""; then
8955         export HOME=""
8956     fi
8957     ;;
8959     DISABLE_PYTHON=TRUE
8960     SYSTEM_PYTHON=
8961     ;;
8963     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8964     ;;
8965 esac
8967 AC_SUBST(DISABLE_PYTHON)
8968 AC_SUBST(SYSTEM_PYTHON)
8969 AC_SUBST(PYTHON_CFLAGS)
8970 AC_SUBST(PYTHON_LIBS)
8971 AC_SUBST(PYTHON_VERSION)
8972 AC_SUBST(PYTHON_VERSION_MAJOR)
8973 AC_SUBST(PYTHON_VERSION_MINOR)
8975 ENABLE_MARIADBC=TRUE
8976 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8977     ENABLE_MARIADBC=
8979 MARIADBC_MAJOR=1
8980 MARIADBC_MINOR=0
8981 MARIADBC_MICRO=2
8982 if test "$ENABLE_MARIADBC" = "TRUE"; then
8983     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8986 AC_SUBST(ENABLE_MARIADBC)
8987 AC_SUBST(MARIADBC_MAJOR)
8988 AC_SUBST(MARIADBC_MINOR)
8989 AC_SUBST(MARIADBC_MICRO)
8991 if test "$ENABLE_MARIADBC" = "TRUE"; then
8992     dnl ===================================================================
8993     dnl Check for system MariaDB
8994     dnl ===================================================================
8995     AC_MSG_CHECKING([which MariaDB to use])
8996     if test "$with_system_mariadb" = "yes"; then
8997         AC_MSG_RESULT([external])
8998         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8999         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9000         if test -z "$MARIADBCONFIG"; then
9001             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9002             if test -z "$MARIADBCONFIG"; then
9003                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9004                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9005             fi
9006         fi
9007         AC_MSG_CHECKING([MariaDB version])
9008         MARIADB_VERSION=`$MARIADBCONFIG --version`
9009         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9010         if test "$MARIADB_MAJOR" -ge "5"; then
9011             AC_MSG_RESULT([OK])
9012         else
9013             AC_MSG_ERROR([too old, use 5.0.x or later])
9014         fi
9015         AC_MSG_CHECKING([for MariaDB Client library])
9016         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9017         if test "$COM_IS_CLANG" = TRUE; then
9018             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9019         fi
9020         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9021         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9022         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9023         dnl linux32:
9024         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9025             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9026             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9027                 | sed -e 's|/lib64/|/lib/|')
9028         fi
9029         FilterLibs "${MARIADB_LIBS}"
9030         MARIADB_LIBS="${filteredlibs}"
9031         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9032         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9033         if test "$enable_bundle_mariadb" = "yes"; then
9034             AC_MSG_RESULT([yes])
9035             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9036             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9038 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9040 /g' | grep -E '(mysqlclient|mariadb)')
9041             if test "$_os" = "Darwin"; then
9042                 LIBMARIADB=${LIBMARIADB}.dylib
9043             elif test "$_os" = "WINNT"; then
9044                 LIBMARIADB=${LIBMARIADB}.dll
9045             else
9046                 LIBMARIADB=${LIBMARIADB}.so
9047             fi
9048             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9049             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9050             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9051                 AC_MSG_RESULT([found.])
9052                 PathFormat "$LIBMARIADB_PATH"
9053                 LIBMARIADB_PATH="$formatted_path"
9054             else
9055                 AC_MSG_ERROR([not found.])
9056             fi
9057         else
9058             AC_MSG_RESULT([no])
9059             BUNDLE_MARIADB_CONNECTOR_C=
9060         fi
9061     else
9062         AC_MSG_RESULT([internal])
9063         SYSTEM_MARIADB_CONNECTOR_C=
9064         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9065         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9066         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9067     fi
9069     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9070     AC_SUBST(MARIADB_CFLAGS)
9071     AC_SUBST(MARIADB_LIBS)
9072     AC_SUBST(LIBMARIADB)
9073     AC_SUBST(LIBMARIADB_PATH)
9074     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9077 dnl ===================================================================
9078 dnl Check for system hsqldb
9079 dnl ===================================================================
9080 if test "$with_java" != "no"; then
9081     HSQLDB_USE_JDBC_4_1=
9082     AC_MSG_CHECKING([which hsqldb to use])
9083     if test "$with_system_hsqldb" = "yes"; then
9084         AC_MSG_RESULT([external])
9085         SYSTEM_HSQLDB=TRUE
9086         if test -z $HSQLDB_JAR; then
9087             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9088         fi
9089         if ! test -f $HSQLDB_JAR; then
9090                AC_MSG_ERROR(hsqldb.jar not found.)
9091         fi
9092         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9093         export HSQLDB_JAR
9094         if $PERL -e \
9095            'use Archive::Zip;
9096             my $file = "$ENV{'HSQLDB_JAR'}";
9097             my $zip = Archive::Zip->new( $file );
9098             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9099             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9100             {
9101                 push @l, split(/\n/, $mf);
9102                 foreach my $line (@l)
9103                 {
9104                     if ($line =~ m/Specification-Version:/)
9105                     {
9106                         ($t, $version) = split (/:/,$line);
9107                         $version =~ s/^\s//;
9108                         ($a, $b, $c, $d) = split (/\./,$version);
9109                         if ($c == "0" && $d > "8")
9110                         {
9111                             exit 0;
9112                         }
9113                         else
9114                         {
9115                             exit 1;
9116                         }
9117                     }
9118                 }
9119             }
9120             else
9121             {
9122                 exit 1;
9123             }'; then
9124             AC_MSG_RESULT([yes])
9125         else
9126             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9127         fi
9128     else
9129         AC_MSG_RESULT([internal])
9130         SYSTEM_HSQLDB=
9131         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9132         NEED_ANT=TRUE
9133         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9134         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9135         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9136             AC_MSG_RESULT([yes])
9137             HSQLDB_USE_JDBC_4_1=TRUE
9138         else
9139             AC_MSG_RESULT([no])
9140         fi
9141     fi
9142     AC_SUBST(SYSTEM_HSQLDB)
9143     AC_SUBST(HSQLDB_JAR)
9144     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9147 dnl ===================================================================
9148 dnl Check for PostgreSQL stuff
9149 dnl ===================================================================
9150 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9151 if test "x$enable_postgresql_sdbc" != "xno"; then
9152     AC_MSG_RESULT([yes])
9153     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9155     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9156         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9157     fi
9158     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9159         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9160     fi
9162     postgres_interface=""
9163     if test "$with_system_postgresql" = "yes"; then
9164         postgres_interface="external PostgreSQL"
9165         SYSTEM_POSTGRESQL=TRUE
9166         if test "$_os" = Darwin; then
9167             supp_path=''
9168             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9169                 pg_supp_path="$P_SEP$d$pg_supp_path"
9170             done
9171         fi
9172         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9173         if test -n "$PGCONFIG"; then
9174             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9175             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9176         else
9177             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9178               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9179               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9180             ],[
9181               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9182             ])
9183         fi
9184         FilterLibs "${POSTGRESQL_LIB}"
9185         POSTGRESQL_LIB="${filteredlibs}"
9186     else
9187         # if/when anything else than PostgreSQL uses Kerberos,
9188         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9189         WITH_KRB5=
9190         WITH_GSSAPI=
9191         case "$_os" in
9192         Darwin)
9193             # macOS has system MIT Kerberos 5 since 10.4
9194             if test "$with_krb5" != "no"; then
9195                 WITH_KRB5=TRUE
9196                 save_LIBS=$LIBS
9197                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9198                 # that the libraries where these functions are located on macOS will change, is it?
9199                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9200                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9201                 KRB5_LIBS=$LIBS
9202                 LIBS=$save_LIBS
9203                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9204                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9205                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9206                 LIBS=$save_LIBS
9207             fi
9208             if test "$with_gssapi" != "no"; then
9209                 WITH_GSSAPI=TRUE
9210                 save_LIBS=$LIBS
9211                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9212                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9213                 GSSAPI_LIBS=$LIBS
9214                 LIBS=$save_LIBS
9215             fi
9216             ;;
9217         WINNT)
9218             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9219                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9220             fi
9221             ;;
9222         Linux|GNU|*BSD|DragonFly)
9223             if test "$with_krb5" != "no"; then
9224                 WITH_KRB5=TRUE
9225                 save_LIBS=$LIBS
9226                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9227                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9228                 KRB5_LIBS=$LIBS
9229                 LIBS=$save_LIBS
9230                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9231                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9232                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9233                 LIBS=$save_LIBS
9234             fi
9235             if test "$with_gssapi" != "no"; then
9236                 WITH_GSSAPI=TRUE
9237                 save_LIBS=$LIBS
9238                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9239                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9240                 GSSAPI_LIBS=$LIBS
9241                 LIBS=$save_LIBS
9242             fi
9243             ;;
9244         *)
9245             if test "$with_krb5" = "yes"; then
9246                 WITH_KRB5=TRUE
9247                 save_LIBS=$LIBS
9248                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9249                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9250                 KRB5_LIBS=$LIBS
9251                 LIBS=$save_LIBS
9252                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9253                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9254                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9255                 LIBS=$save_LIBS
9256             fi
9257             if test "$with_gssapi" = "yes"; then
9258                 WITH_GSSAPI=TRUE
9259                 save_LIBS=$LIBS
9260                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9261                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9262                 LIBS=$save_LIBS
9263                 GSSAPI_LIBS=$LIBS
9264             fi
9265         esac
9267         if test -n "$with_libpq_path"; then
9268             SYSTEM_POSTGRESQL=TRUE
9269             postgres_interface="external libpq"
9270             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9271             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9272         else
9273             SYSTEM_POSTGRESQL=
9274             postgres_interface="internal"
9275             POSTGRESQL_LIB=""
9276             POSTGRESQL_INC="%OVERRIDE_ME%"
9277             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9278         fi
9279     fi
9281     AC_MSG_CHECKING([PostgreSQL C interface])
9282     AC_MSG_RESULT([$postgres_interface])
9284     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9285         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9286         save_CFLAGS=$CFLAGS
9287         save_CPPFLAGS=$CPPFLAGS
9288         save_LIBS=$LIBS
9289         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9290         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9291         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9292         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9293             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9294         CFLAGS=$save_CFLAGS
9295         CPPFLAGS=$save_CPPFLAGS
9296         LIBS=$save_LIBS
9297     fi
9298     BUILD_POSTGRESQL_SDBC=TRUE
9299 else
9300     AC_MSG_RESULT([no])
9302 AC_SUBST(WITH_KRB5)
9303 AC_SUBST(WITH_GSSAPI)
9304 AC_SUBST(GSSAPI_LIBS)
9305 AC_SUBST(KRB5_LIBS)
9306 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9307 AC_SUBST(SYSTEM_POSTGRESQL)
9308 AC_SUBST(POSTGRESQL_INC)
9309 AC_SUBST(POSTGRESQL_LIB)
9311 dnl ===================================================================
9312 dnl Check for Firebird stuff
9313 dnl ===================================================================
9314 ENABLE_FIREBIRD_SDBC=
9315 if test "$enable_firebird_sdbc" = "yes" ; then
9316     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9318     dnl ===================================================================
9319     dnl Check for system Firebird
9320     dnl ===================================================================
9321     AC_MSG_CHECKING([which Firebird to use])
9322     if test "$with_system_firebird" = "yes"; then
9323         AC_MSG_RESULT([external])
9324         SYSTEM_FIREBIRD=TRUE
9325         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9326         if test -z "$FIREBIRDCONFIG"; then
9327             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9328             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9329                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9330             ])
9331             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9332         else
9333             AC_MSG_NOTICE([fb_config found])
9334             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9335             AC_MSG_CHECKING([for Firebird Client library])
9336             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9337             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9338             FilterLibs "${FIREBIRD_LIBS}"
9339             FIREBIRD_LIBS="${filteredlibs}"
9340         fi
9341         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9342         AC_MSG_CHECKING([Firebird version])
9343         if test -n "${FIREBIRD_VERSION}"; then
9344             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9345             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9346             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9347                 AC_MSG_RESULT([OK])
9348             else
9349                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9350             fi
9351         else
9352             __save_CFLAGS="${CFLAGS}"
9353             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9354             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9355 #if defined(FB_API_VER) && FB_API_VER == 30
9356 int fb_api_is_30(void) { return 0; }
9357 #else
9358 #error "Wrong Firebird API version"
9359 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9360             CFLAGS="${__save_CFLAGS}"
9361         fi
9362         ENABLE_FIREBIRD_SDBC=TRUE
9363         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9364     elif test "$enable_database_connectivity" != yes; then
9365         AC_MSG_RESULT([none])
9366     elif test "$cross_compiling" = "yes"; then
9367         AC_MSG_RESULT([none])
9368     else
9369         dnl Embedded Firebird has version 3.0
9370         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9371         dnl We need libatomic_ops for any non X86/X64 system
9372         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9373             dnl ===================================================================
9374             dnl Check for system libatomic_ops
9375             dnl ===================================================================
9376             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9377             if test "$with_system_libatomic_ops" = "yes"; then
9378                 SYSTEM_LIBATOMIC_OPS=TRUE
9379                 AC_CHECK_HEADERS(atomic_ops.h, [],
9380                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9381             else
9382                 SYSTEM_LIBATOMIC_OPS=
9383                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9384                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9385                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9386             fi
9387         fi
9389         AC_MSG_RESULT([internal])
9390         SYSTEM_FIREBIRD=
9391         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9392         FIREBIRD_LIBS="-lfbclient"
9394         if test "$with_system_libtommath" = "yes"; then
9395             SYSTEM_LIBTOMMATH=TRUE
9396             dnl check for tommath presence
9397             save_LIBS=$LIBS
9398             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9399             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9400             LIBS=$save_LIBS
9401         else
9402             SYSTEM_LIBTOMMATH=
9403             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9404             LIBTOMMATH_LIBS="-ltommath"
9405             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9406         fi
9408         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9409         ENABLE_FIREBIRD_SDBC=TRUE
9410         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9411     fi
9413 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9414 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9415 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9416 AC_SUBST(LIBATOMIC_OPS_LIBS)
9417 AC_SUBST(SYSTEM_FIREBIRD)
9418 AC_SUBST(FIREBIRD_CFLAGS)
9419 AC_SUBST(FIREBIRD_LIBS)
9420 AC_SUBST([TOMMATH_CFLAGS])
9421 AC_SUBST([TOMMATH_LIBS])
9423 dnl ===================================================================
9424 dnl Check for system curl
9425 dnl ===================================================================
9426 AC_MSG_CHECKING([which libcurl to use])
9427 if test "$with_system_curl" = "auto"; then
9428     with_system_curl="$with_system_libs"
9431 if test "$with_system_curl" = "yes"; then
9432     AC_MSG_RESULT([external])
9433     SYSTEM_CURL=TRUE
9435     # First try PKGCONFIG and then fall back
9436     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9438     if test -n "$CURL_PKG_ERRORS"; then
9439         AC_PATH_PROG(CURLCONFIG, curl-config)
9440         if test -z "$CURLCONFIG"; then
9441             AC_MSG_ERROR([curl development files not found])
9442         fi
9443         CURL_LIBS=`$CURLCONFIG --libs`
9444         FilterLibs "${CURL_LIBS}"
9445         CURL_LIBS="${filteredlibs}"
9446         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9447         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9449         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9450         case $curl_version in
9451         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9452         dnl so they need to be doubled to end up in the configure script
9453         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9454             AC_MSG_RESULT([yes])
9455             ;;
9456         *)
9457             AC_MSG_ERROR([no, you have $curl_version])
9458             ;;
9459         esac
9460     fi
9462     ENABLE_CURL=TRUE
9463 else
9464     AC_MSG_RESULT([internal])
9465     SYSTEM_CURL=
9466     BUILD_TYPE="$BUILD_TYPE CURL"
9467     ENABLE_CURL=TRUE
9469 AC_SUBST(SYSTEM_CURL)
9470 AC_SUBST(CURL_CFLAGS)
9471 AC_SUBST(CURL_LIBS)
9472 AC_SUBST(ENABLE_CURL)
9474 dnl ===================================================================
9475 dnl Check for system boost
9476 dnl ===================================================================
9477 AC_MSG_CHECKING([which boost to use])
9478 if test "$with_system_boost" = "yes"; then
9479     AC_MSG_RESULT([external])
9480     SYSTEM_BOOST=TRUE
9481     AX_BOOST_BASE(1.47)
9482     AX_BOOST_DATE_TIME
9483     AX_BOOST_FILESYSTEM
9484     AX_BOOST_IOSTREAMS
9485     AX_BOOST_LOCALE
9486     AC_LANG_PUSH([C++])
9487     save_CXXFLAGS=$CXXFLAGS
9488     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9489     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9490        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9491     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9492        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9493     CXXFLAGS=$save_CXXFLAGS
9494     AC_LANG_POP([C++])
9495     # this is in m4/ax_boost_base.m4
9496     FilterLibs "${BOOST_LDFLAGS}"
9497     BOOST_LDFLAGS="${filteredlibs}"
9498 else
9499     AC_MSG_RESULT([internal])
9500     BUILD_TYPE="$BUILD_TYPE BOOST"
9501     SYSTEM_BOOST=
9502     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9503         # use warning-suppressing wrapper headers
9504         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9505     else
9506         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9507     fi
9509 AC_SUBST(SYSTEM_BOOST)
9511 dnl ===================================================================
9512 dnl Check for system mdds
9513 dnl ===================================================================
9514 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9516 dnl ===================================================================
9517 dnl Check for system glm
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([which glm to use])
9520 if test "$with_system_glm" = "yes"; then
9521     AC_MSG_RESULT([external])
9522     SYSTEM_GLM=TRUE
9523     AC_LANG_PUSH([C++])
9524     AC_CHECK_HEADER([glm/glm.hpp], [],
9525        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9526     AC_LANG_POP([C++])
9527 else
9528     AC_MSG_RESULT([internal])
9529     BUILD_TYPE="$BUILD_TYPE GLM"
9530     SYSTEM_GLM=
9531     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9533 AC_SUBST([GLM_CFLAGS])
9534 AC_SUBST([SYSTEM_GLM])
9536 dnl ===================================================================
9537 dnl Check for system odbc
9538 dnl ===================================================================
9539 AC_MSG_CHECKING([which odbc headers to use])
9540 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
9541     AC_MSG_RESULT([external])
9542     SYSTEM_ODBC_HEADERS=TRUE
9544     if test "$build_os" = "cygwin"; then
9545         save_CPPFLAGS=$CPPFLAGS
9546         find_winsdk
9547         PathFormat "$winsdktest"
9548         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"
9549         AC_CHECK_HEADER(sqlext.h, [],
9550             [AC_MSG_ERROR(odbc not found. install odbc)],
9551             [#include <windows.h>])
9552         CPPFLAGS=$save_CPPFLAGS
9553     else
9554         AC_CHECK_HEADER(sqlext.h, [],
9555             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9556     fi
9557 elif test "$enable_database_connectivity" != yes; then
9558     AC_MSG_RESULT([none])
9559 else
9560     AC_MSG_RESULT([internal])
9561     SYSTEM_ODBC_HEADERS=
9563 AC_SUBST(SYSTEM_ODBC_HEADERS)
9565 dnl ===================================================================
9566 dnl Enable LDAP support
9567 dnl ===================================================================
9569 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9570 AC_MSG_CHECKING([whether to enable LDAP support])
9571     if test "$enable_ldap" != "yes"; then
9572         AC_MSG_RESULT([no])
9573         ENABLE_LDAP=""
9574         enable_ldap=no
9575     else
9576         AC_MSG_RESULT([yes])
9577         ENABLE_LDAP="TRUE"
9578         AC_DEFINE(HAVE_FEATURE_LDAP)
9579     fi
9581 AC_SUBST(ENABLE_LDAP)
9583 dnl ===================================================================
9584 dnl Check for system openldap
9585 dnl ===================================================================
9587 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9588 AC_MSG_CHECKING([which openldap library to use])
9589 if test "$with_system_openldap" = "yes"; then
9590     AC_MSG_RESULT([external])
9591     SYSTEM_OPENLDAP=TRUE
9592     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9593     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9594     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9595 else
9596     AC_MSG_RESULT([internal])
9597     SYSTEM_OPENLDAP=
9598     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9601 AC_SUBST(SYSTEM_OPENLDAP)
9603 dnl ===================================================================
9604 dnl Check for system NSS
9605 dnl ===================================================================
9606 if test "$enable_fuzzers" != "yes"; then
9607     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9608     AC_DEFINE(HAVE_FEATURE_NSS)
9609     ENABLE_NSS="TRUE"
9610     AC_DEFINE(ENABLE_NSS)
9611 elif test $_os != iOS ; then
9612     with_tls=openssl
9614 AC_SUBST(ENABLE_NSS)
9616 dnl ===================================================================
9617 dnl Check for TLS/SSL and cryptographic implementation to use
9618 dnl ===================================================================
9619 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9620 if test -n "$with_tls"; then
9621     case $with_tls in
9622     openssl)
9623         AC_DEFINE(USE_TLS_OPENSSL)
9624         TLS=OPENSSL
9626         if test "$enable_openssl" != "yes"; then
9627             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9628         fi
9630         # warn that OpenSSL has been selected but not all TLS code has this option
9631         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9632         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9633         ;;
9634     nss)
9635         AC_DEFINE(USE_TLS_NSS)
9636         TLS=NSS
9637         ;;
9638     no)
9639         AC_MSG_WARN([Skipping TLS/SSL])
9640         ;;
9641     *)
9642         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9643 openssl - OpenSSL
9644 nss - Mozilla's Network Security Services (NSS)
9645     ])
9646         ;;
9647     esac
9648 else
9649     # default to using NSS, it results in smaller oox lib
9650     AC_DEFINE(USE_TLS_NSS)
9651     TLS=NSS
9653 AC_MSG_RESULT([$TLS])
9654 AC_SUBST(TLS)
9656 dnl ===================================================================
9657 dnl Check for system sane
9658 dnl ===================================================================
9659 AC_MSG_CHECKING([which sane header to use])
9660 if test "$with_system_sane" = "yes"; then
9661     AC_MSG_RESULT([external])
9662     AC_CHECK_HEADER(sane/sane.h, [],
9663       [AC_MSG_ERROR(sane not found. install sane)], [])
9664 else
9665     AC_MSG_RESULT([internal])
9666     BUILD_TYPE="$BUILD_TYPE SANE"
9669 dnl ===================================================================
9670 dnl Check for system icu
9671 dnl ===================================================================
9672 SYSTEM_GENBRK=
9673 SYSTEM_GENCCODE=
9674 SYSTEM_GENCMN=
9676 ICU_MAJOR=65
9677 ICU_MINOR=1
9678 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9679 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9680 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9681 AC_MSG_CHECKING([which icu to use])
9682 if test "$with_system_icu" = "yes"; then
9683     AC_MSG_RESULT([external])
9684     SYSTEM_ICU=TRUE
9685     AC_LANG_PUSH([C++])
9686     AC_MSG_CHECKING([for unicode/rbbi.h])
9687     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9688     AC_LANG_POP([C++])
9690     if test "$cross_compiling" != "yes"; then
9691         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9692         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9693         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9694         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9695     fi
9697     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9698         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9699         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9700         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9701         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9702         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9703             AC_MSG_RESULT([yes])
9704         else
9705             AC_MSG_RESULT([no])
9706             if test "$with_system_icu_for_build" != "force"; then
9707                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9708 You can use --with-system-icu-for-build=force to use it anyway.])
9709             fi
9710         fi
9711     fi
9713     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9714         # using the system icu tools can lead to version confusion, use the
9715         # ones from the build environment when cross-compiling
9716         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9717         if test -z "$SYSTEM_GENBRK"; then
9718             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9719         fi
9720         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9721         if test -z "$SYSTEM_GENCCODE"; then
9722             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9723         fi
9724         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9725         if test -z "$SYSTEM_GENCMN"; then
9726             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9727         fi
9728         if test "$ICU_MAJOR" -ge "49"; then
9729             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9730             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9731             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9732         else
9733             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9734             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9735             ICU_RECLASSIFIED_HEBREW_LETTER=
9736         fi
9737     fi
9739     if test "$cross_compiling" = "yes"; then
9740         if test "$ICU_MAJOR" -ge "50"; then
9741             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9742             ICU_MINOR=""
9743         fi
9744     fi
9745 else
9746     AC_MSG_RESULT([internal])
9747     SYSTEM_ICU=
9748     BUILD_TYPE="$BUILD_TYPE ICU"
9749     # surprisingly set these only for "internal" (to be used by various other
9750     # external libs): the system icu-config is quite unhelpful and spits out
9751     # dozens of weird flags and also default path -I/usr/include
9752     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9753     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9755 if test "$ICU_MAJOR" -ge "59"; then
9756     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9757     # with -std=c++11 but not all external libraries can be built with that,
9758     # for those use a bit-compatible typedef uint16_t UChar; see
9759     # icu/source/common/unicode/umachine.h
9760     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9761 else
9762     ICU_UCHAR_TYPE=""
9764 AC_SUBST(SYSTEM_ICU)
9765 AC_SUBST(SYSTEM_GENBRK)
9766 AC_SUBST(SYSTEM_GENCCODE)
9767 AC_SUBST(SYSTEM_GENCMN)
9768 AC_SUBST(ICU_MAJOR)
9769 AC_SUBST(ICU_MINOR)
9770 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9771 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9772 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9773 AC_SUBST(ICU_CFLAGS)
9774 AC_SUBST(ICU_LIBS)
9775 AC_SUBST(ICU_UCHAR_TYPE)
9777 dnl ==================================================================
9778 dnl Breakpad
9779 dnl ==================================================================
9780 DEFAULT_CRASHDUMP_VALUE="true"
9781 AC_MSG_CHECKING([whether to enable breakpad])
9782 if test "$enable_breakpad" != yes; then
9783     AC_MSG_RESULT([no])
9784 else
9785     AC_MSG_RESULT([yes])
9786     ENABLE_BREAKPAD="TRUE"
9787     AC_DEFINE(ENABLE_BREAKPAD)
9788     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9789     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9791     AC_MSG_CHECKING([for disable crash dump])
9792     if test "$enable_crashdump" = no; then
9793         DEFAULT_CRASHDUMP_VALUE="false"
9794         AC_MSG_RESULT([yes])
9795     else
9796        AC_MSG_RESULT([no])
9797     fi
9799     AC_MSG_CHECKING([for crashreport config])
9800     if test "$with_symbol_config" = "no"; then
9801         BREAKPAD_SYMBOL_CONFIG="invalid"
9802         AC_MSG_RESULT([no])
9803     else
9804         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9805         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9806         AC_MSG_RESULT([yes])
9807     fi
9808     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9810 AC_SUBST(ENABLE_BREAKPAD)
9811 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9813 dnl ==================================================================
9814 dnl libfuzzer
9815 dnl ==================================================================
9816 AC_MSG_CHECKING([whether to enable fuzzers])
9817 if test "$enable_fuzzers" != yes; then
9818     AC_MSG_RESULT([no])
9819 else
9820     AC_MSG_RESULT([yes])
9821     ENABLE_FUZZERS="TRUE"
9822     AC_DEFINE([ENABLE_FUZZERS],1)
9823     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9825 AC_SUBST(ENABLE_FUZZERS)
9827 dnl ===================================================================
9828 dnl Orcus
9829 dnl ===================================================================
9830 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9831 if test "$with_system_orcus" != "yes"; then
9832     if test "$SYSTEM_BOOST" = "TRUE"; then
9833         # ===========================================================
9834         # Determine if we are going to need to link with Boost.System
9835         # ===========================================================
9836         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9837         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9838         dnl in documentation has no effect.
9839         AC_MSG_CHECKING([if we need to link with Boost.System])
9840         AC_LANG_PUSH([C++])
9841         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9842                 @%:@include <boost/version.hpp>
9843             ]],[[
9844                 #if BOOST_VERSION >= 105000
9845                 #   error yes, we need to link with Boost.System
9846                 #endif
9847             ]])],[
9848                 AC_MSG_RESULT([no])
9849             ],[
9850                 AC_MSG_RESULT([yes])
9851                 AX_BOOST_SYSTEM
9852         ])
9853         AC_LANG_POP([C++])
9854     fi
9856 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9857 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9858 AC_SUBST([BOOST_SYSTEM_LIB])
9859 AC_SUBST(SYSTEM_LIBORCUS)
9861 dnl ===================================================================
9862 dnl HarfBuzz
9863 dnl ===================================================================
9864 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9865                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9866                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9868 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9869                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9870                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9872 if test "$COM" = "MSC"; then # override the above
9873     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9874     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9877 if test "$with_system_harfbuzz" = "yes"; then
9878     if test "$with_system_graphite" = "no"; then
9879         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9880     fi
9881     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9882     _save_libs="$LIBS"
9883     _save_cflags="$CFLAGS"
9884     LIBS="$LIBS $HARFBUZZ_LIBS"
9885     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9886     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9887     LIBS="$_save_libs"
9888     CFLAGS="$_save_cflags"
9889 else
9890     if test "$with_system_graphite" = "yes"; then
9891         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9892     fi
9895 AC_MSG_CHECKING([whether to use X11])
9896 dnl ***************************************
9897 dnl testing for X libraries and includes...
9898 dnl ***************************************
9899 if test "$USING_X11" = TRUE; then
9900     AC_DEFINE(HAVE_FEATURE_X11)
9902 AC_MSG_RESULT([$USING_X11])
9904 if test "$USING_X11" = TRUE; then
9905     AC_PATH_X
9906     AC_PATH_XTRA
9907     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9909     if test -z "$x_includes"; then
9910         x_includes="default_x_includes"
9911     fi
9912     if test -z "$x_libraries"; then
9913         x_libraries="default_x_libraries"
9914     fi
9915     CFLAGS="$CFLAGS $X_CFLAGS"
9916     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9917     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9918 else
9919     x_includes="no_x_includes"
9920     x_libraries="no_x_libraries"
9923 if test "$USING_X11" = TRUE; then
9924     dnl ===================================================================
9925     dnl Check for extension headers
9926     dnl ===================================================================
9927     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9928      [#include <X11/extensions/shape.h>])
9930     # vcl needs ICE and SM
9931     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9932     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9933         [AC_MSG_ERROR(ICE library not found)])
9934     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9935     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9936         [AC_MSG_ERROR(SM library not found)])
9939 dnl ===================================================================
9940 dnl Check for system Xrender
9941 dnl ===================================================================
9942 AC_MSG_CHECKING([whether to use Xrender])
9943 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9944     AC_MSG_RESULT([yes])
9945     PKG_CHECK_MODULES(XRENDER, xrender)
9946     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9947     FilterLibs "${XRENDER_LIBS}"
9948     XRENDER_LIBS="${filteredlibs}"
9949     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9950       [AC_MSG_ERROR(libXrender not found or functional)], [])
9951     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9952       [AC_MSG_ERROR(Xrender not found. install X)], [])
9953 else
9954     AC_MSG_RESULT([no])
9956 AC_SUBST(XRENDER_CFLAGS)
9957 AC_SUBST(XRENDER_LIBS)
9959 dnl ===================================================================
9960 dnl Check for XRandr
9961 dnl ===================================================================
9962 AC_MSG_CHECKING([whether to enable RandR support])
9963 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9964     AC_MSG_RESULT([yes])
9965     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9966     if test "$ENABLE_RANDR" != "TRUE"; then
9967         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9968                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9969         XRANDR_CFLAGS=" "
9970         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9971           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9972         XRANDR_LIBS="-lXrandr "
9973         ENABLE_RANDR="TRUE"
9974     fi
9975     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9976     FilterLibs "${XRANDR_LIBS}"
9977     XRANDR_LIBS="${filteredlibs}"
9978 else
9979     ENABLE_RANDR=""
9980     AC_MSG_RESULT([no])
9982 AC_SUBST(XRANDR_CFLAGS)
9983 AC_SUBST(XRANDR_LIBS)
9984 AC_SUBST(ENABLE_RANDR)
9986 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9987     if test -z "$WITH_WEBDAV"; then
9988         WITH_WEBDAV="serf"
9989     fi
9991 if test $_os = iOS -o $_os = Android; then
9992     WITH_WEBDAV="no"
9994 AC_MSG_CHECKING([for webdav library])
9995 case "$WITH_WEBDAV" in
9996 serf)
9997     AC_MSG_RESULT([serf])
9998     # Check for system apr-util
9999     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10000                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10001                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10002     if test "$COM" = "MSC"; then
10003         APR_LIB_DIR="LibR"
10004         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10005         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10006     fi
10008     # Check for system serf
10009     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10010     ;;
10011 neon)
10012     AC_MSG_RESULT([neon])
10013     # Check for system neon
10014     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10015     if test "$with_system_neon" = "yes"; then
10016         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10017     else
10018         NEON_VERSION=0295
10019     fi
10020     AC_SUBST(NEON_VERSION)
10021     ;;
10023     AC_MSG_RESULT([none, disabled])
10024     WITH_WEBDAV=""
10025     ;;
10026 esac
10027 AC_SUBST(WITH_WEBDAV)
10029 dnl ===================================================================
10030 dnl Check for disabling cve_tests
10031 dnl ===================================================================
10032 AC_MSG_CHECKING([whether to execute CVE tests])
10033 # If not explicitly enabled or disabled, default
10034 if test -z "$enable_cve_tests"; then
10035     case "$OS" in
10036     WNT)
10037         # Default cves off for Windows with its wild and wonderful
10038         # variety of AV software kicking in and panicking
10039         enable_cve_tests=no
10040         ;;
10041     *)
10042         # otherwise yes
10043         enable_cve_tests=yes
10044         ;;
10045     esac
10047 if test "$enable_cve_tests" = "no"; then
10048     AC_MSG_RESULT([no])
10049     DISABLE_CVE_TESTS=TRUE
10050     AC_SUBST(DISABLE_CVE_TESTS)
10051 else
10052     AC_MSG_RESULT([yes])
10055 dnl ===================================================================
10056 dnl Check for enabling chart XShape tests
10057 dnl ===================================================================
10058 AC_MSG_CHECKING([whether to execute chart XShape tests])
10059 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10060     AC_MSG_RESULT([yes])
10061     ENABLE_CHART_TESTS=TRUE
10062     AC_SUBST(ENABLE_CHART_TESTS)
10063 else
10064     AC_MSG_RESULT([no])
10067 dnl ===================================================================
10068 dnl Check for system openssl
10069 dnl ===================================================================
10070 DISABLE_OPENSSL=
10071 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10072 if test "$enable_openssl" = "yes"; then
10073     AC_MSG_RESULT([no])
10074     if test "$_os" = Darwin ; then
10075         # OpenSSL is deprecated when building for 10.7 or later.
10076         #
10077         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10078         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10080         with_system_openssl=no
10081         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10082     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10083             && test "$with_system_openssl" != "no"; then
10084         with_system_openssl=yes
10085         SYSTEM_OPENSSL=TRUE
10086         OPENSSL_CFLAGS=
10087         OPENSSL_LIBS="-lssl -lcrypto"
10088     else
10089         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10090     fi
10091     if test "$with_system_openssl" = "yes"; then
10092         AC_MSG_CHECKING([whether openssl supports SHA512])
10093         AC_LANG_PUSH([C])
10094         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10095             SHA512_CTX context;
10096 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10097         AC_LANG_POP(C)
10098     fi
10099 else
10100     AC_MSG_RESULT([yes])
10101     DISABLE_OPENSSL=TRUE
10103     # warn that although OpenSSL is disabled, system libraries may depend on it
10104     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10105     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10108 AC_SUBST([DISABLE_OPENSSL])
10110 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10111     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10112         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10113         enable_cipher_openssl_backend=no
10114     else
10115         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10116     fi
10118 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10119 ENABLE_CIPHER_OPENSSL_BACKEND=
10120 if test "$enable_cipher_openssl_backend" = yes; then
10121     AC_MSG_RESULT([yes])
10122     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10123 else
10124     AC_MSG_RESULT([no])
10126 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10128 dnl ===================================================================
10129 dnl Check for building gnutls
10130 dnl ===================================================================
10131 AC_MSG_CHECKING([whether to use gnutls])
10132 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10133     AC_MSG_RESULT([yes])
10134     AM_PATH_LIBGCRYPT()
10135     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10136         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10137                       available in the system to use as replacement.]]))
10138     FilterLibs "${LIBGCRYPT_LIBS}"
10139     LIBGCRYPT_LIBS="${filteredlibs}"
10140 else
10141     AC_MSG_RESULT([no])
10144 AC_SUBST([LIBGCRYPT_CFLAGS])
10145 AC_SUBST([LIBGCRYPT_LIBS])
10147 dnl ===================================================================
10148 dnl Check for system redland
10149 dnl ===================================================================
10150 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10151 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10152 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10153 if test "$with_system_redland" = "yes"; then
10154     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10155             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10156 else
10157     RAPTOR_MAJOR="0"
10158     RASQAL_MAJOR="3"
10159     REDLAND_MAJOR="0"
10161 AC_SUBST(RAPTOR_MAJOR)
10162 AC_SUBST(RASQAL_MAJOR)
10163 AC_SUBST(REDLAND_MAJOR)
10165 dnl ===================================================================
10166 dnl Check for system hunspell
10167 dnl ===================================================================
10168 AC_MSG_CHECKING([which libhunspell to use])
10169 if test "$with_system_hunspell" = "yes"; then
10170     AC_MSG_RESULT([external])
10171     SYSTEM_HUNSPELL=TRUE
10172     AC_LANG_PUSH([C++])
10173     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10174     if test "$HUNSPELL_PC" != "TRUE"; then
10175         AC_CHECK_HEADER(hunspell.hxx, [],
10176             [
10177             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10178             [AC_MSG_ERROR(hunspell headers not found.)], [])
10179             ], [])
10180         AC_CHECK_LIB([hunspell], [main], [:],
10181            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10182         HUNSPELL_LIBS=-lhunspell
10183     fi
10184     AC_LANG_POP([C++])
10185     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10186     FilterLibs "${HUNSPELL_LIBS}"
10187     HUNSPELL_LIBS="${filteredlibs}"
10188 else
10189     AC_MSG_RESULT([internal])
10190     SYSTEM_HUNSPELL=
10191     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10192     if test "$COM" = "MSC"; then
10193         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10194     else
10195         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10196     fi
10197     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10199 AC_SUBST(SYSTEM_HUNSPELL)
10200 AC_SUBST(HUNSPELL_CFLAGS)
10201 AC_SUBST(HUNSPELL_LIBS)
10203 dnl ===================================================================
10204 dnl Check for system qrcodegen
10205 dnl ===================================================================
10206 AC_MSG_CHECKING([whether to use libqrcodegen])
10207 if test "$enable_qrcodegen" = "no"; then
10208     AC_MSG_RESULT([no])
10209     ENABLE_QRCODEGEN=
10210     SYSTEM_QRCODEGEN=
10211 else
10212     AC_MSG_RESULT([yes])
10213     ENABLE_QRCODEGEN=TRUE
10214     AC_MSG_CHECKING([which libqrcodegen to use])
10215     if test "$with_system_qrcodegen" = "yes"; then
10216         AC_MSG_RESULT([external])
10217         SYSTEM_QRCODEGEN=TRUE
10218         AC_LANG_PUSH([C++])
10219         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10220             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10221         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10222             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10223         QRCODEGEN_LIBS=-lqrcodegencpp
10224         AC_LANG_POP([C++])
10225         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10226         FilterLibs "${QRCODEGEN_LIBS}"
10227         QRCODEGEN_LIBS="${filteredlibs}"
10228     else
10229         AC_MSG_RESULT([internal])
10230         SYSTEM_QRCODEGEN=
10231         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10232     fi
10233     if test "$ENABLE_QRCODEGEN" = TRUE; then
10234         AC_DEFINE(ENABLE_QRCODEGEN)
10235     fi
10237 AC_SUBST(SYSTEM_QRCODEGEN)
10238 AC_SUBST(ENABLE_QRCODEGEN)
10239 AC_SUBST(QRCODEGEN_CFLAGS)
10240 AC_SUBST(QRCODEGEN_LIBS)
10242 dnl ===================================================================
10243 dnl Checking for altlinuxhyph
10244 dnl ===================================================================
10245 AC_MSG_CHECKING([which altlinuxhyph to use])
10246 if test "$with_system_altlinuxhyph" = "yes"; then
10247     AC_MSG_RESULT([external])
10248     SYSTEM_HYPH=TRUE
10249     AC_CHECK_HEADER(hyphen.h, [],
10250        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10251     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10252        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10253        [#include <hyphen.h>])
10254     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10255         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10256     if test -z "$HYPHEN_LIB"; then
10257         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10258            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10259     fi
10260     if test -z "$HYPHEN_LIB"; then
10261         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10262            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10263     fi
10264 else
10265     AC_MSG_RESULT([internal])
10266     SYSTEM_HYPH=
10267     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10268     if test "$COM" = "MSC"; then
10269         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10270     else
10271         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10272     fi
10274 AC_SUBST(SYSTEM_HYPH)
10275 AC_SUBST(HYPHEN_LIB)
10277 dnl ===================================================================
10278 dnl Checking for mythes
10279 dnl ===================================================================
10280 AC_MSG_CHECKING([which mythes to use])
10281 if test "$with_system_mythes" = "yes"; then
10282     AC_MSG_RESULT([external])
10283     SYSTEM_MYTHES=TRUE
10284     AC_LANG_PUSH([C++])
10285     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10286     if test "$MYTHES_PKGCONFIG" = "no"; then
10287         AC_CHECK_HEADER(mythes.hxx, [],
10288             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10289         AC_CHECK_LIB([mythes-1.2], [main], [:],
10290             [ MYTHES_FOUND=no], [])
10291     if test "$MYTHES_FOUND" = "no"; then
10292         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10293                 [ MYTHES_FOUND=no], [])
10294     fi
10295     if test "$MYTHES_FOUND" = "no"; then
10296         AC_MSG_ERROR([mythes library not found!.])
10297     fi
10298     fi
10299     AC_LANG_POP([C++])
10300     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10301     FilterLibs "${MYTHES_LIBS}"
10302     MYTHES_LIBS="${filteredlibs}"
10303 else
10304     AC_MSG_RESULT([internal])
10305     SYSTEM_MYTHES=
10306     BUILD_TYPE="$BUILD_TYPE MYTHES"
10307     if test "$COM" = "MSC"; then
10308         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10309     else
10310         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10311     fi
10313 AC_SUBST(SYSTEM_MYTHES)
10314 AC_SUBST(MYTHES_CFLAGS)
10315 AC_SUBST(MYTHES_LIBS)
10317 dnl ===================================================================
10318 dnl How should we build the linear programming solver ?
10319 dnl ===================================================================
10321 ENABLE_COINMP=
10322 AC_MSG_CHECKING([whether to build with CoinMP])
10323 if test "$enable_coinmp" != "no"; then
10324     ENABLE_COINMP=TRUE
10325     AC_MSG_RESULT([yes])
10326     if test "$with_system_coinmp" = "yes"; then
10327         SYSTEM_COINMP=TRUE
10328         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10329         FilterLibs "${COINMP_LIBS}"
10330         COINMP_LIBS="${filteredlibs}"
10331     else
10332         BUILD_TYPE="$BUILD_TYPE COINMP"
10333     fi
10334 else
10335     AC_MSG_RESULT([no])
10337 AC_SUBST(ENABLE_COINMP)
10338 AC_SUBST(SYSTEM_COINMP)
10339 AC_SUBST(COINMP_CFLAGS)
10340 AC_SUBST(COINMP_LIBS)
10342 ENABLE_LPSOLVE=
10343 AC_MSG_CHECKING([whether to build with lpsolve])
10344 if test "$enable_lpsolve" != "no"; then
10345     ENABLE_LPSOLVE=TRUE
10346     AC_MSG_RESULT([yes])
10347 else
10348     AC_MSG_RESULT([no])
10350 AC_SUBST(ENABLE_LPSOLVE)
10352 if test "$ENABLE_LPSOLVE" = TRUE; then
10353     AC_MSG_CHECKING([which lpsolve to use])
10354     if test "$with_system_lpsolve" = "yes"; then
10355         AC_MSG_RESULT([external])
10356         SYSTEM_LPSOLVE=TRUE
10357         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10358            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10359         save_LIBS=$LIBS
10360         # some systems need this. Like Ubuntu...
10361         AC_CHECK_LIB(m, floor)
10362         AC_CHECK_LIB(dl, dlopen)
10363         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10364             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10365         LIBS=$save_LIBS
10366     else
10367         AC_MSG_RESULT([internal])
10368         SYSTEM_LPSOLVE=
10369         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10370     fi
10372 AC_SUBST(SYSTEM_LPSOLVE)
10374 dnl ===================================================================
10375 dnl Checking for libexttextcat
10376 dnl ===================================================================
10377 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10378 if test "$with_system_libexttextcat" = "yes"; then
10379     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10381 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10383 dnl ===================================================================
10384 dnl Checking for libnumbertext
10385 dnl ===================================================================
10386 AC_MSG_CHECKING([whether to use libnumbertext])
10387 if test "$enable_libnumbertext" = "no"; then
10388     AC_MSG_RESULT([no])
10389     ENABLE_LIBNUMBERTEXT=
10390     SYSTEM_LIBNUMBERTEXT=
10391 else
10392     AC_MSG_RESULT([yes])
10393     ENABLE_LIBNUMBERTEXT=TRUE
10394     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10395     if test "$with_system_libnumbertext" = "yes"; then
10396         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10397         SYSTEM_LIBNUMBERTEXT=YES
10398     else
10399         SYSTEM_LIBNUMBERTEXT=
10400         AC_LANG_PUSH([C++])
10401         save_CPPFLAGS=$CPPFLAGS
10402         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10403         AC_CHECK_HEADERS([codecvt regex])
10404         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10405                 [ ENABLE_LIBNUMBERTEXT=''
10406                   LIBNUMBERTEXT_CFLAGS=''
10407                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10408                                Enable libnumbertext fallback (missing number to number name conversion).])
10409                 ])
10410         CPPFLAGS=$save_CPPFLAGS
10411         AC_LANG_POP([C++])
10412     fi
10413     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10414         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10415     fi
10417 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10418 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10419 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10420 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10422 dnl ***************************************
10423 dnl testing libc version for Linux...
10424 dnl ***************************************
10425 if test "$_os" = "Linux"; then
10426     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10427     exec 6>/dev/null # no output
10428     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10429     exec 6>&1 # output on again
10430     if test "$HAVE_LIBC"; then
10431         AC_MSG_RESULT([yes])
10432     else
10433         AC_MSG_ERROR([no, upgrade libc])
10434     fi
10437 dnl =========================================
10438 dnl Check for uuidgen
10439 dnl =========================================
10440 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10441     # presence is already tested above in the WINDOWS_SDK_HOME check
10442     UUIDGEN=uuidgen.exe
10443     AC_SUBST(UUIDGEN)
10444 else
10445     AC_PATH_PROG([UUIDGEN], [uuidgen])
10446     if test -z "$UUIDGEN"; then
10447         AC_MSG_WARN([uuid is needed for building installation sets])
10448     fi
10451 dnl ***************************************
10452 dnl Checking for bison and flex
10453 dnl ***************************************
10454 AC_PATH_PROG(BISON, bison)
10455 if test -z "$BISON"; then
10456     AC_MSG_ERROR([no bison found in \$PATH, install it])
10457 else
10458     AC_MSG_CHECKING([the bison version])
10459     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10460     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10461     # Accept newer than 2.0
10462     if test "$_bison_longver" -lt 2000; then
10463         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10464     fi
10467 AC_PATH_PROG(FLEX, flex)
10468 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10469     FLEX=`cygpath -m $FLEX`
10471 if test -z "$FLEX"; then
10472     AC_MSG_ERROR([no flex found in \$PATH, install it])
10473 else
10474     AC_MSG_CHECKING([the flex version])
10475     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10476     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10477         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10478     fi
10480 AC_SUBST([FLEX])
10481 dnl ***************************************
10482 dnl Checking for patch
10483 dnl ***************************************
10484 AC_PATH_PROG(PATCH, patch)
10485 if test -z "$PATCH"; then
10486     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10489 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10490 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10491     if test -z "$with_gnu_patch"; then
10492         GNUPATCH=$PATCH
10493     else
10494         if test -x "$with_gnu_patch"; then
10495             GNUPATCH=$with_gnu_patch
10496         else
10497             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10498         fi
10499     fi
10501     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10502     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10503         AC_MSG_RESULT([yes])
10504     else
10505         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10506     fi
10507 else
10508     GNUPATCH=$PATCH
10511 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10512     GNUPATCH=`cygpath -m $GNUPATCH`
10515 dnl We also need to check for --with-gnu-cp
10517 if test -z "$with_gnu_cp"; then
10518     # check the place where the good stuff is hidden on Solaris...
10519     if test -x /usr/gnu/bin/cp; then
10520         GNUCP=/usr/gnu/bin/cp
10521     else
10522         AC_PATH_PROGS(GNUCP, gnucp cp)
10523     fi
10524     if test -z $GNUCP; then
10525         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10526     fi
10527 else
10528     if test -x "$with_gnu_cp"; then
10529         GNUCP=$with_gnu_cp
10530     else
10531         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10532     fi
10535 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10536     GNUCP=`cygpath -m $GNUCP`
10539 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10540 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10541     AC_MSG_RESULT([yes])
10542 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10543     AC_MSG_RESULT([yes])
10544 else
10545     case "$build_os" in
10546     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10547         x_GNUCP=[\#]
10548         GNUCP=''
10549         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10550         ;;
10551     *)
10552         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10553         ;;
10554     esac
10557 AC_SUBST(GNUPATCH)
10558 AC_SUBST(GNUCP)
10559 AC_SUBST(x_GNUCP)
10561 dnl ***************************************
10562 dnl testing assembler path
10563 dnl ***************************************
10564 ML_EXE=""
10565 if test "$_os" = "WINNT"; then
10566     if test "$BITNESS_OVERRIDE" = ""; then
10567         assembler=ml.exe
10568     else
10569         assembler=ml64.exe
10570     fi
10572     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10573     if test -f "$CL_PATH/$assembler"; then
10574         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10575         AC_MSG_RESULT([$ML_EXE])
10576     else
10577         AC_MSG_ERROR([not found])
10578     fi
10581 AC_SUBST(ML_EXE)
10583 dnl ===================================================================
10584 dnl We need zip and unzip
10585 dnl ===================================================================
10586 AC_PATH_PROG(ZIP, zip)
10587 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10588 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10589     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],,)
10592 AC_PATH_PROG(UNZIP, unzip)
10593 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10595 dnl ===================================================================
10596 dnl Zip must be a specific type for different build types.
10597 dnl ===================================================================
10598 if test $build_os = cygwin; then
10599     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10600         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10601     fi
10604 dnl ===================================================================
10605 dnl We need touch with -h option support.
10606 dnl ===================================================================
10607 AC_PATH_PROG(TOUCH, touch)
10608 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10609 touch warn
10610 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10611     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],,)
10614 dnl ===================================================================
10615 dnl Check for system epoxy
10616 dnl ===================================================================
10617 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10619 dnl ===================================================================
10620 dnl Set vcl option: coordinate device in double or sal_Int32
10621 dnl ===================================================================
10623 dnl disabled for now, we don't want subtle differences between OSs
10624 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10625 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10626 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10627 dnl     AC_MSG_RESULT([double])
10628 dnl else
10629 dnl     AC_MSG_RESULT([sal_Int32])
10630 dnl fi
10632 dnl ===================================================================
10633 dnl Test which vclplugs have to be built.
10634 dnl ===================================================================
10635 R=""
10636 if test "$USING_X11" != TRUE; then
10637     enable_gtk3=no
10639 GTK3_CFLAGS=""
10640 GTK3_LIBS=""
10641 ENABLE_GTK3=""
10642 if test "x$enable_gtk3" = "xyes"; then
10643     if test "$with_system_cairo" = no; then
10644         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10645     fi
10646     : ${with_system_cairo:=yes}
10647     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="")
10648     if test "x$ENABLE_GTK3" = "xTRUE"; then
10649         AC_DEFINE(ENABLE_GTK3)
10650         R="gtk3"
10651     else
10652         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10653     fi
10654     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10655     FilterLibs "${GTK3_LIBS}"
10656     GTK3_LIBS="${filteredlibs}"
10658     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10659     if test "$with_system_epoxy" != "yes"; then
10660         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10661         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10662                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10663     fi
10665 AC_SUBST(GTK3_LIBS)
10666 AC_SUBST(GTK3_CFLAGS)
10667 AC_SUBST(ENABLE_GTK3)
10669 if test "$enable_introspection" = yes; then
10670     if test "$ENABLE_GTK3" = TRUE; then
10671         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10672     else
10673         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10674     fi
10677 ENABLE_QT5=""
10678 if test "x$enable_qt5" = "xyes"; then
10679     ENABLE_QT5="TRUE"
10680     AC_DEFINE(ENABLE_QT5)
10681     R="$R qt5"
10683 AC_SUBST(ENABLE_QT5)
10685 ENABLE_KF5=""
10686 if test "x$enable_kf5" = "xyes"; then
10687     ENABLE_KF5="TRUE"
10688     AC_DEFINE(ENABLE_KF5)
10689     R="$R kf5"
10691 AC_SUBST(ENABLE_KF5)
10693 ENABLE_GTK3_KDE5=""
10694 if test "x$enable_gtk3_kde5" = "xyes"; then
10695     ENABLE_GTK3_KDE5="TRUE"
10696     AC_DEFINE(ENABLE_GTK3_KDE5)
10697     R="$R gtk3_kde5"
10699 AC_SUBST(ENABLE_GTK3_KDE5)
10701 if test "$_os" = "WINNT"; then
10702     R="$R win"
10703 elif test "$_os" = "Darwin"; then
10704     R="$R osx"
10705 elif test "$_os" = "iOS"; then
10706     R="ios (builtin)"
10709 build_vcl_plugins="$R"
10710 if test -z "$build_vcl_plugins"; then
10711     build_vcl_plugins="none"
10713 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10715 dnl ===================================================================
10716 dnl check for dbus support
10717 dnl ===================================================================
10718 ENABLE_DBUS=""
10719 DBUS_CFLAGS=""
10720 DBUS_LIBS=""
10721 DBUS_GLIB_CFLAGS=""
10722 DBUS_GLIB_LIBS=""
10723 DBUS_HAVE_GLIB=""
10725 if test "$enable_dbus" = "no"; then
10726     test_dbus=no
10729 AC_MSG_CHECKING([whether to enable DBUS support])
10730 if test "$test_dbus" = "yes"; then
10731     ENABLE_DBUS="TRUE"
10732     AC_MSG_RESULT([yes])
10733     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10734     AC_DEFINE(ENABLE_DBUS)
10735     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10736     FilterLibs "${DBUS_LIBS}"
10737     DBUS_LIBS="${filteredlibs}"
10739     # Glib is needed for BluetoothServer
10740     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10741     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10742         [
10743             DBUS_HAVE_GLIB="TRUE"
10744             AC_DEFINE(DBUS_HAVE_GLIB,1)
10745         ],
10746         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10747     )
10748 else
10749     AC_MSG_RESULT([no])
10752 AC_SUBST(ENABLE_DBUS)
10753 AC_SUBST(DBUS_CFLAGS)
10754 AC_SUBST(DBUS_LIBS)
10755 AC_SUBST(DBUS_GLIB_CFLAGS)
10756 AC_SUBST(DBUS_GLIB_LIBS)
10757 AC_SUBST(DBUS_HAVE_GLIB)
10759 AC_MSG_CHECKING([whether to enable Impress remote control])
10760 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10761     AC_MSG_RESULT([yes])
10762     ENABLE_SDREMOTE=TRUE
10763     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10765     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10766         # The Bluetooth code doesn't compile with macOS SDK 10.15
10767         enable_sdremote_bluetooth=no
10768     fi
10769     # If not explicitly enabled or disabled, default
10770     if test -z "$enable_sdremote_bluetooth"; then
10771         case "$OS" in
10772         LINUX|MACOSX|WNT)
10773             # Default to yes for these
10774             enable_sdremote_bluetooth=yes
10775             ;;
10776         *)
10777             # otherwise no
10778             enable_sdremote_bluetooth=no
10779             ;;
10780         esac
10781     fi
10782     # $enable_sdremote_bluetooth is guaranteed non-empty now
10784     if test "$enable_sdremote_bluetooth" != "no"; then
10785         if test "$OS" = "LINUX"; then
10786             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10787                 AC_MSG_RESULT([yes])
10788                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10789                 dnl ===================================================================
10790                 dnl Check for system bluez
10791                 dnl ===================================================================
10792                 AC_MSG_CHECKING([which Bluetooth header to use])
10793                 if test "$with_system_bluez" = "yes"; then
10794                     AC_MSG_RESULT([external])
10795                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10796                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10797                     SYSTEM_BLUEZ=TRUE
10798                 else
10799                     AC_MSG_RESULT([internal])
10800                     SYSTEM_BLUEZ=
10801                 fi
10802             else
10803                 AC_MSG_RESULT([no, dbus disabled])
10804                 ENABLE_SDREMOTE_BLUETOOTH=
10805                 SYSTEM_BLUEZ=
10806             fi
10807         else
10808             AC_MSG_RESULT([yes])
10809             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10810             SYSTEM_BLUEZ=
10811         fi
10812     else
10813         AC_MSG_RESULT([no])
10814         ENABLE_SDREMOTE_BLUETOOTH=
10815         SYSTEM_BLUEZ=
10816     fi
10817 else
10818     ENABLE_SDREMOTE=
10819     SYSTEM_BLUEZ=
10820     AC_MSG_RESULT([no])
10822 AC_SUBST(ENABLE_SDREMOTE)
10823 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10824 AC_SUBST(SYSTEM_BLUEZ)
10826 dnl ===================================================================
10827 dnl Check whether to enable GIO support
10828 dnl ===================================================================
10829 if test "$ENABLE_GTK3" = "TRUE"; then
10830     AC_MSG_CHECKING([whether to enable GIO support])
10831     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10832         dnl Need at least 2.26 for the dbus support.
10833         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10834                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10835         if test "$ENABLE_GIO" = "TRUE"; then
10836             AC_DEFINE(ENABLE_GIO)
10837             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10838             FilterLibs "${GIO_LIBS}"
10839             GIO_LIBS="${filteredlibs}"
10840         fi
10841     else
10842         AC_MSG_RESULT([no])
10843     fi
10845 AC_SUBST(ENABLE_GIO)
10846 AC_SUBST(GIO_CFLAGS)
10847 AC_SUBST(GIO_LIBS)
10850 dnl ===================================================================
10852 SPLIT_APP_MODULES=""
10853 if test "$enable_split_app_modules" = "yes"; then
10854     SPLIT_APP_MODULES="TRUE"
10856 AC_SUBST(SPLIT_APP_MODULES)
10858 SPLIT_OPT_FEATURES=""
10859 if test "$enable_split_opt_features" = "yes"; then
10860     SPLIT_OPT_FEATURES="TRUE"
10862 AC_SUBST(SPLIT_OPT_FEATURES)
10864 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10865     if test "$enable_cairo_canvas" = yes; then
10866         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10867     fi
10868     enable_cairo_canvas=no
10869 elif test -z "$enable_cairo_canvas"; then
10870     enable_cairo_canvas=yes
10873 ENABLE_CAIRO_CANVAS=""
10874 if test "$enable_cairo_canvas" = "yes"; then
10875     test_cairo=yes
10876     ENABLE_CAIRO_CANVAS="TRUE"
10877     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10879 AC_SUBST(ENABLE_CAIRO_CANVAS)
10881 dnl ===================================================================
10882 dnl Check whether the GStreamer libraries are available.
10883 dnl ===================================================================
10885 ENABLE_GSTREAMER_1_0=""
10887 if test "$build_gstreamer_1_0" = "yes"; then
10889     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10890     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10891         ENABLE_GSTREAMER_1_0="TRUE"
10892         AC_MSG_RESULT([yes])
10893         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10894         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10895         FilterLibs "${GSTREAMER_1_0_LIBS}"
10896         GSTREAMER_1_0_LIBS="${filteredlibs}"
10897         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10898     else
10899         AC_MSG_RESULT([no])
10900     fi
10902 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10903 AC_SUBST(GSTREAMER_1_0_LIBS)
10904 AC_SUBST(ENABLE_GSTREAMER_1_0)
10906 dnl ===================================================================
10907 dnl Check whether to build the VLC avmedia backend
10908 dnl ===================================================================
10910 ENABLE_VLC=""
10912 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10913 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10914     ENABLE_VLC="TRUE"
10915     AC_MSG_RESULT([yes])
10916 else
10917     AC_MSG_RESULT([no])
10919 AC_SUBST(ENABLE_VLC)
10921 ENABLE_OPENGL_TRANSITIONS=
10922 ENABLE_OPENGL_CANVAS=
10923 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10924    : # disable
10925 elif test "$_os" = "Darwin"; then
10926     # We use frameworks on macOS, no need for detail checks
10927     ENABLE_OPENGL_TRANSITIONS=TRUE
10928     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10929     ENABLE_OPENGL_CANVAS=TRUE
10930 elif test $_os = WINNT; then
10931     ENABLE_OPENGL_TRANSITIONS=TRUE
10932     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10933     ENABLE_OPENGL_CANVAS=TRUE
10934 else
10935     if test "$USING_X11" = TRUE; then
10936         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10937         ENABLE_OPENGL_TRANSITIONS=TRUE
10938         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10939         ENABLE_OPENGL_CANVAS=TRUE
10940     fi
10943 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10944 AC_SUBST(ENABLE_OPENGL_CANVAS)
10946 dnl =================================================
10947 dnl Check whether to build with OpenCL support.
10948 dnl =================================================
10950 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10951     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10952     # platform (optional at run-time, used through clew).
10953     BUILD_TYPE="$BUILD_TYPE OPENCL"
10954     AC_DEFINE(HAVE_FEATURE_OPENCL)
10957 dnl =================================================
10958 dnl Check whether to build with dconf support.
10959 dnl =================================================
10961 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10962     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10963         if test "$enable_dconf" = yes; then
10964             AC_MSG_ERROR([dconf not found])
10965         else
10966             enable_dconf=no
10967         fi])
10969 AC_MSG_CHECKING([whether to enable dconf])
10970 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10971     DCONF_CFLAGS=
10972     DCONF_LIBS=
10973     ENABLE_DCONF=
10974     AC_MSG_RESULT([no])
10975 else
10976     ENABLE_DCONF=TRUE
10977     AC_DEFINE(ENABLE_DCONF)
10978     AC_MSG_RESULT([yes])
10980 AC_SUBST([DCONF_CFLAGS])
10981 AC_SUBST([DCONF_LIBS])
10982 AC_SUBST([ENABLE_DCONF])
10984 # pdf import?
10985 AC_MSG_CHECKING([whether to build the PDF import feature])
10986 ENABLE_PDFIMPORT=
10987 if test \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10988     AC_MSG_RESULT([yes])
10989     ENABLE_PDFIMPORT=TRUE
10990     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10991 else
10992     AC_MSG_RESULT([no])
10995 # Pdfium?
10996 AC_MSG_CHECKING([whether to build PDFium])
10997 ENABLE_PDFIUM=
10998 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10999     AC_MSG_RESULT([yes])
11000     ENABLE_PDFIUM=TRUE
11001     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11002     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11003 else
11004     AC_MSG_RESULT([no])
11006 AC_SUBST(ENABLE_PDFIUM)
11008 dnl ===================================================================
11009 dnl Check for poppler
11010 dnl ===================================================================
11011 ENABLE_POPPLER=
11012 AC_MSG_CHECKING([whether to build Poppler])
11013 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11014     AC_MSG_RESULT([yes])
11015     ENABLE_POPPLER=TRUE
11016     AC_DEFINE(HAVE_FEATURE_POPPLER)
11017 else
11018     AC_MSG_RESULT([no])
11020 AC_SUBST(ENABLE_POPPLER)
11022 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11023     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11026 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11027     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11030 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11031     dnl ===================================================================
11032     dnl Check for system poppler
11033     dnl ===================================================================
11034     AC_MSG_CHECKING([which PDF import poppler to use])
11035     if test "$with_system_poppler" = "yes"; then
11036         AC_MSG_RESULT([external])
11037         SYSTEM_POPPLER=TRUE
11038         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11039         AC_LANG_PUSH([C++])
11040         save_CXXFLAGS=$CXXFLAGS
11041         save_CPPFLAGS=$CPPFLAGS
11042         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11043         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11044         AC_CHECK_HEADER([cpp/poppler-version.h],
11045             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11046             [])
11047         CXXFLAGS=$save_CXXFLAGS
11048         CPPFLAGS=$save_CPPFLAGS
11049         AC_LANG_POP([C++])
11050         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11052         FilterLibs "${POPPLER_LIBS}"
11053         POPPLER_LIBS="${filteredlibs}"
11054     else
11055         AC_MSG_RESULT([internal])
11056         SYSTEM_POPPLER=
11057         BUILD_TYPE="$BUILD_TYPE POPPLER"
11058         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11059     fi
11060     AC_DEFINE([ENABLE_PDFIMPORT],1)
11062 AC_SUBST(ENABLE_PDFIMPORT)
11063 AC_SUBST(SYSTEM_POPPLER)
11064 AC_SUBST(POPPLER_CFLAGS)
11065 AC_SUBST(POPPLER_LIBS)
11067 SYSTEM_GPGMEPP=
11069 if test "$build_for_ios" = "YES"; then
11070     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11071     AC_MSG_RESULT([yes])
11072 elif test "$enable_mpl_subset" = "yes"; then
11073     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11074     AC_MSG_RESULT([yes])
11075 elif test "$enable_fuzzers" = "yes"; then
11076     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11077     AC_MSG_RESULT([yes])
11078 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11079     dnl ===================================================================
11080     dnl Check for system gpgme
11081     dnl ===================================================================
11082     AC_MSG_CHECKING([which gpgmepp to use])
11083     if test "$with_system_gpgmepp" = "yes"; then
11084         AC_MSG_RESULT([external])
11085         SYSTEM_GPGMEPP=TRUE
11087         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11088         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11089             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11090         # progress_callback is the only func with plain C linkage
11091         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11092         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11093             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11094         AC_CHECK_HEADER(gpgme.h, [],
11095             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11096     else
11097         AC_MSG_RESULT([internal])
11098         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11099         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11101         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11102         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11103         if test "$_os" != "WINNT"; then
11104             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11105             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11106         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11107             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11108         fi
11109     fi
11110     ENABLE_GPGMEPP=TRUE
11111     AC_DEFINE([HAVE_FEATURE_GPGME])
11112     AC_PATH_PROG(GPG, gpg)
11113     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11114     # so let's exclude that manually for the moment
11115     if test -n "$GPG" -a "$_os" != "WINNT"; then
11116         # make sure we not only have a working gpgme, but a full working
11117         # gpg installation to run OpenPGP signature verification
11118         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11119     fi
11120     if test "$_os" = "Linux"; then
11121       uid=`id -u`
11122       AC_MSG_CHECKING([for /run/user/$uid])
11123       if test -d /run/user/$uid; then
11124         AC_MSG_RESULT([yes])
11125         AC_PATH_PROG(GPGCONF, gpgconf)
11127         # Older versions of gpgconf are not working as expected, since
11128         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11129         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11130         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11131         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11132         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11133         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11134         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11135           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11136           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11137           if $GPGCONF --dump-options > /dev/null ; then
11138             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11139               AC_MSG_RESULT([yes])
11140               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11141               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11142             else
11143               AC_MSG_RESULT([no])
11144             fi
11145           else
11146             AC_MSG_RESULT([no. missing or broken gpgconf?])
11147           fi
11148         else
11149           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11150         fi
11151       else
11152         AC_MSG_RESULT([no])
11153      fi
11154    fi
11156 AC_SUBST(ENABLE_GPGMEPP)
11157 AC_SUBST(SYSTEM_GPGMEPP)
11158 AC_SUBST(GPG_ERROR_CFLAGS)
11159 AC_SUBST(GPG_ERROR_LIBS)
11160 AC_SUBST(LIBASSUAN_CFLAGS)
11161 AC_SUBST(LIBASSUAN_LIBS)
11162 AC_SUBST(GPGMEPP_CFLAGS)
11163 AC_SUBST(GPGMEPP_LIBS)
11165 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11166 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11167     AC_MSG_RESULT([yes])
11168     ENABLE_MEDIAWIKI=TRUE
11169     BUILD_TYPE="$BUILD_TYPE XSLTML"
11170     if test  "x$with_java" = "xno"; then
11171         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11172     fi
11173 else
11174     AC_MSG_RESULT([no])
11175     ENABLE_MEDIAWIKI=
11176     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11178 AC_SUBST(ENABLE_MEDIAWIKI)
11180 AC_MSG_CHECKING([whether to build the Report Builder])
11181 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11182     AC_MSG_RESULT([yes])
11183     ENABLE_REPORTBUILDER=TRUE
11184     AC_MSG_CHECKING([which jfreereport libs to use])
11185     if test "$with_system_jfreereport" = "yes"; then
11186         SYSTEM_JFREEREPORT=TRUE
11187         AC_MSG_RESULT([external])
11188         if test -z $SAC_JAR; then
11189             SAC_JAR=/usr/share/java/sac.jar
11190         fi
11191         if ! test -f $SAC_JAR; then
11192              AC_MSG_ERROR(sac.jar not found.)
11193         fi
11195         if test -z $LIBXML_JAR; then
11196             if test -f /usr/share/java/libxml-1.0.0.jar; then
11197                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11198             elif test -f /usr/share/java/libxml.jar; then
11199                 LIBXML_JAR=/usr/share/java/libxml.jar
11200             else
11201                 AC_MSG_ERROR(libxml.jar replacement not found.)
11202             fi
11203         elif ! test -f $LIBXML_JAR; then
11204             AC_MSG_ERROR(libxml.jar not found.)
11205         fi
11207         if test -z $FLUTE_JAR; then
11208             if test -f/usr/share/java/flute-1.3.0.jar; then
11209                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11210             elif test -f /usr/share/java/flute.jar; then
11211                 FLUTE_JAR=/usr/share/java/flute.jar
11212             else
11213                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11214             fi
11215         elif ! test -f $FLUTE_JAR; then
11216             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11217         fi
11219         if test -z $JFREEREPORT_JAR; then
11220             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11221                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11222             elif test -f /usr/share/java/flow-engine.jar; then
11223                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11224             else
11225                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11226             fi
11227         elif ! test -f  $JFREEREPORT_JAR; then
11228                 AC_MSG_ERROR(jfreereport.jar not found.)
11229         fi
11231         if test -z $LIBLAYOUT_JAR; then
11232             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11233                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11234             elif test -f /usr/share/java/liblayout.jar; then
11235                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11236             else
11237                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11238             fi
11239         elif ! test -f $LIBLAYOUT_JAR; then
11240                 AC_MSG_ERROR(liblayout.jar not found.)
11241         fi
11243         if test -z $LIBLOADER_JAR; then
11244             if test -f /usr/share/java/libloader-1.0.0.jar; then
11245                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11246             elif test -f /usr/share/java/libloader.jar; then
11247                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11248             else
11249                 AC_MSG_ERROR(libloader.jar replacement not found.)
11250             fi
11251         elif ! test -f  $LIBLOADER_JAR; then
11252             AC_MSG_ERROR(libloader.jar not found.)
11253         fi
11255         if test -z $LIBFORMULA_JAR; then
11256             if test -f /usr/share/java/libformula-0.2.0.jar; then
11257                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11258             elif test -f /usr/share/java/libformula.jar; then
11259                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11260             else
11261                 AC_MSG_ERROR(libformula.jar replacement not found.)
11262             fi
11263         elif ! test -f $LIBFORMULA_JAR; then
11264                 AC_MSG_ERROR(libformula.jar not found.)
11265         fi
11267         if test -z $LIBREPOSITORY_JAR; then
11268             if test -f /usr/share/java/librepository-1.0.0.jar; then
11269                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11270             elif test -f /usr/share/java/librepository.jar; then
11271                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11272             else
11273                 AC_MSG_ERROR(librepository.jar replacement not found.)
11274             fi
11275         elif ! test -f $LIBREPOSITORY_JAR; then
11276             AC_MSG_ERROR(librepository.jar not found.)
11277         fi
11279         if test -z $LIBFONTS_JAR; then
11280             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11281                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11282             elif test -f /usr/share/java/libfonts.jar; then
11283                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11284             else
11285                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11286             fi
11287         elif ! test -f $LIBFONTS_JAR; then
11288                 AC_MSG_ERROR(libfonts.jar not found.)
11289         fi
11291         if test -z $LIBSERIALIZER_JAR; then
11292             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11293                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11294             elif test -f /usr/share/java/libserializer.jar; then
11295                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11296             else
11297                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11298             fi
11299         elif ! test -f $LIBSERIALIZER_JAR; then
11300                 AC_MSG_ERROR(libserializer.jar not found.)
11301         fi
11303         if test -z $LIBBASE_JAR; then
11304             if test -f /usr/share/java/libbase-1.0.0.jar; then
11305                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11306             elif test -f /usr/share/java/libbase.jar; then
11307                 LIBBASE_JAR=/usr/share/java/libbase.jar
11308             else
11309                 AC_MSG_ERROR(libbase.jar replacement not found.)
11310             fi
11311         elif ! test -f $LIBBASE_JAR; then
11312             AC_MSG_ERROR(libbase.jar not found.)
11313         fi
11315     else
11316         AC_MSG_RESULT([internal])
11317         SYSTEM_JFREEREPORT=
11318         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11319         NEED_ANT=TRUE
11320     fi
11321 else
11322     AC_MSG_RESULT([no])
11323     ENABLE_REPORTBUILDER=
11324     SYSTEM_JFREEREPORT=
11326 AC_SUBST(ENABLE_REPORTBUILDER)
11327 AC_SUBST(SYSTEM_JFREEREPORT)
11328 AC_SUBST(SAC_JAR)
11329 AC_SUBST(LIBXML_JAR)
11330 AC_SUBST(FLUTE_JAR)
11331 AC_SUBST(JFREEREPORT_JAR)
11332 AC_SUBST(LIBBASE_JAR)
11333 AC_SUBST(LIBLAYOUT_JAR)
11334 AC_SUBST(LIBLOADER_JAR)
11335 AC_SUBST(LIBFORMULA_JAR)
11336 AC_SUBST(LIBREPOSITORY_JAR)
11337 AC_SUBST(LIBFONTS_JAR)
11338 AC_SUBST(LIBSERIALIZER_JAR)
11340 # this has to be here because both the Wiki Publisher and the SRB use
11341 # commons-logging
11342 COMMONS_LOGGING_VERSION=1.2
11343 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11344     AC_MSG_CHECKING([which Apache commons-* libs to use])
11345     if test "$with_system_apache_commons" = "yes"; then
11346         SYSTEM_APACHE_COMMONS=TRUE
11347         AC_MSG_RESULT([external])
11348         if test -z $COMMONS_LOGGING_JAR; then
11349             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11350                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11351            elif test -f /usr/share/java/commons-logging.jar; then
11352                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11353             else
11354                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11355             fi
11356         elif ! test -f $COMMONS_LOGGING_JAR; then
11357             AC_MSG_ERROR(commons-logging.jar not found.)
11358         fi
11359     else
11360         AC_MSG_RESULT([internal])
11361         SYSTEM_APACHE_COMMONS=
11362         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11363         NEED_ANT=TRUE
11364     fi
11366 AC_SUBST(SYSTEM_APACHE_COMMONS)
11367 AC_SUBST(COMMONS_LOGGING_JAR)
11368 AC_SUBST(COMMONS_LOGGING_VERSION)
11370 # scripting provider for BeanShell?
11371 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11372 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11373     AC_MSG_RESULT([yes])
11374     ENABLE_SCRIPTING_BEANSHELL=TRUE
11376     dnl ===================================================================
11377     dnl Check for system beanshell
11378     dnl ===================================================================
11379     AC_MSG_CHECKING([which beanshell to use])
11380     if test "$with_system_beanshell" = "yes"; then
11381         AC_MSG_RESULT([external])
11382         SYSTEM_BSH=TRUE
11383         if test -z $BSH_JAR; then
11384             BSH_JAR=/usr/share/java/bsh.jar
11385         fi
11386         if ! test -f $BSH_JAR; then
11387             AC_MSG_ERROR(bsh.jar not found.)
11388         fi
11389     else
11390         AC_MSG_RESULT([internal])
11391         SYSTEM_BSH=
11392         BUILD_TYPE="$BUILD_TYPE BSH"
11393     fi
11394 else
11395     AC_MSG_RESULT([no])
11396     ENABLE_SCRIPTING_BEANSHELL=
11397     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11399 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11400 AC_SUBST(SYSTEM_BSH)
11401 AC_SUBST(BSH_JAR)
11403 # scripting provider for JavaScript?
11404 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11405 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11406     AC_MSG_RESULT([yes])
11407     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11409     dnl ===================================================================
11410     dnl Check for system rhino
11411     dnl ===================================================================
11412     AC_MSG_CHECKING([which rhino to use])
11413     if test "$with_system_rhino" = "yes"; then
11414         AC_MSG_RESULT([external])
11415         SYSTEM_RHINO=TRUE
11416         if test -z $RHINO_JAR; then
11417             RHINO_JAR=/usr/share/java/js.jar
11418         fi
11419         if ! test -f $RHINO_JAR; then
11420             AC_MSG_ERROR(js.jar not found.)
11421         fi
11422     else
11423         AC_MSG_RESULT([internal])
11424         SYSTEM_RHINO=
11425         BUILD_TYPE="$BUILD_TYPE RHINO"
11426         NEED_ANT=TRUE
11427     fi
11428 else
11429     AC_MSG_RESULT([no])
11430     ENABLE_SCRIPTING_JAVASCRIPT=
11431     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11433 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11434 AC_SUBST(SYSTEM_RHINO)
11435 AC_SUBST(RHINO_JAR)
11437 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11438 # paths should be added to library search path. So lets put all 64-bit
11439 # platforms there.
11440 supports_multilib=
11441 case "$host_cpu" in
11442 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11443     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11444         supports_multilib="yes"
11445     fi
11446     ;;
11448     ;;
11449 esac
11451 dnl ===================================================================
11452 dnl QT5 Integration
11453 dnl ===================================================================
11455 QT5_CFLAGS=""
11456 QT5_LIBS=""
11457 QMAKE5="qmake"
11458 MOC5="moc"
11459 QT5_GOBJECT_CFLAGS=""
11460 QT5_GOBJECT_LIBS=""
11461 QT5_HAVE_GOBJECT=""
11462 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11463         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11464         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11465 then
11466     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11467     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11469     if test -n "$supports_multilib"; then
11470         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11471     fi
11473     qt5_test_include="QtWidgets/qapplication.h"
11474     qt5_test_library="libQt5Widgets.so"
11476     dnl Check for qmake5
11477     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11478     if test "$QMAKE5" = "no"; then
11479         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11480     else
11481         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11482         if test -z "$qmake5_test_ver"; then
11483             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11484         fi
11485         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11486         qt5_minimal_minor="6"
11487         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11488             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11489         else
11490             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11491         fi
11492     fi
11494     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11495     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11497     AC_MSG_CHECKING([for Qt5 headers])
11498     qt5_incdir="no"
11499     for inc_dir in $qt5_incdirs; do
11500         if test -r "$inc_dir/$qt5_test_include"; then
11501             qt5_incdir="$inc_dir"
11502             break
11503         fi
11504     done
11505     AC_MSG_RESULT([$qt5_incdir])
11506     if test "x$qt5_incdir" = "xno"; then
11507         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11508     fi
11510     AC_MSG_CHECKING([for Qt5 libraries])
11511     qt5_libdir="no"
11512     for lib_dir in $qt5_libdirs; do
11513         if test -r "$lib_dir/$qt5_test_library"; then
11514             qt5_libdir="$lib_dir"
11515             break
11516         fi
11517     done
11518     AC_MSG_RESULT([$qt5_libdir])
11519     if test "x$qt5_libdir" = "xno"; then
11520         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11521     fi
11523     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11524     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11525     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11527     if test "$USING_X11" = TRUE; then
11528         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11529         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11530             QT5_HAVE_XCB_ICCCM=1
11531             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11532         ],[
11533             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)])
11534             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11535         ])
11536         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11537         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11538         QT5_USING_X11=1
11539         AC_DEFINE(QT5_USING_X11)
11540     fi
11542     dnl Check for Meta Object Compiler
11544     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11545     if test "$MOC5" = "no"; then
11546         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11547 the root of your Qt installation by exporting QT5DIR before running "configure".])
11548     fi
11550     if test "$build_gstreamer_1_0" = "yes"; then
11551         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11552                 QT5_HAVE_GOBJECT=1
11553                 AC_DEFINE(QT5_HAVE_GOBJECT)
11554             ],
11555             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11556         )
11557     fi
11559 AC_SUBST(QT5_CFLAGS)
11560 AC_SUBST(QT5_LIBS)
11561 AC_SUBST(MOC5)
11562 AC_SUBST(QT5_GOBJECT_CFLAGS)
11563 AC_SUBST(QT5_GOBJECT_LIBS)
11564 AC_SUBST(QT5_HAVE_GOBJECT)
11566 dnl ===================================================================
11567 dnl KF5 Integration
11568 dnl ===================================================================
11570 KF5_CFLAGS=""
11571 KF5_LIBS=""
11572 KF5_CONFIG="kf5-config"
11573 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11574         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11575 then
11576     if test "$OS" = "HAIKU"; then
11577         haiku_arch="`echo $RTL_ARCH | tr X x`"
11578         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11579         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11580     fi
11582     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11583     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11584     if test -n "$supports_multilib"; then
11585         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11586     fi
11588     kf5_test_include="KF5/kcoreaddons_version.h"
11589     kf5_test_library="libKF5CoreAddons.so"
11590     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11592     dnl kf5 KDE4 support compatibility installed
11593     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11594     if test "$KF5_CONFIG" != "no"; then
11595         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11596         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11597     fi
11599     dnl Check for KF5 headers
11600     AC_MSG_CHECKING([for KF5 headers])
11601     kf5_incdir="no"
11602     for kf5_check in $kf5_incdirs; do
11603         if test -r "$kf5_check/$kf5_test_include"; then
11604             kf5_incdir="$kf5_check/KF5"
11605             break
11606         fi
11607     done
11608     AC_MSG_RESULT([$kf5_incdir])
11609     if test "x$kf5_incdir" = "xno"; then
11610         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11611     fi
11613     dnl Check for KF5 libraries
11614     AC_MSG_CHECKING([for KF5 libraries])
11615     kf5_libdir="no"
11616     for kf5_check in $kf5_libdirs; do
11617         if test -r "$kf5_check/$kf5_test_library"; then
11618             kf5_libdir="$kf5_check"
11619             break
11620         fi
11621     done
11623     AC_MSG_RESULT([$kf5_libdir])
11624     if test "x$kf5_libdir" = "xno"; then
11625         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11626     fi
11628     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"
11629     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11630     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11632     if test "$USING_X11" = TRUE; then
11633         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11634     fi
11636     AC_LANG_PUSH([C++])
11637     save_CXXFLAGS=$CXXFLAGS
11638     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11639     AC_MSG_CHECKING([whether KDE is >= 5.0])
11640        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11641 #include <kcoreaddons_version.h>
11643 int main(int argc, char **argv) {
11644        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11645        else return 1;
11647        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11648     CXXFLAGS=$save_CXXFLAGS
11649     AC_LANG_POP([C++])
11651 AC_SUBST(KF5_CFLAGS)
11652 AC_SUBST(KF5_LIBS)
11654 dnl ===================================================================
11655 dnl Test whether to include Evolution 2 support
11656 dnl ===================================================================
11657 AC_MSG_CHECKING([whether to enable evolution 2 support])
11658 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11659     AC_MSG_RESULT([yes])
11660     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11661     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11662     FilterLibs "${GOBJECT_LIBS}"
11663     GOBJECT_LIBS="${filteredlibs}"
11664     ENABLE_EVOAB2="TRUE"
11665 else
11666     ENABLE_EVOAB2=""
11667     AC_MSG_RESULT([no])
11669 AC_SUBST(ENABLE_EVOAB2)
11670 AC_SUBST(GOBJECT_CFLAGS)
11671 AC_SUBST(GOBJECT_LIBS)
11673 dnl ===================================================================
11674 dnl Test which themes to include
11675 dnl ===================================================================
11676 AC_MSG_CHECKING([which themes to include])
11677 # if none given use default subset of available themes
11678 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11679     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"
11682 WITH_THEMES=""
11683 if test "x$with_theme" != "xno"; then
11684     for theme in $with_theme; do
11685         case $theme in
11686         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" ;;
11687         default) real_theme=colibre ;;
11688         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11689         esac
11690         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11691     done
11693 AC_MSG_RESULT([$WITH_THEMES])
11694 AC_SUBST([WITH_THEMES])
11695 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11696 for theme in $with_theme; do
11697     case $theme in
11698     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11699     *) ;;
11700     esac
11701 done
11703 dnl ===================================================================
11704 dnl Test whether to integrate helppacks into the product's installer
11705 dnl ===================================================================
11706 AC_MSG_CHECKING([for helppack integration])
11707 if test "$with_helppack_integration" = "no"; then
11708     AC_MSG_RESULT([no integration])
11709 else
11710     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11711     AC_MSG_RESULT([integration])
11714 ###############################################################################
11715 # Extensions checking
11716 ###############################################################################
11717 AC_MSG_CHECKING([for extensions integration])
11718 if test "x$enable_extension_integration" != "xno"; then
11719     WITH_EXTENSION_INTEGRATION=TRUE
11720     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11721     AC_MSG_RESULT([yes, use integration])
11722 else
11723     WITH_EXTENSION_INTEGRATION=
11724     AC_MSG_RESULT([no, do not integrate])
11726 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11728 dnl Should any extra extensions be included?
11729 dnl There are standalone tests for each of these below.
11730 WITH_EXTRA_EXTENSIONS=
11731 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11733 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11734 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11735 if test "x$with_java" != "xno"; then
11736     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11737     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11740 AC_MSG_CHECKING([whether to build opens___.ttf])
11741 if test "$enable_build_opensymbol" = "yes"; then
11742     AC_MSG_RESULT([yes])
11743     AC_PATH_PROG(FONTFORGE, fontforge)
11744     if test -z "$FONTFORGE"; then
11745         AC_MSG_ERROR([fontforge not installed])
11746     fi
11747 else
11748     AC_MSG_RESULT([no])
11749     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11750     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11752 AC_SUBST(OPENSYMBOL_TTF)
11753 AC_SUBST(FONTFORGE)
11755 dnl ===================================================================
11756 dnl Test whether to include fonts
11757 dnl ===================================================================
11758 AC_MSG_CHECKING([whether to include third-party fonts])
11759 if test "$with_fonts" != "no"; then
11760     AC_MSG_RESULT([yes])
11761     WITH_FONTS=TRUE
11762     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11763     AC_DEFINE(HAVE_MORE_FONTS)
11764 else
11765     AC_MSG_RESULT([no])
11766     WITH_FONTS=
11767     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11769 AC_SUBST(WITH_FONTS)
11771 dnl Test whether to include more Google Noto fonts
11772 dnl ===================================================================
11773 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11774 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11775     AC_MSG_RESULT([no])
11776     WITH_NOTO_FONT=
11777 else
11778     AC_MSG_RESULT([yes])
11779     WITH_NOTO_FONT=TRUE
11780     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11781     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11783 AC_SUBST(WITH_NOTO_FONT)
11785 dnl ===================================================================
11786 dnl Test whether to enable online update service
11787 dnl ===================================================================
11788 AC_MSG_CHECKING([whether to enable online update])
11789 ENABLE_ONLINE_UPDATE=
11790 ENABLE_ONLINE_UPDATE_MAR=
11791 UPDATE_CONFIG=
11792 if test "$enable_online_update" = ""; then
11793     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11794         AC_MSG_RESULT([yes])
11795         ENABLE_ONLINE_UPDATE="TRUE"
11796     else
11797         AC_MSG_RESULT([no])
11798     fi
11799 else
11800     if test "$enable_online_update" = "mar"; then
11801         AC_MSG_RESULT([yes - MAR-based online update])
11802         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11803         if test "$with_update_config" = ""; then
11804             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11805         fi
11806         UPDATE_CONFIG="$with_update_config"
11807         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11808     elif test "$enable_online_update" = "yes"; then
11809         AC_MSG_RESULT([yes])
11810         ENABLE_ONLINE_UPDATE="TRUE"
11811     else
11812         AC_MSG_RESULT([no])
11813     fi
11815 AC_SUBST(ENABLE_ONLINE_UPDATE)
11816 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11817 AC_SUBST(UPDATE_CONFIG)
11819 dnl ===================================================================
11820 dnl Test whether we need bzip2
11821 dnl ===================================================================
11822 SYSTEM_BZIP2=
11823 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11824     AC_MSG_CHECKING([whether to use system bzip2])
11825     if test "$with_system_bzip2" = yes; then
11826         SYSTEM_BZIP2=TRUE
11827         AC_MSG_RESULT([yes])
11828         PKG_CHECK_MODULES(BZIP2, bzip2)
11829         FilterLibs "${BZIP2_LIBS}"
11830         BZIP2_LIBS="${filteredlibs}"
11831     else
11832         AC_MSG_RESULT([no])
11833         BUILD_TYPE="$BUILD_TYPE BZIP2"
11834     fi
11836 AC_SUBST(SYSTEM_BZIP2)
11837 AC_SUBST(BZIP2_CFLAGS)
11838 AC_SUBST(BZIP2_LIBS)
11840 dnl ===================================================================
11841 dnl Test whether to enable extension update
11842 dnl ===================================================================
11843 AC_MSG_CHECKING([whether to enable extension update])
11844 ENABLE_EXTENSION_UPDATE=
11845 if test "x$enable_extension_update" = "xno"; then
11846     AC_MSG_RESULT([no])
11847 else
11848     AC_MSG_RESULT([yes])
11849     ENABLE_EXTENSION_UPDATE="TRUE"
11850     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11851     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11853 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11856 dnl ===================================================================
11857 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11858 dnl ===================================================================
11859 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11860 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11861     AC_MSG_RESULT([no])
11862     ENABLE_SILENT_MSI=
11863 else
11864     AC_MSG_RESULT([yes])
11865     ENABLE_SILENT_MSI=TRUE
11866     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11868 AC_SUBST(ENABLE_SILENT_MSI)
11870 AC_MSG_CHECKING([whether and how to use Xinerama])
11871 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11872     if test "$x_libraries" = "default_x_libraries"; then
11873         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11874         if test "x$XINERAMALIB" = x; then
11875            XINERAMALIB="/usr/lib"
11876         fi
11877     else
11878         XINERAMALIB="$x_libraries"
11879     fi
11880     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11881         # we have both versions, let the user decide but use the dynamic one
11882         # per default
11883         USE_XINERAMA=TRUE
11884         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11885             XINERAMA_LINK=dynamic
11886         else
11887             XINERAMA_LINK=static
11888         fi
11889     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11890         # we have only the dynamic version
11891         USE_XINERAMA=TRUE
11892         XINERAMA_LINK=dynamic
11893     elif test -e "$XINERAMALIB/libXinerama.a"; then
11894         # static version
11895         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11896             USE_XINERAMA=TRUE
11897             XINERAMA_LINK=static
11898         else
11899             USE_XINERAMA=
11900             XINERAMA_LINK=none
11901         fi
11902     else
11903         # no Xinerama
11904         USE_XINERAMA=
11905         XINERAMA_LINK=none
11906     fi
11907     if test "$USE_XINERAMA" = "TRUE"; then
11908         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11909         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11910             [AC_MSG_ERROR(Xinerama header not found.)], [])
11911         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11912         if test "x$XEXTLIB" = x; then
11913            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11914         fi
11915         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11916         if test "$_os" = "FreeBSD"; then
11917             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11918         fi
11919         if test "$_os" = "Linux"; then
11920             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11921         fi
11922         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11923             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11924     else
11925         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11926     fi
11927 else
11928     USE_XINERAMA=
11929     XINERAMA_LINK=none
11930     AC_MSG_RESULT([no])
11932 AC_SUBST(USE_XINERAMA)
11933 AC_SUBST(XINERAMA_LINK)
11935 dnl ===================================================================
11936 dnl Test whether to build cairo or rely on the system version
11937 dnl ===================================================================
11939 if test "$USING_X11" = TRUE; then
11940     # Used in vcl/Library_vclplug_gen.mk
11941     test_cairo=yes
11944 if test "$test_cairo" = "yes"; then
11945     AC_MSG_CHECKING([whether to use the system cairo])
11947     : ${with_system_cairo:=$with_system_libs}
11948     if test "$with_system_cairo" = "yes"; then
11949         SYSTEM_CAIRO=TRUE
11950         AC_MSG_RESULT([yes])
11952         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11953         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11954         FilterLibs "${CAIRO_LIBS}"
11955         CAIRO_LIBS="${filteredlibs}"
11957         if test "$test_xrender" = "yes"; then
11958             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11959             AC_LANG_PUSH([C])
11960             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11961 #ifdef PictStandardA8
11962 #else
11963       return fail;
11964 #endif
11965 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11967             AC_LANG_POP([C])
11968         fi
11969     else
11970         SYSTEM_CAIRO=
11971         AC_MSG_RESULT([no])
11973         BUILD_TYPE="$BUILD_TYPE CAIRO"
11974     fi
11977 AC_SUBST(SYSTEM_CAIRO)
11978 AC_SUBST(CAIRO_CFLAGS)
11979 AC_SUBST(CAIRO_LIBS)
11981 dnl ===================================================================
11982 dnl Test whether to use avahi
11983 dnl ===================================================================
11984 if test "$_os" = "WINNT"; then
11985     # Windows uses bundled mDNSResponder
11986     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11987 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11988     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11989                       [ENABLE_AVAHI="TRUE"])
11990     AC_DEFINE(HAVE_FEATURE_AVAHI)
11991     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11992     FilterLibs "${AVAHI_LIBS}"
11993     AVAHI_LIBS="${filteredlibs}"
11996 AC_SUBST(ENABLE_AVAHI)
11997 AC_SUBST(AVAHI_CFLAGS)
11998 AC_SUBST(AVAHI_LIBS)
12000 dnl ===================================================================
12001 dnl Test whether to use liblangtag
12002 dnl ===================================================================
12003 SYSTEM_LIBLANGTAG=
12004 AC_MSG_CHECKING([whether to use system liblangtag])
12005 if test "$with_system_liblangtag" = yes; then
12006     SYSTEM_LIBLANGTAG=TRUE
12007     AC_MSG_RESULT([yes])
12008     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12009     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12010     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12011     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12012     FilterLibs "${LIBLANGTAG_LIBS}"
12013     LIBLANGTAG_LIBS="${filteredlibs}"
12014 else
12015     SYSTEM_LIBLANGTAG=
12016     AC_MSG_RESULT([no])
12017     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12018     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12019     if test "$COM" = "MSC"; then
12020         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12021     else
12022         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12023     fi
12025 AC_SUBST(SYSTEM_LIBLANGTAG)
12026 AC_SUBST(LIBLANGTAG_CFLAGS)
12027 AC_SUBST(LIBLANGTAG_LIBS)
12029 dnl ===================================================================
12030 dnl Test whether to build libpng or rely on the system version
12031 dnl ===================================================================
12033 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12035 dnl ===================================================================
12036 dnl Check for runtime JVM search path
12037 dnl ===================================================================
12038 if test "$ENABLE_JAVA" != ""; then
12039     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12040     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12041         AC_MSG_RESULT([yes])
12042         if ! test -d "$with_jvm_path"; then
12043             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12044         fi
12045         if ! test -d "$with_jvm_path"jvm; then
12046             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12047         fi
12048         JVM_ONE_PATH_CHECK="$with_jvm_path"
12049         AC_SUBST(JVM_ONE_PATH_CHECK)
12050     else
12051         AC_MSG_RESULT([no])
12052     fi
12055 dnl ===================================================================
12056 dnl Test for the presence of Ant and that it works
12057 dnl ===================================================================
12059 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12060     ANT_HOME=; export ANT_HOME
12061     WITH_ANT_HOME=; export WITH_ANT_HOME
12062     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12063         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12064             if test "$_os" = "WINNT"; then
12065                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12066             else
12067                 with_ant_home="$LODE_HOME/opt/ant"
12068             fi
12069         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12070             with_ant_home="$LODE_HOME/opt/ant"
12071         fi
12072     fi
12073     if test -z "$with_ant_home"; then
12074         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12075     else
12076         if test "$_os" = "WINNT"; then
12077             # AC_PATH_PROGS needs unix path
12078             with_ant_home=`cygpath -u "$with_ant_home"`
12079         fi
12080         AbsolutePath "$with_ant_home"
12081         with_ant_home=$absolute_path
12082         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12083         WITH_ANT_HOME=$with_ant_home
12084         ANT_HOME=$with_ant_home
12085     fi
12087     if test -z "$ANT"; then
12088         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12089     else
12090         # resolve relative or absolute symlink
12091         while test -h "$ANT"; do
12092             a_cwd=`pwd`
12093             a_basename=`basename "$ANT"`
12094             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12095             cd "`dirname "$ANT"`"
12096             cd "`dirname "$a_script"`"
12097             ANT="`pwd`"/"`basename "$a_script"`"
12098             cd "$a_cwd"
12099         done
12101         AC_MSG_CHECKING([if $ANT works])
12102         mkdir -p conftest.dir
12103         a_cwd=$(pwd)
12104         cd conftest.dir
12105         cat > conftest.java << EOF
12106         public class conftest {
12107             int testmethod(int a, int b) {
12108                     return a + b;
12109             }
12110         }
12113         cat > conftest.xml << EOF
12114         <project name="conftest" default="conftest">
12115         <target name="conftest">
12116             <javac srcdir="." includes="conftest.java">
12117             </javac>
12118         </target>
12119         </project>
12122         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12123         if test $? = 0 -a -f ./conftest.class; then
12124             AC_MSG_RESULT([Ant works])
12125             if test -z "$WITH_ANT_HOME"; then
12126                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12127                 if test -z "$ANT_HOME"; then
12128                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12129                 fi
12130             else
12131                 ANT_HOME="$WITH_ANT_HOME"
12132             fi
12133         else
12134             echo "configure: Ant test failed" >&5
12135             cat conftest.java >&5
12136             cat conftest.xml >&5
12137             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12138         fi
12139         cd "$a_cwd"
12140         rm -fr conftest.dir
12141     fi
12142     if test -z "$ANT_HOME"; then
12143         ANT_HOME="NO_ANT_HOME"
12144     else
12145         PathFormat "$ANT_HOME"
12146         ANT_HOME="$formatted_path"
12147         PathFormat "$ANT"
12148         ANT="$formatted_path"
12149     fi
12150     AC_SUBST(ANT_HOME)
12151     AC_SUBST(ANT)
12153     dnl Checking for ant.jar
12154     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12155         AC_MSG_CHECKING([Ant lib directory])
12156         if test -f $ANT_HOME/lib/ant.jar; then
12157             ANT_LIB="$ANT_HOME/lib"
12158         else
12159             if test -f $ANT_HOME/ant.jar; then
12160                 ANT_LIB="$ANT_HOME"
12161             else
12162                 if test -f /usr/share/java/ant.jar; then
12163                     ANT_LIB=/usr/share/java
12164                 else
12165                     if test -f /usr/share/ant-core/lib/ant.jar; then
12166                         ANT_LIB=/usr/share/ant-core/lib
12167                     else
12168                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12169                             ANT_LIB="$ANT_HOME/lib/ant"
12170                         else
12171                             if test -f /usr/share/lib/ant/ant.jar; then
12172                                 ANT_LIB=/usr/share/lib/ant
12173                             else
12174                                 AC_MSG_ERROR([Ant libraries not found!])
12175                             fi
12176                         fi
12177                     fi
12178                 fi
12179             fi
12180         fi
12181         PathFormat "$ANT_LIB"
12182         ANT_LIB="$formatted_path"
12183         AC_MSG_RESULT([Ant lib directory found.])
12184     fi
12185     AC_SUBST(ANT_LIB)
12187     ant_minver=1.6.0
12188     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12190     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12191     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12192     ant_version_major=`echo $ant_version | cut -d. -f1`
12193     ant_version_minor=`echo $ant_version | cut -d. -f2`
12194     echo "configure: ant_version $ant_version " >&5
12195     echo "configure: ant_version_major $ant_version_major " >&5
12196     echo "configure: ant_version_minor $ant_version_minor " >&5
12197     if test "$ant_version_major" -ge "2"; then
12198         AC_MSG_RESULT([yes, $ant_version])
12199     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12200         AC_MSG_RESULT([yes, $ant_version])
12201     else
12202         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12203     fi
12205     rm -f conftest* core core.* *.core
12208 OOO_JUNIT_JAR=
12209 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12210     AC_MSG_CHECKING([for JUnit 4])
12211     if test "$with_junit" = "yes"; then
12212         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12213             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12214         elif test -e /usr/share/java/junit4.jar; then
12215             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12216         else
12217            if test -e /usr/share/lib/java/junit.jar; then
12218               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12219            else
12220               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12221            fi
12222         fi
12223     else
12224         OOO_JUNIT_JAR=$with_junit
12225     fi
12226     if test "$_os" = "WINNT"; then
12227         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12228     fi
12229     printf 'import org.junit.Before;' > conftest.java
12230     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12231         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12232     else
12233         AC_MSG_ERROR(
12234 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12235  specify its pathname via --with-junit=..., or disable it via --without-junit])
12236     fi
12237     rm -f conftest.class conftest.java
12238     if test $OOO_JUNIT_JAR != ""; then
12239     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12240     fi
12242 AC_SUBST(OOO_JUNIT_JAR)
12244 HAMCREST_JAR=
12245 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12246     AC_MSG_CHECKING([for included Hamcrest])
12247     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12248     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12249         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12250     else
12251         AC_MSG_RESULT([Not included])
12252         AC_MSG_CHECKING([for standalone hamcrest jar.])
12253         if test "$with_hamcrest" = "yes"; then
12254             if test -e /usr/share/lib/java/hamcrest.jar; then
12255                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12256             elif test -e /usr/share/java/hamcrest/core.jar; then
12257                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12258             else
12259                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12260             fi
12261         else
12262             HAMCREST_JAR=$with_hamcrest
12263         fi
12264         if test "$_os" = "WINNT"; then
12265             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12266         fi
12267         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12268             AC_MSG_RESULT([$HAMCREST_JAR])
12269         else
12270             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),
12271                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12272         fi
12273     fi
12274     rm -f conftest.class conftest.java
12276 AC_SUBST(HAMCREST_JAR)
12279 AC_SUBST(SCPDEFS)
12282 # check for wget and curl
12284 WGET=
12285 CURL=
12287 if test "$enable_fetch_external" != "no"; then
12289 CURL=`which curl 2>/dev/null`
12291 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12292     # wget new enough?
12293     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12294     if test $? -eq 0; then
12295         WGET=$i
12296         break
12297     fi
12298 done
12300 if test -z "$WGET" -a -z "$CURL"; then
12301     AC_MSG_ERROR([neither wget nor curl found!])
12306 AC_SUBST(WGET)
12307 AC_SUBST(CURL)
12310 # check for sha256sum
12312 SHA256SUM=
12314 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12315     eval "$i -a 256 --version" > /dev/null 2>&1
12316     ret=$?
12317     if test $ret -eq 0; then
12318         SHA256SUM="$i -a 256"
12319         break
12320     fi
12321 done
12323 if test -z "$SHA256SUM"; then
12324     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12325         eval "$i --version" > /dev/null 2>&1
12326         ret=$?
12327         if test $ret -eq 0; then
12328             SHA256SUM=$i
12329             break
12330         fi
12331     done
12334 if test -z "$SHA256SUM"; then
12335     AC_MSG_ERROR([no sha256sum found!])
12338 AC_SUBST(SHA256SUM)
12340 dnl ===================================================================
12341 dnl Dealing with l10n options
12342 dnl ===================================================================
12343 AC_MSG_CHECKING([which languages to be built])
12344 # get list of all languages
12345 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12346 # the sed command does the following:
12347 #   + if a line ends with a backslash, append the next line to it
12348 #   + adds " on the beginning of the value (after =)
12349 #   + adds " at the end of the value
12350 #   + removes en-US; we want to put it on the beginning
12351 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12352 [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)]
12353 ALL_LANGS="en-US $completelangiso"
12354 # check the configured localizations
12355 WITH_LANG="$with_lang"
12357 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12358 # (Norwegian is "nb" and "nn".)
12359 if test "$WITH_LANG" = "no"; then
12360     WITH_LANG=
12363 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12364     AC_MSG_RESULT([en-US])
12365 else
12366     AC_MSG_RESULT([$WITH_LANG])
12367     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12368     if test -z "$MSGFMT"; then
12369         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12370             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12371         elif test -x "/opt/lo/bin/msgfmt"; then
12372             MSGFMT="/opt/lo/bin/msgfmt"
12373         else
12374             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12375             if test -z "$MSGFMT"; then
12376                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12377             fi
12378         fi
12379     fi
12380     if test -z "$MSGUNIQ"; then
12381         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12382             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12383         elif test -x "/opt/lo/bin/msguniq"; then
12384             MSGUNIQ="/opt/lo/bin/msguniq"
12385         else
12386             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12387             if test -z "$MSGUNIQ"; then
12388                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12389             fi
12390         fi
12391     fi
12393 AC_SUBST(MSGFMT)
12394 AC_SUBST(MSGUNIQ)
12395 # check that the list is valid
12396 for lang in $WITH_LANG; do
12397     test "$lang" = "ALL" && continue
12398     # need to check for the exact string, so add space before and after the list of all languages
12399     for vl in $ALL_LANGS; do
12400         if test "$vl" = "$lang"; then
12401            break
12402         fi
12403     done
12404     if test "$vl" != "$lang"; then
12405         # if you're reading this - you prolly quoted your languages remove the quotes ...
12406         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12407     fi
12408 done
12409 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12410     echo $WITH_LANG | grep -q en-US
12411     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12413 # list with substituted ALL
12414 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12415 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12416 test "$WITH_LANG" = "en-US" && WITH_LANG=
12417 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12418     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12419     ALL_LANGS=`echo $ALL_LANGS qtz`
12421 AC_SUBST(ALL_LANGS)
12422 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12423 AC_SUBST(WITH_LANG)
12424 AC_SUBST(WITH_LANG_LIST)
12425 AC_SUBST(GIT_NEEDED_SUBMODULES)
12427 WITH_POOR_HELP_LOCALIZATIONS=
12428 if test -d "$SRC_ROOT/translations/source"; then
12429     for l in `ls -1 $SRC_ROOT/translations/source`; do
12430         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12431             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12432         fi
12433     done
12435 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12437 if test -n "$with_locales"; then
12438     WITH_LOCALES="$with_locales"
12440     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12441     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12442     # config_host/config_locales.h.in
12443     for locale in $WITH_LOCALES; do
12444         lang=${locale%_*}
12446         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12448         case $lang in
12449         hi|mr*ne)
12450             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12451             ;;
12452         bg|ru)
12453             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12454             ;;
12455         esac
12456     done
12457 else
12458     AC_DEFINE(WITH_LOCALE_ALL)
12460 AC_SUBST(WITH_LOCALES)
12462 dnl git submodule update --reference
12463 dnl ===================================================================
12464 if test -n "${GIT_REFERENCE_SRC}"; then
12465     for repo in ${GIT_NEEDED_SUBMODULES}; do
12466         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12467             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12468         fi
12469     done
12471 AC_SUBST(GIT_REFERENCE_SRC)
12473 dnl git submodules linked dirs
12474 dnl ===================================================================
12475 if test -n "${GIT_LINK_SRC}"; then
12476     for repo in ${GIT_NEEDED_SUBMODULES}; do
12477         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12478             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12479         fi
12480     done
12482 AC_SUBST(GIT_LINK_SRC)
12484 dnl branding
12485 dnl ===================================================================
12486 AC_MSG_CHECKING([for alternative branding images directory])
12487 # initialize mapped arrays
12488 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12489 brand_files="$BRAND_INTRO_IMAGES about.svg"
12491 if test -z "$with_branding" -o "$with_branding" = "no"; then
12492     AC_MSG_RESULT([none])
12493     DEFAULT_BRAND_IMAGES="$brand_files"
12494 else
12495     if ! test -d $with_branding ; then
12496         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12497     else
12498         AC_MSG_RESULT([$with_branding])
12499         CUSTOM_BRAND_DIR="$with_branding"
12500         for lfile in $brand_files
12501         do
12502             if ! test -f $with_branding/$lfile ; then
12503                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12504                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12505             else
12506                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12507             fi
12508         done
12509         check_for_progress="yes"
12510     fi
12512 AC_SUBST([BRAND_INTRO_IMAGES])
12513 AC_SUBST([CUSTOM_BRAND_DIR])
12514 AC_SUBST([CUSTOM_BRAND_IMAGES])
12515 AC_SUBST([DEFAULT_BRAND_IMAGES])
12518 AC_MSG_CHECKING([for 'intro' progress settings])
12519 PROGRESSBARCOLOR=
12520 PROGRESSSIZE=
12521 PROGRESSPOSITION=
12522 PROGRESSFRAMECOLOR=
12523 PROGRESSTEXTCOLOR=
12524 PROGRESSTEXTBASELINE=
12526 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12527     source "$with_branding/progress.conf"
12528     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12529 else
12530     AC_MSG_RESULT([none])
12533 AC_SUBST(PROGRESSBARCOLOR)
12534 AC_SUBST(PROGRESSSIZE)
12535 AC_SUBST(PROGRESSPOSITION)
12536 AC_SUBST(PROGRESSFRAMECOLOR)
12537 AC_SUBST(PROGRESSTEXTCOLOR)
12538 AC_SUBST(PROGRESSTEXTBASELINE)
12541 AC_MSG_CHECKING([for extra build ID])
12542 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12543     EXTRA_BUILDID="$with_extra_buildid"
12545 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12546 if test -n "$EXTRA_BUILDID" ; then
12547     AC_MSG_RESULT([$EXTRA_BUILDID])
12548 else
12549     AC_MSG_RESULT([not set])
12551 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12553 OOO_VENDOR=
12554 AC_MSG_CHECKING([for vendor])
12555 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12556     OOO_VENDOR="$USERNAME"
12558     if test -z "$OOO_VENDOR"; then
12559         OOO_VENDOR="$USER"
12560     fi
12562     if test -z "$OOO_VENDOR"; then
12563         OOO_VENDOR="`id -u -n`"
12564     fi
12566     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12567 else
12568     OOO_VENDOR="$with_vendor"
12569     AC_MSG_RESULT([$OOO_VENDOR])
12571 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12572 AC_SUBST(OOO_VENDOR)
12574 if test "$_os" = "Android" ; then
12575     ANDROID_PACKAGE_NAME=
12576     AC_MSG_CHECKING([for Android package name])
12577     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12578         if test -n "$ENABLE_DEBUG"; then
12579             # Default to the package name that makes ndk-gdb happy.
12580             ANDROID_PACKAGE_NAME="org.libreoffice"
12581         else
12582             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12583         fi
12585         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12586     else
12587         ANDROID_PACKAGE_NAME="$with_android_package_name"
12588         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12589     fi
12590     AC_SUBST(ANDROID_PACKAGE_NAME)
12593 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12594 if test "$with_compat_oowrappers" = "yes"; then
12595     WITH_COMPAT_OOWRAPPERS=TRUE
12596     AC_MSG_RESULT(yes)
12597 else
12598     WITH_COMPAT_OOWRAPPERS=
12599     AC_MSG_RESULT(no)
12601 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12603 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12604 AC_MSG_CHECKING([for install dirname])
12605 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12606     INSTALLDIRNAME="$with_install_dirname"
12608 AC_MSG_RESULT([$INSTALLDIRNAME])
12609 AC_SUBST(INSTALLDIRNAME)
12611 AC_MSG_CHECKING([for prefix])
12612 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12613 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12614 PREFIXDIR="$prefix"
12615 AC_MSG_RESULT([$PREFIXDIR])
12616 AC_SUBST(PREFIXDIR)
12618 LIBDIR=[$(eval echo $(eval echo $libdir))]
12619 AC_SUBST(LIBDIR)
12621 DATADIR=[$(eval echo $(eval echo $datadir))]
12622 AC_SUBST(DATADIR)
12624 MANDIR=[$(eval echo $(eval echo $mandir))]
12625 AC_SUBST(MANDIR)
12627 DOCDIR=[$(eval echo $(eval echo $docdir))]
12628 AC_SUBST(DOCDIR)
12630 BINDIR=[$(eval echo $(eval echo $bindir))]
12631 AC_SUBST(BINDIR)
12633 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12634 AC_SUBST(INSTALLDIR)
12636 TESTINSTALLDIR="${BUILDDIR}/test-install"
12637 AC_SUBST(TESTINSTALLDIR)
12640 # ===================================================================
12641 # OAuth2 id and secrets
12642 # ===================================================================
12644 AC_MSG_CHECKING([for Google Drive client id and secret])
12645 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12646     AC_MSG_RESULT([not set])
12647     GDRIVE_CLIENT_ID="\"\""
12648     GDRIVE_CLIENT_SECRET="\"\""
12649 else
12650     AC_MSG_RESULT([set])
12651     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12652     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12654 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12655 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12657 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12658 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12659     AC_MSG_RESULT([not set])
12660     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12661     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12662 else
12663     AC_MSG_RESULT([set])
12664     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12665     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12667 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12668 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12670 AC_MSG_CHECKING([for OneDrive client id and secret])
12671 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12672     AC_MSG_RESULT([not set])
12673     ONEDRIVE_CLIENT_ID="\"\""
12674     ONEDRIVE_CLIENT_SECRET="\"\""
12675 else
12676     AC_MSG_RESULT([set])
12677     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12678     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12680 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12681 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12684 dnl ===================================================================
12685 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12686 dnl --enable-dependency-tracking configure option
12687 dnl ===================================================================
12688 AC_MSG_CHECKING([whether to enable dependency tracking])
12689 if test "$enable_dependency_tracking" = "no"; then
12690     nodep=TRUE
12691     AC_MSG_RESULT([no])
12692 else
12693     AC_MSG_RESULT([yes])
12695 AC_SUBST(nodep)
12697 dnl ===================================================================
12698 dnl Number of CPUs to use during the build
12699 dnl ===================================================================
12700 AC_MSG_CHECKING([for number of processors to use])
12701 # plain --with-parallelism is just the default
12702 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12703     if test "$with_parallelism" = "no"; then
12704         PARALLELISM=0
12705     else
12706         PARALLELISM=$with_parallelism
12707     fi
12708 else
12709     if test "$enable_icecream" = "yes"; then
12710         PARALLELISM="40"
12711     else
12712         case `uname -s` in
12714         Darwin|FreeBSD|NetBSD|OpenBSD)
12715             PARALLELISM=`sysctl -n hw.ncpu`
12716             ;;
12718         Linux)
12719             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12720         ;;
12721         # what else than above does profit here *and* has /proc?
12722         *)
12723             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12724             ;;
12725         esac
12727         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12728         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12729     fi
12732 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12733     if test -z "$with_parallelism"; then
12734             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12735             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12736             PARALLELISM="1"
12737     else
12738         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."
12739     fi
12742 if test $PARALLELISM -eq 0; then
12743     AC_MSG_RESULT([explicit make -j option needed])
12744 else
12745     AC_MSG_RESULT([$PARALLELISM])
12747 AC_SUBST(PARALLELISM)
12749 IWYU_PATH="$with_iwyu"
12750 AC_SUBST(IWYU_PATH)
12751 if test ! -z "$IWYU_PATH"; then
12752     if test ! -f "$IWYU_PATH"; then
12753         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12754     fi
12758 # Set up ILIB for MSVC build
12760 ILIB1=
12761 if test "$build_os" = "cygwin"; then
12762     ILIB="."
12763     if test -n "$JAVA_HOME"; then
12764         ILIB="$ILIB;$JAVA_HOME/lib"
12765     fi
12766     ILIB1=-link
12767     if test "$BITNESS_OVERRIDE" = 64; then
12768         ILIB="$ILIB;$COMPATH/lib/x64"
12769         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12770         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12771         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12772         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12773             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12774             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12775         fi
12776         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12777         ucrtlibpath_formatted=$formatted_path
12778         ILIB="$ILIB;$ucrtlibpath_formatted"
12779         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12780     else
12781         ILIB="$ILIB;$COMPATH/lib/x86"
12782         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12783         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12784         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12785         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12786             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12787             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12788         fi
12789         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12790         ucrtlibpath_formatted=$formatted_path
12791         ILIB="$ILIB;$ucrtlibpath_formatted"
12792         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12793     fi
12794     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12795         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12796     else
12797         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12798     fi
12800     AC_SUBST(ILIB)
12803 # ===================================================================
12804 # Creating bigger shared library to link against
12805 # ===================================================================
12806 AC_MSG_CHECKING([whether to create huge library])
12807 MERGELIBS=
12809 if test $_os = iOS -o $_os = Android; then
12810     # Never any point in mergelibs for these as we build just static
12811     # libraries anyway...
12812     enable_mergelibs=no
12815 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12816     if test $_os != Linux -a $_os != WINNT; then
12817         add_warning "--enable-mergelibs is not tested for this platform"
12818     fi
12819     MERGELIBS="TRUE"
12820     AC_MSG_RESULT([yes])
12821 else
12822     AC_MSG_RESULT([no])
12824 AC_SUBST([MERGELIBS])
12826 dnl ===================================================================
12827 dnl icerun is a wrapper that stops us spawning tens of processes
12828 dnl locally - for tools that can't be executed on the compile cluster
12829 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12830 dnl ===================================================================
12831 AC_MSG_CHECKING([whether to use icerun wrapper])
12832 ICECREAM_RUN=
12833 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12834     ICECREAM_RUN=icerun
12835     AC_MSG_RESULT([yes])
12836 else
12837     AC_MSG_RESULT([no])
12839 AC_SUBST(ICECREAM_RUN)
12841 dnl ===================================================================
12842 dnl Setup the ICECC_VERSION for the build the same way it was set for
12843 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12844 dnl ===================================================================
12845 x_ICECC_VERSION=[\#]
12846 if test -n "$ICECC_VERSION" ; then
12847     x_ICECC_VERSION=
12849 AC_SUBST(x_ICECC_VERSION)
12850 AC_SUBST(ICECC_VERSION)
12852 dnl ===================================================================
12854 AC_MSG_CHECKING([MPL subset])
12855 MPL_SUBSET=
12857 if test "$enable_mpl_subset" = "yes"; then
12858     warn_report=false
12859     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12860         warn_report=true
12861     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12862         warn_report=true
12863     fi
12864     if test "$warn_report" = "true"; then
12865         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12866     fi
12867     if test "x$enable_postgresql_sdbc" != "xno"; then
12868         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12869     fi
12870     if test "$enable_lotuswordpro" = "yes"; then
12871         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12872     fi
12873     if test "$WITH_WEBDAV" = "neon"; then
12874         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12875     fi
12876     if test -n "$ENABLE_POPPLER"; then
12877         if test "x$SYSTEM_POPPLER" = "x"; then
12878             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12879         fi
12880     fi
12881     # cf. m4/libo_check_extension.m4
12882     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12883         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12884     fi
12885     for theme in $WITH_THEMES; do
12886         case $theme in
12887         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12888             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12889         *) : ;;
12890         esac
12891     done
12893     ENABLE_OPENGL_TRANSITIONS=
12895     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12896         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12897     fi
12899     MPL_SUBSET="TRUE"
12900     AC_DEFINE(MPL_HAVE_SUBSET)
12901     AC_MSG_RESULT([only])
12902 else
12903     AC_MSG_RESULT([no restrictions])
12905 AC_SUBST(MPL_SUBSET)
12907 dnl ===================================================================
12909 AC_MSG_CHECKING([formula logger])
12910 ENABLE_FORMULA_LOGGER=
12912 if test "x$enable_formula_logger" = "xyes"; then
12913     AC_MSG_RESULT([yes])
12914     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12915     ENABLE_FORMULA_LOGGER=TRUE
12916 elif test -n "$ENABLE_DBGUTIL" ; then
12917     AC_MSG_RESULT([yes])
12918     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12919     ENABLE_FORMULA_LOGGER=TRUE
12920 else
12921     AC_MSG_RESULT([no])
12924 AC_SUBST(ENABLE_FORMULA_LOGGER)
12926 dnl ===================================================================
12927 dnl Setting up the environment.
12928 dnl ===================================================================
12929 AC_MSG_NOTICE([setting up the build environment variables...])
12931 AC_SUBST(COMPATH)
12933 if test "$build_os" = "cygwin"; then
12934     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12935         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12936         ATL_INCLUDE="$COMPATH/atlmfc/include"
12937     elif test -d "$COMPATH/atlmfc/lib"; then
12938         ATL_LIB="$COMPATH/atlmfc/lib"
12939         ATL_INCLUDE="$COMPATH/atlmfc/include"
12940     else
12941         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12942         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12943     fi
12944     if test "$BITNESS_OVERRIDE" = 64; then
12945         ATL_LIB="$ATL_LIB/x64"
12946     else
12947         ATL_LIB="$ATL_LIB/x86"
12948     fi
12949     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12950     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12952     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12953     PathFormat "/usr/bin/find.exe"
12954     FIND="$formatted_path"
12955     PathFormat "/usr/bin/sort.exe"
12956     SORT="$formatted_path"
12957     PathFormat "/usr/bin/grep.exe"
12958     WIN_GREP="$formatted_path"
12959     PathFormat "/usr/bin/ls.exe"
12960     WIN_LS="$formatted_path"
12961     PathFormat "/usr/bin/touch.exe"
12962     WIN_TOUCH="$formatted_path"
12963 else
12964     FIND=find
12965     SORT=sort
12968 AC_SUBST(ATL_INCLUDE)
12969 AC_SUBST(ATL_LIB)
12970 AC_SUBST(FIND)
12971 AC_SUBST(SORT)
12972 AC_SUBST(WIN_GREP)
12973 AC_SUBST(WIN_LS)
12974 AC_SUBST(WIN_TOUCH)
12976 AC_SUBST(BUILD_TYPE)
12978 AC_SUBST(SOLARINC)
12980 PathFormat "$PERL"
12981 PERL="$formatted_path"
12982 AC_SUBST(PERL)
12984 if test -n "$TMPDIR"; then
12985     TEMP_DIRECTORY="$TMPDIR"
12986 else
12987     TEMP_DIRECTORY="/tmp"
12989 if test "$build_os" = "cygwin"; then
12990     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12992 AC_SUBST(TEMP_DIRECTORY)
12994 # setup the PATH for the environment
12995 if test -n "$LO_PATH_FOR_BUILD"; then
12996     LO_PATH="$LO_PATH_FOR_BUILD"
12997 else
12998     LO_PATH="$PATH"
13000     case "$host_os" in
13002     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13003         if test "$ENABLE_JAVA" != ""; then
13004             pathmunge "$JAVA_HOME/bin" "after"
13005         fi
13006         ;;
13008     cygwin*)
13009         # Win32 make needs native paths
13010         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13011             LO_PATH=`cygpath -p -m "$PATH"`
13012         fi
13013         if test "$BITNESS_OVERRIDE" = 64; then
13014             # needed for msi packaging
13015             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13016         fi
13017         # .NET 4.6 and higher don't have bin directory
13018         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13019             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13020         fi
13021         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13022         pathmunge "$CSC_PATH" "before"
13023         pathmunge "$MIDL_PATH" "before"
13024         pathmunge "$AL_PATH" "before"
13025         pathmunge "$MSPDB_PATH" "before"
13026         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13027             pathmunge "$CL_PATH" "before"
13028         fi
13029         if test -n "$MSBUILD_PATH" ; then
13030             pathmunge "$MSBUILD_PATH" "before"
13031         fi
13032         if test "$BITNESS_OVERRIDE" = 64; then
13033             pathmunge "$COMPATH/bin/amd64" "before"
13034             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13035         else
13036             pathmunge "$COMPATH/bin" "before"
13037             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13038         fi
13039         if test "$ENABLE_JAVA" != ""; then
13040             if test -d "$JAVA_HOME/jre/bin/client"; then
13041                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13042             fi
13043             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13044                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13045             fi
13046             pathmunge "$JAVA_HOME/bin" "before"
13047         fi
13048         ;;
13050     solaris*)
13051         pathmunge "/usr/css/bin" "before"
13052         if test "$ENABLE_JAVA" != ""; then
13053             pathmunge "$JAVA_HOME/bin" "after"
13054         fi
13055         ;;
13056     esac
13059 AC_SUBST(LO_PATH)
13061 libo_FUZZ_SUMMARY
13063 # Generate a configuration sha256 we can use for deps
13064 if test -f config_host.mk; then
13065     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13067 if test -f config_host_lang.mk; then
13068     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13071 CFLAGS=$my_original_CFLAGS
13072 CXXFLAGS=$my_original_CXXFLAGS
13073 CPPFLAGS=$my_original_CPPFLAGS
13075 AC_CONFIG_LINKS([include:include])
13076 AC_CONFIG_FILES([config_host.mk
13077                  config_host_lang.mk
13078                  Makefile
13079                  bin/bffvalidator.sh
13080                  bin/odfvalidator.sh
13081                  bin/officeotron.sh
13082                  instsetoo_native/util/openoffice.lst
13083                  setup_native/source/packinfo/finals_instsetoo.txt
13084                  sysui/desktop/macosx/Info.plist])
13085 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13086 AC_CONFIG_HEADERS([config_host/config_clang.h])
13087 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13088 AC_CONFIG_HEADERS([config_host/config_eot.h])
13089 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13090 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13091 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13092 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13093 AC_CONFIG_HEADERS([config_host/config_features.h])
13094 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13095 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13096 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13097 AC_CONFIG_HEADERS([config_host/config_folders.h])
13098 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13099 AC_CONFIG_HEADERS([config_host/config_gio.h])
13100 AC_CONFIG_HEADERS([config_host/config_global.h])
13101 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13102 AC_CONFIG_HEADERS([config_host/config_java.h])
13103 AC_CONFIG_HEADERS([config_host/config_langs.h])
13104 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13105 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13106 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13107 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13108 AC_CONFIG_HEADERS([config_host/config_locales.h])
13109 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13110 AC_CONFIG_HEADERS([config_host/config_oox.h])
13111 AC_CONFIG_HEADERS([config_host/config_options.h])
13112 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13113 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
13114 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13115 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13116 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13117 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13118 AC_CONFIG_HEADERS([config_host/config_version.h])
13119 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13120 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13121 AC_CONFIG_HEADERS([config_host/config_python.h])
13122 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13123 AC_OUTPUT
13125 if test "$CROSS_COMPILING" = TRUE; then
13126     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13129 # touch the config timestamp file
13130 if test ! -f config_host.mk.stamp; then
13131     echo > config_host.mk.stamp
13132 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13133     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13134 else
13135     echo > config_host.mk.stamp
13138 # touch the config lang timestamp file
13139 if test ! -f config_host_lang.mk.stamp; then
13140     echo > config_host_lang.mk.stamp
13141 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13142     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13143 else
13144     echo > config_host_lang.mk.stamp
13148 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13149         -a "$build_os" = "cygwin"; then
13151 cat << _EOS
13152 ****************************************************************************
13153 WARNING:
13154 Your make version is known to be horribly slow, and hard to debug
13155 problems with. To get a reasonably functional make please do:
13157 to install a pre-compiled binary make for Win32
13159  mkdir -p /opt/lo/bin
13160  cd /opt/lo/bin
13161  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13162  cp make-4.2.1-msvc.exe make
13163  chmod +x make
13165 to install from source:
13166 place yourself in a working directory of you choice.
13168  git clone git://git.savannah.gnu.org/make.git
13170  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13171  set PATH=%PATH%;C:\Cygwin\bin
13172  [or Cygwin64, if that is what you have]
13173  cd path-to-make-repo-you-cloned-above
13174  build_w32.bat --without-guile
13176 should result in a WinRel/gnumake.exe.
13177 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13179 Then re-run autogen.sh
13181 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13182 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13184 _EOS
13185 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13186     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13191 cat << _EOF
13192 ****************************************************************************
13194 To build, run:
13195 $GNUMAKE
13197 To view some help, run:
13198 $GNUMAKE help
13200 _EOF
13202 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13203     cat << _EOF
13204 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13205 _EOF
13207     if test $_os = Darwin; then
13208         echo open instdir/$PRODUCTNAME.app
13209     else
13210         echo instdir/program/soffice
13211     fi
13212     cat << _EOF
13214 If you want to run the smoketest, run:
13215 $GNUMAKE check
13217 _EOF
13220 if test -f warn; then
13221     cat warn
13222     rm warn
13225 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: