Bump version to 6.4-54
[libreoffice.git] / configure.ac
blob716e2bcaf0c8c4247d2646d8c76535f5c6d1c93f
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.54],[],[],[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 # prefer parallel comression tools, if available
2541 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2542 if test -z "$COMPRESSIONTOOL"; then
2543     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2544     if test -z "$COMPRESSIONTOOL"; then
2545         AC_MSG_ERROR([gzip not found in \$PATH])
2546     fi
2548 AC_SUBST(COMPRESSIONTOOL)
2550 AC_MSG_CHECKING([for GNU or BSD tar])
2551 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2552     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2553     if test $? -eq 0;  then
2554         GNUTAR=$a
2555         break
2556     fi
2557 done
2558 AC_MSG_RESULT($GNUTAR)
2559 if test -z "$GNUTAR"; then
2560     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2562 AC_SUBST(GNUTAR)
2564 AC_MSG_CHECKING([for tar's option to strip components])
2565 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2566 if test $? -eq 0; then
2567     STRIP_COMPONENTS="--strip-components"
2568 else
2569     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2570     if test $? -eq 0; then
2571         STRIP_COMPONENTS="--strip-path"
2572     else
2573         STRIP_COMPONENTS="unsupported"
2574     fi
2576 AC_MSG_RESULT($STRIP_COMPONENTS)
2577 if test x$STRIP_COMPONENTS = xunsupported; then
2578     AC_MSG_ERROR([you need a tar that is able to strip components.])
2580 AC_SUBST(STRIP_COMPONENTS)
2582 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2583 dnl desktop OSes from "mobile" ones.
2585 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2586 dnl In other words, that when building for an OS that is not a
2587 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2589 dnl Note the direction of the implication; there is no assumption that
2590 dnl cross-compiling would imply a non-desktop OS.
2592 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2593     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2594     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2595     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2598 # Whether to build "avmedia" functionality or not.
2600 if test -z "$enable_avmedia"; then
2601     enable_avmedia=yes
2604 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2605 if test "$enable_avmedia" = yes; then
2606     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2607 else
2608     USE_AVMEDIA_DUMMY='TRUE'
2610 AC_SUBST(USE_AVMEDIA_DUMMY)
2612 # Decide whether to build database connectivity stuff (including
2613 # Base) or not. We probably don't want to on non-desktop OSes.
2614 if test -z "$enable_database_connectivity"; then
2615     # --disable-database-connectivity is unfinished work in progress
2616     # and the iOS test app doesn't link if we actually try to use it.
2617     # if test $_os != iOS -a $_os != Android; then
2618     if test $_os != iOS; then
2619         enable_database_connectivity=yes
2620     fi
2623 if test "$enable_database_connectivity" = yes; then
2624     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2625     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2628 if test -z "$enable_extensions"; then
2629     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2630     if test $_os != iOS; then
2631         enable_extensions=yes
2632     fi
2635 if test "$enable_extensions" = yes; then
2636     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2637     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2640 if test -z "$enable_scripting"; then
2641     enable_scripting=yes
2644 DISABLE_SCRIPTING=''
2645 if test "$enable_scripting" = yes; then
2646     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2647     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2648 else
2649     DISABLE_SCRIPTING='TRUE'
2650     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2653 if test $_os = iOS -o $_os = Android; then
2654     # Disable dynamic_loading always for iOS and Android
2655     enable_dynamic_loading=no
2656 elif test -z "$enable_dynamic_loading"; then
2657     # Otherwise enable it unless specifically disabled
2658     enable_dynamic_loading=yes
2661 DISABLE_DYNLOADING=''
2662 if test "$enable_dynamic_loading" = yes; then
2663     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2664 else
2665     DISABLE_DYNLOADING='TRUE'
2667 AC_SUBST(DISABLE_DYNLOADING)
2669 # remember SYSBASE value
2670 AC_SUBST(SYSBASE)
2672 dnl ===================================================================
2673 dnl  Sort out various gallery compilation options
2674 dnl ===================================================================
2675 AC_MSG_CHECKING([how to build and package galleries])
2676 if test -n "${with_galleries}"; then
2677     if test "$with_galleries" = "build"; then
2678         WITH_GALLERY_BUILD=TRUE
2679         AC_MSG_RESULT([build from source images internally])
2680     elif test "$with_galleries" = "no"; then
2681         WITH_GALLERY_BUILD=
2682         AC_MSG_RESULT([disable non-internal gallery build])
2683     else
2684         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2685     fi
2686 else
2687     if test $_os != iOS -a $_os != Android; then
2688         WITH_GALLERY_BUILD=TRUE
2689         AC_MSG_RESULT([internal src images for desktop])
2690     else
2691         WITH_GALLERY_BUILD=
2692         AC_MSG_RESULT([disable src image build])
2693     fi
2695 AC_SUBST(WITH_GALLERY_BUILD)
2697 dnl ===================================================================
2698 dnl  Checks if ccache is available
2699 dnl ===================================================================
2700 CCACHE_DEPEND_MODE=
2701 if test "$_os" = "WINNT"; then
2702     # on windows/VC build do not use ccache
2703     CCACHE=""
2704 elif test "$enable_ccache" = "no"; then
2705     CCACHE=""
2706 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2707     case "%$CC%$CXX%" in
2708     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2709     # assume that's good then
2710     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2711         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2712         CCACHE_DEPEND_MODE=1
2713         ;;
2714     *)
2715         AC_PATH_PROG([CCACHE],[ccache],[not found])
2716         if test "$CCACHE" = "not found"; then
2717             CCACHE=""
2718         else
2719             CCACHE_DEPEND_MODE=1
2720             # Need to check for ccache version: otherwise prevents
2721             # caching of the results (like "-x objective-c++" for Mac)
2722             if test $_os = Darwin -o $_os = iOS; then
2723                 # Check ccache version
2724                 AC_MSG_CHECKING([whether version of ccache is suitable])
2725                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2726                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2727                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2728                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2729                 else
2730                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2731                     CCACHE=""
2732                     CCACHE_DEPEND_MODE=
2733                 fi
2734             fi
2735         fi
2736         ;;
2737     esac
2738 else
2739     CCACHE=""
2741 if test "$enable_ccache" = "nodepend"; then
2742     CCACHE_DEPEND_MODE=""
2744 AC_SUBST(CCACHE_DEPEND_MODE)
2746 if test "$CCACHE" != ""; then
2747     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2748     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2749     if test "$ccache_size" = ""; then
2750         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2751         if test "$ccache_size" = ""; then
2752             ccache_size=0
2753         fi
2754         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2755         if test $ccache_size -lt 1024; then
2756             CCACHE=""
2757             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2758             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2759         else
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     else
2765         if test $ccache_size -lt 5; then
2766             #warn that ccache may be too small for debug build
2767             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2768             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2769         fi
2770     fi
2773 dnl ===================================================================
2774 dnl  Checks for C compiler,
2775 dnl  The check for the C++ compiler is later on.
2776 dnl ===================================================================
2777 if test "$_os" != "WINNT"; then
2778     GCC_HOME_SET="true"
2779     AC_MSG_CHECKING([gcc home])
2780     if test -z "$with_gcc_home"; then
2781         if test "$enable_icecream" = "yes"; then
2782             if test -d "/usr/lib/icecc/bin"; then
2783                 GCC_HOME="/usr/lib/icecc/"
2784             elif test -d "/usr/libexec/icecc/bin"; then
2785                 GCC_HOME="/usr/libexec/icecc/"
2786             elif test -d "/opt/icecream/bin"; then
2787                 GCC_HOME="/opt/icecream/"
2788             else
2789                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2791             fi
2792         else
2793             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2794             GCC_HOME_SET="false"
2795         fi
2796     else
2797         GCC_HOME="$with_gcc_home"
2798     fi
2799     AC_MSG_RESULT($GCC_HOME)
2800     AC_SUBST(GCC_HOME)
2802     if test "$GCC_HOME_SET" = "true"; then
2803         if test -z "$CC"; then
2804             CC="$GCC_HOME/bin/gcc"
2805             CC_BASE="gcc"
2806         fi
2807         if test -z "$CXX"; then
2808             CXX="$GCC_HOME/bin/g++"
2809             CXX_BASE="g++"
2810         fi
2811     fi
2814 COMPATH=`dirname "$CC"`
2815 if test "$COMPATH" = "."; then
2816     AC_PATH_PROGS(COMPATH, $CC)
2817     dnl double square bracket to get single because of M4 quote...
2818     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2820 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2822 dnl ===================================================================
2823 dnl Java support
2824 dnl ===================================================================
2825 AC_MSG_CHECKING([whether to build with Java support])
2826 if test "$with_java" != "no"; then
2827     if test "$DISABLE_SCRIPTING" = TRUE; then
2828         AC_MSG_RESULT([no, overridden by --disable-scripting])
2829         ENABLE_JAVA=""
2830         with_java=no
2831     else
2832         AC_MSG_RESULT([yes])
2833         ENABLE_JAVA="TRUE"
2834         AC_DEFINE(HAVE_FEATURE_JAVA)
2835     fi
2836 else
2837     AC_MSG_RESULT([no])
2838     ENABLE_JAVA=""
2841 AC_SUBST(ENABLE_JAVA)
2843 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2845 dnl ENABLE_JAVA="" indicate no Java support at all
2847 dnl ===================================================================
2848 dnl Check macOS SDK and compiler
2849 dnl ===================================================================
2851 HAVE_MACOS_LD_PLATFORMVERSION=
2852 if test $_os = Darwin; then
2854     # If no --with-macosx-sdk option is given, look for one
2856     # The intent is that for "most" Mac-based developers, a suitable
2857     # SDK will be found automatically without any configure options.
2859     # For developers with a current Xcode, the lowest-numbered SDK
2860     # higher than or equal to the minimum required should be found.
2862     AC_MSG_CHECKING([what macOS SDK to use])
2863     for _macosx_sdk in ${with_macosx_sdk-12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13 10.12}; do
2864         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2865         if test -d "$MACOSX_SDK_PATH"; then
2866             with_macosx_sdk="${_macosx_sdk}"
2867             break
2868         else
2869             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2870             if test -d "$MACOSX_SDK_PATH"; then
2871                 with_macosx_sdk="${_macosx_sdk}"
2872                 break
2873             fi
2874         fi
2875     done
2876     if test ! -d "$MACOSX_SDK_PATH"; then
2877         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2878     fi
2880     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2882     case $with_macosx_sdk in
2883     10.12)
2884         MACOSX_SDK_VERSION=101200
2885         ;;
2886     10.13)
2887         MACOSX_SDK_VERSION=101300
2888         ;;
2889     10.14)
2890         MACOSX_SDK_VERSION=101400
2891         ;;
2892     10.15)
2893         MACOSX_SDK_VERSION=101500
2894         ;;
2895     11.0)
2896         MACOSX_SDK_VERSION=110000
2897         ;;
2898     11.1)
2899         MACOSX_SDK_VERSION=110100
2900         ;;
2901     11.3)
2902         MACOSX_SDK_VERSION=110300
2903         ;;
2904     12.0)
2905         MACOSX_SDK_VERSION=120000
2906         ;;
2907     12.1)
2908         MACOSX_SDK_VERSION=120100
2909         ;;
2910     *)
2911         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--12.1])
2912         ;;
2913     esac
2915     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
2916         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
2917     fi
2919     if test "$with_macosx_version_min_required" = "" ; then
2920         if test "$host_cpu" = x86_64; then
2921             with_macosx_version_min_required="10.10";
2922         else
2923             with_macosx_version_min_required="11.0";
2924         fi
2925     fi
2927     if test "$with_macosx_version_max_allowed" = "" ; then
2928         with_macosx_version_max_allowed="$with_macosx_sdk"
2929     fi
2931     # export this so that "xcrun" invocations later return matching values
2932     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2933     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2934     export DEVELOPER_DIR
2935     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2936     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2938     AC_MSG_CHECKING([whether Xcode is new enough])
2939     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2940     my_xcode_ver2=${my_xcode_ver1#Xcode }
2941     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2942     if test "$my_xcode_ver3" -ge 903; then
2943         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2944     else
2945         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2946     fi
2948     case "$with_macosx_version_min_required" in
2949     10.10)
2950         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2951         ;;
2952     10.11)
2953         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2954         ;;
2955     10.12)
2956         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2957         ;;
2958     10.13)
2959         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2960         ;;
2961     10.14)
2962         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2963         ;;
2964     10.15)
2965         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2966         ;;
2967     10.16)
2968         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
2969         ;;
2970     11.0)
2971         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
2972         ;;
2973     11.1)
2974         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
2975         ;;
2976     11.3)
2977         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
2978         ;;
2979     12.0)
2980         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
2981         ;;
2982     12.1)
2983         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
2984         ;;
2985     *)
2986         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.1])
2987         ;;
2988     esac
2989     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2991     LIBTOOL=/usr/bin/libtool
2992     INSTALL_NAME_TOOL=install_name_tool
2993     if test -z "$save_CC"; then
2994         stdlib=-stdlib=libc++
2995         if test "$ENABLE_LTO" = TRUE; then
2996             lto=-flto
2997         fi
2999         AC_MSG_CHECKING([what C compiler to use])
3000         CC="`xcrun -find clang`"
3001         CC_BASE=`first_arg_basename "$CC"`
3002         if test "$host_cpu" = x86_64; then
3003             CC+=" -target x86_64-apple-macos"
3004         else
3005             CC+=" -target arm64-apple-macos"
3006         fi
3007         CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3008         AC_MSG_RESULT([$CC])
3010         AC_MSG_CHECKING([what C++ compiler to use])
3011         CXX="`xcrun -find clang++`"
3012         CXX_BASE=`first_arg_basename "$CXX"`
3013         if test "$host_cpu" = x86_64; then
3014             CXX+=" -target x86_64-apple-macos"
3015         else
3016             CXX+=" -target arm64-apple-macos"
3017         fi
3018         CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3019         AC_MSG_RESULT([$CXX])
3021         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3022         AR=`xcrun -find ar`
3023         NM=`xcrun -find nm`
3024         STRIP=`xcrun -find strip`
3025         LIBTOOL=`xcrun -find libtool`
3026         RANLIB=`xcrun -find ranlib`
3027     fi
3029     case "$with_macosx_version_max_allowed" in
3030     10.10)
3031         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3032         ;;
3033     10.11)
3034         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3035         ;;
3036     10.12)
3037         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3038         ;;
3039     10.13)
3040         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3041         ;;
3042     10.14)
3043         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3044         ;;
3045     10.15)
3046         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3047         ;;
3048     11.0)
3049         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3050         ;;
3051     11.1)
3052         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3053         ;;
3054     11.3)
3055         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3056         ;;
3057     12.0)
3058         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3059         ;;
3060     12.1)
3061         MAC_OS_X_VERSION_MAX_ALLOWED="120100"
3062         ;;
3063     *)
3064         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.1])
3065         ;;
3066     esac
3068     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3069     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3070         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])
3071     else
3072         AC_MSG_RESULT([ok])
3073     fi
3075     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3076     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3077         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3078     else
3079         AC_MSG_RESULT([ok])
3080     fi
3081     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3082     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3084     AC_MSG_CHECKING([whether to do code signing])
3086     if test "$enable_macosx_code_signing" = yes; then
3087         # By default use the first suitable certificate (?).
3089         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3090         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3091         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3092         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3093         # "Developer ID Application" one.
3095         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3096         if test -n "$identity"; then
3097             MACOSX_CODESIGNING_IDENTITY=$identity
3098             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3099             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3100         else
3101             AC_MSG_ERROR([cannot determine identity to use])
3102         fi
3103     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3104         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3105         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3106         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3107     else
3108         AC_MSG_RESULT([no])
3109     fi
3111     AC_MSG_CHECKING([whether to create a Mac App Store package])
3113     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3114         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3115     elif test "$enable_macosx_package_signing" = yes; then
3116         # By default use the first suitable certificate.
3117         # It should be a "3rd Party Mac Developer Installer" one
3119         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3120         if test -n "$identity"; then
3121             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3122             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3123             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3124         else
3125             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3126         fi
3127     elif test -n "$enable_macosx_package_signing"; then
3128         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3129         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3130         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3131     else
3132         AC_MSG_RESULT([no])
3133     fi
3135     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3136         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3137     fi
3139     AC_MSG_CHECKING([whether to sandbox the application])
3141     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3142         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3143     elif test "$enable_macosx_sandbox" = yes; then
3144         ENABLE_MACOSX_SANDBOX=TRUE
3145         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3146         AC_MSG_RESULT([yes])
3147     else
3148         AC_MSG_RESULT([no])
3149     fi
3151     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3152     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3153     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3155     AC_MSG_CHECKING([whether the linker supports -platform_version])
3156     save_LDFLAGS=$LDFLAGS
3157     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3158         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3159     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3160         [AC_MSG_RESULT([yes])
3161          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3162         [AC_MSG_RESULT([no])])
3163     LDFLAGS=$save_LDFLAGS
3165 AC_SUBST(MACOSX_SDK_PATH)
3166 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3167 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3168 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3169 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3170 AC_SUBST(INSTALL_NAME_TOOL)
3171 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3172 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3173 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3174 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3175 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3176 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3178 dnl ===================================================================
3179 dnl Check iOS SDK and compiler
3180 dnl ===================================================================
3182 if test $_os = iOS; then
3183     AC_MSG_CHECKING([what iOS SDK to use])
3184     current_sdk_ver=15.2
3185     older_sdk_vers="15.0 14.5 14.0"
3186     if test "$enable_ios_simulator" = "yes"; then
3187         platform=iPhoneSimulator
3188         versionmin=-mios-simulator-version-min=12.2
3189     else
3190         platform=iPhoneOS
3191         versionmin=-miphoneos-version-min=12.2
3192     fi
3193     xcode_developer=`xcode-select -print-path`
3195     for sdkver in $current_sdk_ver $older_sdk_vers; do
3196         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3197         if test -d $t; then
3198             sysroot=$t
3199             break
3200         fi
3201     done
3203     if test -z "$sysroot"; then
3204         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3205     fi
3207     AC_MSG_RESULT($sysroot)
3209     # LTO is not really recommended for iOS builds,
3210     # the link time will be astronomical
3211     if test "$ENABLE_LTO" = TRUE; then
3212         lto=-flto
3213     fi
3215     stdlib="-stdlib=libc++"
3217     AC_MSG_CHECKING([what C compiler to use])
3218     CC="`xcrun -find clang`"
3219     CC_BASE=`first_arg_basename "$CC"`
3220     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
3221     AC_MSG_RESULT([$CC])
3223     AC_MSG_CHECKING([what C++ compiler to use])
3224     CXX="`xcrun -find clang++`"
3225     CXX_BASE=`first_arg_basename "$CXX"`
3226     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
3227     AC_MSG_RESULT([$CXX])
3229     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3230     AR=`xcrun -find ar`
3231     NM=`xcrun -find nm`
3232     STRIP=`xcrun -find strip`
3233     LIBTOOL=`xcrun -find libtool`
3234     RANLIB=`xcrun -find ranlib`
3237 AC_MSG_CHECKING([whether to treat the installation as read-only])
3239 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3240         "$enable_extensions" != yes; then
3241     enable_readonly_installset=yes
3243 if test "$enable_readonly_installset" = yes; then
3244     AC_MSG_RESULT([yes])
3245     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3246 else
3247     AC_MSG_RESULT([no])
3250 dnl ===================================================================
3251 dnl Structure of install set
3252 dnl ===================================================================
3254 if test $_os = Darwin; then
3255     LIBO_BIN_FOLDER=MacOS
3256     LIBO_ETC_FOLDER=Resources
3257     LIBO_LIBEXEC_FOLDER=MacOS
3258     LIBO_LIB_FOLDER=Frameworks
3259     LIBO_LIB_PYUNO_FOLDER=Resources
3260     LIBO_SHARE_FOLDER=Resources
3261     LIBO_SHARE_HELP_FOLDER=Resources/help
3262     LIBO_SHARE_JAVA_FOLDER=Resources/java
3263     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3264     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3265     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3266     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3267     LIBO_URE_BIN_FOLDER=MacOS
3268     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3269     LIBO_URE_LIB_FOLDER=Frameworks
3270     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3271     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3272 elif test $_os = WINNT; then
3273     LIBO_BIN_FOLDER=program
3274     LIBO_ETC_FOLDER=program
3275     LIBO_LIBEXEC_FOLDER=program
3276     LIBO_LIB_FOLDER=program
3277     LIBO_LIB_PYUNO_FOLDER=program
3278     LIBO_SHARE_FOLDER=share
3279     LIBO_SHARE_HELP_FOLDER=help
3280     LIBO_SHARE_JAVA_FOLDER=program/classes
3281     LIBO_SHARE_PRESETS_FOLDER=presets
3282     LIBO_SHARE_READMES_FOLDER=readmes
3283     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3284     LIBO_SHARE_SHELL_FOLDER=program/shell
3285     LIBO_URE_BIN_FOLDER=program
3286     LIBO_URE_ETC_FOLDER=program
3287     LIBO_URE_LIB_FOLDER=program
3288     LIBO_URE_MISC_FOLDER=program
3289     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3290 else
3291     LIBO_BIN_FOLDER=program
3292     LIBO_ETC_FOLDER=program
3293     LIBO_LIBEXEC_FOLDER=program
3294     LIBO_LIB_FOLDER=program
3295     LIBO_LIB_PYUNO_FOLDER=program
3296     LIBO_SHARE_FOLDER=share
3297     LIBO_SHARE_HELP_FOLDER=help
3298     LIBO_SHARE_JAVA_FOLDER=program/classes
3299     LIBO_SHARE_PRESETS_FOLDER=presets
3300     LIBO_SHARE_READMES_FOLDER=readmes
3301     if test "$enable_fuzzers" != yes; then
3302         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3303     else
3304         LIBO_SHARE_RESOURCE_FOLDER=resource
3305     fi
3306     LIBO_SHARE_SHELL_FOLDER=program/shell
3307     LIBO_URE_BIN_FOLDER=program
3308     LIBO_URE_ETC_FOLDER=program
3309     LIBO_URE_LIB_FOLDER=program
3310     LIBO_URE_MISC_FOLDER=program
3311     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3313 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3314 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3315 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3316 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3317 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3318 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3319 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3320 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3321 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3322 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3323 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3324 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3325 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3326 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3327 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3328 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3330 # Not all of them needed in config_host.mk, add more if need arises
3331 AC_SUBST(LIBO_BIN_FOLDER)
3332 AC_SUBST(LIBO_ETC_FOLDER)
3333 AC_SUBST(LIBO_LIB_FOLDER)
3334 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3335 AC_SUBST(LIBO_SHARE_FOLDER)
3336 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3337 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3338 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3339 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3340 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3341 AC_SUBST(LIBO_URE_BIN_FOLDER)
3342 AC_SUBST(LIBO_URE_ETC_FOLDER)
3343 AC_SUBST(LIBO_URE_LIB_FOLDER)
3344 AC_SUBST(LIBO_URE_MISC_FOLDER)
3345 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3347 dnl ===================================================================
3348 dnl Windows specific tests and stuff
3349 dnl ===================================================================
3351 reg_get_value()
3353     # Return value: $regvalue
3354     unset regvalue
3356     local _regentry="/proc/registry${1}/${2}"
3357     if test -f "$_regentry"; then
3358         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3359         # Registry keys read via /proc/registry* are always \0 terminated!
3360         local _regvalue=$(tr -d '\0' < "$_regentry")
3361         if test $? -eq 0; then
3362             regvalue=$_regvalue
3363         fi
3364     fi
3367 # Get a value from the 32-bit side of the Registry
3368 reg_get_value_32()
3370     reg_get_value "32" "$1"
3373 # Get a value from the 64-bit side of the Registry
3374 reg_get_value_64()
3376     reg_get_value "64" "$1"
3379 if test "$_os" = "WINNT"; then
3380     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3381     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3382         AC_MSG_RESULT([no])
3383         WINDOWS_SDK_ARCH="x86"
3384     else
3385         AC_MSG_RESULT([yes])
3386         WINDOWS_SDK_ARCH="x64"
3387         BITNESS_OVERRIDE=64
3388     fi
3390 AC_SUBST(WINDOWS_SDK_ARCH)
3391 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3392     cross_compiling="yes"
3394 if test "$cross_compiling" = "yes"; then
3395     export CROSS_COMPILING=TRUE
3396 else
3397     CROSS_COMPILING=
3398     BUILD_TYPE="$BUILD_TYPE NATIVE"
3400 AC_SUBST(CROSS_COMPILING)
3402 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3403 # NOTE: must _not_ be used for bundled external libraries!
3404 ISYSTEM=
3405 if test "$GCC" = "yes"; then
3406     AC_MSG_CHECKING( for -isystem )
3407     save_CFLAGS=$CFLAGS
3408     CFLAGS="$CFLAGS -Werror"
3409     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3410     CFLAGS=$save_CFLAGS
3411     if test -n "$ISYSTEM"; then
3412         AC_MSG_RESULT(yes)
3413     else
3414         AC_MSG_RESULT(no)
3415     fi
3417 if test -z "$ISYSTEM"; then
3418     # fall back to using -I
3419     ISYSTEM=-I
3421 AC_SUBST(ISYSTEM)
3423 dnl ===================================================================
3424 dnl  Check which Visual Studio compiler is used
3425 dnl ===================================================================
3427 map_vs_year_to_version()
3429     # Return value: $vsversion
3431     unset vsversion
3433     case $1 in
3434     2017)
3435         vsversion=15;;
3436     2019)
3437         vsversion=16;;
3438     *)
3439         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3440     esac
3443 vs_versions_to_check()
3445     # Args: $1 (optional) : versions to check, in the order of preference
3446     # Return value: $vsversions
3448     unset vsversions
3450     if test -n "$1"; then
3451         map_vs_year_to_version "$1"
3452         vsversions=$vsversion
3453     else
3454         # We accept only 2017
3455         vsversions="15"
3456     fi
3459 win_get_env_from_vsvars32bat()
3461     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3462     # Also seems to be located in another directory under the same name: vsvars32.bat
3463     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3464     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3465     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3466     chmod +x $WRAPPERBATCHFILEPATH
3467     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3468     rm -f $WRAPPERBATCHFILEPATH
3469     printf '%s' "$_win_get_env_from_vsvars32bat"
3472 find_ucrt()
3474     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3475     if test -n "$regvalue"; then
3476         PathFormat "$regvalue"
3477         UCRTSDKDIR=$formatted_path
3478         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3479         UCRTVERSION=$regvalue
3480         # Rest if not exist
3481         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3482           UCRTSDKDIR=
3483         fi
3484     fi
3485     if test -z "$UCRTSDKDIR"; then
3486         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3487         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3488         if test -f "$ide_env_file"; then
3489             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3490             UCRTSDKDIR=$formatted_path
3491             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3492             dnl Hack needed at least by tml:
3493             if test "$UCRTVERSION" = 10.0.15063.0 \
3494                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3495                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3496             then
3497                 UCRTVERSION=10.0.14393.0
3498             fi
3499         else
3500           AC_MSG_ERROR([No UCRT found])
3501         fi
3502     fi
3505 find_msvc()
3507     # Find Visual C++ 2017/2019
3508     # Args: $1 (optional) : The VS version year
3509     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3511     unset vctest vcnum vcnumwithdot vcbuildnumber
3513     vs_versions_to_check "$1"
3514     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3515     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3516     PathFormat "$vswhere"
3517     vswhere=$formatted_path
3518     for ver in $vsversions; do
3519         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3520         if test -n "$vswhereoutput"; then
3521             PathFormat "$vswhereoutput"
3522             vctest=$formatted_path
3523             break
3524         fi
3525     done
3527     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3528     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3529     # should be removed when upgrading baseline.
3530     if ! test -n "$vctest"; then
3531         for ver in $vsversions; do
3532             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3533             if test -n "$regvalue"; then
3534                 vctest=$regvalue
3535                 break
3536             fi
3537             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3538             if test -n "$regvalue"; then
3539                 AC_MSG_RESULT([found: $regvalue])
3540                 PathFormat "$regvalue"
3541                 vctest=$formatted_path
3542                 break
3543             fi
3544         done
3545     fi
3547     if test -n "$vctest"; then
3548         vcnumwithdot="$ver.0"
3549         case "$vcnumwithdot" in
3550         15.0)
3551             vcyear=2017
3552             vcnum=150
3553             ;;
3554         16.0)
3555             vcyear=2019
3556             vcnum=160
3557             ;;
3558         esac
3559         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3561     fi
3564 SOLARINC=
3565 MSBUILD_PATH=
3566 DEVENV=
3567 if test "$_os" = "WINNT"; then
3568     AC_MSG_CHECKING([Visual C++])
3569     find_msvc "$with_visual_studio"
3570     if test -z "$vctest"; then
3571         if test -n "$with_visual_studio"; then
3572             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3573         else
3574             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3575         fi
3576     fi
3578     if test "$BITNESS_OVERRIDE" = ""; then
3579         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3580             VC_PRODUCT_DIR=$vctest/VC
3581         else
3582             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3583         fi
3584     else
3585         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3586             VC_PRODUCT_DIR=$vctest/VC
3587         else
3588             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3589         fi
3590     fi
3591     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3593     AC_MSG_CHECKING([for short pathname of VC product directory])
3594     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3595     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3597     UCRTSDKDIR=
3598     UCRTVERSION=
3600     AC_MSG_CHECKING([for UCRT location])
3601     find_ucrt
3602     # find_ucrt errors out if it doesn't find it
3603     AC_MSG_RESULT([found])
3604     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3605     ucrtincpath_formatted=$formatted_path
3606     # SOLARINC is used for external modules and must be set too.
3607     # And no, it's not sufficient to set SOLARINC only, as configure
3608     # itself doesn't honour it.
3609     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3610     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3611     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3612     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3614     AC_SUBST(UCRTSDKDIR)
3615     AC_SUBST(UCRTVERSION)
3617     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3618     # Find the proper version of MSBuild.exe to use based on the VS version
3619     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3620     if test -n "$regvalue" ; then
3621         AC_MSG_RESULT([found: $regvalue])
3622         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3623     else
3624         if test "$vcnumwithdot" = "16.0"; then
3625             if test "$BITNESS_OVERRIDE" = ""; then
3626                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3627             else
3628                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3629             fi
3630         else
3631             if test "$BITNESS_OVERRIDE" = ""; then
3632                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3633             else
3634                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3635             fi
3636         fi
3637         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3638         AC_MSG_RESULT([$regvalue])
3639     fi
3641     # Find the version of devenv.exe
3642     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3643     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3644     if test ! -e "$DEVENV"; then
3645         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3646     fi
3648     dnl ===========================================================
3649     dnl  Check for the corresponding mspdb*.dll
3650     dnl ===========================================================
3652     VC_HOST_DIR=
3653     MSPDB_PATH=
3654     CL_PATH=
3656     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3657         VC_HOST_DIR="HostX64"
3658         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3659     else
3660         VC_HOST_DIR="HostX86"
3661         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3662     fi
3664     if test "$BITNESS_OVERRIDE" = ""; then
3665         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3666     else
3667         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3668     fi
3670     # MSVC 15.0 has libraries from 14.0?
3671     mspdbnum="140"
3673     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3674         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3675     fi
3677     dnl The path needs to be added before cl is called
3678     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3679     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3681     AC_MSG_CHECKING([cl.exe])
3683     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3684     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3685     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3686     # is not enough?
3688     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3689     dnl needed when building CLR code:
3690     if test -z "$MSVC_CXX"; then
3691         if test -f "$CL_PATH/cl.exe"; then
3692             MSVC_CXX="$CL_PATH/cl.exe"
3693         fi
3695         # This gives us a posix path with 8.3 filename restrictions
3696         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3697     fi
3699     if test -z "$CC"; then
3700         CC=$MSVC_CXX
3701         CC_BASE=`first_arg_basename "$CC"`
3702     fi
3703     if test "$BITNESS_OVERRIDE" = ""; then
3704         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3705         MSVC_CXX="$MSVC_CXX -arch:SSE"
3706     fi
3707     if test -z "$CXX"; then
3708         CXX=$MSVC_CXX
3709         CXX_BASE=`first_arg_basename "$CXX"`
3710     fi
3712     if test -n "$CC"; then
3713         # Remove /cl.exe from CC case insensitive
3714         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3715         if test "$BITNESS_OVERRIDE" = ""; then
3716            COMPATH="$VC_PRODUCT_DIR"
3717         else
3718             if test -n "$VC_PRODUCT_DIR"; then
3719                 COMPATH=$VC_PRODUCT_DIR
3720             fi
3721         fi
3722         if test "$BITNESS_OVERRIDE" = ""; then
3723             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3724             CC="$CC -arch:SSE"
3725         fi
3727         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3729         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3731         PathFormat "$COMPATH"
3732         COMPATH=`win_short_path_for_make "$formatted_path"`
3734         VCVER=$vcnum
3735         MSVSVER=$vcyear
3737         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3738         # are always "better", we list them in reverse chronological order.
3740         case "$vcnum" in
3741         150|160)
3742             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3743             ;;
3744         esac
3746         # The expectation is that --with-windows-sdk should not need to be used
3747         if test -n "$with_windows_sdk"; then
3748             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3749             *" "$with_windows_sdk" "*)
3750                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3751                 ;;
3752             *)
3753                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3754                 ;;
3755             esac
3756         fi
3758         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3759         ac_objext=obj
3760         ac_exeext=exe
3762     else
3763         AC_MSG_ERROR([Visual C++ not found after all, huh])
3764     fi
3766     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3767     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3768         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3769         // between Visual Studio versions and _MSC_VER:
3770         #if _MSC_VER < 1914
3771         #error
3772         #endif
3773     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3775     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3776     # version of the Explorer extension (and maybe other small
3777     # bits, too) needed when installing a 32-bit LibreOffice on a
3778     # 64-bit OS. The 64-bit Explorer extension is a feature that
3779     # has been present since long in OOo. Don't confuse it with
3780     # building LibreOffice itself as 64-bit code.
3782     BUILD_X64=
3783     CXX_X64_BINARY=
3785     if test "$BITNESS_OVERRIDE" = ""; then
3786         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3787         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3788              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3789             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3790                 BUILD_X64=TRUE
3791                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3792             fi
3793         fi
3794         if test "$BUILD_X64" = TRUE; then
3795             AC_MSG_RESULT([found])
3796         else
3797             AC_MSG_RESULT([not found])
3798             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3799         fi
3800     else
3801         CXX_X64_BINARY=$CXX
3802     fi
3803     AC_SUBST(BUILD_X64)
3805     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3806     AC_SUBST(CXX_X64_BINARY)
3808     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3809     # needed to support TWAIN scan on both 32- and 64-bit systems
3811     BUILD_X86=
3813     if test "$BITNESS_OVERRIDE" = "64"; then
3814         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3815         if test -n "$CXX_X86_BINARY"; then
3816             BUILD_X86=TRUE
3817             AC_MSG_RESULT([preset])
3818         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3819             BUILD_X86=TRUE
3820             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3821             CXX_X86_BINARY+=" /arch:SSE"
3822             AC_MSG_RESULT([found])
3823         else
3824             CXX_X86_BINARY=
3825             AC_MSG_RESULT([not found])
3826             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3827         fi
3828     else
3829         BUILD_X86=TRUE
3830         CXX_X86_BINARY=$MSVC_CXX
3831     fi
3832     AC_SUBST(BUILD_X86)
3833     AC_SUBST(CXX_X86_BINARY)
3835 AC_SUBST(VCVER)
3836 AC_SUBST(DEVENV)
3837 AC_SUBST(MSVC_CXX)
3840 # unowinreg.dll
3842 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3843 AC_SUBST(UNOWINREG_DLL)
3845 COM_IS_CLANG=
3846 AC_MSG_CHECKING([whether the compiler is actually Clang])
3847 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3848     #ifndef __clang__
3849     you lose
3850     #endif
3851     int foo=42;
3852     ]])],
3853     [AC_MSG_RESULT([yes])
3854      COM_IS_CLANG=TRUE],
3855     [AC_MSG_RESULT([no])])
3856 AC_SUBST(COM_IS_CLANG)
3858 CC_PLAIN=$CC
3859 CLANGVER=
3860 if test "$COM_IS_CLANG" = TRUE; then
3861     AC_MSG_CHECKING([whether Clang is new enough])
3862     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3863         #if !defined __apple_build_version__
3864         #error
3865         #endif
3866         ]])],
3867         [my_apple_clang=yes],[my_apple_clang=])
3868     if test "$my_apple_clang" = yes; then
3869         AC_MSG_RESULT([assumed yes (Apple Clang)])
3870     else
3871         if test "$_os" = WINNT; then
3872             dnl In which case, assume clang-cl:
3873             my_args="/EP /TC"
3874             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3875             dnl clang-cl:
3876             CC_PLAIN=
3877             for i in $CC; do
3878                 case $i in
3879                 -FIIntrin.h)
3880                     ;;
3881                 *)
3882                     CC_PLAIN="$CC_PLAIN $i"
3883                     ;;
3884                 esac
3885             done
3886         else
3887             my_args="-E -P"
3888         fi
3889         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3890         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3891         CLANGVER=`echo $clang_version \
3892             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3893         if test "$CLANGVER" -ge 50002; then
3894             AC_MSG_RESULT([yes ($clang_version)])
3895         else
3896             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3897         fi
3898         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3899         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3900     fi
3903 SHOWINCLUDES_PREFIX=
3904 if test "$_os" = WINNT; then
3905     dnl We need to guess the prefix of the -showIncludes output, it can be
3906     dnl localized
3907     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3908     echo "#include <stdlib.h>" > conftest.c
3909     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3910         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3911     rm -f conftest.c conftest.obj
3912     if test -z "$SHOWINCLUDES_PREFIX"; then
3913         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3914     else
3915         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3916     fi
3918 AC_SUBST(SHOWINCLUDES_PREFIX)
3921 # prefix C with ccache if needed
3923 if test "$CCACHE" != ""; then
3924     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3926     AC_LANG_PUSH([C])
3927     save_CFLAGS=$CFLAGS
3928     CFLAGS="$CFLAGS --ccache-skip -O2"
3929     dnl an empty program will do, we're checking the compiler flags
3930     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3931                       [use_ccache=yes], [use_ccache=no])
3932     if test $use_ccache = yes; then
3933         AC_MSG_RESULT([yes])
3934     else
3935         CC="$CCACHE $CC"
3936         CC_BASE="ccache $CC_BASE"
3937         AC_MSG_RESULT([no])
3938     fi
3939     CFLAGS=$save_CFLAGS
3940     AC_LANG_POP([C])
3943 # ===================================================================
3944 # check various GCC options that Clang does not support now but maybe
3945 # will somewhen in the future, check them even for GCC, so that the
3946 # flags are set
3947 # ===================================================================
3949 HAVE_GCC_GGDB2=
3950 if test "$GCC" = "yes"; then
3951     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3952     save_CFLAGS=$CFLAGS
3953     CFLAGS="$CFLAGS -Werror -ggdb2"
3954     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3955     CFLAGS=$save_CFLAGS
3956     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3957         AC_MSG_RESULT([yes])
3958     else
3959         AC_MSG_RESULT([no])
3960     fi
3962     if test "$host_cpu" = "m68k"; then
3963         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3964         save_CFLAGS=$CFLAGS
3965         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3966         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3967         CFLAGS=$save_CFLAGS
3968         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3969             AC_MSG_RESULT([yes])
3970         else
3971             AC_MSG_ERROR([no])
3972         fi
3973     fi
3975 AC_SUBST(HAVE_GCC_GGDB2)
3977 dnl ===================================================================
3978 dnl  Test the gcc version
3979 dnl ===================================================================
3980 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3981     AC_MSG_CHECKING([the GCC version])
3982     _gcc_version=`$CC -dumpversion`
3983     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3984         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3985     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3987     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3989     if test "$gcc_full_version" -lt 70000; then
3990         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3991     fi
3992 else
3993     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3994     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3995     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3996     # (which reports itself as GCC 4.2.1).
3997     GCC_VERSION=
3999 AC_SUBST(GCC_VERSION)
4001 dnl Set the ENABLE_DBGUTIL variable
4002 dnl ===================================================================
4003 AC_MSG_CHECKING([whether to build with additional debug utilities])
4004 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4005     ENABLE_DBGUTIL="TRUE"
4006     # this is an extra var so it can have different default on different MSVC
4007     # versions (in case there are version specific problems with it)
4008     MSVC_USE_DEBUG_RUNTIME="TRUE"
4010     AC_MSG_RESULT([yes])
4011     # cppunit and graphite expose STL in public headers
4012     if test "$with_system_cppunit" = "yes"; then
4013         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4014     else
4015         with_system_cppunit=no
4016     fi
4017     if test "$with_system_graphite" = "yes"; then
4018         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4019     else
4020         with_system_graphite=no
4021     fi
4022     if test "$with_system_orcus" = "yes"; then
4023         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4024     else
4025         with_system_orcus=no
4026     fi
4027     if test "$with_system_libcmis" = "yes"; then
4028         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4029     else
4030         with_system_libcmis=no
4031     fi
4032     if test "$with_system_hunspell" = "yes"; then
4033         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4034     else
4035         with_system_hunspell=no
4036     fi
4037     if test "$with_system_gpgmepp" = "yes"; then
4038         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4039     else
4040         with_system_gpgmepp=no
4041     fi
4042     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4043     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4044     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4045     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4046     # of those two is using the system variant:
4047     if test "$with_system_libnumbertext" = "yes"; then
4048         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4049     else
4050         with_system_libnumbertext=no
4051     fi
4052     if test "$with_system_libwps" = "yes"; then
4053         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4054     else
4055         with_system_libwps=no
4056     fi
4057 else
4058     ENABLE_DBGUTIL=""
4059     MSVC_USE_DEBUG_RUNTIME=""
4060     AC_MSG_RESULT([no])
4062 AC_SUBST(ENABLE_DBGUTIL)
4063 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4065 dnl Set the ENABLE_DEBUG variable.
4066 dnl ===================================================================
4067 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4068     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4070 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4071     if test -z "$libo_fuzzed_enable_debug"; then
4072         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4073     else
4074         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4075         enable_debug=yes
4076     fi
4079 AC_MSG_CHECKING([whether to do a debug build])
4080 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4081     ENABLE_DEBUG="TRUE"
4082     if test -n "$ENABLE_DBGUTIL" ; then
4083         AC_MSG_RESULT([yes (dbgutil)])
4084     else
4085         AC_MSG_RESULT([yes])
4086     fi
4087 else
4088     ENABLE_DEBUG=""
4089     AC_MSG_RESULT([no])
4091 AC_SUBST(ENABLE_DEBUG)
4093 dnl ===================================================================
4094 dnl Select the linker to use (gold/lld/ld.bfd).
4095 dnl This is done only after compiler checks (need to know if Clang is
4096 dnl used, for different defaults) and after checking if a debug build
4097 dnl is wanted (non-debug builds get the default linker if not explicitly
4098 dnl specified otherwise).
4099 dnl All checks for linker features/options should come after this.
4100 dnl ===================================================================
4101 check_use_ld()
4103     use_ld=$1
4104     use_ld_fail_if_error=$2
4105     use_ld_ok=
4106     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
4107     use_ld_ldflags_save="$LDFLAGS"
4108     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
4109     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4110 #include <stdio.h>
4111         ],[
4112 printf ("hello world\n");
4113         ])], USE_LD=$use_ld, [])
4114     if test -n "$USE_LD"; then
4115         AC_MSG_RESULT( yes )
4116         use_ld_ok=yes
4117     else
4118         if test -n "$use_ld_fail_if_error"; then
4119             AC_MSG_ERROR( no )
4120         else
4121             AC_MSG_RESULT( no )
4122         fi
4123     fi
4124     if test -n "$use_ld_ok"; then
4125         dnl keep the value of LDFLAGS
4126         return 0
4127     fi
4128     LDFLAGS="$use_ld_ldflags_save"
4129     return 1
4131 USE_LD=
4132 if test "$enable_ld" != "no"; then
4133     if test "$GCC" = "yes"; then
4134         if test -n "$enable_ld"; then
4135             check_use_ld "$enable_ld" fail_if_error
4136         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4137             dnl non-debug builds default to the default linker
4138             true
4139         elif test -n "$COM_IS_CLANG"; then
4140             check_use_ld lld
4141             if test $? -ne 0; then
4142                 check_use_ld gold
4143             fi
4144         else
4145             # For gcc first try gold, new versions also support lld.
4146             check_use_ld gold
4147             if test $? -ne 0; then
4148                 check_use_ld lld
4149             fi
4150         fi
4151         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4152         rm conftest.out
4153         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4154         if test -z "$ld_used"; then
4155             ld_used="unknown"
4156         fi
4157         AC_MSG_CHECKING([for linker that is used])
4158         AC_MSG_RESULT([$ld_used])
4159         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4160             if echo "$ld_used" | grep -q "^GNU ld"; then
4161                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4162                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4163             fi
4164         fi
4165     else
4166         if test "$enable_ld" = "yes"; then
4167             AC_MSG_ERROR([--enable-ld not supported])
4168         fi
4169     fi
4171 AC_SUBST(USE_LD)
4173 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4174 if test "$GCC" = "yes"; then
4175     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4176     bsymbolic_functions_ldflags_save=$LDFLAGS
4177     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4178     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4179 #include <stdio.h>
4180         ],[
4181 printf ("hello world\n");
4182         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4183     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4184         AC_MSG_RESULT( found )
4185     else
4186         AC_MSG_RESULT( not found )
4187     fi
4188     LDFLAGS=$bsymbolic_functions_ldflags_save
4190 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4193 HAVE_GSPLIT_DWARF=
4194 if test "$enable_split_debug" != no; then
4195     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4196     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4197         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4198         save_CFLAGS=$CFLAGS
4199         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4200         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4201         CFLAGS=$save_CFLAGS
4202         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4203             AC_MSG_RESULT([yes])
4204         else
4205             if test "$enable_split_debug" = yes; then
4206                 AC_MSG_ERROR([no])
4207             else
4208                 AC_MSG_RESULT([no])
4209             fi
4210         fi
4211     fi
4212     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4213         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4214         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4215     fi
4217 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4219 ENABLE_GDB_INDEX=
4220 if test "$enable_gdb_index" != "no"; then
4221     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4222     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4223         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4224         save_CFLAGS=$CFLAGS
4225         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4226         have_ggnu_pubnames=
4227         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4228         if test "$have_ggnu_pubnames" != "TRUE"; then
4229             if test "$enable_gdb_index" = "yes"; then
4230                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4231             else
4232                 AC_MSG_RESULT( no )
4233             fi
4234         else
4235             AC_MSG_RESULT( yes )
4236             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4237             ldflags_save=$LDFLAGS
4238             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4239             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4240 #include <stdio.h>
4241                 ],[
4242 printf ("hello world\n");
4243                 ])], ENABLE_GDB_INDEX=TRUE, [])
4244             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4245                 AC_MSG_RESULT( yes )
4246             else
4247                 if test "$enable_gdb_index" = "yes"; then
4248                     AC_MSG_ERROR( no )
4249                 else
4250                     AC_MSG_RESULT( no )
4251                 fi
4252             fi
4253             LDFLAGS=$ldflags_save
4254         fi
4255         CFLAGS=$save_CFLAGS
4256         fi
4257     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4258         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4259         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4260     fi
4262 AC_SUBST(ENABLE_GDB_INDEX)
4264 if test "$enable_sal_log" = yes; then
4265     ENABLE_SAL_LOG=TRUE
4267 AC_SUBST(ENABLE_SAL_LOG)
4269 dnl Check for enable symbols option
4270 dnl ===================================================================
4271 AC_MSG_CHECKING([whether to generate debug information])
4272 if test -z "$enable_symbols"; then
4273     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4274         enable_symbols=yes
4275     else
4276         enable_symbols=no
4277     fi
4279 if test "$enable_symbols" = yes; then
4280     ENABLE_SYMBOLS_FOR=all
4281     AC_MSG_RESULT([yes])
4282 elif test "$enable_symbols" = no; then
4283     ENABLE_SYMBOLS_FOR=
4284     AC_MSG_RESULT([no])
4285 else
4286     # Selective debuginfo.
4287     ENABLE_SYMBOLS_FOR="$enable_symbols"
4288     AC_MSG_RESULT([for "$enable_symbols"])
4290 AC_SUBST(ENABLE_SYMBOLS_FOR)
4292 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4293     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4294     AC_MSG_CHECKING([whether enough memory is available for linking])
4295     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4296     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4297     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4298         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4299     else
4300         AC_MSG_RESULT([yes])
4301     fi
4304 AC_MSG_CHECKING([whether to compile with optimization flags])
4305 if test -z "$enable_optimized"; then
4306     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4307         enable_optimized=no
4308     else
4309         enable_optimized=yes
4310     fi
4312 if test "$enable_optimized" != no; then
4313     ENABLE_OPTIMIZED=TRUE
4314     AC_MSG_RESULT([yes])
4315 else
4316     ENABLE_OPTIMIZED=
4317     AC_MSG_RESULT([no])
4319 AC_SUBST(ENABLE_OPTIMIZED)
4322 # determine CPUNAME, OS, ...
4323 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4325 case "$host_os" in
4327 aix*)
4328     COM=GCC
4329     CPUNAME=POWERPC
4330     USING_X11=TRUE
4331     OS=AIX
4332     RTL_OS=AIX
4333     RTL_ARCH=PowerPC
4334     PLATFORMID=aix_powerpc
4335     P_SEP=:
4336     ;;
4338 cygwin*)
4339     COM=MSC
4340     USING_X11=
4341     OS=WNT
4342     RTL_OS=Windows
4343     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4344         P_SEP=";"
4345     else
4346         P_SEP=:
4347     fi
4348     case "$host_cpu" in
4349     i*86|x86_64)
4350         if test "$BITNESS_OVERRIDE" = 64; then
4351             CPUNAME=X86_64
4352             RTL_ARCH=X86_64
4353             PLATFORMID=windows_x86_64
4354             WINDOWS_X64=1
4355             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4356         else
4357             CPUNAME=INTEL
4358             RTL_ARCH=x86
4359             PLATFORMID=windows_x86
4360         fi
4361         ;;
4362     *)
4363         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4364         ;;
4365     esac
4366     SCPDEFS="$SCPDEFS -D_MSC_VER"
4367     ;;
4369 darwin*|macos*)
4370     COM=GCC
4371     USING_X11=
4372     OS=MACOSX
4373     RTL_OS=MacOSX
4374     P_SEP=:
4376     case "$host_cpu" in
4377     aarch64|arm64)
4378         if test "$enable_ios_simulator" = "yes"; then
4379             OS=iOS
4380         else
4381             CPUNAME=AARCH64
4382             RTL_ARCH=AARCH64
4383             PLATFORMID=macosx_arm64
4384         fi
4385         ;;
4386     x86_64)
4387         if test "$enable_ios_simulator" = "yes"; then
4388             OS=iOS
4389         fi
4390         CPUNAME=X86_64
4391         RTL_ARCH=X86_64
4392         PLATFORMID=macosx_x86_64
4393         ;;
4394     *)
4395         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4396         ;;
4397     esac
4398     ;;
4400 ios*)
4401     COM=GCC
4402     USING_X11=
4403     OS=iOS
4404     RTL_OS=iOS
4405     P_SEP=:
4407     case "$host_cpu" in
4408     aarch64|arm64)
4409         if test "$enable_ios_simulator" = "yes"; then
4410             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4411         fi
4412         ;;
4413     *)
4414         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4415         ;;
4416     esac
4417     CPUNAME=AARCH64
4418     RTL_ARCH=AARCH64
4419     PLATFORMID=ios_arm64
4420     ;;
4422 dragonfly*)
4423     COM=GCC
4424     USING_X11=TRUE
4425     OS=DRAGONFLY
4426     RTL_OS=DragonFly
4427     P_SEP=:
4429     case "$host_cpu" in
4430     i*86)
4431         CPUNAME=INTEL
4432         RTL_ARCH=x86
4433         PLATFORMID=dragonfly_x86
4434         ;;
4435     x86_64)
4436         CPUNAME=X86_64
4437         RTL_ARCH=X86_64
4438         PLATFORMID=dragonfly_x86_64
4439         ;;
4440     *)
4441         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4442         ;;
4443     esac
4444     ;;
4446 freebsd*)
4447     COM=GCC
4448     USING_X11=TRUE
4449     RTL_OS=FreeBSD
4450     OS=FREEBSD
4451     P_SEP=:
4453     case "$host_cpu" in
4454     i*86)
4455         CPUNAME=INTEL
4456         RTL_ARCH=x86
4457         PLATFORMID=freebsd_x86
4458         ;;
4459     x86_64|amd64)
4460         CPUNAME=X86_64
4461         RTL_ARCH=X86_64
4462         PLATFORMID=freebsd_x86_64
4463         ;;
4464     *)
4465         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4466         ;;
4467     esac
4468     ;;
4470 haiku*)
4471     COM=GCC
4472     USING_X11=
4473     GUIBASE=haiku
4474     RTL_OS=Haiku
4475     OS=HAIKU
4476     P_SEP=:
4478     case "$host_cpu" in
4479     i*86)
4480         CPUNAME=INTEL
4481         RTL_ARCH=x86
4482         PLATFORMID=haiku_x86
4483         ;;
4484     x86_64|amd64)
4485         CPUNAME=X86_64
4486         RTL_ARCH=X86_64
4487         PLATFORMID=haiku_x86_64
4488         ;;
4489     *)
4490         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4491         ;;
4492     esac
4493     ;;
4495 kfreebsd*)
4496     COM=GCC
4497     USING_X11=TRUE
4498     OS=LINUX
4499     RTL_OS=kFreeBSD
4500     P_SEP=:
4502     case "$host_cpu" in
4504     i*86)
4505         CPUNAME=INTEL
4506         RTL_ARCH=x86
4507         PLATFORMID=kfreebsd_x86
4508         ;;
4509     x86_64)
4510         CPUNAME=X86_64
4511         RTL_ARCH=X86_64
4512         PLATFORMID=kfreebsd_x86_64
4513         ;;
4514     *)
4515         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4516         ;;
4517     esac
4518     ;;
4520 linux-gnu*)
4521     COM=GCC
4522     USING_X11=TRUE
4523     OS=LINUX
4524     RTL_OS=Linux
4525     P_SEP=:
4527     case "$host_cpu" in
4529     aarch64)
4530         CPUNAME=AARCH64
4531         PLATFORMID=linux_aarch64
4532         RTL_ARCH=AARCH64
4533         EPM_FLAGS="-a arm64"
4534         ;;
4535     alpha)
4536         CPUNAME=AXP
4537         RTL_ARCH=ALPHA
4538         PLATFORMID=linux_alpha
4539         ;;
4540     arm*)
4541         CPUNAME=ARM
4542         EPM_FLAGS="-a arm"
4543         RTL_ARCH=ARM_EABI
4544         PLATFORMID=linux_arm_eabi
4545         case "$host_cpu" in
4546         arm*-linux)
4547             RTL_ARCH=ARM_OABI
4548             PLATFORMID=linux_arm_oabi
4549             ;;
4550         esac
4551         ;;
4552     hppa)
4553         CPUNAME=HPPA
4554         RTL_ARCH=HPPA
4555         EPM_FLAGS="-a hppa"
4556         PLATFORMID=linux_hppa
4557         ;;
4558     i*86)
4559         CPUNAME=INTEL
4560         RTL_ARCH=x86
4561         PLATFORMID=linux_x86
4562         ;;
4563     ia64)
4564         CPUNAME=IA64
4565         RTL_ARCH=IA64
4566         PLATFORMID=linux_ia64
4567         ;;
4568     mips)
4569         CPUNAME=GODSON
4570         RTL_ARCH=MIPS_EB
4571         EPM_FLAGS="-a mips"
4572         PLATFORMID=linux_mips_eb
4573         ;;
4574     mips64)
4575         CPUNAME=GODSON64
4576         RTL_ARCH=MIPS64_EB
4577         EPM_FLAGS="-a mips64"
4578         PLATFORMID=linux_mips64_eb
4579         ;;
4580     mips64el)
4581         CPUNAME=GODSON64
4582         RTL_ARCH=MIPS64_EL
4583         EPM_FLAGS="-a mips64el"
4584         PLATFORMID=linux_mips64_el
4585         ;;
4586     mipsel)
4587         CPUNAME=GODSON
4588         RTL_ARCH=MIPS_EL
4589         EPM_FLAGS="-a mipsel"
4590         PLATFORMID=linux_mips_el
4591         ;;
4592     m68k)
4593         CPUNAME=M68K
4594         RTL_ARCH=M68K
4595         PLATFORMID=linux_m68k
4596         ;;
4597     powerpc)
4598         CPUNAME=POWERPC
4599         RTL_ARCH=PowerPC
4600         PLATFORMID=linux_powerpc
4601         ;;
4602     powerpc64)
4603         CPUNAME=POWERPC64
4604         RTL_ARCH=PowerPC_64
4605         PLATFORMID=linux_powerpc64
4606         ;;
4607     powerpc64le)
4608         CPUNAME=POWERPC64
4609         RTL_ARCH=PowerPC_64_LE
4610         PLATFORMID=linux_powerpc64_le
4611         ;;
4612     sparc)
4613         CPUNAME=SPARC
4614         RTL_ARCH=SPARC
4615         PLATFORMID=linux_sparc
4616         ;;
4617     sparc64)
4618         CPUNAME=SPARC64
4619         RTL_ARCH=SPARC64
4620         PLATFORMID=linux_sparc64
4621         ;;
4622     s390)
4623         CPUNAME=S390
4624         RTL_ARCH=S390
4625         PLATFORMID=linux_s390
4626         ;;
4627     s390x)
4628         CPUNAME=S390X
4629         RTL_ARCH=S390x
4630         PLATFORMID=linux_s390x
4631         ;;
4632     x86_64)
4633         CPUNAME=X86_64
4634         RTL_ARCH=X86_64
4635         PLATFORMID=linux_x86_64
4636         ;;
4637     *)
4638         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4639         ;;
4640     esac
4641     ;;
4643 linux-android*)
4644     COM=GCC
4645     USING_X11=
4646     OS=ANDROID
4647     RTL_OS=Android
4648     P_SEP=:
4650     case "$host_cpu" in
4652     arm|armel)
4653         CPUNAME=ARM
4654         RTL_ARCH=ARM_EABI
4655         PLATFORMID=android_arm_eabi
4656         ;;
4657     aarch64)
4658         CPUNAME=AARCH64
4659         RTL_ARCH=AARCH64
4660         PLATFORMID=android_aarch64
4661         ;;
4662     i*86)
4663         CPUNAME=INTEL
4664         RTL_ARCH=x86
4665         PLATFORMID=android_x86
4666         ;;
4667     x86_64)
4668         CPUNAME=X86_64
4669         RTL_ARCH=X86_64
4670         PLATFORMID=android_x86_64
4671         ;;
4672     *)
4673         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4674         ;;
4675     esac
4676     ;;
4678 *netbsd*)
4679     COM=GCC
4680     USING_X11=TRUE
4681     OS=NETBSD
4682     RTL_OS=NetBSD
4683     P_SEP=:
4685     case "$host_cpu" in
4686     i*86)
4687         CPUNAME=INTEL
4688         RTL_ARCH=x86
4689         PLATFORMID=netbsd_x86
4690         ;;
4691     powerpc)
4692         CPUNAME=POWERPC
4693         RTL_ARCH=PowerPC
4694         PLATFORMID=netbsd_powerpc
4695         ;;
4696     sparc)
4697         CPUNAME=SPARC
4698         RTL_ARCH=SPARC
4699         PLATFORMID=netbsd_sparc
4700         ;;
4701     x86_64)
4702         CPUNAME=X86_64
4703         RTL_ARCH=X86_64
4704         PLATFORMID=netbsd_x86_64
4705         ;;
4706     *)
4707         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4708         ;;
4709     esac
4710     ;;
4712 openbsd*)
4713     COM=GCC
4714     USING_X11=TRUE
4715     OS=OPENBSD
4716     RTL_OS=OpenBSD
4717     P_SEP=:
4719     case "$host_cpu" in
4720     i*86)
4721         CPUNAME=INTEL
4722         RTL_ARCH=x86
4723         PLATFORMID=openbsd_x86
4724         ;;
4725     x86_64)
4726         CPUNAME=X86_64
4727         RTL_ARCH=X86_64
4728         PLATFORMID=openbsd_x86_64
4729         ;;
4730     *)
4731         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4732         ;;
4733     esac
4734     SOLARINC="$SOLARINC -I/usr/local/include"
4735     ;;
4737 solaris*)
4738     COM=GCC
4739     USING_X11=TRUE
4740     OS=SOLARIS
4741     RTL_OS=Solaris
4742     P_SEP=:
4744     case "$host_cpu" in
4745     i*86)
4746         CPUNAME=INTEL
4747         RTL_ARCH=x86
4748         PLATFORMID=solaris_x86
4749         ;;
4750     sparc)
4751         CPUNAME=SPARC
4752         RTL_ARCH=SPARC
4753         PLATFORMID=solaris_sparc
4754         ;;
4755     sparc64)
4756         CPUNAME=SPARC64
4757         RTL_ARCH=SPARC64
4758         PLATFORMID=solaris_sparc64
4759         ;;
4760     *)
4761         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4762         ;;
4763     esac
4764     SOLARINC="$SOLARINC -I/usr/local/include"
4765     ;;
4768     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4769     ;;
4770 esac
4772 if test "$with_x" = "no"; then
4773     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4776 DISABLE_GUI=""
4777 if test "$enable_gui" = "no"; then
4778     if test "$USING_X11" != TRUE; then
4779         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4780     fi
4781     USING_X11=
4782     DISABLE_GUI=TRUE
4783     AC_DEFINE(HAVE_FEATURE_UI,0)
4784     test_cairo=yes
4786 AC_SUBST(DISABLE_GUI)
4788 WORKDIR="${BUILDDIR}/workdir"
4789 INSTDIR="${BUILDDIR}/instdir"
4790 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4791 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4792 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4793 AC_SUBST(COM)
4794 AC_SUBST(CPUNAME)
4795 AC_SUBST(RTL_OS)
4796 AC_SUBST(RTL_ARCH)
4797 AC_SUBST(EPM_FLAGS)
4798 AC_SUBST(USING_X11)
4799 AC_SUBST([INSTDIR])
4800 AC_SUBST([INSTROOT])
4801 AC_SUBST([INSTROOTBASE])
4802 AC_SUBST(OS)
4803 AC_SUBST(P_SEP)
4804 AC_SUBST(WORKDIR)
4805 AC_SUBST(PLATFORMID)
4806 AC_SUBST(WINDOWS_X64)
4807 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4809 dnl ===================================================================
4810 dnl Test which package format to use
4811 dnl ===================================================================
4812 AC_MSG_CHECKING([which package format to use])
4813 if test -n "$with_package_format" -a "$with_package_format" != no; then
4814     for i in $with_package_format; do
4815         case "$i" in
4816         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4817             ;;
4818         *)
4819             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4820 aix - AIX software distribution
4821 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4822 deb - Debian software distribution
4823 pkg - Solaris software distribution
4824 rpm - RedHat software distribution
4826 LibreOffice additionally supports:
4827 archive - .tar.gz or .zip
4828 dmg - macOS .dmg
4829 installed - installation tree
4830 msi - Windows .msi
4831         ])
4832             ;;
4833         esac
4834     done
4835     # fakeroot is needed to ensure correct file ownerships/permissions
4836     # inside deb packages and tar archives created on Linux and Solaris.
4837     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4838         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4839         if test "$FAKEROOT" = "no"; then
4840             AC_MSG_ERROR(
4841                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4842         fi
4843     fi
4844     PKGFORMAT="$with_package_format"
4845     AC_MSG_RESULT([$PKGFORMAT])
4846 else
4847     PKGFORMAT=
4848     AC_MSG_RESULT([none])
4850 AC_SUBST(PKGFORMAT)
4852 dnl ===================================================================
4853 dnl Set up a different compiler to produce tools to run on the build
4854 dnl machine when doing cross-compilation
4855 dnl ===================================================================
4857 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4858 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4859 if test "$cross_compiling" = "yes"; then
4860     AC_MSG_CHECKING([for BUILD platform configuration])
4861     echo
4862     rm -rf CONF-FOR-BUILD config_build.mk
4863     mkdir CONF-FOR-BUILD
4864     # Here must be listed all files needed when running the configure script. In particular, also
4865     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4866     # keep them in the same order as there.
4867     (cd $SRC_ROOT && tar cf - \
4868         config.guess \
4869         bin/get_config_variables \
4870         solenv/bin/getcompver.awk \
4871         solenv/inc/langlist.mk \
4872         download.lst \
4873         config_host.mk.in \
4874         config_host_lang.mk.in \
4875         Makefile.in \
4876         bin/bffvalidator.sh.in \
4877         bin/odfvalidator.sh.in \
4878         bin/officeotron.sh.in \
4879         instsetoo_native/util/openoffice.lst.in \
4880         setup_native/source/packinfo/finals_instsetoo.txt.in \
4881         config_host/*.in \
4882         sysui/desktop/macosx/Info.plist.in) \
4883     | (cd CONF-FOR-BUILD && tar xf -)
4884     cp configure CONF-FOR-BUILD
4885     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4886     (
4887     unset COM USING_X11 OS CPUNAME
4888     unset CC CXX SYSBASE CFLAGS
4889     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4890     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4891     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4892     if test -n "$CC_FOR_BUILD"; then
4893         export CC="$CC_FOR_BUILD"
4894         CC_BASE=`first_arg_basename "$CC"`
4895     fi
4896     if test -n "$CXX_FOR_BUILD"; then
4897         export CXX="$CXX_FOR_BUILD"
4898         CXX_BASE=`first_arg_basename "$CXX"`
4899     fi
4900     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4901     cd CONF-FOR-BUILD
4902     sub_conf_opts=""
4903     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4904     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4905     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4906     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4907     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4908     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4909     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4910     # Don't bother having configure look for stuff not needed for the build platform anyway
4911     ./configure \
4912         --disable-cups \
4913         --disable-gstreamer-1-0 \
4914         --disable-gtk3 \
4915         --disable-pdfimport \
4916         --disable-postgresql-sdbc \
4917         --enable-icecream="$enable_icecream" \
4918         --with-parallelism="$with_parallelism" \
4919         --without-doxygen \
4920         --without-java \
4921         $sub_conf_opts \
4922         --srcdir=$srcdir \
4923         2>&1 | sed -e 's/^/    /'
4924     test -f ./config_host.mk 2>/dev/null || exit
4925     cp config_host.mk ../config_build.mk
4926     cp config_host_lang.mk ../config_build_lang.mk
4927     mv config.log ../config.Build.log
4928     mkdir -p ../config_build
4929     mv config_host/*.h ../config_build
4930     . ./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
4932     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
4933         VV='$'$V
4934         VV=`eval "echo $VV"`
4935         if test -n "$VV"; then
4936             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4937             echo "$line" >>build-config
4938         fi
4939     done
4941     for V in INSTDIR INSTROOT WORKDIR; do
4942         VV='$'$V
4943         VV=`eval "echo $VV"`
4944         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4945         if test -n "$VV"; then
4946             line="${V}_FOR_BUILD='$VV'"
4947             echo "$line" >>build-config
4948         fi
4949     done
4951     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4952     echo "$line" >>build-config
4954     )
4955     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4956     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])
4957     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4958              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4960     eval `cat CONF-FOR-BUILD/build-config`
4962     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4964     rm -rf CONF-FOR-BUILD
4965 else
4966     OS_FOR_BUILD="$OS"
4967     CC_FOR_BUILD="$CC"
4968     CXX_FOR_BUILD="$CXX"
4969     INSTDIR_FOR_BUILD="$INSTDIR"
4970     INSTROOT_FOR_BUILD="$INSTROOT"
4971     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4972     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4973     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4974     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4975     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4976     WORKDIR_FOR_BUILD="$WORKDIR"
4978 AC_SUBST(OS_FOR_BUILD)
4979 AC_SUBST(INSTDIR_FOR_BUILD)
4980 AC_SUBST(INSTROOT_FOR_BUILD)
4981 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4982 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4983 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4984 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4985 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4986 AC_SUBST(WORKDIR_FOR_BUILD)
4988 dnl ===================================================================
4989 dnl Check for syslog header
4990 dnl ===================================================================
4991 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4993 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4994 dnl ===================================================================
4995 AC_MSG_CHECKING([whether to turn warnings to errors])
4996 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4997     ENABLE_WERROR="TRUE"
4998     AC_MSG_RESULT([yes])
4999 else
5000     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5001         ENABLE_WERROR="TRUE"
5002         AC_MSG_RESULT([yes])
5003     else
5004         AC_MSG_RESULT([no])
5005     fi
5007 AC_SUBST(ENABLE_WERROR)
5009 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5010 dnl ===================================================================
5011 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5012 if test -z "$enable_assert_always_abort"; then
5013    if test "$ENABLE_DEBUG" = TRUE; then
5014        enable_assert_always_abort=yes
5015    else
5016        enable_assert_always_abort=no
5017    fi
5019 if test "$enable_assert_always_abort" = "yes"; then
5020     ASSERT_ALWAYS_ABORT="TRUE"
5021     AC_MSG_RESULT([yes])
5022 else
5023     ASSERT_ALWAYS_ABORT="FALSE"
5024     AC_MSG_RESULT([no])
5026 AC_SUBST(ASSERT_ALWAYS_ABORT)
5028 # Determine whether to use ooenv for the instdir installation
5029 # ===================================================================
5030 if test $_os != "WINNT" -a $_os != "Darwin"; then
5031     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5032     if test "$enable_ooenv" = "no"; then
5033         AC_MSG_RESULT([no])
5034     else
5035         ENABLE_OOENV="TRUE"
5036         AC_MSG_RESULT([yes])
5037     fi
5039 AC_SUBST(ENABLE_OOENV)
5041 if test "$USING_X11" != TRUE; then
5042     # be sure to do not mess with unneeded stuff
5043     test_randr=no
5044     test_xrender=no
5045     test_cups=no
5046     test_dbus=no
5047     build_gstreamer_1_0=no
5048     test_kf5=no
5049     test_qt5=no
5050     test_gtk3_kde5=no
5051     enable_cairo_canvas=no
5054 if test "$OS" = "HAIKU"; then
5055     enable_cairo_canvas=yes
5056     test_kf5=yes
5059 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5060     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!])
5061     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!"
5062     enable_kf5=yes
5065 if test "$test_kf5" = "yes"; then
5066     test_qt5=yes
5069 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5070     if test "$enable_qt5" = "no"; then
5071         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5072     else
5073         enable_qt5=yes
5074     fi
5077 dnl ===================================================================
5078 dnl check for cups support
5079 dnl ===================================================================
5080 ENABLE_CUPS=""
5082 if test "$enable_cups" = "no"; then
5083     test_cups=no
5086 AC_MSG_CHECKING([whether to enable CUPS support])
5087 if test "$test_cups" = "yes"; then
5088     ENABLE_CUPS="TRUE"
5089     AC_MSG_RESULT([yes])
5091     AC_MSG_CHECKING([whether cups support is present])
5092     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5093     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5094     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5095         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5096     fi
5098 else
5099     AC_MSG_RESULT([no])
5102 AC_SUBST(ENABLE_CUPS)
5104 # fontconfig checks
5105 if test "$test_fontconfig" = "yes"; then
5106     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5107     SYSTEM_FONTCONFIG=TRUE
5108     FilterLibs "${FONTCONFIG_LIBS}"
5109     FONTCONFIG_LIBS="${filteredlibs}"
5111 AC_SUBST(FONTCONFIG_CFLAGS)
5112 AC_SUBST(FONTCONFIG_LIBS)
5113 AC_SUBST([SYSTEM_FONTCONFIG])
5115 dnl whether to find & fetch external tarballs?
5116 dnl ===================================================================
5117 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5118    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5119        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5120    else
5121        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5122    fi
5124 if test -z "$TARFILE_LOCATION"; then
5125     if test -d "$SRC_ROOT/src" ; then
5126         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5127         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5128     fi
5129     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5130 else
5131     AbsolutePath "$TARFILE_LOCATION"
5132     PathFormat "${absolute_path}"
5133     TARFILE_LOCATION="${formatted_path}"
5135 AC_SUBST(TARFILE_LOCATION)
5137 AC_MSG_CHECKING([whether we want to fetch tarballs])
5138 if test "$enable_fetch_external" != "no"; then
5139     if test "$with_all_tarballs" = "yes"; then
5140         AC_MSG_RESULT([yes, all of them])
5141         DO_FETCH_TARBALLS="ALL"
5142     else
5143         AC_MSG_RESULT([yes, if we use them])
5144         DO_FETCH_TARBALLS="TRUE"
5145     fi
5146 else
5147     AC_MSG_RESULT([no])
5148     DO_FETCH_TARBALLS=
5150 AC_SUBST(DO_FETCH_TARBALLS)
5152 AC_MSG_CHECKING([whether to build help])
5153 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5154     BUILD_TYPE="$BUILD_TYPE HELP"
5155     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5156     case "$with_help" in
5157     "html")
5158         ENABLE_HTMLHELP=TRUE
5159         SCPDEFS="$SCPDEFS -DWITH_HELP"
5160         AC_MSG_RESULT([HTML])
5161         ;;
5162     "online")
5163         ENABLE_HTMLHELP=TRUE
5164         HELP_ONLINE=TRUE
5165         AC_MSG_RESULT([HTML])
5166         ;;
5167     yes)
5168         SCPDEFS="$SCPDEFS -DWITH_HELP"
5169         AC_MSG_RESULT([yes])
5170         ;;
5171     *)
5172         AC_MSG_ERROR([Unknown --with-help=$with_help])
5173         ;;
5174     esac
5175 else
5176     AC_MSG_RESULT([no])
5178 AC_SUBST([ENABLE_HTMLHELP])
5179 AC_SUBST([HELP_ONLINE])
5181 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5182 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5183     BUILD_TYPE="$BUILD_TYPE HELP"
5184     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5185     case "$with_omindex" in
5186     "server")
5187         ENABLE_HTMLHELP=TRUE
5188         HELP_ONLINE=TRUE
5189         HELP_OMINDEX_PAGE=TRUE
5190         AC_MSG_RESULT([SERVER])
5191         ;;
5192     "noxap")
5193         ENABLE_HTMLHELP=TRUE
5194         HELP_ONLINE=TRUE
5195         HELP_OMINDEX_PAGE=FALSE
5196         AC_MSG_RESULT([NOXAP])
5197         ;;
5198     *)
5199         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5200         ;;
5201     esac
5202 else
5203     HELP_OMINDEX_PAGE=FALSE
5204     AC_MSG_RESULT([no])
5206 AC_SUBST([ENABLE_HTMLHELP])
5207 AC_SUBST([HELP_OMINDEX_PAGE])
5208 AC_SUBST([HELP_ONLINE])
5211 dnl Test whether to include MySpell dictionaries
5212 dnl ===================================================================
5213 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5214 if test "$with_myspell_dicts" = "yes"; then
5215     AC_MSG_RESULT([yes])
5216     WITH_MYSPELL_DICTS=TRUE
5217     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5218     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5219 else
5220     AC_MSG_RESULT([no])
5221     WITH_MYSPELL_DICTS=
5223 AC_SUBST(WITH_MYSPELL_DICTS)
5225 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5226 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5227     if test "$with_system_dicts" = yes; then
5228         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5229     fi
5230     with_system_dicts=no
5233 AC_MSG_CHECKING([whether to use dicts from external paths])
5234 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5235     AC_MSG_RESULT([yes])
5236     SYSTEM_DICTS=TRUE
5237     AC_MSG_CHECKING([for spelling dictionary directory])
5238     if test -n "$with_external_dict_dir"; then
5239         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5240     else
5241         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5242         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5243             DICT_SYSTEM_DIR=file:///usr/share/myspell
5244         fi
5245     fi
5246     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5247     AC_MSG_CHECKING([for hyphenation patterns directory])
5248     if test -n "$with_external_hyph_dir"; then
5249         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5250     else
5251         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5252     fi
5253     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5254     AC_MSG_CHECKING([for thesaurus directory])
5255     if test -n "$with_external_thes_dir"; then
5256         THES_SYSTEM_DIR=file://$with_external_thes_dir
5257     else
5258         THES_SYSTEM_DIR=file:///usr/share/mythes
5259     fi
5260     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5261 else
5262     AC_MSG_RESULT([no])
5263     SYSTEM_DICTS=
5265 AC_SUBST(SYSTEM_DICTS)
5266 AC_SUBST(DICT_SYSTEM_DIR)
5267 AC_SUBST(HYPH_SYSTEM_DIR)
5268 AC_SUBST(THES_SYSTEM_DIR)
5270 dnl ===================================================================
5271 dnl Precompiled headers.
5272 ENABLE_PCH=""
5273 AC_MSG_CHECKING([whether to enable pch feature])
5274 if test -z "$enable_pch"; then
5275     if test "$_os" = "WINNT"; then
5276         # Enabled by default on Windows.
5277         enable_pch=yes
5278     else
5279         enable_pch=no
5280     fi
5282 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5283     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5285 if test "$enable_pch" = "system"; then
5286     ENABLE_PCH="1"
5287     AC_MSG_RESULT([yes (system headers)])
5288 elif test "$enable_pch" = "base"; then
5289     ENABLE_PCH="2"
5290     AC_MSG_RESULT([yes (system and base headers)])
5291 elif test "$enable_pch" = "normal"; then
5292     ENABLE_PCH="3"
5293     AC_MSG_RESULT([yes (normal)])
5294 elif test "$enable_pch" = "full"; then
5295     ENABLE_PCH="4"
5296     AC_MSG_RESULT([yes (full)])
5297 elif test "$enable_pch" = "yes"; then
5298     # Pick a suitable default.
5299     if test "$GCC" = "yes"; then
5300         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5301         # while making the PCHs larger and rebuilds more likely.
5302         ENABLE_PCH="2"
5303         AC_MSG_RESULT([yes (system and base headers)])
5304     else
5305         # With MSVC the highest level makes a significant difference,
5306         # and it was the default when there used to be no PCH levels.
5307         ENABLE_PCH="4"
5308         AC_MSG_RESULT([yes (full)])
5309     fi
5310 elif test "$enable_pch" = "no"; then
5311     AC_MSG_RESULT([no])
5312 else
5313     AC_MSG_ERROR([Unknown value for --enable-pch])
5315 AC_SUBST(ENABLE_PCH)
5316 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5317 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5318     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5319     if test "$CCACHE_BIN" != "not found"; then
5320         AC_MSG_CHECKING([ccache version])
5321         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5322         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5323         AC_MSG_RESULT([$CCACHE_VERSION])
5324         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5325         if test "$CCACHE_NUMVER" -gt "030701"; then
5326             AC_MSG_RESULT([yes])
5327         else
5328             AC_MSG_RESULT([no (not newer than 3.7.1)])
5329             CCACHE_DEPEND_MODE=
5330         fi
5331     fi
5334 TAB=`printf '\t'`
5336 AC_MSG_CHECKING([the GNU Make version])
5337 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5338 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5339 if test "$_make_longver" -ge "038200"; then
5340     AC_MSG_RESULT([$GNUMAKE $_make_version])
5342 elif test "$_make_longver" -ge "038100"; then
5343     if test "$build_os" = "cygwin"; then
5344         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5345     fi
5346     AC_MSG_RESULT([$GNUMAKE $_make_version])
5348     dnl ===================================================================
5349     dnl Search all the common names for sha1sum
5350     dnl ===================================================================
5351     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5352     if test -z "$SHA1SUM"; then
5353         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5354     elif test "$SHA1SUM" = "openssl"; then
5355         SHA1SUM="openssl sha1"
5356     fi
5357     AC_MSG_CHECKING([for GNU Make bug 20033])
5358     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5359     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5360 A := \$(wildcard *.a)
5362 .PHONY: all
5363 all: \$(A:.a=.b)
5364 <TAB>@echo survived bug20033.
5366 .PHONY: setup
5367 setup:
5368 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5370 define d1
5371 @echo lala \$(1)
5372 @sleep 1
5373 endef
5375 define d2
5376 @echo tyty \$(1)
5377 @sleep 1
5378 endef
5380 %.b : %.a
5381 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5382 <TAB>\$(call d1,\$(CHECKSUM)),\
5383 <TAB>\$(call d2,\$(CHECKSUM)))
5385     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5386         no_parallelism_make="YES"
5387         AC_MSG_RESULT([yes, disable parallelism])
5388     else
5389         AC_MSG_RESULT([no, keep parallelism enabled])
5390     fi
5391     rm -rf $TESTGMAKEBUG20033
5392 else
5393     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5396 # find if gnumake support file function
5397 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5398 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5399 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5400     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5402 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5403 \$(file >test.txt,Success )
5405 .PHONY: all
5406 all:
5407 <TAB>@cat test.txt
5410 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5411 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5412     HAVE_GNUMAKE_FILE_FUNC=TRUE
5413     AC_MSG_RESULT([yes])
5414 else
5415     AC_MSG_RESULT([no])
5417 rm -rf $TESTGMAKEFILEFUNC
5418 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5419 AC_SUBST(GNUMAKE_WIN_NATIVE)
5421 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5422 STALE_MAKE=
5423 if test "$_make_ver_check" = ""; then
5424    STALE_MAKE=TRUE
5427 HAVE_LD_HASH_STYLE=FALSE
5428 WITH_LINKER_HASH_STYLE=
5429 AC_MSG_CHECKING([for --hash-style gcc linker support])
5430 if test "$GCC" = "yes"; then
5431     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5432         hash_styles="gnu sysv"
5433     elif test "$with_linker_hash_style" = "no"; then
5434         hash_styles=
5435     else
5436         hash_styles="$with_linker_hash_style"
5437     fi
5439     for hash_style in $hash_styles; do
5440         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5441         hash_style_ldflags_save=$LDFLAGS
5442         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5444         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5445             [
5446 #include <stdio.h>
5447             ],[
5448 printf ("");
5449             ])],
5450             [
5451                   HAVE_LD_HASH_STYLE=TRUE
5452                   WITH_LINKER_HASH_STYLE=$hash_style
5453             ],
5454             [HAVE_LD_HASH_STYLE=FALSE],
5455             [HAVE_LD_HASH_STYLE=FALSE])
5456         LDFLAGS=$hash_style_ldflags_save
5457     done
5459     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5460         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5461     else
5462         AC_MSG_RESULT( no )
5463     fi
5464     LDFLAGS=$hash_style_ldflags_save
5465 else
5466     AC_MSG_RESULT( no )
5468 AC_SUBST(HAVE_LD_HASH_STYLE)
5469 AC_SUBST(WITH_LINKER_HASH_STYLE)
5471 dnl ===================================================================
5472 dnl Check whether there's a Perl version available.
5473 dnl ===================================================================
5474 if test -z "$with_perl_home"; then
5475     AC_PATH_PROG(PERL, perl)
5476 else
5477     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5478     _perl_path="$with_perl_home/bin/perl"
5479     if test -x "$_perl_path"; then
5480         PERL=$_perl_path
5481     else
5482         AC_MSG_ERROR([$_perl_path not found])
5483     fi
5486 dnl ===================================================================
5487 dnl Testing for Perl version 5 or greater.
5488 dnl $] is the Perl version variable, it is returned as an integer
5489 dnl ===================================================================
5490 if test "$PERL"; then
5491     AC_MSG_CHECKING([the Perl version])
5492     ${PERL} -e "exit($]);"
5493     _perl_version=$?
5494     if test "$_perl_version" -lt 5; then
5495         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5496     fi
5497     AC_MSG_RESULT([Perl $_perl_version])
5498 else
5499     AC_MSG_ERROR([Perl not found, install Perl 5])
5502 dnl ===================================================================
5503 dnl Testing for required Perl modules
5504 dnl ===================================================================
5506 AC_MSG_CHECKING([for required Perl modules])
5507 perl_use_string="use Cwd ; use Digest::MD5"
5508 if test "$_os" = "WINNT"; then
5509     if test -n "$PKGFORMAT"; then
5510         for i in $PKGFORMAT; do
5511             case "$i" in
5512             msi)
5513                 # for getting fonts versions to use in MSI
5514                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5515                 ;;
5516             esac
5517         done
5518     fi
5520 if test "$with_system_hsqldb" = "yes"; then
5521     perl_use_string="$perl_use_string ; use Archive::Zip"
5523 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5524     AC_MSG_RESULT([all modules found])
5525 else
5526     AC_MSG_RESULT([failed to find some modules])
5527     # Find out which modules are missing.
5528     for i in $perl_use_string; do
5529         if test "$i" != "use" -a "$i" != ";"; then
5530             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5531                 missing_perl_modules="$missing_perl_modules $i"
5532             fi
5533         fi
5534     done
5535     AC_MSG_ERROR([
5536     The missing Perl modules are: $missing_perl_modules
5537     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5540 dnl ===================================================================
5541 dnl Check for pkg-config
5542 dnl ===================================================================
5543 if test "$_os" != "WINNT"; then
5544     PKG_PROG_PKG_CONFIG
5547 if test "$_os" != "WINNT"; then
5549     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5550     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5551     # explicitly. Or put /path/to/compiler in PATH yourself.
5553     # Use wrappers for LTO
5554     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5555         AC_CHECK_TOOL(AR,gcc-ar)
5556         AC_CHECK_TOOL(NM,gcc-nm)
5557         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5558     else
5559         AC_CHECK_TOOL(AR,ar)
5560         AC_CHECK_TOOL(NM,nm)
5561         AC_CHECK_TOOL(RANLIB,ranlib)
5562     fi
5563     AC_CHECK_TOOL(OBJDUMP,objdump)
5564     AC_CHECK_TOOL(READELF,readelf)
5565     AC_CHECK_TOOL(STRIP,strip)
5566     if test "$_os" = "WINNT"; then
5567         AC_CHECK_TOOL(DLLTOOL,dlltool)
5568         AC_CHECK_TOOL(WINDRES,windres)
5569     fi
5571 AC_SUBST(AR)
5572 AC_SUBST(DLLTOOL)
5573 AC_SUBST(NM)
5574 AC_SUBST(OBJDUMP)
5575 AC_SUBST(PKG_CONFIG)
5576 AC_SUBST(RANLIB)
5577 AC_SUBST(READELF)
5578 AC_SUBST(STRIP)
5579 AC_SUBST(WINDRES)
5581 dnl ===================================================================
5582 dnl pkg-config checks on macOS
5583 dnl ===================================================================
5585 if test $_os = Darwin; then
5586     AC_MSG_CHECKING([for bogus pkg-config])
5587     if test -n "$PKG_CONFIG"; then
5588         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5589             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5590         else
5591             if test "$enable_bogus_pkg_config" = "yes"; then
5592                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5593             else
5594                 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.])
5595             fi
5596         fi
5597     else
5598         AC_MSG_RESULT([no, good])
5599     fi
5602 find_csc()
5604     # Return value: $csctest
5606     unset csctest
5608     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5609     if test -n "$regvalue"; then
5610         csctest=$regvalue
5611         return
5612     fi
5615 find_al()
5617     # Return value: $altest
5619     unset altest
5621     # We need this check to detect 4.6.1 or above.
5622     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5623         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5624         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5625             altest=$regvalue
5626             return
5627         fi
5628     done
5630     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5631         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5632         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5633             altest=$regvalue
5634             return
5635         fi
5636     done
5641 find_dotnetsdk46()
5643     unset frametest
5645     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5646         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5647         if test -n "$regvalue"; then
5648             frametest=$regvalue
5649             return
5650         fi
5651     done
5654 find_winsdk_version()
5656     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5657     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5659     unset winsdktest winsdkbinsubdir winsdklibsubdir
5661     case "$1" in
5662     8.0|8.0A)
5663         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5664         if test -n "$regvalue"; then
5665             winsdktest=$regvalue
5666             winsdklibsubdir=win8
5667             return
5668         fi
5669         ;;
5670     8.1|8.1A)
5671         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5672         if test -n "$regvalue"; then
5673             winsdktest=$regvalue
5674             winsdklibsubdir=winv6.3
5675             return
5676         fi
5677         ;;
5678     10.0)
5679         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5680         if test -n "$regvalue"; then
5681             winsdktest=$regvalue
5682             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5683             if test -n "$regvalue"; then
5684                 winsdkbinsubdir="$regvalue".0
5685                 winsdklibsubdir=$winsdkbinsubdir
5686                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5687                 # test exist the SDK path
5688                 if test -d "$tmppath"; then
5689                    # when path is convertible to a short path then path is okay
5690                    cygpath -d "$tmppath" >/dev/null 2>&1
5691                    if test $? -ne 0; then
5692                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5693                    fi
5694                 else
5695                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5696                 fi
5697             fi
5698             return
5699         fi
5700         ;;
5701     esac
5704 find_winsdk()
5706     # Return value: From find_winsdk_version
5708     unset winsdktest
5710     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5711         find_winsdk_version $ver
5712         if test -n "$winsdktest"; then
5713             return
5714         fi
5715     done
5718 find_msms()
5720     AC_MSG_CHECKING([for MSVC merge modules directory])
5721     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5722     case "$VCVER" in
5723         150|160)
5724         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5725         ;;
5726     esac
5727     for f in $my_msm_files; do
5728         echo "$as_me:$LINENO: searching for $f" >&5
5729     done
5731     msmdir=
5732     for ver in 14.0 15.0; do
5733         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5734         if test -n "$regvalue"; then
5735             for f in ${my_msm_files}; do
5736                 if test -e "$regvalue/${f}"; then
5737                     msmdir=$regvalue
5738                     break
5739                 fi
5740             done
5741         fi
5742     done
5743     dnl Is the following fallback really necessary, or was it added in response
5744     dnl to never having started Visual Studio on a given machine, so the
5745     dnl registry keys checked above had presumably not yet been created?
5746     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5747     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5748     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5749     dnl expanding to "C:\Program Files\Common Files"), which would need
5750     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5751     dnl obtain its value from cygwin:
5752     if test -z "$msmdir"; then
5753         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5754         for f in ${my_msm_files}; do
5755             if test -e "$my_msm_dir/${f}"; then
5756                 msmdir=$my_msm_dir
5757             fi
5758         done
5759     fi
5761     dnl Starting from MSVC 15.0, merge modules are located in different directory
5762     case "$VCVER" in
5763     150|160)
5764         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5765             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5766             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5767             for f in ${my_msm_files}; do
5768                 if test -e "$my_msm_dir/${f}"; then
5769                     msmdir=$my_msm_dir
5770                     break
5771                 fi
5772             done
5773         done
5774         ;;
5775     esac
5777     if test -n "$msmdir"; then
5778         msmdir=`cygpath -m "$msmdir"`
5779         AC_MSG_RESULT([$msmdir])
5780     else
5781         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5782             AC_MSG_FAILURE([not found])
5783         else
5784             AC_MSG_WARN([not found (check config.log)])
5785             add_warning "MSM none of ${my_msm_files} found"
5786         fi
5787     fi
5790 find_msvc_x64_dlls()
5792     AC_MSG_CHECKING([for MSVC x64 DLL path])
5793     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5794     case "$VCVER" in
5795     150|160)
5796         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5797             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5798             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5799                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5800                 break
5801             fi
5802             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5803             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5804                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5805                 break
5806             fi
5807             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5808             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5809                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5810                 break
5811             fi
5812         done
5813         ;;
5814     esac
5815     AC_MSG_RESULT([$msvcdllpath])
5816     AC_MSG_CHECKING([for MSVC x64 DLLs])
5817     msvcdlls="msvcp140.dll vcruntime140.dll"
5818     for dll in $msvcdlls; do
5819         if ! test -f "$msvcdllpath/$dll"; then
5820             AC_MSG_FAILURE([missing $dll])
5821         fi
5822     done
5823     AC_MSG_RESULT([found all ($msvcdlls)])
5826 dnl =========================================
5827 dnl Check for the Windows  SDK.
5828 dnl =========================================
5829 if test "$_os" = "WINNT"; then
5830     AC_MSG_CHECKING([for Windows SDK])
5831     if test "$build_os" = "cygwin"; then
5832         find_winsdk
5833         WINDOWS_SDK_HOME=$winsdktest
5835         # normalize if found
5836         if test -n "$WINDOWS_SDK_HOME"; then
5837             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5838             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5839         fi
5841         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5842     fi
5844     if test -n "$WINDOWS_SDK_HOME"; then
5845         # Remove a possible trailing backslash
5846         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5848         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5849              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5850              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5851             have_windows_sdk_headers=yes
5852         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5853              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5854              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5855             have_windows_sdk_headers=yes
5856         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5857              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5858              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5859             have_windows_sdk_headers=yes
5860         else
5861             have_windows_sdk_headers=no
5862         fi
5864         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5865             have_windows_sdk_libs=yes
5866         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5867             have_windows_sdk_libs=yes
5868         else
5869             have_windows_sdk_libs=no
5870         fi
5872         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5873             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5874 the  Windows SDK are installed.])
5875         fi
5876     fi
5878     if test -z "$WINDOWS_SDK_HOME"; then
5879         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5880     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5881         WINDOWS_SDK_VERSION=80
5882         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5883     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5884         WINDOWS_SDK_VERSION=81
5885         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5886     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5887         WINDOWS_SDK_VERSION=10
5888         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5889     else
5890         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5891     fi
5892     PathFormat "$WINDOWS_SDK_HOME"
5893     WINDOWS_SDK_HOME="$formatted_path"
5894     if test "$build_os" = "cygwin"; then
5895         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5896         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5897             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5898         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5899             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5900         fi
5901     fi
5903     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5904     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5905     dnl but not in v8.0), so allow this to be overridden with a
5906     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5907     dnl and configuration error if no WiLangId.vbs is found would arguably be
5908     dnl better, but I do not know under which conditions exactly it is needed by
5909     dnl msiglobal.pm:
5910     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5911         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5912         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5913             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5914         fi
5915         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5916             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5917         fi
5918         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5919             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5920         fi
5921     fi
5922     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5923         if test -n "$with_package_format" -a "$with_package_format" != no; then
5924             for i in "$with_package_format"; do
5925                 if test "$i" = "msi"; then
5926                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5927                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5928                     fi
5929                 fi
5930             done
5931         fi
5932     fi
5934 AC_SUBST(WINDOWS_SDK_HOME)
5935 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5936 AC_SUBST(WINDOWS_SDK_VERSION)
5937 AC_SUBST(WINDOWS_SDK_WILANGID)
5939 if test "$build_os" = "cygwin"; then
5940     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5941     dnl dir, it also determines that dir's path w/o an arch segment if any,
5942     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5943     AC_MSG_CHECKING([for midl.exe])
5945     find_winsdk
5946     if test -n "$winsdkbinsubdir" \
5947         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5948     then
5949         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5950         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5951     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5952         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5953         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5954     elif test -f "$winsdktest/Bin/midl.exe"; then
5955         MIDL_PATH=$winsdktest/Bin
5956         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5957     fi
5958     if test ! -f "$MIDL_PATH/midl.exe"; then
5959         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5960     else
5961         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5962     fi
5964     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5965     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5967     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5968          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5969          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5970          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5971     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5972          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5973          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5974          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5975     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5976          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5977          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5978          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5979     else
5980         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5981     fi
5983     dnl Check csc.exe
5984     AC_MSG_CHECKING([for csc.exe])
5985     find_csc
5986     if test -f "$csctest/csc.exe"; then
5987         CSC_PATH="$csctest"
5988     fi
5989     if test ! -f "$CSC_PATH/csc.exe"; then
5990         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5991     else
5992         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5993     fi
5995     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5997     dnl Check al.exe
5998     AC_MSG_CHECKING([for al.exe])
5999     find_winsdk
6000     if test -n "$winsdkbinsubdir" \
6001         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
6002     then
6003         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
6004     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
6005         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
6006     elif test -f "$winsdktest/Bin/al.exe"; then
6007         AL_PATH="$winsdktest/Bin"
6008     fi
6010     if test -z "$AL_PATH"; then
6011         find_al
6012         if test -f "$altest/bin/al.exe"; then
6013             AL_PATH="$altest/bin"
6014         elif test -f "$altest/al.exe"; then
6015             AL_PATH="$altest"
6016         fi
6017     fi
6018     if test ! -f "$AL_PATH/al.exe"; then
6019         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6020     else
6021         AC_MSG_RESULT([$AL_PATH/al.exe])
6022     fi
6024     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6026     dnl Check mscoree.lib / .NET Framework dir
6027     AC_MSG_CHECKING(.NET Framework)
6028     find_dotnetsdk46
6029     PathFormat "$frametest"
6030     frametest="$formatted_path"
6031     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6032         DOTNET_FRAMEWORK_HOME="$frametest"
6033     else
6034         find_winsdk
6035         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
6036             DOTNET_FRAMEWORK_HOME="$winsdktest"
6037         fi
6038     fi
6039     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
6040         AC_MSG_ERROR([mscoree.lib not found])
6041     fi
6042     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6044     PathFormat "$MIDL_PATH"
6045     MIDL_PATH="$formatted_path"
6047     PathFormat "$AL_PATH"
6048     AL_PATH="$formatted_path"
6050     PathFormat "$DOTNET_FRAMEWORK_HOME"
6051     DOTNET_FRAMEWORK_HOME="$formatted_path"
6053     PathFormat "$CSC_PATH"
6054     CSC_PATH="$formatted_path"
6057 dnl ===================================================================
6058 dnl Check if stdc headers are available excluding MSVC.
6059 dnl ===================================================================
6060 if test "$_os" != "WINNT"; then
6061     AC_HEADER_STDC
6064 dnl ===================================================================
6065 dnl Testing for C++ compiler and version...
6066 dnl ===================================================================
6068 if test "$_os" != "WINNT"; then
6069     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6070     save_CXXFLAGS=$CXXFLAGS
6071     AC_PROG_CXX
6072     CXXFLAGS=$save_CXXFLAGS
6073     if test -z "$CXX_BASE"; then
6074         CXX_BASE=`first_arg_basename "$CXX"`
6075     fi
6078 dnl check for GNU C++ compiler version
6079 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6080     AC_MSG_CHECKING([the GNU C++ compiler version])
6082     _gpp_version=`$CXX -dumpversion`
6083     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6085     if test "$_gpp_majmin" -lt "700"; then
6086         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6087     else
6088         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6089     fi
6091     dnl see https://code.google.com/p/android/issues/detail?id=41770
6092         glibcxx_threads=no
6093         AC_LANG_PUSH([C++])
6094         AC_REQUIRE_CPP
6095         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6096         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6097             #include <bits/c++config.h>]],[[
6098             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6099             && !defined(_GLIBCXX__PTHREADS) \
6100             && !defined(_GLIBCXX_HAS_GTHREADS)
6101             choke me
6102             #endif
6103         ]])],[AC_MSG_RESULT([yes])
6104         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6105         AC_LANG_POP([C++])
6106         if test $glibcxx_threads = yes; then
6107             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6108         fi
6110 AC_SUBST(BOOST_CXXFLAGS)
6113 # prefx CXX with ccache if needed
6115 if test "$CCACHE" != ""; then
6116     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6117     AC_LANG_PUSH([C++])
6118     save_CXXFLAGS=$CXXFLAGS
6119     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6120     dnl an empty program will do, we're checking the compiler flags
6121     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6122                       [use_ccache=yes], [use_ccache=no])
6123     if test $use_ccache = yes; then
6124         AC_MSG_RESULT([yes])
6125     else
6126         CXX="$CCACHE $CXX"
6127         CXX_BASE="ccache $CXX_BASE"
6128         AC_MSG_RESULT([no])
6129     fi
6130     CXXFLAGS=$save_CXXFLAGS
6131     AC_LANG_POP([C++])
6134 dnl ===================================================================
6135 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6136 dnl ===================================================================
6138 if test "$_os" != "WINNT"; then
6139     AC_PROG_CXXCPP
6141     dnl Check whether there's a C pre-processor.
6142     AC_PROG_CPP
6146 dnl ===================================================================
6147 dnl Find integral type sizes and alignments
6148 dnl ===================================================================
6150 if test "$_os" != "WINNT"; then
6152 if test "$_os" = "iOS"; then
6153     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6154     ac_cv_sizeof_long=8
6155     ac_cv_sizeof_short=2
6156     ac_cv_sizeof_int=4
6157     ac_cv_sizeof_long_long=8
6158     ac_cv_sizeof_double=8
6159     ac_cv_sizeof_voidp=8
6160 else
6161     AC_CHECK_SIZEOF(long)
6162     AC_CHECK_SIZEOF(short)
6163     AC_CHECK_SIZEOF(int)
6164     AC_CHECK_SIZEOF(long long)
6165     AC_CHECK_SIZEOF(double)
6166     AC_CHECK_SIZEOF(void*)
6169     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6170     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6171     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6172     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6173     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6175     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6176     m4_pattern_allow([AC_CHECK_ALIGNOF])
6177     m4_ifdef([AC_CHECK_ALIGNOF],
6178         [
6179             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6180             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6181             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6182             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6183         ],
6184         [
6185             case "$_os-$host_cpu" in
6186             Linux-i686)
6187                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6188                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6189                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6190                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6191                 ;;
6192             Linux-x86_64)
6193                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6194                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6195                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6196                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6197                 ;;
6198             *)
6199                 if test -z "$ac_cv_alignof_short" -o \
6200                         -z "$ac_cv_alignof_int" -o \
6201                         -z "$ac_cv_alignof_long" -o \
6202                         -z "$ac_cv_alignof_double"; then
6203                    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.])
6204                 fi
6205                 ;;
6206             esac
6207         ])
6209     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6210     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6211     if test $ac_cv_sizeof_long -eq 8; then
6212         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6213     elif test $ac_cv_sizeof_double -eq 8; then
6214         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6215     else
6216         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6217     fi
6219     dnl Check for large file support
6220     AC_SYS_LARGEFILE
6221     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6222         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6223     fi
6224     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6225         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6226     fi
6227 else
6228     # Hardcode for MSVC
6229     SAL_TYPES_SIZEOFSHORT=2
6230     SAL_TYPES_SIZEOFINT=4
6231     SAL_TYPES_SIZEOFLONG=4
6232     SAL_TYPES_SIZEOFLONGLONG=8
6233     if test "$BITNESS_OVERRIDE" = ""; then
6234         SAL_TYPES_SIZEOFPOINTER=4
6235     else
6236         SAL_TYPES_SIZEOFPOINTER=8
6237     fi
6238     SAL_TYPES_ALIGNMENT2=2
6239     SAL_TYPES_ALIGNMENT4=4
6240     SAL_TYPES_ALIGNMENT8=8
6241     LFS_CFLAGS=''
6243 AC_SUBST(LFS_CFLAGS)
6245 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6246 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6247 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6248 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6249 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6250 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6251 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6252 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6254 dnl ===================================================================
6255 dnl Check whether to enable runtime optimizations
6256 dnl ===================================================================
6257 ENABLE_RUNTIME_OPTIMIZATIONS=
6258 AC_MSG_CHECKING([whether to enable runtime optimizations])
6259 if test -z "$enable_runtime_optimizations"; then
6260     for i in $CC; do
6261         case $i in
6262         -fsanitize=*)
6263             enable_runtime_optimizations=no
6264             break
6265             ;;
6266         esac
6267     done
6269 if test "$enable_runtime_optimizations" != no; then
6270     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6271     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6272     AC_MSG_RESULT([yes])
6273 else
6274     AC_MSG_RESULT([no])
6276 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6278 dnl ===================================================================
6279 dnl Check if valgrind headers are available
6280 dnl ===================================================================
6281 ENABLE_VALGRIND=
6282 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6283     prev_cppflags=$CPPFLAGS
6284     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6285     # or where does it come from?
6286     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6287     AC_CHECK_HEADER([valgrind/valgrind.h],
6288         [ENABLE_VALGRIND=TRUE])
6289     CPPFLAGS=$prev_cppflags
6291 AC_SUBST([ENABLE_VALGRIND])
6292 if test -z "$ENABLE_VALGRIND"; then
6293     if test "$with_valgrind" = yes; then
6294         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6295     fi
6296     VALGRIND_CFLAGS=
6298 AC_SUBST([VALGRIND_CFLAGS])
6301 dnl ===================================================================
6302 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6303 dnl ===================================================================
6305 # We need at least the sys/sdt.h include header.
6306 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6307 if test "$SDT_H_FOUND" = "TRUE"; then
6308     # Found sys/sdt.h header, now make sure the c++ compiler works.
6309     # Old g++ versions had problems with probes in constructors/destructors.
6310     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6311     AC_LANG_PUSH([C++])
6312     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6313     #include <sys/sdt.h>
6314     class ProbeClass
6315     {
6316     private:
6317       int& ref;
6318       const char *name;
6320     public:
6321       ProbeClass(int& v, const char *n) : ref(v), name(n)
6322       {
6323         DTRACE_PROBE2(_test_, cons, name, ref);
6324       }
6326       void method(int min)
6327       {
6328         DTRACE_PROBE3(_test_, meth, name, ref, min);
6329         ref -= min;
6330       }
6332       ~ProbeClass()
6333       {
6334         DTRACE_PROBE2(_test_, dest, name, ref);
6335       }
6336     };
6337     ]],[[
6338     int i = 64;
6339     DTRACE_PROBE1(_test_, call, i);
6340     ProbeClass inst = ProbeClass(i, "call");
6341     inst.method(24);
6342     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6343           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6344     AC_LANG_POP([C++])
6346 AC_CONFIG_HEADERS([config_host/config_probes.h])
6348 dnl ===================================================================
6349 dnl GCC features
6350 dnl ===================================================================
6351 HAVE_GCC_STACK_CLASH_PROTECTION=
6352 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6353     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6354     save_CFLAGS=$CFLAGS
6355     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6356     AC_LINK_IFELSE(
6357         [AC_LANG_PROGRAM(, [[return 0;]])],
6358         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6359         [AC_MSG_RESULT([no])])
6360     CFLAGS=$save_CFLAGS
6362     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6363     save_CFLAGS=$CFLAGS
6364     CFLAGS="$CFLAGS -Werror -mno-avx"
6365     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6366     CFLAGS=$save_CFLAGS
6367     if test "$HAVE_GCC_AVX" = "TRUE"; then
6368         AC_MSG_RESULT([yes])
6369     else
6370         AC_MSG_RESULT([no])
6371     fi
6373     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6374     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6375     int v = 0;
6376     if (__sync_add_and_fetch(&v, 1) != 1 ||
6377         __sync_sub_and_fetch(&v, 1) != 0)
6378         return 1;
6379     __sync_synchronize();
6380     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6381         v != 1)
6382         return 1;
6383     return 0;
6384 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6385     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6386         AC_MSG_RESULT([yes])
6387         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6388     else
6389         AC_MSG_RESULT([no])
6390     fi
6392     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6393     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6394     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6395         AC_MSG_RESULT([yes])
6396         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6397     else
6398         AC_MSG_RESULT([no])
6399     fi
6401     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6402     save_CFLAGS=$CFLAGS
6403     CFLAGS="$CFLAGS -Werror"
6404     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6405             __attribute__((deprecated("test"))) void f();
6406         ])], [
6407             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6408             AC_MSG_RESULT([yes])
6409         ], [AC_MSG_RESULT([no])])
6410     CFLAGS=$save_CFLAGS
6412     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6413     AC_LANG_PUSH([C++])
6414     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6415             #include <cstddef>
6416             #include <cxxabi.h>
6417             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6418         ])], [
6419             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6420             AC_MSG_RESULT([yes])
6421         ], [AC_MSG_RESULT([no])])
6422     AC_LANG_POP([C++])
6424     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6425     AC_LANG_PUSH([C++])
6426     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6427             #include <cstddef>
6428             #include <cxxabi.h>
6429             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6430         ])], [
6431             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6432             AC_MSG_RESULT([yes])
6433         ], [AC_MSG_RESULT([no])])
6434     AC_LANG_POP([C++])
6436     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6437     AC_LANG_PUSH([C++])
6438     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6439             #include <cxxabi.h>
6440             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6441         ])], [
6442             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6443             AC_MSG_RESULT([yes])
6444         ], [AC_MSG_RESULT([no])])
6445     AC_LANG_POP([C++])
6447     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6448     AC_LANG_PUSH([C++])
6449     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6450             #include <cstddef>
6451             #include <cxxabi.h>
6452             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6453         ])], [
6454             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6455             AC_MSG_RESULT([yes])
6456         ], [AC_MSG_RESULT([no])])
6457     AC_LANG_POP([C++])
6459     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6460     AC_LANG_PUSH([C++])
6461     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6462             #include <cstddef>
6463             #include <cxxabi.h>
6464             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6465         ])], [
6466             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6467             AC_MSG_RESULT([yes])
6468         ], [AC_MSG_RESULT([no])])
6469     AC_LANG_POP([C++])
6471     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6472     AC_LANG_PUSH([C++])
6473     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6474             #include <cxxabi.h>
6475             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6476         ])], [
6477             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6478             AC_MSG_RESULT([yes])
6479         ], [AC_MSG_RESULT([no])])
6480     AC_LANG_POP([C++])
6482     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6483     AC_LANG_PUSH([C++])
6484     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6485             #include <cxxabi.h>
6486             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6487         ])], [
6488             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6489             AC_MSG_RESULT([yes])
6490         ], [AC_MSG_RESULT([no])])
6491     AC_LANG_POP([C++])
6493     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6494     AC_LANG_PUSH([C++])
6495     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6496             #include <cxxabi.h>
6497             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6498         ])], [
6499             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6500             AC_MSG_RESULT([yes])
6501         ], [AC_MSG_RESULT([no])])
6502     AC_LANG_POP([C++])
6504     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6505     AC_LANG_PUSH([C++])
6506     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6507             #include <cstddef>
6508             #include <cxxabi.h>
6509             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6510         ])], [
6511             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6512             AC_MSG_RESULT([yes])
6513         ], [AC_MSG_RESULT([no])])
6514     AC_LANG_POP([C++])
6516     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6517     AC_LANG_PUSH([C++])
6518     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6519             #include <cstddef>
6520             #include <cxxabi.h>
6521             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6522         ])], [
6523             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6524             AC_MSG_RESULT([yes])
6525         ], [AC_MSG_RESULT([no])])
6526     AC_LANG_POP([C++])
6528     dnl Available in GCC 4.9 and at least since Clang 3.4:
6529     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6530     AC_LANG_PUSH([C++])
6531     save_CXXFLAGS=$CXXFLAGS
6532     CXXFLAGS="$CXXFLAGS -Werror"
6533     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6534             struct __attribute__((warn_unused)) dummy {};
6535         ])], [
6536             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6537             AC_MSG_RESULT([yes])
6538         ], [AC_MSG_RESULT([no])])
6539     CXXFLAGS=$save_CXXFLAGS
6540 AC_LANG_POP([C++])
6543 AC_SUBST(HAVE_GCC_AVX)
6544 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6545 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6546 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6548 dnl ===================================================================
6549 dnl Identify the C++ library
6550 dnl ===================================================================
6552 AC_MSG_CHECKING([what the C++ library is])
6553 AC_LANG_PUSH([C++])
6554 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6555 #include <utility>
6556 #ifndef __GLIBCXX__
6557 foo bar
6558 #endif
6559 ]])],
6560     [CPP_LIBRARY=GLIBCXX
6561      cpp_library_name="GNU libstdc++"
6562     ],
6563     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6564 #include <utility>
6565 #ifndef _LIBCPP_VERSION
6566 foo bar
6567 #endif
6568 ]])],
6569     [CPP_LIBRARY=LIBCPP
6570      cpp_library_name="LLVM libc++"
6571      AC_DEFINE([HAVE_LIBCXX])
6572     ],
6573     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6574 #include <utility>
6575 #ifndef _MSC_VER
6576 foo bar
6577 #endif
6578 ]])],
6579     [CPP_LIBRARY=MSVCRT
6580      cpp_library_name="Microsoft"
6581     ],
6582     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6583 AC_MSG_RESULT([$cpp_library_name])
6584 AC_LANG_POP([C++])
6586 dnl ===================================================================
6587 dnl Check for gperf
6588 dnl ===================================================================
6589 AC_PATH_PROG(GPERF, gperf)
6590 if test -z "$GPERF"; then
6591     AC_MSG_ERROR([gperf not found but needed. Install it.])
6593 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6594     GPERF=`cygpath -m $GPERF`
6596 AC_MSG_CHECKING([whether gperf is new enough])
6597 my_gperf_ver1=$($GPERF --version | head -n 1)
6598 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6599 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6600 if test "$my_gperf_ver3" -ge 301; then
6601     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6602 else
6603     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6605 AC_SUBST(GPERF)
6607 dnl ===================================================================
6608 dnl Check for system libcmis
6609 dnl ===================================================================
6610 # libcmis requires curl and we can't build curl for iOS
6611 if test $_os != iOS; then
6612     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6613     ENABLE_LIBCMIS=TRUE
6614 else
6615     ENABLE_LIBCMIS=
6617 AC_SUBST(ENABLE_LIBCMIS)
6619 dnl ===================================================================
6620 dnl C++11
6621 dnl ===================================================================
6623 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6624 CXXFLAGS_CXX11=
6625 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6626     if test "$with_latest_c__" = yes; then
6627         CXXFLAGS_CXX11=-std:c++latest
6628     else
6629         CXXFLAGS_CXX11=-std:c++17
6630     fi
6631     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6632 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6633     my_flags='-std=c++17 -std=c++1z'
6634     if test "$with_latest_c__" = yes; then
6635         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6636     fi
6637     for flag in $my_flags; do
6638         if test "$COM" = MSC; then
6639             flag="-Xclang $flag"
6640         fi
6641         save_CXXFLAGS=$CXXFLAGS
6642         CXXFLAGS="$CXXFLAGS $flag -Werror"
6643         if test "$SYSTEM_LIBCMIS" = TRUE; then
6644             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6645         fi
6646         AC_LANG_PUSH([C++])
6647         dnl Clang 3.9 supports __float128 since
6648         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6649         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6650         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6651         dnl $flag is supported below, so check this first):
6652         my_float128hack=
6653         my_float128hack_impl=-D__float128=void
6654         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6655             #include <vector>
6656             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6657             // (__float128)
6658             ]])
6659         ],,[
6660             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6661             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6662             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6663             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6664             dnl place where __float128 is used is in a template specialization, -D__float128=void
6665             dnl will avoid the problem there while still causing a problem if somebody actually uses
6666             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6667             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6668             dnl "fixed" with this hack):
6669             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6670             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6671                 #include <vector>
6672                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6673                 // (__float128)
6674                 ]])
6675             ],[my_float128hack=$my_float128hack_impl])
6676         ])
6677         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6678             #include <algorithm>
6679             #include <functional>
6680             #include <vector>
6682             #if defined SYSTEM_LIBCMIS
6683             // See ucb/source/ucp/cmis/auth_provider.hxx:
6684             #if !defined __clang__
6685             #pragma GCC diagnostic push
6686             #pragma GCC diagnostic ignored "-Wdeprecated"
6687             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6688             #endif
6689             #include <libcmis/libcmis.hxx>
6690             #if !defined __clang__
6691             #pragma GCC diagnostic pop
6692             #endif
6693             #endif
6695             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6696                 std::sort(v.begin(), v.end(), fn);
6697             }
6698             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6699         AC_LANG_POP([C++])
6700         CXXFLAGS=$save_CXXFLAGS
6701         if test -n "$CXXFLAGS_CXX11"; then
6702             break
6703         fi
6704     done
6706 if test -n "$CXXFLAGS_CXX11"; then
6707     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6708 else
6709     AC_MSG_ERROR(no)
6711 AC_SUBST(CXXFLAGS_CXX11)
6713 if test "$GCC" = "yes"; then
6714     save_CXXFLAGS=$CXXFLAGS
6715     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6716     CHECK_L_ATOMIC
6717     CXXFLAGS=$save_CXXFLAGS
6718     AC_SUBST(ATOMIC_LIB)
6721 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6722 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6723 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6724 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6725 dnl again towards 4.7.2:
6726 if test $CPP_LIBRARY = GLIBCXX; then
6727     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6728     AC_LANG_PUSH([C++])
6729     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6730 #include <list>
6731 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6732     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6733     //   GCC 4.7.0: 20120322
6734     //   GCC 4.7.1: 20120614
6735     // and using a range check is not possible as the mapping between
6736     // __GLIBCXX__ values and GCC versions is not monotonic
6737 /* ok */
6738 #else
6739 abi broken
6740 #endif
6741         ]])], [AC_MSG_RESULT(no, ok)],
6742         [AC_MSG_ERROR(yes)])
6743     AC_LANG_POP([C++])
6746 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6747 save_CXXFLAGS=$CXXFLAGS
6748 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6749 AC_LANG_PUSH([C++])
6751 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6752 #include <stddef.h>
6754 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6756 namespace
6758         struct b
6759         {
6760                 int i;
6761                 int j;
6762         };
6764 ]], [[
6765 struct a
6767         int i;
6768         int j;
6770 a thinga[]={{0,0}, {1,1}};
6771 b thingb[]={{0,0}, {1,1}};
6772 size_t i = sizeof(sal_n_array_size(thinga));
6773 size_t j = sizeof(sal_n_array_size(thingb));
6774 return !(i != 0 && j != 0);
6776     ], [ AC_MSG_RESULT(yes) ],
6777     [ AC_MSG_ERROR(no)])
6778 AC_LANG_POP([C++])
6779 CXXFLAGS=$save_CXXFLAGS
6781 dnl _Pragma support (may require C++11)
6782 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6783     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6784     AC_LANG_PUSH([C++])
6785     save_CXXFLAGS=$CXXFLAGS
6786     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6787     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6788             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6789         ])], [
6790             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6791             AC_MSG_RESULT([yes])
6792         ], [AC_MSG_RESULT([no])])
6793     AC_LANG_POP([C++])
6794     CXXFLAGS=$save_CXXFLAGS
6797 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6798 if test "$GCC" = yes; then
6799     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6800     AC_LANG_PUSH([C++])
6801     save_CXXFLAGS=$CXXFLAGS
6802     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6803     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6804     CXXFLAGS=$save_CXXFLAGS
6805     AC_LANG_POP([C++])
6806     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6807         AC_MSG_RESULT([yes])
6808     else
6809         AC_MSG_RESULT([no])
6810     fi
6812 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6814 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6815 AC_LANG_PUSH([C++])
6816 save_CXXFLAGS=$CXXFLAGS
6817 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6818 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6819         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6820         // supporting it:
6821         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6822         struct S {
6823         private:
6824             S(S const &);
6825         public:
6826             S();
6827             ~S();
6828         };
6829         S copy();
6830         void f() { S c(copy()); }
6831         #endif
6832     ])], [
6833         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6834         AC_MSG_RESULT([yes])
6835     ], [AC_MSG_RESULT([no])])
6836 CXXFLAGS=$save_CXXFLAGS
6837 AC_LANG_POP([C++])
6839 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6840 AC_LANG_PUSH([C++])
6841 save_CXXFLAGS=$CXXFLAGS
6842 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6843 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6844         #include <algorithm>
6845         #include <initializer_list>
6846         #include <vector>
6847         template<typename T> class S {
6848         private:
6849             std::vector<T> v_;
6850         public:
6851             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6852         };
6853         constinit S<int> s{3, 2, 1};
6854     ])], [
6855         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6856         AC_MSG_RESULT([yes])
6857     ], [AC_MSG_RESULT([no])])
6858 CXXFLAGS=$save_CXXFLAGS
6859 AC_LANG_POP([C++])
6861 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6862 AC_LANG_PUSH([C++])
6863 save_CXXFLAGS=$CXXFLAGS
6864 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6865 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6866         #include <span>
6867         #include <type_traits>
6868         // Don't check size_type directly, as it was called index_type before P1872R0:
6869         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6870     ])], [
6871         AC_DEFINE([HAVE_CPP_SPAN],[1])
6872         AC_MSG_RESULT([yes])
6873     ], [AC_MSG_RESULT([no])])
6874 CXXFLAGS=$save_CXXFLAGS
6875 AC_LANG_POP([C++])
6877 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6878 AC_LANG_PUSH([C++])
6879 save_CXXFLAGS=$CXXFLAGS
6880 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6881 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6882         struct S1 { S1(S1 &&); };
6883         struct S2: S1 {};
6884         S1 f(S2 s) { return s; }
6885     ])], [
6886         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6887         AC_MSG_RESULT([yes])
6888     ], [AC_MSG_RESULT([no])])
6889 CXXFLAGS=$save_CXXFLAGS
6890 AC_LANG_POP([C++])
6892 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6893 dnl uninitialized warning for code like
6895 dnl   OString f();
6896 dnl   boost::optional<OString> * g(bool b) {
6897 dnl       boost::optional<OString> o;
6898 dnl       if (b) o = f();
6899 dnl       return new boost::optional<OString>(o);
6900 dnl   }
6902 dnl (as is e.g. present, in a slightly more elaborate form, in
6903 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6904 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6905 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6906 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6907     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6908     AC_LANG_PUSH([C++])
6909     save_CXXFLAGS=$CXXFLAGS
6910     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6911     if test "$ENABLE_OPTIMIZED" = TRUE; then
6912         CXXFLAGS="$CXXFLAGS -O2"
6913     else
6914         CXXFLAGS="$CXXFLAGS -O0"
6915     fi
6916     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6917             #include <new>
6918             void f1(int);
6919             struct S1 {
6920                 ~S1() { f1(n); }
6921                 int n = 0;
6922             };
6923             struct S2 {
6924                 S2() {}
6925                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6926                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6927                 void set(S1 s) {
6928                     new (stg) S1(s);
6929                     init = true;
6930                 }
6931                 bool init = false;
6932                 char stg[sizeof (S1)];
6933             } ;
6934             S1 f2();
6935             S2 * f3(bool b) {
6936                 S2 o;
6937                 if (b) o.set(f2());
6938                 return new S2(o);
6939             }
6940         ]])], [AC_MSG_RESULT([no])], [
6941             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6942             AC_MSG_RESULT([yes])
6943         ])
6944     CXXFLAGS=$save_CXXFLAGS
6945     AC_LANG_POP([C++])
6947 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6949 dnl ===================================================================
6950 dnl CPU Intrinsics support - SSE, AVX
6951 dnl ===================================================================
6953 INTRINSICS_CXXFLAGS=""
6955 if test "$GCC" = "yes"; then
6956     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6957     AC_LANG_PUSH([C++])
6958     save_CXXFLAGS=$CXXFLAGS
6959     CXXFLAGS="$CXXFLAGS -msse2"
6960     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6961         #include <emmintrin.h>
6962         int main () {
6963             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6964             c = _mm_xor_si128 (a, b);
6965             return 0;
6966         }
6967         ])],
6968         [can_compile_sse2=yes],
6969         [can_compile_sse2=no])
6970     AC_LANG_POP([C++])
6971     CXXFLAGS=$save_CXXFLAGS
6972     AC_MSG_RESULT([${can_compile_sse2}])
6973     if test "${can_compile_sse2}" = "yes" ; then
6974         INTRINSICS_CXXFLAGS="-msse2"
6975     else
6976         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6977     fi
6979     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6980     AC_LANG_PUSH([C++])
6981     save_CXXFLAGS=$CXXFLAGS
6982     CXXFLAGS="$CXXFLAGS -mssse3"
6983     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6984         #include <tmmintrin.h>
6985         int main () {
6986             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6987             c = _mm_maddubs_epi16 (a, b);
6988             return 0;
6989         }
6990         ])],
6991         [can_compile_ssse3=yes],
6992         [can_compile_ssse3=no])
6993     AC_LANG_POP([C++])
6994     CXXFLAGS=$save_CXXFLAGS
6995     AC_MSG_RESULT([${can_compile_ssse3}])
6996     if test "${can_compile_ssse3}" = "yes" ; then
6997         INTRINSICS_CXXFLAGS="-mssse3"
6998     else
6999         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
7000     fi
7002     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7003     AC_LANG_PUSH([C++])
7004     save_CXXFLAGS=$CXXFLAGS
7005     CXXFLAGS="$CXXFLAGS -mavx"
7006     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7007         #include <immintrin.h>
7008         int main () {
7009             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7010             c = _mm256_xor_ps(a, b);
7011             return 0;
7012         }
7013         ])],
7014         [can_compile_avx=yes],
7015         [can_compile_avx=no])
7016     AC_LANG_POP([C++])
7017     CXXFLAGS=$save_CXXFLAGS
7018     AC_MSG_RESULT([${can_compile_avx}])
7019     if test "${can_compile_avx}" = "yes" ; then
7020         INTRINSICS_CXXFLAGS="-mavx"
7021     else
7022         AC_MSG_WARN([cannot compile AVX intrinsics])
7023     fi
7025     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7026     AC_LANG_PUSH([C++])
7027     save_CXXFLAGS=$CXXFLAGS
7028     CXXFLAGS="$CXXFLAGS -mavx2"
7029     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7030         #include <immintrin.h>
7031         int main () {
7032             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7033             c = _mm256_maddubs_epi16(a, b);
7034             return 0;
7035         }
7036         ])],
7037         [can_compile_avx2=yes],
7038         [can_compile_avx2=no])
7039     AC_LANG_POP([C++])
7040     CXXFLAGS=$save_CXXFLAGS
7041     AC_MSG_RESULT([${can_compile_avx2}])
7042     if test "${can_compile_avx2}" = "yes" ; then
7043         INTRINSICS_CXXFLAGS="-mavx2"
7044     else
7045         AC_MSG_WARN([cannot compile AVX2 intrinsics])
7046     fi
7049 AC_SUBST([INTRINSICS_CXXFLAGS])
7051 dnl ===================================================================
7052 dnl system stl sanity tests
7053 dnl ===================================================================
7054 if test "$_os" != "WINNT"; then
7056     AC_LANG_PUSH([C++])
7058     save_CPPFLAGS="$CPPFLAGS"
7059     if test -n "$MACOSX_SDK_PATH"; then
7060         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7061     fi
7063     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7064     # only.
7065     if test "$CPP_LIBRARY" = GLIBCXX; then
7066         dnl gcc#19664, gcc#22482, rhbz#162935
7067         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7068         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7069         AC_MSG_RESULT([$stlvisok])
7070         if test "$stlvisok" = "no"; then
7071             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7072         fi
7073     fi
7075     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7076     # when we don't make any dynamic libraries?
7077     if test "$DISABLE_DYNLOADING" = ""; then
7078         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7079         cat > conftestlib1.cc <<_ACEOF
7080 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7081 struct S2: S1<int> { virtual ~S2(); };
7082 S2::~S2() {}
7083 _ACEOF
7084         cat > conftestlib2.cc <<_ACEOF
7085 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7086 struct S2: S1<int> { virtual ~S2(); };
7087 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7088 _ACEOF
7089         gccvisinlineshiddenok=yes
7090         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7091             gccvisinlineshiddenok=no
7092         else
7093             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7094             dnl known to not work with -z defs (unsetting which makes the test
7095             dnl moot, though):
7096             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7097             if test "$COM_IS_CLANG" = TRUE; then
7098                 for i in $CXX $CXXFLAGS; do
7099                     case $i in
7100                     -fsanitize=*)
7101                         my_linkflagsnoundefs=
7102                         break
7103                         ;;
7104                     esac
7105                 done
7106             fi
7107             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7108                 gccvisinlineshiddenok=no
7109             fi
7110         fi
7112         rm -fr libconftest*
7113         AC_MSG_RESULT([$gccvisinlineshiddenok])
7114         if test "$gccvisinlineshiddenok" = "no"; then
7115             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7116         fi
7117     fi
7119    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7120     cat >visibility.cxx <<_ACEOF
7121 #pragma GCC visibility push(hidden)
7122 struct __attribute__ ((visibility ("default"))) TestStruct {
7123   static void Init();
7125 __attribute__ ((visibility ("default"))) void TestFunc() {
7126   TestStruct::Init();
7128 _ACEOF
7129     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7130         gccvisbroken=yes
7131     else
7132         case "$host_cpu" in
7133         i?86|x86_64)
7134             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7135                 gccvisbroken=no
7136             else
7137                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7138                     gccvisbroken=no
7139                 else
7140                     gccvisbroken=yes
7141                 fi
7142             fi
7143             ;;
7144         *)
7145             gccvisbroken=no
7146             ;;
7147         esac
7148     fi
7149     rm -f visibility.s visibility.cxx
7151     AC_MSG_RESULT([$gccvisbroken])
7152     if test "$gccvisbroken" = "yes"; then
7153         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7154     fi
7156     CPPFLAGS="$save_CPPFLAGS"
7158     AC_LANG_POP([C++])
7161 dnl ===================================================================
7162 dnl  Clang++ tests
7163 dnl ===================================================================
7165 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7166 if test "$GCC" = "yes"; then
7167     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7168     AC_LANG_PUSH([C++])
7169     save_CXXFLAGS=$CXXFLAGS
7170     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7171     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7172     CXXFLAGS=$save_CXXFLAGS
7173     AC_LANG_POP([C++])
7174     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7175         AC_MSG_RESULT([yes])
7176     else
7177         AC_MSG_RESULT([no])
7178     fi
7180 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7182 dnl ===================================================================
7183 dnl Compiler plugins
7184 dnl ===================================================================
7186 COMPILER_PLUGINS=
7187 # currently only Clang
7189 if test "$COM_IS_CLANG" != "TRUE"; then
7190     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7191         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7192         enable_compiler_plugins=no
7193     fi
7196 if test "$COM_IS_CLANG" = "TRUE"; then
7197     if test -n "$enable_compiler_plugins"; then
7198         compiler_plugins="$enable_compiler_plugins"
7199     elif test -n "$ENABLE_DBGUTIL"; then
7200         compiler_plugins=test
7201     else
7202         compiler_plugins=no
7203     fi
7204     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7205         if test "$CLANGVER" -lt 50002; then
7206             if test "$compiler_plugins" = yes; then
7207                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7208             else
7209                 compiler_plugins=no
7210             fi
7211         fi
7212     fi
7213     if test "$compiler_plugins" != "no"; then
7214         dnl The prefix where Clang resides, override to where Clang resides if
7215         dnl using a source build:
7216         if test -z "$CLANGDIR"; then
7217             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7218         fi
7219         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7220         if test -z "$COMPILER_PLUGINS_CXX"; then
7221             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7222         fi
7223         clangbindir=$CLANGDIR/bin
7224         if test "$build_os" = "cygwin"; then
7225             clangbindir=$(cygpath -u "$clangbindir")
7226         fi
7227         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7228         if test -n "$LLVM_CONFIG"; then
7229             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7230             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7231             if test -z "$CLANGLIBDIR"; then
7232                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7233             fi
7234             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7235             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7236             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7237             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7238                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7239             fi
7240             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7241             clangobjdir=$($LLVM_CONFIG --obj-root)
7242             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7243                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7244             fi
7245         fi
7246         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7247         AC_LANG_PUSH([C++])
7248         save_CXX=$CXX
7249         save_CXXCPP=$CXXCPP
7250         save_CPPFLAGS=$CPPFLAGS
7251         save_CXXFLAGS=$CXXFLAGS
7252         save_LDFLAGS=$LDFLAGS
7253         save_LIBS=$LIBS
7254         CXX=$COMPILER_PLUGINS_CXX
7255         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7256         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7257         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7258         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7259             [COMPILER_PLUGINS=TRUE],
7260             [
7261             if test "$compiler_plugins" = "yes"; then
7262                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7263             else
7264                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7265                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7266             fi
7267             ])
7268         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7269         dnl comment in compilerplugins/Makefile-clang.mk:
7270         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7271             LDFLAGS=""
7272             AC_MSG_CHECKING([for clang libraries to use])
7273             if test -z "$CLANGTOOLLIBS"; then
7274                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7275  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7276                 AC_LINK_IFELSE([
7277                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7278                         [[ clang::FullSourceLoc().dump(); ]])
7279                 ],[CLANGTOOLLIBS="$LIBS"],[])
7280             fi
7281             if test -z "$CLANGTOOLLIBS"; then
7282                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7283                 AC_LINK_IFELSE([
7284                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7285                         [[ clang::FullSourceLoc().dump(); ]])
7286                 ],[CLANGTOOLLIBS="$LIBS"],[])
7287             fi
7288             AC_MSG_RESULT([$CLANGTOOLLIBS])
7289             if test -z "$CLANGTOOLLIBS"; then
7290                 if test "$compiler_plugins" = "yes"; then
7291                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7292                 else
7293                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7294                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7295                 fi
7296                 COMPILER_PLUGINS=
7297             fi
7298             if test -n "$COMPILER_PLUGINS"; then
7299                 if test -z "$CLANGSYSINCLUDE"; then
7300                     if test -n "$LLVM_CONFIG"; then
7301                         # Path to the clang system headers (no idea if there's a better way to get it).
7302                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7303                     fi
7304                 fi
7305             fi
7306         fi
7307         CXX=$save_CXX
7308         CXXCPP=$save_CXXCPP
7309         CPPFLAGS=$save_CPPFLAGS
7310         CXXFLAGS=$save_CXXFLAGS
7311         LDFLAGS=$save_LDFLAGS
7312         LIBS="$save_LIBS"
7313         AC_LANG_POP([C++])
7314     fi
7315 else
7316     if test "$enable_compiler_plugins" = "yes"; then
7317         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7318     fi
7320 AC_SUBST(COMPILER_PLUGINS)
7321 AC_SUBST(COMPILER_PLUGINS_CXX)
7322 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7323 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7324 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7325 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7326 AC_SUBST(CLANGDIR)
7327 AC_SUBST(CLANGLIBDIR)
7328 AC_SUBST(CLANGTOOLLIBS)
7329 AC_SUBST(CLANGSYSINCLUDE)
7331 # Plugin to help linker.
7332 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7333 # This makes --enable-lto build with clang work.
7334 AC_SUBST(LD_PLUGIN)
7336 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7337 AC_SUBST(HAVE_POSIX_FALLOCATE)
7339 dnl ===================================================================
7340 dnl Custom build version
7341 dnl ===================================================================
7343 AC_MSG_CHECKING([whether to add custom build version])
7344 if test "$with_build_version" != ""; then
7345     BUILD_VER_STRING=$with_build_version
7346     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7347 else
7348     BUILD_VER_STRING=
7349     AC_MSG_RESULT([no])
7351 AC_SUBST(BUILD_VER_STRING)
7353 JITC_PROCESSOR_TYPE=""
7354 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7355     # IBMs JDK needs this...
7356     JITC_PROCESSOR_TYPE=6
7357     export JITC_PROCESSOR_TYPE
7359 AC_SUBST([JITC_PROCESSOR_TYPE])
7361 # Misc Windows Stuff
7362 AC_ARG_WITH(ucrt-dir,
7363     AS_HELP_STRING([--with-ucrt-dir],
7364         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7365         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7366         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7367             Windows6.1-KB2999226-x64.msu
7368             Windows6.1-KB2999226-x86.msu
7369             Windows8.1-KB2999226-x64.msu
7370             Windows8.1-KB2999226-x86.msu
7371             Windows8-RT-KB2999226-x64.msu
7372             Windows8-RT-KB2999226-x86.msu
7373         A zip archive including those files is available from Microsoft site:
7374         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7376 UCRT_REDISTDIR="$with_ucrt_dir"
7377 if test $_os = "WINNT"; then
7378     find_msvc_x64_dlls
7379     find_msms
7380     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7381     MSVC_DLLS="$msvcdlls"
7382     MSM_PATH=`win_short_path_for_make "$msmdir"`
7383     # MSVC 15.3 changed it to VC141
7384     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7385         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7386     else
7387         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7388     fi
7390     if test "$UCRT_REDISTDIR" = "no"; then
7391         dnl explicitly disabled
7392         UCRT_REDISTDIR=""
7393     else
7394         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7395                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7396                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7397                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7398                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7399                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7400             UCRT_REDISTDIR=""
7401             if test -n "$PKGFORMAT"; then
7402                for i in $PKGFORMAT; do
7403                    case "$i" in
7404                    msi)
7405                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7406                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7407                        ;;
7408                    esac
7409                done
7410             fi
7411         fi
7412     fi
7415 AC_SUBST(UCRT_REDISTDIR)
7416 AC_SUBST(MSVC_DLL_PATH)
7417 AC_SUBST(MSVC_DLLS)
7418 AC_SUBST(MSM_PATH)
7420 dnl ===================================================================
7421 dnl Checks for Java
7422 dnl ===================================================================
7423 if test "$ENABLE_JAVA" != ""; then
7425     # Windows-specific tests
7426     if test "$build_os" = "cygwin"; then
7427         if test "$BITNESS_OVERRIDE" = 64; then
7428             bitness=64
7429         else
7430             bitness=32
7431         fi
7433         if test -z "$with_jdk_home"; then
7434             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7435             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7436             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7437             if test -n "$regvalue"; then
7438                 ver=$regvalue
7439                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7440                 _jdk_home=$regvalue
7441             fi
7442             if test -z "$with_jdk_home"; then
7443                 for ver in 1.8; do
7444                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7445                     if test -n "$regvalue"; then
7446                         _jdk_home=$regvalue
7447                         break
7448                     fi
7449                 done
7450             fi
7451             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7452                 with_jdk_home="$_jdk_home"
7453                 howfound="found automatically"
7454             else
7455                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7456             fi
7457         else
7458             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7459             howfound="you passed"
7460         fi
7461     fi
7463     # 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.
7464     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7465     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7466         with_jdk_home=`/usr/libexec/java_home`
7467     fi
7469     JAVA_HOME=; export JAVA_HOME
7470     if test -z "$with_jdk_home"; then
7471         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7472     else
7473         _java_path="$with_jdk_home/bin/$with_java"
7474         dnl Check if there is a Java interpreter at all.
7475         if test -x "$_java_path"; then
7476             JAVAINTERPRETER=$_java_path
7477         else
7478             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7479         fi
7480     fi
7482     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7483     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7484     dnl loaded by java to run JunitTests:
7485     if test "$build_os" = "cygwin"; then
7486         shortjdkhome=`cygpath -d "$with_jdk_home"`
7487         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
7488             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7489             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7490         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
7491             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7492             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7493         fi
7495         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7496             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7497         fi
7498         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7499     elif test "$cross_compiling" != "yes"; then
7500         case $CPUNAME in
7501             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7502                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7503                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7504                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7505                 fi
7506                 ;;
7507             *) # assumption: everything else 32-bit
7508                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7509                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7510                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7511                 fi
7512                 ;;
7513         esac
7514     fi
7517 dnl ===================================================================
7518 dnl Checks for JDK.
7519 dnl ===================================================================
7521 # Note that JAVA_HOME as for now always means the *build* platform's
7522 # JAVA_HOME. Whether all the complexity here actually is needed any
7523 # more or not, no idea.
7525 if test "$ENABLE_JAVA" != ""; then
7526     _gij_longver=0
7527     AC_MSG_CHECKING([the installed JDK])
7528     if test -n "$JAVAINTERPRETER"; then
7529         dnl java -version sends output to stderr!
7530         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7531             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7532         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7533             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7534         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7535             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7536         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7537             JDK=ibm
7539             dnl IBM JDK specific tests
7540             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7541             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7543             if test "$_jdk_ver" -lt 10800; then
7544                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7545             fi
7547             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7549             if test "$with_jdk_home" = ""; then
7550                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7551 you must use the "--with-jdk-home" configure option explicitly])
7552             fi
7554             JAVA_HOME=$with_jdk_home
7555         else
7556             JDK=sun
7558             dnl Sun JDK specific tests
7559             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7560             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7562             if test "$_jdk_ver" -lt 10800; then
7563                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7564             fi
7565             if test "$_jdk_ver" -gt 10800; then
7566                 JAVA_CLASSPATH_NOT_SET=TRUE
7567             fi
7569             AC_MSG_RESULT([found (JDK $_jdk)])
7570             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7571             if test "$_os" = "WINNT"; then
7572                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7573             fi
7575             # set to limit VM usage for JunitTests
7576             JAVAIFLAGS=-Xmx64M
7577             # set to limit VM usage for javac
7578             JAVAFLAGS=-J-Xmx128M
7579         fi
7580     else
7581         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7582     fi
7583 else
7584     dnl Java disabled
7585     JAVA_HOME=
7586     export JAVA_HOME
7589 dnl ===================================================================
7590 dnl Checks for javac
7591 dnl ===================================================================
7592 if test "$ENABLE_JAVA" != ""; then
7593     javacompiler="javac"
7594     : ${JAVA_SOURCE_VER=8}
7595     : ${JAVA_TARGET_VER=8}
7596     if test -z "$with_jdk_home"; then
7597         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7598     else
7599         _javac_path="$with_jdk_home/bin/$javacompiler"
7600         dnl Check if there is a Java compiler at all.
7601         if test -x "$_javac_path"; then
7602             JAVACOMPILER=$_javac_path
7603         fi
7604     fi
7605     if test -z "$JAVACOMPILER"; then
7606         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7607     fi
7608     if test "$build_os" = "cygwin"; then
7609         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7610             JAVACOMPILER="${JAVACOMPILER}.exe"
7611         fi
7612         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7613     fi
7616 dnl ===================================================================
7617 dnl Checks for javadoc
7618 dnl ===================================================================
7619 if test "$ENABLE_JAVA" != ""; then
7620     if test -z "$with_jdk_home"; then
7621         AC_PATH_PROG(JAVADOC, javadoc)
7622     else
7623         _javadoc_path="$with_jdk_home/bin/javadoc"
7624         dnl Check if there is a javadoc at all.
7625         if test -x "$_javadoc_path"; then
7626             JAVADOC=$_javadoc_path
7627         else
7628             AC_PATH_PROG(JAVADOC, javadoc)
7629         fi
7630     fi
7631     if test -z "$JAVADOC"; then
7632         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7633     fi
7634     if test "$build_os" = "cygwin"; then
7635         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7636             JAVADOC="${JAVADOC}.exe"
7637         fi
7638         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7639     fi
7641     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7642     JAVADOCISGJDOC="yes"
7643     fi
7645 AC_SUBST(JAVADOCISGJDOC)
7647 if test "$ENABLE_JAVA" != ""; then
7648     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7649     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7650         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7651            # try to recover first by looking whether we have an alternative
7652            # system as in Debian or newer SuSEs where following /usr/bin/javac
7653            # over /etc/alternatives/javac leads to the right bindir where we
7654            # just need to strip a bit away to get a valid JAVA_HOME
7655            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7656         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7657             # maybe only one level of symlink (e.g. on Mac)
7658             JAVA_HOME=$(readlink $JAVACOMPILER)
7659             if test "$(dirname $JAVA_HOME)" = "."; then
7660                 # we've got no path to trim back
7661                 JAVA_HOME=""
7662             fi
7663         else
7664             # else warn
7665             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7666             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7667             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7668             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7669         fi
7670         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7671         if test "$JAVA_HOME" != "/usr"; then
7672             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7673                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7674                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7675                 dnl Tiger already returns a JDK path...
7676                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7677             else
7678                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7679                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7680                 dnl that checks which version to run
7681                 if test -f "$JAVA_HOME"; then
7682                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7683                 fi
7684             fi
7685         fi
7686     fi
7687     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7689     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7690     if test -z "$JAVA_HOME"; then
7691         if test "x$with_jdk_home" = "x"; then
7692             cat > findhome.java <<_ACEOF
7693 [import java.io.File;
7695 class findhome
7697     public static void main(String args[])
7698     {
7699         String jrelocation = System.getProperty("java.home");
7700         File jre = new File(jrelocation);
7701         System.out.println(jre.getParent());
7702     }
7704 _ACEOF
7705             AC_MSG_CHECKING([if javac works])
7706             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7707             AC_TRY_EVAL(javac_cmd)
7708             if test $? = 0 -a -f ./findhome.class; then
7709                 AC_MSG_RESULT([javac works])
7710             else
7711                 echo "configure: javac test failed" >&5
7712                 cat findhome.java >&5
7713                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7714             fi
7715             AC_MSG_CHECKING([if gij knows its java.home])
7716             JAVA_HOME=`$JAVAINTERPRETER findhome`
7717             if test $? = 0 -a "$JAVA_HOME" != ""; then
7718                 AC_MSG_RESULT([$JAVA_HOME])
7719             else
7720                 echo "configure: java test failed" >&5
7721                 cat findhome.java >&5
7722                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7723             fi
7724             # clean-up after ourselves
7725             rm -f ./findhome.java ./findhome.class
7726         else
7727             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7728         fi
7729     fi
7731     # now check if $JAVA_HOME is really valid
7732     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7733         case "${JAVA_HOME}" in
7734             /Library/Java/JavaVirtualMachines/*)
7735                 ;;
7736             *)
7737                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7738                 ;;
7739         esac
7740         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7741             JAVA_HOME_OK="NO"
7742         fi
7743     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7744         JAVA_HOME_OK="NO"
7745     fi
7746     if test "$JAVA_HOME_OK" = "NO"; then
7747         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7748         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7749         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7750         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7751         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7752         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7753     fi
7754     PathFormat "$JAVA_HOME"
7755     JAVA_HOME="$formatted_path"
7758 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7759     "$_os" != Darwin
7760 then
7761     AC_MSG_CHECKING([for JAWT lib])
7762     if test "$_os" = WINNT; then
7763         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7764         JAWTLIB=jawt.lib
7765     else
7766         case "$host_cpu" in
7767         arm*)
7768             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7769             JAVA_ARCH=$my_java_arch
7770             ;;
7771         i*86)
7772             my_java_arch=i386
7773             ;;
7774         m68k)
7775             my_java_arch=m68k
7776             ;;
7777         powerpc)
7778             my_java_arch=ppc
7779             ;;
7780         powerpc64)
7781             my_java_arch=ppc64
7782             ;;
7783         powerpc64le)
7784             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7785             JAVA_ARCH=$my_java_arch
7786             ;;
7787         sparc64)
7788             my_java_arch=sparcv9
7789             ;;
7790         x86_64)
7791             my_java_arch=amd64
7792             ;;
7793         *)
7794             my_java_arch=$host_cpu
7795             ;;
7796         esac
7797         # This is where JDK9 puts the library
7798         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7799             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7800         else
7801             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7802         fi
7803         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7804     fi
7805     AC_MSG_RESULT([$JAWTLIB])
7807 AC_SUBST(JAWTLIB)
7809 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7810     case "$host_os" in
7812     aix*)
7813         JAVAINC="-I$JAVA_HOME/include"
7814         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7815         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7816         ;;
7818     cygwin*)
7819         JAVAINC="-I$JAVA_HOME/include/win32"
7820         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7821         ;;
7823     darwin*)
7824         if test -d "$JAVA_HOME/include/darwin"; then
7825             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7826         else
7827             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7828         fi
7829         ;;
7831     dragonfly*)
7832         JAVAINC="-I$JAVA_HOME/include"
7833         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7834         ;;
7836     freebsd*)
7837         JAVAINC="-I$JAVA_HOME/include"
7838         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7839         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7840         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7841         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7842         ;;
7844     k*bsd*-gnu*)
7845         JAVAINC="-I$JAVA_HOME/include"
7846         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7847         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7848         ;;
7850     linux-gnu*)
7851         JAVAINC="-I$JAVA_HOME/include"
7852         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7853         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7854         ;;
7856     *netbsd*)
7857         JAVAINC="-I$JAVA_HOME/include"
7858         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7859         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7860        ;;
7862     openbsd*)
7863         JAVAINC="-I$JAVA_HOME/include"
7864         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7865         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7866         ;;
7868     solaris*)
7869         JAVAINC="-I$JAVA_HOME/include"
7870         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7871         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7872         ;;
7873     esac
7875 SOLARINC="$SOLARINC $JAVAINC"
7877 AC_SUBST(JAVACOMPILER)
7878 AC_SUBST(JAVADOC)
7879 AC_SUBST(JAVAINTERPRETER)
7880 AC_SUBST(JAVAIFLAGS)
7881 AC_SUBST(JAVAFLAGS)
7882 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7883 AC_SUBST(JAVA_HOME)
7884 AC_SUBST(JAVA_SOURCE_VER)
7885 AC_SUBST(JAVA_TARGET_VER)
7886 AC_SUBST(JDK)
7889 dnl ===================================================================
7890 dnl Export file validation
7891 dnl ===================================================================
7892 AC_MSG_CHECKING([whether to enable export file validation])
7893 if test "$with_export_validation" != "no"; then
7894     if test -z "$ENABLE_JAVA"; then
7895         if test "$with_export_validation" = "yes"; then
7896             AC_MSG_ERROR([requested, but Java is disabled])
7897         else
7898             AC_MSG_RESULT([no, as Java is disabled])
7899         fi
7900     elif ! test -d "${SRC_ROOT}/schema"; then
7901         if test "$with_export_validation" = "yes"; then
7902             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7903         else
7904             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7905         fi
7906     else
7907         AC_MSG_RESULT([yes])
7908         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7910         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7911         if test -z "$ODFVALIDATOR"; then
7912             # remember to download the ODF toolkit with validator later
7913             AC_MSG_NOTICE([no odfvalidator found, will download it])
7914             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7915             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7917             # and fetch name of odfvalidator jar name from download.lst
7918             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7919             AC_SUBST(ODFVALIDATOR_JAR)
7921             if test -z "$ODFVALIDATOR_JAR"; then
7922                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
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             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7931         else
7932             ODFVALIDATOR="sh $ODFVALIDATOR"
7933         fi
7934         AC_SUBST(ODFVALIDATOR)
7937         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7938         if test -z "$OFFICEOTRON"; then
7939             # remember to download the officeotron with validator later
7940             AC_MSG_NOTICE([no officeotron found, will download it])
7941             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7942             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7944             # and fetch name of officeotron jar name from download.lst
7945             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7946             AC_SUBST(OFFICEOTRON_JAR)
7948             if test -z "$OFFICEOTRON_JAR"; then
7949                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7950             fi
7951         else
7952             # check version of existing officeotron
7953             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7954             if test 0"$OFFICEOTRON_VER" -lt 704; then
7955                 AC_MSG_ERROR([officeotron too old])
7956             fi
7957         fi
7958         if test "$build_os" = "cygwin"; then
7959             # In case of Cygwin it will be executed from Windows,
7960             # so we need to run bash and absolute path to validator
7961             # so instead of "odfvalidator" it will be
7962             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7963             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7964         else
7965             OFFICEOTRON="sh $OFFICEOTRON"
7966         fi
7967     fi
7968     AC_SUBST(OFFICEOTRON)
7969 else
7970     AC_MSG_RESULT([no])
7973 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7974 if test "$with_bffvalidator" != "no"; then
7975     AC_DEFINE(HAVE_BFFVALIDATOR)
7977     if test "$with_export_validation" = "no"; then
7978         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7979     fi
7981     if test "$with_bffvalidator" = "yes"; then
7982         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7983     else
7984         BFFVALIDATOR="$with_bffvalidator"
7985     fi
7987     if test "$build_os" = "cygwin"; then
7988         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7989             AC_MSG_RESULT($BFFVALIDATOR)
7990         else
7991             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7992         fi
7993     elif test -n "$BFFVALIDATOR"; then
7994         # We are not in Cygwin but need to run Windows binary with wine
7995         AC_PATH_PROGS(WINE, wine)
7997         # so swap in a shell wrapper that converts paths transparently
7998         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7999         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8000         AC_SUBST(BFFVALIDATOR_EXE)
8001         AC_MSG_RESULT($BFFVALIDATOR)
8002     else
8003         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8004     fi
8005     AC_SUBST(BFFVALIDATOR)
8006 else
8007     AC_MSG_RESULT([no])
8010 dnl ===================================================================
8011 dnl Check for C preprocessor to use
8012 dnl ===================================================================
8013 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8014 if test -n "$with_idlc_cpp"; then
8015     AC_MSG_RESULT([$with_idlc_cpp])
8016     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8017 else
8018     AC_MSG_RESULT([ucpp])
8019     AC_MSG_CHECKING([which ucpp tp use])
8020     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8021         AC_MSG_RESULT([external])
8022         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8023     else
8024         AC_MSG_RESULT([internal])
8025         BUILD_TYPE="$BUILD_TYPE UCPP"
8026     fi
8028 AC_SUBST(SYSTEM_UCPP)
8030 dnl ===================================================================
8031 dnl Check for epm (not needed for Windows)
8032 dnl ===================================================================
8033 AC_MSG_CHECKING([whether to enable EPM for packing])
8034 if test "$enable_epm" = "yes"; then
8035     AC_MSG_RESULT([yes])
8036     if test "$_os" != "WINNT"; then
8037         if test $_os = Darwin; then
8038             EPM=internal
8039         elif test -n "$with_epm"; then
8040             EPM=$with_epm
8041         else
8042             AC_PATH_PROG(EPM, epm, no)
8043         fi
8044         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8045             AC_MSG_NOTICE([EPM will be built.])
8046             BUILD_TYPE="$BUILD_TYPE EPM"
8047             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8048         else
8049             # Gentoo has some epm which is something different...
8050             AC_MSG_CHECKING([whether the found epm is the right epm])
8051             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8052                 AC_MSG_RESULT([yes])
8053             else
8054                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8055             fi
8056             AC_MSG_CHECKING([epm version])
8057             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8058             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8059                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8060                 AC_MSG_RESULT([OK, >= 3.7])
8061             else
8062                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8063                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8064             fi
8065         fi
8066     fi
8068     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8069         AC_MSG_CHECKING([for rpm])
8070         for a in "$RPM" rpmbuild rpm; do
8071             $a --usage >/dev/null 2> /dev/null
8072             if test $? -eq 0; then
8073                 RPM=$a
8074                 break
8075             else
8076                 $a --version >/dev/null 2> /dev/null
8077                 if test $? -eq 0; then
8078                     RPM=$a
8079                     break
8080                 fi
8081             fi
8082         done
8083         if test -z "$RPM"; then
8084             AC_MSG_ERROR([not found])
8085         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8086             RPM_PATH=`which $RPM`
8087             AC_MSG_RESULT([$RPM_PATH])
8088             SCPDEFS="$SCPDEFS -DWITH_RPM"
8089         else
8090             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8091         fi
8092     fi
8093     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8094         AC_PATH_PROG(DPKG, dpkg, no)
8095         if test "$DPKG" = "no"; then
8096             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8097         fi
8098     fi
8099     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8100        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8101         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8102             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8103                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8104                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8105                     AC_MSG_RESULT([yes])
8106                 else
8107                     AC_MSG_RESULT([no])
8108                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8109                         _pt="rpm"
8110                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8111                         add_warning "the rpms will need to be installed with --nodeps"
8112                     else
8113                         _pt="pkg"
8114                     fi
8115                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8116                     add_warning "the ${_pt}s will not be relocatable"
8117                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8118                                  relocation will work, you need to patch your epm with the
8119                                  patch in epm/epm-3.7.patch or build with
8120                                  --with-epm=internal which will build a suitable epm])
8121                 fi
8122             fi
8123         fi
8124     fi
8125     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8126         AC_PATH_PROG(PKGMK, pkgmk, no)
8127         if test "$PKGMK" = "no"; then
8128             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8129         fi
8130     fi
8131     AC_SUBST(RPM)
8132     AC_SUBST(DPKG)
8133     AC_SUBST(PKGMK)
8134 else
8135     for i in $PKGFORMAT; do
8136         case "$i" in
8137         aix | bsd | deb | pkg | rpm | native | portable)
8138             AC_MSG_ERROR(
8139                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8140             ;;
8141         esac
8142     done
8143     AC_MSG_RESULT([no])
8144     EPM=NO
8146 AC_SUBST(EPM)
8148 ENABLE_LWP=
8149 if test "$enable_lotuswordpro" = "yes"; then
8150     ENABLE_LWP="TRUE"
8152 AC_SUBST(ENABLE_LWP)
8154 dnl ===================================================================
8155 dnl Check for building ODK
8156 dnl ===================================================================
8157 if test "$enable_odk" = no; then
8158     unset DOXYGEN
8159 else
8160     if test "$with_doxygen" = no; then
8161         AC_MSG_CHECKING([for doxygen])
8162         unset DOXYGEN
8163         AC_MSG_RESULT([no])
8164     else
8165         if test "$with_doxygen" = yes; then
8166             AC_PATH_PROG([DOXYGEN], [doxygen])
8167             if test -z "$DOXYGEN"; then
8168                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8169             fi
8170             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8171                 if ! dot -V 2>/dev/null; then
8172                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8173                 fi
8174             fi
8175         else
8176             AC_MSG_CHECKING([for doxygen])
8177             DOXYGEN=$with_doxygen
8178             AC_MSG_RESULT([$DOXYGEN])
8179         fi
8180         if test -n "$DOXYGEN"; then
8181             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8182             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8183             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8184                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8185             fi
8186         fi
8187     fi
8189 AC_SUBST([DOXYGEN])
8191 AC_MSG_CHECKING([whether to build the ODK])
8192 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8193     AC_MSG_RESULT([yes])
8195     if test "$with_java" != "no"; then
8196         AC_MSG_CHECKING([whether to build unowinreg.dll])
8197         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8198             # build on Win by default
8199             enable_build_unowinreg=yes
8200         fi
8201         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8202             AC_MSG_RESULT([no])
8203             BUILD_UNOWINREG=
8204         else
8205             AC_MSG_RESULT([yes])
8206             BUILD_UNOWINREG=TRUE
8207         fi
8208         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8209             if test -z "$with_mingw_cross_compiler"; then
8210                 dnl Guess...
8211                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8212             elif test -x "$with_mingw_cross_compiler"; then
8213                  MINGWCXX="$with_mingw_cross_compiler"
8214             else
8215                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8216             fi
8218             if test "$MINGWCXX" = "false"; then
8219                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8220             fi
8222             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8223             if test -x "$mingwstrip_test"; then
8224                 MINGWSTRIP="$mingwstrip_test"
8225             else
8226                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8227             fi
8229             if test "$MINGWSTRIP" = "false"; then
8230                 AC_MSG_ERROR(MinGW32 binutils not found.)
8231             fi
8232         fi
8233     fi
8234     BUILD_TYPE="$BUILD_TYPE ODK"
8235 else
8236     AC_MSG_RESULT([no])
8237     BUILD_UNOWINREG=
8239 AC_SUBST(BUILD_UNOWINREG)
8240 AC_SUBST(MINGWCXX)
8241 AC_SUBST(MINGWSTRIP)
8243 dnl ===================================================================
8244 dnl Check for system zlib
8245 dnl ===================================================================
8246 if test "$with_system_zlib" = "auto"; then
8247     case "$_os" in
8248     WINNT)
8249         with_system_zlib="$with_system_libs"
8250         ;;
8251     *)
8252         if test "$enable_fuzzers" != "yes"; then
8253             with_system_zlib=yes
8254         else
8255             with_system_zlib=no
8256         fi
8257         ;;
8258     esac
8261 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8262 dnl and has no pkg-config for it at least on some tinderboxes,
8263 dnl so leaving that out for now
8264 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8265 AC_MSG_CHECKING([which zlib to use])
8266 if test "$with_system_zlib" = "yes"; then
8267     AC_MSG_RESULT([external])
8268     SYSTEM_ZLIB=TRUE
8269     AC_CHECK_HEADER(zlib.h, [],
8270         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8271     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8272         [AC_MSG_ERROR(zlib not found or functional)], [])
8273 else
8274     AC_MSG_RESULT([internal])
8275     SYSTEM_ZLIB=
8276     BUILD_TYPE="$BUILD_TYPE ZLIB"
8277     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8278     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8280 AC_SUBST(ZLIB_CFLAGS)
8281 AC_SUBST(ZLIB_LIBS)
8282 AC_SUBST(SYSTEM_ZLIB)
8284 dnl ===================================================================
8285 dnl Check for system jpeg
8286 dnl ===================================================================
8287 AC_MSG_CHECKING([which libjpeg to use])
8288 if test "$with_system_jpeg" = "yes"; then
8289     AC_MSG_RESULT([external])
8290     SYSTEM_LIBJPEG=TRUE
8291     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8292         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8293     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8294         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8295 else
8296     SYSTEM_LIBJPEG=
8297     AC_MSG_RESULT([internal, libjpeg-turbo])
8298     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8299     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8300     if test "$COM" = "MSC"; then
8301         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8302     else
8303         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8304     fi
8306     case "$host_cpu" in
8307     x86_64 | amd64 | i*86 | x86 | ia32)
8308         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8309         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8310             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8311                 NASM="$LODE_HOME/opt/bin/nasm"
8312             elif test -x "/opt/lo/bin/nasm"; then
8313                 NASM="/opt/lo/bin/nasm"
8314             fi
8315         fi
8317         if test -n "$NASM"; then
8318             AC_MSG_CHECKING([for object file format of host system])
8319             case "$host_os" in
8320               cygwin* | mingw* | pw32* | interix*)
8321                 case "$host_cpu" in
8322                   x86_64)
8323                     objfmt='Win64-COFF'
8324                     ;;
8325                   *)
8326                     objfmt='Win32-COFF'
8327                     ;;
8328                 esac
8329               ;;
8330               msdosdjgpp* | go32*)
8331                 objfmt='COFF'
8332               ;;
8333               os2-emx*) # not tested
8334                 objfmt='MSOMF' # obj
8335               ;;
8336               linux*coff* | linux*oldld*)
8337                 objfmt='COFF' # ???
8338               ;;
8339               linux*aout*)
8340                 objfmt='a.out'
8341               ;;
8342               linux*)
8343                 case "$host_cpu" in
8344                   x86_64)
8345                     objfmt='ELF64'
8346                     ;;
8347                   *)
8348                     objfmt='ELF'
8349                     ;;
8350                 esac
8351               ;;
8352               kfreebsd* | freebsd* | netbsd* | openbsd*)
8353                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8354                   objfmt='BSD-a.out'
8355                 else
8356                   case "$host_cpu" in
8357                     x86_64 | amd64)
8358                       objfmt='ELF64'
8359                       ;;
8360                     *)
8361                       objfmt='ELF'
8362                       ;;
8363                   esac
8364                 fi
8365               ;;
8366               solaris* | sunos* | sysv* | sco*)
8367                 case "$host_cpu" in
8368                   x86_64)
8369                     objfmt='ELF64'
8370                     ;;
8371                   *)
8372                     objfmt='ELF'
8373                     ;;
8374                 esac
8375               ;;
8376               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8377                 case "$host_cpu" in
8378                   x86_64)
8379                     objfmt='Mach-O64'
8380                     ;;
8381                   *)
8382                     objfmt='Mach-O'
8383                     ;;
8384                 esac
8385               ;;
8386               *)
8387                 objfmt='ELF ?'
8388               ;;
8389             esac
8391             AC_MSG_RESULT([$objfmt])
8392             if test "$objfmt" = 'ELF ?'; then
8393               objfmt='ELF'
8394               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8395             fi
8397             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8398             case "$objfmt" in
8399               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8400               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8401               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8402               COFF)       NAFLAGS='-fcoff -DCOFF';;
8403               a.out)      NAFLAGS='-faout -DAOUT';;
8404               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8405               ELF)        NAFLAGS='-felf -DELF';;
8406               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8407               RDF)        NAFLAGS='-frdf -DRDF';;
8408               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8409               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8410             esac
8411             AC_MSG_RESULT([$NAFLAGS])
8413             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8414             cat > conftest.asm << EOF
8415             [%line __oline__ "configure"
8416                     section .text
8417                     global  _main,main
8418             _main:
8419             main:   xor     eax,eax
8420                     ret
8421             ]
8423             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8424             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8425               AC_MSG_RESULT(yes)
8426             else
8427               echo "configure: failed program was:" >&AC_FD_CC
8428               cat conftest.asm >&AC_FD_CC
8429               rm -rf conftest*
8430               AC_MSG_RESULT(no)
8431               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8432               NASM=""
8433             fi
8435         fi
8437         if test -z "$NASM"; then
8438 cat << _EOS
8439 ****************************************************************************
8440 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8441 To get one please:
8443 _EOS
8444             if test "$build_os" = "cygwin"; then
8445 cat << _EOS
8446 install a pre-compiled binary for Win32
8448 mkdir -p /opt/lo/bin
8449 cd /opt/lo/bin
8450 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8451 chmod +x nasm
8453 or get and install one from http://www.nasm.us/
8455 Then re-run autogen.sh
8457 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8458 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8460 _EOS
8461             else
8462 cat << _EOS
8463 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8465 _EOS
8466             fi
8467             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8468             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8469         fi
8470       ;;
8471     esac
8474 AC_SUBST(NASM)
8475 AC_SUBST(LIBJPEG_CFLAGS)
8476 AC_SUBST(LIBJPEG_LIBS)
8477 AC_SUBST(SYSTEM_LIBJPEG)
8479 dnl ===================================================================
8480 dnl Check for system clucene
8481 dnl ===================================================================
8482 dnl we should rather be using
8483 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8484 dnl but the contribs-lib check seems tricky
8485 AC_MSG_CHECKING([which clucene to use])
8486 if test "$with_system_clucene" = "yes"; then
8487     AC_MSG_RESULT([external])
8488     SYSTEM_CLUCENE=TRUE
8489     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8490     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8491     FilterLibs "${CLUCENE_LIBS}"
8492     CLUCENE_LIBS="${filteredlibs}"
8493     AC_LANG_PUSH([C++])
8494     save_CXXFLAGS=$CXXFLAGS
8495     save_CPPFLAGS=$CPPFLAGS
8496     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8497     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8498     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8499     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8500     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8501                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8502     CXXFLAGS=$save_CXXFLAGS
8503     CPPFLAGS=$save_CPPFLAGS
8504     AC_LANG_POP([C++])
8506     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8507 else
8508     AC_MSG_RESULT([internal])
8509     SYSTEM_CLUCENE=
8510     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8512 AC_SUBST(SYSTEM_CLUCENE)
8513 AC_SUBST(CLUCENE_CFLAGS)
8514 AC_SUBST(CLUCENE_LIBS)
8516 dnl ===================================================================
8517 dnl Check for system expat
8518 dnl ===================================================================
8519 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8521 dnl ===================================================================
8522 dnl Check for system xmlsec
8523 dnl ===================================================================
8524 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8526 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8527 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8528     ENABLE_EOT="TRUE"
8529     AC_DEFINE([ENABLE_EOT])
8530     AC_MSG_RESULT([yes])
8532     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8533 else
8534     ENABLE_EOT=
8535     AC_MSG_RESULT([no])
8537 AC_SUBST([ENABLE_EOT])
8539 dnl ===================================================================
8540 dnl Check for DLP libs
8541 dnl ===================================================================
8542 AS_IF([test "$COM" = "MSC"],
8543       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8544       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8546 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8548 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8550 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8552 AS_IF([test "$COM" = "MSC"],
8553       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8554       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8556 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8558 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8560 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8561 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8563 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8565 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8567 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8569 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8570 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.16])
8572 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8573 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
8575 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8577 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8578 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8580 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8582 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8584 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8586 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8588 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8589 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8591 dnl ===================================================================
8592 dnl Check for system lcms2
8593 dnl ===================================================================
8594 if test "$with_system_lcms2" != "yes"; then
8595     SYSTEM_LCMS2=
8597 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8598 if test "$GCC" = "yes"; then
8599     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8601 if test "$COM" = "MSC"; then # override the above
8602     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8605 dnl ===================================================================
8606 dnl Check for system cppunit
8607 dnl ===================================================================
8608 if test "$_os" != "Android" ; then
8609     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8612 dnl ===================================================================
8613 dnl Check whether freetype is available
8614 dnl ===================================================================
8615 if test  "$test_freetype" = "yes"; then
8616     AC_MSG_CHECKING([whether freetype is available])
8617     # FreeType has 3 different kinds of versions
8618     # * release, like 2.4.10
8619     # * libtool, like 13.0.7 (this what pkg-config returns)
8620     # * soname
8621     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8622     #
8623     # 9.9.3 is 2.2.0
8624     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8625     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8626     FilterLibs "${FREETYPE_LIBS}"
8627     FREETYPE_LIBS="${filteredlibs}"
8628     SYSTEM_FREETYPE=TRUE
8629 else
8630     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8631     if test "x$ac_config_site_64bit_host" = xYES; then
8632         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8633     else
8634         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8635     fi
8637 AC_SUBST(FREETYPE_CFLAGS)
8638 AC_SUBST(FREETYPE_LIBS)
8639 AC_SUBST([SYSTEM_FREETYPE])
8641 # ===================================================================
8642 # Check for system libxslt
8643 # to prevent incompatibilities between internal libxml2 and external libxslt,
8644 # or vice versa, use with_system_libxml here
8645 # ===================================================================
8646 if test "$with_system_libxml" = "auto"; then
8647     case "$_os" in
8648     WINNT|iOS|Android)
8649         with_system_libxml="$with_system_libs"
8650         ;;
8651     *)
8652         if test "$enable_fuzzers" != "yes"; then
8653             with_system_libxml=yes
8654         else
8655             with_system_libxml=no
8656         fi
8657         ;;
8658     esac
8661 AC_MSG_CHECKING([which libxslt to use])
8662 if test "$with_system_libxml" = "yes"; then
8663     AC_MSG_RESULT([external])
8664     SYSTEM_LIBXSLT=TRUE
8665     if test "$_os" = "Darwin"; then
8666         dnl make sure to use SDK path
8667         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8668         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8669         dnl omit -L/usr/lib
8670         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8671         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8672     else
8673         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8674         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8675         FilterLibs "${LIBXSLT_LIBS}"
8676         LIBXSLT_LIBS="${filteredlibs}"
8677         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8678         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8679         FilterLibs "${LIBEXSLT_LIBS}"
8680         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8681     fi
8683     dnl Check for xsltproc
8684     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8685     if test "$XSLTPROC" = "no"; then
8686         AC_MSG_ERROR([xsltproc is required])
8687     fi
8688 else
8689     AC_MSG_RESULT([internal])
8690     SYSTEM_LIBXSLT=
8691     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8693     if test "$cross_compiling" = "yes"; then
8694         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8695         if test "$XSLTPROC" = "no"; then
8696             AC_MSG_ERROR([xsltproc is required])
8697         fi
8698     fi
8700 AC_SUBST(SYSTEM_LIBXSLT)
8701 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8702     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8704 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8706 AC_SUBST(LIBEXSLT_CFLAGS)
8707 AC_SUBST(LIBEXSLT_LIBS)
8708 AC_SUBST(LIBXSLT_CFLAGS)
8709 AC_SUBST(LIBXSLT_LIBS)
8710 AC_SUBST(XSLTPROC)
8712 # ===================================================================
8713 # Check for system libxml
8714 # ===================================================================
8715 AC_MSG_CHECKING([which libxml to use])
8716 if test "$with_system_libxml" = "yes"; then
8717     AC_MSG_RESULT([external])
8718     SYSTEM_LIBXML=TRUE
8719     if test "$_os" = "Darwin"; then
8720         dnl make sure to use SDK path
8721         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8722         dnl omit -L/usr/lib
8723         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8724     elif test $_os = iOS; then
8725         dnl make sure to use SDK path
8726         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8727         LIBXML_CFLAGS="-I$usr/include/libxml2"
8728         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8729     else
8730         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8731         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8732         FilterLibs "${LIBXML_LIBS}"
8733         LIBXML_LIBS="${filteredlibs}"
8734     fi
8736     dnl Check for xmllint
8737     AC_PATH_PROG(XMLLINT, xmllint, no)
8738     if test "$XMLLINT" = "no"; then
8739         AC_MSG_ERROR([xmllint is required])
8740     fi
8741 else
8742     AC_MSG_RESULT([internal])
8743     SYSTEM_LIBXML=
8744     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8745     if test "$COM" = "MSC"; then
8746         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8747     fi
8748     if test "$COM" = "MSC"; then
8749         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8750     else
8751         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8752     fi
8753     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8755 AC_SUBST(SYSTEM_LIBXML)
8756 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8757     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8759 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8760 AC_SUBST(LIBXML_CFLAGS)
8761 AC_SUBST(LIBXML_LIBS)
8762 AC_SUBST(XMLLINT)
8764 # =====================================================================
8765 # Checking for a Python interpreter with version >= 2.7.
8766 # Build and runtime requires Python 3 compatible version (>= 2.7).
8767 # Optionally user can pass an option to configure, i. e.
8768 # ./configure PYTHON=/usr/bin/python
8769 # =====================================================================
8770 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
8771     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
8772     enable_python=internal
8774 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8775     if test -n "$PYTHON"; then
8776         PYTHON_FOR_BUILD=$PYTHON
8777     else
8778         # This allows a lack of system python with no error, we use internal one in that case.
8779         AM_PATH_PYTHON([2.7],, [:])
8780         # Clean PYTHON_VERSION checked below if cross-compiling
8781         PYTHON_VERSION=""
8782         if test "$PYTHON" != ":"; then
8783             PYTHON_FOR_BUILD=$PYTHON
8784         fi
8785     fi
8787 AC_SUBST(PYTHON_FOR_BUILD)
8789 # Checks for Python to use for Pyuno
8790 AC_MSG_CHECKING([which Python to use for Pyuno])
8791 case "$enable_python" in
8792 no|disable)
8793     if test -z $PYTHON_FOR_BUILD; then
8794         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8795         # requirement from the choice whether to include Python stuff in the installer, but why
8796         # bother?
8797         AC_MSG_ERROR([Python is required at build time.])
8798     fi
8799     enable_python=no
8800     AC_MSG_RESULT([none])
8801     ;;
8802 ""|yes|auto)
8803     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8804         AC_MSG_RESULT([no, overridden by --disable-scripting])
8805         enable_python=no
8806     elif test $build_os = cygwin; then
8807         dnl When building on Windows we don't attempt to use any installed
8808         dnl "system"  Python.
8809         AC_MSG_RESULT([fully internal])
8810         enable_python=internal
8811     elif test "$cross_compiling" = yes; then
8812         AC_MSG_RESULT([system])
8813         enable_python=system
8814     else
8815         # Unset variables set by the above AM_PATH_PYTHON so that
8816         # we actually do check anew.
8817         AC_MSG_RESULT([])
8818         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
8819         AM_PATH_PYTHON([3.3],, [:])
8820         AC_MSG_CHECKING([which Python to use for Pyuno])
8821         if test "$PYTHON" = ":"; then
8822             if test -z "$PYTHON_FOR_BUILD"; then
8823                 AC_MSG_RESULT([fully internal])
8824             else
8825                 AC_MSG_RESULT([internal])
8826             fi
8827             enable_python=internal
8828         else
8829             AC_MSG_RESULT([system])
8830             enable_python=system
8831         fi
8832     fi
8833     ;;
8834 internal)
8835     AC_MSG_RESULT([internal])
8836     ;;
8837 fully-internal)
8838     AC_MSG_RESULT([fully internal])
8839     enable_python=internal
8840     ;;
8841 system)
8842     AC_MSG_RESULT([system])
8843     if test "$_os" = Darwin; then
8844         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])
8845     fi
8846     ;;
8848     AC_MSG_ERROR([Incorrect --enable-python option])
8849     ;;
8850 esac
8852 if test $enable_python != no; then
8853     BUILD_TYPE="$BUILD_TYPE PYUNO"
8856 if test $enable_python = system; then
8857     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8858         # Fallback: Accept these in the environment, or as set above
8859         # for MacOSX.
8860         :
8861     elif test "$cross_compiling" != yes; then
8862         # Unset variables set by the above AM_PATH_PYTHON so that
8863         # we actually do check anew.
8864         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
8865         # This causes an error if no python command is found
8866         AM_PATH_PYTHON([3.3])
8867         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8868         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8869         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8870         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8871         if test -z "$PKG_CONFIG"; then
8872             PYTHON_CFLAGS="-I$python_include"
8873             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8874         elif $PKG_CONFIG --exists python-$python_version-embed; then
8875             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8876             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8877         elif $PKG_CONFIG --exists python-$python_version; then
8878             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8879             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8880         else
8881             PYTHON_CFLAGS="-I$python_include"
8882             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8883         fi
8884         FilterLibs "${PYTHON_LIBS}"
8885         PYTHON_LIBS="${filteredlibs}"
8886     else
8887         dnl How to find out the cross-compilation Python installation path?
8888         AC_MSG_CHECKING([for python version])
8889         AS_IF([test -n "$PYTHON_VERSION"],
8890               [AC_MSG_RESULT([$PYTHON_VERSION])],
8891               [AC_MSG_RESULT([not found])
8892                AC_MSG_ERROR([no usable python found])])
8893         test -n "$PYTHON_CFLAGS" && break
8894     fi
8896     dnl Check if the headers really work
8897     save_CPPFLAGS="$CPPFLAGS"
8898     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8899     AC_CHECK_HEADER(Python.h)
8900     CPPFLAGS="$save_CPPFLAGS"
8902     # let the PYTHON_FOR_BUILD match the same python installation that
8903     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8904     # better for PythonTests.
8905     PYTHON_FOR_BUILD=$PYTHON
8908 if test "$with_lxml" != no; then
8909     if test -z "$PYTHON_FOR_BUILD"; then
8910         case $build_os in
8911             cygwin)
8912                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8913                 ;;
8914             *)
8915                 if test "$cross_compiling" != yes ; then
8916                     BUILD_TYPE="$BUILD_TYPE LXML"
8917                 fi
8918                 ;;
8919         esac
8920     else
8921         AC_MSG_CHECKING([for python lxml])
8922         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8923             AC_MSG_RESULT([yes])
8924         else
8925             case $build_os in
8926                 cygwin)
8927                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8928                     ;;
8929                 *)
8930                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8931                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8932                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8933                         else
8934                             BUILD_TYPE="$BUILD_TYPE LXML"
8935                             AC_MSG_RESULT([no, using internal lxml])
8936                         fi
8937                     else
8938                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8939                     fi
8940                     ;;
8941             esac
8942         fi
8943     fi
8946 dnl By now enable_python should be "system", "internal" or "no"
8947 case $enable_python in
8948 system)
8949     SYSTEM_PYTHON=TRUE
8951     if test "x$ac_cv_header_Python_h" != "xyes"; then
8952        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8953     fi
8955     AC_LANG_PUSH(C)
8956     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8957     AC_MSG_CHECKING([for correct python library version])
8958        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8959 #include <Python.h>
8961 int main(int argc, char **argv) {
8962    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8963        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8964    else return 1;
8966        ]])],[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])])
8967     CFLAGS=$save_CFLAGS
8968     AC_LANG_POP(C)
8970     dnl FIXME Check if the Python library can be linked with, too?
8971     ;;
8973 internal)
8974     SYSTEM_PYTHON=
8975     PYTHON_VERSION_MAJOR=3
8976     PYTHON_VERSION_MINOR=7
8977     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
8978     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8979         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8980     fi
8981     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"3.7.7"])
8982     BUILD_TYPE="$BUILD_TYPE PYTHON"
8983     if test "$OS" = LINUX; then
8984         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8985     fi
8986     # Embedded Python dies without Home set
8987     if test "$HOME" = ""; then
8988         export HOME=""
8989     fi
8990     ;;
8992     DISABLE_PYTHON=TRUE
8993     SYSTEM_PYTHON=
8994     ;;
8996     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8997     ;;
8998 esac
9000 AC_SUBST(DISABLE_PYTHON)
9001 AC_SUBST(SYSTEM_PYTHON)
9002 AC_SUBST(PYTHON_CFLAGS)
9003 AC_SUBST(PYTHON_LIBS)
9004 AC_SUBST(PYTHON_VERSION)
9005 AC_SUBST(PYTHON_VERSION_MAJOR)
9006 AC_SUBST(PYTHON_VERSION_MINOR)
9008 ENABLE_MARIADBC=TRUE
9009 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
9010     ENABLE_MARIADBC=
9012 MARIADBC_MAJOR=1
9013 MARIADBC_MINOR=0
9014 MARIADBC_MICRO=2
9015 if test "$ENABLE_MARIADBC" = "TRUE"; then
9016     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9019 AC_SUBST(ENABLE_MARIADBC)
9020 AC_SUBST(MARIADBC_MAJOR)
9021 AC_SUBST(MARIADBC_MINOR)
9022 AC_SUBST(MARIADBC_MICRO)
9024 if test "$ENABLE_MARIADBC" = "TRUE"; then
9025     dnl ===================================================================
9026     dnl Check for system MariaDB
9027     dnl ===================================================================
9028     AC_MSG_CHECKING([which MariaDB to use])
9029     if test "$with_system_mariadb" = "yes"; then
9030         AC_MSG_RESULT([external])
9031         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9032         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9033         if test -z "$MARIADBCONFIG"; then
9034             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9035             if test -z "$MARIADBCONFIG"; then
9036                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9037                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9038             fi
9039         fi
9040         AC_MSG_CHECKING([MariaDB version])
9041         MARIADB_VERSION=`$MARIADBCONFIG --version`
9042         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9043         if test "$MARIADB_MAJOR" -ge "5"; then
9044             AC_MSG_RESULT([OK])
9045         else
9046             AC_MSG_ERROR([too old, use 5.0.x or later])
9047         fi
9048         AC_MSG_CHECKING([for MariaDB Client library])
9049         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9050         if test "$COM_IS_CLANG" = TRUE; then
9051             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9052         fi
9053         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9054         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9055         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9056         dnl linux32:
9057         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9058             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9059             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9060                 | sed -e 's|/lib64/|/lib/|')
9061         fi
9062         FilterLibs "${MARIADB_LIBS}"
9063         MARIADB_LIBS="${filteredlibs}"
9064         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9065         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9066         if test "$enable_bundle_mariadb" = "yes"; then
9067             AC_MSG_RESULT([yes])
9068             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9069             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9071 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9073 /g' | grep -E '(mysqlclient|mariadb)')
9074             if test "$_os" = "Darwin"; then
9075                 LIBMARIADB=${LIBMARIADB}.dylib
9076             elif test "$_os" = "WINNT"; then
9077                 LIBMARIADB=${LIBMARIADB}.dll
9078             else
9079                 LIBMARIADB=${LIBMARIADB}.so
9080             fi
9081             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9082             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9083             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9084                 AC_MSG_RESULT([found.])
9085                 PathFormat "$LIBMARIADB_PATH"
9086                 LIBMARIADB_PATH="$formatted_path"
9087             else
9088                 AC_MSG_ERROR([not found.])
9089             fi
9090         else
9091             AC_MSG_RESULT([no])
9092             BUNDLE_MARIADB_CONNECTOR_C=
9093         fi
9094     else
9095         AC_MSG_RESULT([internal])
9096         SYSTEM_MARIADB_CONNECTOR_C=
9097         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9098         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9099         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9100     fi
9102     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9103     AC_SUBST(MARIADB_CFLAGS)
9104     AC_SUBST(MARIADB_LIBS)
9105     AC_SUBST(LIBMARIADB)
9106     AC_SUBST(LIBMARIADB_PATH)
9107     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9110 dnl ===================================================================
9111 dnl Check for system hsqldb
9112 dnl ===================================================================
9113 if test "$with_java" != "no"; then
9114     HSQLDB_USE_JDBC_4_1=
9115     AC_MSG_CHECKING([which hsqldb to use])
9116     if test "$with_system_hsqldb" = "yes"; then
9117         AC_MSG_RESULT([external])
9118         SYSTEM_HSQLDB=TRUE
9119         if test -z $HSQLDB_JAR; then
9120             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9121         fi
9122         if ! test -f $HSQLDB_JAR; then
9123                AC_MSG_ERROR(hsqldb.jar not found.)
9124         fi
9125         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9126         export HSQLDB_JAR
9127         if $PERL -e \
9128            'use Archive::Zip;
9129             my $file = "$ENV{'HSQLDB_JAR'}";
9130             my $zip = Archive::Zip->new( $file );
9131             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9132             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9133             {
9134                 push @l, split(/\n/, $mf);
9135                 foreach my $line (@l)
9136                 {
9137                     if ($line =~ m/Specification-Version:/)
9138                     {
9139                         ($t, $version) = split (/:/,$line);
9140                         $version =~ s/^\s//;
9141                         ($a, $b, $c, $d) = split (/\./,$version);
9142                         if ($c == "0" && $d > "8")
9143                         {
9144                             exit 0;
9145                         }
9146                         else
9147                         {
9148                             exit 1;
9149                         }
9150                     }
9151                 }
9152             }
9153             else
9154             {
9155                 exit 1;
9156             }'; then
9157             AC_MSG_RESULT([yes])
9158         else
9159             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9160         fi
9161     else
9162         AC_MSG_RESULT([internal])
9163         SYSTEM_HSQLDB=
9164         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9165         NEED_ANT=TRUE
9166         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9167         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9168         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9169             AC_MSG_RESULT([yes])
9170             HSQLDB_USE_JDBC_4_1=TRUE
9171         else
9172             AC_MSG_RESULT([no])
9173         fi
9174     fi
9175     AC_SUBST(SYSTEM_HSQLDB)
9176     AC_SUBST(HSQLDB_JAR)
9177     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9180 dnl ===================================================================
9181 dnl Check for PostgreSQL stuff
9182 dnl ===================================================================
9183 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9184 if test "x$enable_postgresql_sdbc" != "xno"; then
9185     AC_MSG_RESULT([yes])
9186     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9188     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9189         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9190     fi
9191     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9192         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9193     fi
9195     postgres_interface=""
9196     if test "$with_system_postgresql" = "yes"; then
9197         postgres_interface="external PostgreSQL"
9198         SYSTEM_POSTGRESQL=TRUE
9199         if test "$_os" = Darwin; then
9200             supp_path=''
9201             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9202                 pg_supp_path="$P_SEP$d$pg_supp_path"
9203             done
9204         fi
9205         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9206         if test -n "$PGCONFIG"; then
9207             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9208             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9209         else
9210             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9211               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9212               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9213             ],[
9214               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9215             ])
9216         fi
9217         FilterLibs "${POSTGRESQL_LIB}"
9218         POSTGRESQL_LIB="${filteredlibs}"
9219     else
9220         # if/when anything else than PostgreSQL uses Kerberos,
9221         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9222         WITH_KRB5=
9223         WITH_GSSAPI=
9224         case "$_os" in
9225         Darwin)
9226             # macOS has system MIT Kerberos 5 since 10.4
9227             if test "$with_krb5" != "no"; then
9228                 WITH_KRB5=TRUE
9229                 save_LIBS=$LIBS
9230                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9231                 # that the libraries where these functions are located on macOS will change, is it?
9232                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9233                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9234                 KRB5_LIBS=$LIBS
9235                 LIBS=$save_LIBS
9236                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9237                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9238                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9239                 LIBS=$save_LIBS
9240             fi
9241             if test "$with_gssapi" != "no"; then
9242                 WITH_GSSAPI=TRUE
9243                 save_LIBS=$LIBS
9244                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9245                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9246                 GSSAPI_LIBS=$LIBS
9247                 LIBS=$save_LIBS
9248             fi
9249             ;;
9250         WINNT)
9251             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9252                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9253             fi
9254             ;;
9255         Linux|GNU|*BSD|DragonFly)
9256             if test "$with_krb5" != "no"; then
9257                 WITH_KRB5=TRUE
9258                 save_LIBS=$LIBS
9259                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9260                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9261                 KRB5_LIBS=$LIBS
9262                 LIBS=$save_LIBS
9263                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9264                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9265                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9266                 LIBS=$save_LIBS
9267             fi
9268             if test "$with_gssapi" != "no"; then
9269                 WITH_GSSAPI=TRUE
9270                 save_LIBS=$LIBS
9271                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9272                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9273                 GSSAPI_LIBS=$LIBS
9274                 LIBS=$save_LIBS
9275             fi
9276             ;;
9277         *)
9278             if test "$with_krb5" = "yes"; then
9279                 WITH_KRB5=TRUE
9280                 save_LIBS=$LIBS
9281                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9282                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9283                 KRB5_LIBS=$LIBS
9284                 LIBS=$save_LIBS
9285                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9286                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9287                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9288                 LIBS=$save_LIBS
9289             fi
9290             if test "$with_gssapi" = "yes"; then
9291                 WITH_GSSAPI=TRUE
9292                 save_LIBS=$LIBS
9293                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9294                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9295                 LIBS=$save_LIBS
9296                 GSSAPI_LIBS=$LIBS
9297             fi
9298         esac
9300         if test -n "$with_libpq_path"; then
9301             SYSTEM_POSTGRESQL=TRUE
9302             postgres_interface="external libpq"
9303             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9304             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9305         else
9306             SYSTEM_POSTGRESQL=
9307             postgres_interface="internal"
9308             POSTGRESQL_LIB=""
9309             POSTGRESQL_INC="%OVERRIDE_ME%"
9310             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9311         fi
9312     fi
9314     AC_MSG_CHECKING([PostgreSQL C interface])
9315     AC_MSG_RESULT([$postgres_interface])
9317     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9318         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9319         save_CFLAGS=$CFLAGS
9320         save_CPPFLAGS=$CPPFLAGS
9321         save_LIBS=$LIBS
9322         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9323         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9324         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9325         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9326             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9327         CFLAGS=$save_CFLAGS
9328         CPPFLAGS=$save_CPPFLAGS
9329         LIBS=$save_LIBS
9330     fi
9331     BUILD_POSTGRESQL_SDBC=TRUE
9332 else
9333     AC_MSG_RESULT([no])
9335 AC_SUBST(WITH_KRB5)
9336 AC_SUBST(WITH_GSSAPI)
9337 AC_SUBST(GSSAPI_LIBS)
9338 AC_SUBST(KRB5_LIBS)
9339 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9340 AC_SUBST(SYSTEM_POSTGRESQL)
9341 AC_SUBST(POSTGRESQL_INC)
9342 AC_SUBST(POSTGRESQL_LIB)
9344 dnl ===================================================================
9345 dnl Check for Firebird stuff
9346 dnl ===================================================================
9347 ENABLE_FIREBIRD_SDBC=
9348 if test "$enable_firebird_sdbc" = "yes" ; then
9349     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9351     dnl ===================================================================
9352     dnl Check for system Firebird
9353     dnl ===================================================================
9354     AC_MSG_CHECKING([which Firebird to use])
9355     if test "$with_system_firebird" = "yes"; then
9356         AC_MSG_RESULT([external])
9357         SYSTEM_FIREBIRD=TRUE
9358         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9359         if test -z "$FIREBIRDCONFIG"; then
9360             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9361             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9362                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9363             ])
9364             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9365         else
9366             AC_MSG_NOTICE([fb_config found])
9367             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9368             AC_MSG_CHECKING([for Firebird Client library])
9369             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9370             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9371             FilterLibs "${FIREBIRD_LIBS}"
9372             FIREBIRD_LIBS="${filteredlibs}"
9373         fi
9374         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9375         AC_MSG_CHECKING([Firebird version])
9376         if test -n "${FIREBIRD_VERSION}"; then
9377             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9378             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9379             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9380                 AC_MSG_RESULT([OK])
9381             else
9382                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9383             fi
9384         else
9385             __save_CFLAGS="${CFLAGS}"
9386             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9387             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9388 #if defined(FB_API_VER) && FB_API_VER == 30
9389 int fb_api_is_30(void) { return 0; }
9390 #else
9391 #error "Wrong Firebird API version"
9392 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9393             CFLAGS="${__save_CFLAGS}"
9394         fi
9395         ENABLE_FIREBIRD_SDBC=TRUE
9396         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9397     elif test "$enable_database_connectivity" != yes; then
9398         AC_MSG_RESULT([none])
9399     elif test "$cross_compiling" = "yes"; then
9400         AC_MSG_RESULT([none])
9401     else
9402         dnl Embedded Firebird has version 3.0
9403         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9404         dnl We need libatomic_ops for any non X86/X64 system
9405         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9406             dnl ===================================================================
9407             dnl Check for system libatomic_ops
9408             dnl ===================================================================
9409             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9410             if test "$with_system_libatomic_ops" = "yes"; then
9411                 SYSTEM_LIBATOMIC_OPS=TRUE
9412                 AC_CHECK_HEADERS(atomic_ops.h, [],
9413                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9414             else
9415                 SYSTEM_LIBATOMIC_OPS=
9416                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9417                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9418                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9419             fi
9420         fi
9422         AC_MSG_RESULT([internal])
9423         SYSTEM_FIREBIRD=
9424         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9425         FIREBIRD_LIBS="-lfbclient"
9427         if test "$with_system_libtommath" = "yes"; then
9428             SYSTEM_LIBTOMMATH=TRUE
9429             dnl check for tommath presence
9430             save_LIBS=$LIBS
9431             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9432             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9433             LIBS=$save_LIBS
9434         else
9435             SYSTEM_LIBTOMMATH=
9436             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9437             LIBTOMMATH_LIBS="-ltommath"
9438             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9439         fi
9441         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9442         ENABLE_FIREBIRD_SDBC=TRUE
9443         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9444     fi
9446 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9447 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9448 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9449 AC_SUBST(LIBATOMIC_OPS_LIBS)
9450 AC_SUBST(SYSTEM_FIREBIRD)
9451 AC_SUBST(FIREBIRD_CFLAGS)
9452 AC_SUBST(FIREBIRD_LIBS)
9453 AC_SUBST([TOMMATH_CFLAGS])
9454 AC_SUBST([TOMMATH_LIBS])
9456 dnl ===================================================================
9457 dnl Check for system curl
9458 dnl ===================================================================
9459 AC_MSG_CHECKING([which libcurl to use])
9460 if test "$with_system_curl" = "auto"; then
9461     with_system_curl="$with_system_libs"
9464 if test "$with_system_curl" = "yes"; then
9465     AC_MSG_RESULT([external])
9466     SYSTEM_CURL=TRUE
9468     # First try PKGCONFIG and then fall back
9469     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9471     if test -n "$CURL_PKG_ERRORS"; then
9472         AC_PATH_PROG(CURLCONFIG, curl-config)
9473         if test -z "$CURLCONFIG"; then
9474             AC_MSG_ERROR([curl development files not found])
9475         fi
9476         CURL_LIBS=`$CURLCONFIG --libs`
9477         FilterLibs "${CURL_LIBS}"
9478         CURL_LIBS="${filteredlibs}"
9479         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9480         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9482         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9483         case $curl_version in
9484         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9485         dnl so they need to be doubled to end up in the configure script
9486         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9487             AC_MSG_RESULT([yes])
9488             ;;
9489         *)
9490             AC_MSG_ERROR([no, you have $curl_version])
9491             ;;
9492         esac
9493     fi
9495     ENABLE_CURL=TRUE
9496 else
9497     AC_MSG_RESULT([internal])
9498     SYSTEM_CURL=
9499     BUILD_TYPE="$BUILD_TYPE CURL"
9500     ENABLE_CURL=TRUE
9502 AC_SUBST(SYSTEM_CURL)
9503 AC_SUBST(CURL_CFLAGS)
9504 AC_SUBST(CURL_LIBS)
9505 AC_SUBST(ENABLE_CURL)
9507 dnl ===================================================================
9508 dnl Check for system boost
9509 dnl ===================================================================
9510 AC_MSG_CHECKING([which boost to use])
9511 if test "$with_system_boost" = "yes"; then
9512     AC_MSG_RESULT([external])
9513     SYSTEM_BOOST=TRUE
9514     AX_BOOST_BASE(1.47)
9515     AX_BOOST_DATE_TIME
9516     AX_BOOST_FILESYSTEM
9517     AX_BOOST_IOSTREAMS
9518     AX_BOOST_LOCALE
9519     AC_LANG_PUSH([C++])
9520     save_CXXFLAGS=$CXXFLAGS
9521     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9522     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9523        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9524     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9525        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9526     CXXFLAGS=$save_CXXFLAGS
9527     AC_LANG_POP([C++])
9528     # this is in m4/ax_boost_base.m4
9529     FilterLibs "${BOOST_LDFLAGS}"
9530     BOOST_LDFLAGS="${filteredlibs}"
9531 else
9532     AC_MSG_RESULT([internal])
9533     BUILD_TYPE="$BUILD_TYPE BOOST"
9534     SYSTEM_BOOST=
9535     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9536         # use warning-suppressing wrapper headers
9537         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9538     else
9539         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9540     fi
9542 AC_SUBST(SYSTEM_BOOST)
9544 dnl ===================================================================
9545 dnl Check for system mdds
9546 dnl ===================================================================
9547 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9549 dnl ===================================================================
9550 dnl Check for system glm
9551 dnl ===================================================================
9552 AC_MSG_CHECKING([which glm to use])
9553 if test "$with_system_glm" = "yes"; then
9554     AC_MSG_RESULT([external])
9555     SYSTEM_GLM=TRUE
9556     AC_LANG_PUSH([C++])
9557     AC_CHECK_HEADER([glm/glm.hpp], [],
9558        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9559     AC_LANG_POP([C++])
9560 else
9561     AC_MSG_RESULT([internal])
9562     BUILD_TYPE="$BUILD_TYPE GLM"
9563     SYSTEM_GLM=
9564     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9566 AC_SUBST([GLM_CFLAGS])
9567 AC_SUBST([SYSTEM_GLM])
9569 dnl ===================================================================
9570 dnl Check for system odbc
9571 dnl ===================================================================
9572 AC_MSG_CHECKING([which odbc headers to use])
9573 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
9574     AC_MSG_RESULT([external])
9575     SYSTEM_ODBC_HEADERS=TRUE
9577     if test "$build_os" = "cygwin"; then
9578         save_CPPFLAGS=$CPPFLAGS
9579         find_winsdk
9580         PathFormat "$winsdktest"
9581         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"
9582         AC_CHECK_HEADER(sqlext.h, [],
9583             [AC_MSG_ERROR(odbc not found. install odbc)],
9584             [#include <windows.h>])
9585         CPPFLAGS=$save_CPPFLAGS
9586     else
9587         AC_CHECK_HEADER(sqlext.h, [],
9588             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9589     fi
9590 elif test "$enable_database_connectivity" != yes; then
9591     AC_MSG_RESULT([none])
9592 else
9593     AC_MSG_RESULT([internal])
9594     SYSTEM_ODBC_HEADERS=
9596 AC_SUBST(SYSTEM_ODBC_HEADERS)
9598 dnl ===================================================================
9599 dnl Enable LDAP support
9600 dnl ===================================================================
9602 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9603 AC_MSG_CHECKING([whether to enable LDAP support])
9604     if test "$enable_ldap" != "yes"; then
9605         AC_MSG_RESULT([no])
9606         ENABLE_LDAP=""
9607         enable_ldap=no
9608     else
9609         AC_MSG_RESULT([yes])
9610         ENABLE_LDAP="TRUE"
9611         AC_DEFINE(HAVE_FEATURE_LDAP)
9612     fi
9614 AC_SUBST(ENABLE_LDAP)
9616 dnl ===================================================================
9617 dnl Check for system openldap
9618 dnl ===================================================================
9620 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9621 AC_MSG_CHECKING([which openldap library to use])
9622 if test "$with_system_openldap" = "yes"; then
9623     AC_MSG_RESULT([external])
9624     SYSTEM_OPENLDAP=TRUE
9625     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9626     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9627     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9628 else
9629     AC_MSG_RESULT([internal])
9630     SYSTEM_OPENLDAP=
9631     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9634 AC_SUBST(SYSTEM_OPENLDAP)
9636 dnl ===================================================================
9637 dnl Check for system NSS
9638 dnl ===================================================================
9639 if test "$enable_fuzzers" != "yes"; then
9640     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9641     AC_DEFINE(HAVE_FEATURE_NSS)
9642     ENABLE_NSS="TRUE"
9643     AC_DEFINE(ENABLE_NSS)
9644 elif test $_os != iOS ; then
9645     with_tls=openssl
9647 AC_SUBST(ENABLE_NSS)
9649 dnl ===================================================================
9650 dnl Check for TLS/SSL and cryptographic implementation to use
9651 dnl ===================================================================
9652 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9653 if test -n "$with_tls"; then
9654     case $with_tls in
9655     openssl)
9656         AC_DEFINE(USE_TLS_OPENSSL)
9657         TLS=OPENSSL
9659         if test "$enable_openssl" != "yes"; then
9660             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9661         fi
9663         # warn that OpenSSL has been selected but not all TLS code has this option
9664         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9665         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9666         ;;
9667     nss)
9668         AC_DEFINE(USE_TLS_NSS)
9669         TLS=NSS
9670         ;;
9671     no)
9672         AC_MSG_WARN([Skipping TLS/SSL])
9673         ;;
9674     *)
9675         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9676 openssl - OpenSSL
9677 nss - Mozilla's Network Security Services (NSS)
9678     ])
9679         ;;
9680     esac
9681 else
9682     # default to using NSS, it results in smaller oox lib
9683     AC_DEFINE(USE_TLS_NSS)
9684     TLS=NSS
9686 AC_MSG_RESULT([$TLS])
9687 AC_SUBST(TLS)
9689 dnl ===================================================================
9690 dnl Check for system sane
9691 dnl ===================================================================
9692 AC_MSG_CHECKING([which sane header to use])
9693 if test "$with_system_sane" = "yes"; then
9694     AC_MSG_RESULT([external])
9695     AC_CHECK_HEADER(sane/sane.h, [],
9696       [AC_MSG_ERROR(sane not found. install sane)], [])
9697 else
9698     AC_MSG_RESULT([internal])
9699     BUILD_TYPE="$BUILD_TYPE SANE"
9702 dnl ===================================================================
9703 dnl Check for system icu
9704 dnl ===================================================================
9705 SYSTEM_GENBRK=
9706 SYSTEM_GENCCODE=
9707 SYSTEM_GENCMN=
9709 ICU_MAJOR=65
9710 ICU_MINOR=1
9711 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9712 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9713 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9714 AC_MSG_CHECKING([which icu to use])
9715 if test "$with_system_icu" = "yes"; then
9716     AC_MSG_RESULT([external])
9717     SYSTEM_ICU=TRUE
9718     AC_LANG_PUSH([C++])
9719     AC_MSG_CHECKING([for unicode/rbbi.h])
9720     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9721     AC_LANG_POP([C++])
9723     if test "$cross_compiling" != "yes"; then
9724         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9725         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9726         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9727         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9728     fi
9730     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9731         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9732         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9733         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9734         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9735         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9736             AC_MSG_RESULT([yes])
9737         else
9738             AC_MSG_RESULT([no])
9739             if test "$with_system_icu_for_build" != "force"; then
9740                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9741 You can use --with-system-icu-for-build=force to use it anyway.])
9742             fi
9743         fi
9744     fi
9746     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9747         # using the system icu tools can lead to version confusion, use the
9748         # ones from the build environment when cross-compiling
9749         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9750         if test -z "$SYSTEM_GENBRK"; then
9751             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9752         fi
9753         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9754         if test -z "$SYSTEM_GENCCODE"; then
9755             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9756         fi
9757         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9758         if test -z "$SYSTEM_GENCMN"; then
9759             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9760         fi
9761         if test "$ICU_MAJOR" -ge "49"; then
9762             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9763             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9764             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9765         else
9766             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9767             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9768             ICU_RECLASSIFIED_HEBREW_LETTER=
9769         fi
9770     fi
9772     if test "$cross_compiling" = "yes"; then
9773         if test "$ICU_MAJOR" -ge "50"; then
9774             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9775             ICU_MINOR=""
9776         fi
9777     fi
9778 else
9779     AC_MSG_RESULT([internal])
9780     SYSTEM_ICU=
9781     BUILD_TYPE="$BUILD_TYPE ICU"
9782     # surprisingly set these only for "internal" (to be used by various other
9783     # external libs): the system icu-config is quite unhelpful and spits out
9784     # dozens of weird flags and also default path -I/usr/include
9785     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9786     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9788 if test "$ICU_MAJOR" -ge "59"; then
9789     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9790     # with -std=c++11 but not all external libraries can be built with that,
9791     # for those use a bit-compatible typedef uint16_t UChar; see
9792     # icu/source/common/unicode/umachine.h
9793     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9794 else
9795     ICU_UCHAR_TYPE=""
9797 AC_SUBST(SYSTEM_ICU)
9798 AC_SUBST(SYSTEM_GENBRK)
9799 AC_SUBST(SYSTEM_GENCCODE)
9800 AC_SUBST(SYSTEM_GENCMN)
9801 AC_SUBST(ICU_MAJOR)
9802 AC_SUBST(ICU_MINOR)
9803 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9804 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9805 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9806 AC_SUBST(ICU_CFLAGS)
9807 AC_SUBST(ICU_LIBS)
9808 AC_SUBST(ICU_UCHAR_TYPE)
9810 dnl ==================================================================
9811 dnl Breakpad
9812 dnl ==================================================================
9813 DEFAULT_CRASHDUMP_VALUE="true"
9814 AC_MSG_CHECKING([whether to enable breakpad])
9815 if test "$enable_breakpad" != yes; then
9816     AC_MSG_RESULT([no])
9817 else
9818     AC_MSG_RESULT([yes])
9819     ENABLE_BREAKPAD="TRUE"
9820     AC_DEFINE(ENABLE_BREAKPAD)
9821     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9822     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9824     AC_MSG_CHECKING([for disable crash dump])
9825     if test "$enable_crashdump" = no; then
9826         DEFAULT_CRASHDUMP_VALUE="false"
9827         AC_MSG_RESULT([yes])
9828     else
9829        AC_MSG_RESULT([no])
9830     fi
9832     AC_MSG_CHECKING([for crashreport config])
9833     if test "$with_symbol_config" = "no"; then
9834         BREAKPAD_SYMBOL_CONFIG="invalid"
9835         AC_MSG_RESULT([no])
9836     else
9837         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9838         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9839         AC_MSG_RESULT([yes])
9840     fi
9841     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9843 AC_SUBST(ENABLE_BREAKPAD)
9844 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9846 dnl ==================================================================
9847 dnl libfuzzer
9848 dnl ==================================================================
9849 AC_MSG_CHECKING([whether to enable fuzzers])
9850 if test "$enable_fuzzers" != yes; then
9851     AC_MSG_RESULT([no])
9852 else
9853     AC_MSG_RESULT([yes])
9854     ENABLE_FUZZERS="TRUE"
9855     AC_DEFINE([ENABLE_FUZZERS],1)
9856     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9858 AC_SUBST(ENABLE_FUZZERS)
9860 dnl ===================================================================
9861 dnl Orcus
9862 dnl ===================================================================
9863 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9864 if test "$with_system_orcus" != "yes"; then
9865     if test "$SYSTEM_BOOST" = "TRUE"; then
9866         # ===========================================================
9867         # Determine if we are going to need to link with Boost.System
9868         # ===========================================================
9869         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9870         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9871         dnl in documentation has no effect.
9872         AC_MSG_CHECKING([if we need to link with Boost.System])
9873         AC_LANG_PUSH([C++])
9874         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9875                 @%:@include <boost/version.hpp>
9876             ]],[[
9877                 #if BOOST_VERSION >= 105000
9878                 #   error yes, we need to link with Boost.System
9879                 #endif
9880             ]])],[
9881                 AC_MSG_RESULT([no])
9882             ],[
9883                 AC_MSG_RESULT([yes])
9884                 AX_BOOST_SYSTEM
9885         ])
9886         AC_LANG_POP([C++])
9887     fi
9889 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9890 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9891 AC_SUBST([BOOST_SYSTEM_LIB])
9892 AC_SUBST(SYSTEM_LIBORCUS)
9894 dnl ===================================================================
9895 dnl HarfBuzz
9896 dnl ===================================================================
9897 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9898                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9899                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9901 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9902                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9903                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9905 if test "$COM" = "MSC"; then # override the above
9906     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9907     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9910 if test "$with_system_harfbuzz" = "yes"; then
9911     if test "$with_system_graphite" = "no"; then
9912         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9913     fi
9914     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9915     _save_libs="$LIBS"
9916     _save_cflags="$CFLAGS"
9917     LIBS="$LIBS $HARFBUZZ_LIBS"
9918     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9919     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9920     LIBS="$_save_libs"
9921     CFLAGS="$_save_cflags"
9922 else
9923     if test "$with_system_graphite" = "yes"; then
9924         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9925     fi
9928 AC_MSG_CHECKING([whether to use X11])
9929 dnl ***************************************
9930 dnl testing for X libraries and includes...
9931 dnl ***************************************
9932 if test "$USING_X11" = TRUE; then
9933     AC_DEFINE(HAVE_FEATURE_X11)
9935 AC_MSG_RESULT([$USING_X11])
9937 if test "$USING_X11" = TRUE; then
9938     AC_PATH_X
9939     AC_PATH_XTRA
9940     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9942     if test -z "$x_includes"; then
9943         x_includes="default_x_includes"
9944     fi
9945     if test -z "$x_libraries"; then
9946         x_libraries="default_x_libraries"
9947     fi
9948     CFLAGS="$CFLAGS $X_CFLAGS"
9949     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9950     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9951 else
9952     x_includes="no_x_includes"
9953     x_libraries="no_x_libraries"
9956 if test "$USING_X11" = TRUE; then
9957     dnl ===================================================================
9958     dnl Check for extension headers
9959     dnl ===================================================================
9960     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9961      [#include <X11/extensions/shape.h>])
9963     # vcl needs ICE and SM
9964     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9965     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9966         [AC_MSG_ERROR(ICE library not found)])
9967     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9968     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9969         [AC_MSG_ERROR(SM library not found)])
9972 dnl ===================================================================
9973 dnl Check for system Xrender
9974 dnl ===================================================================
9975 AC_MSG_CHECKING([whether to use Xrender])
9976 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9977     AC_MSG_RESULT([yes])
9978     PKG_CHECK_MODULES(XRENDER, xrender)
9979     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9980     FilterLibs "${XRENDER_LIBS}"
9981     XRENDER_LIBS="${filteredlibs}"
9982     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9983       [AC_MSG_ERROR(libXrender not found or functional)], [])
9984     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9985       [AC_MSG_ERROR(Xrender not found. install X)], [])
9986 else
9987     AC_MSG_RESULT([no])
9989 AC_SUBST(XRENDER_CFLAGS)
9990 AC_SUBST(XRENDER_LIBS)
9992 dnl ===================================================================
9993 dnl Check for XRandr
9994 dnl ===================================================================
9995 AC_MSG_CHECKING([whether to enable RandR support])
9996 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9997     AC_MSG_RESULT([yes])
9998     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9999     if test "$ENABLE_RANDR" != "TRUE"; then
10000         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10001                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10002         XRANDR_CFLAGS=" "
10003         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10004           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10005         XRANDR_LIBS="-lXrandr "
10006         ENABLE_RANDR="TRUE"
10007     fi
10008     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10009     FilterLibs "${XRANDR_LIBS}"
10010     XRANDR_LIBS="${filteredlibs}"
10011 else
10012     ENABLE_RANDR=""
10013     AC_MSG_RESULT([no])
10015 AC_SUBST(XRANDR_CFLAGS)
10016 AC_SUBST(XRANDR_LIBS)
10017 AC_SUBST(ENABLE_RANDR)
10019 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10020     if test -z "$WITH_WEBDAV"; then
10021         WITH_WEBDAV="serf"
10022     fi
10024 if test $_os = iOS -o $_os = Android; then
10025     WITH_WEBDAV="no"
10027 AC_MSG_CHECKING([for webdav library])
10028 case "$WITH_WEBDAV" in
10029 serf)
10030     AC_MSG_RESULT([serf])
10031     # Check for system apr-util
10032     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10033                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10034                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10035     if test "$COM" = "MSC"; then
10036         APR_LIB_DIR="LibR"
10037         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10038         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10039     fi
10041     # Check for system serf
10042     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10043     ;;
10044 neon)
10045     AC_MSG_RESULT([neon])
10046     # Check for system neon
10047     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
10048     if test "$with_system_neon" = "yes"; then
10049         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10050     else
10051         NEON_VERSION=0295
10052     fi
10053     AC_SUBST(NEON_VERSION)
10054     ;;
10056     AC_MSG_RESULT([none, disabled])
10057     WITH_WEBDAV=""
10058     ;;
10059 esac
10060 AC_SUBST(WITH_WEBDAV)
10062 dnl ===================================================================
10063 dnl Check for disabling cve_tests
10064 dnl ===================================================================
10065 AC_MSG_CHECKING([whether to execute CVE tests])
10066 # If not explicitly enabled or disabled, default
10067 if test -z "$enable_cve_tests"; then
10068     case "$OS" in
10069     WNT)
10070         # Default cves off for Windows with its wild and wonderful
10071         # variety of AV software kicking in and panicking
10072         enable_cve_tests=no
10073         ;;
10074     *)
10075         # otherwise yes
10076         enable_cve_tests=yes
10077         ;;
10078     esac
10080 if test "$enable_cve_tests" = "no"; then
10081     AC_MSG_RESULT([no])
10082     DISABLE_CVE_TESTS=TRUE
10083     AC_SUBST(DISABLE_CVE_TESTS)
10084 else
10085     AC_MSG_RESULT([yes])
10088 dnl ===================================================================
10089 dnl Check for enabling chart XShape tests
10090 dnl ===================================================================
10091 AC_MSG_CHECKING([whether to execute chart XShape tests])
10092 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10093     AC_MSG_RESULT([yes])
10094     ENABLE_CHART_TESTS=TRUE
10095     AC_SUBST(ENABLE_CHART_TESTS)
10096 else
10097     AC_MSG_RESULT([no])
10100 dnl ===================================================================
10101 dnl Check for system openssl
10102 dnl ===================================================================
10103 DISABLE_OPENSSL=
10104 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10105 if test "$enable_openssl" = "yes"; then
10106     AC_MSG_RESULT([no])
10107     if test "$_os" = Darwin ; then
10108         # OpenSSL is deprecated when building for 10.7 or later.
10109         #
10110         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10111         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10113         with_system_openssl=no
10114         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10115     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10116             && test "$with_system_openssl" != "no"; then
10117         with_system_openssl=yes
10118         SYSTEM_OPENSSL=TRUE
10119         OPENSSL_CFLAGS=
10120         OPENSSL_LIBS="-lssl -lcrypto"
10121     else
10122         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10123     fi
10124     if test "$with_system_openssl" = "yes"; then
10125         AC_MSG_CHECKING([whether openssl supports SHA512])
10126         AC_LANG_PUSH([C])
10127         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10128             SHA512_CTX context;
10129 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10130         AC_LANG_POP(C)
10131     fi
10132 else
10133     AC_MSG_RESULT([yes])
10134     DISABLE_OPENSSL=TRUE
10136     # warn that although OpenSSL is disabled, system libraries may depend on it
10137     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10138     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10141 AC_SUBST([DISABLE_OPENSSL])
10143 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10144     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10145         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10146         enable_cipher_openssl_backend=no
10147     else
10148         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10149     fi
10151 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10152 ENABLE_CIPHER_OPENSSL_BACKEND=
10153 if test "$enable_cipher_openssl_backend" = yes; then
10154     AC_MSG_RESULT([yes])
10155     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10156 else
10157     AC_MSG_RESULT([no])
10159 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10161 dnl ===================================================================
10162 dnl Check for building gnutls
10163 dnl ===================================================================
10164 AC_MSG_CHECKING([whether to use gnutls])
10165 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10166     AC_MSG_RESULT([yes])
10167     AM_PATH_LIBGCRYPT()
10168     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10169         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10170                       available in the system to use as replacement.]]))
10171     FilterLibs "${LIBGCRYPT_LIBS}"
10172     LIBGCRYPT_LIBS="${filteredlibs}"
10173 else
10174     AC_MSG_RESULT([no])
10177 AC_SUBST([LIBGCRYPT_CFLAGS])
10178 AC_SUBST([LIBGCRYPT_LIBS])
10180 dnl ===================================================================
10181 dnl Check for system redland
10182 dnl ===================================================================
10183 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10184 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10185 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10186 if test "$with_system_redland" = "yes"; then
10187     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10188             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10189 else
10190     RAPTOR_MAJOR="0"
10191     RASQAL_MAJOR="3"
10192     REDLAND_MAJOR="0"
10194 AC_SUBST(RAPTOR_MAJOR)
10195 AC_SUBST(RASQAL_MAJOR)
10196 AC_SUBST(REDLAND_MAJOR)
10198 dnl ===================================================================
10199 dnl Check for system hunspell
10200 dnl ===================================================================
10201 AC_MSG_CHECKING([which libhunspell to use])
10202 if test "$with_system_hunspell" = "yes"; then
10203     AC_MSG_RESULT([external])
10204     SYSTEM_HUNSPELL=TRUE
10205     AC_LANG_PUSH([C++])
10206     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10207     if test "$HUNSPELL_PC" != "TRUE"; then
10208         AC_CHECK_HEADER(hunspell.hxx, [],
10209             [
10210             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10211             [AC_MSG_ERROR(hunspell headers not found.)], [])
10212             ], [])
10213         AC_CHECK_LIB([hunspell], [main], [:],
10214            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10215         HUNSPELL_LIBS=-lhunspell
10216     fi
10217     AC_LANG_POP([C++])
10218     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10219     FilterLibs "${HUNSPELL_LIBS}"
10220     HUNSPELL_LIBS="${filteredlibs}"
10221 else
10222     AC_MSG_RESULT([internal])
10223     SYSTEM_HUNSPELL=
10224     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10225     if test "$COM" = "MSC"; then
10226         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10227     else
10228         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10229     fi
10230     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10232 AC_SUBST(SYSTEM_HUNSPELL)
10233 AC_SUBST(HUNSPELL_CFLAGS)
10234 AC_SUBST(HUNSPELL_LIBS)
10236 dnl ===================================================================
10237 dnl Check for system qrcodegen
10238 dnl ===================================================================
10239 AC_MSG_CHECKING([whether to use libqrcodegen])
10240 if test "$enable_qrcodegen" = "no"; then
10241     AC_MSG_RESULT([no])
10242     ENABLE_QRCODEGEN=
10243     SYSTEM_QRCODEGEN=
10244 else
10245     AC_MSG_RESULT([yes])
10246     ENABLE_QRCODEGEN=TRUE
10247     AC_MSG_CHECKING([which libqrcodegen to use])
10248     if test "$with_system_qrcodegen" = "yes"; then
10249         AC_MSG_RESULT([external])
10250         SYSTEM_QRCODEGEN=TRUE
10251         AC_LANG_PUSH([C++])
10252         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10253             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10254         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10255             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10256         QRCODEGEN_LIBS=-lqrcodegencpp
10257         AC_LANG_POP([C++])
10258         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10259         FilterLibs "${QRCODEGEN_LIBS}"
10260         QRCODEGEN_LIBS="${filteredlibs}"
10261     else
10262         AC_MSG_RESULT([internal])
10263         SYSTEM_QRCODEGEN=
10264         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10265     fi
10266     if test "$ENABLE_QRCODEGEN" = TRUE; then
10267         AC_DEFINE(ENABLE_QRCODEGEN)
10268     fi
10270 AC_SUBST(SYSTEM_QRCODEGEN)
10271 AC_SUBST(ENABLE_QRCODEGEN)
10272 AC_SUBST(QRCODEGEN_CFLAGS)
10273 AC_SUBST(QRCODEGEN_LIBS)
10275 dnl ===================================================================
10276 dnl Checking for altlinuxhyph
10277 dnl ===================================================================
10278 AC_MSG_CHECKING([which altlinuxhyph to use])
10279 if test "$with_system_altlinuxhyph" = "yes"; then
10280     AC_MSG_RESULT([external])
10281     SYSTEM_HYPH=TRUE
10282     AC_CHECK_HEADER(hyphen.h, [],
10283        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10284     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10285        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10286        [#include <hyphen.h>])
10287     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10288         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10289     if test -z "$HYPHEN_LIB"; then
10290         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10291            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10292     fi
10293     if test -z "$HYPHEN_LIB"; then
10294         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10295            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10296     fi
10297 else
10298     AC_MSG_RESULT([internal])
10299     SYSTEM_HYPH=
10300     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10301     if test "$COM" = "MSC"; then
10302         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10303     else
10304         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10305     fi
10307 AC_SUBST(SYSTEM_HYPH)
10308 AC_SUBST(HYPHEN_LIB)
10310 dnl ===================================================================
10311 dnl Checking for mythes
10312 dnl ===================================================================
10313 AC_MSG_CHECKING([which mythes to use])
10314 if test "$with_system_mythes" = "yes"; then
10315     AC_MSG_RESULT([external])
10316     SYSTEM_MYTHES=TRUE
10317     AC_LANG_PUSH([C++])
10318     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10319     if test "$MYTHES_PKGCONFIG" = "no"; then
10320         AC_CHECK_HEADER(mythes.hxx, [],
10321             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10322         AC_CHECK_LIB([mythes-1.2], [main], [:],
10323             [ MYTHES_FOUND=no], [])
10324     if test "$MYTHES_FOUND" = "no"; then
10325         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10326                 [ MYTHES_FOUND=no], [])
10327     fi
10328     if test "$MYTHES_FOUND" = "no"; then
10329         AC_MSG_ERROR([mythes library not found!.])
10330     fi
10331     fi
10332     AC_LANG_POP([C++])
10333     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10334     FilterLibs "${MYTHES_LIBS}"
10335     MYTHES_LIBS="${filteredlibs}"
10336 else
10337     AC_MSG_RESULT([internal])
10338     SYSTEM_MYTHES=
10339     BUILD_TYPE="$BUILD_TYPE MYTHES"
10340     if test "$COM" = "MSC"; then
10341         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10342     else
10343         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10344     fi
10346 AC_SUBST(SYSTEM_MYTHES)
10347 AC_SUBST(MYTHES_CFLAGS)
10348 AC_SUBST(MYTHES_LIBS)
10350 dnl ===================================================================
10351 dnl How should we build the linear programming solver ?
10352 dnl ===================================================================
10354 ENABLE_COINMP=
10355 AC_MSG_CHECKING([whether to build with CoinMP])
10356 if test "$enable_coinmp" != "no"; then
10357     ENABLE_COINMP=TRUE
10358     AC_MSG_RESULT([yes])
10359     if test "$with_system_coinmp" = "yes"; then
10360         SYSTEM_COINMP=TRUE
10361         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10362         FilterLibs "${COINMP_LIBS}"
10363         COINMP_LIBS="${filteredlibs}"
10364     else
10365         BUILD_TYPE="$BUILD_TYPE COINMP"
10366     fi
10367 else
10368     AC_MSG_RESULT([no])
10370 AC_SUBST(ENABLE_COINMP)
10371 AC_SUBST(SYSTEM_COINMP)
10372 AC_SUBST(COINMP_CFLAGS)
10373 AC_SUBST(COINMP_LIBS)
10375 ENABLE_LPSOLVE=
10376 AC_MSG_CHECKING([whether to build with lpsolve])
10377 if test "$enable_lpsolve" != "no"; then
10378     ENABLE_LPSOLVE=TRUE
10379     AC_MSG_RESULT([yes])
10380 else
10381     AC_MSG_RESULT([no])
10383 AC_SUBST(ENABLE_LPSOLVE)
10385 if test "$ENABLE_LPSOLVE" = TRUE; then
10386     AC_MSG_CHECKING([which lpsolve to use])
10387     if test "$with_system_lpsolve" = "yes"; then
10388         AC_MSG_RESULT([external])
10389         SYSTEM_LPSOLVE=TRUE
10390         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10391            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10392         save_LIBS=$LIBS
10393         # some systems need this. Like Ubuntu...
10394         AC_CHECK_LIB(m, floor)
10395         AC_CHECK_LIB(dl, dlopen)
10396         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10397             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10398         LIBS=$save_LIBS
10399     else
10400         AC_MSG_RESULT([internal])
10401         SYSTEM_LPSOLVE=
10402         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10403     fi
10405 AC_SUBST(SYSTEM_LPSOLVE)
10407 dnl ===================================================================
10408 dnl Checking for libexttextcat
10409 dnl ===================================================================
10410 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10411 if test "$with_system_libexttextcat" = "yes"; then
10412     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10414 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10416 dnl ===================================================================
10417 dnl Checking for libnumbertext
10418 dnl ===================================================================
10419 AC_MSG_CHECKING([whether to use libnumbertext])
10420 if test "$enable_libnumbertext" = "no"; then
10421     AC_MSG_RESULT([no])
10422     ENABLE_LIBNUMBERTEXT=
10423     SYSTEM_LIBNUMBERTEXT=
10424 else
10425     AC_MSG_RESULT([yes])
10426     ENABLE_LIBNUMBERTEXT=TRUE
10427     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10428     if test "$with_system_libnumbertext" = "yes"; then
10429         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10430         SYSTEM_LIBNUMBERTEXT=YES
10431     else
10432         SYSTEM_LIBNUMBERTEXT=
10433         AC_LANG_PUSH([C++])
10434         save_CPPFLAGS=$CPPFLAGS
10435         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10436         AC_CHECK_HEADERS([codecvt regex])
10437         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10438                 [ ENABLE_LIBNUMBERTEXT=''
10439                   LIBNUMBERTEXT_CFLAGS=''
10440                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10441                                Enable libnumbertext fallback (missing number to number name conversion).])
10442                 ])
10443         CPPFLAGS=$save_CPPFLAGS
10444         AC_LANG_POP([C++])
10445     fi
10446     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10447         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10448     fi
10450 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10451 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10452 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10453 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10455 dnl ***************************************
10456 dnl testing libc version for Linux...
10457 dnl ***************************************
10458 if test "$_os" = "Linux"; then
10459     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10460     exec 6>/dev/null # no output
10461     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10462     exec 6>&1 # output on again
10463     if test "$HAVE_LIBC"; then
10464         AC_MSG_RESULT([yes])
10465     else
10466         AC_MSG_ERROR([no, upgrade libc])
10467     fi
10470 dnl =========================================
10471 dnl Check for uuidgen
10472 dnl =========================================
10473 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10474     # presence is already tested above in the WINDOWS_SDK_HOME check
10475     UUIDGEN=uuidgen.exe
10476     AC_SUBST(UUIDGEN)
10477 else
10478     AC_PATH_PROG([UUIDGEN], [uuidgen])
10479     if test -z "$UUIDGEN"; then
10480         AC_MSG_WARN([uuid is needed for building installation sets])
10481     fi
10484 dnl ***************************************
10485 dnl Checking for bison and flex
10486 dnl ***************************************
10487 AC_PATH_PROG(BISON, bison)
10488 if test -z "$BISON"; then
10489     AC_MSG_ERROR([no bison found in \$PATH, install it])
10490 else
10491     AC_MSG_CHECKING([the bison version])
10492     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10493     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10494     # Accept newer than 2.0
10495     if test "$_bison_longver" -lt 2000; then
10496         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10497     fi
10500 AC_PATH_PROG(FLEX, flex)
10501 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10502     FLEX=`cygpath -m $FLEX`
10504 if test -z "$FLEX"; then
10505     AC_MSG_ERROR([no flex found in \$PATH, install it])
10506 else
10507     AC_MSG_CHECKING([the flex version])
10508     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10509     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10510         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10511     fi
10513 AC_SUBST([FLEX])
10514 dnl ***************************************
10515 dnl Checking for patch
10516 dnl ***************************************
10517 AC_PATH_PROG(PATCH, patch)
10518 if test -z "$PATCH"; then
10519     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10522 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10523 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10524     if test -z "$with_gnu_patch"; then
10525         GNUPATCH=$PATCH
10526     else
10527         if test -x "$with_gnu_patch"; then
10528             GNUPATCH=$with_gnu_patch
10529         else
10530             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10531         fi
10532     fi
10534     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10535     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10536         AC_MSG_RESULT([yes])
10537     else
10538         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10539     fi
10540 else
10541     GNUPATCH=$PATCH
10544 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10545     GNUPATCH=`cygpath -m $GNUPATCH`
10548 dnl We also need to check for --with-gnu-cp
10550 if test -z "$with_gnu_cp"; then
10551     # check the place where the good stuff is hidden on Solaris...
10552     if test -x /usr/gnu/bin/cp; then
10553         GNUCP=/usr/gnu/bin/cp
10554     else
10555         AC_PATH_PROGS(GNUCP, gnucp cp)
10556     fi
10557     if test -z $GNUCP; then
10558         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10559     fi
10560 else
10561     if test -x "$with_gnu_cp"; then
10562         GNUCP=$with_gnu_cp
10563     else
10564         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10565     fi
10568 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10569     GNUCP=`cygpath -m $GNUCP`
10572 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10573 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10574     AC_MSG_RESULT([yes])
10575 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10576     AC_MSG_RESULT([yes])
10577 else
10578     case "$build_os" in
10579     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10580         x_GNUCP=[\#]
10581         GNUCP=''
10582         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10583         ;;
10584     *)
10585         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10586         ;;
10587     esac
10590 AC_SUBST(GNUPATCH)
10591 AC_SUBST(GNUCP)
10592 AC_SUBST(x_GNUCP)
10594 dnl ***************************************
10595 dnl testing assembler path
10596 dnl ***************************************
10597 ML_EXE=""
10598 if test "$_os" = "WINNT"; then
10599     if test "$BITNESS_OVERRIDE" = ""; then
10600         assembler=ml.exe
10601     else
10602         assembler=ml64.exe
10603     fi
10605     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10606     if test -f "$CL_PATH/$assembler"; then
10607         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10608         AC_MSG_RESULT([$ML_EXE])
10609     else
10610         AC_MSG_ERROR([not found])
10611     fi
10614 AC_SUBST(ML_EXE)
10616 dnl ===================================================================
10617 dnl We need zip and unzip
10618 dnl ===================================================================
10619 AC_PATH_PROG(ZIP, zip)
10620 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10621 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10622     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],,)
10625 AC_PATH_PROG(UNZIP, unzip)
10626 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10628 dnl ===================================================================
10629 dnl Zip must be a specific type for different build types.
10630 dnl ===================================================================
10631 if test $build_os = cygwin; then
10632     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10633         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10634     fi
10637 dnl ===================================================================
10638 dnl We need touch with -h option support.
10639 dnl ===================================================================
10640 AC_PATH_PROG(TOUCH, touch)
10641 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10642 touch warn
10643 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10644     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],,)
10647 dnl ===================================================================
10648 dnl Check for system epoxy
10649 dnl ===================================================================
10650 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10652 dnl ===================================================================
10653 dnl Set vcl option: coordinate device in double or sal_Int32
10654 dnl ===================================================================
10656 dnl disabled for now, we don't want subtle differences between OSs
10657 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10658 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10659 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10660 dnl     AC_MSG_RESULT([double])
10661 dnl else
10662 dnl     AC_MSG_RESULT([sal_Int32])
10663 dnl fi
10665 dnl ===================================================================
10666 dnl Test which vclplugs have to be built.
10667 dnl ===================================================================
10668 R=""
10669 if test "$USING_X11" != TRUE; then
10670     enable_gtk3=no
10672 GTK3_CFLAGS=""
10673 GTK3_LIBS=""
10674 ENABLE_GTK3=""
10675 if test "x$enable_gtk3" = "xyes"; then
10676     if test "$with_system_cairo" = no; then
10677         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10678     fi
10679     : ${with_system_cairo:=yes}
10680     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="")
10681     if test "x$ENABLE_GTK3" = "xTRUE"; then
10682         AC_DEFINE(ENABLE_GTK3)
10683         R="gtk3"
10684     else
10685         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10686     fi
10687     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10688     FilterLibs "${GTK3_LIBS}"
10689     GTK3_LIBS="${filteredlibs}"
10691     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10692     if test "$with_system_epoxy" != "yes"; then
10693         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10694         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10695                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10696     fi
10698 AC_SUBST(GTK3_LIBS)
10699 AC_SUBST(GTK3_CFLAGS)
10700 AC_SUBST(ENABLE_GTK3)
10702 if test "$enable_introspection" = yes; then
10703     if test "$ENABLE_GTK3" = TRUE; then
10704         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10705     else
10706         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10707     fi
10710 ENABLE_QT5=""
10711 if test "x$enable_qt5" = "xyes"; then
10712     ENABLE_QT5="TRUE"
10713     AC_DEFINE(ENABLE_QT5)
10714     R="$R qt5"
10716 AC_SUBST(ENABLE_QT5)
10718 ENABLE_KF5=""
10719 if test "x$enable_kf5" = "xyes"; then
10720     ENABLE_KF5="TRUE"
10721     AC_DEFINE(ENABLE_KF5)
10722     R="$R kf5"
10724 AC_SUBST(ENABLE_KF5)
10726 ENABLE_GTK3_KDE5=""
10727 if test "x$enable_gtk3_kde5" = "xyes"; then
10728     ENABLE_GTK3_KDE5="TRUE"
10729     AC_DEFINE(ENABLE_GTK3_KDE5)
10730     R="$R gtk3_kde5"
10732 AC_SUBST(ENABLE_GTK3_KDE5)
10734 if test "$_os" = "WINNT"; then
10735     R="$R win"
10736 elif test "$_os" = "Darwin"; then
10737     R="$R osx"
10738 elif test "$_os" = "iOS"; then
10739     R="ios (builtin)"
10742 build_vcl_plugins="$R"
10743 if test -z "$build_vcl_plugins"; then
10744     build_vcl_plugins="none"
10746 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10748 dnl ===================================================================
10749 dnl check for dbus support
10750 dnl ===================================================================
10751 ENABLE_DBUS=""
10752 DBUS_CFLAGS=""
10753 DBUS_LIBS=""
10754 DBUS_GLIB_CFLAGS=""
10755 DBUS_GLIB_LIBS=""
10756 DBUS_HAVE_GLIB=""
10758 if test "$enable_dbus" = "no"; then
10759     test_dbus=no
10762 AC_MSG_CHECKING([whether to enable DBUS support])
10763 if test "$test_dbus" = "yes"; then
10764     ENABLE_DBUS="TRUE"
10765     AC_MSG_RESULT([yes])
10766     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10767     AC_DEFINE(ENABLE_DBUS)
10768     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10769     FilterLibs "${DBUS_LIBS}"
10770     DBUS_LIBS="${filteredlibs}"
10772     # Glib is needed for BluetoothServer
10773     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10774     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10775         [
10776             DBUS_HAVE_GLIB="TRUE"
10777             AC_DEFINE(DBUS_HAVE_GLIB,1)
10778         ],
10779         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10780     )
10781 else
10782     AC_MSG_RESULT([no])
10785 AC_SUBST(ENABLE_DBUS)
10786 AC_SUBST(DBUS_CFLAGS)
10787 AC_SUBST(DBUS_LIBS)
10788 AC_SUBST(DBUS_GLIB_CFLAGS)
10789 AC_SUBST(DBUS_GLIB_LIBS)
10790 AC_SUBST(DBUS_HAVE_GLIB)
10792 AC_MSG_CHECKING([whether to enable Impress remote control])
10793 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10794     AC_MSG_RESULT([yes])
10795     ENABLE_SDREMOTE=TRUE
10796     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10798     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10799         # The Bluetooth code doesn't compile with macOS SDK 10.15
10800         enable_sdremote_bluetooth=no
10801     fi
10802     # If not explicitly enabled or disabled, default
10803     if test -z "$enable_sdremote_bluetooth"; then
10804         case "$OS" in
10805         LINUX|MACOSX|WNT)
10806             # Default to yes for these
10807             enable_sdremote_bluetooth=yes
10808             ;;
10809         *)
10810             # otherwise no
10811             enable_sdremote_bluetooth=no
10812             ;;
10813         esac
10814     fi
10815     # $enable_sdremote_bluetooth is guaranteed non-empty now
10817     if test "$enable_sdremote_bluetooth" != "no"; then
10818         if test "$OS" = "LINUX"; then
10819             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10820                 AC_MSG_RESULT([yes])
10821                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10822                 dnl ===================================================================
10823                 dnl Check for system bluez
10824                 dnl ===================================================================
10825                 AC_MSG_CHECKING([which Bluetooth header to use])
10826                 if test "$with_system_bluez" = "yes"; then
10827                     AC_MSG_RESULT([external])
10828                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10829                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10830                     SYSTEM_BLUEZ=TRUE
10831                 else
10832                     AC_MSG_RESULT([internal])
10833                     SYSTEM_BLUEZ=
10834                 fi
10835             else
10836                 AC_MSG_RESULT([no, dbus disabled])
10837                 ENABLE_SDREMOTE_BLUETOOTH=
10838                 SYSTEM_BLUEZ=
10839             fi
10840         else
10841             AC_MSG_RESULT([yes])
10842             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10843             SYSTEM_BLUEZ=
10844         fi
10845     else
10846         AC_MSG_RESULT([no])
10847         ENABLE_SDREMOTE_BLUETOOTH=
10848         SYSTEM_BLUEZ=
10849     fi
10850 else
10851     ENABLE_SDREMOTE=
10852     SYSTEM_BLUEZ=
10853     AC_MSG_RESULT([no])
10855 AC_SUBST(ENABLE_SDREMOTE)
10856 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10857 AC_SUBST(SYSTEM_BLUEZ)
10859 dnl ===================================================================
10860 dnl Check whether to enable GIO support
10861 dnl ===================================================================
10862 if test "$ENABLE_GTK3" = "TRUE"; then
10863     AC_MSG_CHECKING([whether to enable GIO support])
10864     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10865         dnl Need at least 2.26 for the dbus support.
10866         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10867                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10868         if test "$ENABLE_GIO" = "TRUE"; then
10869             AC_DEFINE(ENABLE_GIO)
10870             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10871             FilterLibs "${GIO_LIBS}"
10872             GIO_LIBS="${filteredlibs}"
10873         fi
10874     else
10875         AC_MSG_RESULT([no])
10876     fi
10878 AC_SUBST(ENABLE_GIO)
10879 AC_SUBST(GIO_CFLAGS)
10880 AC_SUBST(GIO_LIBS)
10883 dnl ===================================================================
10885 SPLIT_APP_MODULES=""
10886 if test "$enable_split_app_modules" = "yes"; then
10887     SPLIT_APP_MODULES="TRUE"
10889 AC_SUBST(SPLIT_APP_MODULES)
10891 SPLIT_OPT_FEATURES=""
10892 if test "$enable_split_opt_features" = "yes"; then
10893     SPLIT_OPT_FEATURES="TRUE"
10895 AC_SUBST(SPLIT_OPT_FEATURES)
10897 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10898     if test "$enable_cairo_canvas" = yes; then
10899         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10900     fi
10901     enable_cairo_canvas=no
10902 elif test -z "$enable_cairo_canvas"; then
10903     enable_cairo_canvas=yes
10906 ENABLE_CAIRO_CANVAS=""
10907 if test "$enable_cairo_canvas" = "yes"; then
10908     test_cairo=yes
10909     ENABLE_CAIRO_CANVAS="TRUE"
10910     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10912 AC_SUBST(ENABLE_CAIRO_CANVAS)
10914 dnl ===================================================================
10915 dnl Check whether the GStreamer libraries are available.
10916 dnl ===================================================================
10918 ENABLE_GSTREAMER_1_0=""
10920 if test "$build_gstreamer_1_0" = "yes"; then
10922     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10923     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10924         ENABLE_GSTREAMER_1_0="TRUE"
10925         AC_MSG_RESULT([yes])
10926         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10927         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10928         FilterLibs "${GSTREAMER_1_0_LIBS}"
10929         GSTREAMER_1_0_LIBS="${filteredlibs}"
10930         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10931     else
10932         AC_MSG_RESULT([no])
10933     fi
10935 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10936 AC_SUBST(GSTREAMER_1_0_LIBS)
10937 AC_SUBST(ENABLE_GSTREAMER_1_0)
10939 dnl ===================================================================
10940 dnl Check whether to build the VLC avmedia backend
10941 dnl ===================================================================
10943 ENABLE_VLC=""
10945 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10946 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10947     ENABLE_VLC="TRUE"
10948     AC_MSG_RESULT([yes])
10949 else
10950     AC_MSG_RESULT([no])
10952 AC_SUBST(ENABLE_VLC)
10954 ENABLE_OPENGL_TRANSITIONS=
10955 ENABLE_OPENGL_CANVAS=
10956 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10957    : # disable
10958 elif test "$_os" = "Darwin"; then
10959     # We use frameworks on macOS, no need for detail checks
10960     ENABLE_OPENGL_TRANSITIONS=TRUE
10961     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10962     ENABLE_OPENGL_CANVAS=TRUE
10963 elif test $_os = WINNT; then
10964     ENABLE_OPENGL_TRANSITIONS=TRUE
10965     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10966     ENABLE_OPENGL_CANVAS=TRUE
10967 else
10968     if test "$USING_X11" = TRUE; then
10969         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10970         ENABLE_OPENGL_TRANSITIONS=TRUE
10971         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10972         ENABLE_OPENGL_CANVAS=TRUE
10973     fi
10976 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10977 AC_SUBST(ENABLE_OPENGL_CANVAS)
10979 dnl =================================================
10980 dnl Check whether to build with OpenCL support.
10981 dnl =================================================
10983 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10984     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10985     # platform (optional at run-time, used through clew).
10986     BUILD_TYPE="$BUILD_TYPE OPENCL"
10987     AC_DEFINE(HAVE_FEATURE_OPENCL)
10990 dnl =================================================
10991 dnl Check whether to build with dconf support.
10992 dnl =================================================
10994 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10995     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10996         if test "$enable_dconf" = yes; then
10997             AC_MSG_ERROR([dconf not found])
10998         else
10999             enable_dconf=no
11000         fi])
11002 AC_MSG_CHECKING([whether to enable dconf])
11003 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11004     DCONF_CFLAGS=
11005     DCONF_LIBS=
11006     ENABLE_DCONF=
11007     AC_MSG_RESULT([no])
11008 else
11009     ENABLE_DCONF=TRUE
11010     AC_DEFINE(ENABLE_DCONF)
11011     AC_MSG_RESULT([yes])
11013 AC_SUBST([DCONF_CFLAGS])
11014 AC_SUBST([DCONF_LIBS])
11015 AC_SUBST([ENABLE_DCONF])
11017 # pdf import?
11018 AC_MSG_CHECKING([whether to build the PDF import feature])
11019 ENABLE_PDFIMPORT=
11020 if test \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
11021     AC_MSG_RESULT([yes])
11022     ENABLE_PDFIMPORT=TRUE
11023     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11024 else
11025     AC_MSG_RESULT([no])
11028 # Pdfium?
11029 AC_MSG_CHECKING([whether to build PDFium])
11030 ENABLE_PDFIUM=
11031 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11032     AC_MSG_RESULT([yes])
11033     ENABLE_PDFIUM=TRUE
11034     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11035     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11036 else
11037     AC_MSG_RESULT([no])
11039 AC_SUBST(ENABLE_PDFIUM)
11041 dnl ===================================================================
11042 dnl Check for poppler
11043 dnl ===================================================================
11044 ENABLE_POPPLER=
11045 AC_MSG_CHECKING([whether to build Poppler])
11046 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
11047     AC_MSG_RESULT([yes])
11048     ENABLE_POPPLER=TRUE
11049     AC_DEFINE(HAVE_FEATURE_POPPLER)
11050 else
11051     AC_MSG_RESULT([no])
11053 AC_SUBST(ENABLE_POPPLER)
11055 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11056     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11059 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11060     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11063 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11064     dnl ===================================================================
11065     dnl Check for system poppler
11066     dnl ===================================================================
11067     AC_MSG_CHECKING([which PDF import poppler to use])
11068     if test "$with_system_poppler" = "yes"; then
11069         AC_MSG_RESULT([external])
11070         SYSTEM_POPPLER=TRUE
11071         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11072         AC_LANG_PUSH([C++])
11073         save_CXXFLAGS=$CXXFLAGS
11074         save_CPPFLAGS=$CPPFLAGS
11075         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11076         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11077         AC_CHECK_HEADER([cpp/poppler-version.h],
11078             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11079             [])
11080         CXXFLAGS=$save_CXXFLAGS
11081         CPPFLAGS=$save_CPPFLAGS
11082         AC_LANG_POP([C++])
11083         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11085         FilterLibs "${POPPLER_LIBS}"
11086         POPPLER_LIBS="${filteredlibs}"
11087     else
11088         AC_MSG_RESULT([internal])
11089         SYSTEM_POPPLER=
11090         BUILD_TYPE="$BUILD_TYPE POPPLER"
11091         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11092     fi
11093     AC_DEFINE([ENABLE_PDFIMPORT],1)
11095 AC_SUBST(ENABLE_PDFIMPORT)
11096 AC_SUBST(SYSTEM_POPPLER)
11097 AC_SUBST(POPPLER_CFLAGS)
11098 AC_SUBST(POPPLER_LIBS)
11100 SYSTEM_GPGMEPP=
11102 if test "$build_for_ios" = "YES"; then
11103     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
11104     AC_MSG_RESULT([yes])
11105 elif test "$enable_mpl_subset" = "yes"; then
11106     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
11107     AC_MSG_RESULT([yes])
11108 elif test "$enable_fuzzers" = "yes"; then
11109     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
11110     AC_MSG_RESULT([yes])
11111 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
11112     dnl ===================================================================
11113     dnl Check for system gpgme
11114     dnl ===================================================================
11115     AC_MSG_CHECKING([which gpgmepp to use])
11116     if test "$with_system_gpgmepp" = "yes"; then
11117         AC_MSG_RESULT([external])
11118         SYSTEM_GPGMEPP=TRUE
11120         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
11121         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
11122             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
11123         # progress_callback is the only func with plain C linkage
11124         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11125         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11126             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11127         AC_CHECK_HEADER(gpgme.h, [],
11128             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11129     else
11130         AC_MSG_RESULT([internal])
11131         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11132         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11134         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11135         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11136         if test "$_os" != "WINNT"; then
11137             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11138             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11139         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11140             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11141         fi
11142     fi
11143     ENABLE_GPGMEPP=TRUE
11144     AC_DEFINE([HAVE_FEATURE_GPGME])
11145     AC_PATH_PROG(GPG, gpg)
11146     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11147     # so let's exclude that manually for the moment
11148     if test -n "$GPG" -a "$_os" != "WINNT"; then
11149         # make sure we not only have a working gpgme, but a full working
11150         # gpg installation to run OpenPGP signature verification
11151         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11152     fi
11153     if test "$_os" = "Linux"; then
11154       uid=`id -u`
11155       AC_MSG_CHECKING([for /run/user/$uid])
11156       if test -d /run/user/$uid; then
11157         AC_MSG_RESULT([yes])
11158         AC_PATH_PROG(GPGCONF, gpgconf)
11160         # Older versions of gpgconf are not working as expected, since
11161         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11162         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11163         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11164         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11165         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11166         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11167         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11168           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11169           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11170           if $GPGCONF --dump-options > /dev/null ; then
11171             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11172               AC_MSG_RESULT([yes])
11173               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11174               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11175             else
11176               AC_MSG_RESULT([no])
11177             fi
11178           else
11179             AC_MSG_RESULT([no. missing or broken gpgconf?])
11180           fi
11181         else
11182           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11183         fi
11184       else
11185         AC_MSG_RESULT([no])
11186      fi
11187    fi
11189 AC_SUBST(ENABLE_GPGMEPP)
11190 AC_SUBST(SYSTEM_GPGMEPP)
11191 AC_SUBST(GPG_ERROR_CFLAGS)
11192 AC_SUBST(GPG_ERROR_LIBS)
11193 AC_SUBST(LIBASSUAN_CFLAGS)
11194 AC_SUBST(LIBASSUAN_LIBS)
11195 AC_SUBST(GPGMEPP_CFLAGS)
11196 AC_SUBST(GPGMEPP_LIBS)
11198 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11199 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11200     AC_MSG_RESULT([yes])
11201     ENABLE_MEDIAWIKI=TRUE
11202     BUILD_TYPE="$BUILD_TYPE XSLTML"
11203     if test  "x$with_java" = "xno"; then
11204         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11205     fi
11206 else
11207     AC_MSG_RESULT([no])
11208     ENABLE_MEDIAWIKI=
11209     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11211 AC_SUBST(ENABLE_MEDIAWIKI)
11213 AC_MSG_CHECKING([whether to build the Report Builder])
11214 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11215     AC_MSG_RESULT([yes])
11216     ENABLE_REPORTBUILDER=TRUE
11217     AC_MSG_CHECKING([which jfreereport libs to use])
11218     if test "$with_system_jfreereport" = "yes"; then
11219         SYSTEM_JFREEREPORT=TRUE
11220         AC_MSG_RESULT([external])
11221         if test -z $SAC_JAR; then
11222             SAC_JAR=/usr/share/java/sac.jar
11223         fi
11224         if ! test -f $SAC_JAR; then
11225              AC_MSG_ERROR(sac.jar not found.)
11226         fi
11228         if test -z $LIBXML_JAR; then
11229             if test -f /usr/share/java/libxml-1.0.0.jar; then
11230                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11231             elif test -f /usr/share/java/libxml.jar; then
11232                 LIBXML_JAR=/usr/share/java/libxml.jar
11233             else
11234                 AC_MSG_ERROR(libxml.jar replacement not found.)
11235             fi
11236         elif ! test -f $LIBXML_JAR; then
11237             AC_MSG_ERROR(libxml.jar not found.)
11238         fi
11240         if test -z $FLUTE_JAR; then
11241             if test -f/usr/share/java/flute-1.3.0.jar; then
11242                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11243             elif test -f /usr/share/java/flute.jar; then
11244                 FLUTE_JAR=/usr/share/java/flute.jar
11245             else
11246                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11247             fi
11248         elif ! test -f $FLUTE_JAR; then
11249             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11250         fi
11252         if test -z $JFREEREPORT_JAR; then
11253             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11254                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11255             elif test -f /usr/share/java/flow-engine.jar; then
11256                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11257             else
11258                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11259             fi
11260         elif ! test -f  $JFREEREPORT_JAR; then
11261                 AC_MSG_ERROR(jfreereport.jar not found.)
11262         fi
11264         if test -z $LIBLAYOUT_JAR; then
11265             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11266                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11267             elif test -f /usr/share/java/liblayout.jar; then
11268                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11269             else
11270                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11271             fi
11272         elif ! test -f $LIBLAYOUT_JAR; then
11273                 AC_MSG_ERROR(liblayout.jar not found.)
11274         fi
11276         if test -z $LIBLOADER_JAR; then
11277             if test -f /usr/share/java/libloader-1.0.0.jar; then
11278                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11279             elif test -f /usr/share/java/libloader.jar; then
11280                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11281             else
11282                 AC_MSG_ERROR(libloader.jar replacement not found.)
11283             fi
11284         elif ! test -f  $LIBLOADER_JAR; then
11285             AC_MSG_ERROR(libloader.jar not found.)
11286         fi
11288         if test -z $LIBFORMULA_JAR; then
11289             if test -f /usr/share/java/libformula-0.2.0.jar; then
11290                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11291             elif test -f /usr/share/java/libformula.jar; then
11292                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11293             else
11294                 AC_MSG_ERROR(libformula.jar replacement not found.)
11295             fi
11296         elif ! test -f $LIBFORMULA_JAR; then
11297                 AC_MSG_ERROR(libformula.jar not found.)
11298         fi
11300         if test -z $LIBREPOSITORY_JAR; then
11301             if test -f /usr/share/java/librepository-1.0.0.jar; then
11302                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11303             elif test -f /usr/share/java/librepository.jar; then
11304                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11305             else
11306                 AC_MSG_ERROR(librepository.jar replacement not found.)
11307             fi
11308         elif ! test -f $LIBREPOSITORY_JAR; then
11309             AC_MSG_ERROR(librepository.jar not found.)
11310         fi
11312         if test -z $LIBFONTS_JAR; then
11313             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11314                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11315             elif test -f /usr/share/java/libfonts.jar; then
11316                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11317             else
11318                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11319             fi
11320         elif ! test -f $LIBFONTS_JAR; then
11321                 AC_MSG_ERROR(libfonts.jar not found.)
11322         fi
11324         if test -z $LIBSERIALIZER_JAR; then
11325             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11326                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11327             elif test -f /usr/share/java/libserializer.jar; then
11328                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11329             else
11330                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11331             fi
11332         elif ! test -f $LIBSERIALIZER_JAR; then
11333                 AC_MSG_ERROR(libserializer.jar not found.)
11334         fi
11336         if test -z $LIBBASE_JAR; then
11337             if test -f /usr/share/java/libbase-1.0.0.jar; then
11338                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11339             elif test -f /usr/share/java/libbase.jar; then
11340                 LIBBASE_JAR=/usr/share/java/libbase.jar
11341             else
11342                 AC_MSG_ERROR(libbase.jar replacement not found.)
11343             fi
11344         elif ! test -f $LIBBASE_JAR; then
11345             AC_MSG_ERROR(libbase.jar not found.)
11346         fi
11348     else
11349         AC_MSG_RESULT([internal])
11350         SYSTEM_JFREEREPORT=
11351         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11352         NEED_ANT=TRUE
11353     fi
11354 else
11355     AC_MSG_RESULT([no])
11356     ENABLE_REPORTBUILDER=
11357     SYSTEM_JFREEREPORT=
11359 AC_SUBST(ENABLE_REPORTBUILDER)
11360 AC_SUBST(SYSTEM_JFREEREPORT)
11361 AC_SUBST(SAC_JAR)
11362 AC_SUBST(LIBXML_JAR)
11363 AC_SUBST(FLUTE_JAR)
11364 AC_SUBST(JFREEREPORT_JAR)
11365 AC_SUBST(LIBBASE_JAR)
11366 AC_SUBST(LIBLAYOUT_JAR)
11367 AC_SUBST(LIBLOADER_JAR)
11368 AC_SUBST(LIBFORMULA_JAR)
11369 AC_SUBST(LIBREPOSITORY_JAR)
11370 AC_SUBST(LIBFONTS_JAR)
11371 AC_SUBST(LIBSERIALIZER_JAR)
11373 # this has to be here because both the Wiki Publisher and the SRB use
11374 # commons-logging
11375 COMMONS_LOGGING_VERSION=1.2
11376 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11377     AC_MSG_CHECKING([which Apache commons-* libs to use])
11378     if test "$with_system_apache_commons" = "yes"; then
11379         SYSTEM_APACHE_COMMONS=TRUE
11380         AC_MSG_RESULT([external])
11381         if test -z $COMMONS_LOGGING_JAR; then
11382             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11383                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11384            elif test -f /usr/share/java/commons-logging.jar; then
11385                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11386             else
11387                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11388             fi
11389         elif ! test -f $COMMONS_LOGGING_JAR; then
11390             AC_MSG_ERROR(commons-logging.jar not found.)
11391         fi
11392     else
11393         AC_MSG_RESULT([internal])
11394         SYSTEM_APACHE_COMMONS=
11395         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11396         NEED_ANT=TRUE
11397     fi
11399 AC_SUBST(SYSTEM_APACHE_COMMONS)
11400 AC_SUBST(COMMONS_LOGGING_JAR)
11401 AC_SUBST(COMMONS_LOGGING_VERSION)
11403 # scripting provider for BeanShell?
11404 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11405 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11406     AC_MSG_RESULT([yes])
11407     ENABLE_SCRIPTING_BEANSHELL=TRUE
11409     dnl ===================================================================
11410     dnl Check for system beanshell
11411     dnl ===================================================================
11412     AC_MSG_CHECKING([which beanshell to use])
11413     if test "$with_system_beanshell" = "yes"; then
11414         AC_MSG_RESULT([external])
11415         SYSTEM_BSH=TRUE
11416         if test -z $BSH_JAR; then
11417             BSH_JAR=/usr/share/java/bsh.jar
11418         fi
11419         if ! test -f $BSH_JAR; then
11420             AC_MSG_ERROR(bsh.jar not found.)
11421         fi
11422     else
11423         AC_MSG_RESULT([internal])
11424         SYSTEM_BSH=
11425         BUILD_TYPE="$BUILD_TYPE BSH"
11426     fi
11427 else
11428     AC_MSG_RESULT([no])
11429     ENABLE_SCRIPTING_BEANSHELL=
11430     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11432 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11433 AC_SUBST(SYSTEM_BSH)
11434 AC_SUBST(BSH_JAR)
11436 # scripting provider for JavaScript?
11437 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11438 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11439     AC_MSG_RESULT([yes])
11440     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11442     dnl ===================================================================
11443     dnl Check for system rhino
11444     dnl ===================================================================
11445     AC_MSG_CHECKING([which rhino to use])
11446     if test "$with_system_rhino" = "yes"; then
11447         AC_MSG_RESULT([external])
11448         SYSTEM_RHINO=TRUE
11449         if test -z $RHINO_JAR; then
11450             RHINO_JAR=/usr/share/java/js.jar
11451         fi
11452         if ! test -f $RHINO_JAR; then
11453             AC_MSG_ERROR(js.jar not found.)
11454         fi
11455     else
11456         AC_MSG_RESULT([internal])
11457         SYSTEM_RHINO=
11458         BUILD_TYPE="$BUILD_TYPE RHINO"
11459         NEED_ANT=TRUE
11460     fi
11461 else
11462     AC_MSG_RESULT([no])
11463     ENABLE_SCRIPTING_JAVASCRIPT=
11464     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11466 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11467 AC_SUBST(SYSTEM_RHINO)
11468 AC_SUBST(RHINO_JAR)
11470 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11471 # paths should be added to library search path. So lets put all 64-bit
11472 # platforms there.
11473 supports_multilib=
11474 case "$host_cpu" in
11475 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11476     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11477         supports_multilib="yes"
11478     fi
11479     ;;
11481     ;;
11482 esac
11484 dnl ===================================================================
11485 dnl QT5 Integration
11486 dnl ===================================================================
11488 QT5_CFLAGS=""
11489 QT5_LIBS=""
11490 QMAKE5="qmake"
11491 MOC5="moc"
11492 QT5_GOBJECT_CFLAGS=""
11493 QT5_GOBJECT_LIBS=""
11494 QT5_HAVE_GOBJECT=""
11495 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11496         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11497         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11498 then
11499     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11500     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11502     if test -n "$supports_multilib"; then
11503         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11504     fi
11506     qt5_test_include="QtWidgets/qapplication.h"
11507     qt5_test_library="libQt5Widgets.so"
11509     dnl Check for qmake5
11510     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11511     if test "$QMAKE5" = "no"; then
11512         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11513     else
11514         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11515         if test -z "$qmake5_test_ver"; then
11516             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11517         fi
11518         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11519         qt5_minimal_minor="6"
11520         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11521             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11522         else
11523             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11524         fi
11525     fi
11527     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11528     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11530     AC_MSG_CHECKING([for Qt5 headers])
11531     qt5_incdir="no"
11532     for inc_dir in $qt5_incdirs; do
11533         if test -r "$inc_dir/$qt5_test_include"; then
11534             qt5_incdir="$inc_dir"
11535             break
11536         fi
11537     done
11538     AC_MSG_RESULT([$qt5_incdir])
11539     if test "x$qt5_incdir" = "xno"; then
11540         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11541     fi
11543     AC_MSG_CHECKING([for Qt5 libraries])
11544     qt5_libdir="no"
11545     for lib_dir in $qt5_libdirs; do
11546         if test -r "$lib_dir/$qt5_test_library"; then
11547             qt5_libdir="$lib_dir"
11548             break
11549         fi
11550     done
11551     AC_MSG_RESULT([$qt5_libdir])
11552     if test "x$qt5_libdir" = "xno"; then
11553         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11554     fi
11556     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11557     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11558     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11560     if test "$USING_X11" = TRUE; then
11561         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11562         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11563             QT5_HAVE_XCB_ICCCM=1
11564             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11565         ],[
11566             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)])
11567             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11568         ])
11569         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11570         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11571         QT5_USING_X11=1
11572         AC_DEFINE(QT5_USING_X11)
11573     fi
11575     dnl Check for Meta Object Compiler
11577     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11578     if test "$MOC5" = "no"; then
11579         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11580 the root of your Qt installation by exporting QT5DIR before running "configure".])
11581     fi
11583     if test "$build_gstreamer_1_0" = "yes"; then
11584         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11585                 QT5_HAVE_GOBJECT=1
11586                 AC_DEFINE(QT5_HAVE_GOBJECT)
11587             ],
11588             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11589         )
11590     fi
11592 AC_SUBST(QT5_CFLAGS)
11593 AC_SUBST(QT5_LIBS)
11594 AC_SUBST(MOC5)
11595 AC_SUBST(QT5_GOBJECT_CFLAGS)
11596 AC_SUBST(QT5_GOBJECT_LIBS)
11597 AC_SUBST(QT5_HAVE_GOBJECT)
11599 dnl ===================================================================
11600 dnl KF5 Integration
11601 dnl ===================================================================
11603 KF5_CFLAGS=""
11604 KF5_LIBS=""
11605 KF5_CONFIG="kf5-config"
11606 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11607         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11608 then
11609     if test "$OS" = "HAIKU"; then
11610         haiku_arch="`echo $RTL_ARCH | tr X x`"
11611         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11612         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11613     fi
11615     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11616     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11617     if test -n "$supports_multilib"; then
11618         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11619     fi
11621     kf5_test_include="KF5/kcoreaddons_version.h"
11622     kf5_test_library="libKF5CoreAddons.so"
11623     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11625     dnl kf5 KDE4 support compatibility installed
11626     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11627     if test "$KF5_CONFIG" != "no"; then
11628         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11629         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11630     fi
11632     dnl Check for KF5 headers
11633     AC_MSG_CHECKING([for KF5 headers])
11634     kf5_incdir="no"
11635     for kf5_check in $kf5_incdirs; do
11636         if test -r "$kf5_check/$kf5_test_include"; then
11637             kf5_incdir="$kf5_check/KF5"
11638             break
11639         fi
11640     done
11641     AC_MSG_RESULT([$kf5_incdir])
11642     if test "x$kf5_incdir" = "xno"; then
11643         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11644     fi
11646     dnl Check for KF5 libraries
11647     AC_MSG_CHECKING([for KF5 libraries])
11648     kf5_libdir="no"
11649     for kf5_check in $kf5_libdirs; do
11650         if test -r "$kf5_check/$kf5_test_library"; then
11651             kf5_libdir="$kf5_check"
11652             break
11653         fi
11654     done
11656     AC_MSG_RESULT([$kf5_libdir])
11657     if test "x$kf5_libdir" = "xno"; then
11658         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11659     fi
11661     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"
11662     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11663     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11665     if test "$USING_X11" = TRUE; then
11666         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11667     fi
11669     AC_LANG_PUSH([C++])
11670     save_CXXFLAGS=$CXXFLAGS
11671     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11672     AC_MSG_CHECKING([whether KDE is >= 5.0])
11673        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11674 #include <kcoreaddons_version.h>
11676 int main(int argc, char **argv) {
11677        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11678        else return 1;
11680        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11681     CXXFLAGS=$save_CXXFLAGS
11682     AC_LANG_POP([C++])
11684 AC_SUBST(KF5_CFLAGS)
11685 AC_SUBST(KF5_LIBS)
11687 dnl ===================================================================
11688 dnl Test whether to include Evolution 2 support
11689 dnl ===================================================================
11690 AC_MSG_CHECKING([whether to enable evolution 2 support])
11691 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11692     AC_MSG_RESULT([yes])
11693     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11694     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11695     FilterLibs "${GOBJECT_LIBS}"
11696     GOBJECT_LIBS="${filteredlibs}"
11697     ENABLE_EVOAB2="TRUE"
11698 else
11699     ENABLE_EVOAB2=""
11700     AC_MSG_RESULT([no])
11702 AC_SUBST(ENABLE_EVOAB2)
11703 AC_SUBST(GOBJECT_CFLAGS)
11704 AC_SUBST(GOBJECT_LIBS)
11706 dnl ===================================================================
11707 dnl Test which themes to include
11708 dnl ===================================================================
11709 AC_MSG_CHECKING([which themes to include])
11710 # if none given use default subset of available themes
11711 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11712     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"
11715 WITH_THEMES=""
11716 if test "x$with_theme" != "xno"; then
11717     for theme in $with_theme; do
11718         case $theme in
11719         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" ;;
11720         default) real_theme=colibre ;;
11721         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11722         esac
11723         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11724     done
11726 AC_MSG_RESULT([$WITH_THEMES])
11727 AC_SUBST([WITH_THEMES])
11728 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11729 for theme in $with_theme; do
11730     case $theme in
11731     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11732     *) ;;
11733     esac
11734 done
11736 dnl ===================================================================
11737 dnl Test whether to integrate helppacks into the product's installer
11738 dnl ===================================================================
11739 AC_MSG_CHECKING([for helppack integration])
11740 if test "$with_helppack_integration" = "no"; then
11741     AC_MSG_RESULT([no integration])
11742 else
11743     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11744     AC_MSG_RESULT([integration])
11747 ###############################################################################
11748 # Extensions checking
11749 ###############################################################################
11750 AC_MSG_CHECKING([for extensions integration])
11751 if test "x$enable_extension_integration" != "xno"; then
11752     WITH_EXTENSION_INTEGRATION=TRUE
11753     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11754     AC_MSG_RESULT([yes, use integration])
11755 else
11756     WITH_EXTENSION_INTEGRATION=
11757     AC_MSG_RESULT([no, do not integrate])
11759 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11761 dnl Should any extra extensions be included?
11762 dnl There are standalone tests for each of these below.
11763 WITH_EXTRA_EXTENSIONS=
11764 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11766 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11767 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11768 if test "x$with_java" != "xno"; then
11769     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11770     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11773 AC_MSG_CHECKING([whether to build opens___.ttf])
11774 if test "$enable_build_opensymbol" = "yes"; then
11775     AC_MSG_RESULT([yes])
11776     AC_PATH_PROG(FONTFORGE, fontforge)
11777     if test -z "$FONTFORGE"; then
11778         AC_MSG_ERROR([fontforge not installed])
11779     fi
11780 else
11781     AC_MSG_RESULT([no])
11782     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11783     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11785 AC_SUBST(OPENSYMBOL_TTF)
11786 AC_SUBST(FONTFORGE)
11788 dnl ===================================================================
11789 dnl Test whether to include fonts
11790 dnl ===================================================================
11791 AC_MSG_CHECKING([whether to include third-party fonts])
11792 if test "$with_fonts" != "no"; then
11793     AC_MSG_RESULT([yes])
11794     WITH_FONTS=TRUE
11795     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11796     AC_DEFINE(HAVE_MORE_FONTS)
11797 else
11798     AC_MSG_RESULT([no])
11799     WITH_FONTS=
11800     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11802 AC_SUBST(WITH_FONTS)
11804 dnl Test whether to include more Google Noto fonts
11805 dnl ===================================================================
11806 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11807 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11808     AC_MSG_RESULT([no])
11809     WITH_NOTO_FONT=
11810 else
11811     AC_MSG_RESULT([yes])
11812     WITH_NOTO_FONT=TRUE
11813     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11814     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11816 AC_SUBST(WITH_NOTO_FONT)
11818 dnl ===================================================================
11819 dnl Test whether to enable online update service
11820 dnl ===================================================================
11821 AC_MSG_CHECKING([whether to enable online update])
11822 ENABLE_ONLINE_UPDATE=
11823 ENABLE_ONLINE_UPDATE_MAR=
11824 UPDATE_CONFIG=
11825 if test "$enable_online_update" = ""; then
11826     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11827         AC_MSG_RESULT([yes])
11828         ENABLE_ONLINE_UPDATE="TRUE"
11829     else
11830         AC_MSG_RESULT([no])
11831     fi
11832 else
11833     if test "$enable_online_update" = "mar"; then
11834         AC_MSG_RESULT([yes - MAR-based online update])
11835         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11836         if test "$with_update_config" = ""; then
11837             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11838         fi
11839         UPDATE_CONFIG="$with_update_config"
11840         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11841     elif test "$enable_online_update" = "yes"; then
11842         AC_MSG_RESULT([yes])
11843         ENABLE_ONLINE_UPDATE="TRUE"
11844     else
11845         AC_MSG_RESULT([no])
11846     fi
11848 AC_SUBST(ENABLE_ONLINE_UPDATE)
11849 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11850 AC_SUBST(UPDATE_CONFIG)
11852 dnl ===================================================================
11853 dnl Test whether we need bzip2
11854 dnl ===================================================================
11855 SYSTEM_BZIP2=
11856 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11857     AC_MSG_CHECKING([whether to use system bzip2])
11858     if test "$with_system_bzip2" = yes; then
11859         SYSTEM_BZIP2=TRUE
11860         AC_MSG_RESULT([yes])
11861         PKG_CHECK_MODULES(BZIP2, bzip2)
11862         FilterLibs "${BZIP2_LIBS}"
11863         BZIP2_LIBS="${filteredlibs}"
11864     else
11865         AC_MSG_RESULT([no])
11866         BUILD_TYPE="$BUILD_TYPE BZIP2"
11867     fi
11869 AC_SUBST(SYSTEM_BZIP2)
11870 AC_SUBST(BZIP2_CFLAGS)
11871 AC_SUBST(BZIP2_LIBS)
11873 dnl ===================================================================
11874 dnl Test whether to enable extension update
11875 dnl ===================================================================
11876 AC_MSG_CHECKING([whether to enable extension update])
11877 ENABLE_EXTENSION_UPDATE=
11878 if test "x$enable_extension_update" = "xno"; then
11879     AC_MSG_RESULT([no])
11880 else
11881     AC_MSG_RESULT([yes])
11882     ENABLE_EXTENSION_UPDATE="TRUE"
11883     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11884     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11886 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11889 dnl ===================================================================
11890 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11891 dnl ===================================================================
11892 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11893 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11894     AC_MSG_RESULT([no])
11895     ENABLE_SILENT_MSI=
11896 else
11897     AC_MSG_RESULT([yes])
11898     ENABLE_SILENT_MSI=TRUE
11899     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11901 AC_SUBST(ENABLE_SILENT_MSI)
11903 AC_MSG_CHECKING([whether and how to use Xinerama])
11904 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11905     if test "$x_libraries" = "default_x_libraries"; then
11906         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11907         if test "x$XINERAMALIB" = x; then
11908            XINERAMALIB="/usr/lib"
11909         fi
11910     else
11911         XINERAMALIB="$x_libraries"
11912     fi
11913     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11914         # we have both versions, let the user decide but use the dynamic one
11915         # per default
11916         USE_XINERAMA=TRUE
11917         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11918             XINERAMA_LINK=dynamic
11919         else
11920             XINERAMA_LINK=static
11921         fi
11922     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11923         # we have only the dynamic version
11924         USE_XINERAMA=TRUE
11925         XINERAMA_LINK=dynamic
11926     elif test -e "$XINERAMALIB/libXinerama.a"; then
11927         # static version
11928         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11929             USE_XINERAMA=TRUE
11930             XINERAMA_LINK=static
11931         else
11932             USE_XINERAMA=
11933             XINERAMA_LINK=none
11934         fi
11935     else
11936         # no Xinerama
11937         USE_XINERAMA=
11938         XINERAMA_LINK=none
11939     fi
11940     if test "$USE_XINERAMA" = "TRUE"; then
11941         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11942         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11943             [AC_MSG_ERROR(Xinerama header not found.)], [])
11944         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11945         if test "x$XEXTLIB" = x; then
11946            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11947         fi
11948         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11949         if test "$_os" = "FreeBSD"; then
11950             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11951         fi
11952         if test "$_os" = "Linux"; then
11953             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11954         fi
11955         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11956             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11957     else
11958         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11959     fi
11960 else
11961     USE_XINERAMA=
11962     XINERAMA_LINK=none
11963     AC_MSG_RESULT([no])
11965 AC_SUBST(USE_XINERAMA)
11966 AC_SUBST(XINERAMA_LINK)
11968 dnl ===================================================================
11969 dnl Test whether to build cairo or rely on the system version
11970 dnl ===================================================================
11972 if test "$USING_X11" = TRUE; then
11973     # Used in vcl/Library_vclplug_gen.mk
11974     test_cairo=yes
11977 if test "$test_cairo" = "yes"; then
11978     AC_MSG_CHECKING([whether to use the system cairo])
11980     : ${with_system_cairo:=$with_system_libs}
11981     if test "$with_system_cairo" = "yes"; then
11982         SYSTEM_CAIRO=TRUE
11983         AC_MSG_RESULT([yes])
11985         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11986         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11987         FilterLibs "${CAIRO_LIBS}"
11988         CAIRO_LIBS="${filteredlibs}"
11990         if test "$test_xrender" = "yes"; then
11991             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11992             AC_LANG_PUSH([C])
11993             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11994 #ifdef PictStandardA8
11995 #else
11996       return fail;
11997 #endif
11998 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12000             AC_LANG_POP([C])
12001         fi
12002     else
12003         SYSTEM_CAIRO=
12004         AC_MSG_RESULT([no])
12006         BUILD_TYPE="$BUILD_TYPE CAIRO"
12007     fi
12010 AC_SUBST(SYSTEM_CAIRO)
12011 AC_SUBST(CAIRO_CFLAGS)
12012 AC_SUBST(CAIRO_LIBS)
12014 dnl ===================================================================
12015 dnl Test whether to use avahi
12016 dnl ===================================================================
12017 if test "$_os" = "WINNT"; then
12018     # Windows uses bundled mDNSResponder
12019     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12020 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12021     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12022                       [ENABLE_AVAHI="TRUE"])
12023     AC_DEFINE(HAVE_FEATURE_AVAHI)
12024     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12025     FilterLibs "${AVAHI_LIBS}"
12026     AVAHI_LIBS="${filteredlibs}"
12029 AC_SUBST(ENABLE_AVAHI)
12030 AC_SUBST(AVAHI_CFLAGS)
12031 AC_SUBST(AVAHI_LIBS)
12033 dnl ===================================================================
12034 dnl Test whether to use liblangtag
12035 dnl ===================================================================
12036 SYSTEM_LIBLANGTAG=
12037 AC_MSG_CHECKING([whether to use system liblangtag])
12038 if test "$with_system_liblangtag" = yes; then
12039     SYSTEM_LIBLANGTAG=TRUE
12040     AC_MSG_RESULT([yes])
12041     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12042     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12043     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12044     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12045     FilterLibs "${LIBLANGTAG_LIBS}"
12046     LIBLANGTAG_LIBS="${filteredlibs}"
12047 else
12048     SYSTEM_LIBLANGTAG=
12049     AC_MSG_RESULT([no])
12050     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12051     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12052     if test "$COM" = "MSC"; then
12053         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12054     else
12055         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12056     fi
12058 AC_SUBST(SYSTEM_LIBLANGTAG)
12059 AC_SUBST(LIBLANGTAG_CFLAGS)
12060 AC_SUBST(LIBLANGTAG_LIBS)
12062 dnl ===================================================================
12063 dnl Test whether to build libpng or rely on the system version
12064 dnl ===================================================================
12066 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12068 dnl ===================================================================
12069 dnl Check for runtime JVM search path
12070 dnl ===================================================================
12071 if test "$ENABLE_JAVA" != ""; then
12072     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12073     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12074         AC_MSG_RESULT([yes])
12075         if ! test -d "$with_jvm_path"; then
12076             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12077         fi
12078         if ! test -d "$with_jvm_path"jvm; then
12079             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12080         fi
12081         JVM_ONE_PATH_CHECK="$with_jvm_path"
12082         AC_SUBST(JVM_ONE_PATH_CHECK)
12083     else
12084         AC_MSG_RESULT([no])
12085     fi
12088 dnl ===================================================================
12089 dnl Test for the presence of Ant and that it works
12090 dnl ===================================================================
12092 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
12093     ANT_HOME=; export ANT_HOME
12094     WITH_ANT_HOME=; export WITH_ANT_HOME
12095     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
12096         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
12097             if test "$_os" = "WINNT"; then
12098                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
12099             else
12100                 with_ant_home="$LODE_HOME/opt/ant"
12101             fi
12102         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
12103             with_ant_home="$LODE_HOME/opt/ant"
12104         fi
12105     fi
12106     if test -z "$with_ant_home"; then
12107         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
12108     else
12109         if test "$_os" = "WINNT"; then
12110             # AC_PATH_PROGS needs unix path
12111             with_ant_home=`cygpath -u "$with_ant_home"`
12112         fi
12113         AbsolutePath "$with_ant_home"
12114         with_ant_home=$absolute_path
12115         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12116         WITH_ANT_HOME=$with_ant_home
12117         ANT_HOME=$with_ant_home
12118     fi
12120     if test -z "$ANT"; then
12121         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12122     else
12123         # resolve relative or absolute symlink
12124         while test -h "$ANT"; do
12125             a_cwd=`pwd`
12126             a_basename=`basename "$ANT"`
12127             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12128             cd "`dirname "$ANT"`"
12129             cd "`dirname "$a_script"`"
12130             ANT="`pwd`"/"`basename "$a_script"`"
12131             cd "$a_cwd"
12132         done
12134         AC_MSG_CHECKING([if $ANT works])
12135         mkdir -p conftest.dir
12136         a_cwd=$(pwd)
12137         cd conftest.dir
12138         cat > conftest.java << EOF
12139         public class conftest {
12140             int testmethod(int a, int b) {
12141                     return a + b;
12142             }
12143         }
12146         cat > conftest.xml << EOF
12147         <project name="conftest" default="conftest">
12148         <target name="conftest">
12149             <javac srcdir="." includes="conftest.java">
12150             </javac>
12151         </target>
12152         </project>
12155         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12156         if test $? = 0 -a -f ./conftest.class; then
12157             AC_MSG_RESULT([Ant works])
12158             if test -z "$WITH_ANT_HOME"; then
12159                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12160                 if test -z "$ANT_HOME"; then
12161                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12162                 fi
12163             else
12164                 ANT_HOME="$WITH_ANT_HOME"
12165             fi
12166         else
12167             echo "configure: Ant test failed" >&5
12168             cat conftest.java >&5
12169             cat conftest.xml >&5
12170             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12171         fi
12172         cd "$a_cwd"
12173         rm -fr conftest.dir
12174     fi
12175     if test -z "$ANT_HOME"; then
12176         ANT_HOME="NO_ANT_HOME"
12177     else
12178         PathFormat "$ANT_HOME"
12179         ANT_HOME="$formatted_path"
12180         PathFormat "$ANT"
12181         ANT="$formatted_path"
12182     fi
12183     AC_SUBST(ANT_HOME)
12184     AC_SUBST(ANT)
12186     dnl Checking for ant.jar
12187     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12188         AC_MSG_CHECKING([Ant lib directory])
12189         if test -f $ANT_HOME/lib/ant.jar; then
12190             ANT_LIB="$ANT_HOME/lib"
12191         else
12192             if test -f $ANT_HOME/ant.jar; then
12193                 ANT_LIB="$ANT_HOME"
12194             else
12195                 if test -f /usr/share/java/ant.jar; then
12196                     ANT_LIB=/usr/share/java
12197                 else
12198                     if test -f /usr/share/ant-core/lib/ant.jar; then
12199                         ANT_LIB=/usr/share/ant-core/lib
12200                     else
12201                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12202                             ANT_LIB="$ANT_HOME/lib/ant"
12203                         else
12204                             if test -f /usr/share/lib/ant/ant.jar; then
12205                                 ANT_LIB=/usr/share/lib/ant
12206                             else
12207                                 AC_MSG_ERROR([Ant libraries not found!])
12208                             fi
12209                         fi
12210                     fi
12211                 fi
12212             fi
12213         fi
12214         PathFormat "$ANT_LIB"
12215         ANT_LIB="$formatted_path"
12216         AC_MSG_RESULT([Ant lib directory found.])
12217     fi
12218     AC_SUBST(ANT_LIB)
12220     ant_minver=1.6.0
12221     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12223     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12224     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12225     ant_version_major=`echo $ant_version | cut -d. -f1`
12226     ant_version_minor=`echo $ant_version | cut -d. -f2`
12227     echo "configure: ant_version $ant_version " >&5
12228     echo "configure: ant_version_major $ant_version_major " >&5
12229     echo "configure: ant_version_minor $ant_version_minor " >&5
12230     if test "$ant_version_major" -ge "2"; then
12231         AC_MSG_RESULT([yes, $ant_version])
12232     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12233         AC_MSG_RESULT([yes, $ant_version])
12234     else
12235         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12236     fi
12238     rm -f conftest* core core.* *.core
12241 OOO_JUNIT_JAR=
12242 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12243     AC_MSG_CHECKING([for JUnit 4])
12244     if test "$with_junit" = "yes"; then
12245         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12246             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12247         elif test -e /usr/share/java/junit4.jar; then
12248             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12249         else
12250            if test -e /usr/share/lib/java/junit.jar; then
12251               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12252            else
12253               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12254            fi
12255         fi
12256     else
12257         OOO_JUNIT_JAR=$with_junit
12258     fi
12259     if test "$_os" = "WINNT"; then
12260         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12261     fi
12262     printf 'import org.junit.Before;' > conftest.java
12263     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12264         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12265     else
12266         AC_MSG_ERROR(
12267 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12268  specify its pathname via --with-junit=..., or disable it via --without-junit])
12269     fi
12270     rm -f conftest.class conftest.java
12271     if test $OOO_JUNIT_JAR != ""; then
12272     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12273     fi
12275 AC_SUBST(OOO_JUNIT_JAR)
12277 HAMCREST_JAR=
12278 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12279     AC_MSG_CHECKING([for included Hamcrest])
12280     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12281     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12282         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12283     else
12284         AC_MSG_RESULT([Not included])
12285         AC_MSG_CHECKING([for standalone hamcrest jar.])
12286         if test "$with_hamcrest" = "yes"; then
12287             if test -e /usr/share/lib/java/hamcrest.jar; then
12288                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12289             elif test -e /usr/share/java/hamcrest/core.jar; then
12290                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12291             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
12292                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
12293             else
12294                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12295             fi
12296         else
12297             HAMCREST_JAR=$with_hamcrest
12298         fi
12299         if test "$_os" = "WINNT"; then
12300             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12301         fi
12302         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12303             AC_MSG_RESULT([$HAMCREST_JAR])
12304         else
12305             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),
12306                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12307         fi
12308     fi
12309     rm -f conftest.class conftest.java
12311 AC_SUBST(HAMCREST_JAR)
12314 AC_SUBST(SCPDEFS)
12317 # check for wget and curl
12319 WGET=
12320 CURL=
12322 if test "$enable_fetch_external" != "no"; then
12324 CURL=`which curl 2>/dev/null`
12326 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12327     # wget new enough?
12328     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12329     if test $? -eq 0; then
12330         WGET=$i
12331         break
12332     fi
12333 done
12335 if test -z "$WGET" -a -z "$CURL"; then
12336     AC_MSG_ERROR([neither wget nor curl found!])
12341 AC_SUBST(WGET)
12342 AC_SUBST(CURL)
12345 # check for sha256sum
12347 SHA256SUM=
12349 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12350     eval "$i -a 256 --version" > /dev/null 2>&1
12351     ret=$?
12352     if test $ret -eq 0; then
12353         SHA256SUM="$i -a 256"
12354         break
12355     fi
12356 done
12358 if test -z "$SHA256SUM"; then
12359     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12360         eval "$i --version" > /dev/null 2>&1
12361         ret=$?
12362         if test $ret -eq 0; then
12363             SHA256SUM=$i
12364             break
12365         fi
12366     done
12369 if test -z "$SHA256SUM"; then
12370     AC_MSG_ERROR([no sha256sum found!])
12373 AC_SUBST(SHA256SUM)
12375 dnl ===================================================================
12376 dnl Dealing with l10n options
12377 dnl ===================================================================
12378 AC_MSG_CHECKING([which languages to be built])
12379 # get list of all languages
12380 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12381 # the sed command does the following:
12382 #   + if a line ends with a backslash, append the next line to it
12383 #   + adds " on the beginning of the value (after =)
12384 #   + adds " at the end of the value
12385 #   + removes en-US; we want to put it on the beginning
12386 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12387 [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)]
12388 ALL_LANGS="en-US $completelangiso"
12389 # check the configured localizations
12390 WITH_LANG="$with_lang"
12392 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12393 # (Norwegian is "nb" and "nn".)
12394 if test "$WITH_LANG" = "no"; then
12395     WITH_LANG=
12398 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12399     AC_MSG_RESULT([en-US])
12400 else
12401     AC_MSG_RESULT([$WITH_LANG])
12402     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12403     if test -z "$MSGFMT"; then
12404         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12405             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12406         elif test -x "/opt/lo/bin/msgfmt"; then
12407             MSGFMT="/opt/lo/bin/msgfmt"
12408         else
12409             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12410             if test -z "$MSGFMT"; then
12411                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12412             fi
12413         fi
12414     fi
12415     if test -z "$MSGUNIQ"; then
12416         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12417             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12418         elif test -x "/opt/lo/bin/msguniq"; then
12419             MSGUNIQ="/opt/lo/bin/msguniq"
12420         else
12421             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12422             if test -z "$MSGUNIQ"; then
12423                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12424             fi
12425         fi
12426     fi
12428 AC_SUBST(MSGFMT)
12429 AC_SUBST(MSGUNIQ)
12430 # check that the list is valid
12431 for lang in $WITH_LANG; do
12432     test "$lang" = "ALL" && continue
12433     # need to check for the exact string, so add space before and after the list of all languages
12434     for vl in $ALL_LANGS; do
12435         if test "$vl" = "$lang"; then
12436            break
12437         fi
12438     done
12439     if test "$vl" != "$lang"; then
12440         # if you're reading this - you prolly quoted your languages remove the quotes ...
12441         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12442     fi
12443 done
12444 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12445     echo $WITH_LANG | grep -q en-US
12446     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12448 # list with substituted ALL
12449 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12450 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12451 test "$WITH_LANG" = "en-US" && WITH_LANG=
12452 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12453     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12454     ALL_LANGS=`echo $ALL_LANGS qtz`
12456 AC_SUBST(ALL_LANGS)
12457 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12458 AC_SUBST(WITH_LANG)
12459 AC_SUBST(WITH_LANG_LIST)
12460 AC_SUBST(GIT_NEEDED_SUBMODULES)
12462 WITH_POOR_HELP_LOCALIZATIONS=
12463 if test -d "$SRC_ROOT/translations/source"; then
12464     for l in `ls -1 $SRC_ROOT/translations/source`; do
12465         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12466             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12467         fi
12468     done
12470 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12472 if test -n "$with_locales"; then
12473     WITH_LOCALES="$with_locales"
12475     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12476     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12477     # config_host/config_locales.h.in
12478     for locale in $WITH_LOCALES; do
12479         lang=${locale%_*}
12481         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12483         case $lang in
12484         hi|mr*ne)
12485             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12486             ;;
12487         bg|ru)
12488             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12489             ;;
12490         esac
12491     done
12492 else
12493     AC_DEFINE(WITH_LOCALE_ALL)
12495 AC_SUBST(WITH_LOCALES)
12497 dnl git submodule update --reference
12498 dnl ===================================================================
12499 if test -n "${GIT_REFERENCE_SRC}"; then
12500     for repo in ${GIT_NEEDED_SUBMODULES}; do
12501         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12502             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12503         fi
12504     done
12506 AC_SUBST(GIT_REFERENCE_SRC)
12508 dnl git submodules linked dirs
12509 dnl ===================================================================
12510 if test -n "${GIT_LINK_SRC}"; then
12511     for repo in ${GIT_NEEDED_SUBMODULES}; do
12512         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12513             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12514         fi
12515     done
12517 AC_SUBST(GIT_LINK_SRC)
12519 dnl branding
12520 dnl ===================================================================
12521 AC_MSG_CHECKING([for alternative branding images directory])
12522 # initialize mapped arrays
12523 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12524 brand_files="$BRAND_INTRO_IMAGES about.svg"
12526 if test -z "$with_branding" -o "$with_branding" = "no"; then
12527     AC_MSG_RESULT([none])
12528     DEFAULT_BRAND_IMAGES="$brand_files"
12529 else
12530     if ! test -d $with_branding ; then
12531         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12532     else
12533         AC_MSG_RESULT([$with_branding])
12534         CUSTOM_BRAND_DIR="$with_branding"
12535         for lfile in $brand_files
12536         do
12537             if ! test -f $with_branding/$lfile ; then
12538                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12539                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12540             else
12541                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12542             fi
12543         done
12544         check_for_progress="yes"
12545     fi
12547 AC_SUBST([BRAND_INTRO_IMAGES])
12548 AC_SUBST([CUSTOM_BRAND_DIR])
12549 AC_SUBST([CUSTOM_BRAND_IMAGES])
12550 AC_SUBST([DEFAULT_BRAND_IMAGES])
12553 AC_MSG_CHECKING([for 'intro' progress settings])
12554 PROGRESSBARCOLOR=
12555 PROGRESSSIZE=
12556 PROGRESSPOSITION=
12557 PROGRESSFRAMECOLOR=
12558 PROGRESSTEXTCOLOR=
12559 PROGRESSTEXTBASELINE=
12561 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12562     source "$with_branding/progress.conf"
12563     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12564 else
12565     AC_MSG_RESULT([none])
12568 AC_SUBST(PROGRESSBARCOLOR)
12569 AC_SUBST(PROGRESSSIZE)
12570 AC_SUBST(PROGRESSPOSITION)
12571 AC_SUBST(PROGRESSFRAMECOLOR)
12572 AC_SUBST(PROGRESSTEXTCOLOR)
12573 AC_SUBST(PROGRESSTEXTBASELINE)
12576 AC_MSG_CHECKING([for extra build ID])
12577 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12578     EXTRA_BUILDID="$with_extra_buildid"
12580 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12581 if test -n "$EXTRA_BUILDID" ; then
12582     AC_MSG_RESULT([$EXTRA_BUILDID])
12583 else
12584     AC_MSG_RESULT([not set])
12586 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12588 OOO_VENDOR=
12589 AC_MSG_CHECKING([for vendor])
12590 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12591     OOO_VENDOR="$USERNAME"
12593     if test -z "$OOO_VENDOR"; then
12594         OOO_VENDOR="$USER"
12595     fi
12597     if test -z "$OOO_VENDOR"; then
12598         OOO_VENDOR="`id -u -n`"
12599     fi
12601     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12602 else
12603     OOO_VENDOR="$with_vendor"
12604     AC_MSG_RESULT([$OOO_VENDOR])
12606 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12607 AC_SUBST(OOO_VENDOR)
12609 if test "$_os" = "Android" ; then
12610     ANDROID_PACKAGE_NAME=
12611     AC_MSG_CHECKING([for Android package name])
12612     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12613         if test -n "$ENABLE_DEBUG"; then
12614             # Default to the package name that makes ndk-gdb happy.
12615             ANDROID_PACKAGE_NAME="org.libreoffice"
12616         else
12617             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12618         fi
12620         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12621     else
12622         ANDROID_PACKAGE_NAME="$with_android_package_name"
12623         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12624     fi
12625     AC_SUBST(ANDROID_PACKAGE_NAME)
12628 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12629 if test "$with_compat_oowrappers" = "yes"; then
12630     WITH_COMPAT_OOWRAPPERS=TRUE
12631     AC_MSG_RESULT(yes)
12632 else
12633     WITH_COMPAT_OOWRAPPERS=
12634     AC_MSG_RESULT(no)
12636 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12638 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12639 AC_MSG_CHECKING([for install dirname])
12640 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12641     INSTALLDIRNAME="$with_install_dirname"
12643 AC_MSG_RESULT([$INSTALLDIRNAME])
12644 AC_SUBST(INSTALLDIRNAME)
12646 AC_MSG_CHECKING([for prefix])
12647 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12648 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12649 PREFIXDIR="$prefix"
12650 AC_MSG_RESULT([$PREFIXDIR])
12651 AC_SUBST(PREFIXDIR)
12653 LIBDIR=[$(eval echo $(eval echo $libdir))]
12654 AC_SUBST(LIBDIR)
12656 DATADIR=[$(eval echo $(eval echo $datadir))]
12657 AC_SUBST(DATADIR)
12659 MANDIR=[$(eval echo $(eval echo $mandir))]
12660 AC_SUBST(MANDIR)
12662 DOCDIR=[$(eval echo $(eval echo $docdir))]
12663 AC_SUBST(DOCDIR)
12665 BINDIR=[$(eval echo $(eval echo $bindir))]
12666 AC_SUBST(BINDIR)
12668 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12669 AC_SUBST(INSTALLDIR)
12671 TESTINSTALLDIR="${BUILDDIR}/test-install"
12672 AC_SUBST(TESTINSTALLDIR)
12675 # ===================================================================
12676 # OAuth2 id and secrets
12677 # ===================================================================
12679 AC_MSG_CHECKING([for Google Drive client id and secret])
12680 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12681     AC_MSG_RESULT([not set])
12682     GDRIVE_CLIENT_ID="\"\""
12683     GDRIVE_CLIENT_SECRET="\"\""
12684 else
12685     AC_MSG_RESULT([set])
12686     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12687     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12689 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12690 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12692 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12693 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12694     AC_MSG_RESULT([not set])
12695     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12696     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12697 else
12698     AC_MSG_RESULT([set])
12699     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12700     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12702 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12703 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12705 AC_MSG_CHECKING([for OneDrive client id and secret])
12706 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12707     AC_MSG_RESULT([not set])
12708     ONEDRIVE_CLIENT_ID="\"\""
12709     ONEDRIVE_CLIENT_SECRET="\"\""
12710 else
12711     AC_MSG_RESULT([set])
12712     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12713     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12715 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12716 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12719 dnl ===================================================================
12720 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12721 dnl --enable-dependency-tracking configure option
12722 dnl ===================================================================
12723 AC_MSG_CHECKING([whether to enable dependency tracking])
12724 if test "$enable_dependency_tracking" = "no"; then
12725     nodep=TRUE
12726     AC_MSG_RESULT([no])
12727 else
12728     AC_MSG_RESULT([yes])
12730 AC_SUBST(nodep)
12732 dnl ===================================================================
12733 dnl Number of CPUs to use during the build
12734 dnl ===================================================================
12735 AC_MSG_CHECKING([for number of processors to use])
12736 # plain --with-parallelism is just the default
12737 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12738     if test "$with_parallelism" = "no"; then
12739         PARALLELISM=0
12740     else
12741         PARALLELISM=$with_parallelism
12742     fi
12743 else
12744     if test "$enable_icecream" = "yes"; then
12745         PARALLELISM="40"
12746     else
12747         case `uname -s` in
12749         Darwin|FreeBSD|NetBSD|OpenBSD)
12750             PARALLELISM=`sysctl -n hw.ncpu`
12751             ;;
12753         Linux)
12754             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12755         ;;
12756         # what else than above does profit here *and* has /proc?
12757         *)
12758             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12759             ;;
12760         esac
12762         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12763         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12764     fi
12767 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12768     if test -z "$with_parallelism"; then
12769             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12770             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12771             PARALLELISM="1"
12772     else
12773         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."
12774     fi
12777 if test $PARALLELISM -eq 0; then
12778     AC_MSG_RESULT([explicit make -j option needed])
12779 else
12780     AC_MSG_RESULT([$PARALLELISM])
12782 AC_SUBST(PARALLELISM)
12784 IWYU_PATH="$with_iwyu"
12785 AC_SUBST(IWYU_PATH)
12786 if test ! -z "$IWYU_PATH"; then
12787     if test ! -f "$IWYU_PATH"; then
12788         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12789     fi
12793 # Set up ILIB for MSVC build
12795 ILIB1=
12796 if test "$build_os" = "cygwin"; then
12797     ILIB="."
12798     if test -n "$JAVA_HOME"; then
12799         ILIB="$ILIB;$JAVA_HOME/lib"
12800     fi
12801     ILIB1=-link
12802     if test "$BITNESS_OVERRIDE" = 64; then
12803         ILIB="$ILIB;$COMPATH/lib/x64"
12804         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12805         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12806         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12807         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12808             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12809             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12810         fi
12811         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12812         ucrtlibpath_formatted=$formatted_path
12813         ILIB="$ILIB;$ucrtlibpath_formatted"
12814         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12815     else
12816         ILIB="$ILIB;$COMPATH/lib/x86"
12817         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12818         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12819         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12820         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12821             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12822             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12823         fi
12824         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12825         ucrtlibpath_formatted=$formatted_path
12826         ILIB="$ILIB;$ucrtlibpath_formatted"
12827         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12828     fi
12829     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12830         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12831     else
12832         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12833     fi
12835     AC_SUBST(ILIB)
12838 # ===================================================================
12839 # Creating bigger shared library to link against
12840 # ===================================================================
12841 AC_MSG_CHECKING([whether to create huge library])
12842 MERGELIBS=
12844 if test $_os = iOS -o $_os = Android; then
12845     # Never any point in mergelibs for these as we build just static
12846     # libraries anyway...
12847     enable_mergelibs=no
12850 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12851     if test $_os != Linux -a $_os != WINNT; then
12852         add_warning "--enable-mergelibs is not tested for this platform"
12853     fi
12854     MERGELIBS="TRUE"
12855     AC_MSG_RESULT([yes])
12856 else
12857     AC_MSG_RESULT([no])
12859 AC_SUBST([MERGELIBS])
12861 dnl ===================================================================
12862 dnl icerun is a wrapper that stops us spawning tens of processes
12863 dnl locally - for tools that can't be executed on the compile cluster
12864 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12865 dnl ===================================================================
12866 AC_MSG_CHECKING([whether to use icerun wrapper])
12867 ICECREAM_RUN=
12868 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12869     ICECREAM_RUN=icerun
12870     AC_MSG_RESULT([yes])
12871 else
12872     AC_MSG_RESULT([no])
12874 AC_SUBST(ICECREAM_RUN)
12876 dnl ===================================================================
12877 dnl Setup the ICECC_VERSION for the build the same way it was set for
12878 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12879 dnl ===================================================================
12880 x_ICECC_VERSION=[\#]
12881 if test -n "$ICECC_VERSION" ; then
12882     x_ICECC_VERSION=
12884 AC_SUBST(x_ICECC_VERSION)
12885 AC_SUBST(ICECC_VERSION)
12887 dnl ===================================================================
12889 AC_MSG_CHECKING([MPL subset])
12890 MPL_SUBSET=
12892 if test "$enable_mpl_subset" = "yes"; then
12893     warn_report=false
12894     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12895         warn_report=true
12896     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12897         warn_report=true
12898     fi
12899     if test "$warn_report" = "true"; then
12900         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12901     fi
12902     if test "x$enable_postgresql_sdbc" != "xno"; then
12903         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12904     fi
12905     if test "$enable_lotuswordpro" = "yes"; then
12906         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12907     fi
12908     if test "$WITH_WEBDAV" = "neon"; then
12909         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12910     fi
12911     if test -n "$ENABLE_POPPLER"; then
12912         if test "x$SYSTEM_POPPLER" = "x"; then
12913             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12914         fi
12915     fi
12916     # cf. m4/libo_check_extension.m4
12917     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12918         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12919     fi
12920     for theme in $WITH_THEMES; do
12921         case $theme in
12922         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12923             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12924         *) : ;;
12925         esac
12926     done
12928     ENABLE_OPENGL_TRANSITIONS=
12930     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12931         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12932     fi
12934     MPL_SUBSET="TRUE"
12935     AC_DEFINE(MPL_HAVE_SUBSET)
12936     AC_MSG_RESULT([only])
12937 else
12938     AC_MSG_RESULT([no restrictions])
12940 AC_SUBST(MPL_SUBSET)
12942 dnl ===================================================================
12944 AC_MSG_CHECKING([formula logger])
12945 ENABLE_FORMULA_LOGGER=
12947 if test "x$enable_formula_logger" = "xyes"; then
12948     AC_MSG_RESULT([yes])
12949     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12950     ENABLE_FORMULA_LOGGER=TRUE
12951 elif test -n "$ENABLE_DBGUTIL" ; then
12952     AC_MSG_RESULT([yes])
12953     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12954     ENABLE_FORMULA_LOGGER=TRUE
12955 else
12956     AC_MSG_RESULT([no])
12959 AC_SUBST(ENABLE_FORMULA_LOGGER)
12961 dnl ===================================================================
12962 dnl Setting up the environment.
12963 dnl ===================================================================
12964 AC_MSG_NOTICE([setting up the build environment variables...])
12966 AC_SUBST(COMPATH)
12968 if test "$build_os" = "cygwin"; then
12969     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12970         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12971         ATL_INCLUDE="$COMPATH/atlmfc/include"
12972     elif test -d "$COMPATH/atlmfc/lib"; then
12973         ATL_LIB="$COMPATH/atlmfc/lib"
12974         ATL_INCLUDE="$COMPATH/atlmfc/include"
12975     else
12976         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12977         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12978     fi
12979     if test "$BITNESS_OVERRIDE" = 64; then
12980         ATL_LIB="$ATL_LIB/x64"
12981     else
12982         ATL_LIB="$ATL_LIB/x86"
12983     fi
12984     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12985     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12987     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12988     PathFormat "/usr/bin/find.exe"
12989     FIND="$formatted_path"
12990     PathFormat "/usr/bin/sort.exe"
12991     SORT="$formatted_path"
12992     PathFormat "/usr/bin/grep.exe"
12993     WIN_GREP="$formatted_path"
12994     PathFormat "/usr/bin/ls.exe"
12995     WIN_LS="$formatted_path"
12996     PathFormat "/usr/bin/touch.exe"
12997     WIN_TOUCH="$formatted_path"
12998 else
12999     FIND=find
13000     SORT=sort
13003 AC_SUBST(ATL_INCLUDE)
13004 AC_SUBST(ATL_LIB)
13005 AC_SUBST(FIND)
13006 AC_SUBST(SORT)
13007 AC_SUBST(WIN_GREP)
13008 AC_SUBST(WIN_LS)
13009 AC_SUBST(WIN_TOUCH)
13011 AC_SUBST(BUILD_TYPE)
13013 AC_SUBST(SOLARINC)
13015 PathFormat "$PERL"
13016 PERL="$formatted_path"
13017 AC_SUBST(PERL)
13019 if test -n "$TMPDIR"; then
13020     TEMP_DIRECTORY="$TMPDIR"
13021 else
13022     TEMP_DIRECTORY="/tmp"
13024 if test "$build_os" = "cygwin"; then
13025     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13027 AC_SUBST(TEMP_DIRECTORY)
13029 # setup the PATH for the environment
13030 if test -n "$LO_PATH_FOR_BUILD"; then
13031     LO_PATH="$LO_PATH_FOR_BUILD"
13032 else
13033     LO_PATH="$PATH"
13035     case "$host_os" in
13037     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13038         if test "$ENABLE_JAVA" != ""; then
13039             pathmunge "$JAVA_HOME/bin" "after"
13040         fi
13041         ;;
13043     cygwin*)
13044         # Win32 make needs native paths
13045         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13046             LO_PATH=`cygpath -p -m "$PATH"`
13047         fi
13048         if test "$BITNESS_OVERRIDE" = 64; then
13049             # needed for msi packaging
13050             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13051         fi
13052         # .NET 4.6 and higher don't have bin directory
13053         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13054             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13055         fi
13056         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13057         pathmunge "$CSC_PATH" "before"
13058         pathmunge "$MIDL_PATH" "before"
13059         pathmunge "$AL_PATH" "before"
13060         pathmunge "$MSPDB_PATH" "before"
13061         if test "$MSPDB_PATH" != "$CL_PATH" ; then
13062             pathmunge "$CL_PATH" "before"
13063         fi
13064         if test -n "$MSBUILD_PATH" ; then
13065             pathmunge "$MSBUILD_PATH" "before"
13066         fi
13067         if test "$BITNESS_OVERRIDE" = 64; then
13068             pathmunge "$COMPATH/bin/amd64" "before"
13069             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
13070         else
13071             pathmunge "$COMPATH/bin" "before"
13072             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13073         fi
13074         if test "$ENABLE_JAVA" != ""; then
13075             if test -d "$JAVA_HOME/jre/bin/client"; then
13076                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
13077             fi
13078             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
13079                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
13080             fi
13081             pathmunge "$JAVA_HOME/bin" "before"
13082         fi
13083         ;;
13085     solaris*)
13086         pathmunge "/usr/css/bin" "before"
13087         if test "$ENABLE_JAVA" != ""; then
13088             pathmunge "$JAVA_HOME/bin" "after"
13089         fi
13090         ;;
13091     esac
13094 AC_SUBST(LO_PATH)
13096 libo_FUZZ_SUMMARY
13098 # Generate a configuration sha256 we can use for deps
13099 if test -f config_host.mk; then
13100     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
13102 if test -f config_host_lang.mk; then
13103     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
13106 CFLAGS=$my_original_CFLAGS
13107 CXXFLAGS=$my_original_CXXFLAGS
13108 CPPFLAGS=$my_original_CPPFLAGS
13110 AC_CONFIG_LINKS([include:include])
13111 AC_CONFIG_FILES([config_host.mk
13112                  config_host_lang.mk
13113                  Makefile
13114                  bin/bffvalidator.sh
13115                  bin/odfvalidator.sh
13116                  bin/officeotron.sh
13117                  instsetoo_native/util/openoffice.lst
13118                  setup_native/source/packinfo/finals_instsetoo.txt
13119                  sysui/desktop/macosx/Info.plist])
13120 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13121 AC_CONFIG_HEADERS([config_host/config_clang.h])
13122 AC_CONFIG_HEADERS([config_host/config_dconf.h])
13123 AC_CONFIG_HEADERS([config_host/config_eot.h])
13124 AC_CONFIG_HEADERS([config_host/config_extensions.h])
13125 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13126 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13127 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13128 AC_CONFIG_HEADERS([config_host/config_features.h])
13129 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13130 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13131 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13132 AC_CONFIG_HEADERS([config_host/config_folders.h])
13133 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13134 AC_CONFIG_HEADERS([config_host/config_gio.h])
13135 AC_CONFIG_HEADERS([config_host/config_global.h])
13136 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13137 AC_CONFIG_HEADERS([config_host/config_java.h])
13138 AC_CONFIG_HEADERS([config_host/config_langs.h])
13139 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13140 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13141 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13142 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13143 AC_CONFIG_HEADERS([config_host/config_locales.h])
13144 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13145 AC_CONFIG_HEADERS([config_host/config_oox.h])
13146 AC_CONFIG_HEADERS([config_host/config_options.h])
13147 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13148 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
13149 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13150 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13151 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13152 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13153 AC_CONFIG_HEADERS([config_host/config_version.h])
13154 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13155 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13156 AC_CONFIG_HEADERS([config_host/config_python.h])
13157 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13158 AC_OUTPUT
13160 if test "$CROSS_COMPILING" = TRUE; then
13161     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13164 # touch the config timestamp file
13165 if test ! -f config_host.mk.stamp; then
13166     echo > config_host.mk.stamp
13167 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13168     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13169 else
13170     echo > config_host.mk.stamp
13173 # touch the config lang timestamp file
13174 if test ! -f config_host_lang.mk.stamp; then
13175     echo > config_host_lang.mk.stamp
13176 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13177     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13178 else
13179     echo > config_host_lang.mk.stamp
13183 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13184         -a "$build_os" = "cygwin"; then
13186 cat << _EOS
13187 ****************************************************************************
13188 WARNING:
13189 Your make version is known to be horribly slow, and hard to debug
13190 problems with. To get a reasonably functional make please do:
13192 to install a pre-compiled binary make for Win32
13194  mkdir -p /opt/lo/bin
13195  cd /opt/lo/bin
13196  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13197  cp make-4.2.1-msvc.exe make
13198  chmod +x make
13200 to install from source:
13201 place yourself in a working directory of you choice.
13203  git clone git://git.savannah.gnu.org/make.git
13205  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13206  set PATH=%PATH%;C:\Cygwin\bin
13207  [or Cygwin64, if that is what you have]
13208  cd path-to-make-repo-you-cloned-above
13209  build_w32.bat --without-guile
13211 should result in a WinRel/gnumake.exe.
13212 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13214 Then re-run autogen.sh
13216 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13217 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13219 _EOS
13220 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13221     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13226 cat << _EOF
13227 ****************************************************************************
13229 To build, run:
13230 $GNUMAKE
13232 To view some help, run:
13233 $GNUMAKE help
13235 _EOF
13237 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13238     cat << _EOF
13239 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13240 _EOF
13242     if test $_os = Darwin; then
13243         echo open instdir/$PRODUCTNAME.app
13244     else
13245         echo instdir/program/soffice
13246     fi
13247     cat << _EOF
13249 If you want to run the smoketest, run:
13250 $GNUMAKE check
13252 _EOF
13255 if test -f warn; then
13256     cat warn
13257     rm warn
13260 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: