jsdialog: don't report hidden toolbox items as present.
[LibreOffice.git] / configure.ac
blob32cbef9c17193139647d606db1029905431f74fc
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.1],[],[],[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 libo_FUZZ_ARG_ENABLE([android-editing],
549     AS_HELP_STRING([--enable-android-editing],
550         [Enable the experimental editing feature on Android.])
552 ENABLE_ANDROID_EDITING=
553 if test "$enable_android_editing" = yes; then
554     ENABLE_ANDROID_EDITING=TRUE
556 AC_SUBST([ENABLE_ANDROID_EDITING])
558 dnl ===================================================================
559 dnl The following is a list of supported systems.
560 dnl Sequential to keep the logic very simple
561 dnl These values may be checked and reset later.
562 dnl ===================================================================
563 #defaults unless the os test overrides this:
564 test_randr=yes
565 test_xrender=yes
566 test_cups=yes
567 test_dbus=yes
568 test_fontconfig=yes
569 test_cairo=no
570 test_gdb_index=no
571 test_split_debug=no
573 # Default values, as such probably valid just for Linux, set
574 # differently below just for Mac OSX, but at least better than
575 # hardcoding these as we used to do. Much of this is duplicated also
576 # in solenv for old build system and for gbuild, ideally we should
577 # perhaps define stuff like this only here in configure.ac?
579 LINKFLAGSSHL="-shared"
580 PICSWITCH="-fpic"
581 DLLPOST=".so"
583 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
585 INSTROOTBASESUFFIX=
586 INSTROOTCONTENTSUFFIX=
587 SDKDIRNAME=sdk
589 case "$host_os" in
591 solaris*)
592     build_gstreamer_1_0=yes
593     test_freetype=yes
594     _os=SunOS
596     dnl ===========================================================
597     dnl Check whether we're using Solaris 10 - SPARC or Intel.
598     dnl ===========================================================
599     AC_MSG_CHECKING([the Solaris operating system release])
600     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
601     if test "$_os_release" -lt "10"; then
602         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
603     else
604         AC_MSG_RESULT([ok ($_os_release)])
605     fi
607     dnl Check whether we're using a SPARC or i386 processor
608     AC_MSG_CHECKING([the processor type])
609     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
610         AC_MSG_RESULT([ok ($host_cpu)])
611     else
612         AC_MSG_ERROR([only SPARC and i386 processors are supported])
613     fi
614     ;;
616 linux-gnu*|k*bsd*-gnu*)
617     build_gstreamer_1_0=yes
618     test_kf5=yes
619     test_gtk3_kde5=yes
620     test_gdb_index=yes
621     test_split_debug=yes
622     if test "$enable_fuzzers" != yes; then
623         test_freetype=yes
624         test_fontconfig=yes
625     else
626         test_freetype=no
627         test_fontconfig=no
628         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
629     fi
630     _os=Linux
631     ;;
633 gnu)
634     test_randr=no
635     test_xrender=no
636     _os=GNU
637      ;;
639 cygwin*|interix*)
641     # When building on Windows normally with MSVC under Cygwin,
642     # configure thinks that the host platform (the platform the
643     # built code will run on) is Cygwin, even if it obviously is
644     # Windows, which in Autoconf terminology is called
645     # "mingw32". (Which is misleading as MinGW is the name of the
646     # tool-chain, not an operating system.)
648     # Somewhat confusing, yes. But this configure script doesn't
649     # look at $host etc that much, it mostly uses its own $_os
650     # variable, set here in this case statement.
652     test_cups=no
653     test_dbus=no
654     test_randr=no
655     test_xrender=no
656     test_freetype=no
657     test_fontconfig=no
658     _os=WINNT
660     DLLPOST=".dll"
661     LINKFLAGSNOUNDEFS=
662     ;;
664 darwin*) # macOS or iOS
665     test_randr=no
666     test_xrender=no
667     test_freetype=no
668     test_fontconfig=no
669     test_dbus=no
670     if test -n "$LODE_HOME" ; then
671         mac_sanitize_path
672         AC_MSG_NOTICE([sanitized the PATH to $PATH])
673     fi
674     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
675         build_for_ios=YES
676         _os=iOS
677         test_cups=no
678         enable_mpl_subset=yes
679         enable_lotuswordpro=no
680         enable_coinmp=no
681         enable_lpsolve=no
682         enable_postgresql_sdbc=no
683         enable_extension_integration=no
684         enable_report_builder=no
685         with_ppds=no
686         if test "$enable_ios_simulator" = "yes"; then
687             host=x86_64-apple-darwin
688         fi
689     else
690         _os=Darwin
691         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
692         INSTROOTCONTENTSUFFIX=/Contents
693         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
694     fi
695     # See comment above the case "$host_os"
696     LINKFLAGSSHL="-dynamiclib -single_module"
698     # -fPIC is default
699     PICSWITCH=""
701     DLLPOST=".dylib"
703     # -undefined error is the default
704     LINKFLAGSNOUNDEFS=""
707 freebsd*)
708     build_gstreamer_1_0=yes
709     test_kf5=yes
710     test_gtk3_kde5=yes
711     test_freetype=yes
712     AC_MSG_CHECKING([the FreeBSD operating system release])
713     if test -n "$with_os_version"; then
714         OSVERSION="$with_os_version"
715     else
716         OSVERSION=`/sbin/sysctl -n kern.osreldate`
717     fi
718     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
719     AC_MSG_CHECKING([which thread library to use])
720     if test "$OSVERSION" -lt "500016"; then
721         PTHREAD_CFLAGS="-D_THREAD_SAFE"
722         PTHREAD_LIBS="-pthread"
723     elif test "$OSVERSION" -lt "502102"; then
724         PTHREAD_CFLAGS="-D_THREAD_SAFE"
725         PTHREAD_LIBS="-lc_r"
726     else
727         PTHREAD_CFLAGS=""
728         PTHREAD_LIBS="-pthread"
729     fi
730     AC_MSG_RESULT([$PTHREAD_LIBS])
731     _os=FreeBSD
732     ;;
734 *netbsd*)
735     build_gstreamer_1_0=yes
736     test_kf5=yes
737     test_gtk3_kde5=yes
738     test_freetype=yes
739     PTHREAD_LIBS="-pthread -lpthread"
740     _os=NetBSD
741     ;;
743 aix*)
744     test_randr=no
745     test_freetype=yes
746     PTHREAD_LIBS=-pthread
747     _os=AIX
748     ;;
750 openbsd*)
751     test_freetype=yes
752     PTHREAD_CFLAGS="-D_THREAD_SAFE"
753     PTHREAD_LIBS="-pthread"
754     _os=OpenBSD
755     ;;
757 dragonfly*)
758     build_gstreamer_1_0=yes
759     test_kf5=yes
760     test_gtk3_kde5=yes
761     test_freetype=yes
762     PTHREAD_LIBS="-pthread"
763     _os=DragonFly
764     ;;
766 linux-android*)
767     build_gstreamer_1_0=no
768     enable_lotuswordpro=no
769     enable_mpl_subset=yes
770     enable_coinmp=yes
771     enable_lpsolve=no
772     enable_report_builder=no
773     enable_odk=no
774     enable_postgresql_sdbc=no
775     enable_python=no
776     test_cups=no
777     test_dbus=no
778     test_fontconfig=no
779     test_freetype=no
780     test_kf5=no
781     test_qt5=no
782     test_gtk3_kde5=no
783     test_randr=no
784     test_xrender=no
785     _os=Android
787     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
788     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
789     ;;
791 haiku*)
792     test_cups=no
793     test_dbus=no
794     test_randr=no
795     test_xrender=no
796     test_freetype=yes
797     enable_odk=no
798     enable_gstreamer_1_0=no
799     enable_vlc=no
800     enable_coinmp=no
801     enable_pdfium=no
802     enable_sdremote=no
803     enable_postgresql_sdbc=no
804     enable_firebird_sdbc=no
805     _os=Haiku
806     ;;
809     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
810     ;;
811 esac
813 if test "$_os" = "Android" ; then
814     # Verify that the NDK and SDK options are proper
815     if test -z "$with_android_ndk"; then
816         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
817     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
818         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
819     fi
821     if test -z "$ANDROID_SDK_HOME"; then
822         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
823     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
824         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
825     fi
827     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
828     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
829         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
830                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
831                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
832         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
833         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
834         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
835     fi
836     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
837         AC_MSG_WARN([android support repository not found - install with
838                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
839                      to allow the build to download the specified version of the android support libraries])
840         add_warning "android support repository not found - install with"
841         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
842         add_warning "to allow the build to download the specified version of the android support libraries"
843     fi
846 if test "$_os" = "AIX"; then
847     AC_PATH_PROG(GAWK, gawk)
848     if test -z "$GAWK"; then
849         AC_MSG_ERROR([gawk not found in \$PATH])
850     fi
853 AC_SUBST(SDKDIRNAME)
855 AC_SUBST(PTHREAD_CFLAGS)
856 AC_SUBST(PTHREAD_LIBS)
858 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
859 # By default use the ones specified by our build system,
860 # but explicit override is possible.
861 AC_MSG_CHECKING(for explicit AFLAGS)
862 if test -n "$AFLAGS"; then
863     AC_MSG_RESULT([$AFLAGS])
864     x_AFLAGS=
865 else
866     AC_MSG_RESULT(no)
867     x_AFLAGS=[\#]
869 AC_MSG_CHECKING(for explicit CFLAGS)
870 if test -n "$CFLAGS"; then
871     AC_MSG_RESULT([$CFLAGS])
872     x_CFLAGS=
873 else
874     AC_MSG_RESULT(no)
875     x_CFLAGS=[\#]
877 AC_MSG_CHECKING(for explicit CXXFLAGS)
878 if test -n "$CXXFLAGS"; then
879     AC_MSG_RESULT([$CXXFLAGS])
880     x_CXXFLAGS=
881 else
882     AC_MSG_RESULT(no)
883     x_CXXFLAGS=[\#]
885 AC_MSG_CHECKING(for explicit OBJCFLAGS)
886 if test -n "$OBJCFLAGS"; then
887     AC_MSG_RESULT([$OBJCFLAGS])
888     x_OBJCFLAGS=
889 else
890     AC_MSG_RESULT(no)
891     x_OBJCFLAGS=[\#]
893 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
894 if test -n "$OBJCXXFLAGS"; then
895     AC_MSG_RESULT([$OBJCXXFLAGS])
896     x_OBJCXXFLAGS=
897 else
898     AC_MSG_RESULT(no)
899     x_OBJCXXFLAGS=[\#]
901 AC_MSG_CHECKING(for explicit LDFLAGS)
902 if test -n "$LDFLAGS"; then
903     AC_MSG_RESULT([$LDFLAGS])
904     x_LDFLAGS=
905 else
906     AC_MSG_RESULT(no)
907     x_LDFLAGS=[\#]
909 AC_SUBST(AFLAGS)
910 AC_SUBST(CFLAGS)
911 AC_SUBST(CXXFLAGS)
912 AC_SUBST(OBJCFLAGS)
913 AC_SUBST(OBJCXXFLAGS)
914 AC_SUBST(LDFLAGS)
915 AC_SUBST(x_AFLAGS)
916 AC_SUBST(x_CFLAGS)
917 AC_SUBST(x_CXXFLAGS)
918 AC_SUBST(x_OBJCFLAGS)
919 AC_SUBST(x_OBJCXXFLAGS)
920 AC_SUBST(x_LDFLAGS)
922 dnl These are potentially set for MSVC, in the code checking for UCRT below:
923 my_original_CFLAGS=$CFLAGS
924 my_original_CXXFLAGS=$CXXFLAGS
925 my_original_CPPFLAGS=$CPPFLAGS
927 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
928 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
929 dnl AC_PROG_CC internally.
930 if test "$_os" != "WINNT"; then
931     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
932     save_CFLAGS=$CFLAGS
933     AC_PROG_CC
934     CFLAGS=$save_CFLAGS
935     if test -z "$CC_BASE"; then
936         CC_BASE=`first_arg_basename "$CC"`
937     fi
940 if test "$_os" != "WINNT"; then
941     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
942 else
943     ENDIANNESS=little
945 AC_SUBST(ENDIANNESS)
947 if test $_os != "WINNT"; then
948     save_LIBS="$LIBS"
949     AC_SEARCH_LIBS([dlsym], [dl],
950         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
951         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
952     LIBS="$save_LIBS"
954 AC_SUBST(DLOPEN_LIBS)
956 AC_ARG_ENABLE(ios-simulator,
957     AS_HELP_STRING([--enable-ios-simulator],
958         [build i386 or x86_64 for ios simulator])
961 AC_ARG_ENABLE(ios-libreofficelight-app,
962     AS_HELP_STRING([--enable-ios-libreofficelight-app],
963         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
964          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
965          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
968 ENABLE_IOS_LIBREOFFICELIGHT_APP=
969 if test "$enable_ios_libreofficelight_app" = yes; then
970     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
972 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
974 ###############################################################################
975 # Extensions switches --enable/--disable
976 ###############################################################################
977 # By default these should be enabled unless having extra dependencies.
978 # If there is extra dependency over configure options then the enable should
979 # be automagic based on whether the requiring feature is enabled or not.
980 # All this options change anything only with --enable-extension-integration.
982 # The name of this option and its help string makes it sound as if
983 # extensions are built anyway, just not integrated in the installer,
984 # if you use --disable-extension-integration. Is that really the
985 # case?
987 libo_FUZZ_ARG_ENABLE(extension-integration,
988     AS_HELP_STRING([--disable-extension-integration],
989         [Disable integration of the built extensions in the installer of the
990          product. Use this switch to disable the integration.])
993 AC_ARG_ENABLE(avmedia,
994     AS_HELP_STRING([--disable-avmedia],
995         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
998 AC_ARG_ENABLE(database-connectivity,
999     AS_HELP_STRING([--disable-database-connectivity],
1000         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1003 # This doesn't mean not building (or "integrating") extensions
1004 # (although it probably should; i.e. it should imply
1005 # --disable-extension-integration I guess), it means not supporting
1006 # any extension mechanism at all
1007 libo_FUZZ_ARG_ENABLE(extensions,
1008     AS_HELP_STRING([--disable-extensions],
1009         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1012 AC_ARG_ENABLE(scripting,
1013     AS_HELP_STRING([--disable-scripting],
1014         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1017 # This is mainly for Android and iOS, but could potentially be used in some
1018 # special case otherwise, too, so factored out as a separate setting
1020 AC_ARG_ENABLE(dynamic-loading,
1021     AS_HELP_STRING([--disable-dynamic-loading],
1022         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1025 libo_FUZZ_ARG_ENABLE(report-builder,
1026     AS_HELP_STRING([--disable-report-builder],
1027         [Disable the Report Builder.])
1030 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1031     AS_HELP_STRING([--enable-ext-wiki-publisher],
1032         [Enable the Wiki Publisher extension.])
1035 libo_FUZZ_ARG_ENABLE(lpsolve,
1036     AS_HELP_STRING([--disable-lpsolve],
1037         [Disable compilation of the lp solve solver ])
1039 libo_FUZZ_ARG_ENABLE(coinmp,
1040     AS_HELP_STRING([--disable-coinmp],
1041         [Disable compilation of the CoinMP solver ])
1044 libo_FUZZ_ARG_ENABLE(pdfimport,
1045     AS_HELP_STRING([--disable-pdfimport],
1046         [Disable building the PDF import feature.])
1049 libo_FUZZ_ARG_ENABLE(pdfium,
1050     AS_HELP_STRING([--disable-pdfium],
1051         [Disable building PDFium.])
1054 ###############################################################################
1056 dnl ---------- *** ----------
1058 libo_FUZZ_ARG_ENABLE(mergelibs,
1059     AS_HELP_STRING([--enable-mergelibs],
1060         [Merge several of the smaller libraries into one big, "merged", one.])
1063 libo_FUZZ_ARG_ENABLE(breakpad,
1064     AS_HELP_STRING([--enable-breakpad],
1065         [Enables breakpad for crash reporting.])
1068 libo_FUZZ_ARG_ENABLE(crashdump,
1069     AS_HELP_STRING([--disable-crashdump],
1070         [Disable dump.ini and dump-file, when --enable-breakpad])
1073 AC_ARG_ENABLE(fetch-external,
1074     AS_HELP_STRING([--disable-fetch-external],
1075         [Disables fetching external tarballs from web sources.])
1078 AC_ARG_ENABLE(fuzzers,
1079     AS_HELP_STRING([--enable-fuzzers],
1080         [Enables building libfuzzer targets for fuzz testing.])
1083 libo_FUZZ_ARG_ENABLE(pch,
1084     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1085         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1086          Using 'system' will include only external headers, 'base' will add also headers
1087          from base modules, 'normal' will also add all headers except from the module built,
1088          'full' will use all suitable headers even from a module itself.])
1091 libo_FUZZ_ARG_ENABLE(epm,
1092     AS_HELP_STRING([--enable-epm],
1093         [LibreOffice includes self-packaging code, that requires epm, however epm is
1094          useless for large scale package building.])
1097 libo_FUZZ_ARG_ENABLE(odk,
1098     AS_HELP_STRING([--disable-odk],
1099         [LibreOffice includes an ODK, office development kit which some packagers may
1100          wish to build without.])
1103 AC_ARG_ENABLE(mpl-subset,
1104     AS_HELP_STRING([--enable-mpl-subset],
1105         [Don't compile any pieces which are not MPL or more liberally licensed])
1108 libo_FUZZ_ARG_ENABLE(evolution2,
1109     AS_HELP_STRING([--enable-evolution2],
1110         [Allows the built-in evolution 2 addressbook connectivity build to be
1111          enabled.])
1114 AC_ARG_ENABLE(avahi,
1115     AS_HELP_STRING([--enable-avahi],
1116         [Determines whether to use Avahi to advertise Impress to remote controls.])
1119 libo_FUZZ_ARG_ENABLE(werror,
1120     AS_HELP_STRING([--enable-werror],
1121         [Turn warnings to errors. (Has no effect in modules where the treating
1122          of warnings as errors is disabled explicitly.)]),
1125 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1126     AS_HELP_STRING([--enable-assert-always-abort],
1127         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1130 libo_FUZZ_ARG_ENABLE(dbgutil,
1131     AS_HELP_STRING([--enable-dbgutil],
1132         [Provide debugging support from --enable-debug and include additional debugging
1133          utilities such as object counting or more expensive checks.
1134          This is the recommended option for developers.
1135          Note that this makes the build ABI incompatible, it is not possible to mix object
1136          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1138 libo_FUZZ_ARG_ENABLE(debug,
1139     AS_HELP_STRING([--enable-debug],
1140         [Include debugging information, disable compiler optimization and inlining plus
1141          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1143 libo_FUZZ_ARG_ENABLE(split-debug,
1144     AS_HELP_STRING([--disable-split-debug],
1145         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1146          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1148 libo_FUZZ_ARG_ENABLE(gdb-index,
1149     AS_HELP_STRING([--disable-gdb-index],
1150         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1151          The feature requires the gold or lld linker.]))
1153 libo_FUZZ_ARG_ENABLE(sal-log,
1154     AS_HELP_STRING([--enable-sal-log],
1155         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1157 libo_FUZZ_ARG_ENABLE(symbols,
1158     AS_HELP_STRING([--enable-symbols],
1159         [Generate debug information.
1160          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1161          otherwise. It is possible to explicitly specify gbuild build targets
1162          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1163          everything in the directory; there is no ordering, more specific overrides
1164          more general, and disabling takes precedence).
1165          Example: --enable-symbols="all -sw/ -Library_sc".]))
1167 libo_FUZZ_ARG_ENABLE(optimized,
1168     AS_HELP_STRING([--disable-optimized],
1169         [Whether to compile with optimization flags.
1170          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1171          otherwise.]))
1173 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1174     AS_HELP_STRING([--disable-runtime-optimizations],
1175         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1176          JVM JIT) that are known to interact badly with certain dynamic analysis
1177          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1178          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1179          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1181 AC_ARG_WITH(valgrind,
1182     AS_HELP_STRING([--with-valgrind],
1183         [Make availability of Valgrind headers a hard requirement.]))
1185 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1186     AS_HELP_STRING([--enable-compiler-plugins],
1187         [Enable compiler plugins that will perform additional checks during
1188          building. Enabled automatically by --enable-dbgutil.
1189          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1190 COMPILER_PLUGINS_DEBUG=
1191 if test "$enable_compiler_plugins" = debug; then
1192     enable_compiler_plugins=yes
1193     COMPILER_PLUGINS_DEBUG=TRUE
1196 libo_FUZZ_ARG_ENABLE(ooenv,
1197     AS_HELP_STRING([--disable-ooenv],
1198         [Disable ooenv for the instdir installation.]))
1200 libo_FUZZ_ARG_ENABLE(libnumbertext,
1201     AS_HELP_STRING([--disable-libnumbertext],
1202         [Disable use of numbertext external library.]))
1204 AC_ARG_ENABLE(lto,
1205     AS_HELP_STRING([--enable-lto],
1206         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1207          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1208          linker. For MSVC, this option is broken at the moment. This is experimental work
1209          in progress that shouldn't be used unless you are working on it.)]))
1211 AC_ARG_ENABLE(python,
1212     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1213         [Enables or disables Python support at run-time.
1214          Also specifies what Python to use. 'auto' is the default.
1215          'fully-internal' even forces the internal version for uses of Python
1216          during the build.]))
1218 libo_FUZZ_ARG_ENABLE(gtk3,
1219     AS_HELP_STRING([--disable-gtk3],
1220         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1221 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1223 AC_ARG_ENABLE(introspection,
1224     AS_HELP_STRING([--enable-introspection],
1225         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1226          Linux distributions.)]))
1228 AC_ARG_ENABLE(split-app-modules,
1229     AS_HELP_STRING([--enable-split-app-modules],
1230         [Split file lists for app modules, e.g. base, calc.
1231          Has effect only with make distro-pack-install]),
1234 AC_ARG_ENABLE(split-opt-features,
1235     AS_HELP_STRING([--enable-split-opt-features],
1236         [Split file lists for some optional features, e.g. pyuno, testtool.
1237          Has effect only with make distro-pack-install]),
1240 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1241     AS_HELP_STRING([--disable-cairo-canvas],
1242         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1245 libo_FUZZ_ARG_ENABLE(dbus,
1246     AS_HELP_STRING([--disable-dbus],
1247         [Determines whether to enable features that depend on dbus.
1248          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1249 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1251 libo_FUZZ_ARG_ENABLE(sdremote,
1252     AS_HELP_STRING([--disable-sdremote],
1253         [Determines whether to enable Impress remote control (i.e. the server component).]),
1254 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1256 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1257     AS_HELP_STRING([--disable-sdremote-bluetooth],
1258         [Determines whether to build sdremote with bluetooth support.
1259          Requires dbus on Linux.]))
1261 libo_FUZZ_ARG_ENABLE(gio,
1262     AS_HELP_STRING([--disable-gio],
1263         [Determines whether to use the GIO support.]),
1264 ,test "${enable_gio+set}" = set || enable_gio=yes)
1266 AC_ARG_ENABLE(qt5,
1267     AS_HELP_STRING([--enable-qt5],
1268         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1269          available.]),
1272 AC_ARG_ENABLE(kf5,
1273     AS_HELP_STRING([--enable-kf5],
1274         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1275          KF5 are available.]),
1278 AC_ARG_ENABLE(kde5,
1279     AS_HELP_STRING([--enable-kde5],
1280         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1283 AC_ARG_ENABLE(gtk3_kde5,
1284     AS_HELP_STRING([--enable-gtk3-kde5],
1285         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1286          platforms where Gtk3, Qt5 and Plasma is available.]),
1289 AC_ARG_ENABLE(gui,
1290     AS_HELP_STRING([--disable-gui],
1291         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1292 ,enable_gui=yes)
1294 libo_FUZZ_ARG_ENABLE(randr,
1295     AS_HELP_STRING([--disable-randr],
1296         [Disable RandR support in the vcl project.]),
1297 ,test "${enable_randr+set}" = set || enable_randr=yes)
1299 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1300     AS_HELP_STRING([--disable-gstreamer-1-0],
1301         [Disable building with the gstreamer 1.0 avmedia backend.]),
1302 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1304 libo_FUZZ_ARG_ENABLE(vlc,
1305     AS_HELP_STRING([--enable-vlc],
1306         [Enable building with the (experimental) VLC avmedia backend.]),
1307 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1309 libo_FUZZ_ARG_ENABLE(neon,
1310     AS_HELP_STRING([--disable-neon],
1311         [Disable neon and the compilation of webdav binding.]),
1314 libo_FUZZ_ARG_ENABLE([eot],
1315     [AS_HELP_STRING([--enable-eot],
1316         [Enable support for Embedded OpenType fonts.])],
1317 ,test "${enable_eot+set}" = set || enable_eot=no)
1319 libo_FUZZ_ARG_ENABLE(cve-tests,
1320     AS_HELP_STRING([--disable-cve-tests],
1321         [Prevent CVE tests to be executed]),
1324 libo_FUZZ_ARG_ENABLE(chart-tests,
1325     AS_HELP_STRING([--enable-chart-tests],
1326         [Executes chart XShape tests. In a perfect world these tests would be
1327          stable and everyone could run them, in reality it is best to run them
1328          only on a few machines that are known to work and maintained by people
1329          who can judge if a test failure is a regression or not.]),
1332 AC_ARG_ENABLE(build-unowinreg,
1333     AS_HELP_STRING([--enable-build-unowinreg],
1334         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1335          compiler is needed on Linux.]),
1338 AC_ARG_ENABLE(build-opensymbol,
1339     AS_HELP_STRING([--enable-build-opensymbol],
1340         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1341          fontforge installed.]),
1344 AC_ARG_ENABLE(dependency-tracking,
1345     AS_HELP_STRING([--enable-dependency-tracking],
1346         [Do not reject slow dependency extractors.])[
1347   --disable-dependency-tracking
1348                           Disables generation of dependency information.
1349                           Speed up one-time builds.],
1352 AC_ARG_ENABLE(icecream,
1353     AS_HELP_STRING([--enable-icecream],
1354         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1355          It defaults to /opt/icecream for the location of the icecream gcc/g++
1356          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1359 AC_ARG_ENABLE(ld,
1360     AS_HELP_STRING([--enable-ld=<linker>],
1361         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1362          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1365 libo_FUZZ_ARG_ENABLE(cups,
1366     AS_HELP_STRING([--disable-cups],
1367         [Do not build cups support.])
1370 AC_ARG_ENABLE(ccache,
1371     AS_HELP_STRING([--disable-ccache],
1372         [Do not try to use ccache automatically.
1373          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1374          CC/CXX are not yet set, and --enable-icecream is not given, we
1375          attempt to use ccache. --disable-ccache disables ccache completely.
1376          Additionally ccache's depend mode is enabled if possible,
1377          use --enable-ccache=nodepend to enable ccache without depend mode.
1381 AC_ARG_ENABLE(64-bit,
1382     AS_HELP_STRING([--enable-64-bit],
1383         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1384          At the moment meaningful only for Windows.]), ,)
1386 libo_FUZZ_ARG_ENABLE(online-update,
1387     AS_HELP_STRING([--enable-online-update],
1388         [Enable the online update service that will check for new versions of
1389          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1390          If the value is "mar", the experimental Mozilla-like update will be
1391          enabled instead of the traditional update mechanism.]),
1394 AC_ARG_WITH(update-config,
1395     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1396                    [Path to the update config ini file]))
1398 libo_FUZZ_ARG_ENABLE(extension-update,
1399     AS_HELP_STRING([--disable-extension-update],
1400         [Disable possibility to update installed extensions.]),
1403 libo_FUZZ_ARG_ENABLE(release-build,
1404     AS_HELP_STRING([--enable-release-build],
1405         [Enable release build. Note that the "release build" choice is orthogonal to
1406          whether symbols are present, debug info is generated, or optimization
1407          is done.
1408          See http://wiki.documentfoundation.org/Development/DevBuild]),
1411 AC_ARG_ENABLE(windows-build-signing,
1412     AS_HELP_STRING([--enable-windows-build-signing],
1413         [Enable signing of windows binaries (*.exe, *.dll)]),
1416 AC_ARG_ENABLE(silent-msi,
1417     AS_HELP_STRING([--enable-silent-msi],
1418         [Enable MSI with LIMITUI=1 (silent install).]),
1421 AC_ARG_ENABLE(macosx-code-signing,
1422     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1423         [Sign executables, dylibs, frameworks and the app bundle. If you
1424          don't provide an identity the first suitable certificate
1425          in your keychain is used.]),
1428 AC_ARG_ENABLE(macosx-package-signing,
1429     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1430         [Create a .pkg suitable for uploading to the Mac App Store and sign
1431          it. If you don't provide an identity the first suitable certificate
1432          in your keychain is used.]),
1435 AC_ARG_ENABLE(macosx-sandbox,
1436     AS_HELP_STRING([--enable-macosx-sandbox],
1437         [Make the app bundle run in a sandbox. Requires code signing.
1438          Is required by apps distributed in the Mac App Store, and implies
1439          adherence to App Store rules.]),
1442 AC_ARG_WITH(macosx-bundle-identifier,
1443     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1444         [Define the macOS bundle identifier. Default is the somewhat weird
1445          org.libreoffice.script ("script", huh?).]),
1446 ,with_macosx_bundle_identifier=org.libreoffice.script)
1448 AC_ARG_WITH(product-name,
1449     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1450         [Define the product name. Default is AC_PACKAGE_NAME.]),
1451 ,with_product_name=$PRODUCTNAME)
1453 AC_ARG_WITH(package-version,
1454     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1455         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1458 libo_FUZZ_ARG_ENABLE(readonly-installset,
1459     AS_HELP_STRING([--enable-readonly-installset],
1460         [Prevents any attempts by LibreOffice to write into its installation. That means
1461          at least that no "system-wide" extensions can be added. Partly experimental work in
1462          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1465 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1466     AS_HELP_STRING([--disable-postgresql-sdbc],
1467         [Disable the build of the PostgreSQL-SDBC driver.])
1470 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1471     AS_HELP_STRING([--disable-lotuswordpro],
1472         [Disable the build of the Lotus Word Pro filter.]),
1473 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1475 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1476     AS_HELP_STRING([--disable-firebird-sdbc],
1477         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1478 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1480 AC_ARG_ENABLE(bogus-pkg-config,
1481     AS_HELP_STRING([--enable-bogus-pkg-config],
1482         [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.]),
1485 AC_ARG_ENABLE(openssl,
1486     AS_HELP_STRING([--disable-openssl],
1487         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1488          components will either use GNUTLS or NSS. Work in progress,
1489          use only if you are hacking on it.]),
1490 ,enable_openssl=yes)
1492 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1493     AS_HELP_STRING([--enable-cipher-openssl-backend],
1494         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1495          Requires --enable-openssl.]))
1497 AC_ARG_ENABLE(library-bin-tar,
1498     AS_HELP_STRING([--enable-library-bin-tar],
1499         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1500         Some libraries can save their build result in a tarball
1501         stored in TARFILE_LOCATION. That binary tarball is
1502         uniquely identified by the source tarball,
1503         the content of the config_host.mk file and the content
1504         of the top-level directory in core for that library
1505         If this option is enabled, then if such a tarfile exist, it will be untarred
1506         instead of the source tarfile, and the build step will be skipped for that
1507         library.
1508         If a proper tarfile does not exist, then the normal source-based
1509         build is done for that library and a proper binary tarfile is created
1510         for the next time.]),
1513 AC_ARG_ENABLE(dconf,
1514     AS_HELP_STRING([--disable-dconf],
1515         [Disable the dconf configuration backend (enabled by default where
1516          available).]))
1518 libo_FUZZ_ARG_ENABLE(formula-logger,
1519     AS_HELP_STRING(
1520         [--enable-formula-logger],
1521         [Enable formula logger for logging formula calculation flow in Calc.]
1522     )
1525 AC_ARG_ENABLE(ldap,
1526     AS_HELP_STRING([--disable-ldap],
1527         [Disable LDAP support.]),
1528 ,enable_ldap=yes)
1530 dnl ===================================================================
1531 dnl Optional Packages (--with/without-)
1532 dnl ===================================================================
1534 AC_ARG_WITH(gcc-home,
1535     AS_HELP_STRING([--with-gcc-home],
1536         [Specify the location of gcc/g++ manually. This can be used in conjunction
1537          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1538          non-default path.]),
1541 AC_ARG_WITH(gnu-patch,
1542     AS_HELP_STRING([--with-gnu-patch],
1543         [Specify location of GNU patch on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(build-platform-configure-options,
1547     AS_HELP_STRING([--with-build-platform-configure-options],
1548         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1551 AC_ARG_WITH(gnu-cp,
1552     AS_HELP_STRING([--with-gnu-cp],
1553         [Specify location of GNU cp on Solaris or FreeBSD.]),
1556 AC_ARG_WITH(external-tar,
1557     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1558         [Specify an absolute path of where to find (and store) tarfiles.]),
1559     TARFILE_LOCATION=$withval ,
1562 AC_ARG_WITH(referenced-git,
1563     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1564         [Specify another checkout directory to reference. This makes use of
1565                  git submodule update --reference, and saves a lot of diskspace
1566                  when having multiple trees side-by-side.]),
1567     GIT_REFERENCE_SRC=$withval ,
1570 AC_ARG_WITH(linked-git,
1571     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1572         [Specify a directory where the repositories of submodules are located.
1573          This uses a method similar to git-new-workdir to get submodules.]),
1574     GIT_LINK_SRC=$withval ,
1577 AC_ARG_WITH(galleries,
1578     AS_HELP_STRING([--with-galleries],
1579         [Specify how galleries should be built. It is possible either to
1580          build these internally from source ("build"),
1581          or to disable them ("no")]),
1584 AC_ARG_WITH(theme,
1585     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1586         [Choose which themes to include. By default those themes with an '*' are included.
1587          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1588          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1591 libo_FUZZ_ARG_WITH(helppack-integration,
1592     AS_HELP_STRING([--without-helppack-integration],
1593         [It will not integrate the helppacks to the installer
1594          of the product. Please use this switch to use the online help
1595          or separate help packages.]),
1598 libo_FUZZ_ARG_WITH(fonts,
1599     AS_HELP_STRING([--without-fonts],
1600         [LibreOffice includes some third-party fonts to provide a reliable basis for
1601          help content, templates, samples, etc. When these fonts are already
1602          known to be available on the system then you should use this option.]),
1605 AC_ARG_ENABLE(noto-font,
1606     AS_HELP_STRING([--enable-noto-font],
1607         [Add more Google Noto fonts.]),
1610 AC_ARG_WITH(epm,
1611     AS_HELP_STRING([--with-epm],
1612         [Decides which epm to use. Default is to use the one from the system if
1613          one is built. When either this is not there or you say =internal epm
1614          will be built.]),
1617 AC_ARG_WITH(package-format,
1618     AS_HELP_STRING([--with-package-format],
1619         [Specify package format(s) for LibreOffice installation sets. The
1620          implicit --without-package-format leads to no installation sets being
1621          generated. Possible values: aix, archive, bsd, deb, dmg,
1622          installed, msi, pkg, and rpm.
1623          Example: --with-package-format='deb rpm']),
1626 AC_ARG_WITH(tls,
1627     AS_HELP_STRING([--with-tls],
1628         [Decides which TLS/SSL and cryptographic implementations to use for
1629          LibreOffice's code. Notice that this doesn't apply for depending
1630          libraries like "neon", for example. Default is to use OpenSSL
1631          although NSS is also possible. Notice that selecting NSS restricts
1632          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1633          restrict by now the usage of NSS in LO's code. Possible values:
1634          openssl, nss. Example: --with-tls="nss"]),
1637 AC_ARG_WITH(system-libs,
1638     AS_HELP_STRING([--with-system-libs],
1639         [Use libraries already on system -- enables all --with-system-* flags.]),
1642 AC_ARG_WITH(system-bzip2,
1643     AS_HELP_STRING([--with-system-bzip2],
1644         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1645     [with_system_bzip2="$with_system_libs"])
1647 AC_ARG_WITH(system-headers,
1648     AS_HELP_STRING([--with-system-headers],
1649         [Use headers already on system -- enables all --with-system-* flags for
1650          external packages whose headers are the only entities used i.e.
1651          boost/odbc/sane-header(s).]),,
1652     [with_system_headers="$with_system_libs"])
1654 AC_ARG_WITH(system-jars,
1655     AS_HELP_STRING([--without-system-jars],
1656         [When building with --with-system-libs, also the needed jars are expected
1657          on the system. Use this to disable that]),,
1658     [with_system_jars="$with_system_libs"])
1660 AC_ARG_WITH(system-cairo,
1661     AS_HELP_STRING([--with-system-cairo],
1662         [Use cairo libraries already on system.  Happens automatically for
1663          (implicit) --enable-gtk3.]))
1665 AC_ARG_WITH(system-epoxy,
1666     AS_HELP_STRING([--with-system-epoxy],
1667         [Use epoxy libraries already on system.  Happens automatically for
1668          (implicit) --enable-gtk3.]),,
1669        [with_system_epoxy="$with_system_libs"])
1671 AC_ARG_WITH(myspell-dicts,
1672     AS_HELP_STRING([--with-myspell-dicts],
1673         [Adds myspell dictionaries to the LibreOffice installation set]),
1676 AC_ARG_WITH(system-dicts,
1677     AS_HELP_STRING([--without-system-dicts],
1678         [Do not use dictionaries from system paths.]),
1681 AC_ARG_WITH(external-dict-dir,
1682     AS_HELP_STRING([--with-external-dict-dir],
1683         [Specify external dictionary dir.]),
1686 AC_ARG_WITH(external-hyph-dir,
1687     AS_HELP_STRING([--with-external-hyph-dir],
1688         [Specify external hyphenation pattern dir.]),
1691 AC_ARG_WITH(external-thes-dir,
1692     AS_HELP_STRING([--with-external-thes-dir],
1693         [Specify external thesaurus dir.]),
1696 AC_ARG_WITH(system-zlib,
1697     AS_HELP_STRING([--with-system-zlib],
1698         [Use zlib already on system.]),,
1699     [with_system_zlib=auto])
1701 AC_ARG_WITH(system-jpeg,
1702     AS_HELP_STRING([--with-system-jpeg],
1703         [Use jpeg already on system.]),,
1704     [with_system_jpeg="$with_system_libs"])
1706 AC_ARG_WITH(system-clucene,
1707     AS_HELP_STRING([--with-system-clucene],
1708         [Use clucene already on system.]),,
1709     [with_system_clucene="$with_system_libs"])
1711 AC_ARG_WITH(system-expat,
1712     AS_HELP_STRING([--with-system-expat],
1713         [Use expat already on system.]),,
1714     [with_system_expat="$with_system_libs"])
1716 AC_ARG_WITH(system-libxml,
1717     AS_HELP_STRING([--with-system-libxml],
1718         [Use libxml/libxslt already on system.]),,
1719     [with_system_libxml=auto])
1721 AC_ARG_WITH(system-icu,
1722     AS_HELP_STRING([--with-system-icu],
1723         [Use icu already on system.]),,
1724     [with_system_icu="$with_system_libs"])
1726 AC_ARG_WITH(system-ucpp,
1727     AS_HELP_STRING([--with-system-ucpp],
1728         [Use ucpp already on system.]),,
1729     [])
1731 AC_ARG_WITH(system-openldap,
1732     AS_HELP_STRING([--with-system-openldap],
1733         [Use the OpenLDAP LDAP SDK already on system.]),,
1734     [with_system_openldap="$with_system_libs"])
1736 libo_FUZZ_ARG_ENABLE(poppler,
1737     AS_HELP_STRING([--disable-poppler],
1738         [Disable building Poppler.])
1741 AC_ARG_WITH(system-poppler,
1742     AS_HELP_STRING([--with-system-poppler],
1743         [Use system poppler (only needed for PDF import).]),,
1744     [with_system_poppler="$with_system_libs"])
1746 AC_ARG_WITH(system-gpgmepp,
1747     AS_HELP_STRING([--with-system-gpgmepp],
1748         [Use gpgmepp already on system]),,
1749     [with_system_gpgmepp="$with_system_libs"])
1751 AC_ARG_WITH(system-apache-commons,
1752     AS_HELP_STRING([--with-system-apache-commons],
1753         [Use Apache commons libraries already on system.]),,
1754     [with_system_apache_commons="$with_system_jars"])
1756 AC_ARG_WITH(system-mariadb,
1757     AS_HELP_STRING([--with-system-mariadb],
1758         [Use MariaDB/MySQL libraries already on system.]),,
1759     [with_system_mariadb="$with_system_libs"])
1761 AC_ARG_ENABLE(bundle-mariadb,
1762     AS_HELP_STRING([--enable-bundle-mariadb],
1763         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1766 AC_ARG_WITH(system-postgresql,
1767     AS_HELP_STRING([--with-system-postgresql],
1768         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1769          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1770     [with_system_postgresql="$with_system_libs"])
1772 AC_ARG_WITH(libpq-path,
1773     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1774         [Use this PostgreSQL C interface (libpq) installation for building
1775          the PostgreSQL-SDBC extension.]),
1778 AC_ARG_WITH(system-firebird,
1779     AS_HELP_STRING([--with-system-firebird],
1780         [Use Firebird libraries already on system, for building the Firebird-SDBC
1781          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1782     [with_system_firebird="$with_system_libs"])
1784 AC_ARG_WITH(system-libtommath,
1785             AS_HELP_STRING([--with-system-libtommath],
1786                            [Use libtommath already on system]),,
1787             [with_system_libtommath="$with_system_libs"])
1789 AC_ARG_WITH(system-hsqldb,
1790     AS_HELP_STRING([--with-system-hsqldb],
1791         [Use hsqldb already on system.]))
1793 AC_ARG_WITH(hsqldb-jar,
1794     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1795         [Specify path to jarfile manually.]),
1796     HSQLDB_JAR=$withval)
1798 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1799     AS_HELP_STRING([--disable-scripting-beanshell],
1800         [Disable support for scripts in BeanShell.]),
1804 AC_ARG_WITH(system-beanshell,
1805     AS_HELP_STRING([--with-system-beanshell],
1806         [Use beanshell already on system.]),,
1807     [with_system_beanshell="$with_system_jars"])
1809 AC_ARG_WITH(beanshell-jar,
1810     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     BSH_JAR=$withval)
1814 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1815     AS_HELP_STRING([--disable-scripting-javascript],
1816         [Disable support for scripts in JavaScript.]),
1820 AC_ARG_WITH(system-rhino,
1821     AS_HELP_STRING([--with-system-rhino],
1822         [Use rhino already on system.]),,)
1823 #    [with_system_rhino="$with_system_jars"])
1824 # Above is not used as we have different debug interface
1825 # patched into internal rhino. This code needs to be fixed
1826 # before we can enable it by default.
1828 AC_ARG_WITH(rhino-jar,
1829     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     RHINO_JAR=$withval)
1833 AC_ARG_WITH(commons-logging-jar,
1834     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     COMMONS_LOGGING_JAR=$withval)
1838 AC_ARG_WITH(system-jfreereport,
1839     AS_HELP_STRING([--with-system-jfreereport],
1840         [Use JFreeReport already on system.]),,
1841     [with_system_jfreereport="$with_system_jars"])
1843 AC_ARG_WITH(sac-jar,
1844     AS_HELP_STRING([--with-sac-jar=JARFILE],
1845         [Specify path to jarfile manually.]),
1846     SAC_JAR=$withval)
1848 AC_ARG_WITH(libxml-jar,
1849     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1850         [Specify path to jarfile manually.]),
1851     LIBXML_JAR=$withval)
1853 AC_ARG_WITH(flute-jar,
1854     AS_HELP_STRING([--with-flute-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     FLUTE_JAR=$withval)
1858 AC_ARG_WITH(jfreereport-jar,
1859     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     JFREEREPORT_JAR=$withval)
1863 AC_ARG_WITH(liblayout-jar,
1864     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     LIBLAYOUT_JAR=$withval)
1868 AC_ARG_WITH(libloader-jar,
1869     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     LIBLOADER_JAR=$withval)
1873 AC_ARG_WITH(libformula-jar,
1874     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBFORMULA_JAR=$withval)
1878 AC_ARG_WITH(librepository-jar,
1879     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBREPOSITORY_JAR=$withval)
1883 AC_ARG_WITH(libfonts-jar,
1884     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1885         [Specify path to jarfile manually.]),
1886     LIBFONTS_JAR=$withval)
1888 AC_ARG_WITH(libserializer-jar,
1889     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1890         [Specify path to jarfile manually.]),
1891     LIBSERIALIZER_JAR=$withval)
1893 AC_ARG_WITH(libbase-jar,
1894     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1895         [Specify path to jarfile manually.]),
1896     LIBBASE_JAR=$withval)
1898 AC_ARG_WITH(system-odbc,
1899     AS_HELP_STRING([--with-system-odbc],
1900         [Use the odbc headers already on system.]),,
1901     [with_system_odbc="auto"])
1903 AC_ARG_WITH(system-sane,
1904     AS_HELP_STRING([--with-system-sane],
1905         [Use sane.h already on system.]),,
1906     [with_system_sane="$with_system_headers"])
1908 AC_ARG_WITH(system-bluez,
1909     AS_HELP_STRING([--with-system-bluez],
1910         [Use bluetooth.h already on system.]),,
1911     [with_system_bluez="$with_system_headers"])
1913 AC_ARG_WITH(system-curl,
1914     AS_HELP_STRING([--with-system-curl],
1915         [Use curl already on system.]),,
1916     [with_system_curl=auto])
1918 AC_ARG_WITH(system-boost,
1919     AS_HELP_STRING([--with-system-boost],
1920         [Use boost already on system.]),,
1921     [with_system_boost="$with_system_headers"])
1923 AC_ARG_WITH(system-glm,
1924     AS_HELP_STRING([--with-system-glm],
1925         [Use glm already on system.]),,
1926     [with_system_glm="$with_system_headers"])
1928 AC_ARG_WITH(system-hunspell,
1929     AS_HELP_STRING([--with-system-hunspell],
1930         [Use libhunspell already on system.]),,
1931     [with_system_hunspell="$with_system_libs"])
1933 AC_ARG_WITH(system-qrcodegen,
1934     AS_HELP_STRING([--with-system-qrcodegen],
1935         [Use libqrcodegen already on system.]),,
1936     [with_system_qrcodegen="$with_system_libs"])
1938 AC_ARG_WITH(system-mythes,
1939     AS_HELP_STRING([--with-system-mythes],
1940         [Use mythes already on system.]),,
1941     [with_system_mythes="$with_system_libs"])
1943 AC_ARG_WITH(system-altlinuxhyph,
1944     AS_HELP_STRING([--with-system-altlinuxhyph],
1945         [Use ALTLinuxhyph already on system.]),,
1946     [with_system_altlinuxhyph="$with_system_libs"])
1948 AC_ARG_WITH(system-lpsolve,
1949     AS_HELP_STRING([--with-system-lpsolve],
1950         [Use lpsolve already on system.]),,
1951     [with_system_lpsolve="$with_system_libs"])
1953 AC_ARG_WITH(system-coinmp,
1954     AS_HELP_STRING([--with-system-coinmp],
1955         [Use CoinMP already on system.]),,
1956     [with_system_coinmp="$with_system_libs"])
1958 AC_ARG_WITH(system-liblangtag,
1959     AS_HELP_STRING([--with-system-liblangtag],
1960         [Use liblangtag library already on system.]),,
1961     [with_system_liblangtag="$with_system_libs"])
1963 AC_ARG_WITH(webdav,
1964     AS_HELP_STRING([--with-webdav],
1965         [Specify which library to use for webdav implementation.
1966          Possible values: "neon", "serf", "no". The default value is "neon".
1967          Example: --with-webdav="serf"]),
1968     WITH_WEBDAV=$withval,
1969     WITH_WEBDAV="neon")
1971 AC_ARG_WITH(linker-hash-style,
1972     AS_HELP_STRING([--with-linker-hash-style],
1973         [Use linker with --hash-style=<style> when linking shared objects.
1974          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1975          if supported on the build system, and "sysv" otherwise.]))
1977 AC_ARG_WITH(jdk-home,
1978     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1979         [If you have installed JDK 8 or later on your system please supply the
1980          path here. Note that this is not the location of the java command but the
1981          location of the entire distribution.]),
1984 AC_ARG_WITH(help,
1985     AS_HELP_STRING([--with-help],
1986         [Enable the build of help. There is a special parameter "common" that
1987          can be used to bundle only the common part, .e.g help-specific icons.
1988          This is useful when you build the helpcontent separately.])
1989     [
1990                           Usage:     --with-help    build the old local help
1991                                  --without-help     no local help (default)
1992                                  --with-help=html   build the new HTML local help
1993                                  --with-help=online build the new HTML online help
1994     ],
1997 AC_ARG_WITH(omindex,
1998    AS_HELP_STRING([--with-omindex],
1999         [Enable the support of xapian-omega index for online help.])
2000    [
2001                          Usage: --with-omindex=server prepare the pages for omindex
2002                                 but let xapian-omega be built in server.
2003                                 --with-omindex=noxap do not prepare online pages
2004                                 for xapian-omega
2005   ],
2008 libo_FUZZ_ARG_WITH(java,
2009     AS_HELP_STRING([--with-java=<java command>],
2010         [Specify the name of the Java interpreter command. Typically "java"
2011          which is the default.
2013          To build without support for Java components, applets, accessibility
2014          or the XML filters written in Java, use --without-java or --with-java=no.]),
2015     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2016     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2019 AC_ARG_WITH(jvm-path,
2020     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2021         [Use a specific JVM search path at runtime.
2022          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2025 AC_ARG_WITH(ant-home,
2026     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2027         [If you have installed Apache Ant on your system, please supply the path here.
2028          Note that this is not the location of the Ant binary but the location
2029          of the entire distribution.]),
2032 AC_ARG_WITH(symbol-config,
2033     AS_HELP_STRING([--with-symbol-config],
2034         [Configuration for the crashreport symbol upload]),
2035         [],
2036         [with_symbol_config=no])
2038 AC_ARG_WITH(export-validation,
2039     AS_HELP_STRING([--without-export-validation],
2040         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2041 ,with_export_validation=auto)
2043 AC_ARG_WITH(bffvalidator,
2044     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2045         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2046          Requires installed Microsoft Office Binary File Format Validator.
2047          Note: export-validation (--with-export-validation) is required to be turned on.
2048          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2049 ,with_bffvalidator=no)
2051 libo_FUZZ_ARG_WITH(junit,
2052     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2053         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2054          --without-junit disables those tests. Not relevant in the --without-java case.]),
2055 ,with_junit=yes)
2057 AC_ARG_WITH(hamcrest,
2058     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2059         [Specifies the hamcrest jar file to use for JUnit-based tests.
2060          --without-junit disables those tests. Not relevant in the --without-java case.]),
2061 ,with_hamcrest=yes)
2063 AC_ARG_WITH(perl-home,
2064     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2065         [If you have installed Perl 5 Distribution, on your system, please
2066          supply the path here. Note that this is not the location of the Perl
2067          binary but the location of the entire distribution.]),
2070 libo_FUZZ_ARG_WITH(doxygen,
2071     AS_HELP_STRING(
2072         [--with-doxygen=<absolute path to doxygen executable>],
2073         [Specifies the doxygen executable to use when generating ODK C/C++
2074          documentation. --without-doxygen disables generation of ODK C/C++
2075          documentation. Not relevant in the --disable-odk case.]),
2076 ,with_doxygen=yes)
2078 AC_ARG_WITH(visual-studio,
2079     AS_HELP_STRING([--with-visual-studio=<2017>],
2080         [Specify which Visual Studio version to use in case several are
2081          installed. Currently only 2017 is supported.]),
2084 AC_ARG_WITH(windows-sdk,
2085     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2086         [Specify which Windows SDK, or "Windows Kit", version to use
2087          in case the one that came with the selected Visual Studio
2088          is not what you want for some reason. Note that not all compiler/SDK
2089          combinations are supported. The intent is that this option should not
2090          be needed.]),
2093 AC_ARG_WITH(lang,
2094     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2095         [Use this option to build LibreOffice with additional UI language support.
2096          English (US) is always included by default.
2097          Separate multiple languages with space.
2098          For all languages, use --with-lang=ALL.]),
2101 AC_ARG_WITH(locales,
2102     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2103         [Use this option to limit the locale information built in.
2104          Separate multiple locales with space.
2105          Very experimental and might well break stuff.
2106          Just a desperate measure to shrink code and data size.
2107          By default all the locales available is included.
2108          This option is completely unrelated to --with-lang.])
2109     [
2110                           Affects also our character encoding conversion
2111                           tables for encodings mainly targeted for a
2112                           particular locale, like EUC-CN and EUC-TW for
2113                           zh, ISO-2022-JP for ja.
2115                           Affects also our add-on break iterator data for
2116                           some languages.
2118                           For the default, all locales, don't use this switch at all.
2119                           Specifying just the language part of a locale means all matching
2120                           locales will be included.
2121     ],
2124 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2125 libo_FUZZ_ARG_WITH(krb5,
2126     AS_HELP_STRING([--with-krb5],
2127         [Enable MIT Kerberos 5 support in modules that support it.
2128          By default automatically enabled on platforms
2129          where a good system Kerberos 5 is available.]),
2132 libo_FUZZ_ARG_WITH(gssapi,
2133     AS_HELP_STRING([--with-gssapi],
2134         [Enable GSSAPI support in modules that support it.
2135          By default automatically enabled on platforms
2136          where a good system GSSAPI is available.]),
2139 AC_ARG_WITH(iwyu,
2140     AS_HELP_STRING([--with-iwyu],
2141         [Use given IWYU binary path to check unneeded includes instead of building.
2142          Use only if you are hacking on it.]),
2145 libo_FUZZ_ARG_WITH(lxml,
2146     AS_HELP_STRING([--without-lxml],
2147         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2148          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2149          report widget classes and ids.]),
2152 dnl ===================================================================
2153 dnl Branding
2154 dnl ===================================================================
2156 AC_ARG_WITH(branding,
2157     AS_HELP_STRING([--with-branding=/path/to/images],
2158         [Use given path to retrieve branding images set.])
2159     [
2160                           Search for intro.png about.svg and flat_logo.svg.
2161                           If any is missing, default ones will be used instead.
2163                           Search also progress.conf for progress
2164                           settings on intro screen :
2166                           PROGRESSBARCOLOR="255,255,255" Set color of
2167                           progress bar. Comma separated RGB decimal values.
2168                           PROGRESSSIZE="407,6" Set size of progress bar.
2169                           Comma separated decimal values (width, height).
2170                           PROGRESSPOSITION="61,317" Set position of progress
2171                           bar from left,top. Comma separated decimal values.
2172                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2173                           bar frame. Comma separated RGB decimal values.
2174                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2175                           bar text. Comma separated RGB decimal values.
2176                           PROGRESSTEXTBASELINE="287" Set vertical position of
2177                           progress bar text from top. Decimal value.
2179                           Default values will be used if not found.
2180     ],
2184 AC_ARG_WITH(extra-buildid,
2185     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2186         [Show addition build identification in about dialog.]),
2190 AC_ARG_WITH(vendor,
2191     AS_HELP_STRING([--with-vendor="John the Builder"],
2192         [Set vendor of the build.]),
2195 AC_ARG_WITH(android-package-name,
2196     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2197         [Set Android package name of the build.]),
2200 AC_ARG_WITH(compat-oowrappers,
2201     AS_HELP_STRING([--with-compat-oowrappers],
2202         [Install oo* wrappers in parallel with
2203          lo* ones to keep backward compatibility.
2204          Has effect only with make distro-pack-install]),
2207 AC_ARG_WITH(os-version,
2208     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2209         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2212 AC_ARG_WITH(mingw-cross-compiler,
2213     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2214         [Specify the MinGW cross-compiler to use.
2215          When building on the ODK on Unix and building unowinreg.dll,
2216          specify the MinGW C++ cross-compiler.]),
2219 AC_ARG_WITH(idlc-cpp,
2220     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2221         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2224 AC_ARG_WITH(build-version,
2225     AS_HELP_STRING([--with-build-version="Built by Jim"],
2226         [Allows the builder to add a custom version tag that will appear in the
2227          Help/About box for QA purposes.]),
2228 with_build_version=$withval,
2231 AC_ARG_WITH(parallelism,
2232     AS_HELP_STRING([--with-parallelism],
2233         [Number of jobs to run simultaneously during build. Parallel builds can
2234         save a lot of time on multi-cpu machines. Defaults to the number of
2235         CPUs on the machine, unless you configure --enable-icecream - then to
2236         40.]),
2239 AC_ARG_WITH(all-tarballs,
2240     AS_HELP_STRING([--with-all-tarballs],
2241         [Download all external tarballs unconditionally]))
2243 AC_ARG_WITH(gdrive-client-id,
2244     AS_HELP_STRING([--with-gdrive-client-id],
2245         [Provides the client id of the application for OAuth2 authentication
2246         on Google Drive. If either this or --with-gdrive-client-secret is
2247         empty, the feature will be disabled]),
2250 AC_ARG_WITH(gdrive-client-secret,
2251     AS_HELP_STRING([--with-gdrive-client-secret],
2252         [Provides the client secret of the application for OAuth2
2253         authentication on Google Drive. If either this or
2254         --with-gdrive-client-id is empty, the feature will be disabled]),
2257 AC_ARG_WITH(alfresco-cloud-client-id,
2258     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2259         [Provides the client id of the application for OAuth2 authentication
2260         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2261         empty, the feature will be disabled]),
2264 AC_ARG_WITH(alfresco-cloud-client-secret,
2265     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2266         [Provides the client secret of the application for OAuth2
2267         authentication on Alfresco Cloud. If either this or
2268         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2271 AC_ARG_WITH(onedrive-client-id,
2272     AS_HELP_STRING([--with-onedrive-client-id],
2273         [Provides the client id of the application for OAuth2 authentication
2274         on OneDrive. If either this or --with-onedrive-client-secret is
2275         empty, the feature will be disabled]),
2278 AC_ARG_WITH(onedrive-client-secret,
2279     AS_HELP_STRING([--with-onedrive-client-secret],
2280         [Provides the client secret of the application for OAuth2
2281         authentication on OneDrive. If either this or
2282         --with-onedrive-client-id is empty, the feature will be disabled]),
2284 dnl ===================================================================
2285 dnl Do we want to use pre-build binary tarball for recompile
2286 dnl ===================================================================
2288 if test "$enable_library_bin_tar" = "yes" ; then
2289     USE_LIBRARY_BIN_TAR=TRUE
2290 else
2291     USE_LIBRARY_BIN_TAR=
2293 AC_SUBST(USE_LIBRARY_BIN_TAR)
2295 dnl ===================================================================
2296 dnl Test whether build target is Release Build
2297 dnl ===================================================================
2298 AC_MSG_CHECKING([whether build target is Release Build])
2299 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2300     AC_MSG_RESULT([no])
2301     ENABLE_RELEASE_BUILD=
2302 else
2303     AC_MSG_RESULT([yes])
2304     ENABLE_RELEASE_BUILD=TRUE
2306 AC_SUBST(ENABLE_RELEASE_BUILD)
2308 dnl ===================================================================
2309 dnl Test whether to sign Windows Build
2310 dnl ===================================================================
2311 AC_MSG_CHECKING([whether to sign windows build])
2312 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2313     AC_MSG_RESULT([yes])
2314     WINDOWS_BUILD_SIGNING="TRUE"
2315 else
2316     AC_MSG_RESULT([no])
2317     WINDOWS_BUILD_SIGNING="FALSE"
2319 AC_SUBST(WINDOWS_BUILD_SIGNING)
2321 dnl ===================================================================
2322 dnl MacOSX build and runtime environment options
2323 dnl ===================================================================
2325 AC_ARG_WITH(macosx-sdk,
2326     AS_HELP_STRING([--with-macosx-sdk=<version>],
2327         [Prefer a specific SDK for building.])
2328     [
2329                           If the requested SDK is not available, a search for the oldest one will be done.
2330                           With current Xcode versions, only the latest SDK is included, so this option is
2331                           not terribly useful. It works fine to build with a new SDK and run the result
2332                           on an older OS.
2334                           e. g.: --with-macosx-sdk=10.10
2336                           there are 3 options to control the MacOSX build:
2337                           --with-macosx-sdk (referred as 'sdk' below)
2338                           --with-macosx-version-min-required (referred as 'min' below)
2339                           --with-macosx-version-max-allowed (referred as 'max' below)
2341                           the connection between these value and the default they take is as follow:
2342                           ( ? means not specified on the command line, s means the SDK version found,
2343                           constraint: 8 <= x <= y <= z)
2345                           ==========================================
2346                            command line      || config result
2347                           ==========================================
2348                           min  | max  | sdk  || min   | max  | sdk  |
2349                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2350                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2351                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2352                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2353                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2354                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2355                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2356                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2359                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2360                           for a detailed technical explanation of these variables
2362                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2363     ],
2366 AC_ARG_WITH(macosx-version-min-required,
2367     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2368         [set the minimum OS version needed to run the built LibreOffice])
2369     [
2370                           e. g.: --with-macos-version-min-required=10.10
2371                           see --with-macosx-sdk for more info
2372     ],
2375 AC_ARG_WITH(macosx-version-max-allowed,
2376     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2377         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2378     [
2379                           e. g.: --with-macos-version-max-allowed=10.10
2380                           see --with-macosx-sdk for more info
2381     ],
2385 dnl ===================================================================
2386 dnl options for stuff used during cross-compilation build
2387 dnl Not quite superseded by --with-build-platform-configure-options.
2388 dnl TODO: check, if the "force" option is still needed anywhere.
2389 dnl ===================================================================
2391 AC_ARG_WITH(system-icu-for-build,
2392     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2393         [Use icu already on system for build tools (cross-compilation only).]))
2396 dnl ===================================================================
2397 dnl Check for incompatible options set by fuzzing, and reset those
2398 dnl automatically to working combinations
2399 dnl ===================================================================
2401 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2402         "$enable_dbus" != "$enable_avahi"; then
2403     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2404     enable_avahi=$enable_dbus
2407 add_lopath_after ()
2409     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2410         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2411     fi
2414 add_lopath_before ()
2416     local IFS=${P_SEP}
2417     local path_cleanup
2418     local dir
2419     for dir in $LO_PATH ; do
2420         if test "$dir" != "$1" ; then
2421             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2422         fi
2423     done
2424     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2427 dnl ===================================================================
2428 dnl check for required programs (grep, awk, sed, bash)
2429 dnl ===================================================================
2431 pathmunge ()
2433     if test -n "$1"; then
2434         if test "$build_os" = "cygwin"; then
2435             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2436                 PathFormat "$1"
2437                 new_path=`cygpath -sm "$formatted_path"`
2438             else
2439                 PathFormat "$1"
2440                 new_path=`cygpath -u "$formatted_path"`
2441             fi
2442         else
2443             new_path="$1"
2444         fi
2445         if test "$2" = "after"; then
2446             add_lopath_after "$new_path"
2447         else
2448             add_lopath_before "$new_path"
2449         fi
2450         unset new_path
2451     fi
2454 AC_PROG_AWK
2455 AC_PATH_PROG( AWK, $AWK)
2456 if test -z "$AWK"; then
2457     AC_MSG_ERROR([install awk to run this script])
2460 AC_PATH_PROG(BASH, bash)
2461 if test -z "$BASH"; then
2462     AC_MSG_ERROR([bash not found in \$PATH])
2464 AC_SUBST(BASH)
2466 AC_MSG_CHECKING([for GNU or BSD tar])
2467 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2468     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2469     if test $? -eq 0;  then
2470         GNUTAR=$a
2471         break
2472     fi
2473 done
2474 AC_MSG_RESULT($GNUTAR)
2475 if test -z "$GNUTAR"; then
2476     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2478 AC_SUBST(GNUTAR)
2480 AC_MSG_CHECKING([for tar's option to strip components])
2481 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2482 if test $? -eq 0; then
2483     STRIP_COMPONENTS="--strip-components"
2484 else
2485     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2486     if test $? -eq 0; then
2487         STRIP_COMPONENTS="--strip-path"
2488     else
2489         STRIP_COMPONENTS="unsupported"
2490     fi
2492 AC_MSG_RESULT($STRIP_COMPONENTS)
2493 if test x$STRIP_COMPONENTS = xunsupported; then
2494     AC_MSG_ERROR([you need a tar that is able to strip components.])
2496 AC_SUBST(STRIP_COMPONENTS)
2498 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2499 dnl desktop OSes from "mobile" ones.
2501 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2502 dnl In other words, that when building for an OS that is not a
2503 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2505 dnl Note the direction of the implication; there is no assumption that
2506 dnl cross-compiling would imply a non-desktop OS.
2508 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2509     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2510     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2511     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2514 # Whether to build "avmedia" functionality or not.
2516 if test -z "$enable_avmedia"; then
2517     enable_avmedia=yes
2520 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2521 if test "$enable_avmedia" = yes; then
2522     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2523 else
2524     USE_AVMEDIA_DUMMY='TRUE'
2526 AC_SUBST(USE_AVMEDIA_DUMMY)
2528 # Decide whether to build database connectivity stuff (including
2529 # Base) or not. We probably don't want to on non-desktop OSes.
2530 if test -z "$enable_database_connectivity"; then
2531     # --disable-database-connectivity is unfinished work in progress
2532     # and the iOS test app doesn't link if we actually try to use it.
2533     # if test $_os != iOS -a $_os != Android; then
2534     if test $_os != iOS; then
2535         enable_database_connectivity=yes
2536     fi
2539 if test "$enable_database_connectivity" = yes; then
2540     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2541     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2544 if test -z "$enable_extensions"; then
2545     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2546     if test $_os != iOS -a $_os != Android; then
2547         enable_extensions=yes
2548     fi
2551 if test "$enable_extensions" = yes; then
2552     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2553     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2556 if test -z "$enable_scripting"; then
2557     # Disable scripting for iOS unless specifically overridden
2558     # with --enable-scripting.
2559     if test $_os != iOS; then
2560         enable_scripting=yes
2561     fi
2564 DISABLE_SCRIPTING=''
2565 if test "$enable_scripting" = yes; then
2566     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2567     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2568 else
2569     DISABLE_SCRIPTING='TRUE'
2570     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2573 if test $_os = iOS -o $_os = Android; then
2574     # Disable dynamic_loading always for iOS and Android
2575     enable_dynamic_loading=no
2576 elif test -z "$enable_dynamic_loading"; then
2577     # Otherwise enable it unless specifically disabled
2578     enable_dynamic_loading=yes
2581 DISABLE_DYNLOADING=''
2582 if test "$enable_dynamic_loading" = yes; then
2583     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2584 else
2585     DISABLE_DYNLOADING='TRUE'
2587 AC_SUBST(DISABLE_DYNLOADING)
2589 # remember SYSBASE value
2590 AC_SUBST(SYSBASE)
2592 dnl ===================================================================
2593 dnl  Sort out various gallery compilation options
2594 dnl ===================================================================
2595 AC_MSG_CHECKING([how to build and package galleries])
2596 if test -n "${with_galleries}"; then
2597     if test "$with_galleries" = "build"; then
2598         WITH_GALLERY_BUILD=TRUE
2599         AC_MSG_RESULT([build from source images internally])
2600     elif test "$with_galleries" = "no"; then
2601         WITH_GALLERY_BUILD=
2602         AC_MSG_RESULT([disable non-internal gallery build])
2603     else
2604         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2605     fi
2606 else
2607     if test $_os != iOS -a $_os != Android; then
2608         WITH_GALLERY_BUILD=TRUE
2609         AC_MSG_RESULT([internal src images for desktop])
2610     else
2611         WITH_GALLERY_BUILD=
2612         AC_MSG_RESULT([disable src image build])
2613     fi
2615 AC_SUBST(WITH_GALLERY_BUILD)
2617 dnl ===================================================================
2618 dnl  Checks if ccache is available
2619 dnl ===================================================================
2620 CCACHE_DEPEND_MODE=
2621 if test "$_os" = "WINNT"; then
2622     # on windows/VC build do not use ccache
2623     CCACHE=""
2624 elif test "$enable_ccache" = "no"; then
2625     CCACHE=""
2626 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2627     case "%$CC%$CXX%" in
2628     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2629     # assume that's good then
2630     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2631         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2632         CCACHE_DEPEND_MODE=1
2633         ;;
2634     *)
2635         AC_PATH_PROG([CCACHE],[ccache],[not found])
2636         if test "$CCACHE" = "not found"; then
2637             CCACHE=""
2638         else
2639             CCACHE_DEPEND_MODE=1
2640             # Need to check for ccache version: otherwise prevents
2641             # caching of the results (like "-x objective-c++" for Mac)
2642             if test $_os = Darwin -o $_os = iOS; then
2643                 # Check ccache version
2644                 AC_MSG_CHECKING([whether version of ccache is suitable])
2645                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2646                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2647                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2648                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2649                 else
2650                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2651                     CCACHE=""
2652                     CCACHE_DEPEND_MODE=
2653                 fi
2654             fi
2655         fi
2656         ;;
2657     esac
2658 else
2659     CCACHE=""
2661 if test "$enable_ccache" = "nodepend"; then
2662     CCACHE_DEPEND_MODE=""
2664 AC_SUBST(CCACHE_DEPEND_MODE)
2666 if test "$CCACHE" != ""; then
2667     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2668     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2669     if test "$ccache_size" = ""; then
2670         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2671         if test "$ccache_size" = ""; then
2672             ccache_size=0
2673         fi
2674         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2675         if test $ccache_size -lt 1024; then
2676             CCACHE=""
2677             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2678             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2679         else
2680             # warn that ccache may be too small for debug build
2681             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2682             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2683         fi
2684     else
2685         if test $ccache_size -lt 5; then
2686             #warn that ccache may be too small for debug build
2687             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2688             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2689         fi
2690     fi
2693 dnl ===================================================================
2694 dnl  Checks for C compiler,
2695 dnl  The check for the C++ compiler is later on.
2696 dnl ===================================================================
2697 if test "$_os" != "WINNT"; then
2698     GCC_HOME_SET="true"
2699     AC_MSG_CHECKING([gcc home])
2700     if test -z "$with_gcc_home"; then
2701         if test "$enable_icecream" = "yes"; then
2702             if test -d "/usr/lib/icecc/bin"; then
2703                 GCC_HOME="/usr/lib/icecc/"
2704             elif test -d "/usr/libexec/icecc/bin"; then
2705                 GCC_HOME="/usr/libexec/icecc/"
2706             elif test -d "/opt/icecream/bin"; then
2707                 GCC_HOME="/opt/icecream/"
2708             else
2709                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2711             fi
2712         else
2713             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2714             GCC_HOME_SET="false"
2715         fi
2716     else
2717         GCC_HOME="$with_gcc_home"
2718     fi
2719     AC_MSG_RESULT($GCC_HOME)
2720     AC_SUBST(GCC_HOME)
2722     if test "$GCC_HOME_SET" = "true"; then
2723         if test -z "$CC"; then
2724             CC="$GCC_HOME/bin/gcc"
2725             CC_BASE="gcc"
2726         fi
2727         if test -z "$CXX"; then
2728             CXX="$GCC_HOME/bin/g++"
2729             CXX_BASE="g++"
2730         fi
2731     fi
2734 COMPATH=`dirname "$CC"`
2735 if test "$COMPATH" = "."; then
2736     AC_PATH_PROGS(COMPATH, $CC)
2737     dnl double square bracket to get single because of M4 quote...
2738     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2740 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2742 dnl ===================================================================
2743 dnl Java support
2744 dnl ===================================================================
2745 AC_MSG_CHECKING([whether to build with Java support])
2746 if test "$with_java" != "no"; then
2747     if test "$DISABLE_SCRIPTING" = TRUE; then
2748         AC_MSG_RESULT([no, overridden by --disable-scripting])
2749         ENABLE_JAVA=""
2750         with_java=no
2751     else
2752         AC_MSG_RESULT([yes])
2753         ENABLE_JAVA="TRUE"
2754         AC_DEFINE(HAVE_FEATURE_JAVA)
2755     fi
2756 else
2757     AC_MSG_RESULT([no])
2758     ENABLE_JAVA=""
2761 AC_SUBST(ENABLE_JAVA)
2763 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2765 dnl ENABLE_JAVA="" indicate no Java support at all
2767 dnl ===================================================================
2768 dnl Check macOS SDK and compiler
2769 dnl ===================================================================
2771 HAVE_MACOS_LD_PLATFORMVERSION=
2772 if test $_os = Darwin; then
2774     # If no --with-macosx-sdk option is given, look for one
2776     # The intent is that for "most" Mac-based developers, a suitable
2777     # SDK will be found automatically without any configure options.
2779     # For developers with a current Xcode, the lowest-numbered SDK
2780     # higher than or equal to the minimum required should be found.
2782     AC_MSG_CHECKING([what macOS SDK to use])
2783     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2784         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2785         if test -d "$MACOSX_SDK_PATH"; then
2786             with_macosx_sdk="${_macosx_sdk}"
2787             break
2788         else
2789             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2790             if test -d "$MACOSX_SDK_PATH"; then
2791                 with_macosx_sdk="${_macosx_sdk}"
2792                 break
2793             fi
2794         fi
2795     done
2796     if test ! -d "$MACOSX_SDK_PATH"; then
2797         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2798     fi
2800     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2802     case $with_macosx_sdk in
2803     10.12)
2804         MACOSX_SDK_VERSION=101200
2805         ;;
2806     10.13)
2807         MACOSX_SDK_VERSION=101300
2808         ;;
2809     10.14)
2810         MACOSX_SDK_VERSION=101400
2811         ;;
2812     10.15)
2813         MACOSX_SDK_VERSION=101500
2814         ;;
2815     *)
2816         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2817         ;;
2818     esac
2820     if test "$with_macosx_version_min_required" = "" ; then
2821         with_macosx_version_min_required="10.10";
2822     fi
2824     if test "$with_macosx_version_max_allowed" = "" ; then
2825         with_macosx_version_max_allowed="$with_macosx_sdk"
2826     fi
2828     # export this so that "xcrun" invocations later return matching values
2829     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2830     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2831     export DEVELOPER_DIR
2832     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2833     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2835     AC_MSG_CHECKING([whether Xcode is new enough])
2836     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2837     my_xcode_ver2=${my_xcode_ver1#Xcode }
2838     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2839     if test "$my_xcode_ver3" -ge 903; then
2840         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2841     else
2842         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2843     fi
2845     case "$with_macosx_version_min_required" in
2846     10.10)
2847         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2848         ;;
2849     10.11)
2850         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2851         ;;
2852     10.12)
2853         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2854         ;;
2855     10.13)
2856         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2857         ;;
2858     10.14)
2859         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2860         ;;
2861     10.15)
2862         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2863         ;;
2864     *)
2865         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2866         ;;
2867     esac
2868     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2870     LIBTOOL=/usr/bin/libtool
2871     INSTALL_NAME_TOOL=install_name_tool
2872     if test -z "$save_CC"; then
2873         stdlib=-stdlib=libc++
2874         if test "$ENABLE_LTO" = TRUE; then
2875             lto=-flto
2876         fi
2878         AC_MSG_CHECKING([what C compiler to use])
2879         CC="`xcrun -find clang`"
2880         CC_BASE=`first_arg_basename "$CC"`
2881         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2882         AC_MSG_RESULT([$CC])
2884         AC_MSG_CHECKING([what C++ compiler to use])
2885         CXX="`xcrun -find clang++`"
2886         CXX_BASE=`first_arg_basename "$CXX"`
2887         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2888         AC_MSG_RESULT([$CXX])
2890         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2891         AR=`xcrun -find ar`
2892         NM=`xcrun -find nm`
2893         STRIP=`xcrun -find strip`
2894         LIBTOOL=`xcrun -find libtool`
2895         RANLIB=`xcrun -find ranlib`
2896     fi
2898     case "$with_macosx_version_max_allowed" in
2899     10.10)
2900         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2901         ;;
2902     10.11)
2903         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2904         ;;
2905     10.12)
2906         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2907         ;;
2908     10.13)
2909         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2910         ;;
2911     10.14)
2912         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2913         ;;
2914     10.15)
2915         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2916         ;;
2917     *)
2918         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2919         ;;
2920     esac
2922     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2923     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2924         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])
2925     else
2926         AC_MSG_RESULT([ok])
2927     fi
2929     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2930     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2931         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2932     else
2933         AC_MSG_RESULT([ok])
2934     fi
2935     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2936     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2938     AC_MSG_CHECKING([whether to do code signing])
2940     if test "$enable_macosx_code_signing" = yes; then
2941         # By default use the first suitable certificate (?).
2943         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2944         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2945         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2946         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2947         # "Developer ID Application" one.
2949         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2950         if test -n "$identity"; then
2951             MACOSX_CODESIGNING_IDENTITY=$identity
2952             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2953             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2954         else
2955             AC_MSG_ERROR([cannot determine identity to use])
2956         fi
2957     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2958         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2959         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2960         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2961     else
2962         AC_MSG_RESULT([no])
2963     fi
2965     AC_MSG_CHECKING([whether to create a Mac App Store package])
2967     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2968         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2969     elif test "$enable_macosx_package_signing" = yes; then
2970         # By default use the first suitable certificate.
2971         # It should be a "3rd Party Mac Developer Installer" one
2973         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2974         if test -n "$identity"; then
2975             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2976             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2977             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2978         else
2979             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2980         fi
2981     elif test -n "$enable_macosx_package_signing"; then
2982         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2983         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2984         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2985     else
2986         AC_MSG_RESULT([no])
2987     fi
2989     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2990         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2991     fi
2993     AC_MSG_CHECKING([whether to sandbox the application])
2995     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2996         AC_MSG_ERROR([macOS sandboxing requires code signing])
2997     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2998         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2999     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3000         ENABLE_MACOSX_SANDBOX=TRUE
3001         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3002         AC_MSG_RESULT([yes])
3003     else
3004         AC_MSG_RESULT([no])
3005     fi
3007     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3008     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3009     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3011     AC_MSG_CHECKING([whether the linker supports -platform_version])
3012     save_LDFLAGS=$LDFLAGS
3013     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3014         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3015     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3016         [AC_MSG_RESULT([yes])
3017          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3018         [AC_MSG_RESULT([no])])
3019     LDFLAGS=$save_LDFLAGS
3021 AC_SUBST(MACOSX_SDK_PATH)
3022 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3023 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3024 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3025 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3026 AC_SUBST(INSTALL_NAME_TOOL)
3027 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3028 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3029 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3030 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3031 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3032 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3034 dnl ===================================================================
3035 dnl Check iOS SDK and compiler
3036 dnl ===================================================================
3038 if test $_os = iOS; then
3039     AC_MSG_CHECKING([what iOS SDK to use])
3040     current_sdk_ver=13.2
3041     older_sdk_vers="13.1 13.0 12.4 12.2"
3042     if test "$enable_ios_simulator" = "yes"; then
3043         platform=iPhoneSimulator
3044         versionmin=-mios-simulator-version-min=12.2
3045     else
3046         platform=iPhoneOS
3047         versionmin=-miphoneos-version-min=12.2
3048     fi
3049     xcode_developer=`xcode-select -print-path`
3051     for sdkver in $current_sdk_ver $older_sdk_vers; do
3052         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3053         if test -d $t; then
3054             sysroot=$t
3055             break
3056         fi
3057     done
3059     if test -z "$sysroot"; then
3060         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3061     fi
3063     AC_MSG_RESULT($sysroot)
3065     # LTO is not really recommended for iOS builds,
3066     # the link time will be astronomical
3067     if test "$ENABLE_LTO" = TRUE; then
3068         lto=-flto
3069     fi
3071     stdlib="-stdlib=libc++"
3073     AC_MSG_CHECKING([what C compiler to use])
3074     CC="`xcrun -find clang`"
3075     CC_BASE=`first_arg_basename "$CC"`
3076     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3077     AC_MSG_RESULT([$CC])
3079     AC_MSG_CHECKING([what C++ compiler to use])
3080     CXX="`xcrun -find clang++`"
3081     CXX_BASE=`first_arg_basename "$CXX"`
3082     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3083     AC_MSG_RESULT([$CXX])
3085     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3086     AR=`xcrun -find ar`
3087     NM=`xcrun -find nm`
3088     STRIP=`xcrun -find strip`
3089     LIBTOOL=`xcrun -find libtool`
3090     RANLIB=`xcrun -find ranlib`
3093 AC_MSG_CHECKING([whether to treat the installation as read-only])
3095 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3096         "$enable_extensions" != yes; then
3097     enable_readonly_installset=yes
3099 if test "$enable_readonly_installset" = yes; then
3100     AC_MSG_RESULT([yes])
3101     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3102 else
3103     AC_MSG_RESULT([no])
3106 dnl ===================================================================
3107 dnl Structure of install set
3108 dnl ===================================================================
3110 if test $_os = Darwin; then
3111     LIBO_BIN_FOLDER=MacOS
3112     LIBO_ETC_FOLDER=Resources
3113     LIBO_LIBEXEC_FOLDER=MacOS
3114     LIBO_LIB_FOLDER=Frameworks
3115     LIBO_LIB_PYUNO_FOLDER=Resources
3116     LIBO_SHARE_FOLDER=Resources
3117     LIBO_SHARE_HELP_FOLDER=Resources/help
3118     LIBO_SHARE_JAVA_FOLDER=Resources/java
3119     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3120     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3121     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3122     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3123     LIBO_URE_BIN_FOLDER=MacOS
3124     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3125     LIBO_URE_LIB_FOLDER=Frameworks
3126     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3127     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3128 elif test $_os = WINNT; then
3129     LIBO_BIN_FOLDER=program
3130     LIBO_ETC_FOLDER=program
3131     LIBO_LIBEXEC_FOLDER=program
3132     LIBO_LIB_FOLDER=program
3133     LIBO_LIB_PYUNO_FOLDER=program
3134     LIBO_SHARE_FOLDER=share
3135     LIBO_SHARE_HELP_FOLDER=help
3136     LIBO_SHARE_JAVA_FOLDER=program/classes
3137     LIBO_SHARE_PRESETS_FOLDER=presets
3138     LIBO_SHARE_READMES_FOLDER=readmes
3139     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3140     LIBO_SHARE_SHELL_FOLDER=program/shell
3141     LIBO_URE_BIN_FOLDER=program
3142     LIBO_URE_ETC_FOLDER=program
3143     LIBO_URE_LIB_FOLDER=program
3144     LIBO_URE_MISC_FOLDER=program
3145     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3146 else
3147     LIBO_BIN_FOLDER=program
3148     LIBO_ETC_FOLDER=program
3149     LIBO_LIBEXEC_FOLDER=program
3150     LIBO_LIB_FOLDER=program
3151     LIBO_LIB_PYUNO_FOLDER=program
3152     LIBO_SHARE_FOLDER=share
3153     LIBO_SHARE_HELP_FOLDER=help
3154     LIBO_SHARE_JAVA_FOLDER=program/classes
3155     LIBO_SHARE_PRESETS_FOLDER=presets
3156     LIBO_SHARE_READMES_FOLDER=readmes
3157     if test "$enable_fuzzers" != yes; then
3158         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3159     else
3160         LIBO_SHARE_RESOURCE_FOLDER=resource
3161     fi
3162     LIBO_SHARE_SHELL_FOLDER=program/shell
3163     LIBO_URE_BIN_FOLDER=program
3164     LIBO_URE_ETC_FOLDER=program
3165     LIBO_URE_LIB_FOLDER=program
3166     LIBO_URE_MISC_FOLDER=program
3167     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3169 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3171 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3172 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3173 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3174 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3175 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3176 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3177 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3178 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3179 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3180 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3181 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3182 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3183 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3184 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3186 # Not all of them needed in config_host.mk, add more if need arises
3187 AC_SUBST(LIBO_BIN_FOLDER)
3188 AC_SUBST(LIBO_ETC_FOLDER)
3189 AC_SUBST(LIBO_LIB_FOLDER)
3190 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3191 AC_SUBST(LIBO_SHARE_FOLDER)
3192 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3193 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3194 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3195 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3196 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3197 AC_SUBST(LIBO_URE_BIN_FOLDER)
3198 AC_SUBST(LIBO_URE_ETC_FOLDER)
3199 AC_SUBST(LIBO_URE_LIB_FOLDER)
3200 AC_SUBST(LIBO_URE_MISC_FOLDER)
3201 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3203 dnl ===================================================================
3204 dnl Windows specific tests and stuff
3205 dnl ===================================================================
3207 reg_get_value()
3209     # Return value: $regvalue
3210     unset regvalue
3212     local _regentry="/proc/registry${1}/${2}"
3213     if test -f "$_regentry"; then
3214         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3215         # Registry keys read via /proc/registry* are always \0 terminated!
3216         local _regvalue=$(tr -d '\0' < "$_regentry")
3217         if test $? -eq 0; then
3218             regvalue=$_regvalue
3219         fi
3220     fi
3223 # Get a value from the 32-bit side of the Registry
3224 reg_get_value_32()
3226     reg_get_value "32" "$1"
3229 # Get a value from the 64-bit side of the Registry
3230 reg_get_value_64()
3232     reg_get_value "64" "$1"
3235 if test "$_os" = "WINNT"; then
3236     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3237     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3238         AC_MSG_RESULT([no])
3239         WINDOWS_SDK_ARCH="x86"
3240     else
3241         AC_MSG_RESULT([yes])
3242         WINDOWS_SDK_ARCH="x64"
3243         BITNESS_OVERRIDE=64
3244     fi
3246 if test "$_os" = "iOS"; then
3247     cross_compiling="yes"
3250 if test "$cross_compiling" = "yes"; then
3251     export CROSS_COMPILING=TRUE
3252 else
3253     CROSS_COMPILING=
3254     BUILD_TYPE="$BUILD_TYPE NATIVE"
3256 AC_SUBST(CROSS_COMPILING)
3258 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3259 # NOTE: must _not_ be used for bundled external libraries!
3260 ISYSTEM=
3261 if test "$GCC" = "yes"; then
3262     AC_MSG_CHECKING( for -isystem )
3263     save_CFLAGS=$CFLAGS
3264     CFLAGS="$CFLAGS -Werror"
3265     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3266     CFLAGS=$save_CFLAGS
3267     if test -n "$ISYSTEM"; then
3268         AC_MSG_RESULT(yes)
3269     else
3270         AC_MSG_RESULT(no)
3271     fi
3273 if test -z "$ISYSTEM"; then
3274     # fall back to using -I
3275     ISYSTEM=-I
3277 AC_SUBST(ISYSTEM)
3279 dnl ===================================================================
3280 dnl  Check which Visual Studio compiler is used
3281 dnl ===================================================================
3283 map_vs_year_to_version()
3285     # Return value: $vsversion
3287     unset vsversion
3289     case $1 in
3290     2017)
3291         vsversion=15;;
3292     2019)
3293         vsversion=16;;
3294     *)
3295         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3296     esac
3299 vs_versions_to_check()
3301     # Args: $1 (optional) : versions to check, in the order of preference
3302     # Return value: $vsversions
3304     unset vsversions
3306     if test -n "$1"; then
3307         map_vs_year_to_version "$1"
3308         vsversions=$vsversion
3309     else
3310         # We accept only 2017
3311         vsversions="15"
3312     fi
3315 win_get_env_from_vsvars32bat()
3317     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3318     # Also seems to be located in another directory under the same name: vsvars32.bat
3319     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3320     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3321     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3322     chmod +x $WRAPPERBATCHFILEPATH
3323     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3324     rm -f $WRAPPERBATCHFILEPATH
3325     printf '%s' "$_win_get_env_from_vsvars32bat"
3328 find_ucrt()
3330     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3331     if test -n "$regvalue"; then
3332         PathFormat "$regvalue"
3333         UCRTSDKDIR=$formatted_path
3334         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3335         UCRTVERSION=$regvalue
3336         # Rest if not exist
3337         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3338           UCRTSDKDIR=
3339         fi
3340     fi
3341     if test -z "$UCRTSDKDIR"; then
3342         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3343         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3344         if test -f "$ide_env_file"; then
3345             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3346             UCRTSDKDIR=$formatted_path
3347             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3348             dnl Hack needed at least by tml:
3349             if test "$UCRTVERSION" = 10.0.15063.0 \
3350                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3351                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3352             then
3353                 UCRTVERSION=10.0.14393.0
3354             fi
3355         else
3356           AC_MSG_ERROR([No UCRT found])
3357         fi
3358     fi
3361 find_msvc()
3363     # Find Visual C++ 2017/2019
3364     # Args: $1 (optional) : The VS version year
3365     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3367     unset vctest vcnum vcnumwithdot vcbuildnumber
3369     vs_versions_to_check "$1"
3370     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3371     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3372     PathFormat "$vswhere"
3373     vswhere=$formatted_path
3374     for ver in $vsversions; do
3375         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3376         if test -n "$vswhereoutput"; then
3377             PathFormat "$vswhereoutput"
3378             vctest=$formatted_path
3379             break
3380         fi
3381     done
3383     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3384     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3385     # should be removed when upgrading baseline.
3386     if ! test -n "$vctest"; then
3387         for ver in $vsversions; do
3388             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3389             if test -n "$regvalue"; then
3390                 vctest=$regvalue
3391                 break
3392             fi
3393             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3394             if test -n "$regvalue"; then
3395                 AC_MSG_RESULT([found: $regvalue])
3396                 PathFormat "$regvalue"
3397                 vctest=$formatted_path
3398                 break
3399             fi
3400         done
3401     fi
3403     if test -n "$vctest"; then
3404         vcnumwithdot="$ver.0"
3405         case "$vcnumwithdot" in
3406         15.0)
3407             vcyear=2017
3408             vcnum=150
3409             ;;
3410         16.0)
3411             vcyear=2019
3412             vcnum=160
3413             ;;
3414         esac
3415         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3417     fi
3420 SOLARINC=
3421 MSBUILD_PATH=
3422 DEVENV=
3423 if test "$_os" = "WINNT"; then
3424     AC_MSG_CHECKING([Visual C++])
3425     find_msvc "$with_visual_studio"
3426     if test -z "$vctest"; then
3427         if test -n "$with_visual_studio"; then
3428             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3429         else
3430             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3431         fi
3432     fi
3434     if test "$BITNESS_OVERRIDE" = ""; then
3435         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3436             VC_PRODUCT_DIR=$vctest/VC
3437         else
3438             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3439         fi
3440     else
3441         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3442             VC_PRODUCT_DIR=$vctest/VC
3443         else
3444             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3445         fi
3446     fi
3447     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3449     AC_MSG_CHECKING([for short pathname of VC product directory])
3450     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3451     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3453     UCRTSDKDIR=
3454     UCRTVERSION=
3456     AC_MSG_CHECKING([for UCRT location])
3457     find_ucrt
3458     # find_ucrt errors out if it doesn't find it
3459     AC_MSG_RESULT([found])
3460     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3461     ucrtincpath_formatted=$formatted_path
3462     # SOLARINC is used for external modules and must be set too.
3463     # And no, it's not sufficient to set SOLARINC only, as configure
3464     # itself doesn't honour it.
3465     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3466     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3467     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3468     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3470     AC_SUBST(UCRTSDKDIR)
3471     AC_SUBST(UCRTVERSION)
3473     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3474     # Find the proper version of MSBuild.exe to use based on the VS version
3475     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3476     if test -n "$regvalue" ; then
3477         AC_MSG_RESULT([found: $regvalue])
3478         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3479     else
3480         if test "$vcnumwithdot" = "16.0"; then
3481             if test "$BITNESS_OVERRIDE" = ""; then
3482                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3483             else
3484                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3485             fi
3486         else
3487             if test "$BITNESS_OVERRIDE" = ""; then
3488                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3489             else
3490                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3491             fi
3492         fi
3493         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3494         AC_MSG_RESULT([$regvalue])
3495     fi
3497     # Find the version of devenv.exe
3498     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3499     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3500     if test ! -e "$DEVENV"; then
3501         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3502     fi
3504     dnl ===========================================================
3505     dnl  Check for the corresponding mspdb*.dll
3506     dnl ===========================================================
3508     VC_HOST_DIR=
3509     MSPDB_PATH=
3510     CL_PATH=
3512     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3513         VC_HOST_DIR="HostX64"
3514         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3515     else
3516         VC_HOST_DIR="HostX86"
3517         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3518     fi
3520     if test "$BITNESS_OVERRIDE" = ""; then
3521         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3522     else
3523         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3524     fi
3526     # MSVC 15.0 has libraries from 14.0?
3527     mspdbnum="140"
3529     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3530         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3531     fi
3533     dnl The path needs to be added before cl is called
3534     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3535     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3537     AC_MSG_CHECKING([cl.exe])
3539     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3540     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3541     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3542     # is not enough?
3544     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3545     dnl needed when building CLR code:
3546     if test -z "$MSVC_CXX"; then
3547         if test -f "$CL_PATH/cl.exe"; then
3548             MSVC_CXX="$CL_PATH/cl.exe"
3549         fi
3551         # This gives us a posix path with 8.3 filename restrictions
3552         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3553     fi
3555     if test -z "$CC"; then
3556         CC=$MSVC_CXX
3557         CC_BASE=`first_arg_basename "$CC"`
3558     fi
3559     if test "$BITNESS_OVERRIDE" = ""; then
3560         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3561         MSVC_CXX="$MSVC_CXX -arch:SSE"
3562     fi
3563     if test -z "$CXX"; then
3564         CXX=$MSVC_CXX
3565         CXX_BASE=`first_arg_basename "$CXX"`
3566     fi
3568     if test -n "$CC"; then
3569         # Remove /cl.exe from CC case insensitive
3570         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3571         if test "$BITNESS_OVERRIDE" = ""; then
3572            COMPATH="$VC_PRODUCT_DIR"
3573         else
3574             if test -n "$VC_PRODUCT_DIR"; then
3575                 COMPATH=$VC_PRODUCT_DIR
3576             fi
3577         fi
3578         if test "$BITNESS_OVERRIDE" = ""; then
3579             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3580             CC="$CC -arch:SSE"
3581         fi
3583         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3585         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3587         PathFormat "$COMPATH"
3588         COMPATH=`win_short_path_for_make "$formatted_path"`
3590         VCVER=$vcnum
3591         MSVSVER=$vcyear
3593         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3594         # are always "better", we list them in reverse chronological order.
3596         case "$vcnum" in
3597         150|160)
3598             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3599             ;;
3600         esac
3602         # The expectation is that --with-windows-sdk should not need to be used
3603         if test -n "$with_windows_sdk"; then
3604             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3605             *" "$with_windows_sdk" "*)
3606                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3607                 ;;
3608             *)
3609                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3610                 ;;
3611             esac
3612         fi
3614         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3615         ac_objext=obj
3616         ac_exeext=exe
3618     else
3619         AC_MSG_ERROR([Visual C++ not found after all, huh])
3620     fi
3622     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3623     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3624         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3625         // between Visual Studio versions and _MSC_VER:
3626         #if _MSC_VER < 1914
3627         #error
3628         #endif
3629     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3631     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3632     # version of the Explorer extension (and maybe other small
3633     # bits, too) needed when installing a 32-bit LibreOffice on a
3634     # 64-bit OS. The 64-bit Explorer extension is a feature that
3635     # has been present since long in OOo. Don't confuse it with
3636     # building LibreOffice itself as 64-bit code.
3638     BUILD_X64=
3639     CXX_X64_BINARY=
3641     if test "$BITNESS_OVERRIDE" = ""; then
3642         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3643         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3644              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3645             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3646                 BUILD_X64=TRUE
3647                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3648             fi
3649         fi
3650         if test "$BUILD_X64" = TRUE; then
3651             AC_MSG_RESULT([found])
3652         else
3653             AC_MSG_RESULT([not found])
3654             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3655         fi
3656     else
3657         CXX_X64_BINARY=$CXX
3658     fi
3659     AC_SUBST(BUILD_X64)
3661     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3662     AC_SUBST(CXX_X64_BINARY)
3664     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3665     # needed to support TWAIN scan on both 32- and 64-bit systems
3667     BUILD_X86=
3669     if test "$BITNESS_OVERRIDE" = "64"; then
3670         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3671         if test -n "$CXX_X86_BINARY"; then
3672             BUILD_X86=TRUE
3673             AC_MSG_RESULT([preset])
3674         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3675             BUILD_X86=TRUE
3676             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3677             CXX_X86_BINARY+=" /arch:SSE"
3678             AC_MSG_RESULT([found])
3679         else
3680             CXX_X86_BINARY=
3681             AC_MSG_RESULT([not found])
3682             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3683         fi
3684     else
3685         BUILD_X86=TRUE
3686         CXX_X86_BINARY=$MSVC_CXX
3687     fi
3688     AC_SUBST(BUILD_X86)
3689     AC_SUBST(CXX_X86_BINARY)
3691 AC_SUBST(VCVER)
3692 AC_SUBST(DEVENV)
3693 AC_SUBST(MSVC_CXX)
3696 # unowinreg.dll
3698 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3699 AC_SUBST(UNOWINREG_DLL)
3701 COM_IS_CLANG=
3702 AC_MSG_CHECKING([whether the compiler is actually Clang])
3703 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3704     #ifndef __clang__
3705     you lose
3706     #endif
3707     int foo=42;
3708     ]])],
3709     [AC_MSG_RESULT([yes])
3710      COM_IS_CLANG=TRUE],
3711     [AC_MSG_RESULT([no])])
3712 AC_SUBST(COM_IS_CLANG)
3714 CC_PLAIN=$CC
3715 CLANGVER=
3716 if test "$COM_IS_CLANG" = TRUE; then
3717     AC_MSG_CHECKING([whether Clang is new enough])
3718     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3719         #if !defined __apple_build_version__
3720         #error
3721         #endif
3722         ]])],
3723         [my_apple_clang=yes],[my_apple_clang=])
3724     if test "$my_apple_clang" = yes; then
3725         AC_MSG_RESULT([assumed yes (Apple Clang)])
3726     else
3727         if test "$_os" = WINNT; then
3728             dnl In which case, assume clang-cl:
3729             my_args="/EP /TC"
3730             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3731             dnl clang-cl:
3732             CC_PLAIN=
3733             for i in $CC; do
3734                 case $i in
3735                 -FIIntrin.h)
3736                     ;;
3737                 *)
3738                     CC_PLAIN="$CC_PLAIN $i"
3739                     ;;
3740                 esac
3741             done
3742         else
3743             my_args="-E -P"
3744         fi
3745         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3746         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3747         CLANGVER=`echo $clang_version \
3748             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3749         if test "$CLANGVER" -ge 50002; then
3750             AC_MSG_RESULT([yes ($clang_version)])
3751         else
3752             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3753         fi
3754         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3755         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3756     fi
3759 SHOWINCLUDES_PREFIX=
3760 if test "$_os" = WINNT; then
3761     dnl We need to guess the prefix of the -showIncludes output, it can be
3762     dnl localized
3763     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3764     echo "#include <stdlib.h>" > conftest.c
3765     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3766         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3767     rm -f conftest.c conftest.obj
3768     if test -z "$SHOWINCLUDES_PREFIX"; then
3769         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3770     else
3771         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3772     fi
3774 AC_SUBST(SHOWINCLUDES_PREFIX)
3777 # prefix C with ccache if needed
3779 if test "$CCACHE" != ""; then
3780     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3782     AC_LANG_PUSH([C])
3783     save_CFLAGS=$CFLAGS
3784     CFLAGS="$CFLAGS --ccache-skip -O2"
3785     dnl an empty program will do, we're checking the compiler flags
3786     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3787                       [use_ccache=yes], [use_ccache=no])
3788     if test $use_ccache = yes; then
3789         AC_MSG_RESULT([yes])
3790     else
3791         CC="$CCACHE $CC"
3792         CC_BASE="ccache $CC_BASE"
3793         AC_MSG_RESULT([no])
3794     fi
3795     CFLAGS=$save_CFLAGS
3796     AC_LANG_POP([C])
3799 # ===================================================================
3800 # check various GCC options that Clang does not support now but maybe
3801 # will somewhen in the future, check them even for GCC, so that the
3802 # flags are set
3803 # ===================================================================
3805 HAVE_GCC_GGDB2=
3806 if test "$GCC" = "yes"; then
3807     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3808     save_CFLAGS=$CFLAGS
3809     CFLAGS="$CFLAGS -Werror -ggdb2"
3810     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3811     CFLAGS=$save_CFLAGS
3812     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3813         AC_MSG_RESULT([yes])
3814     else
3815         AC_MSG_RESULT([no])
3816     fi
3818     if test "$host_cpu" = "m68k"; then
3819         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3820         save_CFLAGS=$CFLAGS
3821         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3822         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3823         CFLAGS=$save_CFLAGS
3824         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3825             AC_MSG_RESULT([yes])
3826         else
3827             AC_MSG_ERROR([no])
3828         fi
3829     fi
3831 AC_SUBST(HAVE_GCC_GGDB2)
3833 dnl ===================================================================
3834 dnl  Test the gcc version
3835 dnl ===================================================================
3836 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3837     AC_MSG_CHECKING([the GCC version])
3838     _gcc_version=`$CC -dumpversion`
3839     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3840         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3841     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3843     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3845     if test "$gcc_full_version" -lt 70000; then
3846         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3847     fi
3848 else
3849     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3850     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3851     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3852     # (which reports itself as GCC 4.2.1).
3853     GCC_VERSION=
3855 AC_SUBST(GCC_VERSION)
3857 dnl Set the ENABLE_DBGUTIL variable
3858 dnl ===================================================================
3859 AC_MSG_CHECKING([whether to build with additional debug utilities])
3860 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3861     ENABLE_DBGUTIL="TRUE"
3862     # this is an extra var so it can have different default on different MSVC
3863     # versions (in case there are version specific problems with it)
3864     MSVC_USE_DEBUG_RUNTIME="TRUE"
3866     AC_MSG_RESULT([yes])
3867     # cppunit and graphite expose STL in public headers
3868     if test "$with_system_cppunit" = "yes"; then
3869         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3870     else
3871         with_system_cppunit=no
3872     fi
3873     if test "$with_system_graphite" = "yes"; then
3874         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3875     else
3876         with_system_graphite=no
3877     fi
3878     if test "$with_system_orcus" = "yes"; then
3879         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3880     else
3881         with_system_orcus=no
3882     fi
3883     if test "$with_system_libcmis" = "yes"; then
3884         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3885     else
3886         with_system_libcmis=no
3887     fi
3888     if test "$with_system_hunspell" = "yes"; then
3889         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3890     else
3891         with_system_hunspell=no
3892     fi
3893     if test "$with_system_gpgmepp" = "yes"; then
3894         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3895     else
3896         with_system_gpgmepp=no
3897     fi
3898     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3899     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3900     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3901     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3902     # of those two is using the system variant:
3903     if test "$with_system_libnumbertext" = "yes"; then
3904         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3905     else
3906         with_system_libnumbertext=no
3907     fi
3908     if test "$with_system_libwps" = "yes"; then
3909         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3910     else
3911         with_system_libwps=no
3912     fi
3913 else
3914     ENABLE_DBGUTIL=""
3915     MSVC_USE_DEBUG_RUNTIME=""
3916     AC_MSG_RESULT([no])
3918 AC_SUBST(ENABLE_DBGUTIL)
3919 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3921 dnl Set the ENABLE_DEBUG variable.
3922 dnl ===================================================================
3923 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3924     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3926 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3927     if test -z "$libo_fuzzed_enable_debug"; then
3928         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3929     else
3930         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3931         enable_debug=yes
3932     fi
3935 AC_MSG_CHECKING([whether to do a debug build])
3936 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3937     ENABLE_DEBUG="TRUE"
3938     if test -n "$ENABLE_DBGUTIL" ; then
3939         AC_MSG_RESULT([yes (dbgutil)])
3940     else
3941         AC_MSG_RESULT([yes])
3942     fi
3943 else
3944     ENABLE_DEBUG=""
3945     AC_MSG_RESULT([no])
3947 AC_SUBST(ENABLE_DEBUG)
3949 dnl ===================================================================
3950 dnl Select the linker to use (gold/lld/ld.bfd).
3951 dnl This is done only after compiler checks (need to know if Clang is
3952 dnl used, for different defaults) and after checking if a debug build
3953 dnl is wanted (non-debug builds get the default linker if not explicitly
3954 dnl specified otherwise).
3955 dnl All checks for linker features/options should come after this.
3956 dnl ===================================================================
3957 check_use_ld()
3959     use_ld=$1
3960     use_ld_fail_if_error=$2
3961     use_ld_ok=
3962     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3963     use_ld_ldflags_save="$LDFLAGS"
3964     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3965     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3966 #include <stdio.h>
3967         ],[
3968 printf ("hello world\n");
3969         ])], USE_LD=$use_ld, [])
3970     if test -n "$USE_LD"; then
3971         AC_MSG_RESULT( yes )
3972         use_ld_ok=yes
3973     else
3974         if test -n "$use_ld_fail_if_error"; then
3975             AC_MSG_ERROR( no )
3976         else
3977             AC_MSG_RESULT( no )
3978         fi
3979     fi
3980     if test -n "$use_ld_ok"; then
3981         dnl keep the value of LDFLAGS
3982         return 0
3983     fi
3984     LDFLAGS="$use_ld_ldflags_save"
3985     return 1
3987 USE_LD=
3988 if test "$enable_ld" != "no"; then
3989     if test "$GCC" = "yes"; then
3990         if test -n "$enable_ld"; then
3991             check_use_ld "$enable_ld" fail_if_error
3992         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3993             dnl non-debug builds default to the default linker
3994             true
3995         elif test -n "$COM_IS_CLANG"; then
3996             check_use_ld lld
3997             if test $? -ne 0; then
3998                 check_use_ld gold
3999             fi
4000         else
4001             # For gcc first try gold, new versions also support lld.
4002             check_use_ld gold
4003             if test $? -ne 0; then
4004                 check_use_ld lld
4005             fi
4006         fi
4007         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4008         rm conftest.out
4009         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4010         if test -z "$ld_used"; then
4011             ld_used="unknown"
4012         fi
4013         AC_MSG_CHECKING([for linker that is used])
4014         AC_MSG_RESULT([$ld_used])
4015         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4016             if echo "$ld_used" | grep -q "^GNU ld"; then
4017                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4018                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4019             fi
4020         fi
4021     else
4022         if test "$enable_ld" = "yes"; then
4023             AC_MSG_ERROR([--enable-ld not supported])
4024         fi
4025     fi
4027 AC_SUBST(USE_LD)
4029 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4030 if test "$GCC" = "yes"; then
4031     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4032     bsymbolic_functions_ldflags_save=$LDFLAGS
4033     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4034     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4035 #include <stdio.h>
4036         ],[
4037 printf ("hello world\n");
4038         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4039     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4040         AC_MSG_RESULT( found )
4041     else
4042         AC_MSG_RESULT( not found )
4043     fi
4044     LDFLAGS=$bsymbolic_functions_ldflags_save
4046 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4049 HAVE_GSPLIT_DWARF=
4050 if test "$enable_split_debug" != no; then
4051     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4052     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4053         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4054         save_CFLAGS=$CFLAGS
4055         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4056         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4057         CFLAGS=$save_CFLAGS
4058         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4059             AC_MSG_RESULT([yes])
4060         else
4061             if test "$enable_split_debug" = yes; then
4062                 AC_MSG_ERROR([no])
4063             else
4064                 AC_MSG_RESULT([no])
4065             fi
4066         fi
4067     fi
4068     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4069         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4070         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4071     fi
4073 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4075 ENABLE_GDB_INDEX=
4076 if test "$enable_gdb_index" != "no"; then
4077     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4078     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4079         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4080         save_CFLAGS=$CFLAGS
4081         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4082         have_ggnu_pubnames=
4083         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4084         if test "$have_ggnu_pubnames" != "TRUE"; then
4085             if test "$enable_gdb_index" = "yes"; then
4086                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4087             else
4088                 AC_MSG_RESULT( no )
4089             fi
4090         else
4091             AC_MSG_RESULT( yes )
4092             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4093             ldflags_save=$LDFLAGS
4094             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4095             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4096 #include <stdio.h>
4097                 ],[
4098 printf ("hello world\n");
4099                 ])], ENABLE_GDB_INDEX=TRUE, [])
4100             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4101                 AC_MSG_RESULT( yes )
4102             else
4103                 if test "$enable_gdb_index" = "yes"; then
4104                     AC_MSG_ERROR( no )
4105                 else
4106                     AC_MSG_RESULT( no )
4107                 fi
4108             fi
4109             LDFLAGS=$ldflags_save
4110         fi
4111         CFLAGS=$save_CFLAGS
4112         fi
4113     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4114         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4115         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4116     fi
4118 AC_SUBST(ENABLE_GDB_INDEX)
4120 if test "$enable_sal_log" = yes; then
4121     ENABLE_SAL_LOG=TRUE
4123 AC_SUBST(ENABLE_SAL_LOG)
4125 dnl Check for enable symbols option
4126 dnl ===================================================================
4127 AC_MSG_CHECKING([whether to generate debug information])
4128 if test -z "$enable_symbols"; then
4129     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4130         enable_symbols=yes
4131     else
4132         enable_symbols=no
4133     fi
4135 if test "$enable_symbols" = yes; then
4136     ENABLE_SYMBOLS_FOR=all
4137     AC_MSG_RESULT([yes])
4138 elif test "$enable_symbols" = no; then
4139     ENABLE_SYMBOLS_FOR=
4140     AC_MSG_RESULT([no])
4141 else
4142     # Selective debuginfo.
4143     ENABLE_SYMBOLS_FOR="$enable_symbols"
4144     AC_MSG_RESULT([for "$enable_symbols"])
4146 AC_SUBST(ENABLE_SYMBOLS_FOR)
4148 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4149     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4150     AC_MSG_CHECKING([whether enough memory is available for linking])
4151     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4152     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4153     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4154         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4155     else
4156         AC_MSG_RESULT([yes])
4157     fi
4160 AC_MSG_CHECKING([whether to compile with optimization flags])
4161 if test -z "$enable_optimized"; then
4162     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4163         enable_optimized=no
4164     else
4165         enable_optimized=yes
4166     fi
4168 if test "$enable_optimized" != no; then
4169     ENABLE_OPTIMIZED=TRUE
4170     AC_MSG_RESULT([yes])
4171 else
4172     ENABLE_OPTIMIZED=
4173     AC_MSG_RESULT([no])
4175 AC_SUBST(ENABLE_OPTIMIZED)
4178 # determine CPUNAME, OS, ...
4179 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4181 case "$host_os" in
4183 aix*)
4184     COM=GCC
4185     CPUNAME=POWERPC
4186     USING_X11=TRUE
4187     OS=AIX
4188     RTL_OS=AIX
4189     RTL_ARCH=PowerPC
4190     PLATFORMID=aix_powerpc
4191     P_SEP=:
4192     ;;
4194 cygwin*)
4195     COM=MSC
4196     USING_X11=
4197     OS=WNT
4198     RTL_OS=Windows
4199     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4200         P_SEP=";"
4201     else
4202         P_SEP=:
4203     fi
4204     case "$host_cpu" in
4205     i*86|x86_64)
4206         if test "$BITNESS_OVERRIDE" = 64; then
4207             CPUNAME=X86_64
4208             RTL_ARCH=X86_64
4209             PLATFORMID=windows_x86_64
4210             WINDOWS_X64=1
4211             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4212         else
4213             CPUNAME=INTEL
4214             RTL_ARCH=x86
4215             PLATFORMID=windows_x86
4216         fi
4217         ;;
4218     *)
4219         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4220         ;;
4221     esac
4222     SCPDEFS="$SCPDEFS -D_MSC_VER"
4223     ;;
4225 darwin*)
4226     COM=GCC
4227     USING_X11=
4228     OS=MACOSX
4229     RTL_OS=MacOSX
4230     P_SEP=:
4232     case "$host_cpu" in
4233     arm)
4234         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4235         ;;
4236     arm64)
4237         OS=iOS
4238         RTL_OS=iOS
4239         if test "$enable_ios_simulator" = "yes"; then
4240             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4241         else
4242             CPUNAME=ARM64
4243             RTL_ARCH=ARM_EABI
4244             PLATFORMID=ios_arm64
4245         fi
4246         ;;
4247     i*86)
4248         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4249         ;;
4250     x86_64)
4251         if test "$enable_ios_simulator" = "yes"; then
4252             OS=iOS
4253         fi
4254         CPUNAME=X86_64
4255         RTL_ARCH=X86_64
4256         PLATFORMID=macosx_x86_64
4257         ;;
4258     *)
4259         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4260         ;;
4261     esac
4262     ;;
4264 dragonfly*)
4265     COM=GCC
4266     USING_X11=TRUE
4267     OS=DRAGONFLY
4268     RTL_OS=DragonFly
4269     P_SEP=:
4271     case "$host_cpu" in
4272     i*86)
4273         CPUNAME=INTEL
4274         RTL_ARCH=x86
4275         PLATFORMID=dragonfly_x86
4276         ;;
4277     x86_64)
4278         CPUNAME=X86_64
4279         RTL_ARCH=X86_64
4280         PLATFORMID=dragonfly_x86_64
4281         ;;
4282     *)
4283         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4284         ;;
4285     esac
4286     ;;
4288 freebsd*)
4289     COM=GCC
4290     USING_X11=TRUE
4291     RTL_OS=FreeBSD
4292     OS=FREEBSD
4293     P_SEP=:
4295     case "$host_cpu" in
4296     i*86)
4297         CPUNAME=INTEL
4298         RTL_ARCH=x86
4299         PLATFORMID=freebsd_x86
4300         ;;
4301     x86_64|amd64)
4302         CPUNAME=X86_64
4303         RTL_ARCH=X86_64
4304         PLATFORMID=freebsd_x86_64
4305         ;;
4306     *)
4307         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4308         ;;
4309     esac
4310     ;;
4312 haiku*)
4313     COM=GCC
4314     USING_X11=
4315     GUIBASE=haiku
4316     RTL_OS=Haiku
4317     OS=HAIKU
4318     P_SEP=:
4320     case "$host_cpu" in
4321     i*86)
4322         CPUNAME=INTEL
4323         RTL_ARCH=x86
4324         PLATFORMID=haiku_x86
4325         ;;
4326     x86_64|amd64)
4327         CPUNAME=X86_64
4328         RTL_ARCH=X86_64
4329         PLATFORMID=haiku_x86_64
4330         ;;
4331     *)
4332         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4333         ;;
4334     esac
4335     ;;
4337 kfreebsd*)
4338     COM=GCC
4339     USING_X11=TRUE
4340     OS=LINUX
4341     RTL_OS=kFreeBSD
4342     P_SEP=:
4344     case "$host_cpu" in
4346     i*86)
4347         CPUNAME=INTEL
4348         RTL_ARCH=x86
4349         PLATFORMID=kfreebsd_x86
4350         ;;
4351     x86_64)
4352         CPUNAME=X86_64
4353         RTL_ARCH=X86_64
4354         PLATFORMID=kfreebsd_x86_64
4355         ;;
4356     *)
4357         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4358         ;;
4359     esac
4360     ;;
4362 linux-gnu*)
4363     COM=GCC
4364     USING_X11=TRUE
4365     OS=LINUX
4366     RTL_OS=Linux
4367     P_SEP=:
4369     case "$host_cpu" in
4371     aarch64)
4372         CPUNAME=AARCH64
4373         PLATFORMID=linux_aarch64
4374         RTL_ARCH=AARCH64
4375         ;;
4376     alpha)
4377         CPUNAME=AXP
4378         RTL_ARCH=ALPHA
4379         PLATFORMID=linux_alpha
4380         ;;
4381     arm*)
4382         CPUNAME=ARM
4383         EPM_FLAGS="-a arm"
4384         RTL_ARCH=ARM_EABI
4385         PLATFORMID=linux_arm_eabi
4386         case "$host_cpu" in
4387         arm*-linux)
4388             RTL_ARCH=ARM_OABI
4389             PLATFORMID=linux_arm_oabi
4390             ;;
4391         esac
4392         ;;
4393     hppa)
4394         CPUNAME=HPPA
4395         RTL_ARCH=HPPA
4396         EPM_FLAGS="-a hppa"
4397         PLATFORMID=linux_hppa
4398         ;;
4399     i*86)
4400         CPUNAME=INTEL
4401         RTL_ARCH=x86
4402         PLATFORMID=linux_x86
4403         ;;
4404     ia64)
4405         CPUNAME=IA64
4406         RTL_ARCH=IA64
4407         PLATFORMID=linux_ia64
4408         ;;
4409     mips)
4410         CPUNAME=GODSON
4411         RTL_ARCH=MIPS_EB
4412         EPM_FLAGS="-a mips"
4413         PLATFORMID=linux_mips_eb
4414         ;;
4415     mips64)
4416         CPUNAME=GODSON64
4417         RTL_ARCH=MIPS64_EB
4418         EPM_FLAGS="-a mips64"
4419         PLATFORMID=linux_mips64_eb
4420         ;;
4421     mips64el)
4422         CPUNAME=GODSON64
4423         RTL_ARCH=MIPS64_EL
4424         EPM_FLAGS="-a mips64el"
4425         PLATFORMID=linux_mips64_el
4426         ;;
4427     mipsel)
4428         CPUNAME=GODSON
4429         RTL_ARCH=MIPS_EL
4430         EPM_FLAGS="-a mipsel"
4431         PLATFORMID=linux_mips_el
4432         ;;
4433     m68k)
4434         CPUNAME=M68K
4435         RTL_ARCH=M68K
4436         PLATFORMID=linux_m68k
4437         ;;
4438     powerpc)
4439         CPUNAME=POWERPC
4440         RTL_ARCH=PowerPC
4441         PLATFORMID=linux_powerpc
4442         ;;
4443     powerpc64)
4444         CPUNAME=POWERPC64
4445         RTL_ARCH=PowerPC_64
4446         PLATFORMID=linux_powerpc64
4447         ;;
4448     powerpc64le)
4449         CPUNAME=POWERPC64
4450         RTL_ARCH=PowerPC_64_LE
4451         PLATFORMID=linux_powerpc64_le
4452         ;;
4453     sparc)
4454         CPUNAME=SPARC
4455         RTL_ARCH=SPARC
4456         PLATFORMID=linux_sparc
4457         ;;
4458     sparc64)
4459         CPUNAME=SPARC64
4460         RTL_ARCH=SPARC64
4461         PLATFORMID=linux_sparc64
4462         ;;
4463     s390)
4464         CPUNAME=S390
4465         RTL_ARCH=S390
4466         PLATFORMID=linux_s390
4467         ;;
4468     s390x)
4469         CPUNAME=S390X
4470         RTL_ARCH=S390x
4471         PLATFORMID=linux_s390x
4472         ;;
4473     x86_64)
4474         CPUNAME=X86_64
4475         RTL_ARCH=X86_64
4476         PLATFORMID=linux_x86_64
4477         ;;
4478     *)
4479         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4480         ;;
4481     esac
4482     ;;
4484 linux-android*)
4485     COM=GCC
4486     USING_X11=
4487     OS=ANDROID
4488     RTL_OS=Android
4489     P_SEP=:
4491     case "$host_cpu" in
4493     arm|armel)
4494         CPUNAME=ARM
4495         RTL_ARCH=ARM_EABI
4496         PLATFORMID=android_arm_eabi
4497         ;;
4498     aarch64)
4499         CPUNAME=AARCH64
4500         RTL_ARCH=AARCH64
4501         PLATFORMID=android_aarch64
4502         ;;
4503     i*86)
4504         CPUNAME=INTEL
4505         RTL_ARCH=x86
4506         PLATFORMID=android_x86
4507         ;;
4508     x86_64)
4509         CPUNAME=X86_64
4510         RTL_ARCH=X86_64
4511         PLATFORMID=android_x86_64
4512         ;;
4513     *)
4514         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4515         ;;
4516     esac
4517     ;;
4519 *netbsd*)
4520     COM=GCC
4521     USING_X11=TRUE
4522     OS=NETBSD
4523     RTL_OS=NetBSD
4524     P_SEP=:
4526     case "$host_cpu" in
4527     i*86)
4528         CPUNAME=INTEL
4529         RTL_ARCH=x86
4530         PLATFORMID=netbsd_x86
4531         ;;
4532     powerpc)
4533         CPUNAME=POWERPC
4534         RTL_ARCH=PowerPC
4535         PLATFORMID=netbsd_powerpc
4536         ;;
4537     sparc)
4538         CPUNAME=SPARC
4539         RTL_ARCH=SPARC
4540         PLATFORMID=netbsd_sparc
4541         ;;
4542     x86_64)
4543         CPUNAME=X86_64
4544         RTL_ARCH=X86_64
4545         PLATFORMID=netbsd_x86_64
4546         ;;
4547     *)
4548         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4549         ;;
4550     esac
4551     ;;
4553 openbsd*)
4554     COM=GCC
4555     USING_X11=TRUE
4556     OS=OPENBSD
4557     RTL_OS=OpenBSD
4558     P_SEP=:
4560     case "$host_cpu" in
4561     i*86)
4562         CPUNAME=INTEL
4563         RTL_ARCH=x86
4564         PLATFORMID=openbsd_x86
4565         ;;
4566     x86_64)
4567         CPUNAME=X86_64
4568         RTL_ARCH=X86_64
4569         PLATFORMID=openbsd_x86_64
4570         ;;
4571     *)
4572         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4573         ;;
4574     esac
4575     SOLARINC="$SOLARINC -I/usr/local/include"
4576     ;;
4578 solaris*)
4579     COM=GCC
4580     USING_X11=TRUE
4581     OS=SOLARIS
4582     RTL_OS=Solaris
4583     P_SEP=:
4585     case "$host_cpu" in
4586     i*86)
4587         CPUNAME=INTEL
4588         RTL_ARCH=x86
4589         PLATFORMID=solaris_x86
4590         ;;
4591     sparc)
4592         CPUNAME=SPARC
4593         RTL_ARCH=SPARC
4594         PLATFORMID=solaris_sparc
4595         ;;
4596     sparc64)
4597         CPUNAME=SPARC64
4598         RTL_ARCH=SPARC64
4599         PLATFORMID=solaris_sparc64
4600         ;;
4601     *)
4602         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4603         ;;
4604     esac
4605     SOLARINC="$SOLARINC -I/usr/local/include"
4606     ;;
4609     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4610     ;;
4611 esac
4613 if test "$with_x" = "no"; then
4614     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4617 DISABLE_GUI=""
4618 if test "$enable_gui" = "no"; then
4619     if test "$USING_X11" != TRUE; then
4620         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4621     fi
4622     USING_X11=
4623     DISABLE_GUI=TRUE
4624     AC_DEFINE(HAVE_FEATURE_UI,0)
4625     test_cairo=yes
4627 AC_SUBST(DISABLE_GUI)
4629 WORKDIR="${BUILDDIR}/workdir"
4630 INSTDIR="${BUILDDIR}/instdir"
4631 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4632 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4633 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4634 AC_SUBST(COM)
4635 AC_SUBST(CPUNAME)
4636 AC_SUBST(RTL_OS)
4637 AC_SUBST(RTL_ARCH)
4638 AC_SUBST(EPM_FLAGS)
4639 AC_SUBST(USING_X11)
4640 AC_SUBST([INSTDIR])
4641 AC_SUBST([INSTROOT])
4642 AC_SUBST([INSTROOTBASE])
4643 AC_SUBST(OS)
4644 AC_SUBST(P_SEP)
4645 AC_SUBST(WORKDIR)
4646 AC_SUBST(PLATFORMID)
4647 AC_SUBST(WINDOWS_X64)
4648 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4650 dnl ===================================================================
4651 dnl Test which package format to use
4652 dnl ===================================================================
4653 AC_MSG_CHECKING([which package format to use])
4654 if test -n "$with_package_format" -a "$with_package_format" != no; then
4655     for i in $with_package_format; do
4656         case "$i" in
4657         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4658             ;;
4659         *)
4660             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4661 aix - AIX software distribution
4662 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4663 deb - Debian software distribution
4664 pkg - Solaris software distribution
4665 rpm - RedHat software distribution
4667 LibreOffice additionally supports:
4668 archive - .tar.gz or .zip
4669 dmg - macOS .dmg
4670 installed - installation tree
4671 msi - Windows .msi
4672         ])
4673             ;;
4674         esac
4675     done
4676     # fakeroot is needed to ensure correct file ownerships/permissions
4677     # inside deb packages and tar archives created on Linux and Solaris.
4678     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4679         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4680         if test "$FAKEROOT" = "no"; then
4681             AC_MSG_ERROR(
4682                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4683         fi
4684     fi
4685     PKGFORMAT="$with_package_format"
4686     AC_MSG_RESULT([$PKGFORMAT])
4687 else
4688     PKGFORMAT=
4689     AC_MSG_RESULT([none])
4691 AC_SUBST(PKGFORMAT)
4693 dnl ===================================================================
4694 dnl Set up a different compiler to produce tools to run on the build
4695 dnl machine when doing cross-compilation
4696 dnl ===================================================================
4698 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4699 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4700 if test "$cross_compiling" = "yes"; then
4701     AC_MSG_CHECKING([for BUILD platform configuration])
4702     echo
4703     rm -rf CONF-FOR-BUILD config_build.mk
4704     mkdir CONF-FOR-BUILD
4705     # Here must be listed all files needed when running the configure script. In particular, also
4706     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4707     # keep them in the same order as there.
4708     (cd $SRC_ROOT && tar cf - \
4709         config.guess \
4710         bin/get_config_variables \
4711         solenv/bin/getcompver.awk \
4712         solenv/inc/langlist.mk \
4713         download.lst \
4714         config_host.mk.in \
4715         config_host_lang.mk.in \
4716         Makefile.in \
4717         bin/bffvalidator.sh.in \
4718         bin/odfvalidator.sh.in \
4719         bin/officeotron.sh.in \
4720         instsetoo_native/util/openoffice.lst.in \
4721         config_host/*.in \
4722         sysui/desktop/macosx/Info.plist.in) \
4723     | (cd CONF-FOR-BUILD && tar xf -)
4724     cp configure CONF-FOR-BUILD
4725     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4726     (
4727     unset COM USING_X11 OS CPUNAME
4728     unset CC CXX SYSBASE CFLAGS
4729     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4730     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4731     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4732     if test -n "$CC_FOR_BUILD"; then
4733         export CC="$CC_FOR_BUILD"
4734         CC_BASE=`first_arg_basename "$CC"`
4735     fi
4736     if test -n "$CXX_FOR_BUILD"; then
4737         export CXX="$CXX_FOR_BUILD"
4738         CXX_BASE=`first_arg_basename "$CXX"`
4739     fi
4740     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4741     cd CONF-FOR-BUILD
4742     sub_conf_opts=""
4743     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4744     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4745     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4746     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4747     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4748     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4749     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4750     # Don't bother having configure look for stuff not needed for the build platform anyway
4751     ./configure \
4752         --disable-cups \
4753         --disable-gstreamer-1-0 \
4754         --disable-gtk3 \
4755         --disable-pdfimport \
4756         --disable-postgresql-sdbc \
4757         --with-parallelism="$with_parallelism" \
4758         --without-doxygen \
4759         --without-java \
4760         $sub_conf_opts \
4761         --srcdir=$srcdir \
4762         2>&1 | sed -e 's/^/    /'
4763     test -f ./config_host.mk 2>/dev/null || exit
4764     cp config_host.mk ../config_build.mk
4765     cp config_host_lang.mk ../config_build_lang.mk
4766     mv config.log ../config.Build.log
4767     mkdir -p ../config_build
4768     mv config_host/*.h ../config_build
4769     . ./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
4771     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
4772         VV='$'$V
4773         VV=`eval "echo $VV"`
4774         if test -n "$VV"; then
4775             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4776             echo "$line" >>build-config
4777         fi
4778     done
4780     for V in INSTDIR INSTROOT WORKDIR; do
4781         VV='$'$V
4782         VV=`eval "echo $VV"`
4783         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4784         if test -n "$VV"; then
4785             line="${V}_FOR_BUILD='$VV'"
4786             echo "$line" >>build-config
4787         fi
4788     done
4790     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4791     echo "$line" >>build-config
4793     )
4794     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4795     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])
4796     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4797              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4799     eval `cat CONF-FOR-BUILD/build-config`
4801     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4803     rm -rf CONF-FOR-BUILD
4804 else
4805     OS_FOR_BUILD="$OS"
4806     CC_FOR_BUILD="$CC"
4807     CXX_FOR_BUILD="$CXX"
4808     INSTDIR_FOR_BUILD="$INSTDIR"
4809     INSTROOT_FOR_BUILD="$INSTROOT"
4810     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4811     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4812     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4813     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4814     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4815     WORKDIR_FOR_BUILD="$WORKDIR"
4817 AC_SUBST(OS_FOR_BUILD)
4818 AC_SUBST(INSTDIR_FOR_BUILD)
4819 AC_SUBST(INSTROOT_FOR_BUILD)
4820 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4821 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4822 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4823 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4824 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4825 AC_SUBST(WORKDIR_FOR_BUILD)
4827 dnl ===================================================================
4828 dnl Check for syslog header
4829 dnl ===================================================================
4830 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4832 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4833 dnl ===================================================================
4834 AC_MSG_CHECKING([whether to turn warnings to errors])
4835 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4836     ENABLE_WERROR="TRUE"
4837     AC_MSG_RESULT([yes])
4838 else
4839     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4840         ENABLE_WERROR="TRUE"
4841         AC_MSG_RESULT([yes])
4842     else
4843         AC_MSG_RESULT([no])
4844     fi
4846 AC_SUBST(ENABLE_WERROR)
4848 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4849 dnl ===================================================================
4850 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4851 if test -z "$enable_assert_always_abort"; then
4852    if test "$ENABLE_DEBUG" = TRUE; then
4853        enable_assert_always_abort=yes
4854    else
4855        enable_assert_always_abort=no
4856    fi
4858 if test "$enable_assert_always_abort" = "yes"; then
4859     ASSERT_ALWAYS_ABORT="TRUE"
4860     AC_MSG_RESULT([yes])
4861 else
4862     ASSERT_ALWAYS_ABORT="FALSE"
4863     AC_MSG_RESULT([no])
4865 AC_SUBST(ASSERT_ALWAYS_ABORT)
4867 # Determine whether to use ooenv for the instdir installation
4868 # ===================================================================
4869 if test $_os != "WINNT" -a $_os != "Darwin"; then
4870     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4871     if test "$enable_ooenv" = "no"; then
4872         AC_MSG_RESULT([no])
4873     else
4874         ENABLE_OOENV="TRUE"
4875         AC_MSG_RESULT([yes])
4876     fi
4878 AC_SUBST(ENABLE_OOENV)
4880 if test "$USING_X11" != TRUE; then
4881     # be sure to do not mess with unneeded stuff
4882     test_randr=no
4883     test_xrender=no
4884     test_cups=no
4885     test_dbus=no
4886     build_gstreamer_1_0=no
4887     test_kf5=no
4888     test_qt5=no
4889     test_gtk3_kde5=no
4890     enable_cairo_canvas=no
4893 if test "$OS" = "HAIKU"; then
4894     enable_cairo_canvas=yes
4895     test_kf5=yes
4898 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4899     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!])
4900     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!"
4901     enable_kf5=yes
4904 if test "$test_kf5" = "yes"; then
4905     test_qt5=yes
4908 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4909     if test "$enable_qt5" = "no"; then
4910         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4911     else
4912         enable_qt5=yes
4913     fi
4916 dnl ===================================================================
4917 dnl check for cups support
4918 dnl ===================================================================
4919 ENABLE_CUPS=""
4921 if test "$enable_cups" = "no"; then
4922     test_cups=no
4925 AC_MSG_CHECKING([whether to enable CUPS support])
4926 if test "$test_cups" = "yes"; then
4927     ENABLE_CUPS="TRUE"
4928     AC_MSG_RESULT([yes])
4930     AC_MSG_CHECKING([whether cups support is present])
4931     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4932     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4933     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4934         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4935     fi
4937 else
4938     AC_MSG_RESULT([no])
4941 AC_SUBST(ENABLE_CUPS)
4943 # fontconfig checks
4944 if test "$test_fontconfig" = "yes"; then
4945     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4946     SYSTEM_FONTCONFIG=TRUE
4947     FilterLibs "${FONTCONFIG_LIBS}"
4948     FONTCONFIG_LIBS="${filteredlibs}"
4950 AC_SUBST(FONTCONFIG_CFLAGS)
4951 AC_SUBST(FONTCONFIG_LIBS)
4952 AC_SUBST([SYSTEM_FONTCONFIG])
4954 dnl whether to find & fetch external tarballs?
4955 dnl ===================================================================
4956 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4957    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4958        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4959    else
4960        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4961    fi
4963 if test -z "$TARFILE_LOCATION"; then
4964     if test -d "$SRC_ROOT/src" ; then
4965         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4966         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4967     fi
4968     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4969 else
4970     AbsolutePath "$TARFILE_LOCATION"
4971     PathFormat "${absolute_path}"
4972     TARFILE_LOCATION="${formatted_path}"
4974 AC_SUBST(TARFILE_LOCATION)
4976 AC_MSG_CHECKING([whether we want to fetch tarballs])
4977 if test "$enable_fetch_external" != "no"; then
4978     if test "$with_all_tarballs" = "yes"; then
4979         AC_MSG_RESULT([yes, all of them])
4980         DO_FETCH_TARBALLS="ALL"
4981     else
4982         AC_MSG_RESULT([yes, if we use them])
4983         DO_FETCH_TARBALLS="TRUE"
4984     fi
4985 else
4986     AC_MSG_RESULT([no])
4987     DO_FETCH_TARBALLS=
4989 AC_SUBST(DO_FETCH_TARBALLS)
4991 AC_MSG_CHECKING([whether to build help])
4992 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4993     BUILD_TYPE="$BUILD_TYPE HELP"
4994     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4995     case "$with_help" in
4996     "html")
4997         ENABLE_HTMLHELP=TRUE
4998         SCPDEFS="$SCPDEFS -DWITH_HELP"
4999         AC_MSG_RESULT([HTML])
5000         ;;
5001     "online")
5002         ENABLE_HTMLHELP=TRUE
5003         HELP_ONLINE=TRUE
5004         AC_MSG_RESULT([HTML])
5005         ;;
5006     yes)
5007         SCPDEFS="$SCPDEFS -DWITH_HELP"
5008         AC_MSG_RESULT([yes])
5009         ;;
5010     *)
5011         AC_MSG_ERROR([Unknown --with-help=$with_help])
5012         ;;
5013     esac
5014 else
5015     AC_MSG_RESULT([no])
5017 AC_SUBST([ENABLE_HTMLHELP])
5018 AC_SUBST([HELP_ONLINE])
5020 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5021 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5022     BUILD_TYPE="$BUILD_TYPE HELP"
5023     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5024     case "$with_omindex" in
5025     "server")
5026         ENABLE_HTMLHELP=TRUE
5027         HELP_ONLINE=TRUE
5028         HELP_OMINDEX_PAGE=TRUE
5029         AC_MSG_RESULT([SERVER])
5030         ;;
5031     "noxap")
5032         ENABLE_HTMLHELP=TRUE
5033         HELP_ONLINE=TRUE
5034         HELP_OMINDEX_PAGE=FALSE
5035         AC_MSG_RESULT([NOXAP])
5036         ;;
5037     *)
5038         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5039         ;;
5040     esac
5041 else
5042     HELP_OMINDEX_PAGE=FALSE
5043     AC_MSG_RESULT([no])
5045 AC_SUBST([ENABLE_HTMLHELP])
5046 AC_SUBST([HELP_OMINDEX_PAGE])
5047 AC_SUBST([HELP_ONLINE])
5050 dnl Test whether to include MySpell dictionaries
5051 dnl ===================================================================
5052 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5053 if test "$with_myspell_dicts" = "yes"; then
5054     AC_MSG_RESULT([yes])
5055     WITH_MYSPELL_DICTS=TRUE
5056     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5057     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5058 else
5059     AC_MSG_RESULT([no])
5060     WITH_MYSPELL_DICTS=
5062 AC_SUBST(WITH_MYSPELL_DICTS)
5064 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5065 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5066     if test "$with_system_dicts" = yes; then
5067         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5068     fi
5069     with_system_dicts=no
5072 AC_MSG_CHECKING([whether to use dicts from external paths])
5073 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5074     AC_MSG_RESULT([yes])
5075     SYSTEM_DICTS=TRUE
5076     AC_MSG_CHECKING([for spelling dictionary directory])
5077     if test -n "$with_external_dict_dir"; then
5078         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5079     else
5080         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5081         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5082             DICT_SYSTEM_DIR=file:///usr/share/myspell
5083         fi
5084     fi
5085     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5086     AC_MSG_CHECKING([for hyphenation patterns directory])
5087     if test -n "$with_external_hyph_dir"; then
5088         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5089     else
5090         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5091     fi
5092     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5093     AC_MSG_CHECKING([for thesaurus directory])
5094     if test -n "$with_external_thes_dir"; then
5095         THES_SYSTEM_DIR=file://$with_external_thes_dir
5096     else
5097         THES_SYSTEM_DIR=file:///usr/share/mythes
5098     fi
5099     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5100 else
5101     AC_MSG_RESULT([no])
5102     SYSTEM_DICTS=
5104 AC_SUBST(SYSTEM_DICTS)
5105 AC_SUBST(DICT_SYSTEM_DIR)
5106 AC_SUBST(HYPH_SYSTEM_DIR)
5107 AC_SUBST(THES_SYSTEM_DIR)
5109 dnl ===================================================================
5110 dnl Precompiled headers.
5111 ENABLE_PCH=""
5112 AC_MSG_CHECKING([whether to enable pch feature])
5113 if test -z "$enable_pch"; then
5114     if test "$_os" = "WINNT"; then
5115         # Enabled by default on Windows.
5116         enable_pch=yes
5117     else
5118         enable_pch=no
5119     fi
5121 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5122     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5124 if test "$enable_pch" = "system"; then
5125     ENABLE_PCH="1"
5126     AC_MSG_RESULT([yes (system headers)])
5127 elif test "$enable_pch" = "base"; then
5128     ENABLE_PCH="2"
5129     AC_MSG_RESULT([yes (system and base headers)])
5130 elif test "$enable_pch" = "normal"; then
5131     ENABLE_PCH="3"
5132     AC_MSG_RESULT([yes (normal)])
5133 elif test "$enable_pch" = "full"; then
5134     ENABLE_PCH="4"
5135     AC_MSG_RESULT([yes (full)])
5136 elif test "$enable_pch" = "yes"; then
5137     # Pick a suitable default.
5138     if test "$GCC" = "yes"; then
5139         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5140         # while making the PCHs larger and rebuilds more likely.
5141         ENABLE_PCH="2"
5142         AC_MSG_RESULT([yes (system and base headers)])
5143     else
5144         # With MSVC the highest level makes a significant difference,
5145         # and it was the default when there used to be no PCH levels.
5146         ENABLE_PCH="4"
5147         AC_MSG_RESULT([yes (full)])
5148     fi
5149 elif test "$enable_pch" = "no"; then
5150     AC_MSG_RESULT([no])
5151 else
5152     AC_MSG_ERROR([Unknown value for --enable-pch])
5154 AC_SUBST(ENABLE_PCH)
5155 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5156 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5157     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5158     if test "$CCACHE_BIN" != "not found"; then
5159         AC_MSG_CHECKING([ccache version])
5160         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5161         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5162         AC_MSG_RESULT([$CCACHE_VERSION])
5163         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5164         if test "$CCACHE_NUMVER" -gt "030701"; then
5165             AC_MSG_RESULT([yes])
5166         else
5167             AC_MSG_RESULT([no (not newer than 3.7.1)])
5168             CCACHE_DEPEND_MODE=
5169         fi
5170     fi
5173 TAB=`printf '\t'`
5175 AC_MSG_CHECKING([the GNU Make version])
5176 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5177 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5178 if test "$_make_longver" -ge "038200"; then
5179     AC_MSG_RESULT([$GNUMAKE $_make_version])
5181 elif test "$_make_longver" -ge "038100"; then
5182     if test "$build_os" = "cygwin"; then
5183         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5184     fi
5185     AC_MSG_RESULT([$GNUMAKE $_make_version])
5187     dnl ===================================================================
5188     dnl Search all the common names for sha1sum
5189     dnl ===================================================================
5190     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5191     if test -z "$SHA1SUM"; then
5192         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5193     elif test "$SHA1SUM" = "openssl"; then
5194         SHA1SUM="openssl sha1"
5195     fi
5196     AC_MSG_CHECKING([for GNU Make bug 20033])
5197     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5198     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5199 A := \$(wildcard *.a)
5201 .PHONY: all
5202 all: \$(A:.a=.b)
5203 <TAB>@echo survived bug20033.
5205 .PHONY: setup
5206 setup:
5207 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5209 define d1
5210 @echo lala \$(1)
5211 @sleep 1
5212 endef
5214 define d2
5215 @echo tyty \$(1)
5216 @sleep 1
5217 endef
5219 %.b : %.a
5220 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5221 <TAB>\$(call d1,\$(CHECKSUM)),\
5222 <TAB>\$(call d2,\$(CHECKSUM)))
5224     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5225         no_parallelism_make="YES"
5226         AC_MSG_RESULT([yes, disable parallelism])
5227     else
5228         AC_MSG_RESULT([no, keep parallelism enabled])
5229     fi
5230     rm -rf $TESTGMAKEBUG20033
5231 else
5232     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5235 # find if gnumake support file function
5236 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5237 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5238 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5239     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5241 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5242 \$(file >test.txt,Success )
5244 .PHONY: all
5245 all:
5246 <TAB>@cat test.txt
5249 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5250 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5251     HAVE_GNUMAKE_FILE_FUNC=TRUE
5252     AC_MSG_RESULT([yes])
5253 else
5254     AC_MSG_RESULT([no])
5256 rm -rf $TESTGMAKEFILEFUNC
5257 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5258 AC_SUBST(GNUMAKE_WIN_NATIVE)
5260 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5261 STALE_MAKE=
5262 if test "$_make_ver_check" = ""; then
5263    STALE_MAKE=TRUE
5266 HAVE_LD_HASH_STYLE=FALSE
5267 WITH_LINKER_HASH_STYLE=
5268 AC_MSG_CHECKING([for --hash-style gcc linker support])
5269 if test "$GCC" = "yes"; then
5270     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5271         hash_styles="gnu sysv"
5272     elif test "$with_linker_hash_style" = "no"; then
5273         hash_styles=
5274     else
5275         hash_styles="$with_linker_hash_style"
5276     fi
5278     for hash_style in $hash_styles; do
5279         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5280         hash_style_ldflags_save=$LDFLAGS
5281         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5283         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5284             [
5285 #include <stdio.h>
5286             ],[
5287 printf ("");
5288             ])],
5289             [
5290                   HAVE_LD_HASH_STYLE=TRUE
5291                   WITH_LINKER_HASH_STYLE=$hash_style
5292             ],
5293             [HAVE_LD_HASH_STYLE=FALSE],
5294             [HAVE_LD_HASH_STYLE=FALSE])
5295         LDFLAGS=$hash_style_ldflags_save
5296     done
5298     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5299         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5300     else
5301         AC_MSG_RESULT( no )
5302     fi
5303     LDFLAGS=$hash_style_ldflags_save
5304 else
5305     AC_MSG_RESULT( no )
5307 AC_SUBST(HAVE_LD_HASH_STYLE)
5308 AC_SUBST(WITH_LINKER_HASH_STYLE)
5310 dnl ===================================================================
5311 dnl Check whether there's a Perl version available.
5312 dnl ===================================================================
5313 if test -z "$with_perl_home"; then
5314     AC_PATH_PROG(PERL, perl)
5315 else
5316     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5317     _perl_path="$with_perl_home/bin/perl"
5318     if test -x "$_perl_path"; then
5319         PERL=$_perl_path
5320     else
5321         AC_MSG_ERROR([$_perl_path not found])
5322     fi
5325 dnl ===================================================================
5326 dnl Testing for Perl version 5 or greater.
5327 dnl $] is the Perl version variable, it is returned as an integer
5328 dnl ===================================================================
5329 if test "$PERL"; then
5330     AC_MSG_CHECKING([the Perl version])
5331     ${PERL} -e "exit($]);"
5332     _perl_version=$?
5333     if test "$_perl_version" -lt 5; then
5334         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5335     fi
5336     AC_MSG_RESULT([Perl $_perl_version])
5337 else
5338     AC_MSG_ERROR([Perl not found, install Perl 5])
5341 dnl ===================================================================
5342 dnl Testing for required Perl modules
5343 dnl ===================================================================
5345 AC_MSG_CHECKING([for required Perl modules])
5346 perl_use_string="use Cwd ; use Digest::MD5"
5347 if test "$_os" = "WINNT"; then
5348     if test -n "$PKGFORMAT"; then
5349         for i in $PKGFORMAT; do
5350             case "$i" in
5351             msi)
5352                 # for getting fonts versions to use in MSI
5353                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5354                 ;;
5355             esac
5356         done
5357     fi
5359 if test "$with_system_hsqldb" = "yes"; then
5360     perl_use_string="$perl_use_string ; use Archive::Zip"
5362 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5363     AC_MSG_RESULT([all modules found])
5364 else
5365     AC_MSG_RESULT([failed to find some modules])
5366     # Find out which modules are missing.
5367     for i in $perl_use_string; do
5368         if test "$i" != "use" -a "$i" != ";"; then
5369             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5370                 missing_perl_modules="$missing_perl_modules $i"
5371             fi
5372         fi
5373     done
5374     AC_MSG_ERROR([
5375     The missing Perl modules are: $missing_perl_modules
5376     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5379 dnl ===================================================================
5380 dnl Check for pkg-config
5381 dnl ===================================================================
5382 if test "$_os" != "WINNT"; then
5383     PKG_PROG_PKG_CONFIG
5386 if test "$_os" != "WINNT"; then
5388     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5389     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5390     # explicitly. Or put /path/to/compiler in PATH yourself.
5392     # Use wrappers for LTO
5393     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5394         AC_CHECK_TOOL(AR,gcc-ar)
5395         AC_CHECK_TOOL(NM,gcc-nm)
5396         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5397     else
5398         AC_CHECK_TOOL(AR,ar)
5399         AC_CHECK_TOOL(NM,nm)
5400         AC_CHECK_TOOL(RANLIB,ranlib)
5401     fi
5402     AC_CHECK_TOOL(OBJDUMP,objdump)
5403     AC_CHECK_TOOL(READELF,readelf)
5404     AC_CHECK_TOOL(STRIP,strip)
5405     if test "$_os" = "WINNT"; then
5406         AC_CHECK_TOOL(DLLTOOL,dlltool)
5407         AC_CHECK_TOOL(WINDRES,windres)
5408     fi
5410 AC_SUBST(AR)
5411 AC_SUBST(DLLTOOL)
5412 AC_SUBST(NM)
5413 AC_SUBST(OBJDUMP)
5414 AC_SUBST(PKG_CONFIG)
5415 AC_SUBST(RANLIB)
5416 AC_SUBST(READELF)
5417 AC_SUBST(STRIP)
5418 AC_SUBST(WINDRES)
5420 dnl ===================================================================
5421 dnl pkg-config checks on macOS
5422 dnl ===================================================================
5424 if test $_os = Darwin; then
5425     AC_MSG_CHECKING([for bogus pkg-config])
5426     if test -n "$PKG_CONFIG"; then
5427         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5428             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5429         else
5430             if test "$enable_bogus_pkg_config" = "yes"; then
5431                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5432             else
5433                 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.])
5434             fi
5435         fi
5436     else
5437         AC_MSG_RESULT([no, good])
5438     fi
5441 find_csc()
5443     # Return value: $csctest
5445     unset csctest
5447     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5448     if test -n "$regvalue"; then
5449         csctest=$regvalue
5450         return
5451     fi
5454 find_al()
5456     # Return value: $altest
5458     unset altest
5460     # We need this check to detect 4.6.1 or above.
5461     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5462         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5463         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5464             altest=$regvalue
5465             return
5466         fi
5467     done
5469     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5470         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5471         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5472             altest=$regvalue
5473             return
5474         fi
5475     done
5480 find_dotnetsdk46()
5482     unset frametest
5484     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5485         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5486         if test -n "$regvalue"; then
5487             frametest=$regvalue
5488             return
5489         fi
5490     done
5493 find_winsdk_version()
5495     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5496     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5498     unset winsdktest winsdkbinsubdir winsdklibsubdir
5500     case "$1" in
5501     8.0|8.0A)
5502         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5503         if test -n "$regvalue"; then
5504             winsdktest=$regvalue
5505             winsdklibsubdir=win8
5506             return
5507         fi
5508         ;;
5509     8.1|8.1A)
5510         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5511         if test -n "$regvalue"; then
5512             winsdktest=$regvalue
5513             winsdklibsubdir=winv6.3
5514             return
5515         fi
5516         ;;
5517     10.0)
5518         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5519         if test -n "$regvalue"; then
5520             winsdktest=$regvalue
5521             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5522             if test -n "$regvalue"; then
5523                 winsdkbinsubdir="$regvalue".0
5524                 winsdklibsubdir=$winsdkbinsubdir
5525                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5526                 # test exist the SDK path
5527                 if test -d "$tmppath"; then
5528                    # when path is convertible to a short path then path is okay
5529                    cygpath -d "$tmppath" >/dev/null 2>&1
5530                    if test $? -ne 0; then
5531                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5532                    fi
5533                 else
5534                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5535                 fi
5536             fi
5537             return
5538         fi
5539         ;;
5540     esac
5543 find_winsdk()
5545     # Return value: From find_winsdk_version
5547     unset winsdktest
5549     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5550         find_winsdk_version $ver
5551         if test -n "$winsdktest"; then
5552             return
5553         fi
5554     done
5557 find_msms()
5559     AC_MSG_CHECKING([for MSVC merge modules directory])
5560     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5561     case "$VCVER" in
5562         150|160)
5563         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5564         ;;
5565     esac
5566     for f in $my_msm_files; do
5567         echo "$as_me:$LINENO: searching for $f" >&5
5568     done
5570     msmdir=
5571     for ver in 14.0 15.0; do
5572         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5573         if test -n "$regvalue"; then
5574             for f in ${my_msm_files}; do
5575                 if test -e "$regvalue/${f}"; then
5576                     msmdir=$regvalue
5577                     break
5578                 fi
5579             done
5580         fi
5581     done
5582     dnl Is the following fallback really necessary, or was it added in response
5583     dnl to never having started Visual Studio on a given machine, so the
5584     dnl registry keys checked above had presumably not yet been created?
5585     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5586     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5587     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5588     dnl expanding to "C:\Program Files\Common Files"), which would need
5589     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5590     dnl obtain its value from cygwin:
5591     if test -z "$msmdir"; then
5592         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5593         for f in ${my_msm_files}; do
5594             if test -e "$my_msm_dir/${f}"; then
5595                 msmdir=$my_msm_dir
5596             fi
5597         done
5598     fi
5600     dnl Starting from MSVC 15.0, merge modules are located in different directory
5601     case "$VCVER" in
5602     150|160)
5603         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5604             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5605             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5606             for f in ${my_msm_files}; do
5607                 if test -e "$my_msm_dir/${f}"; then
5608                     msmdir=$my_msm_dir
5609                     break
5610                 fi
5611             done
5612         done
5613         ;;
5614     esac
5616     if test -n "$msmdir"; then
5617         msmdir=`cygpath -m "$msmdir"`
5618         AC_MSG_RESULT([$msmdir])
5619     else
5620         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5621             AC_MSG_FAILURE([not found])
5622         else
5623             AC_MSG_WARN([not found (check config.log)])
5624             add_warning "MSM none of ${my_msm_files} found"
5625         fi
5626     fi
5629 find_msvc_x64_dlls()
5631     AC_MSG_CHECKING([for MSVC x64 DLL path])
5632     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5633     case "$VCVER" in
5634     150|160)
5635         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5636             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5637             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5638                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5639                 break
5640             fi
5641             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5642             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5643                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5644                 break
5645             fi
5646             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5647             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5648                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5649                 break
5650             fi
5651         done
5652         ;;
5653     esac
5654     AC_MSG_RESULT([$msvcdllpath])
5655     AC_MSG_CHECKING([for MSVC x64 DLLs])
5656     msvcdlls="msvcp140.dll vcruntime140.dll"
5657     for dll in $msvcdlls; do
5658         if ! test -f "$msvcdllpath/$dll"; then
5659             AC_MSG_FAILURE([missing $dll])
5660         fi
5661     done
5662     AC_MSG_RESULT([found all ($msvcdlls)])
5665 dnl =========================================
5666 dnl Check for the Windows  SDK.
5667 dnl =========================================
5668 if test "$_os" = "WINNT"; then
5669     AC_MSG_CHECKING([for Windows SDK])
5670     if test "$build_os" = "cygwin"; then
5671         find_winsdk
5672         WINDOWS_SDK_HOME=$winsdktest
5674         # normalize if found
5675         if test -n "$WINDOWS_SDK_HOME"; then
5676             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5677             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5678         fi
5680         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5681     fi
5683     if test -n "$WINDOWS_SDK_HOME"; then
5684         # Remove a possible trailing backslash
5685         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5687         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5688              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5689              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5690             have_windows_sdk_headers=yes
5691         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5692              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5693              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5694             have_windows_sdk_headers=yes
5695         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5696              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5697              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5698             have_windows_sdk_headers=yes
5699         else
5700             have_windows_sdk_headers=no
5701         fi
5703         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5704             have_windows_sdk_libs=yes
5705         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5706             have_windows_sdk_libs=yes
5707         else
5708             have_windows_sdk_libs=no
5709         fi
5711         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5712             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5713 the  Windows SDK are installed.])
5714         fi
5715     fi
5717     if test -z "$WINDOWS_SDK_HOME"; then
5718         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5719     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5720         WINDOWS_SDK_VERSION=80
5721         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5722     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5723         WINDOWS_SDK_VERSION=81
5724         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5725     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5726         WINDOWS_SDK_VERSION=10
5727         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5728     else
5729         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5730     fi
5731     PathFormat "$WINDOWS_SDK_HOME"
5732     WINDOWS_SDK_HOME="$formatted_path"
5733     if test "$build_os" = "cygwin"; then
5734         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5735         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5736             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5737         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5738             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5739         fi
5740     fi
5742     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5743     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5744     dnl but not in v8.0), so allow this to be overridden with a
5745     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5746     dnl and configuration error if no WiLangId.vbs is found would arguably be
5747     dnl better, but I do not know under which conditions exactly it is needed by
5748     dnl msiglobal.pm:
5749     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5750         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5751         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5752             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5753         fi
5754         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5755             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5756         fi
5757         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5758             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5759         fi
5760     fi
5761     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5762         if test -n "$with_package_format" -a "$with_package_format" != no; then
5763             for i in "$with_package_format"; do
5764                 if test "$i" = "msi"; then
5765                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5766                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5767                     fi
5768                 fi
5769             done
5770         fi
5771     fi
5773 AC_SUBST(WINDOWS_SDK_HOME)
5774 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5775 AC_SUBST(WINDOWS_SDK_VERSION)
5776 AC_SUBST(WINDOWS_SDK_WILANGID)
5778 if test "$build_os" = "cygwin"; then
5779     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5780     dnl dir, it also determines that dir's path w/o an arch segment if any,
5781     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5782     AC_MSG_CHECKING([for midl.exe])
5784     find_winsdk
5785     if test -n "$winsdkbinsubdir" \
5786         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5787     then
5788         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5789         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5790     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5791         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5792         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5793     elif test -f "$winsdktest/Bin/midl.exe"; then
5794         MIDL_PATH=$winsdktest/Bin
5795         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5796     fi
5797     if test ! -f "$MIDL_PATH/midl.exe"; then
5798         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5799     else
5800         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5801     fi
5803     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5804     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5806     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5807          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5808          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5809          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5810     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5811          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5812          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5813          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5814     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5815          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5816          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5817          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5818     else
5819         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5820     fi
5822     dnl Check csc.exe
5823     AC_MSG_CHECKING([for csc.exe])
5824     find_csc
5825     if test -f "$csctest/csc.exe"; then
5826         CSC_PATH="$csctest"
5827     fi
5828     if test ! -f "$CSC_PATH/csc.exe"; then
5829         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5830     else
5831         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5832     fi
5834     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5836     dnl Check al.exe
5837     AC_MSG_CHECKING([for al.exe])
5838     find_winsdk
5839     if test -n "$winsdkbinsubdir" \
5840         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5841     then
5842         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5843     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5844         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5845     elif test -f "$winsdktest/Bin/al.exe"; then
5846         AL_PATH="$winsdktest/Bin"
5847     fi
5849     if test -z "$AL_PATH"; then
5850         find_al
5851         if test -f "$altest/bin/al.exe"; then
5852             AL_PATH="$altest/bin"
5853         elif test -f "$altest/al.exe"; then
5854             AL_PATH="$altest"
5855         fi
5856     fi
5857     if test ! -f "$AL_PATH/al.exe"; then
5858         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5859     else
5860         AC_MSG_RESULT([$AL_PATH/al.exe])
5861     fi
5863     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5865     dnl Check mscoree.lib / .NET Framework dir
5866     AC_MSG_CHECKING(.NET Framework)
5867     find_dotnetsdk46
5868     PathFormat "$frametest"
5869     frametest="$formatted_path"
5870     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5871         DOTNET_FRAMEWORK_HOME="$frametest"
5872     else
5873         find_winsdk
5874         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5875             DOTNET_FRAMEWORK_HOME="$winsdktest"
5876         fi
5877     fi
5878     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
5879         AC_MSG_ERROR([mscoree.lib not found])
5880     fi
5881     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5883     PathFormat "$MIDL_PATH"
5884     MIDL_PATH="$formatted_path"
5886     PathFormat "$AL_PATH"
5887     AL_PATH="$formatted_path"
5889     PathFormat "$DOTNET_FRAMEWORK_HOME"
5890     DOTNET_FRAMEWORK_HOME="$formatted_path"
5892     PathFormat "$CSC_PATH"
5893     CSC_PATH="$formatted_path"
5896 dnl ===================================================================
5897 dnl Check if stdc headers are available excluding MSVC.
5898 dnl ===================================================================
5899 if test "$_os" != "WINNT"; then
5900     AC_HEADER_STDC
5903 dnl ===================================================================
5904 dnl Testing for C++ compiler and version...
5905 dnl ===================================================================
5907 if test "$_os" != "WINNT"; then
5908     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5909     save_CXXFLAGS=$CXXFLAGS
5910     AC_PROG_CXX
5911     CXXFLAGS=$save_CXXFLAGS
5912     if test -z "$CXX_BASE"; then
5913         CXX_BASE=`first_arg_basename "$CXX"`
5914     fi
5917 dnl check for GNU C++ compiler version
5918 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5919     AC_MSG_CHECKING([the GNU C++ compiler version])
5921     _gpp_version=`$CXX -dumpversion`
5922     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5924     if test "$_gpp_majmin" -lt "700"; then
5925         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5926     else
5927         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5928     fi
5930     dnl see https://code.google.com/p/android/issues/detail?id=41770
5931         glibcxx_threads=no
5932         AC_LANG_PUSH([C++])
5933         AC_REQUIRE_CPP
5934         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5935         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5936             #include <bits/c++config.h>]],[[
5937             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5938             && !defined(_GLIBCXX__PTHREADS) \
5939             && !defined(_GLIBCXX_HAS_GTHREADS)
5940             choke me
5941             #endif
5942         ]])],[AC_MSG_RESULT([yes])
5943         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5944         AC_LANG_POP([C++])
5945         if test $glibcxx_threads = yes; then
5946             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5947         fi
5949 AC_SUBST(BOOST_CXXFLAGS)
5952 # prefx CXX with ccache if needed
5954 if test "$CCACHE" != ""; then
5955     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5956     AC_LANG_PUSH([C++])
5957     save_CXXFLAGS=$CXXFLAGS
5958     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5959     dnl an empty program will do, we're checking the compiler flags
5960     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5961                       [use_ccache=yes], [use_ccache=no])
5962     if test $use_ccache = yes; then
5963         AC_MSG_RESULT([yes])
5964     else
5965         CXX="$CCACHE $CXX"
5966         CXX_BASE="ccache $CXX_BASE"
5967         AC_MSG_RESULT([no])
5968     fi
5969     CXXFLAGS=$save_CXXFLAGS
5970     AC_LANG_POP([C++])
5973 dnl ===================================================================
5974 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5975 dnl ===================================================================
5977 if test "$_os" != "WINNT"; then
5978     AC_PROG_CXXCPP
5980     dnl Check whether there's a C pre-processor.
5981     AC_PROG_CPP
5985 dnl ===================================================================
5986 dnl Find integral type sizes and alignments
5987 dnl ===================================================================
5989 if test "$_os" != "WINNT"; then
5991 if test "$_os" = "iOS"; then
5992     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5993     ac_cv_sizeof_long=8
5994     ac_cv_sizeof_short=2
5995     ac_cv_sizeof_int=4
5996     ac_cv_sizeof_long_long=8
5997     ac_cv_sizeof_double=8
5998     ac_cv_sizeof_voidp=8
5999 else
6000     AC_CHECK_SIZEOF(long)
6001     AC_CHECK_SIZEOF(short)
6002     AC_CHECK_SIZEOF(int)
6003     AC_CHECK_SIZEOF(long long)
6004     AC_CHECK_SIZEOF(double)
6005     AC_CHECK_SIZEOF(void*)
6008     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6009     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6010     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6011     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6012     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6014     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6015     m4_pattern_allow([AC_CHECK_ALIGNOF])
6016     m4_ifdef([AC_CHECK_ALIGNOF],
6017         [
6018             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6019             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6020             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6021             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6022         ],
6023         [
6024             case "$_os-$host_cpu" in
6025             Linux-i686)
6026                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6027                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6028                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6029                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6030                 ;;
6031             Linux-x86_64)
6032                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6033                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6034                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6035                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6036                 ;;
6037             *)
6038                 if test -z "$ac_cv_alignof_short" -o \
6039                         -z "$ac_cv_alignof_int" -o \
6040                         -z "$ac_cv_alignof_long" -o \
6041                         -z "$ac_cv_alignof_double"; then
6042                    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.])
6043                 fi
6044                 ;;
6045             esac
6046         ])
6048     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6049     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6050     if test $ac_cv_sizeof_long -eq 8; then
6051         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6052     elif test $ac_cv_sizeof_double -eq 8; then
6053         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6054     else
6055         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6056     fi
6058     dnl Check for large file support
6059     AC_SYS_LARGEFILE
6060     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6061         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6062     fi
6063     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6064         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6065     fi
6066 else
6067     # Hardcode for MSVC
6068     SAL_TYPES_SIZEOFSHORT=2
6069     SAL_TYPES_SIZEOFINT=4
6070     SAL_TYPES_SIZEOFLONG=4
6071     SAL_TYPES_SIZEOFLONGLONG=8
6072     if test "$BITNESS_OVERRIDE" = ""; then
6073         SAL_TYPES_SIZEOFPOINTER=4
6074     else
6075         SAL_TYPES_SIZEOFPOINTER=8
6076     fi
6077     SAL_TYPES_ALIGNMENT2=2
6078     SAL_TYPES_ALIGNMENT4=4
6079     SAL_TYPES_ALIGNMENT8=8
6080     LFS_CFLAGS=''
6082 AC_SUBST(LFS_CFLAGS)
6084 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6085 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6086 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6087 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6088 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6089 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6090 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6091 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6093 dnl ===================================================================
6094 dnl Check whether to enable runtime optimizations
6095 dnl ===================================================================
6096 ENABLE_RUNTIME_OPTIMIZATIONS=
6097 AC_MSG_CHECKING([whether to enable runtime optimizations])
6098 if test -z "$enable_runtime_optimizations"; then
6099     for i in $CC; do
6100         case $i in
6101         -fsanitize=*)
6102             enable_runtime_optimizations=no
6103             break
6104             ;;
6105         esac
6106     done
6108 if test "$enable_runtime_optimizations" != no; then
6109     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6110     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6111     AC_MSG_RESULT([yes])
6112 else
6113     AC_MSG_RESULT([no])
6115 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6117 dnl ===================================================================
6118 dnl Check if valgrind headers are available
6119 dnl ===================================================================
6120 ENABLE_VALGRIND=
6121 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6122     prev_cppflags=$CPPFLAGS
6123     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6124     # or where does it come from?
6125     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6126     AC_CHECK_HEADER([valgrind/valgrind.h],
6127         [ENABLE_VALGRIND=TRUE])
6128     CPPFLAGS=$prev_cppflags
6130 AC_SUBST([ENABLE_VALGRIND])
6131 if test -z "$ENABLE_VALGRIND"; then
6132     if test "$with_valgrind" = yes; then
6133         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6134     fi
6135     VALGRIND_CFLAGS=
6137 AC_SUBST([VALGRIND_CFLAGS])
6140 dnl ===================================================================
6141 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6142 dnl ===================================================================
6144 # We need at least the sys/sdt.h include header.
6145 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6146 if test "$SDT_H_FOUND" = "TRUE"; then
6147     # Found sys/sdt.h header, now make sure the c++ compiler works.
6148     # Old g++ versions had problems with probes in constructors/destructors.
6149     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6150     AC_LANG_PUSH([C++])
6151     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6152     #include <sys/sdt.h>
6153     class ProbeClass
6154     {
6155     private:
6156       int& ref;
6157       const char *name;
6159     public:
6160       ProbeClass(int& v, const char *n) : ref(v), name(n)
6161       {
6162         DTRACE_PROBE2(_test_, cons, name, ref);
6163       }
6165       void method(int min)
6166       {
6167         DTRACE_PROBE3(_test_, meth, name, ref, min);
6168         ref -= min;
6169       }
6171       ~ProbeClass()
6172       {
6173         DTRACE_PROBE2(_test_, dest, name, ref);
6174       }
6175     };
6176     ]],[[
6177     int i = 64;
6178     DTRACE_PROBE1(_test_, call, i);
6179     ProbeClass inst = ProbeClass(i, "call");
6180     inst.method(24);
6181     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6182           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6183     AC_LANG_POP([C++])
6185 AC_CONFIG_HEADERS([config_host/config_probes.h])
6187 dnl ===================================================================
6188 dnl GCC features
6189 dnl ===================================================================
6190 HAVE_GCC_STACK_CLASH_PROTECTION=
6191 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6192     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6193     save_CFLAGS=$CFLAGS
6194     CFLAGS="$CFLAGS -fstack-clash-protection"
6195     AC_LINK_IFELSE(
6196         [AC_LANG_PROGRAM(, [[return 0;]])],
6197         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6198         [AC_MSG_RESULT([no])])
6199     CFLAGS=$save_CFLAGS
6201     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6202     save_CFLAGS=$CFLAGS
6203     CFLAGS="$CFLAGS -Werror -mno-avx"
6204     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6205     CFLAGS=$save_CFLAGS
6206     if test "$HAVE_GCC_AVX" = "TRUE"; then
6207         AC_MSG_RESULT([yes])
6208     else
6209         AC_MSG_RESULT([no])
6210     fi
6212     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6213     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6214     int v = 0;
6215     if (__sync_add_and_fetch(&v, 1) != 1 ||
6216         __sync_sub_and_fetch(&v, 1) != 0)
6217         return 1;
6218     __sync_synchronize();
6219     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6220         v != 1)
6221         return 1;
6222     return 0;
6223 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6224     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6225         AC_MSG_RESULT([yes])
6226         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6227     else
6228         AC_MSG_RESULT([no])
6229     fi
6231     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6232     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6233     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6234         AC_MSG_RESULT([yes])
6235         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6236     else
6237         AC_MSG_RESULT([no])
6238     fi
6240     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6241     save_CFLAGS=$CFLAGS
6242     CFLAGS="$CFLAGS -Werror"
6243     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6244             __attribute__((deprecated("test"))) void f();
6245         ])], [
6246             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6247             AC_MSG_RESULT([yes])
6248         ], [AC_MSG_RESULT([no])])
6249     CFLAGS=$save_CFLAGS
6251     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6252     AC_LANG_PUSH([C++])
6253     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6254             #include <cstddef>
6255             #include <cxxabi.h>
6256             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6257         ])], [
6258             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6259             AC_MSG_RESULT([yes])
6260         ], [AC_MSG_RESULT([no])])
6261     AC_LANG_POP([C++])
6263     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6264     AC_LANG_PUSH([C++])
6265     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6266             #include <cstddef>
6267             #include <cxxabi.h>
6268             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6269         ])], [
6270             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6271             AC_MSG_RESULT([yes])
6272         ], [AC_MSG_RESULT([no])])
6273     AC_LANG_POP([C++])
6275     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6276     AC_LANG_PUSH([C++])
6277     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6278             #include <cxxabi.h>
6279             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6280         ])], [
6281             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6282             AC_MSG_RESULT([yes])
6283         ], [AC_MSG_RESULT([no])])
6284     AC_LANG_POP([C++])
6286     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6287     AC_LANG_PUSH([C++])
6288     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6289             #include <cstddef>
6290             #include <cxxabi.h>
6291             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6292         ])], [
6293             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6294             AC_MSG_RESULT([yes])
6295         ], [AC_MSG_RESULT([no])])
6296     AC_LANG_POP([C++])
6298     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6299     AC_LANG_PUSH([C++])
6300     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6301             #include <cstddef>
6302             #include <cxxabi.h>
6303             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6304         ])], [
6305             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6306             AC_MSG_RESULT([yes])
6307         ], [AC_MSG_RESULT([no])])
6308     AC_LANG_POP([C++])
6310     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6311     AC_LANG_PUSH([C++])
6312     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6313             #include <cxxabi.h>
6314             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6315         ])], [
6316             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6317             AC_MSG_RESULT([yes])
6318         ], [AC_MSG_RESULT([no])])
6319     AC_LANG_POP([C++])
6321     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6322     AC_LANG_PUSH([C++])
6323     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6324             #include <cxxabi.h>
6325             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6326         ])], [
6327             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6328             AC_MSG_RESULT([yes])
6329         ], [AC_MSG_RESULT([no])])
6330     AC_LANG_POP([C++])
6332     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6333     AC_LANG_PUSH([C++])
6334     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6335             #include <cxxabi.h>
6336             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6337         ])], [
6338             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6339             AC_MSG_RESULT([yes])
6340         ], [AC_MSG_RESULT([no])])
6341     AC_LANG_POP([C++])
6343     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6344     AC_LANG_PUSH([C++])
6345     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6346             #include <cstddef>
6347             #include <cxxabi.h>
6348             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6349         ])], [
6350             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6351             AC_MSG_RESULT([yes])
6352         ], [AC_MSG_RESULT([no])])
6353     AC_LANG_POP([C++])
6355     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6356     AC_LANG_PUSH([C++])
6357     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6358             #include <cstddef>
6359             #include <cxxabi.h>
6360             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6361         ])], [
6362             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6363             AC_MSG_RESULT([yes])
6364         ], [AC_MSG_RESULT([no])])
6365     AC_LANG_POP([C++])
6367     dnl Available in GCC 4.9 and at least since Clang 3.4:
6368     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6369     AC_LANG_PUSH([C++])
6370     save_CXXFLAGS=$CXXFLAGS
6371     CXXFLAGS="$CXXFLAGS -Werror"
6372     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6373             struct __attribute__((warn_unused)) dummy {};
6374         ])], [
6375             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6376             AC_MSG_RESULT([yes])
6377         ], [AC_MSG_RESULT([no])])
6378     CXXFLAGS=$save_CXXFLAGS
6379 AC_LANG_POP([C++])
6382 AC_SUBST(HAVE_GCC_AVX)
6383 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6384 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6385 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6387 dnl ===================================================================
6388 dnl Identify the C++ library
6389 dnl ===================================================================
6391 AC_MSG_CHECKING([what the C++ library is])
6392 AC_LANG_PUSH([C++])
6393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6394 #include <utility>
6395 #ifndef __GLIBCXX__
6396 foo bar
6397 #endif
6398 ]])],
6399     [CPP_LIBRARY=GLIBCXX
6400      cpp_library_name="GNU libstdc++"
6401     ],
6402     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6403 #include <utility>
6404 #ifndef _LIBCPP_VERSION
6405 foo bar
6406 #endif
6407 ]])],
6408     [CPP_LIBRARY=LIBCPP
6409      cpp_library_name="LLVM libc++"
6410      AC_DEFINE([HAVE_LIBCXX])
6411     ],
6412     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6413 #include <utility>
6414 #ifndef _MSC_VER
6415 foo bar
6416 #endif
6417 ]])],
6418     [CPP_LIBRARY=MSVCRT
6419      cpp_library_name="Microsoft"
6420     ],
6421     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6422 AC_MSG_RESULT([$cpp_library_name])
6423 AC_LANG_POP([C++])
6425 dnl ===================================================================
6426 dnl Check for gperf
6427 dnl ===================================================================
6428 AC_PATH_PROG(GPERF, gperf)
6429 if test -z "$GPERF"; then
6430     AC_MSG_ERROR([gperf not found but needed. Install it.])
6432 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6433     GPERF=`cygpath -m $GPERF`
6435 AC_MSG_CHECKING([whether gperf is new enough])
6436 my_gperf_ver1=$($GPERF --version | head -n 1)
6437 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6438 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6439 if test "$my_gperf_ver3" -ge 301; then
6440     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6441 else
6442     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6444 AC_SUBST(GPERF)
6446 dnl ===================================================================
6447 dnl Check for system libcmis
6448 dnl ===================================================================
6449 # libcmis requires curl and we can't build curl for iOS
6450 if test $_os != iOS; then
6451     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6452     ENABLE_LIBCMIS=TRUE
6453 else
6454     ENABLE_LIBCMIS=
6456 AC_SUBST(ENABLE_LIBCMIS)
6458 dnl ===================================================================
6459 dnl C++11
6460 dnl ===================================================================
6462 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6463 CXXFLAGS_CXX11=
6464 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6465     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6466 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6467     my_flags='-std=c++2a -std=c++17 -std=c++1z'
6468     for flag in $my_flags; do
6469         if test "$COM" = MSC; then
6470             flag="-Xclang $flag"
6471         fi
6472         save_CXXFLAGS=$CXXFLAGS
6473         CXXFLAGS="$CXXFLAGS $flag -Werror"
6474         if test "$SYSTEM_LIBCMIS" = TRUE; then
6475             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6476         fi
6477         AC_LANG_PUSH([C++])
6478         dnl Clang 3.9 supports __float128 since
6479         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6480         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6481         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6482         dnl $flag is supported below, so check this first):
6483         my_float128hack=
6484         my_float128hack_impl=-D__float128=void
6485         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6486             #include <vector>
6487             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6488             // (__float128)
6489             ]])
6490         ],,[
6491             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6492             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6493             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6494             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6495             dnl place where __float128 is used is in a template specialization, -D__float128=void
6496             dnl will avoid the problem there while still causing a problem if somebody actually uses
6497             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6498             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6499             dnl "fixed" with this hack):
6500             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6501             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6502                 #include <vector>
6503                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6504                 // (__float128)
6505                 ]])
6506             ],[my_float128hack=$my_float128hack_impl])
6507         ])
6508         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6509             #include <algorithm>
6510             #include <functional>
6511             #include <vector>
6513             #if defined SYSTEM_LIBCMIS
6514             // See ucb/source/ucp/cmis/auth_provider.hxx:
6515             #if !defined __clang__
6516             #pragma GCC diagnostic push
6517             #pragma GCC diagnostic ignored "-Wdeprecated"
6518             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6519             #endif
6520             #include <libcmis/libcmis.hxx>
6521             #if !defined __clang__
6522             #pragma GCC diagnostic pop
6523             #endif
6524             #endif
6526             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6527                 std::sort(v.begin(), v.end(), fn);
6528             }
6529             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6530         AC_LANG_POP([C++])
6531         CXXFLAGS=$save_CXXFLAGS
6532         if test -n "$CXXFLAGS_CXX11"; then
6533             break
6534         fi
6535     done
6537 if test -n "$CXXFLAGS_CXX11"; then
6538     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6539 else
6540     AC_MSG_ERROR(no)
6542 AC_SUBST(CXXFLAGS_CXX11)
6544 if test "$GCC" = "yes"; then
6545     save_CXXFLAGS=$CXXFLAGS
6546     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6547     CHECK_L_ATOMIC
6548     CXXFLAGS=$save_CXXFLAGS
6549     AC_SUBST(ATOMIC_LIB)
6552 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6553 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6554 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6555 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6556 dnl again towards 4.7.2:
6557 if test $CPP_LIBRARY = GLIBCXX; then
6558     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6559     AC_LANG_PUSH([C++])
6560     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6561 #include <list>
6562 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6563     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6564     //   GCC 4.7.0: 20120322
6565     //   GCC 4.7.1: 20120614
6566     // and using a range check is not possible as the mapping between
6567     // __GLIBCXX__ values and GCC versions is not monotonic
6568 /* ok */
6569 #else
6570 abi broken
6571 #endif
6572         ]])], [AC_MSG_RESULT(no, ok)],
6573         [AC_MSG_ERROR(yes)])
6574     AC_LANG_POP([C++])
6577 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6578 save_CXXFLAGS=$CXXFLAGS
6579 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6580 AC_LANG_PUSH([C++])
6582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6583 #include <stddef.h>
6585 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6587 namespace
6589         struct b
6590         {
6591                 int i;
6592                 int j;
6593         };
6595 ]], [[
6596 struct a
6598         int i;
6599         int j;
6601 a thinga[]={{0,0}, {1,1}};
6602 b thingb[]={{0,0}, {1,1}};
6603 size_t i = sizeof(sal_n_array_size(thinga));
6604 size_t j = sizeof(sal_n_array_size(thingb));
6605 return !(i != 0 && j != 0);
6607     ], [ AC_MSG_RESULT(yes) ],
6608     [ AC_MSG_ERROR(no)])
6609 AC_LANG_POP([C++])
6610 CXXFLAGS=$save_CXXFLAGS
6612 dnl _Pragma support (may require C++11)
6613 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6614     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6615     AC_LANG_PUSH([C++])
6616     save_CXXFLAGS=$CXXFLAGS
6617     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6618     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6619             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6620         ])], [
6621             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6622             AC_MSG_RESULT([yes])
6623         ], [AC_MSG_RESULT([no])])
6624     AC_LANG_POP([C++])
6625     CXXFLAGS=$save_CXXFLAGS
6628 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6629 if test "$GCC" = yes; then
6630     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6631     AC_LANG_PUSH([C++])
6632     save_CXXFLAGS=$CXXFLAGS
6633     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6634     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6635     CXXFLAGS=$save_CXXFLAGS
6636     AC_LANG_POP([C++])
6637     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6638         AC_MSG_RESULT([yes])
6639     else
6640         AC_MSG_RESULT([no])
6641     fi
6643 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6645 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6646 AC_LANG_PUSH([C++])
6647 save_CXXFLAGS=$CXXFLAGS
6648 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6649 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6650         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6651         // supporting it:
6652         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6653         struct S {
6654         private:
6655             S(S const &);
6656         public:
6657             S();
6658             ~S();
6659         };
6660         S copy();
6661         void f() { S c(copy()); }
6662         #endif
6663     ])], [
6664         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6665         AC_MSG_RESULT([yes])
6666     ], [AC_MSG_RESULT([no])])
6667 CXXFLAGS=$save_CXXFLAGS
6668 AC_LANG_POP([C++])
6670 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6671 AC_LANG_PUSH([C++])
6672 save_CXXFLAGS=$CXXFLAGS
6673 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6674 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6675         #include <algorithm>
6676         #include <initializer_list>
6677         #include <vector>
6678         template<typename T> class S {
6679         private:
6680             std::vector<T> v_;
6681         public:
6682             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6683         };
6684         constinit S<int> s{3, 2, 1};
6685     ])], [
6686         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6687         AC_MSG_RESULT([yes])
6688     ], [AC_MSG_RESULT([no])])
6689 CXXFLAGS=$save_CXXFLAGS
6690 AC_LANG_POP([C++])
6692 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6693 AC_LANG_PUSH([C++])
6694 save_CXXFLAGS=$CXXFLAGS
6695 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6696 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6697         #include <span>
6698         #include <type_traits>
6699         // Don't check size_type directly, as it was called index_type before P1872R0:
6700         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6701     ])], [
6702         AC_DEFINE([HAVE_CPP_SPAN],[1])
6703         AC_MSG_RESULT([yes])
6704     ], [AC_MSG_RESULT([no])])
6705 CXXFLAGS=$save_CXXFLAGS
6706 AC_LANG_POP([C++])
6708 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6709 AC_LANG_PUSH([C++])
6710 save_CXXFLAGS=$CXXFLAGS
6711 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6712 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6713         struct S1 { S1(S1 &&); };
6714         struct S2: S1 {};
6715         S1 f(S2 s) { return s; }
6716     ])], [
6717         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6718         AC_MSG_RESULT([yes])
6719     ], [AC_MSG_RESULT([no])])
6720 CXXFLAGS=$save_CXXFLAGS
6721 AC_LANG_POP([C++])
6723 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6724 dnl uninitialized warning for code like
6726 dnl   OString f();
6727 dnl   boost::optional<OString> * g(bool b) {
6728 dnl       boost::optional<OString> o;
6729 dnl       if (b) o = f();
6730 dnl       return new boost::optional<OString>(o);
6731 dnl   }
6733 dnl (as is e.g. present, in a slightly more elaborate form, in
6734 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6735 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6736 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6737 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6738     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6739     AC_LANG_PUSH([C++])
6740     save_CXXFLAGS=$CXXFLAGS
6741     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6742     if test "$ENABLE_OPTIMIZED" = TRUE; then
6743         CXXFLAGS="$CXXFLAGS -O2"
6744     else
6745         CXXFLAGS="$CXXFLAGS -O0"
6746     fi
6747     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6748             #include <new>
6749             void f1(int);
6750             struct S1 {
6751                 ~S1() { f1(n); }
6752                 int n = 0;
6753             };
6754             struct S2 {
6755                 S2() {}
6756                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6757                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6758                 void set(S1 s) {
6759                     new (stg) S1(s);
6760                     init = true;
6761                 }
6762                 bool init = false;
6763                 char stg[sizeof (S1)];
6764             } ;
6765             S1 f2();
6766             S2 * f3(bool b) {
6767                 S2 o;
6768                 if (b) o.set(f2());
6769                 return new S2(o);
6770             }
6771         ]])], [AC_MSG_RESULT([no])], [
6772             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6773             AC_MSG_RESULT([yes])
6774         ])
6775     CXXFLAGS=$save_CXXFLAGS
6776     AC_LANG_POP([C++])
6778 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6780 dnl ===================================================================
6781 dnl CPU Intrinsics support - SSE, AVX
6782 dnl ===================================================================
6784 INTRINSICS_CXXFLAGS=""
6786 if test "$GCC" = "yes"; then
6787     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6788     AC_LANG_PUSH([C++])
6789     save_CXXFLAGS=$CXXFLAGS
6790     CXXFLAGS="$CXXFLAGS -msse2"
6791     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6792         #include <emmintrin.h>
6793         int main () {
6794             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6795             c = _mm_xor_si128 (a, b);
6796             return 0;
6797         }
6798         ])],
6799         [can_compile_sse2=yes],
6800         [can_compile_sse2=no])
6801     AC_LANG_POP([C++])
6802     CXXFLAGS=$save_CXXFLAGS
6803     AC_MSG_RESULT([${can_compile_sse2}])
6804     if test "${can_compile_sse2}" = "yes" ; then
6805         INTRINSICS_CXXFLAGS="-msse2"
6806     else
6807         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6808     fi
6810     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6811     AC_LANG_PUSH([C++])
6812     save_CXXFLAGS=$CXXFLAGS
6813     CXXFLAGS="$CXXFLAGS -mssse3"
6814     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6815         #include <tmmintrin.h>
6816         int main () {
6817             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6818             c = _mm_maddubs_epi16 (a, b);
6819             return 0;
6820         }
6821         ])],
6822         [can_compile_ssse3=yes],
6823         [can_compile_ssse3=no])
6824     AC_LANG_POP([C++])
6825     CXXFLAGS=$save_CXXFLAGS
6826     AC_MSG_RESULT([${can_compile_ssse3}])
6827     if test "${can_compile_ssse3}" = "yes" ; then
6828         INTRINSICS_CXXFLAGS="-mssse3"
6829     else
6830         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6831     fi
6833     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6834     AC_LANG_PUSH([C++])
6835     save_CXXFLAGS=$CXXFLAGS
6836     CXXFLAGS="$CXXFLAGS -mavx"
6837     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6838         #include <immintrin.h>
6839         int main () {
6840             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6841             c = _mm256_xor_ps(a, b);
6842             return 0;
6843         }
6844         ])],
6845         [can_compile_avx=yes],
6846         [can_compile_avx=no])
6847     AC_LANG_POP([C++])
6848     CXXFLAGS=$save_CXXFLAGS
6849     AC_MSG_RESULT([${can_compile_avx}])
6850     if test "${can_compile_avx}" = "yes" ; then
6851         INTRINSICS_CXXFLAGS="-mavx"
6852     else
6853         AC_MSG_WARN([cannot compile AVX intrinsics])
6854     fi
6856     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6857     AC_LANG_PUSH([C++])
6858     save_CXXFLAGS=$CXXFLAGS
6859     CXXFLAGS="$CXXFLAGS -mavx2"
6860     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6861         #include <immintrin.h>
6862         int main () {
6863             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6864             c = _mm256_maddubs_epi16(a, b);
6865             return 0;
6866         }
6867         ])],
6868         [can_compile_avx2=yes],
6869         [can_compile_avx2=no])
6870     AC_LANG_POP([C++])
6871     CXXFLAGS=$save_CXXFLAGS
6872     AC_MSG_RESULT([${can_compile_avx2}])
6873     if test "${can_compile_avx2}" = "yes" ; then
6874         INTRINSICS_CXXFLAGS="-mavx2"
6875     else
6876         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6877     fi
6880 AC_SUBST([INTRINSICS_CXXFLAGS])
6882 dnl ===================================================================
6883 dnl system stl sanity tests
6884 dnl ===================================================================
6885 if test "$_os" != "WINNT"; then
6887     AC_LANG_PUSH([C++])
6889     save_CPPFLAGS="$CPPFLAGS"
6890     if test -n "$MACOSX_SDK_PATH"; then
6891         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6892     fi
6894     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6895     # only.
6896     if test "$CPP_LIBRARY" = GLIBCXX; then
6897         dnl gcc#19664, gcc#22482, rhbz#162935
6898         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6899         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6900         AC_MSG_RESULT([$stlvisok])
6901         if test "$stlvisok" = "no"; then
6902             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6903         fi
6904     fi
6906     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6907     # when we don't make any dynamic libraries?
6908     if test "$DISABLE_DYNLOADING" = ""; then
6909         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6910         cat > conftestlib1.cc <<_ACEOF
6911 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6912 struct S2: S1<int> { virtual ~S2(); };
6913 S2::~S2() {}
6914 _ACEOF
6915         cat > conftestlib2.cc <<_ACEOF
6916 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6917 struct S2: S1<int> { virtual ~S2(); };
6918 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6919 _ACEOF
6920         gccvisinlineshiddenok=yes
6921         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6922             gccvisinlineshiddenok=no
6923         else
6924             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6925             dnl known to not work with -z defs (unsetting which makes the test
6926             dnl moot, though):
6927             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6928             if test "$COM_IS_CLANG" = TRUE; then
6929                 for i in $CXX $CXXFLAGS; do
6930                     case $i in
6931                     -fsanitize=*)
6932                         my_linkflagsnoundefs=
6933                         break
6934                         ;;
6935                     esac
6936                 done
6937             fi
6938             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6939                 gccvisinlineshiddenok=no
6940             fi
6941         fi
6943         rm -fr libconftest*
6944         AC_MSG_RESULT([$gccvisinlineshiddenok])
6945         if test "$gccvisinlineshiddenok" = "no"; then
6946             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6947         fi
6948     fi
6950    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6951     cat >visibility.cxx <<_ACEOF
6952 #pragma GCC visibility push(hidden)
6953 struct __attribute__ ((visibility ("default"))) TestStruct {
6954   static void Init();
6956 __attribute__ ((visibility ("default"))) void TestFunc() {
6957   TestStruct::Init();
6959 _ACEOF
6960     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6961         gccvisbroken=yes
6962     else
6963         case "$host_cpu" in
6964         i?86|x86_64)
6965             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6966                 gccvisbroken=no
6967             else
6968                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6969                     gccvisbroken=no
6970                 else
6971                     gccvisbroken=yes
6972                 fi
6973             fi
6974             ;;
6975         *)
6976             gccvisbroken=no
6977             ;;
6978         esac
6979     fi
6980     rm -f visibility.s visibility.cxx
6982     AC_MSG_RESULT([$gccvisbroken])
6983     if test "$gccvisbroken" = "yes"; then
6984         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6985     fi
6987     CPPFLAGS="$save_CPPFLAGS"
6989     AC_LANG_POP([C++])
6992 dnl ===================================================================
6993 dnl  Clang++ tests
6994 dnl ===================================================================
6996 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6997 if test "$GCC" = "yes"; then
6998     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6999     AC_LANG_PUSH([C++])
7000     save_CXXFLAGS=$CXXFLAGS
7001     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7002     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7003     CXXFLAGS=$save_CXXFLAGS
7004     AC_LANG_POP([C++])
7005     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7006         AC_MSG_RESULT([yes])
7007     else
7008         AC_MSG_RESULT([no])
7009     fi
7011 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7013 dnl ===================================================================
7014 dnl Compiler plugins
7015 dnl ===================================================================
7017 COMPILER_PLUGINS=
7018 # currently only Clang
7020 if test "$COM_IS_CLANG" != "TRUE"; then
7021     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7022         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7023         enable_compiler_plugins=no
7024     fi
7027 if test "$COM_IS_CLANG" = "TRUE"; then
7028     if test -n "$enable_compiler_plugins"; then
7029         compiler_plugins="$enable_compiler_plugins"
7030     elif test -n "$ENABLE_DBGUTIL"; then
7031         compiler_plugins=test
7032     else
7033         compiler_plugins=no
7034     fi
7035     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7036         if test "$CLANGVER" -lt 50002; then
7037             if test "$compiler_plugins" = yes; then
7038                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7039             else
7040                 compiler_plugins=no
7041             fi
7042         fi
7043     fi
7044     if test "$compiler_plugins" != "no"; then
7045         dnl The prefix where Clang resides, override to where Clang resides if
7046         dnl using a source build:
7047         if test -z "$CLANGDIR"; then
7048             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7049         fi
7050         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7051         if test -z "$COMPILER_PLUGINS_CXX"; then
7052             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7053         fi
7054         clangbindir=$CLANGDIR/bin
7055         if test "$build_os" = "cygwin"; then
7056             clangbindir=$(cygpath -u "$clangbindir")
7057         fi
7058         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7059         if test -n "$LLVM_CONFIG"; then
7060             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7061             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7062             if test -z "$CLANGLIBDIR"; then
7063                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7064             fi
7065             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7066             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7067             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7068             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7069                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7070             fi
7071             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7072             clangobjdir=$($LLVM_CONFIG --obj-root)
7073             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7074                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7075             fi
7076         fi
7077         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7078         AC_LANG_PUSH([C++])
7079         save_CXX=$CXX
7080         save_CXXCPP=$CXXCPP
7081         save_CPPFLAGS=$CPPFLAGS
7082         save_CXXFLAGS=$CXXFLAGS
7083         save_LDFLAGS=$LDFLAGS
7084         save_LIBS=$LIBS
7085         CXX=$COMPILER_PLUGINS_CXX
7086         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7087         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7088         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7089         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7090             [COMPILER_PLUGINS=TRUE],
7091             [
7092             if test "$compiler_plugins" = "yes"; then
7093                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7094             else
7095                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7096                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7097             fi
7098             ])
7099         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7100         dnl comment in compilerplugins/Makefile-clang.mk:
7101         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7102             LDFLAGS=""
7103             AC_MSG_CHECKING([for clang libraries to use])
7104             if test -z "$CLANGTOOLLIBS"; then
7105                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7106  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7107                 AC_LINK_IFELSE([
7108                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7109                         [[ clang::FullSourceLoc().dump(); ]])
7110                 ],[CLANGTOOLLIBS="$LIBS"],[])
7111             fi
7112             if test -z "$CLANGTOOLLIBS"; then
7113                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7114                 AC_LINK_IFELSE([
7115                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7116                         [[ clang::FullSourceLoc().dump(); ]])
7117                 ],[CLANGTOOLLIBS="$LIBS"],[])
7118             fi
7119             AC_MSG_RESULT([$CLANGTOOLLIBS])
7120             if test -z "$CLANGTOOLLIBS"; then
7121                 if test "$compiler_plugins" = "yes"; then
7122                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7123                 else
7124                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7125                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7126                 fi
7127                 COMPILER_PLUGINS=
7128             fi
7129             if test -n "$COMPILER_PLUGINS"; then
7130                 if test -z "$CLANGSYSINCLUDE"; then
7131                     if test -n "$LLVM_CONFIG"; then
7132                         # Path to the clang system headers (no idea if there's a better way to get it).
7133                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7134                     fi
7135                 fi
7136             fi
7137         fi
7138         CXX=$save_CXX
7139         CXXCPP=$save_CXXCPP
7140         CPPFLAGS=$save_CPPFLAGS
7141         CXXFLAGS=$save_CXXFLAGS
7142         LDFLAGS=$save_LDFLAGS
7143         LIBS="$save_LIBS"
7144         AC_LANG_POP([C++])
7145     fi
7146 else
7147     if test "$enable_compiler_plugins" = "yes"; then
7148         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7149     fi
7151 AC_SUBST(COMPILER_PLUGINS)
7152 AC_SUBST(COMPILER_PLUGINS_CXX)
7153 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7154 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7155 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7156 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7157 AC_SUBST(CLANGDIR)
7158 AC_SUBST(CLANGLIBDIR)
7159 AC_SUBST(CLANGTOOLLIBS)
7160 AC_SUBST(CLANGSYSINCLUDE)
7162 # Plugin to help linker.
7163 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7164 # This makes --enable-lto build with clang work.
7165 AC_SUBST(LD_PLUGIN)
7167 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7168 AC_SUBST(HAVE_POSIX_FALLOCATE)
7170 dnl ===================================================================
7171 dnl Custom build version
7172 dnl ===================================================================
7174 AC_MSG_CHECKING([whether to add custom build version])
7175 if test "$with_build_version" != ""; then
7176     BUILD_VER_STRING=$with_build_version
7177     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7178 else
7179     BUILD_VER_STRING=
7180     AC_MSG_RESULT([no])
7182 AC_SUBST(BUILD_VER_STRING)
7184 JITC_PROCESSOR_TYPE=""
7185 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7186     # IBMs JDK needs this...
7187     JITC_PROCESSOR_TYPE=6
7188     export JITC_PROCESSOR_TYPE
7190 AC_SUBST([JITC_PROCESSOR_TYPE])
7192 # Misc Windows Stuff
7193 AC_ARG_WITH(ucrt-dir,
7194     AS_HELP_STRING([--with-ucrt-dir],
7195         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7196         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7197         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7198             Windows6.1-KB2999226-x64.msu
7199             Windows6.1-KB2999226-x86.msu
7200             Windows8.1-KB2999226-x64.msu
7201             Windows8.1-KB2999226-x86.msu
7202             Windows8-RT-KB2999226-x64.msu
7203             Windows8-RT-KB2999226-x86.msu
7204         A zip archive including those files is available from Microsoft site:
7205         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7207 UCRT_REDISTDIR="$with_ucrt_dir"
7208 if test $_os = "WINNT"; then
7209     find_msvc_x64_dlls
7210     find_msms
7211     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7212     MSVC_DLLS="$msvcdlls"
7213     MSM_PATH=`win_short_path_for_make "$msmdir"`
7214     # MSVC 15.3 changed it to VC141
7215     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7216         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7217     else
7218         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7219     fi
7221     if test "$UCRT_REDISTDIR" = "no"; then
7222         dnl explicitly disabled
7223         UCRT_REDISTDIR=""
7224     else
7225         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7226                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7227                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7228                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7229                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7230                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7231             UCRT_REDISTDIR=""
7232             if test -n "$PKGFORMAT"; then
7233                for i in $PKGFORMAT; do
7234                    case "$i" in
7235                    msi)
7236                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7237                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7238                        ;;
7239                    esac
7240                done
7241             fi
7242         fi
7243     fi
7246 AC_SUBST(UCRT_REDISTDIR)
7247 AC_SUBST(MSVC_DLL_PATH)
7248 AC_SUBST(MSVC_DLLS)
7249 AC_SUBST(MSM_PATH)
7251 dnl ===================================================================
7252 dnl Checks for Java
7253 dnl ===================================================================
7254 if test "$ENABLE_JAVA" != ""; then
7256     # Windows-specific tests
7257     if test "$build_os" = "cygwin"; then
7258         if test "$BITNESS_OVERRIDE" = 64; then
7259             bitness=64
7260         else
7261             bitness=32
7262         fi
7264         if test -z "$with_jdk_home"; then
7265             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7266             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7267             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7268             if test -n "$regvalue"; then
7269                 ver=$regvalue
7270                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7271                 _jdk_home=$regvalue
7272             fi
7273             if test -z "$with_jdk_home"; then
7274                 for ver in 1.8; do
7275                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7276                     if test -n "$regvalue"; then
7277                         _jdk_home=$regvalue
7278                         break
7279                     fi
7280                 done
7281             fi
7282             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7283                 with_jdk_home="$_jdk_home"
7284                 howfound="found automatically"
7285             else
7286                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7287             fi
7288         else
7289             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7290             howfound="you passed"
7291         fi
7292     fi
7294     # 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.
7295     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7296     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7297         with_jdk_home=`/usr/libexec/java_home`
7298     fi
7300     JAVA_HOME=; export JAVA_HOME
7301     if test -z "$with_jdk_home"; then
7302         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7303     else
7304         _java_path="$with_jdk_home/bin/$with_java"
7305         dnl Check if there is a Java interpreter at all.
7306         if test -x "$_java_path"; then
7307             JAVAINTERPRETER=$_java_path
7308         else
7309             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7310         fi
7311     fi
7313     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7314     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7315     dnl loaded by java to run JunitTests:
7316     if test "$build_os" = "cygwin"; then
7317         shortjdkhome=`cygpath -d "$with_jdk_home"`
7318         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
7319             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7320             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7321         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
7322             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7323             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7324         fi
7326         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7327             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7328         fi
7329         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7330     elif test "$cross_compiling" != "yes"; then
7331         case $CPUNAME in
7332             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7333                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7334                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7335                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7336                 fi
7337                 ;;
7338             *) # assumption: everything else 32-bit
7339                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7340                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7341                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7342                 fi
7343                 ;;
7344         esac
7345     fi
7348 dnl ===================================================================
7349 dnl Checks for JDK.
7350 dnl ===================================================================
7352 # Note that JAVA_HOME as for now always means the *build* platform's
7353 # JAVA_HOME. Whether all the complexity here actually is needed any
7354 # more or not, no idea.
7356 if test "$ENABLE_JAVA" != ""; then
7357     _gij_longver=0
7358     AC_MSG_CHECKING([the installed JDK])
7359     if test -n "$JAVAINTERPRETER"; then
7360         dnl java -version sends output to stderr!
7361         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7362             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7363         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7364             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7365         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7366             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7367         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7368             JDK=ibm
7370             dnl IBM JDK specific tests
7371             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7372             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7374             if test "$_jdk_ver" -lt 10800; then
7375                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7376             fi
7378             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7380             if test "$with_jdk_home" = ""; then
7381                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7382 you must use the "--with-jdk-home" configure option explicitly])
7383             fi
7385             JAVA_HOME=$with_jdk_home
7386         else
7387             JDK=sun
7389             dnl Sun JDK specific tests
7390             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7391             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7393             if test "$_jdk_ver" -lt 10800; then
7394                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7395             fi
7396             if test "$_jdk_ver" -gt 10800; then
7397                 JAVA_CLASSPATH_NOT_SET=TRUE
7398             fi
7400             AC_MSG_RESULT([found (JDK $_jdk)])
7401             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7402             if test "$_os" = "WINNT"; then
7403                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7404             fi
7406             # set to limit VM usage for JunitTests
7407             JAVAIFLAGS=-Xmx64M
7408             # set to limit VM usage for javac
7409             JAVAFLAGS=-J-Xmx128M
7410         fi
7411     else
7412         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7413     fi
7414 else
7415     dnl Java disabled
7416     JAVA_HOME=
7417     export JAVA_HOME
7420 dnl ===================================================================
7421 dnl Checks for javac
7422 dnl ===================================================================
7423 if test "$ENABLE_JAVA" != ""; then
7424     javacompiler="javac"
7425     : ${JAVA_SOURCE_VER=8}
7426     : ${JAVA_TARGET_VER=8}
7427     if test -z "$with_jdk_home"; then
7428         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7429     else
7430         _javac_path="$with_jdk_home/bin/$javacompiler"
7431         dnl Check if there is a Java compiler at all.
7432         if test -x "$_javac_path"; then
7433             JAVACOMPILER=$_javac_path
7434         fi
7435     fi
7436     if test -z "$JAVACOMPILER"; then
7437         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7438     fi
7439     if test "$build_os" = "cygwin"; then
7440         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7441             JAVACOMPILER="${JAVACOMPILER}.exe"
7442         fi
7443         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7444     fi
7447 dnl ===================================================================
7448 dnl Checks for javadoc
7449 dnl ===================================================================
7450 if test "$ENABLE_JAVA" != ""; then
7451     if test -z "$with_jdk_home"; then
7452         AC_PATH_PROG(JAVADOC, javadoc)
7453     else
7454         _javadoc_path="$with_jdk_home/bin/javadoc"
7455         dnl Check if there is a javadoc at all.
7456         if test -x "$_javadoc_path"; then
7457             JAVADOC=$_javadoc_path
7458         else
7459             AC_PATH_PROG(JAVADOC, javadoc)
7460         fi
7461     fi
7462     if test -z "$JAVADOC"; then
7463         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7464     fi
7465     if test "$build_os" = "cygwin"; then
7466         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7467             JAVADOC="${JAVADOC}.exe"
7468         fi
7469         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7470     fi
7472     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7473     JAVADOCISGJDOC="yes"
7474     fi
7476 AC_SUBST(JAVADOCISGJDOC)
7478 if test "$ENABLE_JAVA" != ""; then
7479     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7480     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7481         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7482            # try to recover first by looking whether we have an alternative
7483            # system as in Debian or newer SuSEs where following /usr/bin/javac
7484            # over /etc/alternatives/javac leads to the right bindir where we
7485            # just need to strip a bit away to get a valid JAVA_HOME
7486            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7487         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7488             # maybe only one level of symlink (e.g. on Mac)
7489             JAVA_HOME=$(readlink $JAVACOMPILER)
7490             if test "$(dirname $JAVA_HOME)" = "."; then
7491                 # we've got no path to trim back
7492                 JAVA_HOME=""
7493             fi
7494         else
7495             # else warn
7496             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7497             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7498             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7499             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7500         fi
7501         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7502         if test "$JAVA_HOME" != "/usr"; then
7503             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7504                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7505                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7506                 dnl Tiger already returns a JDK path...
7507                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7508             else
7509                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7510                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7511                 dnl that checks which version to run
7512                 if test -f "$JAVA_HOME"; then
7513                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7514                 fi
7515             fi
7516         fi
7517     fi
7518     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7520     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7521     if test -z "$JAVA_HOME"; then
7522         if test "x$with_jdk_home" = "x"; then
7523             cat > findhome.java <<_ACEOF
7524 [import java.io.File;
7526 class findhome
7528     public static void main(String args[])
7529     {
7530         String jrelocation = System.getProperty("java.home");
7531         File jre = new File(jrelocation);
7532         System.out.println(jre.getParent());
7533     }
7535 _ACEOF
7536             AC_MSG_CHECKING([if javac works])
7537             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7538             AC_TRY_EVAL(javac_cmd)
7539             if test $? = 0 -a -f ./findhome.class; then
7540                 AC_MSG_RESULT([javac works])
7541             else
7542                 echo "configure: javac test failed" >&5
7543                 cat findhome.java >&5
7544                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7545             fi
7546             AC_MSG_CHECKING([if gij knows its java.home])
7547             JAVA_HOME=`$JAVAINTERPRETER findhome`
7548             if test $? = 0 -a "$JAVA_HOME" != ""; then
7549                 AC_MSG_RESULT([$JAVA_HOME])
7550             else
7551                 echo "configure: java test failed" >&5
7552                 cat findhome.java >&5
7553                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7554             fi
7555             # clean-up after ourselves
7556             rm -f ./findhome.java ./findhome.class
7557         else
7558             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7559         fi
7560     fi
7562     # now check if $JAVA_HOME is really valid
7563     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7564         case "${JAVA_HOME}" in
7565             /Library/Java/JavaVirtualMachines/*)
7566                 ;;
7567             *)
7568                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7569                 ;;
7570         esac
7571         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7572             JAVA_HOME_OK="NO"
7573         fi
7574     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7575         JAVA_HOME_OK="NO"
7576     fi
7577     if test "$JAVA_HOME_OK" = "NO"; then
7578         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7579         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7580         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7581         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7582         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7583         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7584     fi
7585     PathFormat "$JAVA_HOME"
7586     JAVA_HOME="$formatted_path"
7589 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7590     "$_os" != Darwin
7591 then
7592     AC_MSG_CHECKING([for JAWT lib])
7593     if test "$_os" = WINNT; then
7594         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7595         JAWTLIB=jawt.lib
7596     else
7597         case "$host_cpu" in
7598         arm*)
7599             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7600             JAVA_ARCH=$my_java_arch
7601             ;;
7602         i*86)
7603             my_java_arch=i386
7604             ;;
7605         m68k)
7606             my_java_arch=m68k
7607             ;;
7608         powerpc)
7609             my_java_arch=ppc
7610             ;;
7611         powerpc64)
7612             my_java_arch=ppc64
7613             ;;
7614         powerpc64le)
7615             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7616             JAVA_ARCH=$my_java_arch
7617             ;;
7618         sparc64)
7619             my_java_arch=sparcv9
7620             ;;
7621         x86_64)
7622             my_java_arch=amd64
7623             ;;
7624         *)
7625             my_java_arch=$host_cpu
7626             ;;
7627         esac
7628         # This is where JDK9 puts the library
7629         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7630             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7631         else
7632             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7633         fi
7634         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7635     fi
7636     AC_MSG_RESULT([$JAWTLIB])
7638 AC_SUBST(JAWTLIB)
7640 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7641     case "$host_os" in
7643     aix*)
7644         JAVAINC="-I$JAVA_HOME/include"
7645         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7646         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7647         ;;
7649     cygwin*)
7650         JAVAINC="-I$JAVA_HOME/include/win32"
7651         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7652         ;;
7654     darwin*)
7655         if test -d "$JAVA_HOME/include/darwin"; then
7656             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7657         else
7658             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7659         fi
7660         ;;
7662     dragonfly*)
7663         JAVAINC="-I$JAVA_HOME/include"
7664         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7665         ;;
7667     freebsd*)
7668         JAVAINC="-I$JAVA_HOME/include"
7669         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7670         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7671         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7672         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7673         ;;
7675     k*bsd*-gnu*)
7676         JAVAINC="-I$JAVA_HOME/include"
7677         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7678         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7679         ;;
7681     linux-gnu*)
7682         JAVAINC="-I$JAVA_HOME/include"
7683         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7684         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7685         ;;
7687     *netbsd*)
7688         JAVAINC="-I$JAVA_HOME/include"
7689         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7690         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7691        ;;
7693     openbsd*)
7694         JAVAINC="-I$JAVA_HOME/include"
7695         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7696         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7697         ;;
7699     solaris*)
7700         JAVAINC="-I$JAVA_HOME/include"
7701         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7702         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7703         ;;
7704     esac
7706 SOLARINC="$SOLARINC $JAVAINC"
7708 AC_SUBST(JAVACOMPILER)
7709 AC_SUBST(JAVADOC)
7710 AC_SUBST(JAVAINTERPRETER)
7711 AC_SUBST(JAVAIFLAGS)
7712 AC_SUBST(JAVAFLAGS)
7713 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7714 AC_SUBST(JAVA_HOME)
7715 AC_SUBST(JAVA_SOURCE_VER)
7716 AC_SUBST(JAVA_TARGET_VER)
7717 AC_SUBST(JDK)
7720 dnl ===================================================================
7721 dnl Export file validation
7722 dnl ===================================================================
7723 AC_MSG_CHECKING([whether to enable export file validation])
7724 if test "$with_export_validation" != "no"; then
7725     if test -z "$ENABLE_JAVA"; then
7726         if test "$with_export_validation" = "yes"; then
7727             AC_MSG_ERROR([requested, but Java is disabled])
7728         else
7729             AC_MSG_RESULT([no, as Java is disabled])
7730         fi
7731     elif ! test -d "${SRC_ROOT}/schema"; then
7732         if test "$with_export_validation" = "yes"; then
7733             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7734         else
7735             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7736         fi
7737     else
7738         AC_MSG_RESULT([yes])
7739         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7741         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7742         if test -z "$ODFVALIDATOR"; then
7743             # remember to download the ODF toolkit with validator later
7744             AC_MSG_NOTICE([no odfvalidator found, will download it])
7745             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7746             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7748             # and fetch name of odfvalidator jar name from download.lst
7749             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7750             AC_SUBST(ODFVALIDATOR_JAR)
7752             if test -z "$ODFVALIDATOR_JAR"; then
7753                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7754             fi
7755         fi
7756         if test "$build_os" = "cygwin"; then
7757             # In case of Cygwin it will be executed from Windows,
7758             # so we need to run bash and absolute path to validator
7759             # so instead of "odfvalidator" it will be
7760             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7761             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7762         else
7763             ODFVALIDATOR="sh $ODFVALIDATOR"
7764         fi
7765         AC_SUBST(ODFVALIDATOR)
7768         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7769         if test -z "$OFFICEOTRON"; then
7770             # remember to download the officeotron with validator later
7771             AC_MSG_NOTICE([no officeotron found, will download it])
7772             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7773             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7775             # and fetch name of officeotron jar name from download.lst
7776             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7777             AC_SUBST(OFFICEOTRON_JAR)
7779             if test -z "$OFFICEOTRON_JAR"; then
7780                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7781             fi
7782         else
7783             # check version of existing officeotron
7784             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7785             if test 0"$OFFICEOTRON_VER" -lt 704; then
7786                 AC_MSG_ERROR([officeotron too old])
7787             fi
7788         fi
7789         if test "$build_os" = "cygwin"; then
7790             # In case of Cygwin it will be executed from Windows,
7791             # so we need to run bash and absolute path to validator
7792             # so instead of "odfvalidator" it will be
7793             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7794             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7795         else
7796             OFFICEOTRON="sh $OFFICEOTRON"
7797         fi
7798     fi
7799     AC_SUBST(OFFICEOTRON)
7800 else
7801     AC_MSG_RESULT([no])
7804 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7805 if test "$with_bffvalidator" != "no"; then
7806     AC_DEFINE(HAVE_BFFVALIDATOR)
7808     if test "$with_export_validation" = "no"; then
7809         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7810     fi
7812     if test "$with_bffvalidator" = "yes"; then
7813         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7814     else
7815         BFFVALIDATOR="$with_bffvalidator"
7816     fi
7818     if test "$build_os" = "cygwin"; then
7819         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7820             AC_MSG_RESULT($BFFVALIDATOR)
7821         else
7822             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7823         fi
7824     elif test -n "$BFFVALIDATOR"; then
7825         # We are not in Cygwin but need to run Windows binary with wine
7826         AC_PATH_PROGS(WINE, wine)
7828         # so swap in a shell wrapper that converts paths transparently
7829         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7830         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7831         AC_SUBST(BFFVALIDATOR_EXE)
7832         AC_MSG_RESULT($BFFVALIDATOR)
7833     else
7834         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7835     fi
7836     AC_SUBST(BFFVALIDATOR)
7837 else
7838     AC_MSG_RESULT([no])
7841 dnl ===================================================================
7842 dnl Check for C preprocessor to use
7843 dnl ===================================================================
7844 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7845 if test -n "$with_idlc_cpp"; then
7846     AC_MSG_RESULT([$with_idlc_cpp])
7847     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7848 else
7849     AC_MSG_RESULT([ucpp])
7850     AC_MSG_CHECKING([which ucpp tp use])
7851     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7852         AC_MSG_RESULT([external])
7853         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7854     else
7855         AC_MSG_RESULT([internal])
7856         BUILD_TYPE="$BUILD_TYPE UCPP"
7857     fi
7859 AC_SUBST(SYSTEM_UCPP)
7861 dnl ===================================================================
7862 dnl Check for epm (not needed for Windows)
7863 dnl ===================================================================
7864 AC_MSG_CHECKING([whether to enable EPM for packing])
7865 if test "$enable_epm" = "yes"; then
7866     AC_MSG_RESULT([yes])
7867     if test "$_os" != "WINNT"; then
7868         if test $_os = Darwin; then
7869             EPM=internal
7870         elif test -n "$with_epm"; then
7871             EPM=$with_epm
7872         else
7873             AC_PATH_PROG(EPM, epm, no)
7874         fi
7875         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7876             AC_MSG_NOTICE([EPM will be built.])
7877             BUILD_TYPE="$BUILD_TYPE EPM"
7878             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7879         else
7880             # Gentoo has some epm which is something different...
7881             AC_MSG_CHECKING([whether the found epm is the right epm])
7882             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7883                 AC_MSG_RESULT([yes])
7884             else
7885                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7886             fi
7887             AC_MSG_CHECKING([epm version])
7888             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7889             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7890                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7891                 AC_MSG_RESULT([OK, >= 3.7])
7892             else
7893                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7894                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7895             fi
7896         fi
7897     fi
7899     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7900         AC_MSG_CHECKING([for rpm])
7901         for a in "$RPM" rpmbuild rpm; do
7902             $a --usage >/dev/null 2> /dev/null
7903             if test $? -eq 0; then
7904                 RPM=$a
7905                 break
7906             else
7907                 $a --version >/dev/null 2> /dev/null
7908                 if test $? -eq 0; then
7909                     RPM=$a
7910                     break
7911                 fi
7912             fi
7913         done
7914         if test -z "$RPM"; then
7915             AC_MSG_ERROR([not found])
7916         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7917             RPM_PATH=`which $RPM`
7918             AC_MSG_RESULT([$RPM_PATH])
7919             SCPDEFS="$SCPDEFS -DWITH_RPM"
7920         else
7921             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7922         fi
7923     fi
7924     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7925         AC_PATH_PROG(DPKG, dpkg, no)
7926         if test "$DPKG" = "no"; then
7927             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7928         fi
7929     fi
7930     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7931        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7932         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7933             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7934                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7935                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7936                     AC_MSG_RESULT([yes])
7937                 else
7938                     AC_MSG_RESULT([no])
7939                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7940                         _pt="rpm"
7941                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7942                         add_warning "the rpms will need to be installed with --nodeps"
7943                     else
7944                         _pt="pkg"
7945                     fi
7946                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7947                     add_warning "the ${_pt}s will not be relocatable"
7948                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7949                                  relocation will work, you need to patch your epm with the
7950                                  patch in epm/epm-3.7.patch or build with
7951                                  --with-epm=internal which will build a suitable epm])
7952                 fi
7953             fi
7954         fi
7955     fi
7956     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7957         AC_PATH_PROG(PKGMK, pkgmk, no)
7958         if test "$PKGMK" = "no"; then
7959             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7960         fi
7961     fi
7962     AC_SUBST(RPM)
7963     AC_SUBST(DPKG)
7964     AC_SUBST(PKGMK)
7965 else
7966     for i in $PKGFORMAT; do
7967         case "$i" in
7968         aix | bsd | deb | pkg | rpm | native | portable)
7969             AC_MSG_ERROR(
7970                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7971             ;;
7972         esac
7973     done
7974     AC_MSG_RESULT([no])
7975     EPM=NO
7977 AC_SUBST(EPM)
7979 ENABLE_LWP=
7980 if test "$enable_lotuswordpro" = "yes"; then
7981     ENABLE_LWP="TRUE"
7983 AC_SUBST(ENABLE_LWP)
7985 dnl ===================================================================
7986 dnl Check for building ODK
7987 dnl ===================================================================
7988 if test "$enable_odk" = no; then
7989     unset DOXYGEN
7990 else
7991     if test "$with_doxygen" = no; then
7992         AC_MSG_CHECKING([for doxygen])
7993         unset DOXYGEN
7994         AC_MSG_RESULT([no])
7995     else
7996         if test "$with_doxygen" = yes; then
7997             AC_PATH_PROG([DOXYGEN], [doxygen])
7998             if test -z "$DOXYGEN"; then
7999                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8000             fi
8001             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8002                 if ! dot -V 2>/dev/null; then
8003                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8004                 fi
8005             fi
8006         else
8007             AC_MSG_CHECKING([for doxygen])
8008             DOXYGEN=$with_doxygen
8009             AC_MSG_RESULT([$DOXYGEN])
8010         fi
8011         if test -n "$DOXYGEN"; then
8012             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8013             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8014             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8015                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8016             fi
8017         fi
8018     fi
8020 AC_SUBST([DOXYGEN])
8022 AC_MSG_CHECKING([whether to build the ODK])
8023 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8024     AC_MSG_RESULT([yes])
8026     if test "$with_java" != "no"; then
8027         AC_MSG_CHECKING([whether to build unowinreg.dll])
8028         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8029             # build on Win by default
8030             enable_build_unowinreg=yes
8031         fi
8032         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8033             AC_MSG_RESULT([no])
8034             BUILD_UNOWINREG=
8035         else
8036             AC_MSG_RESULT([yes])
8037             BUILD_UNOWINREG=TRUE
8038         fi
8039         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8040             if test -z "$with_mingw_cross_compiler"; then
8041                 dnl Guess...
8042                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8043             elif test -x "$with_mingw_cross_compiler"; then
8044                  MINGWCXX="$with_mingw_cross_compiler"
8045             else
8046                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8047             fi
8049             if test "$MINGWCXX" = "false"; then
8050                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8051             fi
8053             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8054             if test -x "$mingwstrip_test"; then
8055                 MINGWSTRIP="$mingwstrip_test"
8056             else
8057                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8058             fi
8060             if test "$MINGWSTRIP" = "false"; then
8061                 AC_MSG_ERROR(MinGW32 binutils not found.)
8062             fi
8063         fi
8064     fi
8065     BUILD_TYPE="$BUILD_TYPE ODK"
8066 else
8067     AC_MSG_RESULT([no])
8068     BUILD_UNOWINREG=
8070 AC_SUBST(BUILD_UNOWINREG)
8071 AC_SUBST(MINGWCXX)
8072 AC_SUBST(MINGWSTRIP)
8074 dnl ===================================================================
8075 dnl Check for system zlib
8076 dnl ===================================================================
8077 if test "$with_system_zlib" = "auto"; then
8078     case "$_os" in
8079     WINNT)
8080         with_system_zlib="$with_system_libs"
8081         ;;
8082     *)
8083         if test "$enable_fuzzers" != "yes"; then
8084             with_system_zlib=yes
8085         else
8086             with_system_zlib=no
8087         fi
8088         ;;
8089     esac
8092 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8093 dnl and has no pkg-config for it at least on some tinderboxes,
8094 dnl so leaving that out for now
8095 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8096 AC_MSG_CHECKING([which zlib to use])
8097 if test "$with_system_zlib" = "yes"; then
8098     AC_MSG_RESULT([external])
8099     SYSTEM_ZLIB=TRUE
8100     AC_CHECK_HEADER(zlib.h, [],
8101         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8102     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8103         [AC_MSG_ERROR(zlib not found or functional)], [])
8104 else
8105     AC_MSG_RESULT([internal])
8106     SYSTEM_ZLIB=
8107     BUILD_TYPE="$BUILD_TYPE ZLIB"
8108     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8109     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8111 AC_SUBST(ZLIB_CFLAGS)
8112 AC_SUBST(ZLIB_LIBS)
8113 AC_SUBST(SYSTEM_ZLIB)
8115 dnl ===================================================================
8116 dnl Check for system jpeg
8117 dnl ===================================================================
8118 AC_MSG_CHECKING([which libjpeg to use])
8119 if test "$with_system_jpeg" = "yes"; then
8120     AC_MSG_RESULT([external])
8121     SYSTEM_LIBJPEG=TRUE
8122     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8123         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8124     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8125         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8126 else
8127     SYSTEM_LIBJPEG=
8128     AC_MSG_RESULT([internal, libjpeg-turbo])
8129     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8130     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8131     if test "$COM" = "MSC"; then
8132         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8133     else
8134         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8135     fi
8137     case "$host_cpu" in
8138     x86_64 | amd64 | i*86 | x86 | ia32)
8139         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8140         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8141             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8142                 NASM="$LODE_HOME/opt/bin/nasm"
8143             elif test -x "/opt/lo/bin/nasm"; then
8144                 NASM="/opt/lo/bin/nasm"
8145             fi
8146         fi
8148         if test -n "$NASM"; then
8149             AC_MSG_CHECKING([for object file format of host system])
8150             case "$host_os" in
8151               cygwin* | mingw* | pw32* | interix*)
8152                 case "$host_cpu" in
8153                   x86_64)
8154                     objfmt='Win64-COFF'
8155                     ;;
8156                   *)
8157                     objfmt='Win32-COFF'
8158                     ;;
8159                 esac
8160               ;;
8161               msdosdjgpp* | go32*)
8162                 objfmt='COFF'
8163               ;;
8164               os2-emx*) # not tested
8165                 objfmt='MSOMF' # obj
8166               ;;
8167               linux*coff* | linux*oldld*)
8168                 objfmt='COFF' # ???
8169               ;;
8170               linux*aout*)
8171                 objfmt='a.out'
8172               ;;
8173               linux*)
8174                 case "$host_cpu" in
8175                   x86_64)
8176                     objfmt='ELF64'
8177                     ;;
8178                   *)
8179                     objfmt='ELF'
8180                     ;;
8181                 esac
8182               ;;
8183               kfreebsd* | freebsd* | netbsd* | openbsd*)
8184                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8185                   objfmt='BSD-a.out'
8186                 else
8187                   case "$host_cpu" in
8188                     x86_64 | amd64)
8189                       objfmt='ELF64'
8190                       ;;
8191                     *)
8192                       objfmt='ELF'
8193                       ;;
8194                   esac
8195                 fi
8196               ;;
8197               solaris* | sunos* | sysv* | sco*)
8198                 case "$host_cpu" in
8199                   x86_64)
8200                     objfmt='ELF64'
8201                     ;;
8202                   *)
8203                     objfmt='ELF'
8204                     ;;
8205                 esac
8206               ;;
8207               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8208                 case "$host_cpu" in
8209                   x86_64)
8210                     objfmt='Mach-O64'
8211                     ;;
8212                   *)
8213                     objfmt='Mach-O'
8214                     ;;
8215                 esac
8216               ;;
8217               *)
8218                 objfmt='ELF ?'
8219               ;;
8220             esac
8222             AC_MSG_RESULT([$objfmt])
8223             if test "$objfmt" = 'ELF ?'; then
8224               objfmt='ELF'
8225               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8226             fi
8228             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8229             case "$objfmt" in
8230               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8231               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8232               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8233               COFF)       NAFLAGS='-fcoff -DCOFF';;
8234               a.out)      NAFLAGS='-faout -DAOUT';;
8235               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8236               ELF)        NAFLAGS='-felf -DELF';;
8237               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8238               RDF)        NAFLAGS='-frdf -DRDF';;
8239               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8240               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8241             esac
8242             AC_MSG_RESULT([$NAFLAGS])
8244             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8245             cat > conftest.asm << EOF
8246             [%line __oline__ "configure"
8247                     section .text
8248                     global  _main,main
8249             _main:
8250             main:   xor     eax,eax
8251                     ret
8252             ]
8254             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8255             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8256               AC_MSG_RESULT(yes)
8257             else
8258               echo "configure: failed program was:" >&AC_FD_CC
8259               cat conftest.asm >&AC_FD_CC
8260               rm -rf conftest*
8261               AC_MSG_RESULT(no)
8262               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8263               NASM=""
8264             fi
8266         fi
8268         if test -z "$NASM"; then
8269 cat << _EOS
8270 ****************************************************************************
8271 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8272 To get one please:
8274 _EOS
8275             if test "$build_os" = "cygwin"; then
8276 cat << _EOS
8277 install a pre-compiled binary for Win32
8279 mkdir -p /opt/lo/bin
8280 cd /opt/lo/bin
8281 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8282 chmod +x nasm
8284 or get and install one from http://www.nasm.us/
8286 Then re-run autogen.sh
8288 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8289 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8291 _EOS
8292             else
8293 cat << _EOS
8294 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8296 _EOS
8297             fi
8298             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8299             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8300         fi
8301       ;;
8302     esac
8305 AC_SUBST(NASM)
8306 AC_SUBST(LIBJPEG_CFLAGS)
8307 AC_SUBST(LIBJPEG_LIBS)
8308 AC_SUBST(SYSTEM_LIBJPEG)
8310 dnl ===================================================================
8311 dnl Check for system clucene
8312 dnl ===================================================================
8313 dnl we should rather be using
8314 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8315 dnl but the contribs-lib check seems tricky
8316 AC_MSG_CHECKING([which clucene to use])
8317 if test "$with_system_clucene" = "yes"; then
8318     AC_MSG_RESULT([external])
8319     SYSTEM_CLUCENE=TRUE
8320     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8321     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8322     FilterLibs "${CLUCENE_LIBS}"
8323     CLUCENE_LIBS="${filteredlibs}"
8324     AC_LANG_PUSH([C++])
8325     save_CXXFLAGS=$CXXFLAGS
8326     save_CPPFLAGS=$CPPFLAGS
8327     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8328     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8329     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8330     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8331     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8332                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8333     CXXFLAGS=$save_CXXFLAGS
8334     CPPFLAGS=$save_CPPFLAGS
8335     AC_LANG_POP([C++])
8337     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8338 else
8339     AC_MSG_RESULT([internal])
8340     SYSTEM_CLUCENE=
8341     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8343 AC_SUBST(SYSTEM_CLUCENE)
8344 AC_SUBST(CLUCENE_CFLAGS)
8345 AC_SUBST(CLUCENE_LIBS)
8347 dnl ===================================================================
8348 dnl Check for system expat
8349 dnl ===================================================================
8350 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8352 dnl ===================================================================
8353 dnl Check for system xmlsec
8354 dnl ===================================================================
8355 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8357 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8358 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8359     ENABLE_EOT="TRUE"
8360     AC_DEFINE([ENABLE_EOT])
8361     AC_MSG_RESULT([yes])
8363     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8364 else
8365     ENABLE_EOT=
8366     AC_MSG_RESULT([no])
8368 AC_SUBST([ENABLE_EOT])
8370 dnl ===================================================================
8371 dnl Check for DLP libs
8372 dnl ===================================================================
8373 AS_IF([test "$COM" = "MSC"],
8374       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8375       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8377 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8379 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8381 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8383 AS_IF([test "$COM" = "MSC"],
8384       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8385       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8387 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8389 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8391 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8392 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8394 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8396 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8398 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8400 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8401 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8403 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8404 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8406 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8408 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8409 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8411 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8413 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8415 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8417 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8419 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8420 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8422 dnl ===================================================================
8423 dnl Check for system lcms2
8424 dnl ===================================================================
8425 if test "$with_system_lcms2" != "yes"; then
8426     SYSTEM_LCMS2=
8428 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8429 if test "$GCC" = "yes"; then
8430     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8432 if test "$COM" = "MSC"; then # override the above
8433     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8436 dnl ===================================================================
8437 dnl Check for system cppunit
8438 dnl ===================================================================
8439 if test "$_os" != "Android" ; then
8440     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8443 dnl ===================================================================
8444 dnl Check whether freetype is available
8445 dnl ===================================================================
8446 if test  "$test_freetype" = "yes"; then
8447     AC_MSG_CHECKING([whether freetype is available])
8448     # FreeType has 3 different kinds of versions
8449     # * release, like 2.4.10
8450     # * libtool, like 13.0.7 (this what pkg-config returns)
8451     # * soname
8452     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8453     #
8454     # 9.9.3 is 2.2.0
8455     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8456     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8457     FilterLibs "${FREETYPE_LIBS}"
8458     FREETYPE_LIBS="${filteredlibs}"
8459     SYSTEM_FREETYPE=TRUE
8460 else
8461     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8462     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8464 AC_SUBST(FREETYPE_CFLAGS)
8465 AC_SUBST(FREETYPE_LIBS)
8466 AC_SUBST([SYSTEM_FREETYPE])
8468 # ===================================================================
8469 # Check for system libxslt
8470 # to prevent incompatibilities between internal libxml2 and external libxslt,
8471 # or vice versa, use with_system_libxml here
8472 # ===================================================================
8473 if test "$with_system_libxml" = "auto"; then
8474     case "$_os" in
8475     WINNT|iOS|Android)
8476         with_system_libxml="$with_system_libs"
8477         ;;
8478     *)
8479         if test "$enable_fuzzers" != "yes"; then
8480             with_system_libxml=yes
8481         else
8482             with_system_libxml=no
8483         fi
8484         ;;
8485     esac
8488 AC_MSG_CHECKING([which libxslt to use])
8489 if test "$with_system_libxml" = "yes"; then
8490     AC_MSG_RESULT([external])
8491     SYSTEM_LIBXSLT=TRUE
8492     if test "$_os" = "Darwin"; then
8493         dnl make sure to use SDK path
8494         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8495         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8496         dnl omit -L/usr/lib
8497         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8498         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8499     else
8500         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8501         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8502         FilterLibs "${LIBXSLT_LIBS}"
8503         LIBXSLT_LIBS="${filteredlibs}"
8504         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8505         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8506         FilterLibs "${LIBEXSLT_LIBS}"
8507         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8508     fi
8510     dnl Check for xsltproc
8511     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8512     if test "$XSLTPROC" = "no"; then
8513         AC_MSG_ERROR([xsltproc is required])
8514     fi
8515 else
8516     AC_MSG_RESULT([internal])
8517     SYSTEM_LIBXSLT=
8518     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8520     if test "$cross_compiling" = "yes"; then
8521         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8522         if test "$XSLTPROC" = "no"; then
8523             AC_MSG_ERROR([xsltproc is required])
8524         fi
8525     fi
8527 AC_SUBST(SYSTEM_LIBXSLT)
8528 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8529     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8531 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8533 AC_SUBST(LIBEXSLT_CFLAGS)
8534 AC_SUBST(LIBEXSLT_LIBS)
8535 AC_SUBST(LIBXSLT_CFLAGS)
8536 AC_SUBST(LIBXSLT_LIBS)
8537 AC_SUBST(XSLTPROC)
8539 # ===================================================================
8540 # Check for system libxml
8541 # ===================================================================
8542 AC_MSG_CHECKING([which libxml to use])
8543 if test "$with_system_libxml" = "yes"; then
8544     AC_MSG_RESULT([external])
8545     SYSTEM_LIBXML=TRUE
8546     if test "$_os" = "Darwin"; then
8547         dnl make sure to use SDK path
8548         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8549         dnl omit -L/usr/lib
8550         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8551     elif test $_os = iOS; then
8552         dnl make sure to use SDK path
8553         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8554         LIBXML_CFLAGS="-I$usr/include/libxml2"
8555         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8556     else
8557         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8558         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8559         FilterLibs "${LIBXML_LIBS}"
8560         LIBXML_LIBS="${filteredlibs}"
8561     fi
8563     dnl Check for xmllint
8564     AC_PATH_PROG(XMLLINT, xmllint, no)
8565     if test "$XMLLINT" = "no"; then
8566         AC_MSG_ERROR([xmllint is required])
8567     fi
8568 else
8569     AC_MSG_RESULT([internal])
8570     SYSTEM_LIBXML=
8571     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8572     if test "$COM" = "MSC"; then
8573         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8574     fi
8575     if test "$COM" = "MSC"; then
8576         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8577     else
8578         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8579     fi
8580     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8582 AC_SUBST(SYSTEM_LIBXML)
8583 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8584     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8586 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8587 AC_SUBST(LIBXML_CFLAGS)
8588 AC_SUBST(LIBXML_LIBS)
8589 AC_SUBST(XMLLINT)
8591 # =====================================================================
8592 # Checking for a Python interpreter with version >= 2.7.
8593 # Build and runtime requires Python 3 compatible version (>= 2.7).
8594 # Optionally user can pass an option to configure, i. e.
8595 # ./configure PYTHON=/usr/bin/python
8596 # =====================================================================
8597 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8598     if test -n "$PYTHON"; then
8599         PYTHON_FOR_BUILD=$PYTHON
8600     else
8601         # This allows a lack of system python with no error, we use internal one in that case.
8602         AM_PATH_PYTHON([2.7],, [:])
8603         # Clean PYTHON_VERSION checked below if cross-compiling
8604         PYTHON_VERSION=""
8605         if test "$PYTHON" != ":"; then
8606             PYTHON_FOR_BUILD=$PYTHON
8607         fi
8608     fi
8610 AC_SUBST(PYTHON_FOR_BUILD)
8612 # Checks for Python to use for Pyuno
8613 AC_MSG_CHECKING([which Python to use for Pyuno])
8614 case "$enable_python" in
8615 no|disable)
8616     if test -z $PYTHON_FOR_BUILD; then
8617         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8618         # requirement from the choice whether to include Python stuff in the installer, but why
8619         # bother?
8620         AC_MSG_ERROR([Python is required at build time.])
8621     fi
8622     enable_python=no
8623     AC_MSG_RESULT([none])
8624     ;;
8625 ""|yes|auto)
8626     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8627         AC_MSG_RESULT([no, overridden by --disable-scripting])
8628         enable_python=no
8629     elif test $build_os = cygwin; then
8630         dnl When building on Windows we don't attempt to use any installed
8631         dnl "system"  Python.
8632         AC_MSG_RESULT([fully internal])
8633         enable_python=internal
8634     elif test "$cross_compiling" = yes; then
8635         AC_MSG_RESULT([system])
8636         enable_python=system
8637     else
8638         # Unset variables set by the above AM_PATH_PYTHON so that
8639         # we actually do check anew.
8640         AC_MSG_RESULT([])
8641         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
8642         AM_PATH_PYTHON([3.3],, [:])
8643         AC_MSG_CHECKING([which Python to use for Pyuno])
8644         if test "$PYTHON" = ":"; then
8645             if test -z "$PYTHON_FOR_BUILD"; then
8646                 AC_MSG_RESULT([fully internal])
8647             else
8648                 AC_MSG_RESULT([internal])
8649             fi
8650             enable_python=internal
8651         else
8652             AC_MSG_RESULT([system])
8653             enable_python=system
8654         fi
8655     fi
8656     ;;
8657 internal)
8658     AC_MSG_RESULT([internal])
8659     ;;
8660 fully-internal)
8661     AC_MSG_RESULT([fully internal])
8662     enable_python=internal
8663     ;;
8664 system)
8665     AC_MSG_RESULT([system])
8666     if test "$_os" = Darwin; then
8667         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])
8668     fi
8669     ;;
8671     AC_MSG_ERROR([Incorrect --enable-python option])
8672     ;;
8673 esac
8675 if test $enable_python != no; then
8676     BUILD_TYPE="$BUILD_TYPE PYUNO"
8679 if test $enable_python = system; then
8680     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8681         # Fallback: Accept these in the environment, or as set above
8682         # for MacOSX.
8683         :
8684     elif test "$cross_compiling" != yes; then
8685         # Unset variables set by the above AM_PATH_PYTHON so that
8686         # we actually do check anew.
8687         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
8688         # This causes an error if no python command is found
8689         AM_PATH_PYTHON([3.3])
8690         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8691         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8692         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8693         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8694         if test -z "$PKG_CONFIG"; then
8695             PYTHON_CFLAGS="-I$python_include"
8696             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8697         elif $PKG_CONFIG --exists python-$python_version-embed; then
8698             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8699             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8700         elif $PKG_CONFIG --exists python-$python_version; then
8701             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8702             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8703         else
8704             PYTHON_CFLAGS="-I$python_include"
8705             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8706         fi
8707         FilterLibs "${PYTHON_LIBS}"
8708         PYTHON_LIBS="${filteredlibs}"
8709     else
8710         dnl How to find out the cross-compilation Python installation path?
8711         AC_MSG_CHECKING([for python version])
8712         AS_IF([test -n "$PYTHON_VERSION"],
8713               [AC_MSG_RESULT([$PYTHON_VERSION])],
8714               [AC_MSG_RESULT([not found])
8715                AC_MSG_ERROR([no usable python found])])
8716         test -n "$PYTHON_CFLAGS" && break
8717     fi
8719     dnl Check if the headers really work
8720     save_CPPFLAGS="$CPPFLAGS"
8721     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8722     AC_CHECK_HEADER(Python.h)
8723     CPPFLAGS="$save_CPPFLAGS"
8725     # let the PYTHON_FOR_BUILD match the same python installation that
8726     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8727     # better for PythonTests.
8728     PYTHON_FOR_BUILD=$PYTHON
8731 if test "$with_lxml" != no; then
8732     if test -z "$PYTHON_FOR_BUILD"; then
8733         case $build_os in
8734             cygwin)
8735                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8736                 ;;
8737             *)
8738                 if test "$cross_compiling" != yes ; then
8739                     BUILD_TYPE="$BUILD_TYPE LXML"
8740                 fi
8741                 ;;
8742         esac
8743     else
8744         AC_MSG_CHECKING([for python lxml])
8745         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8746             AC_MSG_RESULT([yes])
8747         else
8748             case $build_os in
8749                 cygwin)
8750                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8751                     ;;
8752                 *)
8753                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8754                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8755                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8756                         else
8757                             BUILD_TYPE="$BUILD_TYPE LXML"
8758                             AC_MSG_RESULT([no, using internal lxml])
8759                         fi
8760                     else
8761                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8762                     fi
8763                     ;;
8764             esac
8765         fi
8766     fi
8769 dnl By now enable_python should be "system", "internal" or "no"
8770 case $enable_python in
8771 system)
8772     SYSTEM_PYTHON=TRUE
8774     if test "x$ac_cv_header_Python_h" != "xyes"; then
8775        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8776     fi
8778     AC_LANG_PUSH(C)
8779     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8780     AC_MSG_CHECKING([for correct python library version])
8781        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8782 #include <Python.h>
8784 int main(int argc, char **argv) {
8785    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8786        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8787    else return 1;
8789        ]])],[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])])
8790     CFLAGS=$save_CFLAGS
8791     AC_LANG_POP(C)
8793     dnl FIXME Check if the Python library can be linked with, too?
8794     ;;
8796 internal)
8797     SYSTEM_PYTHON=
8798     PYTHON_VERSION_MAJOR=3
8799     PYTHON_VERSION_MINOR=7
8800     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8801     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8802         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8803     fi
8804     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8805     BUILD_TYPE="$BUILD_TYPE PYTHON"
8806     if test "$OS" = LINUX; then
8807         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8808     fi
8809     # Embedded Python dies without Home set
8810     if test "$HOME" = ""; then
8811         export HOME=""
8812     fi
8813     ;;
8815     DISABLE_PYTHON=TRUE
8816     SYSTEM_PYTHON=
8817     ;;
8819     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8820     ;;
8821 esac
8823 AC_SUBST(DISABLE_PYTHON)
8824 AC_SUBST(SYSTEM_PYTHON)
8825 AC_SUBST(PYTHON_CFLAGS)
8826 AC_SUBST(PYTHON_LIBS)
8827 AC_SUBST(PYTHON_VERSION)
8828 AC_SUBST(PYTHON_VERSION_MAJOR)
8829 AC_SUBST(PYTHON_VERSION_MINOR)
8831 ENABLE_MARIADBC=TRUE
8832 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8833     ENABLE_MARIADBC=
8835 MARIADBC_MAJOR=1
8836 MARIADBC_MINOR=0
8837 MARIADBC_MICRO=2
8838 if test "$ENABLE_MARIADBC" = "TRUE"; then
8839     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8842 AC_SUBST(ENABLE_MARIADBC)
8843 AC_SUBST(MARIADBC_MAJOR)
8844 AC_SUBST(MARIADBC_MINOR)
8845 AC_SUBST(MARIADBC_MICRO)
8847 if test "$ENABLE_MARIADBC" = "TRUE"; then
8848     dnl ===================================================================
8849     dnl Check for system MariaDB
8850     dnl ===================================================================
8851     AC_MSG_CHECKING([which MariaDB to use])
8852     if test "$with_system_mariadb" = "yes"; then
8853         AC_MSG_RESULT([external])
8854         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8855         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8856         if test -z "$MARIADBCONFIG"; then
8857             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8858             if test -z "$MARIADBCONFIG"; then
8859                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8860                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8861             fi
8862         fi
8863         AC_MSG_CHECKING([MariaDB version])
8864         MARIADB_VERSION=`$MARIADBCONFIG --version`
8865         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8866         if test "$MARIADB_MAJOR" -ge "5"; then
8867             AC_MSG_RESULT([OK])
8868         else
8869             AC_MSG_ERROR([too old, use 5.0.x or later])
8870         fi
8871         AC_MSG_CHECKING([for MariaDB Client library])
8872         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8873         if test "$COM_IS_CLANG" = TRUE; then
8874             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8875         fi
8876         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8877         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8878         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8879         dnl linux32:
8880         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8881             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8882             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8883                 | sed -e 's|/lib64/|/lib/|')
8884         fi
8885         FilterLibs "${MARIADB_LIBS}"
8886         MARIADB_LIBS="${filteredlibs}"
8887         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8888         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8889         if test "$enable_bundle_mariadb" = "yes"; then
8890             AC_MSG_RESULT([yes])
8891             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8892             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8894 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8896 /g' | grep -E '(mysqlclient|mariadb)')
8897             if test "$_os" = "Darwin"; then
8898                 LIBMARIADB=${LIBMARIADB}.dylib
8899             elif test "$_os" = "WINNT"; then
8900                 LIBMARIADB=${LIBMARIADB}.dll
8901             else
8902                 LIBMARIADB=${LIBMARIADB}.so
8903             fi
8904             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8905             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8906             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8907                 AC_MSG_RESULT([found.])
8908                 PathFormat "$LIBMARIADB_PATH"
8909                 LIBMARIADB_PATH="$formatted_path"
8910             else
8911                 AC_MSG_ERROR([not found.])
8912             fi
8913         else
8914             AC_MSG_RESULT([no])
8915             BUNDLE_MARIADB_CONNECTOR_C=
8916         fi
8917     else
8918         AC_MSG_RESULT([internal])
8919         SYSTEM_MARIADB_CONNECTOR_C=
8920         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8921         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8922         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8923     fi
8925     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8926     AC_SUBST(MARIADB_CFLAGS)
8927     AC_SUBST(MARIADB_LIBS)
8928     AC_SUBST(LIBMARIADB)
8929     AC_SUBST(LIBMARIADB_PATH)
8930     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8933 dnl ===================================================================
8934 dnl Check for system hsqldb
8935 dnl ===================================================================
8936 if test "$with_java" != "no"; then
8937     HSQLDB_USE_JDBC_4_1=
8938     AC_MSG_CHECKING([which hsqldb to use])
8939     if test "$with_system_hsqldb" = "yes"; then
8940         AC_MSG_RESULT([external])
8941         SYSTEM_HSQLDB=TRUE
8942         if test -z $HSQLDB_JAR; then
8943             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8944         fi
8945         if ! test -f $HSQLDB_JAR; then
8946                AC_MSG_ERROR(hsqldb.jar not found.)
8947         fi
8948         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8949         export HSQLDB_JAR
8950         if $PERL -e \
8951            'use Archive::Zip;
8952             my $file = "$ENV{'HSQLDB_JAR'}";
8953             my $zip = Archive::Zip->new( $file );
8954             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8955             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8956             {
8957                 push @l, split(/\n/, $mf);
8958                 foreach my $line (@l)
8959                 {
8960                     if ($line =~ m/Specification-Version:/)
8961                     {
8962                         ($t, $version) = split (/:/,$line);
8963                         $version =~ s/^\s//;
8964                         ($a, $b, $c, $d) = split (/\./,$version);
8965                         if ($c == "0" && $d > "8")
8966                         {
8967                             exit 0;
8968                         }
8969                         else
8970                         {
8971                             exit 1;
8972                         }
8973                     }
8974                 }
8975             }
8976             else
8977             {
8978                 exit 1;
8979             }'; then
8980             AC_MSG_RESULT([yes])
8981         else
8982             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8983         fi
8984     else
8985         AC_MSG_RESULT([internal])
8986         SYSTEM_HSQLDB=
8987         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8988         NEED_ANT=TRUE
8989         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8990         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8991         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8992             AC_MSG_RESULT([yes])
8993             HSQLDB_USE_JDBC_4_1=TRUE
8994         else
8995             AC_MSG_RESULT([no])
8996         fi
8997     fi
8998     AC_SUBST(SYSTEM_HSQLDB)
8999     AC_SUBST(HSQLDB_JAR)
9000     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9003 dnl ===================================================================
9004 dnl Check for PostgreSQL stuff
9005 dnl ===================================================================
9006 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9007 if test "x$enable_postgresql_sdbc" != "xno"; then
9008     AC_MSG_RESULT([yes])
9009     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9011     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9012         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9013     fi
9014     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9015         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9016     fi
9018     postgres_interface=""
9019     if test "$with_system_postgresql" = "yes"; then
9020         postgres_interface="external PostgreSQL"
9021         SYSTEM_POSTGRESQL=TRUE
9022         if test "$_os" = Darwin; then
9023             supp_path=''
9024             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9025                 pg_supp_path="$P_SEP$d$pg_supp_path"
9026             done
9027         fi
9028         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9029         if test -n "$PGCONFIG"; then
9030             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9031             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9032         else
9033             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9034               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9035               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9036             ],[
9037               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9038             ])
9039         fi
9040         FilterLibs "${POSTGRESQL_LIB}"
9041         POSTGRESQL_LIB="${filteredlibs}"
9042     else
9043         # if/when anything else than PostgreSQL uses Kerberos,
9044         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9045         WITH_KRB5=
9046         WITH_GSSAPI=
9047         case "$_os" in
9048         Darwin)
9049             # macOS has system MIT Kerberos 5 since 10.4
9050             if test "$with_krb5" != "no"; then
9051                 WITH_KRB5=TRUE
9052                 save_LIBS=$LIBS
9053                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9054                 # that the libraries where these functions are located on macOS will change, is it?
9055                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9056                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9057                 KRB5_LIBS=$LIBS
9058                 LIBS=$save_LIBS
9059                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9060                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9061                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9062                 LIBS=$save_LIBS
9063             fi
9064             if test "$with_gssapi" != "no"; then
9065                 WITH_GSSAPI=TRUE
9066                 save_LIBS=$LIBS
9067                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9068                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9069                 GSSAPI_LIBS=$LIBS
9070                 LIBS=$save_LIBS
9071             fi
9072             ;;
9073         WINNT)
9074             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9075                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9076             fi
9077             ;;
9078         Linux|GNU|*BSD|DragonFly)
9079             if test "$with_krb5" != "no"; then
9080                 WITH_KRB5=TRUE
9081                 save_LIBS=$LIBS
9082                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9083                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9084                 KRB5_LIBS=$LIBS
9085                 LIBS=$save_LIBS
9086                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9087                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9088                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9089                 LIBS=$save_LIBS
9090             fi
9091             if test "$with_gssapi" != "no"; then
9092                 WITH_GSSAPI=TRUE
9093                 save_LIBS=$LIBS
9094                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9095                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9096                 GSSAPI_LIBS=$LIBS
9097                 LIBS=$save_LIBS
9098             fi
9099             ;;
9100         *)
9101             if test "$with_krb5" = "yes"; then
9102                 WITH_KRB5=TRUE
9103                 save_LIBS=$LIBS
9104                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9105                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9106                 KRB5_LIBS=$LIBS
9107                 LIBS=$save_LIBS
9108                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9109                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9110                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9111                 LIBS=$save_LIBS
9112             fi
9113             if test "$with_gssapi" = "yes"; then
9114                 WITH_GSSAPI=TRUE
9115                 save_LIBS=$LIBS
9116                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9117                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9118                 LIBS=$save_LIBS
9119                 GSSAPI_LIBS=$LIBS
9120             fi
9121         esac
9123         if test -n "$with_libpq_path"; then
9124             SYSTEM_POSTGRESQL=TRUE
9125             postgres_interface="external libpq"
9126             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9127             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9128         else
9129             SYSTEM_POSTGRESQL=
9130             postgres_interface="internal"
9131             POSTGRESQL_LIB=""
9132             POSTGRESQL_INC="%OVERRIDE_ME%"
9133             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9134         fi
9135     fi
9137     AC_MSG_CHECKING([PostgreSQL C interface])
9138     AC_MSG_RESULT([$postgres_interface])
9140     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9141         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9142         save_CFLAGS=$CFLAGS
9143         save_CPPFLAGS=$CPPFLAGS
9144         save_LIBS=$LIBS
9145         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9146         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9147         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9148         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9149             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9150         CFLAGS=$save_CFLAGS
9151         CPPFLAGS=$save_CPPFLAGS
9152         LIBS=$save_LIBS
9153     fi
9154     BUILD_POSTGRESQL_SDBC=TRUE
9155 else
9156     AC_MSG_RESULT([no])
9158 AC_SUBST(WITH_KRB5)
9159 AC_SUBST(WITH_GSSAPI)
9160 AC_SUBST(GSSAPI_LIBS)
9161 AC_SUBST(KRB5_LIBS)
9162 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9163 AC_SUBST(SYSTEM_POSTGRESQL)
9164 AC_SUBST(POSTGRESQL_INC)
9165 AC_SUBST(POSTGRESQL_LIB)
9167 dnl ===================================================================
9168 dnl Check for Firebird stuff
9169 dnl ===================================================================
9170 ENABLE_FIREBIRD_SDBC=
9171 if test "$enable_firebird_sdbc" = "yes" ; then
9172     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9174     dnl ===================================================================
9175     dnl Check for system Firebird
9176     dnl ===================================================================
9177     AC_MSG_CHECKING([which Firebird to use])
9178     if test "$with_system_firebird" = "yes"; then
9179         AC_MSG_RESULT([external])
9180         SYSTEM_FIREBIRD=TRUE
9181         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9182         if test -z "$FIREBIRDCONFIG"; then
9183             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9184             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9185                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9186             ])
9187             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9188         else
9189             AC_MSG_NOTICE([fb_config found])
9190             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9191             AC_MSG_CHECKING([for Firebird Client library])
9192             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9193             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9194             FilterLibs "${FIREBIRD_LIBS}"
9195             FIREBIRD_LIBS="${filteredlibs}"
9196         fi
9197         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9198         AC_MSG_CHECKING([Firebird version])
9199         if test -n "${FIREBIRD_VERSION}"; then
9200             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9201             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9202             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9203                 AC_MSG_RESULT([OK])
9204             else
9205                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9206             fi
9207         else
9208             __save_CFLAGS="${CFLAGS}"
9209             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9210             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9211 #if defined(FB_API_VER) && FB_API_VER == 30
9212 int fb_api_is_30(void) { return 0; }
9213 #else
9214 #error "Wrong Firebird API version"
9215 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9216             CFLAGS="${__save_CFLAGS}"
9217         fi
9218         ENABLE_FIREBIRD_SDBC=TRUE
9219         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9220     elif test "$enable_database_connectivity" != yes; then
9221         AC_MSG_RESULT([none])
9222     elif test "$cross_compiling" = "yes"; then
9223         AC_MSG_RESULT([none])
9224     else
9225         dnl Embedded Firebird has version 3.0
9226         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9227         dnl We need libatomic_ops for any non X86/X64 system
9228         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9229             dnl ===================================================================
9230             dnl Check for system libatomic_ops
9231             dnl ===================================================================
9232             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9233             if test "$with_system_libatomic_ops" = "yes"; then
9234                 SYSTEM_LIBATOMIC_OPS=TRUE
9235                 AC_CHECK_HEADERS(atomic_ops.h, [],
9236                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9237             else
9238                 SYSTEM_LIBATOMIC_OPS=
9239                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9240                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9241                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9242             fi
9243         fi
9245         AC_MSG_RESULT([internal])
9246         SYSTEM_FIREBIRD=
9247         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9248         FIREBIRD_LIBS="-lfbclient"
9250         if test "$with_system_libtommath" = "yes"; then
9251             SYSTEM_LIBTOMMATH=TRUE
9252             dnl check for tommath presence
9253             save_LIBS=$LIBS
9254             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9255             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9256             LIBS=$save_LIBS
9257         else
9258             SYSTEM_LIBTOMMATH=
9259             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9260             LIBTOMMATH_LIBS="-ltommath"
9261             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9262         fi
9264         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9265         ENABLE_FIREBIRD_SDBC=TRUE
9266         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9267     fi
9269 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9270 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9271 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9272 AC_SUBST(LIBATOMIC_OPS_LIBS)
9273 AC_SUBST(SYSTEM_FIREBIRD)
9274 AC_SUBST(FIREBIRD_CFLAGS)
9275 AC_SUBST(FIREBIRD_LIBS)
9276 AC_SUBST([TOMMATH_CFLAGS])
9277 AC_SUBST([TOMMATH_LIBS])
9279 dnl ===================================================================
9280 dnl Check for system curl
9281 dnl ===================================================================
9282 AC_MSG_CHECKING([which libcurl to use])
9283 if test "$with_system_curl" = "auto"; then
9284     with_system_curl="$with_system_libs"
9287 if test "$with_system_curl" = "yes"; then
9288     AC_MSG_RESULT([external])
9289     SYSTEM_CURL=TRUE
9291     # First try PKGCONFIG and then fall back
9292     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9294     if test -n "$CURL_PKG_ERRORS"; then
9295         AC_PATH_PROG(CURLCONFIG, curl-config)
9296         if test -z "$CURLCONFIG"; then
9297             AC_MSG_ERROR([curl development files not found])
9298         fi
9299         CURL_LIBS=`$CURLCONFIG --libs`
9300         FilterLibs "${CURL_LIBS}"
9301         CURL_LIBS="${filteredlibs}"
9302         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9303         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9305         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9306         case $curl_version in
9307         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9308         dnl so they need to be doubled to end up in the configure script
9309         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9310             AC_MSG_RESULT([yes])
9311             ;;
9312         *)
9313             AC_MSG_ERROR([no, you have $curl_version])
9314             ;;
9315         esac
9316     fi
9318     ENABLE_CURL=TRUE
9319 elif test $_os = iOS; then
9320     # Let's see if we need curl, I think not?
9321     AC_MSG_RESULT([none])
9322     ENABLE_CURL=
9323 else
9324     AC_MSG_RESULT([internal])
9325     SYSTEM_CURL=
9326     BUILD_TYPE="$BUILD_TYPE CURL"
9327     ENABLE_CURL=TRUE
9329 AC_SUBST(SYSTEM_CURL)
9330 AC_SUBST(CURL_CFLAGS)
9331 AC_SUBST(CURL_LIBS)
9332 AC_SUBST(ENABLE_CURL)
9334 dnl ===================================================================
9335 dnl Check for system boost
9336 dnl ===================================================================
9337 AC_MSG_CHECKING([which boost to use])
9338 if test "$with_system_boost" = "yes"; then
9339     AC_MSG_RESULT([external])
9340     SYSTEM_BOOST=TRUE
9341     AX_BOOST_BASE(1.47)
9342     AX_BOOST_DATE_TIME
9343     AX_BOOST_FILESYSTEM
9344     AX_BOOST_IOSTREAMS
9345     AX_BOOST_LOCALE
9346     AC_LANG_PUSH([C++])
9347     save_CXXFLAGS=$CXXFLAGS
9348     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9349     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9350        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9351     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9352        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9353     CXXFLAGS=$save_CXXFLAGS
9354     AC_LANG_POP([C++])
9355     # this is in m4/ax_boost_base.m4
9356     FilterLibs "${BOOST_LDFLAGS}"
9357     BOOST_LDFLAGS="${filteredlibs}"
9358 else
9359     AC_MSG_RESULT([internal])
9360     BUILD_TYPE="$BUILD_TYPE BOOST"
9361     SYSTEM_BOOST=
9362     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9363         # use warning-suppressing wrapper headers
9364         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9365     else
9366         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9367     fi
9369 AC_SUBST(SYSTEM_BOOST)
9371 dnl ===================================================================
9372 dnl Check for system mdds
9373 dnl ===================================================================
9374 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9376 dnl ===================================================================
9377 dnl Check for system glm
9378 dnl ===================================================================
9379 AC_MSG_CHECKING([which glm to use])
9380 if test "$with_system_glm" = "yes"; then
9381     AC_MSG_RESULT([external])
9382     SYSTEM_GLM=TRUE
9383     AC_LANG_PUSH([C++])
9384     AC_CHECK_HEADER([glm/glm.hpp], [],
9385        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9386     AC_LANG_POP([C++])
9387 else
9388     AC_MSG_RESULT([internal])
9389     BUILD_TYPE="$BUILD_TYPE GLM"
9390     SYSTEM_GLM=
9391     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9393 AC_SUBST([GLM_CFLAGS])
9394 AC_SUBST([SYSTEM_GLM])
9396 dnl ===================================================================
9397 dnl Check for system odbc
9398 dnl ===================================================================
9399 AC_MSG_CHECKING([which odbc headers to use])
9400 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
9401     AC_MSG_RESULT([external])
9402     SYSTEM_ODBC_HEADERS=TRUE
9404     if test "$build_os" = "cygwin"; then
9405         save_CPPFLAGS=$CPPFLAGS
9406         find_winsdk
9407         PathFormat "$winsdktest"
9408         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"
9409         AC_CHECK_HEADER(sqlext.h, [],
9410             [AC_MSG_ERROR(odbc not found. install odbc)],
9411             [#include <windows.h>])
9412         CPPFLAGS=$save_CPPFLAGS
9413     else
9414         AC_CHECK_HEADER(sqlext.h, [],
9415             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9416     fi
9417 elif test "$enable_database_connectivity" != yes; then
9418     AC_MSG_RESULT([none])
9419 else
9420     AC_MSG_RESULT([internal])
9421     SYSTEM_ODBC_HEADERS=
9423 AC_SUBST(SYSTEM_ODBC_HEADERS)
9425 dnl ===================================================================
9426 dnl Enable LDAP support
9427 dnl ===================================================================
9429 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9430 AC_MSG_CHECKING([whether to enable LDAP support])
9431     if test "$enable_ldap" != "yes"; then
9432         AC_MSG_RESULT([no])
9433         ENABLE_LDAP=""
9434         enable_ldap=no
9435     else
9436         AC_MSG_RESULT([yes])
9437         ENABLE_LDAP="TRUE"
9438         AC_DEFINE(HAVE_FEATURE_LDAP)
9439     fi
9441 AC_SUBST(ENABLE_LDAP)
9443 dnl ===================================================================
9444 dnl Check for system openldap
9445 dnl ===================================================================
9447 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9448 AC_MSG_CHECKING([which openldap library to use])
9449 if test "$with_system_openldap" = "yes"; then
9450     AC_MSG_RESULT([external])
9451     SYSTEM_OPENLDAP=TRUE
9452     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9453     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9454     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9455 else
9456     AC_MSG_RESULT([internal])
9457     SYSTEM_OPENLDAP=
9458     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9461 AC_SUBST(SYSTEM_OPENLDAP)
9463 dnl ===================================================================
9464 dnl Check for system NSS
9465 dnl ===================================================================
9466 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9467     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9468     AC_DEFINE(HAVE_FEATURE_NSS)
9469     ENABLE_NSS="TRUE"
9470     AC_DEFINE(ENABLE_NSS)
9471 elif test $_os != iOS ; then
9472     with_tls=openssl
9474 AC_SUBST(ENABLE_NSS)
9476 dnl ===================================================================
9477 dnl Check for TLS/SSL and cryptographic implementation to use
9478 dnl ===================================================================
9479 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9480 if test -n "$with_tls"; then
9481     case $with_tls in
9482     openssl)
9483         AC_DEFINE(USE_TLS_OPENSSL)
9484         TLS=OPENSSL
9486         if test "$enable_openssl" != "yes"; then
9487             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9488         fi
9490         # warn that OpenSSL has been selected but not all TLS code has this option
9491         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9492         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9493         ;;
9494     nss)
9495         AC_DEFINE(USE_TLS_NSS)
9496         TLS=NSS
9497         ;;
9498     no)
9499         AC_MSG_WARN([Skipping TLS/SSL])
9500         ;;
9501     *)
9502         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9503 openssl - OpenSSL
9504 nss - Mozilla's Network Security Services (NSS)
9505     ])
9506         ;;
9507     esac
9508 else
9509     # default to using NSS, it results in smaller oox lib
9510     AC_DEFINE(USE_TLS_NSS)
9511     TLS=NSS
9513 AC_MSG_RESULT([$TLS])
9514 AC_SUBST(TLS)
9516 dnl ===================================================================
9517 dnl Check for system sane
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([which sane header to use])
9520 if test "$with_system_sane" = "yes"; then
9521     AC_MSG_RESULT([external])
9522     AC_CHECK_HEADER(sane/sane.h, [],
9523       [AC_MSG_ERROR(sane not found. install sane)], [])
9524 else
9525     AC_MSG_RESULT([internal])
9526     BUILD_TYPE="$BUILD_TYPE SANE"
9529 dnl ===================================================================
9530 dnl Check for system icu
9531 dnl ===================================================================
9532 SYSTEM_GENBRK=
9533 SYSTEM_GENCCODE=
9534 SYSTEM_GENCMN=
9536 ICU_MAJOR=65
9537 ICU_MINOR=1
9538 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9539 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9540 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9541 AC_MSG_CHECKING([which icu to use])
9542 if test "$with_system_icu" = "yes"; then
9543     AC_MSG_RESULT([external])
9544     SYSTEM_ICU=TRUE
9545     AC_LANG_PUSH([C++])
9546     AC_MSG_CHECKING([for unicode/rbbi.h])
9547     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9548     AC_LANG_POP([C++])
9550     if test "$cross_compiling" != "yes"; then
9551         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9552         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9553         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9554         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9555     fi
9557     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9558         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9559         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9560         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9561         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9562         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9563             AC_MSG_RESULT([yes])
9564         else
9565             AC_MSG_RESULT([no])
9566             if test "$with_system_icu_for_build" != "force"; then
9567                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9568 You can use --with-system-icu-for-build=force to use it anyway.])
9569             fi
9570         fi
9571     fi
9573     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9574         # using the system icu tools can lead to version confusion, use the
9575         # ones from the build environment when cross-compiling
9576         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9577         if test -z "$SYSTEM_GENBRK"; then
9578             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9579         fi
9580         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9581         if test -z "$SYSTEM_GENCCODE"; then
9582             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9583         fi
9584         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9585         if test -z "$SYSTEM_GENCMN"; then
9586             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9587         fi
9588         if test "$ICU_MAJOR" -ge "49"; then
9589             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9590             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9591             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9592         else
9593             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9594             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9595             ICU_RECLASSIFIED_HEBREW_LETTER=
9596         fi
9597     fi
9599     if test "$cross_compiling" = "yes"; then
9600         if test "$ICU_MAJOR" -ge "50"; then
9601             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9602             ICU_MINOR=""
9603         fi
9604     fi
9605 else
9606     AC_MSG_RESULT([internal])
9607     SYSTEM_ICU=
9608     BUILD_TYPE="$BUILD_TYPE ICU"
9609     # surprisingly set these only for "internal" (to be used by various other
9610     # external libs): the system icu-config is quite unhelpful and spits out
9611     # dozens of weird flags and also default path -I/usr/include
9612     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9613     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9615 if test "$ICU_MAJOR" -ge "59"; then
9616     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9617     # with -std=c++11 but not all external libraries can be built with that,
9618     # for those use a bit-compatible typedef uint16_t UChar; see
9619     # icu/source/common/unicode/umachine.h
9620     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9621 else
9622     ICU_UCHAR_TYPE=""
9624 AC_SUBST(SYSTEM_ICU)
9625 AC_SUBST(SYSTEM_GENBRK)
9626 AC_SUBST(SYSTEM_GENCCODE)
9627 AC_SUBST(SYSTEM_GENCMN)
9628 AC_SUBST(ICU_MAJOR)
9629 AC_SUBST(ICU_MINOR)
9630 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9631 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9632 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9633 AC_SUBST(ICU_CFLAGS)
9634 AC_SUBST(ICU_LIBS)
9635 AC_SUBST(ICU_UCHAR_TYPE)
9637 dnl ==================================================================
9638 dnl Breakpad
9639 dnl ==================================================================
9640 DEFAULT_CRASHDUMP_VALUE="true"
9641 AC_MSG_CHECKING([whether to enable breakpad])
9642 if test "$enable_breakpad" != yes; then
9643     AC_MSG_RESULT([no])
9644 else
9645     AC_MSG_RESULT([yes])
9646     ENABLE_BREAKPAD="TRUE"
9647     AC_DEFINE(ENABLE_BREAKPAD)
9648     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9649     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9651     AC_MSG_CHECKING([for disable crash dump])
9652     if test "$enable_crashdump" = no; then
9653         DEFAULT_CRASHDUMP_VALUE="false"
9654         AC_MSG_RESULT([yes])
9655     else
9656        AC_MSG_RESULT([no])
9657     fi
9659     AC_MSG_CHECKING([for crashreport config])
9660     if test "$with_symbol_config" = "no"; then
9661         BREAKPAD_SYMBOL_CONFIG="invalid"
9662         AC_MSG_RESULT([no])
9663     else
9664         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9665         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9666         AC_MSG_RESULT([yes])
9667     fi
9668     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9670 AC_SUBST(ENABLE_BREAKPAD)
9671 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9673 dnl ==================================================================
9674 dnl libfuzzer
9675 dnl ==================================================================
9676 AC_MSG_CHECKING([whether to enable fuzzers])
9677 if test "$enable_fuzzers" != yes; then
9678     AC_MSG_RESULT([no])
9679 else
9680     AC_MSG_RESULT([yes])
9681     ENABLE_FUZZERS="TRUE"
9682     AC_DEFINE([ENABLE_FUZZERS],1)
9683     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9685 AC_SUBST(ENABLE_FUZZERS)
9687 dnl ===================================================================
9688 dnl Orcus
9689 dnl ===================================================================
9690 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9691 if test "$with_system_orcus" != "yes"; then
9692     if test "$SYSTEM_BOOST" = "TRUE"; then
9693         # ===========================================================
9694         # Determine if we are going to need to link with Boost.System
9695         # ===========================================================
9696         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9697         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9698         dnl in documentation has no effect.
9699         AC_MSG_CHECKING([if we need to link with Boost.System])
9700         AC_LANG_PUSH([C++])
9701         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9702                 @%:@include <boost/version.hpp>
9703             ]],[[
9704                 #if BOOST_VERSION >= 105000
9705                 #   error yes, we need to link with Boost.System
9706                 #endif
9707             ]])],[
9708                 AC_MSG_RESULT([no])
9709             ],[
9710                 AC_MSG_RESULT([yes])
9711                 AX_BOOST_SYSTEM
9712         ])
9713         AC_LANG_POP([C++])
9714     fi
9716 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9717 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9718 AC_SUBST([BOOST_SYSTEM_LIB])
9719 AC_SUBST(SYSTEM_LIBORCUS)
9721 dnl ===================================================================
9722 dnl HarfBuzz
9723 dnl ===================================================================
9724 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9725                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9726                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9728 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9729                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9730                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9732 if test "$COM" = "MSC"; then # override the above
9733     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9734     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9737 if test "$with_system_harfbuzz" = "yes"; then
9738     if test "$with_system_graphite" = "no"; then
9739         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9740     fi
9741     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9742     _save_libs="$LIBS"
9743     _save_cflags="$CFLAGS"
9744     LIBS="$LIBS $HARFBUZZ_LIBS"
9745     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9746     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9747     LIBS="$_save_libs"
9748     CFLAGS="$_save_cflags"
9749 else
9750     if test "$with_system_graphite" = "yes"; then
9751         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9752     fi
9755 AC_MSG_CHECKING([whether to use X11])
9756 dnl ***************************************
9757 dnl testing for X libraries and includes...
9758 dnl ***************************************
9759 if test "$USING_X11" = TRUE; then
9760     AC_DEFINE(HAVE_FEATURE_X11)
9762 AC_MSG_RESULT([$USING_X11])
9764 if test "$USING_X11" = TRUE; then
9765     AC_PATH_X
9766     AC_PATH_XTRA
9767     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9769     if test -z "$x_includes"; then
9770         x_includes="default_x_includes"
9771     fi
9772     if test -z "$x_libraries"; then
9773         x_libraries="default_x_libraries"
9774     fi
9775     CFLAGS="$CFLAGS $X_CFLAGS"
9776     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9777     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9778 else
9779     x_includes="no_x_includes"
9780     x_libraries="no_x_libraries"
9783 if test "$USING_X11" = TRUE; then
9784     dnl ===================================================================
9785     dnl Check for extension headers
9786     dnl ===================================================================
9787     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9788      [#include <X11/extensions/shape.h>])
9790     # vcl needs ICE and SM
9791     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9792     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9793         [AC_MSG_ERROR(ICE library not found)])
9794     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9795     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9796         [AC_MSG_ERROR(SM library not found)])
9799 dnl ===================================================================
9800 dnl Check for system Xrender
9801 dnl ===================================================================
9802 AC_MSG_CHECKING([whether to use Xrender])
9803 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9804     AC_MSG_RESULT([yes])
9805     PKG_CHECK_MODULES(XRENDER, xrender)
9806     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9807     FilterLibs "${XRENDER_LIBS}"
9808     XRENDER_LIBS="${filteredlibs}"
9809     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9810       [AC_MSG_ERROR(libXrender not found or functional)], [])
9811     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9812       [AC_MSG_ERROR(Xrender not found. install X)], [])
9813 else
9814     AC_MSG_RESULT([no])
9816 AC_SUBST(XRENDER_CFLAGS)
9817 AC_SUBST(XRENDER_LIBS)
9819 dnl ===================================================================
9820 dnl Check for XRandr
9821 dnl ===================================================================
9822 AC_MSG_CHECKING([whether to enable RandR support])
9823 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9824     AC_MSG_RESULT([yes])
9825     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9826     if test "$ENABLE_RANDR" != "TRUE"; then
9827         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9828                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9829         XRANDR_CFLAGS=" "
9830         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9831           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9832         XRANDR_LIBS="-lXrandr "
9833         ENABLE_RANDR="TRUE"
9834     fi
9835     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9836     FilterLibs "${XRANDR_LIBS}"
9837     XRANDR_LIBS="${filteredlibs}"
9838 else
9839     ENABLE_RANDR=""
9840     AC_MSG_RESULT([no])
9842 AC_SUBST(XRANDR_CFLAGS)
9843 AC_SUBST(XRANDR_LIBS)
9844 AC_SUBST(ENABLE_RANDR)
9846 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9847     WITH_WEBDAV="serf"
9849 if test $_os = iOS -o $_os = Android; then
9850     WITH_WEBDAV="no"
9852 AC_MSG_CHECKING([for webdav library])
9853 case "$WITH_WEBDAV" in
9854 serf)
9855     AC_MSG_RESULT([serf])
9856     # Check for system apr-util
9857     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9858                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9859                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9860     if test "$COM" = "MSC"; then
9861         APR_LIB_DIR="LibR"
9862         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9863         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9864     fi
9866     # Check for system serf
9867     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9868                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9869     if test "$COM" = "MSC"; then
9870         SERF_LIB_DIR="Release"
9871         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9872         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9873     fi
9874     ;;
9875 neon)
9876     AC_MSG_RESULT([neon])
9877     # Check for system neon
9878     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9879     if test "$with_system_neon" = "yes"; then
9880         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9881     else
9882         NEON_VERSION=0295
9883     fi
9884     AC_SUBST(NEON_VERSION)
9885     ;;
9887     AC_MSG_RESULT([none, disabled])
9888     WITH_WEBDAV=""
9889     ;;
9890 esac
9891 AC_SUBST(WITH_WEBDAV)
9893 dnl ===================================================================
9894 dnl Check for disabling cve_tests
9895 dnl ===================================================================
9896 AC_MSG_CHECKING([whether to execute CVE tests])
9897 # If not explicitly enabled or disabled, default
9898 if test -z "$enable_cve_tests"; then
9899     case "$OS" in
9900     WNT)
9901         # Default cves off for Windows with its wild and wonderful
9902         # variety of AV software kicking in and panicking
9903         enable_cve_tests=no
9904         ;;
9905     *)
9906         # otherwise yes
9907         enable_cve_tests=yes
9908         ;;
9909     esac
9911 if test "$enable_cve_tests" = "no"; then
9912     AC_MSG_RESULT([no])
9913     DISABLE_CVE_TESTS=TRUE
9914     AC_SUBST(DISABLE_CVE_TESTS)
9915 else
9916     AC_MSG_RESULT([yes])
9919 dnl ===================================================================
9920 dnl Check for enabling chart XShape tests
9921 dnl ===================================================================
9922 AC_MSG_CHECKING([whether to execute chart XShape tests])
9923 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9924     AC_MSG_RESULT([yes])
9925     ENABLE_CHART_TESTS=TRUE
9926     AC_SUBST(ENABLE_CHART_TESTS)
9927 else
9928     AC_MSG_RESULT([no])
9931 dnl ===================================================================
9932 dnl Check for system openssl
9933 dnl ===================================================================
9934 DISABLE_OPENSSL=
9935 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9936 if test "$enable_openssl" = "yes"; then
9937     AC_MSG_RESULT([no])
9938     if test "$_os" = Darwin ; then
9939         # OpenSSL is deprecated when building for 10.7 or later.
9940         #
9941         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9942         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9944         with_system_openssl=no
9945         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9946     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9947             && test "$with_system_openssl" != "no"; then
9948         with_system_openssl=yes
9949         SYSTEM_OPENSSL=TRUE
9950         OPENSSL_CFLAGS=
9951         OPENSSL_LIBS="-lssl -lcrypto"
9952     else
9953         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9954     fi
9955     if test "$with_system_openssl" = "yes"; then
9956         AC_MSG_CHECKING([whether openssl supports SHA512])
9957         AC_LANG_PUSH([C])
9958         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9959             SHA512_CTX context;
9960 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9961         AC_LANG_POP(C)
9962     fi
9963 else
9964     AC_MSG_RESULT([yes])
9965     DISABLE_OPENSSL=TRUE
9967     # warn that although OpenSSL is disabled, system libraries may depend on it
9968     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9969     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9972 AC_SUBST([DISABLE_OPENSSL])
9974 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9975     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9976         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9977         enable_cipher_openssl_backend=no
9978     else
9979         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9980     fi
9982 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9983 ENABLE_CIPHER_OPENSSL_BACKEND=
9984 if test "$enable_cipher_openssl_backend" = yes; then
9985     AC_MSG_RESULT([yes])
9986     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9987 else
9988     AC_MSG_RESULT([no])
9990 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9992 dnl ===================================================================
9993 dnl Check for building gnutls
9994 dnl ===================================================================
9995 AC_MSG_CHECKING([whether to use gnutls])
9996 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9997     AC_MSG_RESULT([yes])
9998     AM_PATH_LIBGCRYPT()
9999     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10000         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10001                       available in the system to use as replacement.]]))
10002     FilterLibs "${LIBGCRYPT_LIBS}"
10003     LIBGCRYPT_LIBS="${filteredlibs}"
10004 else
10005     AC_MSG_RESULT([no])
10008 AC_SUBST([LIBGCRYPT_CFLAGS])
10009 AC_SUBST([LIBGCRYPT_LIBS])
10011 dnl ===================================================================
10012 dnl Check for system redland
10013 dnl ===================================================================
10014 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10015 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10016 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10017 if test "$with_system_redland" = "yes"; then
10018     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10019             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10020 else
10021     RAPTOR_MAJOR="0"
10022     RASQAL_MAJOR="3"
10023     REDLAND_MAJOR="0"
10025 AC_SUBST(RAPTOR_MAJOR)
10026 AC_SUBST(RASQAL_MAJOR)
10027 AC_SUBST(REDLAND_MAJOR)
10029 dnl ===================================================================
10030 dnl Check for system hunspell
10031 dnl ===================================================================
10032 AC_MSG_CHECKING([which libhunspell to use])
10033 if test "$with_system_hunspell" = "yes"; then
10034     AC_MSG_RESULT([external])
10035     SYSTEM_HUNSPELL=TRUE
10036     AC_LANG_PUSH([C++])
10037     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10038     if test "$HUNSPELL_PC" != "TRUE"; then
10039         AC_CHECK_HEADER(hunspell.hxx, [],
10040             [
10041             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10042             [AC_MSG_ERROR(hunspell headers not found.)], [])
10043             ], [])
10044         AC_CHECK_LIB([hunspell], [main], [:],
10045            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10046         HUNSPELL_LIBS=-lhunspell
10047     fi
10048     AC_LANG_POP([C++])
10049     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10050     FilterLibs "${HUNSPELL_LIBS}"
10051     HUNSPELL_LIBS="${filteredlibs}"
10052 else
10053     AC_MSG_RESULT([internal])
10054     SYSTEM_HUNSPELL=
10055     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10056     if test "$COM" = "MSC"; then
10057         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10058     else
10059         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10060     fi
10061     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10063 AC_SUBST(SYSTEM_HUNSPELL)
10064 AC_SUBST(HUNSPELL_CFLAGS)
10065 AC_SUBST(HUNSPELL_LIBS)
10067 dnl ===================================================================
10068 dnl Check for system qrcodegen
10069 dnl ===================================================================
10070 AC_MSG_CHECKING([which libqrcodegen to use])
10071 if test "$with_system_qrcodegen" = "yes"; then
10072     AC_MSG_RESULT([external])
10073     SYSTEM_QRCODEGEN=TRUE
10074     AC_LANG_PUSH([C++])
10075     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10076         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10077     AC_CHECK_LIB([qrcodegencpp], [main], [:],
10078         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10079     QRCODEGEN_LIBS=-lqrcodegencpp
10080     AC_LANG_POP([C++])
10081     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10082     FilterLibs "${QRCODEGEN_LIBS}"
10083     QRCODEGEN_LIBS="${filteredlibs}"
10084 else
10085     AC_MSG_RESULT([internal])
10086     SYSTEM_QRCODEGEN=
10087     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10089 AC_SUBST(SYSTEM_QRCODEGEN)
10090 AC_SUBST(QRCODEGEN_CFLAGS)
10091 AC_SUBST(QRCODEGEN_LIBS)
10093 dnl ===================================================================
10094 dnl Checking for altlinuxhyph
10095 dnl ===================================================================
10096 AC_MSG_CHECKING([which altlinuxhyph to use])
10097 if test "$with_system_altlinuxhyph" = "yes"; then
10098     AC_MSG_RESULT([external])
10099     SYSTEM_HYPH=TRUE
10100     AC_CHECK_HEADER(hyphen.h, [],
10101        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10102     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10103        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10104        [#include <hyphen.h>])
10105     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10106         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10107     if test -z "$HYPHEN_LIB"; then
10108         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10109            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10110     fi
10111     if test -z "$HYPHEN_LIB"; then
10112         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10113            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10114     fi
10115 else
10116     AC_MSG_RESULT([internal])
10117     SYSTEM_HYPH=
10118     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10119     if test "$COM" = "MSC"; then
10120         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10121     else
10122         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10123     fi
10125 AC_SUBST(SYSTEM_HYPH)
10126 AC_SUBST(HYPHEN_LIB)
10128 dnl ===================================================================
10129 dnl Checking for mythes
10130 dnl ===================================================================
10131 AC_MSG_CHECKING([which mythes to use])
10132 if test "$with_system_mythes" = "yes"; then
10133     AC_MSG_RESULT([external])
10134     SYSTEM_MYTHES=TRUE
10135     AC_LANG_PUSH([C++])
10136     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10137     if test "$MYTHES_PKGCONFIG" = "no"; then
10138         AC_CHECK_HEADER(mythes.hxx, [],
10139             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10140         AC_CHECK_LIB([mythes-1.2], [main], [:],
10141             [ MYTHES_FOUND=no], [])
10142     if test "$MYTHES_FOUND" = "no"; then
10143         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10144                 [ MYTHES_FOUND=no], [])
10145     fi
10146     if test "$MYTHES_FOUND" = "no"; then
10147         AC_MSG_ERROR([mythes library not found!.])
10148     fi
10149     fi
10150     AC_LANG_POP([C++])
10151     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10152     FilterLibs "${MYTHES_LIBS}"
10153     MYTHES_LIBS="${filteredlibs}"
10154 else
10155     AC_MSG_RESULT([internal])
10156     SYSTEM_MYTHES=
10157     BUILD_TYPE="$BUILD_TYPE MYTHES"
10158     if test "$COM" = "MSC"; then
10159         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10160     else
10161         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10162     fi
10164 AC_SUBST(SYSTEM_MYTHES)
10165 AC_SUBST(MYTHES_CFLAGS)
10166 AC_SUBST(MYTHES_LIBS)
10168 dnl ===================================================================
10169 dnl How should we build the linear programming solver ?
10170 dnl ===================================================================
10172 ENABLE_COINMP=
10173 AC_MSG_CHECKING([whether to build with CoinMP])
10174 if test "$enable_coinmp" != "no"; then
10175     ENABLE_COINMP=TRUE
10176     AC_MSG_RESULT([yes])
10177     if test "$with_system_coinmp" = "yes"; then
10178         SYSTEM_COINMP=TRUE
10179         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10180         FilterLibs "${COINMP_LIBS}"
10181         COINMP_LIBS="${filteredlibs}"
10182     else
10183         BUILD_TYPE="$BUILD_TYPE COINMP"
10184     fi
10185 else
10186     AC_MSG_RESULT([no])
10188 AC_SUBST(ENABLE_COINMP)
10189 AC_SUBST(SYSTEM_COINMP)
10190 AC_SUBST(COINMP_CFLAGS)
10191 AC_SUBST(COINMP_LIBS)
10193 ENABLE_LPSOLVE=
10194 AC_MSG_CHECKING([whether to build with lpsolve])
10195 if test "$enable_lpsolve" != "no"; then
10196     ENABLE_LPSOLVE=TRUE
10197     AC_MSG_RESULT([yes])
10198 else
10199     AC_MSG_RESULT([no])
10201 AC_SUBST(ENABLE_LPSOLVE)
10203 if test "$ENABLE_LPSOLVE" = TRUE; then
10204     AC_MSG_CHECKING([which lpsolve to use])
10205     if test "$with_system_lpsolve" = "yes"; then
10206         AC_MSG_RESULT([external])
10207         SYSTEM_LPSOLVE=TRUE
10208         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10209            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10210         save_LIBS=$LIBS
10211         # some systems need this. Like Ubuntu...
10212         AC_CHECK_LIB(m, floor)
10213         AC_CHECK_LIB(dl, dlopen)
10214         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10215             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10216         LIBS=$save_LIBS
10217     else
10218         AC_MSG_RESULT([internal])
10219         SYSTEM_LPSOLVE=
10220         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10221     fi
10223 AC_SUBST(SYSTEM_LPSOLVE)
10225 dnl ===================================================================
10226 dnl Checking for libexttextcat
10227 dnl ===================================================================
10228 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10229 if test "$with_system_libexttextcat" = "yes"; then
10230     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10232 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10234 dnl ===================================================================
10235 dnl Checking for libnumbertext
10236 dnl ===================================================================
10237 AC_MSG_CHECKING([whether to use libnumbertext])
10238 if test "$enable_libnumbertext" = "no"; then
10239     AC_MSG_RESULT([no])
10240     ENABLE_LIBNUMBERTEXT=
10241     SYSTEM_LIBNUMBERTEXT=
10242 else
10243     AC_MSG_RESULT([yes])
10244     ENABLE_LIBNUMBERTEXT=TRUE
10245     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10246     if test "$with_system_libnumbertext" = "yes"; then
10247         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10248         SYSTEM_LIBNUMBERTEXT=YES
10249     else
10250         SYSTEM_LIBNUMBERTEXT=
10251         AC_LANG_PUSH([C++])
10252         save_CPPFLAGS=$CPPFLAGS
10253         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10254         AC_CHECK_HEADERS([codecvt regex])
10255         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10256                 [ ENABLE_LIBNUMBERTEXT=''
10257                   LIBNUMBERTEXT_CFLAGS=''
10258                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10259                                Enable libnumbertext fallback (missing number to number name conversion).])
10260                 ])
10261         CPPFLAGS=$save_CPPFLAGS
10262         AC_LANG_POP([C++])
10263     fi
10264     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10265         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10266     fi
10268 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10269 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10270 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10271 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10273 dnl ***************************************
10274 dnl testing libc version for Linux...
10275 dnl ***************************************
10276 if test "$_os" = "Linux"; then
10277     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10278     exec 6>/dev/null # no output
10279     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10280     exec 6>&1 # output on again
10281     if test "$HAVE_LIBC"; then
10282         AC_MSG_RESULT([yes])
10283     else
10284         AC_MSG_ERROR([no, upgrade libc])
10285     fi
10288 dnl =========================================
10289 dnl Check for uuidgen
10290 dnl =========================================
10291 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10292     # presence is already tested above in the WINDOWS_SDK_HOME check
10293     UUIDGEN=uuidgen.exe
10294     AC_SUBST(UUIDGEN)
10295 else
10296     AC_PATH_PROG([UUIDGEN], [uuidgen])
10297     if test -z "$UUIDGEN"; then
10298         AC_MSG_WARN([uuid is needed for building installation sets])
10299     fi
10302 dnl ***************************************
10303 dnl Checking for bison and flex
10304 dnl ***************************************
10305 AC_PATH_PROG(BISON, bison)
10306 if test -z "$BISON"; then
10307     AC_MSG_ERROR([no bison found in \$PATH, install it])
10308 else
10309     AC_MSG_CHECKING([the bison version])
10310     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10311     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10312     # Accept newer than 2.0
10313     if test "$_bison_longver" -lt 2000; then
10314         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10315     fi
10318 AC_PATH_PROG(FLEX, flex)
10319 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10320     FLEX=`cygpath -m $FLEX`
10322 if test -z "$FLEX"; then
10323     AC_MSG_ERROR([no flex found in \$PATH, install it])
10324 else
10325     AC_MSG_CHECKING([the flex version])
10326     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10327     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10328         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10329     fi
10331 AC_SUBST([FLEX])
10332 dnl ***************************************
10333 dnl Checking for patch
10334 dnl ***************************************
10335 AC_PATH_PROG(PATCH, patch)
10336 if test -z "$PATCH"; then
10337     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10340 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10341 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10342     if test -z "$with_gnu_patch"; then
10343         GNUPATCH=$PATCH
10344     else
10345         if test -x "$with_gnu_patch"; then
10346             GNUPATCH=$with_gnu_patch
10347         else
10348             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10349         fi
10350     fi
10352     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10353     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10354         AC_MSG_RESULT([yes])
10355     else
10356         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10357     fi
10358 else
10359     GNUPATCH=$PATCH
10362 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10363     GNUPATCH=`cygpath -m $GNUPATCH`
10366 dnl We also need to check for --with-gnu-cp
10368 if test -z "$with_gnu_cp"; then
10369     # check the place where the good stuff is hidden on Solaris...
10370     if test -x /usr/gnu/bin/cp; then
10371         GNUCP=/usr/gnu/bin/cp
10372     else
10373         AC_PATH_PROGS(GNUCP, gnucp cp)
10374     fi
10375     if test -z $GNUCP; then
10376         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10377     fi
10378 else
10379     if test -x "$with_gnu_cp"; then
10380         GNUCP=$with_gnu_cp
10381     else
10382         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10383     fi
10386 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10387     GNUCP=`cygpath -m $GNUCP`
10390 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10391 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10392     AC_MSG_RESULT([yes])
10393 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10394     AC_MSG_RESULT([yes])
10395 else
10396     case "$build_os" in
10397     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10398         x_GNUCP=[\#]
10399         GNUCP=''
10400         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10401         ;;
10402     *)
10403         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10404         ;;
10405     esac
10408 AC_SUBST(GNUPATCH)
10409 AC_SUBST(GNUCP)
10410 AC_SUBST(x_GNUCP)
10412 dnl ***************************************
10413 dnl testing assembler path
10414 dnl ***************************************
10415 ML_EXE=""
10416 if test "$_os" = "WINNT"; then
10417     if test "$BITNESS_OVERRIDE" = ""; then
10418         assembler=ml.exe
10419     else
10420         assembler=ml64.exe
10421     fi
10423     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10424     if test -f "$CL_PATH/$assembler"; then
10425         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10426         AC_MSG_RESULT([$ML_EXE])
10427     else
10428         AC_MSG_ERROR([not found])
10429     fi
10432 AC_SUBST(ML_EXE)
10434 dnl ===================================================================
10435 dnl We need zip and unzip
10436 dnl ===================================================================
10437 AC_PATH_PROG(ZIP, zip)
10438 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10439 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10440     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],,)
10443 AC_PATH_PROG(UNZIP, unzip)
10444 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10446 dnl ===================================================================
10447 dnl Zip must be a specific type for different build types.
10448 dnl ===================================================================
10449 if test $build_os = cygwin; then
10450     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10451         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10452     fi
10455 dnl ===================================================================
10456 dnl We need touch with -h option support.
10457 dnl ===================================================================
10458 AC_PATH_PROG(TOUCH, touch)
10459 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10460 touch warn
10461 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10462     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],,)
10465 dnl ===================================================================
10466 dnl Check for system epoxy
10467 dnl ===================================================================
10468 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10470 dnl ===================================================================
10471 dnl Set vcl option: coordinate device in double or sal_Int32
10472 dnl ===================================================================
10474 dnl disabled for now, we don't want subtle differences between OSs
10475 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10476 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10477 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10478 dnl     AC_MSG_RESULT([double])
10479 dnl else
10480 dnl     AC_MSG_RESULT([sal_Int32])
10481 dnl fi
10483 dnl ===================================================================
10484 dnl Test which vclplugs have to be built.
10485 dnl ===================================================================
10486 R=""
10487 if test "$USING_X11" != TRUE; then
10488     enable_gtk3=no
10490 GTK3_CFLAGS=""
10491 GTK3_LIBS=""
10492 ENABLE_GTK3=""
10493 if test "x$enable_gtk3" = "xyes"; then
10494     if test "$with_system_cairo" = no; then
10495         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10496     fi
10497     : ${with_system_cairo:=yes}
10498     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="")
10499     if test "x$ENABLE_GTK3" = "xTRUE"; then
10500         AC_DEFINE(ENABLE_GTK3)
10501         R="gtk3"
10502     else
10503         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10504     fi
10505     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10506     FilterLibs "${GTK3_LIBS}"
10507     GTK3_LIBS="${filteredlibs}"
10509     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10510     if test "$with_system_epoxy" != "yes"; then
10511         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10512         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10513                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10514     fi
10516 AC_SUBST(GTK3_LIBS)
10517 AC_SUBST(GTK3_CFLAGS)
10518 AC_SUBST(ENABLE_GTK3)
10520 if test "$enable_introspection" = yes; then
10521     if test "$ENABLE_GTK3" = TRUE; then
10522         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10523     else
10524         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10525     fi
10528 ENABLE_QT5=""
10529 if test "x$enable_qt5" = "xyes"; then
10530     ENABLE_QT5="TRUE"
10531     AC_DEFINE(ENABLE_QT5)
10532     R="$R qt5"
10534 AC_SUBST(ENABLE_QT5)
10536 ENABLE_KF5=""
10537 if test "x$enable_kf5" = "xyes"; then
10538     ENABLE_KF5="TRUE"
10539     AC_DEFINE(ENABLE_KF5)
10540     R="$R kf5"
10542 AC_SUBST(ENABLE_KF5)
10544 ENABLE_GTK3_KDE5=""
10545 if test "x$enable_gtk3_kde5" = "xyes"; then
10546     ENABLE_GTK3_KDE5="TRUE"
10547     AC_DEFINE(ENABLE_GTK3_KDE5)
10548     R="$R gtk3_kde5"
10550 AC_SUBST(ENABLE_GTK3_KDE5)
10552 if test "$_os" = "WINNT"; then
10553     R="$R win"
10554 elif test "$_os" = "Darwin"; then
10555     R="$R osx"
10556 elif test "$_os" = "iOS"; then
10557     R="ios (builtin)"
10560 build_vcl_plugins="$R"
10561 if test -z "$build_vcl_plugins"; then
10562     build_vcl_plugins="none"
10564 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10566 dnl ===================================================================
10567 dnl check for dbus support
10568 dnl ===================================================================
10569 ENABLE_DBUS=""
10570 DBUS_CFLAGS=""
10571 DBUS_LIBS=""
10572 DBUS_GLIB_CFLAGS=""
10573 DBUS_GLIB_LIBS=""
10574 DBUS_HAVE_GLIB=""
10576 if test "$enable_dbus" = "no"; then
10577     test_dbus=no
10580 AC_MSG_CHECKING([whether to enable DBUS support])
10581 if test "$test_dbus" = "yes"; then
10582     ENABLE_DBUS="TRUE"
10583     AC_MSG_RESULT([yes])
10584     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10585     AC_DEFINE(ENABLE_DBUS)
10586     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10587     FilterLibs "${DBUS_LIBS}"
10588     DBUS_LIBS="${filteredlibs}"
10590     # Glib is needed for BluetoothServer
10591     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10592     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10593         [
10594             DBUS_HAVE_GLIB="TRUE"
10595             AC_DEFINE(DBUS_HAVE_GLIB,1)
10596         ],
10597         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10598     )
10599 else
10600     AC_MSG_RESULT([no])
10603 AC_SUBST(ENABLE_DBUS)
10604 AC_SUBST(DBUS_CFLAGS)
10605 AC_SUBST(DBUS_LIBS)
10606 AC_SUBST(DBUS_GLIB_CFLAGS)
10607 AC_SUBST(DBUS_GLIB_LIBS)
10608 AC_SUBST(DBUS_HAVE_GLIB)
10610 AC_MSG_CHECKING([whether to enable Impress remote control])
10611 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10612     AC_MSG_RESULT([yes])
10613     ENABLE_SDREMOTE=TRUE
10614     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10616     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10617         # The Bluetooth code doesn't compile with macOS SDK 10.15
10618         enable_sdremote_bluetooth=no
10619     fi
10620     # If not explicitly enabled or disabled, default
10621     if test -z "$enable_sdremote_bluetooth"; then
10622         case "$OS" in
10623         LINUX|MACOSX|WNT)
10624             # Default to yes for these
10625             enable_sdremote_bluetooth=yes
10626             ;;
10627         *)
10628             # otherwise no
10629             enable_sdremote_bluetooth=no
10630             ;;
10631         esac
10632     fi
10633     # $enable_sdremote_bluetooth is guaranteed non-empty now
10635     if test "$enable_sdremote_bluetooth" != "no"; then
10636         if test "$OS" = "LINUX"; then
10637             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10638                 AC_MSG_RESULT([yes])
10639                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10640                 dnl ===================================================================
10641                 dnl Check for system bluez
10642                 dnl ===================================================================
10643                 AC_MSG_CHECKING([which Bluetooth header to use])
10644                 if test "$with_system_bluez" = "yes"; then
10645                     AC_MSG_RESULT([external])
10646                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10647                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10648                     SYSTEM_BLUEZ=TRUE
10649                 else
10650                     AC_MSG_RESULT([internal])
10651                     SYSTEM_BLUEZ=
10652                 fi
10653             else
10654                 AC_MSG_RESULT([no, dbus disabled])
10655                 ENABLE_SDREMOTE_BLUETOOTH=
10656                 SYSTEM_BLUEZ=
10657             fi
10658         else
10659             AC_MSG_RESULT([yes])
10660             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10661             SYSTEM_BLUEZ=
10662         fi
10663     else
10664         AC_MSG_RESULT([no])
10665         ENABLE_SDREMOTE_BLUETOOTH=
10666         SYSTEM_BLUEZ=
10667     fi
10668 else
10669     ENABLE_SDREMOTE=
10670     SYSTEM_BLUEZ=
10671     AC_MSG_RESULT([no])
10673 AC_SUBST(ENABLE_SDREMOTE)
10674 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10675 AC_SUBST(SYSTEM_BLUEZ)
10677 dnl ===================================================================
10678 dnl Check whether to enable GIO support
10679 dnl ===================================================================
10680 if test "$ENABLE_GTK3" = "TRUE"; then
10681     AC_MSG_CHECKING([whether to enable GIO support])
10682     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10683         dnl Need at least 2.26 for the dbus support.
10684         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10685                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10686         if test "$ENABLE_GIO" = "TRUE"; then
10687             AC_DEFINE(ENABLE_GIO)
10688             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10689             FilterLibs "${GIO_LIBS}"
10690             GIO_LIBS="${filteredlibs}"
10691         fi
10692     else
10693         AC_MSG_RESULT([no])
10694     fi
10696 AC_SUBST(ENABLE_GIO)
10697 AC_SUBST(GIO_CFLAGS)
10698 AC_SUBST(GIO_LIBS)
10701 dnl ===================================================================
10703 SPLIT_APP_MODULES=""
10704 if test "$enable_split_app_modules" = "yes"; then
10705     SPLIT_APP_MODULES="TRUE"
10707 AC_SUBST(SPLIT_APP_MODULES)
10709 SPLIT_OPT_FEATURES=""
10710 if test "$enable_split_opt_features" = "yes"; then
10711     SPLIT_OPT_FEATURES="TRUE"
10713 AC_SUBST(SPLIT_OPT_FEATURES)
10715 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10716     if test "$enable_cairo_canvas" = yes; then
10717         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10718     fi
10719     enable_cairo_canvas=no
10720 elif test -z "$enable_cairo_canvas"; then
10721     enable_cairo_canvas=yes
10724 ENABLE_CAIRO_CANVAS=""
10725 if test "$enable_cairo_canvas" = "yes"; then
10726     test_cairo=yes
10727     ENABLE_CAIRO_CANVAS="TRUE"
10728     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10730 AC_SUBST(ENABLE_CAIRO_CANVAS)
10732 dnl ===================================================================
10733 dnl Check whether the GStreamer libraries are available.
10734 dnl ===================================================================
10736 ENABLE_GSTREAMER_1_0=""
10738 if test "$build_gstreamer_1_0" = "yes"; then
10740     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10741     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10742         ENABLE_GSTREAMER_1_0="TRUE"
10743         AC_MSG_RESULT([yes])
10744         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10745         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10746         FilterLibs "${GSTREAMER_1_0_LIBS}"
10747         GSTREAMER_1_0_LIBS="${filteredlibs}"
10748         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10749     else
10750         AC_MSG_RESULT([no])
10751     fi
10753 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10754 AC_SUBST(GSTREAMER_1_0_LIBS)
10755 AC_SUBST(ENABLE_GSTREAMER_1_0)
10757 dnl ===================================================================
10758 dnl Check whether to build the VLC avmedia backend
10759 dnl ===================================================================
10761 ENABLE_VLC=""
10763 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10764 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10765     ENABLE_VLC="TRUE"
10766     AC_MSG_RESULT([yes])
10767 else
10768     AC_MSG_RESULT([no])
10770 AC_SUBST(ENABLE_VLC)
10772 ENABLE_OPENGL_TRANSITIONS=
10773 ENABLE_OPENGL_CANVAS=
10774 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10775    : # disable
10776 elif test "$_os" = "Darwin"; then
10777     # We use frameworks on macOS, no need for detail checks
10778     ENABLE_OPENGL_TRANSITIONS=TRUE
10779     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10780     ENABLE_OPENGL_CANVAS=TRUE
10781 elif test $_os = WINNT; then
10782     ENABLE_OPENGL_TRANSITIONS=TRUE
10783     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10784     ENABLE_OPENGL_CANVAS=TRUE
10785 else
10786     if test "$USING_X11" = TRUE; then
10787         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10788         ENABLE_OPENGL_TRANSITIONS=TRUE
10789         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10790         ENABLE_OPENGL_CANVAS=TRUE
10791     fi
10794 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10795 AC_SUBST(ENABLE_OPENGL_CANVAS)
10797 dnl =================================================
10798 dnl Check whether to build with OpenCL support.
10799 dnl =================================================
10801 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10802     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10803     # platform (optional at run-time, used through clew).
10804     BUILD_TYPE="$BUILD_TYPE OPENCL"
10805     AC_DEFINE(HAVE_FEATURE_OPENCL)
10808 dnl =================================================
10809 dnl Check whether to build with dconf support.
10810 dnl =================================================
10812 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10813     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10814         if test "$enable_dconf" = yes; then
10815             AC_MSG_ERROR([dconf not found])
10816         else
10817             enable_dconf=no
10818         fi])
10820 AC_MSG_CHECKING([whether to enable dconf])
10821 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10822     DCONF_CFLAGS=
10823     DCONF_LIBS=
10824     ENABLE_DCONF=
10825     AC_MSG_RESULT([no])
10826 else
10827     ENABLE_DCONF=TRUE
10828     AC_DEFINE(ENABLE_DCONF)
10829     AC_MSG_RESULT([yes])
10831 AC_SUBST([DCONF_CFLAGS])
10832 AC_SUBST([DCONF_LIBS])
10833 AC_SUBST([ENABLE_DCONF])
10835 # pdf import?
10836 AC_MSG_CHECKING([whether to build the PDF import feature])
10837 ENABLE_PDFIMPORT=
10838 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10839     AC_MSG_RESULT([yes])
10840     ENABLE_PDFIMPORT=TRUE
10841     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10842 else
10843     AC_MSG_RESULT([no])
10846 # Pdfium?
10847 AC_MSG_CHECKING([whether to build PDFium])
10848 ENABLE_PDFIUM=
10849 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10850     AC_MSG_RESULT([yes])
10851     ENABLE_PDFIUM=TRUE
10852     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10853     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10854 else
10855     AC_MSG_RESULT([no])
10857 AC_SUBST(ENABLE_PDFIUM)
10859 dnl ===================================================================
10860 dnl Check for poppler
10861 dnl ===================================================================
10862 ENABLE_POPPLER=
10863 AC_MSG_CHECKING([whether to build Poppler])
10864 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10865     AC_MSG_RESULT([yes])
10866     ENABLE_POPPLER=TRUE
10867     AC_DEFINE(HAVE_FEATURE_POPPLER)
10868 else
10869     AC_MSG_RESULT([no])
10871 AC_SUBST(ENABLE_POPPLER)
10873 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10874     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10877 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10878     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10881 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10882     dnl ===================================================================
10883     dnl Check for system poppler
10884     dnl ===================================================================
10885     AC_MSG_CHECKING([which PDF import poppler to use])
10886     if test "$with_system_poppler" = "yes"; then
10887         AC_MSG_RESULT([external])
10888         SYSTEM_POPPLER=TRUE
10889         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10890         AC_LANG_PUSH([C++])
10891         save_CXXFLAGS=$CXXFLAGS
10892         save_CPPFLAGS=$CPPFLAGS
10893         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10894         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10895         AC_CHECK_HEADER([cpp/poppler-version.h],
10896             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10897             [])
10898         CXXFLAGS=$save_CXXFLAGS
10899         CPPFLAGS=$save_CPPFLAGS
10900         AC_LANG_POP([C++])
10901         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10903         FilterLibs "${POPPLER_LIBS}"
10904         POPPLER_LIBS="${filteredlibs}"
10905     else
10906         AC_MSG_RESULT([internal])
10907         SYSTEM_POPPLER=
10908         BUILD_TYPE="$BUILD_TYPE POPPLER"
10909         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10910     fi
10911     AC_DEFINE([ENABLE_PDFIMPORT],1)
10913 AC_SUBST(ENABLE_PDFIMPORT)
10914 AC_SUBST(SYSTEM_POPPLER)
10915 AC_SUBST(POPPLER_CFLAGS)
10916 AC_SUBST(POPPLER_LIBS)
10918 SYSTEM_GPGMEPP=
10920 if test "$build_for_ios" = "YES"; then
10921     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10922     AC_MSG_RESULT([yes])
10923 elif test "$enable_mpl_subset" = "yes"; then
10924     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10925     AC_MSG_RESULT([yes])
10926 elif test "$enable_fuzzers" = "yes"; then
10927     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10928     AC_MSG_RESULT([yes])
10929 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10930     dnl ===================================================================
10931     dnl Check for system gpgme
10932     dnl ===================================================================
10933     AC_MSG_CHECKING([which gpgmepp to use])
10934     if test "$with_system_gpgmepp" = "yes"; then
10935         AC_MSG_RESULT([external])
10936         SYSTEM_GPGMEPP=TRUE
10938         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10939         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10940             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10941         # progress_callback is the only func with plain C linkage
10942         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10943         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10944             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10945         AC_CHECK_HEADER(gpgme.h, [],
10946             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10947     else
10948         AC_MSG_RESULT([internal])
10949         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10950         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10952         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10953         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10954         if test "$_os" != "WINNT"; then
10955             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10956             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10957         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10958             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10959         fi
10960     fi
10961     ENABLE_GPGMEPP=TRUE
10962     AC_DEFINE([HAVE_FEATURE_GPGME])
10963     AC_PATH_PROG(GPG, gpg)
10964     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10965     # so let's exclude that manually for the moment
10966     if test -n "$GPG" -a "$_os" != "WINNT"; then
10967         # make sure we not only have a working gpgme, but a full working
10968         # gpg installation to run OpenPGP signature verification
10969         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10970     fi
10971     if test "$_os" = "Linux"; then
10972       uid=`id -u`
10973       AC_MSG_CHECKING([for /run/user/$uid])
10974       if test -d /run/user/$uid; then
10975         AC_MSG_RESULT([yes])
10976         AC_PATH_PROG(GPGCONF, gpgconf)
10978         # Older versions of gpgconf are not working as expected, since
10979         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10980         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10981         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10982         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10983         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10984         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10985         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10986           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10987           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10988           if $GPGCONF --dump-options > /dev/null ; then
10989             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10990               AC_MSG_RESULT([yes])
10991               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10992               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10993             else
10994               AC_MSG_RESULT([no])
10995             fi
10996           else
10997             AC_MSG_RESULT([no. missing or broken gpgconf?])
10998           fi
10999         else
11000           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11001         fi
11002       else
11003         AC_MSG_RESULT([no])
11004      fi
11005    fi
11007 AC_SUBST(ENABLE_GPGMEPP)
11008 AC_SUBST(SYSTEM_GPGMEPP)
11009 AC_SUBST(GPG_ERROR_CFLAGS)
11010 AC_SUBST(GPG_ERROR_LIBS)
11011 AC_SUBST(LIBASSUAN_CFLAGS)
11012 AC_SUBST(LIBASSUAN_LIBS)
11013 AC_SUBST(GPGMEPP_CFLAGS)
11014 AC_SUBST(GPGMEPP_LIBS)
11016 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11017 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11018     AC_MSG_RESULT([yes])
11019     ENABLE_MEDIAWIKI=TRUE
11020     BUILD_TYPE="$BUILD_TYPE XSLTML"
11021     if test  "x$with_java" = "xno"; then
11022         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11023     fi
11024 else
11025     AC_MSG_RESULT([no])
11026     ENABLE_MEDIAWIKI=
11027     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11029 AC_SUBST(ENABLE_MEDIAWIKI)
11031 AC_MSG_CHECKING([whether to build the Report Builder])
11032 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11033     AC_MSG_RESULT([yes])
11034     ENABLE_REPORTBUILDER=TRUE
11035     AC_MSG_CHECKING([which jfreereport libs to use])
11036     if test "$with_system_jfreereport" = "yes"; then
11037         SYSTEM_JFREEREPORT=TRUE
11038         AC_MSG_RESULT([external])
11039         if test -z $SAC_JAR; then
11040             SAC_JAR=/usr/share/java/sac.jar
11041         fi
11042         if ! test -f $SAC_JAR; then
11043              AC_MSG_ERROR(sac.jar not found.)
11044         fi
11046         if test -z $LIBXML_JAR; then
11047             if test -f /usr/share/java/libxml-1.0.0.jar; then
11048                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11049             elif test -f /usr/share/java/libxml.jar; then
11050                 LIBXML_JAR=/usr/share/java/libxml.jar
11051             else
11052                 AC_MSG_ERROR(libxml.jar replacement not found.)
11053             fi
11054         elif ! test -f $LIBXML_JAR; then
11055             AC_MSG_ERROR(libxml.jar not found.)
11056         fi
11058         if test -z $FLUTE_JAR; then
11059             if test -f/usr/share/java/flute-1.3.0.jar; then
11060                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11061             elif test -f /usr/share/java/flute.jar; then
11062                 FLUTE_JAR=/usr/share/java/flute.jar
11063             else
11064                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11065             fi
11066         elif ! test -f $FLUTE_JAR; then
11067             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11068         fi
11070         if test -z $JFREEREPORT_JAR; then
11071             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11072                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11073             elif test -f /usr/share/java/flow-engine.jar; then
11074                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11075             else
11076                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11077             fi
11078         elif ! test -f  $JFREEREPORT_JAR; then
11079                 AC_MSG_ERROR(jfreereport.jar not found.)
11080         fi
11082         if test -z $LIBLAYOUT_JAR; then
11083             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11084                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11085             elif test -f /usr/share/java/liblayout.jar; then
11086                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11087             else
11088                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11089             fi
11090         elif ! test -f $LIBLAYOUT_JAR; then
11091                 AC_MSG_ERROR(liblayout.jar not found.)
11092         fi
11094         if test -z $LIBLOADER_JAR; then
11095             if test -f /usr/share/java/libloader-1.0.0.jar; then
11096                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11097             elif test -f /usr/share/java/libloader.jar; then
11098                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11099             else
11100                 AC_MSG_ERROR(libloader.jar replacement not found.)
11101             fi
11102         elif ! test -f  $LIBLOADER_JAR; then
11103             AC_MSG_ERROR(libloader.jar not found.)
11104         fi
11106         if test -z $LIBFORMULA_JAR; then
11107             if test -f /usr/share/java/libformula-0.2.0.jar; then
11108                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11109             elif test -f /usr/share/java/libformula.jar; then
11110                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11111             else
11112                 AC_MSG_ERROR(libformula.jar replacement not found.)
11113             fi
11114         elif ! test -f $LIBFORMULA_JAR; then
11115                 AC_MSG_ERROR(libformula.jar not found.)
11116         fi
11118         if test -z $LIBREPOSITORY_JAR; then
11119             if test -f /usr/share/java/librepository-1.0.0.jar; then
11120                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11121             elif test -f /usr/share/java/librepository.jar; then
11122                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11123             else
11124                 AC_MSG_ERROR(librepository.jar replacement not found.)
11125             fi
11126         elif ! test -f $LIBREPOSITORY_JAR; then
11127             AC_MSG_ERROR(librepository.jar not found.)
11128         fi
11130         if test -z $LIBFONTS_JAR; then
11131             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11132                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11133             elif test -f /usr/share/java/libfonts.jar; then
11134                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11135             else
11136                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11137             fi
11138         elif ! test -f $LIBFONTS_JAR; then
11139                 AC_MSG_ERROR(libfonts.jar not found.)
11140         fi
11142         if test -z $LIBSERIALIZER_JAR; then
11143             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11144                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11145             elif test -f /usr/share/java/libserializer.jar; then
11146                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11147             else
11148                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11149             fi
11150         elif ! test -f $LIBSERIALIZER_JAR; then
11151                 AC_MSG_ERROR(libserializer.jar not found.)
11152         fi
11154         if test -z $LIBBASE_JAR; then
11155             if test -f /usr/share/java/libbase-1.0.0.jar; then
11156                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11157             elif test -f /usr/share/java/libbase.jar; then
11158                 LIBBASE_JAR=/usr/share/java/libbase.jar
11159             else
11160                 AC_MSG_ERROR(libbase.jar replacement not found.)
11161             fi
11162         elif ! test -f $LIBBASE_JAR; then
11163             AC_MSG_ERROR(libbase.jar not found.)
11164         fi
11166     else
11167         AC_MSG_RESULT([internal])
11168         SYSTEM_JFREEREPORT=
11169         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11170         NEED_ANT=TRUE
11171     fi
11172 else
11173     AC_MSG_RESULT([no])
11174     ENABLE_REPORTBUILDER=
11175     SYSTEM_JFREEREPORT=
11177 AC_SUBST(ENABLE_REPORTBUILDER)
11178 AC_SUBST(SYSTEM_JFREEREPORT)
11179 AC_SUBST(SAC_JAR)
11180 AC_SUBST(LIBXML_JAR)
11181 AC_SUBST(FLUTE_JAR)
11182 AC_SUBST(JFREEREPORT_JAR)
11183 AC_SUBST(LIBBASE_JAR)
11184 AC_SUBST(LIBLAYOUT_JAR)
11185 AC_SUBST(LIBLOADER_JAR)
11186 AC_SUBST(LIBFORMULA_JAR)
11187 AC_SUBST(LIBREPOSITORY_JAR)
11188 AC_SUBST(LIBFONTS_JAR)
11189 AC_SUBST(LIBSERIALIZER_JAR)
11191 # this has to be here because both the Wiki Publisher and the SRB use
11192 # commons-logging
11193 COMMONS_LOGGING_VERSION=1.2
11194 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11195     AC_MSG_CHECKING([which Apache commons-* libs to use])
11196     if test "$with_system_apache_commons" = "yes"; then
11197         SYSTEM_APACHE_COMMONS=TRUE
11198         AC_MSG_RESULT([external])
11199         if test -z $COMMONS_LOGGING_JAR; then
11200             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11201                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11202            elif test -f /usr/share/java/commons-logging.jar; then
11203                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11204             else
11205                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11206             fi
11207         elif ! test -f $COMMONS_LOGGING_JAR; then
11208             AC_MSG_ERROR(commons-logging.jar not found.)
11209         fi
11210     else
11211         AC_MSG_RESULT([internal])
11212         SYSTEM_APACHE_COMMONS=
11213         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11214         NEED_ANT=TRUE
11215     fi
11217 AC_SUBST(SYSTEM_APACHE_COMMONS)
11218 AC_SUBST(COMMONS_LOGGING_JAR)
11219 AC_SUBST(COMMONS_LOGGING_VERSION)
11221 # scripting provider for BeanShell?
11222 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11223 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11224     AC_MSG_RESULT([yes])
11225     ENABLE_SCRIPTING_BEANSHELL=TRUE
11227     dnl ===================================================================
11228     dnl Check for system beanshell
11229     dnl ===================================================================
11230     AC_MSG_CHECKING([which beanshell to use])
11231     if test "$with_system_beanshell" = "yes"; then
11232         AC_MSG_RESULT([external])
11233         SYSTEM_BSH=TRUE
11234         if test -z $BSH_JAR; then
11235             BSH_JAR=/usr/share/java/bsh.jar
11236         fi
11237         if ! test -f $BSH_JAR; then
11238             AC_MSG_ERROR(bsh.jar not found.)
11239         fi
11240     else
11241         AC_MSG_RESULT([internal])
11242         SYSTEM_BSH=
11243         BUILD_TYPE="$BUILD_TYPE BSH"
11244     fi
11245 else
11246     AC_MSG_RESULT([no])
11247     ENABLE_SCRIPTING_BEANSHELL=
11248     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11250 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11251 AC_SUBST(SYSTEM_BSH)
11252 AC_SUBST(BSH_JAR)
11254 # scripting provider for JavaScript?
11255 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11256 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11257     AC_MSG_RESULT([yes])
11258     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11260     dnl ===================================================================
11261     dnl Check for system rhino
11262     dnl ===================================================================
11263     AC_MSG_CHECKING([which rhino to use])
11264     if test "$with_system_rhino" = "yes"; then
11265         AC_MSG_RESULT([external])
11266         SYSTEM_RHINO=TRUE
11267         if test -z $RHINO_JAR; then
11268             RHINO_JAR=/usr/share/java/js.jar
11269         fi
11270         if ! test -f $RHINO_JAR; then
11271             AC_MSG_ERROR(js.jar not found.)
11272         fi
11273     else
11274         AC_MSG_RESULT([internal])
11275         SYSTEM_RHINO=
11276         BUILD_TYPE="$BUILD_TYPE RHINO"
11277         NEED_ANT=TRUE
11278     fi
11279 else
11280     AC_MSG_RESULT([no])
11281     ENABLE_SCRIPTING_JAVASCRIPT=
11282     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11284 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11285 AC_SUBST(SYSTEM_RHINO)
11286 AC_SUBST(RHINO_JAR)
11288 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11289 # paths should be added to library search path. So lets put all 64-bit
11290 # platforms there.
11291 supports_multilib=
11292 case "$host_cpu" in
11293 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11294     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11295         supports_multilib="yes"
11296     fi
11297     ;;
11299     ;;
11300 esac
11302 dnl ===================================================================
11303 dnl QT5 Integration
11304 dnl ===================================================================
11306 QT5_CFLAGS=""
11307 QT5_LIBS=""
11308 QMAKE5="qmake"
11309 MOC5="moc"
11310 QT5_GOBJECT_CFLAGS=""
11311 QT5_GOBJECT_LIBS=""
11312 QT5_HAVE_GOBJECT=""
11313 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11314         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11315         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11316 then
11317     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11318     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11320     if test -n "$supports_multilib"; then
11321         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11322     fi
11324     qt5_test_include="QtWidgets/qapplication.h"
11325     qt5_test_library="libQt5Widgets.so"
11327     dnl Check for qmake5
11328     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11329     if test "$QMAKE5" = "no"; then
11330         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11331     else
11332         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11333         if test -z "$qmake5_test_ver"; then
11334             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11335         fi
11336         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11337         qt5_minimal_minor="6"
11338         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11339             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11340         else
11341             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11342         fi
11343     fi
11345     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11346     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11348     AC_MSG_CHECKING([for Qt5 headers])
11349     qt5_incdir="no"
11350     for inc_dir in $qt5_incdirs; do
11351         if test -r "$inc_dir/$qt5_test_include"; then
11352             qt5_incdir="$inc_dir"
11353             break
11354         fi
11355     done
11356     AC_MSG_RESULT([$qt5_incdir])
11357     if test "x$qt5_incdir" = "xno"; then
11358         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11359     fi
11361     AC_MSG_CHECKING([for Qt5 libraries])
11362     qt5_libdir="no"
11363     for lib_dir in $qt5_libdirs; do
11364         if test -r "$lib_dir/$qt5_test_library"; then
11365             qt5_libdir="$lib_dir"
11366             break
11367         fi
11368     done
11369     AC_MSG_RESULT([$qt5_libdir])
11370     if test "x$qt5_libdir" = "xno"; then
11371         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11372     fi
11374     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11375     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11376     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11378     if test "$USING_X11" = TRUE; then
11379         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11380         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11381             QT5_HAVE_XCB_ICCCM=1
11382             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11383         ],[
11384             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)])
11385             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11386         ])
11387         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11388         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11389         QT5_USING_X11=1
11390         AC_DEFINE(QT5_USING_X11)
11391     fi
11393     dnl Check for Meta Object Compiler
11395     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11396     if test "$MOC5" = "no"; then
11397         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11398 the root of your Qt installation by exporting QT5DIR before running "configure".])
11399     fi
11401     if test "$build_gstreamer_1_0" = "yes"; then
11402         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11403                 QT5_HAVE_GOBJECT=1
11404                 AC_DEFINE(QT5_HAVE_GOBJECT)
11405             ],
11406             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11407         )
11408     fi
11410 AC_SUBST(QT5_CFLAGS)
11411 AC_SUBST(QT5_LIBS)
11412 AC_SUBST(MOC5)
11413 AC_SUBST(QT5_GOBJECT_CFLAGS)
11414 AC_SUBST(QT5_GOBJECT_LIBS)
11415 AC_SUBST(QT5_HAVE_GOBJECT)
11417 dnl ===================================================================
11418 dnl KF5 Integration
11419 dnl ===================================================================
11421 KF5_CFLAGS=""
11422 KF5_LIBS=""
11423 KF5_CONFIG="kf5-config"
11424 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11425         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11426 then
11427     if test "$OS" = "HAIKU"; then
11428         haiku_arch="`echo $RTL_ARCH | tr X x`"
11429         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11430         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11431     fi
11433     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11434     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11435     if test -n "$supports_multilib"; then
11436         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11437     fi
11439     kf5_test_include="KF5/kcoreaddons_version.h"
11440     kf5_test_library="libKF5CoreAddons.so"
11441     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11443     dnl kf5 KDE4 support compatibility installed
11444     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11445     if test "$KF5_CONFIG" != "no"; then
11446         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11447         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11448     fi
11450     dnl Check for KF5 headers
11451     AC_MSG_CHECKING([for KF5 headers])
11452     kf5_incdir="no"
11453     for kf5_check in $kf5_incdirs; do
11454         if test -r "$kf5_check/$kf5_test_include"; then
11455             kf5_incdir="$kf5_check/KF5"
11456             break
11457         fi
11458     done
11459     AC_MSG_RESULT([$kf5_incdir])
11460     if test "x$kf5_incdir" = "xno"; then
11461         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11462     fi
11464     dnl Check for KF5 libraries
11465     AC_MSG_CHECKING([for KF5 libraries])
11466     kf5_libdir="no"
11467     for kf5_check in $kf5_libdirs; do
11468         if test -r "$kf5_check/$kf5_test_library"; then
11469             kf5_libdir="$kf5_check"
11470             break
11471         fi
11472     done
11474     AC_MSG_RESULT([$kf5_libdir])
11475     if test "x$kf5_libdir" = "xno"; then
11476         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11477     fi
11479     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"
11480     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11481     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11483     if test "$USING_X11" = TRUE; then
11484         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11485     fi
11487     AC_LANG_PUSH([C++])
11488     save_CXXFLAGS=$CXXFLAGS
11489     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11490     AC_MSG_CHECKING([whether KDE is >= 5.0])
11491        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11492 #include <kcoreaddons_version.h>
11494 int main(int argc, char **argv) {
11495        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11496        else return 1;
11498        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11499     CXXFLAGS=$save_CXXFLAGS
11500     AC_LANG_POP([C++])
11502 AC_SUBST(KF5_CFLAGS)
11503 AC_SUBST(KF5_LIBS)
11505 dnl ===================================================================
11506 dnl Test whether to include Evolution 2 support
11507 dnl ===================================================================
11508 AC_MSG_CHECKING([whether to enable evolution 2 support])
11509 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11510     AC_MSG_RESULT([yes])
11511     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11512     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11513     FilterLibs "${GOBJECT_LIBS}"
11514     GOBJECT_LIBS="${filteredlibs}"
11515     ENABLE_EVOAB2="TRUE"
11516 else
11517     ENABLE_EVOAB2=""
11518     AC_MSG_RESULT([no])
11520 AC_SUBST(ENABLE_EVOAB2)
11521 AC_SUBST(GOBJECT_CFLAGS)
11522 AC_SUBST(GOBJECT_LIBS)
11524 dnl ===================================================================
11525 dnl Test which themes to include
11526 dnl ===================================================================
11527 AC_MSG_CHECKING([which themes to include])
11528 # if none given use default subset of available themes
11529 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11530     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"
11533 WITH_THEMES=""
11534 if test "x$with_theme" != "xno"; then
11535     for theme in $with_theme; do
11536         case $theme in
11537         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" ;;
11538         default) real_theme=colibre ;;
11539         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11540         esac
11541         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11542     done
11544 AC_MSG_RESULT([$WITH_THEMES])
11545 AC_SUBST([WITH_THEMES])
11546 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11547 for theme in $with_theme; do
11548     case $theme in
11549     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11550     *) ;;
11551     esac
11552 done
11554 dnl ===================================================================
11555 dnl Test whether to integrate helppacks into the product's installer
11556 dnl ===================================================================
11557 AC_MSG_CHECKING([for helppack integration])
11558 if test "$with_helppack_integration" = "no"; then
11559     AC_MSG_RESULT([no integration])
11560 else
11561     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11562     AC_MSG_RESULT([integration])
11565 ###############################################################################
11566 # Extensions checking
11567 ###############################################################################
11568 AC_MSG_CHECKING([for extensions integration])
11569 if test "x$enable_extension_integration" != "xno"; then
11570     WITH_EXTENSION_INTEGRATION=TRUE
11571     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11572     AC_MSG_RESULT([yes, use integration])
11573 else
11574     WITH_EXTENSION_INTEGRATION=
11575     AC_MSG_RESULT([no, do not integrate])
11577 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11579 dnl Should any extra extensions be included?
11580 dnl There are standalone tests for each of these below.
11581 WITH_EXTRA_EXTENSIONS=
11582 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11584 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11585 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11586 if test "x$with_java" != "xno"; then
11587     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11588     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11591 AC_MSG_CHECKING([whether to build opens___.ttf])
11592 if test "$enable_build_opensymbol" = "yes"; then
11593     AC_MSG_RESULT([yes])
11594     AC_PATH_PROG(FONTFORGE, fontforge)
11595     if test -z "$FONTFORGE"; then
11596         AC_MSG_ERROR([fontforge not installed])
11597     fi
11598 else
11599     AC_MSG_RESULT([no])
11600     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11601     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11603 AC_SUBST(OPENSYMBOL_TTF)
11604 AC_SUBST(FONTFORGE)
11606 dnl ===================================================================
11607 dnl Test whether to include fonts
11608 dnl ===================================================================
11609 AC_MSG_CHECKING([whether to include third-party fonts])
11610 if test "$with_fonts" != "no"; then
11611     AC_MSG_RESULT([yes])
11612     WITH_FONTS=TRUE
11613     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11614     AC_DEFINE(HAVE_MORE_FONTS)
11615 else
11616     AC_MSG_RESULT([no])
11617     WITH_FONTS=
11618     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11620 AC_SUBST(WITH_FONTS)
11622 dnl Test whether to include more Google Noto fonts
11623 dnl ===================================================================
11624 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11625 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11626     AC_MSG_RESULT([no])
11627     WITH_NOTO_FONT=
11628 else
11629     AC_MSG_RESULT([yes])
11630     WITH_NOTO_FONT=TRUE
11631     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11632     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11634 AC_SUBST(WITH_NOTO_FONT)
11636 dnl ===================================================================
11637 dnl Test whether to enable online update service
11638 dnl ===================================================================
11639 AC_MSG_CHECKING([whether to enable online update])
11640 ENABLE_ONLINE_UPDATE=
11641 ENABLE_ONLINE_UPDATE_MAR=
11642 UPDATE_CONFIG=
11643 if test "$enable_online_update" = ""; then
11644     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11645         AC_MSG_RESULT([yes])
11646         ENABLE_ONLINE_UPDATE="TRUE"
11647     else
11648         AC_MSG_RESULT([no])
11649     fi
11650 else
11651     if test "$enable_online_update" = "mar"; then
11652         AC_MSG_RESULT([yes - MAR-based online update])
11653         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11654         if test "$with_update_config" = ""; then
11655             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11656         fi
11657         UPDATE_CONFIG="$with_update_config"
11658         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11659     elif test "$enable_online_update" = "yes"; then
11660         AC_MSG_RESULT([yes])
11661         ENABLE_ONLINE_UPDATE="TRUE"
11662     else
11663         AC_MSG_RESULT([no])
11664     fi
11666 AC_SUBST(ENABLE_ONLINE_UPDATE)
11667 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11668 AC_SUBST(UPDATE_CONFIG)
11670 dnl ===================================================================
11671 dnl Test whether we need bzip2
11672 dnl ===================================================================
11673 SYSTEM_BZIP2=
11674 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11675     AC_MSG_CHECKING([whether to use system bzip2])
11676     if test "$with_system_bzip2" = yes; then
11677         SYSTEM_BZIP2=TRUE
11678         AC_MSG_RESULT([yes])
11679         PKG_CHECK_MODULES(BZIP2, bzip2)
11680         FilterLibs "${BZIP2_LIBS}"
11681         BZIP2_LIBS="${filteredlibs}"
11682     else
11683         AC_MSG_RESULT([no])
11684         BUILD_TYPE="$BUILD_TYPE BZIP2"
11685     fi
11687 AC_SUBST(SYSTEM_BZIP2)
11688 AC_SUBST(BZIP2_CFLAGS)
11689 AC_SUBST(BZIP2_LIBS)
11691 dnl ===================================================================
11692 dnl Test whether to enable extension update
11693 dnl ===================================================================
11694 AC_MSG_CHECKING([whether to enable extension update])
11695 ENABLE_EXTENSION_UPDATE=
11696 if test "x$enable_extension_update" = "xno"; then
11697     AC_MSG_RESULT([no])
11698 else
11699     AC_MSG_RESULT([yes])
11700     ENABLE_EXTENSION_UPDATE="TRUE"
11701     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11702     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11704 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11707 dnl ===================================================================
11708 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11709 dnl ===================================================================
11710 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11711 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11712     AC_MSG_RESULT([no])
11713     ENABLE_SILENT_MSI=
11714 else
11715     AC_MSG_RESULT([yes])
11716     ENABLE_SILENT_MSI=TRUE
11717     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11719 AC_SUBST(ENABLE_SILENT_MSI)
11721 AC_MSG_CHECKING([whether and how to use Xinerama])
11722 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11723     if test "$x_libraries" = "default_x_libraries"; then
11724         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11725         if test "x$XINERAMALIB" = x; then
11726            XINERAMALIB="/usr/lib"
11727         fi
11728     else
11729         XINERAMALIB="$x_libraries"
11730     fi
11731     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11732         # we have both versions, let the user decide but use the dynamic one
11733         # per default
11734         USE_XINERAMA=TRUE
11735         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11736             XINERAMA_LINK=dynamic
11737         else
11738             XINERAMA_LINK=static
11739         fi
11740     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11741         # we have only the dynamic version
11742         USE_XINERAMA=TRUE
11743         XINERAMA_LINK=dynamic
11744     elif test -e "$XINERAMALIB/libXinerama.a"; then
11745         # static version
11746         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11747             USE_XINERAMA=TRUE
11748             XINERAMA_LINK=static
11749         else
11750             USE_XINERAMA=
11751             XINERAMA_LINK=none
11752         fi
11753     else
11754         # no Xinerama
11755         USE_XINERAMA=
11756         XINERAMA_LINK=none
11757     fi
11758     if test "$USE_XINERAMA" = "TRUE"; then
11759         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11760         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11761             [AC_MSG_ERROR(Xinerama header not found.)], [])
11762         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11763         if test "x$XEXTLIB" = x; then
11764            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11765         fi
11766         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11767         if test "$_os" = "FreeBSD"; then
11768             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11769         fi
11770         if test "$_os" = "Linux"; then
11771             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11772         fi
11773         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11774             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11775     else
11776         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11777     fi
11778 else
11779     USE_XINERAMA=
11780     XINERAMA_LINK=none
11781     AC_MSG_RESULT([no])
11783 AC_SUBST(USE_XINERAMA)
11784 AC_SUBST(XINERAMA_LINK)
11786 dnl ===================================================================
11787 dnl Test whether to build cairo or rely on the system version
11788 dnl ===================================================================
11790 if test "$USING_X11" = TRUE; then
11791     # Used in vcl/Library_vclplug_gen.mk
11792     test_cairo=yes
11795 if test "$test_cairo" = "yes"; then
11796     AC_MSG_CHECKING([whether to use the system cairo])
11798     : ${with_system_cairo:=$with_system_libs}
11799     if test "$with_system_cairo" = "yes"; then
11800         SYSTEM_CAIRO=TRUE
11801         AC_MSG_RESULT([yes])
11803         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11804         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11805         FilterLibs "${CAIRO_LIBS}"
11806         CAIRO_LIBS="${filteredlibs}"
11808         if test "$test_xrender" = "yes"; then
11809             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11810             AC_LANG_PUSH([C])
11811             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11812 #ifdef PictStandardA8
11813 #else
11814       return fail;
11815 #endif
11816 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11818             AC_LANG_POP([C])
11819         fi
11820     else
11821         SYSTEM_CAIRO=
11822         AC_MSG_RESULT([no])
11824         BUILD_TYPE="$BUILD_TYPE CAIRO"
11825     fi
11828 AC_SUBST(SYSTEM_CAIRO)
11829 AC_SUBST(CAIRO_CFLAGS)
11830 AC_SUBST(CAIRO_LIBS)
11832 dnl ===================================================================
11833 dnl Test whether to use avahi
11834 dnl ===================================================================
11835 if test "$_os" = "WINNT"; then
11836     # Windows uses bundled mDNSResponder
11837     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11838 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11839     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11840                       [ENABLE_AVAHI="TRUE"])
11841     AC_DEFINE(HAVE_FEATURE_AVAHI)
11842     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11843     FilterLibs "${AVAHI_LIBS}"
11844     AVAHI_LIBS="${filteredlibs}"
11847 AC_SUBST(ENABLE_AVAHI)
11848 AC_SUBST(AVAHI_CFLAGS)
11849 AC_SUBST(AVAHI_LIBS)
11851 dnl ===================================================================
11852 dnl Test whether to use liblangtag
11853 dnl ===================================================================
11854 SYSTEM_LIBLANGTAG=
11855 AC_MSG_CHECKING([whether to use system liblangtag])
11856 if test "$with_system_liblangtag" = yes; then
11857     SYSTEM_LIBLANGTAG=TRUE
11858     AC_MSG_RESULT([yes])
11859     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11860     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11861     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11862     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11863     FilterLibs "${LIBLANGTAG_LIBS}"
11864     LIBLANGTAG_LIBS="${filteredlibs}"
11865 else
11866     SYSTEM_LIBLANGTAG=
11867     AC_MSG_RESULT([no])
11868     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11869     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11870     if test "$COM" = "MSC"; then
11871         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11872     else
11873         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11874     fi
11876 AC_SUBST(SYSTEM_LIBLANGTAG)
11877 AC_SUBST(LIBLANGTAG_CFLAGS)
11878 AC_SUBST(LIBLANGTAG_LIBS)
11880 dnl ===================================================================
11881 dnl Test whether to build libpng or rely on the system version
11882 dnl ===================================================================
11884 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11886 dnl ===================================================================
11887 dnl Check for runtime JVM search path
11888 dnl ===================================================================
11889 if test "$ENABLE_JAVA" != ""; then
11890     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11891     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11892         AC_MSG_RESULT([yes])
11893         if ! test -d "$with_jvm_path"; then
11894             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11895         fi
11896         if ! test -d "$with_jvm_path"jvm; then
11897             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11898         fi
11899         JVM_ONE_PATH_CHECK="$with_jvm_path"
11900         AC_SUBST(JVM_ONE_PATH_CHECK)
11901     else
11902         AC_MSG_RESULT([no])
11903     fi
11906 dnl ===================================================================
11907 dnl Test for the presence of Ant and that it works
11908 dnl ===================================================================
11910 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11911     ANT_HOME=; export ANT_HOME
11912     WITH_ANT_HOME=; export WITH_ANT_HOME
11913     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11914         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11915             if test "$_os" = "WINNT"; then
11916                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11917             else
11918                 with_ant_home="$LODE_HOME/opt/ant"
11919             fi
11920         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11921             with_ant_home="$LODE_HOME/opt/ant"
11922         fi
11923     fi
11924     if test -z "$with_ant_home"; then
11925         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11926     else
11927         if test "$_os" = "WINNT"; then
11928             # AC_PATH_PROGS needs unix path
11929             with_ant_home=`cygpath -u "$with_ant_home"`
11930         fi
11931         AbsolutePath "$with_ant_home"
11932         with_ant_home=$absolute_path
11933         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11934         WITH_ANT_HOME=$with_ant_home
11935         ANT_HOME=$with_ant_home
11936     fi
11938     if test -z "$ANT"; then
11939         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11940     else
11941         # resolve relative or absolute symlink
11942         while test -h "$ANT"; do
11943             a_cwd=`pwd`
11944             a_basename=`basename "$ANT"`
11945             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11946             cd "`dirname "$ANT"`"
11947             cd "`dirname "$a_script"`"
11948             ANT="`pwd`"/"`basename "$a_script"`"
11949             cd "$a_cwd"
11950         done
11952         AC_MSG_CHECKING([if $ANT works])
11953         mkdir -p conftest.dir
11954         a_cwd=$(pwd)
11955         cd conftest.dir
11956         cat > conftest.java << EOF
11957         public class conftest {
11958             int testmethod(int a, int b) {
11959                     return a + b;
11960             }
11961         }
11964         cat > conftest.xml << EOF
11965         <project name="conftest" default="conftest">
11966         <target name="conftest">
11967             <javac srcdir="." includes="conftest.java">
11968             </javac>
11969         </target>
11970         </project>
11973         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11974         if test $? = 0 -a -f ./conftest.class; then
11975             AC_MSG_RESULT([Ant works])
11976             if test -z "$WITH_ANT_HOME"; then
11977                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11978                 if test -z "$ANT_HOME"; then
11979                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11980                 fi
11981             else
11982                 ANT_HOME="$WITH_ANT_HOME"
11983             fi
11984         else
11985             echo "configure: Ant test failed" >&5
11986             cat conftest.java >&5
11987             cat conftest.xml >&5
11988             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11989         fi
11990         cd "$a_cwd"
11991         rm -fr conftest.dir
11992     fi
11993     if test -z "$ANT_HOME"; then
11994         ANT_HOME="NO_ANT_HOME"
11995     else
11996         PathFormat "$ANT_HOME"
11997         ANT_HOME="$formatted_path"
11998         PathFormat "$ANT"
11999         ANT="$formatted_path"
12000     fi
12001     AC_SUBST(ANT_HOME)
12002     AC_SUBST(ANT)
12004     dnl Checking for ant.jar
12005     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12006         AC_MSG_CHECKING([Ant lib directory])
12007         if test -f $ANT_HOME/lib/ant.jar; then
12008             ANT_LIB="$ANT_HOME/lib"
12009         else
12010             if test -f $ANT_HOME/ant.jar; then
12011                 ANT_LIB="$ANT_HOME"
12012             else
12013                 if test -f /usr/share/java/ant.jar; then
12014                     ANT_LIB=/usr/share/java
12015                 else
12016                     if test -f /usr/share/ant-core/lib/ant.jar; then
12017                         ANT_LIB=/usr/share/ant-core/lib
12018                     else
12019                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12020                             ANT_LIB="$ANT_HOME/lib/ant"
12021                         else
12022                             if test -f /usr/share/lib/ant/ant.jar; then
12023                                 ANT_LIB=/usr/share/lib/ant
12024                             else
12025                                 AC_MSG_ERROR([Ant libraries not found!])
12026                             fi
12027                         fi
12028                     fi
12029                 fi
12030             fi
12031         fi
12032         PathFormat "$ANT_LIB"
12033         ANT_LIB="$formatted_path"
12034         AC_MSG_RESULT([Ant lib directory found.])
12035     fi
12036     AC_SUBST(ANT_LIB)
12038     ant_minver=1.6.0
12039     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12041     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12042     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12043     ant_version_major=`echo $ant_version | cut -d. -f1`
12044     ant_version_minor=`echo $ant_version | cut -d. -f2`
12045     echo "configure: ant_version $ant_version " >&5
12046     echo "configure: ant_version_major $ant_version_major " >&5
12047     echo "configure: ant_version_minor $ant_version_minor " >&5
12048     if test "$ant_version_major" -ge "2"; then
12049         AC_MSG_RESULT([yes, $ant_version])
12050     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12051         AC_MSG_RESULT([yes, $ant_version])
12052     else
12053         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12054     fi
12056     rm -f conftest* core core.* *.core
12059 OOO_JUNIT_JAR=
12060 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12061     AC_MSG_CHECKING([for JUnit 4])
12062     if test "$with_junit" = "yes"; then
12063         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12064             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12065         elif test -e /usr/share/java/junit4.jar; then
12066             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12067         else
12068            if test -e /usr/share/lib/java/junit.jar; then
12069               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12070            else
12071               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12072            fi
12073         fi
12074     else
12075         OOO_JUNIT_JAR=$with_junit
12076     fi
12077     if test "$_os" = "WINNT"; then
12078         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12079     fi
12080     printf 'import org.junit.Before;' > conftest.java
12081     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12082         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12083     else
12084         AC_MSG_ERROR(
12085 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12086  specify its pathname via --with-junit=..., or disable it via --without-junit])
12087     fi
12088     rm -f conftest.class conftest.java
12089     if test $OOO_JUNIT_JAR != ""; then
12090     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12091     fi
12093 AC_SUBST(OOO_JUNIT_JAR)
12095 HAMCREST_JAR=
12096 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12097     AC_MSG_CHECKING([for included Hamcrest])
12098     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12099     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12100         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12101     else
12102         AC_MSG_RESULT([Not included])
12103         AC_MSG_CHECKING([for standalone hamcrest jar.])
12104         if test "$with_hamcrest" = "yes"; then
12105             if test -e /usr/share/lib/java/hamcrest.jar; then
12106                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12107             elif test -e /usr/share/java/hamcrest/core.jar; then
12108                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12109             else
12110                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12111             fi
12112         else
12113             HAMCREST_JAR=$with_hamcrest
12114         fi
12115         if test "$_os" = "WINNT"; then
12116             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12117         fi
12118         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12119             AC_MSG_RESULT([$HAMCREST_JAR])
12120         else
12121             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),
12122                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12123         fi
12124     fi
12125     rm -f conftest.class conftest.java
12127 AC_SUBST(HAMCREST_JAR)
12130 AC_SUBST(SCPDEFS)
12133 # check for wget and curl
12135 WGET=
12136 CURL=
12138 if test "$enable_fetch_external" != "no"; then
12140 CURL=`which curl 2>/dev/null`
12142 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12143     # wget new enough?
12144     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12145     if test $? -eq 0; then
12146         WGET=$i
12147         break
12148     fi
12149 done
12151 if test -z "$WGET" -a -z "$CURL"; then
12152     AC_MSG_ERROR([neither wget nor curl found!])
12157 AC_SUBST(WGET)
12158 AC_SUBST(CURL)
12161 # check for sha256sum
12163 SHA256SUM=
12165 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12166     eval "$i -a 256 --version" > /dev/null 2>&1
12167     ret=$?
12168     if test $ret -eq 0; then
12169         SHA256SUM="$i -a 256"
12170         break
12171     fi
12172 done
12174 if test -z "$SHA256SUM"; then
12175     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12176         eval "$i --version" > /dev/null 2>&1
12177         ret=$?
12178         if test $ret -eq 0; then
12179             SHA256SUM=$i
12180             break
12181         fi
12182     done
12185 if test -z "$SHA256SUM"; then
12186     AC_MSG_ERROR([no sha256sum found!])
12189 AC_SUBST(SHA256SUM)
12191 dnl ===================================================================
12192 dnl Dealing with l10n options
12193 dnl ===================================================================
12194 AC_MSG_CHECKING([which languages to be built])
12195 # get list of all languages
12196 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12197 # the sed command does the following:
12198 #   + if a line ends with a backslash, append the next line to it
12199 #   + adds " on the beginning of the value (after =)
12200 #   + adds " at the end of the value
12201 #   + removes en-US; we want to put it on the beginning
12202 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12203 [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)]
12204 ALL_LANGS="en-US $completelangiso"
12205 # check the configured localizations
12206 WITH_LANG="$with_lang"
12208 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12209 # (Norwegian is "nb" and "nn".)
12210 if test "$WITH_LANG" = "no"; then
12211     WITH_LANG=
12214 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12215     AC_MSG_RESULT([en-US])
12216 else
12217     AC_MSG_RESULT([$WITH_LANG])
12218     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12219     if test -z "$MSGFMT"; then
12220         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12221             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12222         elif test -x "/opt/lo/bin/msgfmt"; then
12223             MSGFMT="/opt/lo/bin/msgfmt"
12224         else
12225             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12226             if test -z "$MSGFMT"; then
12227                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12228             fi
12229         fi
12230     fi
12231     if test -z "$MSGUNIQ"; then
12232         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12233             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12234         elif test -x "/opt/lo/bin/msguniq"; then
12235             MSGUNIQ="/opt/lo/bin/msguniq"
12236         else
12237             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12238             if test -z "$MSGUNIQ"; then
12239                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12240             fi
12241         fi
12242     fi
12244 AC_SUBST(MSGFMT)
12245 AC_SUBST(MSGUNIQ)
12246 # check that the list is valid
12247 for lang in $WITH_LANG; do
12248     test "$lang" = "ALL" && continue
12249     # need to check for the exact string, so add space before and after the list of all languages
12250     for vl in $ALL_LANGS; do
12251         if test "$vl" = "$lang"; then
12252            break
12253         fi
12254     done
12255     if test "$vl" != "$lang"; then
12256         # if you're reading this - you prolly quoted your languages remove the quotes ...
12257         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12258     fi
12259 done
12260 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12261     echo $WITH_LANG | grep -q en-US
12262     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12264 # list with substituted ALL
12265 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12266 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12267 test "$WITH_LANG" = "en-US" && WITH_LANG=
12268 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12269     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12270     ALL_LANGS=`echo $ALL_LANGS qtz`
12272 AC_SUBST(ALL_LANGS)
12273 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12274 AC_SUBST(WITH_LANG)
12275 AC_SUBST(WITH_LANG_LIST)
12276 AC_SUBST(GIT_NEEDED_SUBMODULES)
12278 WITH_POOR_HELP_LOCALIZATIONS=
12279 if test -d "$SRC_ROOT/translations/source"; then
12280     for l in `ls -1 $SRC_ROOT/translations/source`; do
12281         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12282             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12283         fi
12284     done
12286 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12288 if test -n "$with_locales"; then
12289     WITH_LOCALES="$with_locales"
12291     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12292     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12293     # config_host/config_locales.h.in
12294     for locale in $WITH_LOCALES; do
12295         lang=${locale%_*}
12297         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12299         case $lang in
12300         hi|mr*ne)
12301             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12302             ;;
12303         bg|ru)
12304             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12305             ;;
12306         esac
12307     done
12308 else
12309     AC_DEFINE(WITH_LOCALE_ALL)
12311 AC_SUBST(WITH_LOCALES)
12313 dnl git submodule update --reference
12314 dnl ===================================================================
12315 if test -n "${GIT_REFERENCE_SRC}"; then
12316     for repo in ${GIT_NEEDED_SUBMODULES}; do
12317         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12318             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12319         fi
12320     done
12322 AC_SUBST(GIT_REFERENCE_SRC)
12324 dnl git submodules linked dirs
12325 dnl ===================================================================
12326 if test -n "${GIT_LINK_SRC}"; then
12327     for repo in ${GIT_NEEDED_SUBMODULES}; do
12328         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12329             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12330         fi
12331     done
12333 AC_SUBST(GIT_LINK_SRC)
12335 dnl branding
12336 dnl ===================================================================
12337 AC_MSG_CHECKING([for alternative branding images directory])
12338 # initialize mapped arrays
12339 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12340 brand_files="$BRAND_INTRO_IMAGES about.svg"
12342 if test -z "$with_branding" -o "$with_branding" = "no"; then
12343     AC_MSG_RESULT([none])
12344     DEFAULT_BRAND_IMAGES="$brand_files"
12345 else
12346     if ! test -d $with_branding ; then
12347         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12348     else
12349         AC_MSG_RESULT([$with_branding])
12350         CUSTOM_BRAND_DIR="$with_branding"
12351         for lfile in $brand_files
12352         do
12353             if ! test -f $with_branding/$lfile ; then
12354                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12355                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12356             else
12357                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12358             fi
12359         done
12360         check_for_progress="yes"
12361     fi
12363 AC_SUBST([BRAND_INTRO_IMAGES])
12364 AC_SUBST([CUSTOM_BRAND_DIR])
12365 AC_SUBST([CUSTOM_BRAND_IMAGES])
12366 AC_SUBST([DEFAULT_BRAND_IMAGES])
12369 AC_MSG_CHECKING([for 'intro' progress settings])
12370 PROGRESSBARCOLOR=
12371 PROGRESSSIZE=
12372 PROGRESSPOSITION=
12373 PROGRESSFRAMECOLOR=
12374 PROGRESSTEXTCOLOR=
12375 PROGRESSTEXTBASELINE=
12377 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12378     source "$with_branding/progress.conf"
12379     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12380 else
12381     AC_MSG_RESULT([none])
12384 AC_SUBST(PROGRESSBARCOLOR)
12385 AC_SUBST(PROGRESSSIZE)
12386 AC_SUBST(PROGRESSPOSITION)
12387 AC_SUBST(PROGRESSFRAMECOLOR)
12388 AC_SUBST(PROGRESSTEXTCOLOR)
12389 AC_SUBST(PROGRESSTEXTBASELINE)
12392 AC_MSG_CHECKING([for extra build ID])
12393 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12394     EXTRA_BUILDID="$with_extra_buildid"
12396 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12397 if test -n "$EXTRA_BUILDID" ; then
12398     AC_MSG_RESULT([$EXTRA_BUILDID])
12399 else
12400     AC_MSG_RESULT([not set])
12402 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12404 OOO_VENDOR=
12405 AC_MSG_CHECKING([for vendor])
12406 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12407     OOO_VENDOR="$USERNAME"
12409     if test -z "$OOO_VENDOR"; then
12410         OOO_VENDOR="$USER"
12411     fi
12413     if test -z "$OOO_VENDOR"; then
12414         OOO_VENDOR="`id -u -n`"
12415     fi
12417     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12418 else
12419     OOO_VENDOR="$with_vendor"
12420     AC_MSG_RESULT([$OOO_VENDOR])
12422 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12423 AC_SUBST(OOO_VENDOR)
12425 if test "$_os" = "Android" ; then
12426     ANDROID_PACKAGE_NAME=
12427     AC_MSG_CHECKING([for Android package name])
12428     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12429         if test -n "$ENABLE_DEBUG"; then
12430             # Default to the package name that makes ndk-gdb happy.
12431             ANDROID_PACKAGE_NAME="org.libreoffice"
12432         else
12433             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12434         fi
12436         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12437     else
12438         ANDROID_PACKAGE_NAME="$with_android_package_name"
12439         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12440     fi
12441     AC_SUBST(ANDROID_PACKAGE_NAME)
12444 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12445 if test "$with_compat_oowrappers" = "yes"; then
12446     WITH_COMPAT_OOWRAPPERS=TRUE
12447     AC_MSG_RESULT(yes)
12448 else
12449     WITH_COMPAT_OOWRAPPERS=
12450     AC_MSG_RESULT(no)
12452 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12454 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12455 AC_MSG_CHECKING([for install dirname])
12456 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12457     INSTALLDIRNAME="$with_install_dirname"
12459 AC_MSG_RESULT([$INSTALLDIRNAME])
12460 AC_SUBST(INSTALLDIRNAME)
12462 AC_MSG_CHECKING([for prefix])
12463 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12464 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12465 PREFIXDIR="$prefix"
12466 AC_MSG_RESULT([$PREFIXDIR])
12467 AC_SUBST(PREFIXDIR)
12469 LIBDIR=[$(eval echo $(eval echo $libdir))]
12470 AC_SUBST(LIBDIR)
12472 DATADIR=[$(eval echo $(eval echo $datadir))]
12473 AC_SUBST(DATADIR)
12475 MANDIR=[$(eval echo $(eval echo $mandir))]
12476 AC_SUBST(MANDIR)
12478 DOCDIR=[$(eval echo $(eval echo $docdir))]
12479 AC_SUBST(DOCDIR)
12481 BINDIR=[$(eval echo $(eval echo $bindir))]
12482 AC_SUBST(BINDIR)
12484 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12485 AC_SUBST(INSTALLDIR)
12487 TESTINSTALLDIR="${BUILDDIR}/test-install"
12488 AC_SUBST(TESTINSTALLDIR)
12491 # ===================================================================
12492 # OAuth2 id and secrets
12493 # ===================================================================
12495 AC_MSG_CHECKING([for Google Drive client id and secret])
12496 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12497     AC_MSG_RESULT([not set])
12498     GDRIVE_CLIENT_ID="\"\""
12499     GDRIVE_CLIENT_SECRET="\"\""
12500 else
12501     AC_MSG_RESULT([set])
12502     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12503     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12505 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12506 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12508 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12509 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12510     AC_MSG_RESULT([not set])
12511     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12512     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12513 else
12514     AC_MSG_RESULT([set])
12515     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12516     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12518 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12519 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12521 AC_MSG_CHECKING([for OneDrive client id and secret])
12522 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12523     AC_MSG_RESULT([not set])
12524     ONEDRIVE_CLIENT_ID="\"\""
12525     ONEDRIVE_CLIENT_SECRET="\"\""
12526 else
12527     AC_MSG_RESULT([set])
12528     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12529     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12531 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12532 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12535 dnl ===================================================================
12536 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12537 dnl --enable-dependency-tracking configure option
12538 dnl ===================================================================
12539 AC_MSG_CHECKING([whether to enable dependency tracking])
12540 if test "$enable_dependency_tracking" = "no"; then
12541     nodep=TRUE
12542     AC_MSG_RESULT([no])
12543 else
12544     AC_MSG_RESULT([yes])
12546 AC_SUBST(nodep)
12548 dnl ===================================================================
12549 dnl Number of CPUs to use during the build
12550 dnl ===================================================================
12551 AC_MSG_CHECKING([for number of processors to use])
12552 # plain --with-parallelism is just the default
12553 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12554     if test "$with_parallelism" = "no"; then
12555         PARALLELISM=0
12556     else
12557         PARALLELISM=$with_parallelism
12558     fi
12559 else
12560     if test "$enable_icecream" = "yes"; then
12561         PARALLELISM="40"
12562     else
12563         case `uname -s` in
12565         Darwin|FreeBSD|NetBSD|OpenBSD)
12566             PARALLELISM=`sysctl -n hw.ncpu`
12567             ;;
12569         Linux)
12570             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12571         ;;
12572         # what else than above does profit here *and* has /proc?
12573         *)
12574             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12575             ;;
12576         esac
12578         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12579         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12580     fi
12583 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12584     if test -z "$with_parallelism"; then
12585             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12586             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12587             PARALLELISM="1"
12588     else
12589         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."
12590     fi
12593 if test $PARALLELISM -eq 0; then
12594     AC_MSG_RESULT([explicit make -j option needed])
12595 else
12596     AC_MSG_RESULT([$PARALLELISM])
12598 AC_SUBST(PARALLELISM)
12600 IWYU_PATH="$with_iwyu"
12601 AC_SUBST(IWYU_PATH)
12602 if test ! -z "$IWYU_PATH"; then
12603     if test ! -f "$IWYU_PATH"; then
12604         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12605     fi
12609 # Set up ILIB for MSVC build
12611 ILIB1=
12612 if test "$build_os" = "cygwin"; then
12613     ILIB="."
12614     if test -n "$JAVA_HOME"; then
12615         ILIB="$ILIB;$JAVA_HOME/lib"
12616     fi
12617     ILIB1=-link
12618     if test "$BITNESS_OVERRIDE" = 64; then
12619         ILIB="$ILIB;$COMPATH/lib/x64"
12620         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12621         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12622         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12623         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12624             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12625             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12626         fi
12627         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12628         ucrtlibpath_formatted=$formatted_path
12629         ILIB="$ILIB;$ucrtlibpath_formatted"
12630         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12631     else
12632         ILIB="$ILIB;$COMPATH/lib/x86"
12633         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12634         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12635         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12636         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12637             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12638             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12639         fi
12640         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12641         ucrtlibpath_formatted=$formatted_path
12642         ILIB="$ILIB;$ucrtlibpath_formatted"
12643         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12644     fi
12645     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12646         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12647     else
12648         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12649     fi
12651     AC_SUBST(ILIB)
12654 # ===================================================================
12655 # Creating bigger shared library to link against
12656 # ===================================================================
12657 AC_MSG_CHECKING([whether to create huge library])
12658 MERGELIBS=
12660 if test $_os = iOS -o $_os = Android; then
12661     # Never any point in mergelibs for these as we build just static
12662     # libraries anyway...
12663     enable_mergelibs=no
12666 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12667     if test $_os != Linux -a $_os != WINNT; then
12668         add_warning "--enable-mergelibs is not tested for this platform"
12669     fi
12670     MERGELIBS="TRUE"
12671     AC_MSG_RESULT([yes])
12672 else
12673     AC_MSG_RESULT([no])
12675 AC_SUBST([MERGELIBS])
12677 dnl ===================================================================
12678 dnl icerun is a wrapper that stops us spawning tens of processes
12679 dnl locally - for tools that can't be executed on the compile cluster
12680 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12681 dnl ===================================================================
12682 AC_MSG_CHECKING([whether to use icerun wrapper])
12683 ICECREAM_RUN=
12684 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12685     ICECREAM_RUN=icerun
12686     AC_MSG_RESULT([yes])
12687 else
12688     AC_MSG_RESULT([no])
12690 AC_SUBST(ICECREAM_RUN)
12692 dnl ===================================================================
12693 dnl Setup the ICECC_VERSION for the build the same way it was set for
12694 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12695 dnl ===================================================================
12696 x_ICECC_VERSION=[\#]
12697 if test -n "$ICECC_VERSION" ; then
12698     x_ICECC_VERSION=
12700 AC_SUBST(x_ICECC_VERSION)
12701 AC_SUBST(ICECC_VERSION)
12703 dnl ===================================================================
12705 AC_MSG_CHECKING([MPL subset])
12706 MPL_SUBSET=
12708 if test "$enable_mpl_subset" = "yes"; then
12709     warn_report=false
12710     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12711         warn_report=true
12712     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12713         warn_report=true
12714     fi
12715     if test "$warn_report" = "true"; then
12716         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12717     fi
12718     if test "x$enable_postgresql_sdbc" != "xno"; then
12719         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12720     fi
12721     if test "$enable_lotuswordpro" = "yes"; then
12722         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12723     fi
12724     if test "$WITH_WEBDAV" = "neon"; then
12725         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12726     fi
12727     if test -n "$ENABLE_POPPLER"; then
12728         if test "x$SYSTEM_POPPLER" = "x"; then
12729             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12730         fi
12731     fi
12732     # cf. m4/libo_check_extension.m4
12733     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12734         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12735     fi
12736     for theme in $WITH_THEMES; do
12737         case $theme in
12738         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12739             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12740         *) : ;;
12741         esac
12742     done
12744     ENABLE_OPENGL_TRANSITIONS=
12746     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12747         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12748     fi
12750     MPL_SUBSET="TRUE"
12751     AC_DEFINE(MPL_HAVE_SUBSET)
12752     AC_MSG_RESULT([only])
12753 else
12754     AC_MSG_RESULT([no restrictions])
12756 AC_SUBST(MPL_SUBSET)
12758 dnl ===================================================================
12760 AC_MSG_CHECKING([formula logger])
12761 ENABLE_FORMULA_LOGGER=
12763 if test "x$enable_formula_logger" = "xyes"; then
12764     AC_MSG_RESULT([yes])
12765     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12766     ENABLE_FORMULA_LOGGER=TRUE
12767 elif test -n "$ENABLE_DBGUTIL" ; then
12768     AC_MSG_RESULT([yes])
12769     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12770     ENABLE_FORMULA_LOGGER=TRUE
12771 else
12772     AC_MSG_RESULT([no])
12775 AC_SUBST(ENABLE_FORMULA_LOGGER)
12777 dnl ===================================================================
12778 dnl Setting up the environment.
12779 dnl ===================================================================
12780 AC_MSG_NOTICE([setting up the build environment variables...])
12782 AC_SUBST(COMPATH)
12784 if test "$build_os" = "cygwin"; then
12785     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12786         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12787         ATL_INCLUDE="$COMPATH/atlmfc/include"
12788     elif test -d "$COMPATH/atlmfc/lib"; then
12789         ATL_LIB="$COMPATH/atlmfc/lib"
12790         ATL_INCLUDE="$COMPATH/atlmfc/include"
12791     else
12792         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12793         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12794     fi
12795     if test "$BITNESS_OVERRIDE" = 64; then
12796         ATL_LIB="$ATL_LIB/x64"
12797     else
12798         ATL_LIB="$ATL_LIB/x86"
12799     fi
12800     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12801     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12803     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12804     PathFormat "/usr/bin/find.exe"
12805     FIND="$formatted_path"
12806     PathFormat "/usr/bin/sort.exe"
12807     SORT="$formatted_path"
12808     PathFormat "/usr/bin/grep.exe"
12809     WIN_GREP="$formatted_path"
12810     PathFormat "/usr/bin/ls.exe"
12811     WIN_LS="$formatted_path"
12812     PathFormat "/usr/bin/touch.exe"
12813     WIN_TOUCH="$formatted_path"
12814 else
12815     FIND=find
12816     SORT=sort
12819 AC_SUBST(ATL_INCLUDE)
12820 AC_SUBST(ATL_LIB)
12821 AC_SUBST(FIND)
12822 AC_SUBST(SORT)
12823 AC_SUBST(WIN_GREP)
12824 AC_SUBST(WIN_LS)
12825 AC_SUBST(WIN_TOUCH)
12827 AC_SUBST(BUILD_TYPE)
12829 AC_SUBST(SOLARINC)
12831 PathFormat "$PERL"
12832 PERL="$formatted_path"
12833 AC_SUBST(PERL)
12835 if test -n "$TMPDIR"; then
12836     TEMP_DIRECTORY="$TMPDIR"
12837 else
12838     TEMP_DIRECTORY="/tmp"
12840 if test "$build_os" = "cygwin"; then
12841     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12843 AC_SUBST(TEMP_DIRECTORY)
12845 # setup the PATH for the environment
12846 if test -n "$LO_PATH_FOR_BUILD"; then
12847     LO_PATH="$LO_PATH_FOR_BUILD"
12848 else
12849     LO_PATH="$PATH"
12851     case "$host_os" in
12853     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12854         if test "$ENABLE_JAVA" != ""; then
12855             pathmunge "$JAVA_HOME/bin" "after"
12856         fi
12857         ;;
12859     cygwin*)
12860         # Win32 make needs native paths
12861         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12862             LO_PATH=`cygpath -p -m "$PATH"`
12863         fi
12864         if test "$BITNESS_OVERRIDE" = 64; then
12865             # needed for msi packaging
12866             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12867         fi
12868         # .NET 4.6 and higher don't have bin directory
12869         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12870             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12871         fi
12872         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12873         pathmunge "$CSC_PATH" "before"
12874         pathmunge "$MIDL_PATH" "before"
12875         pathmunge "$AL_PATH" "before"
12876         pathmunge "$MSPDB_PATH" "before"
12877         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12878             pathmunge "$CL_PATH" "before"
12879         fi
12880         if test -n "$MSBUILD_PATH" ; then
12881             pathmunge "$MSBUILD_PATH" "before"
12882         fi
12883         if test "$BITNESS_OVERRIDE" = 64; then
12884             pathmunge "$COMPATH/bin/amd64" "before"
12885             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12886         else
12887             pathmunge "$COMPATH/bin" "before"
12888             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12889         fi
12890         if test "$ENABLE_JAVA" != ""; then
12891             if test -d "$JAVA_HOME/jre/bin/client"; then
12892                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12893             fi
12894             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12895                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12896             fi
12897             pathmunge "$JAVA_HOME/bin" "before"
12898         fi
12899         ;;
12901     solaris*)
12902         pathmunge "/usr/css/bin" "before"
12903         if test "$ENABLE_JAVA" != ""; then
12904             pathmunge "$JAVA_HOME/bin" "after"
12905         fi
12906         ;;
12907     esac
12910 AC_SUBST(LO_PATH)
12912 libo_FUZZ_SUMMARY
12914 # Generate a configuration sha256 we can use for deps
12915 if test -f config_host.mk; then
12916     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12918 if test -f config_host_lang.mk; then
12919     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12922 CFLAGS=$my_original_CFLAGS
12923 CXXFLAGS=$my_original_CXXFLAGS
12924 CPPFLAGS=$my_original_CPPFLAGS
12926 AC_CONFIG_FILES([config_host.mk
12927                  config_host_lang.mk
12928                  Makefile
12929                  bin/bffvalidator.sh
12930                  bin/odfvalidator.sh
12931                  bin/officeotron.sh
12932                  instsetoo_native/util/openoffice.lst
12933                  sysui/desktop/macosx/Info.plist])
12934 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12935 AC_CONFIG_HEADERS([config_host/config_clang.h])
12936 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12937 AC_CONFIG_HEADERS([config_host/config_eot.h])
12938 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12939 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12940 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12941 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12942 AC_CONFIG_HEADERS([config_host/config_features.h])
12943 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
12944 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
12945 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12946 AC_CONFIG_HEADERS([config_host/config_folders.h])
12947 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12948 AC_CONFIG_HEADERS([config_host/config_gio.h])
12949 AC_CONFIG_HEADERS([config_host/config_global.h])
12950 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12951 AC_CONFIG_HEADERS([config_host/config_java.h])
12952 AC_CONFIG_HEADERS([config_host/config_langs.h])
12953 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12954 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12955 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12956 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12957 AC_CONFIG_HEADERS([config_host/config_locales.h])
12958 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12959 AC_CONFIG_HEADERS([config_host/config_oox.h])
12960 AC_CONFIG_HEADERS([config_host/config_options.h])
12961 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12962 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12963 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12964 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12965 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12966 AC_CONFIG_HEADERS([config_host/config_version.h])
12967 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12968 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12969 AC_CONFIG_HEADERS([config_host/config_python.h])
12970 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12971 AC_OUTPUT
12973 if test "$CROSS_COMPILING" = TRUE; then
12974     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12977 # touch the config timestamp file
12978 if test ! -f config_host.mk.stamp; then
12979     echo > config_host.mk.stamp
12980 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12981     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12982 else
12983     echo > config_host.mk.stamp
12986 # touch the config lang timestamp file
12987 if test ! -f config_host_lang.mk.stamp; then
12988     echo > config_host_lang.mk.stamp
12989 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12990     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12991 else
12992     echo > config_host_lang.mk.stamp
12996 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12997         -a "$build_os" = "cygwin"; then
12999 cat << _EOS
13000 ****************************************************************************
13001 WARNING:
13002 Your make version is known to be horribly slow, and hard to debug
13003 problems with. To get a reasonably functional make please do:
13005 to install a pre-compiled binary make for Win32
13007  mkdir -p /opt/lo/bin
13008  cd /opt/lo/bin
13009  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13010  cp make-4.2.1-msvc.exe make
13011  chmod +x make
13013 to install from source:
13014 place yourself in a working directory of you choice.
13016  git clone git://git.savannah.gnu.org/make.git
13018  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13019  set PATH=%PATH%;C:\Cygwin\bin
13020  [or Cygwin64, if that is what you have]
13021  cd path-to-make-repo-you-cloned-above
13022  build_w32.bat --without-guile
13024 should result in a WinRel/gnumake.exe.
13025 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13027 Then re-run autogen.sh
13029 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13030 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13032 _EOS
13033 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13034     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13039 cat << _EOF
13040 ****************************************************************************
13042 To build, run:
13043 $GNUMAKE
13045 To view some help, run:
13046 $GNUMAKE help
13048 _EOF
13050 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13051     cat << _EOF
13052 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13053 _EOF
13055     if test $_os = Darwin; then
13056         echo open instdir/$PRODUCTNAME.app
13057     else
13058         echo instdir/program/soffice
13059     fi
13060     cat << _EOF
13062 If you want to run the smoketest, run:
13063 $GNUMAKE check
13065 _EOF
13068 if test -f warn; then
13069     cat warn
13070     rm warn
13073 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: