Bump version to 6.4-11
[LibreOffice.git] / configure.ac
blob66b2d930a3ac4cc4408c65a0b8e7932861952f72
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.11],[],[],[https://collaboraoffice.com/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
188     PRODUCTNAME=AC_PACKAGE_NAME
190 AC_MSG_RESULT([$PRODUCTNAME])
191 AC_SUBST(PRODUCTNAME)
192 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
193 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
195 dnl ===================================================================
196 dnl Our version is defined by the AC_INIT() at the top of this script.
197 dnl ===================================================================
199 AC_MSG_CHECKING([for package version])
200 if test -n "$with_package_version" -a "$with_package_version" != no; then
201     PACKAGE_VERSION="$with_package_version"
203 AC_MSG_RESULT([$PACKAGE_VERSION])
205 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
207 LIBO_VERSION_MAJOR=$1
208 LIBO_VERSION_MINOR=$2
209 LIBO_VERSION_MICRO=$3
210 LIBO_VERSION_PATCH=$4
212 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
213 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
214 # no way to encode that into an integer in general.
215 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
217 LIBO_VERSION_SUFFIX=$5
218 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
219 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
220 # they get undoubled before actually passed to sed.
221 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
222 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
223 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
224 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
226 AC_SUBST(LIBO_VERSION_MAJOR)
227 AC_SUBST(LIBO_VERSION_MINOR)
228 AC_SUBST(LIBO_VERSION_MICRO)
229 AC_SUBST(LIBO_VERSION_PATCH)
230 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
231 AC_SUBST(LIBO_VERSION_SUFFIX)
232 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
237 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
239 LIBO_THIS_YEAR=`date +%Y`
240 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
242 dnl ===================================================================
243 dnl Product version
244 dnl ===================================================================
245 AC_MSG_CHECKING([for product version])
246 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
247 AC_MSG_RESULT([$PRODUCTVERSION])
248 AC_SUBST(PRODUCTVERSION)
250 AC_PROG_EGREP
251 # AC_PROG_EGREP doesn't set GREP on all systems as well
252 AC_PATH_PROG(GREP, grep)
254 BUILDDIR=`pwd`
255 cd $srcdir
256 SRC_ROOT=`pwd`
257 cd $BUILDDIR
258 x_Cygwin=[\#]
260 dnl ======================================
261 dnl Required GObject introspection version
262 dnl ======================================
263 INTROSPECTION_REQUIRED_VERSION=1.32.0
265 dnl ===================================================================
266 dnl Search all the common names for GNU Make
267 dnl ===================================================================
268 AC_MSG_CHECKING([for GNU Make])
270 # try to use our own make if it is available and GNUMAKE was not already defined
271 if test -z "$GNUMAKE"; then
272     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
273         GNUMAKE="$LODE_HOME/opt/bin/make"
274     elif test -x "/opt/lo/bin/make"; then
275         GNUMAKE="/opt/lo/bin/make"
276     fi
279 GNUMAKE_WIN_NATIVE=
280 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
281     if test -n "$a"; then
282         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
283         if test $? -eq 0;  then
284             if test "$build_os" = "cygwin"; then
285                 if test -n "$($a -v | grep 'Built for Windows')" ; then
286                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
287                     GNUMAKE_WIN_NATIVE="TRUE"
288                 else
289                     GNUMAKE=`which $a`
290                 fi
291             else
292                 GNUMAKE=`which $a`
293             fi
294             break
295         fi
296     fi
297 done
298 AC_MSG_RESULT($GNUMAKE)
299 if test -z "$GNUMAKE"; then
300     AC_MSG_ERROR([not found. install GNU Make.])
301 else
302     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
303         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
304     fi
307 win_short_path_for_make()
309     local_short_path="$1"
310     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
311         cygpath -sm "$local_short_path"
312     else
313         cygpath -u "$(cygpath -d "$local_short_path")"
314     fi
318 if test "$build_os" = "cygwin"; then
319     PathFormat "$SRC_ROOT"
320     SRC_ROOT="$formatted_path"
321     PathFormat "$BUILDDIR"
322     BUILDDIR="$formatted_path"
323     x_Cygwin=
324     AC_MSG_CHECKING(for explicit COMSPEC)
325     if test -z "$COMSPEC"; then
326         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
327     else
328         AC_MSG_RESULT([found: $COMSPEC])
329     fi
332 AC_SUBST(SRC_ROOT)
333 AC_SUBST(BUILDDIR)
334 AC_SUBST(x_Cygwin)
335 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
336 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
337 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
339 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
340     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
343 # need sed in os checks...
344 AC_PATH_PROGS(SED, sed)
345 if test -z "$SED"; then
346     AC_MSG_ERROR([install sed to run this script])
349 # Set the ENABLE_LTO variable
350 # ===================================================================
351 AC_MSG_CHECKING([whether to use link-time optimization])
352 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
353     ENABLE_LTO="TRUE"
354     AC_MSG_RESULT([yes])
355     AC_DEFINE(STATIC_LINKING)
356 else
357     ENABLE_LTO=""
358     AC_MSG_RESULT([no])
360 AC_SUBST(ENABLE_LTO)
362 AC_ARG_ENABLE(fuzz-options,
363     AS_HELP_STRING([--enable-fuzz-options],
364         [Randomly enable or disable each of those configurable options
365          that are supposed to be freely selectable without interdependencies,
366          or where bad interaction from interdependencies is automatically avoided.])
369 dnl ===================================================================
370 dnl When building for Android, --with-android-ndk,
371 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
372 dnl mandatory
373 dnl ===================================================================
375 AC_ARG_WITH(android-ndk,
376     AS_HELP_STRING([--with-android-ndk],
377         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
380 AC_ARG_WITH(android-ndk-toolchain-version,
381     AS_HELP_STRING([--with-android-ndk-toolchain-version],
382         [Specify which toolchain version to use, of those present in the
383         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
384         with_android_ndk_toolchain_version=clang5.0)
386 AC_ARG_WITH(android-sdk,
387     AS_HELP_STRING([--with-android-sdk],
388         [Specify location of the Android SDK. Mandatory when building for Android.]),
391 AC_ARG_WITH(android-api-level,
392     AS_HELP_STRING([--with-android-api-level],
393         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
396 ANDROID_NDK_HOME=
397 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
398     with_android_ndk="$SRC_ROOT/external/android-ndk"
400 if test -n "$with_android_ndk"; then
401     eval ANDROID_NDK_HOME=$with_android_ndk
403     # Set up a lot of pre-canned defaults
405     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
406         if test ! -f $ANDROID_NDK_HOME/source.properties; then
407             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
408         fi
409         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
410     else
411         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
412     fi
413     if test -z "$ANDROID_NDK_VERSION";  then
414         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
415     fi
416     case $ANDROID_NDK_VERSION in
417     r9*|r10*)
418         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
419         ;;
420     11.1.*|12.1.*|13.1.*|14.1.*)
421         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
422         ;;
423     16.*|17.*|18.*|19.*|20.*)
424         ;;
425     *)
426         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
427         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
428         ;;
429     esac
431     ANDROID_API_LEVEL=16
432     if test -n "$with_android_api_level" ; then
433         ANDROID_API_LEVEL="$with_android_api_level"
434     fi
436     android_cpu=$host_cpu
437     if test $host_cpu = arm; then
438         android_platform_prefix=arm-linux-androideabi
439         android_gnu_prefix=$android_platform_prefix
440         LLVM_TRIPLE=armv7a-linux-androideabi
441         ANDROID_APP_ABI=armeabi-v7a
442         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
443     elif test $host_cpu = aarch64; then
444         android_platform_prefix=aarch64-linux-android
445         android_gnu_prefix=$android_platform_prefix
446         LLVM_TRIPLE=$android_platform_prefix
447         # minimum android version that supports aarch64
448         if test "$ANDROID_API_LEVEL" -lt "21" ; then
449             ANDROID_API_LEVEL=21
450         fi
451         ANDROID_APP_ABI=arm64-v8a
452     elif test $host_cpu = x86_64; then
453         android_platform_prefix=x86_64-linux-android
454         android_gnu_prefix=$android_platform_prefix
455         LLVM_TRIPLE=$android_platform_prefix
456         # minimum android version that supports x86_64
457         ANDROID_API_LEVEL=21
458         ANDROID_APP_ABI=x86_64
459     else
460         # host_cpu is something like "i386" or "i686" I guess, NDK uses
461         # "x86" in some contexts
462         android_cpu=x86
463         android_platform_prefix=$android_cpu
464         android_gnu_prefix=i686-linux-android
465         LLVM_TRIPLE=$android_gnu_prefix
466         ANDROID_APP_ABI=x86
467     fi
469     case "$with_android_ndk_toolchain_version" in
470     clang5.0)
471         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
472         ;;
473     *)
474         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
475     esac
477     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
479     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
480     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
481     # manage to link the (app-specific) single huge .so that is built for the app in
482     # android/source/ if there is debug information in a significant part of the object files.
483     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
484     # all objects have been built with debug information.)
485     case $build_os in
486     linux-gnu*)
487         android_HOST_TAG=linux-x86_64
488         ;;
489     darwin*)
490         android_HOST_TAG=darwin-x86_64
491         ;;
492     *)
493         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
494         # ndk would also support windows and windows-x86_64
495         ;;
496     esac
497     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
498     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
499     dnl TODO: NSS build uses it...
500     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
501     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
503     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
504     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
505     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
506     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
507     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
511     if test "$ENABLE_LTO" = TRUE; then
512         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
513         # $CC and $CXX when building external libraries
514         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
515     fi
517     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
519     if test -z "$CC"; then
520         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
521         CC_BASE="clang"
522     fi
523     if test -z "$CXX"; then
524         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
525         CXX_BASE="clang++"
526     fi
528     # remember to download the ownCloud Android library later
529     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
531 AC_SUBST(ANDROID_NDK_HOME)
532 AC_SUBST(ANDROID_APP_ABI)
533 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
535 dnl ===================================================================
536 dnl --with-android-sdk
537 dnl ===================================================================
538 ANDROID_SDK_HOME=
539 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
540     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
542 if test -n "$with_android_sdk"; then
543     eval ANDROID_SDK_HOME=$with_android_sdk
544     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
546 AC_SUBST(ANDROID_SDK_HOME)
548 AC_ARG_ENABLE([android-lok],
549     AS_HELP_STRING([--enable-android-lok],
550         [The Android app from the android/ subdir needs several tweaks all
551          over the place that break the LOK when used in the Online-based
552          Android app.  This switch indicates that the intent of this build is
553          actually the Online-based, non-modified LOK.])
555 ENABLE_ANDROID_LOK=
556 if test -n "$ANDROID_NDK_HOME" ; then
557     if test "$enable_android_lok" = yes; then
558         ENABLE_ANDROID_LOK=TRUE
559         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
560         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
561     else
562         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
563     fi
565 AC_SUBST([ENABLE_ANDROID_LOK])
567 libo_FUZZ_ARG_ENABLE([android-editing],
568     AS_HELP_STRING([--enable-android-editing],
569         [Enable the experimental editing feature on Android.])
571 ENABLE_ANDROID_EDITING=
572 if test "$enable_android_editing" = yes; then
573     ENABLE_ANDROID_EDITING=TRUE
575 AC_SUBST([ENABLE_ANDROID_EDITING])
577 dnl ===================================================================
578 dnl The following is a list of supported systems.
579 dnl Sequential to keep the logic very simple
580 dnl These values may be checked and reset later.
581 dnl ===================================================================
582 #defaults unless the os test overrides this:
583 test_randr=yes
584 test_xrender=yes
585 test_cups=yes
586 test_dbus=yes
587 test_fontconfig=yes
588 test_cairo=no
589 test_gdb_index=no
590 test_split_debug=no
592 # Default values, as such probably valid just for Linux, set
593 # differently below just for Mac OSX, but at least better than
594 # hardcoding these as we used to do. Much of this is duplicated also
595 # in solenv for old build system and for gbuild, ideally we should
596 # perhaps define stuff like this only here in configure.ac?
598 LINKFLAGSSHL="-shared"
599 PICSWITCH="-fpic"
600 DLLPOST=".so"
602 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
604 INSTROOTBASESUFFIX=
605 INSTROOTCONTENTSUFFIX=
606 SDKDIRNAME=sdk
608 case "$host_os" in
610 solaris*)
611     build_gstreamer_1_0=yes
612     test_freetype=yes
613     _os=SunOS
615     dnl ===========================================================
616     dnl Check whether we're using Solaris 10 - SPARC or Intel.
617     dnl ===========================================================
618     AC_MSG_CHECKING([the Solaris operating system release])
619     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
620     if test "$_os_release" -lt "10"; then
621         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
622     else
623         AC_MSG_RESULT([ok ($_os_release)])
624     fi
626     dnl Check whether we're using a SPARC or i386 processor
627     AC_MSG_CHECKING([the processor type])
628     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
629         AC_MSG_RESULT([ok ($host_cpu)])
630     else
631         AC_MSG_ERROR([only SPARC and i386 processors are supported])
632     fi
633     ;;
635 linux-gnu*|k*bsd*-gnu*)
636     build_gstreamer_1_0=yes
637     test_kf5=yes
638     test_gtk3_kde5=yes
639     test_gdb_index=yes
640     test_split_debug=yes
641     if test "$enable_fuzzers" != yes; then
642         test_freetype=yes
643         test_fontconfig=yes
644     else
645         test_freetype=no
646         test_fontconfig=no
647         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
648     fi
649     _os=Linux
650     ;;
652 gnu)
653     test_randr=no
654     test_xrender=no
655     _os=GNU
656      ;;
658 cygwin*|interix*)
660     # When building on Windows normally with MSVC under Cygwin,
661     # configure thinks that the host platform (the platform the
662     # built code will run on) is Cygwin, even if it obviously is
663     # Windows, which in Autoconf terminology is called
664     # "mingw32". (Which is misleading as MinGW is the name of the
665     # tool-chain, not an operating system.)
667     # Somewhat confusing, yes. But this configure script doesn't
668     # look at $host etc that much, it mostly uses its own $_os
669     # variable, set here in this case statement.
671     test_cups=no
672     test_dbus=no
673     test_randr=no
674     test_xrender=no
675     test_freetype=no
676     test_fontconfig=no
677     _os=WINNT
679     DLLPOST=".dll"
680     LINKFLAGSNOUNDEFS=
681     ;;
683 darwin*) # macOS or iOS
684     test_randr=no
685     test_xrender=no
686     test_freetype=no
687     test_fontconfig=no
688     test_dbus=no
689     if test -n "$LODE_HOME" ; then
690         mac_sanitize_path
691         AC_MSG_NOTICE([sanitized the PATH to $PATH])
692     fi
693     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
694         build_for_ios=YES
695         _os=iOS
696         test_cups=no
697         enable_mpl_subset=yes
698         enable_lotuswordpro=no
699         enable_coinmp=no
700         enable_lpsolve=no
701         enable_postgresql_sdbc=no
702         enable_extension_integration=no
703         enable_report_builder=no
704         with_ppds=no
705         if test "$enable_ios_simulator" = "yes"; then
706             host=x86_64-apple-darwin
707         fi
708     else
709         _os=Darwin
710         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
711         INSTROOTCONTENTSUFFIX=/Contents
712         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
713     fi
714     # See comment above the case "$host_os"
715     LINKFLAGSSHL="-dynamiclib -single_module"
717     # -fPIC is default
718     PICSWITCH=""
720     DLLPOST=".dylib"
722     # -undefined error is the default
723     LINKFLAGSNOUNDEFS=""
726 freebsd*)
727     build_gstreamer_1_0=yes
728     test_kf5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     AC_MSG_CHECKING([the FreeBSD operating system release])
732     if test -n "$with_os_version"; then
733         OSVERSION="$with_os_version"
734     else
735         OSVERSION=`/sbin/sysctl -n kern.osreldate`
736     fi
737     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
738     AC_MSG_CHECKING([which thread library to use])
739     if test "$OSVERSION" -lt "500016"; then
740         PTHREAD_CFLAGS="-D_THREAD_SAFE"
741         PTHREAD_LIBS="-pthread"
742     elif test "$OSVERSION" -lt "502102"; then
743         PTHREAD_CFLAGS="-D_THREAD_SAFE"
744         PTHREAD_LIBS="-lc_r"
745     else
746         PTHREAD_CFLAGS=""
747         PTHREAD_LIBS="-pthread"
748     fi
749     AC_MSG_RESULT([$PTHREAD_LIBS])
750     _os=FreeBSD
751     ;;
753 *netbsd*)
754     build_gstreamer_1_0=yes
755     test_kf5=yes
756     test_gtk3_kde5=yes
757     test_freetype=yes
758     PTHREAD_LIBS="-pthread -lpthread"
759     _os=NetBSD
760     ;;
762 aix*)
763     test_randr=no
764     test_freetype=yes
765     PTHREAD_LIBS=-pthread
766     _os=AIX
767     ;;
769 openbsd*)
770     test_freetype=yes
771     PTHREAD_CFLAGS="-D_THREAD_SAFE"
772     PTHREAD_LIBS="-pthread"
773     _os=OpenBSD
774     ;;
776 dragonfly*)
777     build_gstreamer_1_0=yes
778     test_kf5=yes
779     test_gtk3_kde5=yes
780     test_freetype=yes
781     PTHREAD_LIBS="-pthread"
782     _os=DragonFly
783     ;;
785 linux-android*)
786     build_gstreamer_1_0=no
787     enable_lotuswordpro=no
788     enable_mpl_subset=yes
789     enable_coinmp=yes
790     enable_lpsolve=no
791     enable_report_builder=no
792     enable_odk=no
793     enable_postgresql_sdbc=no
794     enable_python=no
795     test_cups=no
796     test_dbus=no
797     test_fontconfig=no
798     test_freetype=no
799     test_kf5=no
800     test_qt5=no
801     test_gtk3_kde5=no
802     test_randr=no
803     test_xrender=no
804     _os=Android
806     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
807     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
808     ;;
810 haiku*)
811     test_cups=no
812     test_dbus=no
813     test_randr=no
814     test_xrender=no
815     test_freetype=yes
816     enable_odk=no
817     enable_gstreamer_1_0=no
818     enable_vlc=no
819     enable_coinmp=no
820     enable_pdfium=no
821     enable_sdremote=no
822     enable_postgresql_sdbc=no
823     enable_firebird_sdbc=no
824     _os=Haiku
825     ;;
828     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
829     ;;
830 esac
832 if test "$_os" = "Android" ; then
833     # Verify that the NDK and SDK options are proper
834     if test -z "$with_android_ndk"; then
835         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
836     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
837         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
838     fi
840     if test -z "$ANDROID_SDK_HOME"; then
841         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
842     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
843         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
844     fi
846     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
847     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
848         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
849                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
850                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
851         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
852         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
853         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
854     fi
855     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
856         AC_MSG_WARN([android support repository not found - install with
857                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
858                      to allow the build to download the specified version of the android support libraries])
859         add_warning "android support repository not found - install with"
860         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
861         add_warning "to allow the build to download the specified version of the android support libraries"
862     fi
865 if test "$_os" = "AIX"; then
866     AC_PATH_PROG(GAWK, gawk)
867     if test -z "$GAWK"; then
868         AC_MSG_ERROR([gawk not found in \$PATH])
869     fi
872 AC_SUBST(SDKDIRNAME)
874 AC_SUBST(PTHREAD_CFLAGS)
875 AC_SUBST(PTHREAD_LIBS)
877 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
878 # By default use the ones specified by our build system,
879 # but explicit override is possible.
880 AC_MSG_CHECKING(for explicit AFLAGS)
881 if test -n "$AFLAGS"; then
882     AC_MSG_RESULT([$AFLAGS])
883     x_AFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_AFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit CFLAGS)
889 if test -n "$CFLAGS"; then
890     AC_MSG_RESULT([$CFLAGS])
891     x_CFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_CFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit CXXFLAGS)
897 if test -n "$CXXFLAGS"; then
898     AC_MSG_RESULT([$CXXFLAGS])
899     x_CXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_CXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit OBJCFLAGS)
905 if test -n "$OBJCFLAGS"; then
906     AC_MSG_RESULT([$OBJCFLAGS])
907     x_OBJCFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_OBJCFLAGS=[\#]
912 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
913 if test -n "$OBJCXXFLAGS"; then
914     AC_MSG_RESULT([$OBJCXXFLAGS])
915     x_OBJCXXFLAGS=
916 else
917     AC_MSG_RESULT(no)
918     x_OBJCXXFLAGS=[\#]
920 AC_MSG_CHECKING(for explicit LDFLAGS)
921 if test -n "$LDFLAGS"; then
922     AC_MSG_RESULT([$LDFLAGS])
923     x_LDFLAGS=
924 else
925     AC_MSG_RESULT(no)
926     x_LDFLAGS=[\#]
928 AC_SUBST(AFLAGS)
929 AC_SUBST(CFLAGS)
930 AC_SUBST(CXXFLAGS)
931 AC_SUBST(OBJCFLAGS)
932 AC_SUBST(OBJCXXFLAGS)
933 AC_SUBST(LDFLAGS)
934 AC_SUBST(x_AFLAGS)
935 AC_SUBST(x_CFLAGS)
936 AC_SUBST(x_CXXFLAGS)
937 AC_SUBST(x_OBJCFLAGS)
938 AC_SUBST(x_OBJCXXFLAGS)
939 AC_SUBST(x_LDFLAGS)
941 dnl These are potentially set for MSVC, in the code checking for UCRT below:
942 my_original_CFLAGS=$CFLAGS
943 my_original_CXXFLAGS=$CXXFLAGS
944 my_original_CPPFLAGS=$CPPFLAGS
946 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
947 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
948 dnl AC_PROG_CC internally.
949 if test "$_os" != "WINNT"; then
950     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
951     save_CFLAGS=$CFLAGS
952     AC_PROG_CC
953     CFLAGS=$save_CFLAGS
954     if test -z "$CC_BASE"; then
955         CC_BASE=`first_arg_basename "$CC"`
956     fi
959 if test "$_os" != "WINNT"; then
960     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
961 else
962     ENDIANNESS=little
964 AC_SUBST(ENDIANNESS)
966 if test $_os != "WINNT"; then
967     save_LIBS="$LIBS"
968     AC_SEARCH_LIBS([dlsym], [dl],
969         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
970         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
971     LIBS="$save_LIBS"
973 AC_SUBST(DLOPEN_LIBS)
975 AC_ARG_ENABLE(ios-simulator,
976     AS_HELP_STRING([--enable-ios-simulator],
977         [build i386 or x86_64 for ios simulator])
980 AC_ARG_ENABLE(ios-libreofficelight-app,
981     AS_HELP_STRING([--enable-ios-libreofficelight-app],
982         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
983          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
984          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
987 ENABLE_IOS_LIBREOFFICELIGHT_APP=
988 if test "$enable_ios_libreofficelight_app" = yes; then
989     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
991 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
993 ###############################################################################
994 # Extensions switches --enable/--disable
995 ###############################################################################
996 # By default these should be enabled unless having extra dependencies.
997 # If there is extra dependency over configure options then the enable should
998 # be automagic based on whether the requiring feature is enabled or not.
999 # All this options change anything only with --enable-extension-integration.
1001 # The name of this option and its help string makes it sound as if
1002 # extensions are built anyway, just not integrated in the installer,
1003 # if you use --disable-extension-integration. Is that really the
1004 # case?
1006 libo_FUZZ_ARG_ENABLE(extension-integration,
1007     AS_HELP_STRING([--disable-extension-integration],
1008         [Disable integration of the built extensions in the installer of the
1009          product. Use this switch to disable the integration.])
1012 AC_ARG_ENABLE(avmedia,
1013     AS_HELP_STRING([--disable-avmedia],
1014         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1017 AC_ARG_ENABLE(database-connectivity,
1018     AS_HELP_STRING([--disable-database-connectivity],
1019         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1022 # This doesn't mean not building (or "integrating") extensions
1023 # (although it probably should; i.e. it should imply
1024 # --disable-extension-integration I guess), it means not supporting
1025 # any extension mechanism at all
1026 libo_FUZZ_ARG_ENABLE(extensions,
1027     AS_HELP_STRING([--disable-extensions],
1028         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1031 AC_ARG_ENABLE(scripting,
1032     AS_HELP_STRING([--disable-scripting],
1033         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1036 # This is mainly for Android and iOS, but could potentially be used in some
1037 # special case otherwise, too, so factored out as a separate setting
1039 AC_ARG_ENABLE(dynamic-loading,
1040     AS_HELP_STRING([--disable-dynamic-loading],
1041         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1044 libo_FUZZ_ARG_ENABLE(report-builder,
1045     AS_HELP_STRING([--disable-report-builder],
1046         [Disable the Report Builder.])
1049 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1050     AS_HELP_STRING([--enable-ext-wiki-publisher],
1051         [Enable the Wiki Publisher extension.])
1054 libo_FUZZ_ARG_ENABLE(lpsolve,
1055     AS_HELP_STRING([--disable-lpsolve],
1056         [Disable compilation of the lp solve solver ])
1058 libo_FUZZ_ARG_ENABLE(coinmp,
1059     AS_HELP_STRING([--disable-coinmp],
1060         [Disable compilation of the CoinMP solver ])
1063 libo_FUZZ_ARG_ENABLE(pdfimport,
1064     AS_HELP_STRING([--disable-pdfimport],
1065         [Disable building the PDF import feature.])
1068 libo_FUZZ_ARG_ENABLE(pdfium,
1069     AS_HELP_STRING([--disable-pdfium],
1070         [Disable building PDFium.])
1073 ###############################################################################
1075 dnl ---------- *** ----------
1077 libo_FUZZ_ARG_ENABLE(mergelibs,
1078     AS_HELP_STRING([--enable-mergelibs],
1079         [Merge several of the smaller libraries into one big, "merged", one.])
1082 libo_FUZZ_ARG_ENABLE(breakpad,
1083     AS_HELP_STRING([--enable-breakpad],
1084         [Enables breakpad for crash reporting.])
1087 libo_FUZZ_ARG_ENABLE(crashdump,
1088     AS_HELP_STRING([--disable-crashdump],
1089         [Disable dump.ini and dump-file, when --enable-breakpad])
1092 AC_ARG_ENABLE(fetch-external,
1093     AS_HELP_STRING([--disable-fetch-external],
1094         [Disables fetching external tarballs from web sources.])
1097 AC_ARG_ENABLE(fuzzers,
1098     AS_HELP_STRING([--enable-fuzzers],
1099         [Enables building libfuzzer targets for fuzz testing.])
1102 libo_FUZZ_ARG_ENABLE(pch,
1103     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1104         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1105          Using 'system' will include only external headers, 'base' will add also headers
1106          from base modules, 'normal' will also add all headers except from the module built,
1107          'full' will use all suitable headers even from a module itself.])
1110 libo_FUZZ_ARG_ENABLE(epm,
1111     AS_HELP_STRING([--enable-epm],
1112         [LibreOffice includes self-packaging code, that requires epm, however epm is
1113          useless for large scale package building.])
1116 libo_FUZZ_ARG_ENABLE(odk,
1117     AS_HELP_STRING([--disable-odk],
1118         [LibreOffice includes an ODK, office development kit which some packagers may
1119          wish to build without.])
1122 AC_ARG_ENABLE(mpl-subset,
1123     AS_HELP_STRING([--enable-mpl-subset],
1124         [Don't compile any pieces which are not MPL or more liberally licensed])
1127 libo_FUZZ_ARG_ENABLE(evolution2,
1128     AS_HELP_STRING([--enable-evolution2],
1129         [Allows the built-in evolution 2 addressbook connectivity build to be
1130          enabled.])
1133 AC_ARG_ENABLE(avahi,
1134     AS_HELP_STRING([--enable-avahi],
1135         [Determines whether to use Avahi to advertise Impress to remote controls.])
1138 libo_FUZZ_ARG_ENABLE(werror,
1139     AS_HELP_STRING([--enable-werror],
1140         [Turn warnings to errors. (Has no effect in modules where the treating
1141          of warnings as errors is disabled explicitly.)]),
1144 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1145     AS_HELP_STRING([--enable-assert-always-abort],
1146         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1149 libo_FUZZ_ARG_ENABLE(dbgutil,
1150     AS_HELP_STRING([--enable-dbgutil],
1151         [Provide debugging support from --enable-debug and include additional debugging
1152          utilities such as object counting or more expensive checks.
1153          This is the recommended option for developers.
1154          Note that this makes the build ABI incompatible, it is not possible to mix object
1155          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1157 libo_FUZZ_ARG_ENABLE(debug,
1158     AS_HELP_STRING([--enable-debug],
1159         [Include debugging information, disable compiler optimization and inlining plus
1160          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1162 libo_FUZZ_ARG_ENABLE(split-debug,
1163     AS_HELP_STRING([--disable-split-debug],
1164         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1165          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1167 libo_FUZZ_ARG_ENABLE(gdb-index,
1168     AS_HELP_STRING([--disable-gdb-index],
1169         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1170          The feature requires the gold or lld linker.]))
1172 libo_FUZZ_ARG_ENABLE(sal-log,
1173     AS_HELP_STRING([--enable-sal-log],
1174         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1176 libo_FUZZ_ARG_ENABLE(symbols,
1177     AS_HELP_STRING([--enable-symbols],
1178         [Generate debug information.
1179          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1180          otherwise. It is possible to explicitly specify gbuild build targets
1181          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1182          everything in the directory; there is no ordering, more specific overrides
1183          more general, and disabling takes precedence).
1184          Example: --enable-symbols="all -sw/ -Library_sc".]))
1186 libo_FUZZ_ARG_ENABLE(optimized,
1187     AS_HELP_STRING([--disable-optimized],
1188         [Whether to compile with optimization flags.
1189          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1190          otherwise.]))
1192 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1193     AS_HELP_STRING([--disable-runtime-optimizations],
1194         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1195          JVM JIT) that are known to interact badly with certain dynamic analysis
1196          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1197          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1198          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1200 AC_ARG_WITH(valgrind,
1201     AS_HELP_STRING([--with-valgrind],
1202         [Make availability of Valgrind headers a hard requirement.]))
1204 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1205     AS_HELP_STRING([--enable-compiler-plugins],
1206         [Enable compiler plugins that will perform additional checks during
1207          building. Enabled automatically by --enable-dbgutil.
1208          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1209 COMPILER_PLUGINS_DEBUG=
1210 if test "$enable_compiler_plugins" = debug; then
1211     enable_compiler_plugins=yes
1212     COMPILER_PLUGINS_DEBUG=TRUE
1215 libo_FUZZ_ARG_ENABLE(ooenv,
1216     AS_HELP_STRING([--disable-ooenv],
1217         [Disable ooenv for the instdir installation.]))
1219 libo_FUZZ_ARG_ENABLE(libnumbertext,
1220     AS_HELP_STRING([--disable-libnumbertext],
1221         [Disable use of numbertext external library.]))
1223 AC_ARG_ENABLE(lto,
1224     AS_HELP_STRING([--enable-lto],
1225         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1226          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1227          linker. For MSVC, this option is broken at the moment. This is experimental work
1228          in progress that shouldn't be used unless you are working on it.)]))
1230 AC_ARG_ENABLE(python,
1231     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1232         [Enables or disables Python support at run-time.
1233          Also specifies what Python to use. 'auto' is the default.
1234          'fully-internal' even forces the internal version for uses of Python
1235          during the build.]))
1237 libo_FUZZ_ARG_ENABLE(gtk3,
1238     AS_HELP_STRING([--disable-gtk3],
1239         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1240 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1242 AC_ARG_ENABLE(introspection,
1243     AS_HELP_STRING([--enable-introspection],
1244         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1245          Linux distributions.)]))
1247 AC_ARG_ENABLE(split-app-modules,
1248     AS_HELP_STRING([--enable-split-app-modules],
1249         [Split file lists for app modules, e.g. base, calc.
1250          Has effect only with make distro-pack-install]),
1253 AC_ARG_ENABLE(split-opt-features,
1254     AS_HELP_STRING([--enable-split-opt-features],
1255         [Split file lists for some optional features, e.g. pyuno, testtool.
1256          Has effect only with make distro-pack-install]),
1259 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1260     AS_HELP_STRING([--disable-cairo-canvas],
1261         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1264 libo_FUZZ_ARG_ENABLE(dbus,
1265     AS_HELP_STRING([--disable-dbus],
1266         [Determines whether to enable features that depend on dbus.
1267          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1268 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1270 libo_FUZZ_ARG_ENABLE(sdremote,
1271     AS_HELP_STRING([--disable-sdremote],
1272         [Determines whether to enable Impress remote control (i.e. the server component).]),
1273 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1275 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1276     AS_HELP_STRING([--disable-sdremote-bluetooth],
1277         [Determines whether to build sdremote with bluetooth support.
1278          Requires dbus on Linux.]))
1280 libo_FUZZ_ARG_ENABLE(gio,
1281     AS_HELP_STRING([--disable-gio],
1282         [Determines whether to use the GIO support.]),
1283 ,test "${enable_gio+set}" = set || enable_gio=yes)
1285 AC_ARG_ENABLE(qt5,
1286     AS_HELP_STRING([--enable-qt5],
1287         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1288          available.]),
1291 AC_ARG_ENABLE(kf5,
1292     AS_HELP_STRING([--enable-kf5],
1293         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1294          KF5 are available.]),
1297 AC_ARG_ENABLE(kde5,
1298     AS_HELP_STRING([--enable-kde5],
1299         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1302 AC_ARG_ENABLE(gtk3_kde5,
1303     AS_HELP_STRING([--enable-gtk3-kde5],
1304         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1305          platforms where Gtk3, Qt5 and Plasma is available.]),
1308 AC_ARG_ENABLE(gui,
1309     AS_HELP_STRING([--disable-gui],
1310         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1311 ,enable_gui=yes)
1313 libo_FUZZ_ARG_ENABLE(randr,
1314     AS_HELP_STRING([--disable-randr],
1315         [Disable RandR support in the vcl project.]),
1316 ,test "${enable_randr+set}" = set || enable_randr=yes)
1318 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1319     AS_HELP_STRING([--disable-gstreamer-1-0],
1320         [Disable building with the gstreamer 1.0 avmedia backend.]),
1321 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1323 libo_FUZZ_ARG_ENABLE(vlc,
1324     AS_HELP_STRING([--enable-vlc],
1325         [Enable building with the (experimental) VLC avmedia backend.]),
1326 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1328 libo_FUZZ_ARG_ENABLE(neon,
1329     AS_HELP_STRING([--disable-neon],
1330         [Disable neon and the compilation of webdav binding.]),
1333 libo_FUZZ_ARG_ENABLE([eot],
1334     [AS_HELP_STRING([--enable-eot],
1335         [Enable support for Embedded OpenType fonts.])],
1336 ,test "${enable_eot+set}" = set || enable_eot=no)
1338 libo_FUZZ_ARG_ENABLE(cve-tests,
1339     AS_HELP_STRING([--disable-cve-tests],
1340         [Prevent CVE tests to be executed]),
1343 libo_FUZZ_ARG_ENABLE(chart-tests,
1344     AS_HELP_STRING([--enable-chart-tests],
1345         [Executes chart XShape tests. In a perfect world these tests would be
1346          stable and everyone could run them, in reality it is best to run them
1347          only on a few machines that are known to work and maintained by people
1348          who can judge if a test failure is a regression or not.]),
1351 AC_ARG_ENABLE(build-unowinreg,
1352     AS_HELP_STRING([--enable-build-unowinreg],
1353         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1354          compiler is needed on Linux.]),
1357 AC_ARG_ENABLE(build-opensymbol,
1358     AS_HELP_STRING([--enable-build-opensymbol],
1359         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1360          fontforge installed.]),
1363 AC_ARG_ENABLE(dependency-tracking,
1364     AS_HELP_STRING([--enable-dependency-tracking],
1365         [Do not reject slow dependency extractors.])[
1366   --disable-dependency-tracking
1367                           Disables generation of dependency information.
1368                           Speed up one-time builds.],
1371 AC_ARG_ENABLE(icecream,
1372     AS_HELP_STRING([--enable-icecream],
1373         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1374          It defaults to /opt/icecream for the location of the icecream gcc/g++
1375          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1378 AC_ARG_ENABLE(ld,
1379     AS_HELP_STRING([--enable-ld=<linker>],
1380         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1381          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1384 libo_FUZZ_ARG_ENABLE(cups,
1385     AS_HELP_STRING([--disable-cups],
1386         [Do not build cups support.])
1389 AC_ARG_ENABLE(ccache,
1390     AS_HELP_STRING([--disable-ccache],
1391         [Do not try to use ccache automatically.
1392          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1393          CC/CXX are not yet set, and --enable-icecream is not given, we
1394          attempt to use ccache. --disable-ccache disables ccache completely.
1395          Additionally ccache's depend mode is enabled if possible,
1396          use --enable-ccache=nodepend to enable ccache without depend mode.
1400 AC_ARG_ENABLE(64-bit,
1401     AS_HELP_STRING([--enable-64-bit],
1402         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1403          At the moment meaningful only for Windows.]), ,)
1405 libo_FUZZ_ARG_ENABLE(online-update,
1406     AS_HELP_STRING([--enable-online-update],
1407         [Enable the online update service that will check for new versions of
1408          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1409          If the value is "mar", the experimental Mozilla-like update will be
1410          enabled instead of the traditional update mechanism.]),
1413 AC_ARG_WITH(update-config,
1414     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1415                    [Path to the update config ini file]))
1417 libo_FUZZ_ARG_ENABLE(extension-update,
1418     AS_HELP_STRING([--disable-extension-update],
1419         [Disable possibility to update installed extensions.]),
1422 libo_FUZZ_ARG_ENABLE(release-build,
1423     AS_HELP_STRING([--enable-release-build],
1424         [Enable release build. Note that the "release build" choice is orthogonal to
1425          whether symbols are present, debug info is generated, or optimization
1426          is done.
1427          See http://wiki.documentfoundation.org/Development/DevBuild]),
1430 AC_ARG_ENABLE(windows-build-signing,
1431     AS_HELP_STRING([--enable-windows-build-signing],
1432         [Enable signing of windows binaries (*.exe, *.dll)]),
1435 AC_ARG_ENABLE(silent-msi,
1436     AS_HELP_STRING([--enable-silent-msi],
1437         [Enable MSI with LIMITUI=1 (silent install).]),
1440 AC_ARG_ENABLE(macosx-code-signing,
1441     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1442         [Sign executables, dylibs, frameworks and the app bundle. If you
1443          don't provide an identity the first suitable certificate
1444          in your keychain is used.]),
1447 AC_ARG_ENABLE(macosx-package-signing,
1448     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1449         [Create a .pkg suitable for uploading to the Mac App Store and sign
1450          it. If you don't provide an identity the first suitable certificate
1451          in your keychain is used.]),
1454 AC_ARG_ENABLE(macosx-sandbox,
1455     AS_HELP_STRING([--enable-macosx-sandbox],
1456         [Make the app bundle run in a sandbox. Requires code signing.
1457          Is required by apps distributed in the Mac App Store, and implies
1458          adherence to App Store rules.]),
1461 AC_ARG_WITH(macosx-bundle-identifier,
1462     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1463         [Define the macOS bundle identifier. Default is the somewhat weird
1464          org.libreoffice.script ("script", huh?).]),
1465 ,with_macosx_bundle_identifier=org.libreoffice.script)
1467 AC_ARG_WITH(product-name,
1468     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1469         [Define the product name. Default is AC_PACKAGE_NAME.]),
1470 ,with_product_name=$PRODUCTNAME)
1472 AC_ARG_WITH(package-version,
1473     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1474         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1477 libo_FUZZ_ARG_ENABLE(readonly-installset,
1478     AS_HELP_STRING([--enable-readonly-installset],
1479         [Prevents any attempts by LibreOffice to write into its installation. That means
1480          at least that no "system-wide" extensions can be added. Partly experimental work in
1481          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1484 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1485     AS_HELP_STRING([--disable-postgresql-sdbc],
1486         [Disable the build of the PostgreSQL-SDBC driver.])
1489 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1490     AS_HELP_STRING([--disable-lotuswordpro],
1491         [Disable the build of the Lotus Word Pro filter.]),
1492 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1494 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1495     AS_HELP_STRING([--disable-firebird-sdbc],
1496         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1497 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1499 AC_ARG_ENABLE(bogus-pkg-config,
1500     AS_HELP_STRING([--enable-bogus-pkg-config],
1501         [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.]),
1504 AC_ARG_ENABLE(openssl,
1505     AS_HELP_STRING([--disable-openssl],
1506         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1507          components will either use GNUTLS or NSS. Work in progress,
1508          use only if you are hacking on it.]),
1509 ,enable_openssl=yes)
1511 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1512     AS_HELP_STRING([--enable-cipher-openssl-backend],
1513         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1514          Requires --enable-openssl.]))
1516 AC_ARG_ENABLE(library-bin-tar,
1517     AS_HELP_STRING([--enable-library-bin-tar],
1518         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1519         Some libraries can save their build result in a tarball
1520         stored in TARFILE_LOCATION. That binary tarball is
1521         uniquely identified by the source tarball,
1522         the content of the config_host.mk file and the content
1523         of the top-level directory in core for that library
1524         If this option is enabled, then if such a tarfile exist, it will be untarred
1525         instead of the source tarfile, and the build step will be skipped for that
1526         library.
1527         If a proper tarfile does not exist, then the normal source-based
1528         build is done for that library and a proper binary tarfile is created
1529         for the next time.]),
1532 AC_ARG_ENABLE(dconf,
1533     AS_HELP_STRING([--disable-dconf],
1534         [Disable the dconf configuration backend (enabled by default where
1535          available).]))
1537 libo_FUZZ_ARG_ENABLE(formula-logger,
1538     AS_HELP_STRING(
1539         [--enable-formula-logger],
1540         [Enable formula logger for logging formula calculation flow in Calc.]
1541     )
1544 AC_ARG_ENABLE(ldap,
1545     AS_HELP_STRING([--disable-ldap],
1546         [Disable LDAP support.]),
1547 ,enable_ldap=yes)
1549 dnl ===================================================================
1550 dnl Optional Packages (--with/without-)
1551 dnl ===================================================================
1553 AC_ARG_WITH(gcc-home,
1554     AS_HELP_STRING([--with-gcc-home],
1555         [Specify the location of gcc/g++ manually. This can be used in conjunction
1556          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1557          non-default path.]),
1560 AC_ARG_WITH(gnu-patch,
1561     AS_HELP_STRING([--with-gnu-patch],
1562         [Specify location of GNU patch on Solaris or FreeBSD.]),
1565 AC_ARG_WITH(build-platform-configure-options,
1566     AS_HELP_STRING([--with-build-platform-configure-options],
1567         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1570 AC_ARG_WITH(gnu-cp,
1571     AS_HELP_STRING([--with-gnu-cp],
1572         [Specify location of GNU cp on Solaris or FreeBSD.]),
1575 AC_ARG_WITH(external-tar,
1576     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1577         [Specify an absolute path of where to find (and store) tarfiles.]),
1578     TARFILE_LOCATION=$withval ,
1581 AC_ARG_WITH(referenced-git,
1582     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1583         [Specify another checkout directory to reference. This makes use of
1584                  git submodule update --reference, and saves a lot of diskspace
1585                  when having multiple trees side-by-side.]),
1586     GIT_REFERENCE_SRC=$withval ,
1589 AC_ARG_WITH(linked-git,
1590     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1591         [Specify a directory where the repositories of submodules are located.
1592          This uses a method similar to git-new-workdir to get submodules.]),
1593     GIT_LINK_SRC=$withval ,
1596 AC_ARG_WITH(galleries,
1597     AS_HELP_STRING([--with-galleries],
1598         [Specify how galleries should be built. It is possible either to
1599          build these internally from source ("build"),
1600          or to disable them ("no")]),
1603 AC_ARG_WITH(theme,
1604     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1605         [Choose which themes to include. By default those themes with an '*' are included.
1606          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1607          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *tango.]),
1610 libo_FUZZ_ARG_WITH(helppack-integration,
1611     AS_HELP_STRING([--without-helppack-integration],
1612         [It will not integrate the helppacks to the installer
1613          of the product. Please use this switch to use the online help
1614          or separate help packages.]),
1617 libo_FUZZ_ARG_WITH(fonts,
1618     AS_HELP_STRING([--without-fonts],
1619         [LibreOffice includes some third-party fonts to provide a reliable basis for
1620          help content, templates, samples, etc. When these fonts are already
1621          known to be available on the system then you should use this option.]),
1624 AC_ARG_ENABLE(noto-font,
1625     AS_HELP_STRING([--enable-noto-font],
1626         [Add more Google Noto fonts.]),
1629 AC_ARG_WITH(epm,
1630     AS_HELP_STRING([--with-epm],
1631         [Decides which epm to use. Default is to use the one from the system if
1632          one is built. When either this is not there or you say =internal epm
1633          will be built.]),
1636 AC_ARG_WITH(package-format,
1637     AS_HELP_STRING([--with-package-format],
1638         [Specify package format(s) for LibreOffice installation sets. The
1639          implicit --without-package-format leads to no installation sets being
1640          generated. Possible values: aix, archive, bsd, deb, dmg,
1641          installed, msi, pkg, and rpm.
1642          Example: --with-package-format='deb rpm']),
1645 AC_ARG_WITH(tls,
1646     AS_HELP_STRING([--with-tls],
1647         [Decides which TLS/SSL and cryptographic implementations to use for
1648          LibreOffice's code. Notice that this doesn't apply for depending
1649          libraries like "neon", for example. Default is to use OpenSSL
1650          although NSS is also possible. Notice that selecting NSS restricts
1651          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1652          restrict by now the usage of NSS in LO's code. Possible values:
1653          openssl, nss. Example: --with-tls="nss"]),
1656 AC_ARG_WITH(system-libs,
1657     AS_HELP_STRING([--with-system-libs],
1658         [Use libraries already on system -- enables all --with-system-* flags.]),
1661 AC_ARG_WITH(system-bzip2,
1662     AS_HELP_STRING([--with-system-bzip2],
1663         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1664     [with_system_bzip2="$with_system_libs"])
1666 AC_ARG_WITH(system-headers,
1667     AS_HELP_STRING([--with-system-headers],
1668         [Use headers already on system -- enables all --with-system-* flags for
1669          external packages whose headers are the only entities used i.e.
1670          boost/odbc/sane-header(s).]),,
1671     [with_system_headers="$with_system_libs"])
1673 AC_ARG_WITH(system-jars,
1674     AS_HELP_STRING([--without-system-jars],
1675         [When building with --with-system-libs, also the needed jars are expected
1676          on the system. Use this to disable that]),,
1677     [with_system_jars="$with_system_libs"])
1679 AC_ARG_WITH(system-cairo,
1680     AS_HELP_STRING([--with-system-cairo],
1681         [Use cairo libraries already on system.  Happens automatically for
1682          (implicit) --enable-gtk3.]))
1684 AC_ARG_WITH(system-epoxy,
1685     AS_HELP_STRING([--with-system-epoxy],
1686         [Use epoxy libraries already on system.  Happens automatically for
1687          (implicit) --enable-gtk3.]),,
1688        [with_system_epoxy="$with_system_libs"])
1690 AC_ARG_WITH(myspell-dicts,
1691     AS_HELP_STRING([--with-myspell-dicts],
1692         [Adds myspell dictionaries to the LibreOffice installation set]),
1695 AC_ARG_WITH(system-dicts,
1696     AS_HELP_STRING([--without-system-dicts],
1697         [Do not use dictionaries from system paths.]),
1700 AC_ARG_WITH(external-dict-dir,
1701     AS_HELP_STRING([--with-external-dict-dir],
1702         [Specify external dictionary dir.]),
1705 AC_ARG_WITH(external-hyph-dir,
1706     AS_HELP_STRING([--with-external-hyph-dir],
1707         [Specify external hyphenation pattern dir.]),
1710 AC_ARG_WITH(external-thes-dir,
1711     AS_HELP_STRING([--with-external-thes-dir],
1712         [Specify external thesaurus dir.]),
1715 AC_ARG_WITH(system-zlib,
1716     AS_HELP_STRING([--with-system-zlib],
1717         [Use zlib already on system.]),,
1718     [with_system_zlib=auto])
1720 AC_ARG_WITH(system-jpeg,
1721     AS_HELP_STRING([--with-system-jpeg],
1722         [Use jpeg already on system.]),,
1723     [with_system_jpeg="$with_system_libs"])
1725 AC_ARG_WITH(system-clucene,
1726     AS_HELP_STRING([--with-system-clucene],
1727         [Use clucene already on system.]),,
1728     [with_system_clucene="$with_system_libs"])
1730 AC_ARG_WITH(system-expat,
1731     AS_HELP_STRING([--with-system-expat],
1732         [Use expat already on system.]),,
1733     [with_system_expat="$with_system_libs"])
1735 AC_ARG_WITH(system-libxml,
1736     AS_HELP_STRING([--with-system-libxml],
1737         [Use libxml/libxslt already on system.]),,
1738     [with_system_libxml=auto])
1740 AC_ARG_WITH(system-icu,
1741     AS_HELP_STRING([--with-system-icu],
1742         [Use icu already on system.]),,
1743     [with_system_icu="$with_system_libs"])
1745 AC_ARG_WITH(system-ucpp,
1746     AS_HELP_STRING([--with-system-ucpp],
1747         [Use ucpp already on system.]),,
1748     [])
1750 AC_ARG_WITH(system-openldap,
1751     AS_HELP_STRING([--with-system-openldap],
1752         [Use the OpenLDAP LDAP SDK already on system.]),,
1753     [with_system_openldap="$with_system_libs"])
1755 libo_FUZZ_ARG_ENABLE(poppler,
1756     AS_HELP_STRING([--disable-poppler],
1757         [Disable building Poppler.])
1760 AC_ARG_WITH(system-poppler,
1761     AS_HELP_STRING([--with-system-poppler],
1762         [Use system poppler (only needed for PDF import).]),,
1763     [with_system_poppler="$with_system_libs"])
1765 AC_ARG_WITH(system-gpgmepp,
1766     AS_HELP_STRING([--with-system-gpgmepp],
1767         [Use gpgmepp already on system]),,
1768     [with_system_gpgmepp="$with_system_libs"])
1770 AC_ARG_WITH(system-apache-commons,
1771     AS_HELP_STRING([--with-system-apache-commons],
1772         [Use Apache commons libraries already on system.]),,
1773     [with_system_apache_commons="$with_system_jars"])
1775 AC_ARG_WITH(system-mariadb,
1776     AS_HELP_STRING([--with-system-mariadb],
1777         [Use MariaDB/MySQL libraries already on system.]),,
1778     [with_system_mariadb="$with_system_libs"])
1780 AC_ARG_ENABLE(bundle-mariadb,
1781     AS_HELP_STRING([--enable-bundle-mariadb],
1782         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1785 AC_ARG_WITH(system-postgresql,
1786     AS_HELP_STRING([--with-system-postgresql],
1787         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1788          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1789     [with_system_postgresql="$with_system_libs"])
1791 AC_ARG_WITH(libpq-path,
1792     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1793         [Use this PostgreSQL C interface (libpq) installation for building
1794          the PostgreSQL-SDBC extension.]),
1797 AC_ARG_WITH(system-firebird,
1798     AS_HELP_STRING([--with-system-firebird],
1799         [Use Firebird libraries already on system, for building the Firebird-SDBC
1800          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1801     [with_system_firebird="$with_system_libs"])
1803 AC_ARG_WITH(system-libtommath,
1804             AS_HELP_STRING([--with-system-libtommath],
1805                            [Use libtommath already on system]),,
1806             [with_system_libtommath="$with_system_libs"])
1808 AC_ARG_WITH(system-hsqldb,
1809     AS_HELP_STRING([--with-system-hsqldb],
1810         [Use hsqldb already on system.]))
1812 AC_ARG_WITH(hsqldb-jar,
1813     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1814         [Specify path to jarfile manually.]),
1815     HSQLDB_JAR=$withval)
1817 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1818     AS_HELP_STRING([--disable-scripting-beanshell],
1819         [Disable support for scripts in BeanShell.]),
1823 AC_ARG_WITH(system-beanshell,
1824     AS_HELP_STRING([--with-system-beanshell],
1825         [Use beanshell already on system.]),,
1826     [with_system_beanshell="$with_system_jars"])
1828 AC_ARG_WITH(beanshell-jar,
1829     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     BSH_JAR=$withval)
1833 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1834     AS_HELP_STRING([--disable-scripting-javascript],
1835         [Disable support for scripts in JavaScript.]),
1839 AC_ARG_WITH(system-rhino,
1840     AS_HELP_STRING([--with-system-rhino],
1841         [Use rhino already on system.]),,)
1842 #    [with_system_rhino="$with_system_jars"])
1843 # Above is not used as we have different debug interface
1844 # patched into internal rhino. This code needs to be fixed
1845 # before we can enable it by default.
1847 AC_ARG_WITH(rhino-jar,
1848     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     RHINO_JAR=$withval)
1852 AC_ARG_WITH(commons-logging-jar,
1853     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     COMMONS_LOGGING_JAR=$withval)
1857 AC_ARG_WITH(system-jfreereport,
1858     AS_HELP_STRING([--with-system-jfreereport],
1859         [Use JFreeReport already on system.]),,
1860     [with_system_jfreereport="$with_system_jars"])
1862 AC_ARG_WITH(sac-jar,
1863     AS_HELP_STRING([--with-sac-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     SAC_JAR=$withval)
1867 AC_ARG_WITH(libxml-jar,
1868     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBXML_JAR=$withval)
1872 AC_ARG_WITH(flute-jar,
1873     AS_HELP_STRING([--with-flute-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     FLUTE_JAR=$withval)
1877 AC_ARG_WITH(jfreereport-jar,
1878     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     JFREEREPORT_JAR=$withval)
1882 AC_ARG_WITH(liblayout-jar,
1883     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBLAYOUT_JAR=$withval)
1887 AC_ARG_WITH(libloader-jar,
1888     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBLOADER_JAR=$withval)
1892 AC_ARG_WITH(libformula-jar,
1893     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBFORMULA_JAR=$withval)
1897 AC_ARG_WITH(librepository-jar,
1898     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBREPOSITORY_JAR=$withval)
1902 AC_ARG_WITH(libfonts-jar,
1903     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBFONTS_JAR=$withval)
1907 AC_ARG_WITH(libserializer-jar,
1908     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBSERIALIZER_JAR=$withval)
1912 AC_ARG_WITH(libbase-jar,
1913     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1914         [Specify path to jarfile manually.]),
1915     LIBBASE_JAR=$withval)
1917 AC_ARG_WITH(system-odbc,
1918     AS_HELP_STRING([--with-system-odbc],
1919         [Use the odbc headers already on system.]),,
1920     [with_system_odbc="auto"])
1922 AC_ARG_WITH(system-sane,
1923     AS_HELP_STRING([--with-system-sane],
1924         [Use sane.h already on system.]),,
1925     [with_system_sane="$with_system_headers"])
1927 AC_ARG_WITH(system-bluez,
1928     AS_HELP_STRING([--with-system-bluez],
1929         [Use bluetooth.h already on system.]),,
1930     [with_system_bluez="$with_system_headers"])
1932 AC_ARG_WITH(system-curl,
1933     AS_HELP_STRING([--with-system-curl],
1934         [Use curl already on system.]),,
1935     [with_system_curl=auto])
1937 AC_ARG_WITH(system-boost,
1938     AS_HELP_STRING([--with-system-boost],
1939         [Use boost already on system.]),,
1940     [with_system_boost="$with_system_headers"])
1942 AC_ARG_WITH(system-glm,
1943     AS_HELP_STRING([--with-system-glm],
1944         [Use glm already on system.]),,
1945     [with_system_glm="$with_system_headers"])
1947 AC_ARG_WITH(system-hunspell,
1948     AS_HELP_STRING([--with-system-hunspell],
1949         [Use libhunspell already on system.]),,
1950     [with_system_hunspell="$with_system_libs"])
1952 libo_FUZZ_ARG_ENABLE(qrcodegen,
1953     AS_HELP_STRING([--disable-qrcodegen],
1954         [Disable use of qrcodegen external library.]))
1956 AC_ARG_WITH(system-qrcodegen,
1957     AS_HELP_STRING([--with-system-qrcodegen],
1958         [Use libqrcodegen already on system.]),,
1959     [with_system_qrcodegen="$with_system_libs"])
1961 AC_ARG_WITH(system-mythes,
1962     AS_HELP_STRING([--with-system-mythes],
1963         [Use mythes already on system.]),,
1964     [with_system_mythes="$with_system_libs"])
1966 AC_ARG_WITH(system-altlinuxhyph,
1967     AS_HELP_STRING([--with-system-altlinuxhyph],
1968         [Use ALTLinuxhyph already on system.]),,
1969     [with_system_altlinuxhyph="$with_system_libs"])
1971 AC_ARG_WITH(system-lpsolve,
1972     AS_HELP_STRING([--with-system-lpsolve],
1973         [Use lpsolve already on system.]),,
1974     [with_system_lpsolve="$with_system_libs"])
1976 AC_ARG_WITH(system-coinmp,
1977     AS_HELP_STRING([--with-system-coinmp],
1978         [Use CoinMP already on system.]),,
1979     [with_system_coinmp="$with_system_libs"])
1981 AC_ARG_WITH(system-liblangtag,
1982     AS_HELP_STRING([--with-system-liblangtag],
1983         [Use liblangtag library already on system.]),,
1984     [with_system_liblangtag="$with_system_libs"])
1986 AC_ARG_WITH(webdav,
1987     AS_HELP_STRING([--with-webdav],
1988         [Specify which library to use for webdav implementation.
1989          Possible values: "neon", "serf", "no". The default value is "neon".
1990          Example: --with-webdav="serf"]),
1991     WITH_WEBDAV=$withval,
1992     WITH_WEBDAV="neon")
1994 AC_ARG_WITH(linker-hash-style,
1995     AS_HELP_STRING([--with-linker-hash-style],
1996         [Use linker with --hash-style=<style> when linking shared objects.
1997          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1998          if supported on the build system, and "sysv" otherwise.]))
2000 AC_ARG_WITH(jdk-home,
2001     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2002         [If you have installed JDK 8 or later on your system please supply the
2003          path here. Note that this is not the location of the java command but the
2004          location of the entire distribution.]),
2007 AC_ARG_WITH(help,
2008     AS_HELP_STRING([--with-help],
2009         [Enable the build of help. There is a special parameter "common" that
2010          can be used to bundle only the common part, .e.g help-specific icons.
2011          This is useful when you build the helpcontent separately.])
2012     [
2013                           Usage:     --with-help    build the old local help
2014                                  --without-help     no local help (default)
2015                                  --with-help=html   build the new HTML local help
2016                                  --with-help=online build the new HTML online help
2017     ],
2020 AC_ARG_WITH(omindex,
2021    AS_HELP_STRING([--with-omindex],
2022         [Enable the support of xapian-omega index for online help.])
2023    [
2024                          Usage: --with-omindex=server prepare the pages for omindex
2025                                 but let xapian-omega be built in server.
2026                                 --with-omindex=noxap do not prepare online pages
2027                                 for xapian-omega
2028   ],
2031 libo_FUZZ_ARG_WITH(java,
2032     AS_HELP_STRING([--with-java=<java command>],
2033         [Specify the name of the Java interpreter command. Typically "java"
2034          which is the default.
2036          To build without support for Java components, applets, accessibility
2037          or the XML filters written in Java, use --without-java or --with-java=no.]),
2038     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2039     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2042 AC_ARG_WITH(jvm-path,
2043     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2044         [Use a specific JVM search path at runtime.
2045          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2048 AC_ARG_WITH(ant-home,
2049     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2050         [If you have installed Apache Ant on your system, please supply the path here.
2051          Note that this is not the location of the Ant binary but the location
2052          of the entire distribution.]),
2055 AC_ARG_WITH(symbol-config,
2056     AS_HELP_STRING([--with-symbol-config],
2057         [Configuration for the crashreport symbol upload]),
2058         [],
2059         [with_symbol_config=no])
2061 AC_ARG_WITH(export-validation,
2062     AS_HELP_STRING([--without-export-validation],
2063         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2064 ,with_export_validation=auto)
2066 AC_ARG_WITH(bffvalidator,
2067     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2068         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2069          Requires installed Microsoft Office Binary File Format Validator.
2070          Note: export-validation (--with-export-validation) is required to be turned on.
2071          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2072 ,with_bffvalidator=no)
2074 libo_FUZZ_ARG_WITH(junit,
2075     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2076         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2077          --without-junit disables those tests. Not relevant in the --without-java case.]),
2078 ,with_junit=yes)
2080 AC_ARG_WITH(hamcrest,
2081     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2082         [Specifies the hamcrest jar file to use for JUnit-based tests.
2083          --without-junit disables those tests. Not relevant in the --without-java case.]),
2084 ,with_hamcrest=yes)
2086 AC_ARG_WITH(perl-home,
2087     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2088         [If you have installed Perl 5 Distribution, on your system, please
2089          supply the path here. Note that this is not the location of the Perl
2090          binary but the location of the entire distribution.]),
2093 libo_FUZZ_ARG_WITH(doxygen,
2094     AS_HELP_STRING(
2095         [--with-doxygen=<absolute path to doxygen executable>],
2096         [Specifies the doxygen executable to use when generating ODK C/C++
2097          documentation. --without-doxygen disables generation of ODK C/C++
2098          documentation. Not relevant in the --disable-odk case.]),
2099 ,with_doxygen=yes)
2101 AC_ARG_WITH(visual-studio,
2102     AS_HELP_STRING([--with-visual-studio=<2017>],
2103         [Specify which Visual Studio version to use in case several are
2104          installed. Currently only 2017 is supported.]),
2107 AC_ARG_WITH(windows-sdk,
2108     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2109         [Specify which Windows SDK, or "Windows Kit", version to use
2110          in case the one that came with the selected Visual Studio
2111          is not what you want for some reason. Note that not all compiler/SDK
2112          combinations are supported. The intent is that this option should not
2113          be needed.]),
2116 AC_ARG_WITH(lang,
2117     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2118         [Use this option to build LibreOffice with additional UI language support.
2119          English (US) is always included by default.
2120          Separate multiple languages with space.
2121          For all languages, use --with-lang=ALL.]),
2124 AC_ARG_WITH(locales,
2125     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2126         [Use this option to limit the locale information built in.
2127          Separate multiple locales with space.
2128          Very experimental and might well break stuff.
2129          Just a desperate measure to shrink code and data size.
2130          By default all the locales available is included.
2131          This option is completely unrelated to --with-lang.])
2132     [
2133                           Affects also our character encoding conversion
2134                           tables for encodings mainly targeted for a
2135                           particular locale, like EUC-CN and EUC-TW for
2136                           zh, ISO-2022-JP for ja.
2138                           Affects also our add-on break iterator data for
2139                           some languages.
2141                           For the default, all locales, don't use this switch at all.
2142                           Specifying just the language part of a locale means all matching
2143                           locales will be included.
2144     ],
2147 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2148 libo_FUZZ_ARG_WITH(krb5,
2149     AS_HELP_STRING([--with-krb5],
2150         [Enable MIT Kerberos 5 support in modules that support it.
2151          By default automatically enabled on platforms
2152          where a good system Kerberos 5 is available.]),
2155 libo_FUZZ_ARG_WITH(gssapi,
2156     AS_HELP_STRING([--with-gssapi],
2157         [Enable GSSAPI support in modules that support it.
2158          By default automatically enabled on platforms
2159          where a good system GSSAPI is available.]),
2162 AC_ARG_WITH(iwyu,
2163     AS_HELP_STRING([--with-iwyu],
2164         [Use given IWYU binary path to check unneeded includes instead of building.
2165          Use only if you are hacking on it.]),
2168 libo_FUZZ_ARG_WITH(lxml,
2169     AS_HELP_STRING([--without-lxml],
2170         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2171          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2172          report widget classes and ids.]),
2175 libo_FUZZ_ARG_WITH(latest-c++,
2176     AS_HELP_STRING([--with-latest-c++],
2177         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2178          published standard.]),,
2179         [with_latest_c__=no])
2181 dnl ===================================================================
2182 dnl Branding
2183 dnl ===================================================================
2185 AC_ARG_WITH(branding,
2186     AS_HELP_STRING([--with-branding=/path/to/images],
2187         [Use given path to retrieve branding images set.])
2188     [
2189                           Search for intro.png about.svg and flat_logo.svg.
2190                           If any is missing, default ones will be used instead.
2192                           Search also progress.conf for progress
2193                           settings on intro screen :
2195                           PROGRESSBARCOLOR="255,255,255" Set color of
2196                           progress bar. Comma separated RGB decimal values.
2197                           PROGRESSSIZE="407,6" Set size of progress bar.
2198                           Comma separated decimal values (width, height).
2199                           PROGRESSPOSITION="61,317" Set position of progress
2200                           bar from left,top. Comma separated decimal values.
2201                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2202                           bar frame. Comma separated RGB decimal values.
2203                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2204                           bar text. Comma separated RGB decimal values.
2205                           PROGRESSTEXTBASELINE="287" Set vertical position of
2206                           progress bar text from top. Decimal value.
2208                           Default values will be used if not found.
2209     ],
2213 AC_ARG_WITH(extra-buildid,
2214     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2215         [Show addition build identification in about dialog.]),
2219 AC_ARG_WITH(vendor,
2220     AS_HELP_STRING([--with-vendor="John the Builder"],
2221         [Set vendor of the build.]),
2224 AC_ARG_WITH(android-package-name,
2225     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2226         [Set Android package name of the build.]),
2229 AC_ARG_WITH(compat-oowrappers,
2230     AS_HELP_STRING([--with-compat-oowrappers],
2231         [Install oo* wrappers in parallel with
2232          lo* ones to keep backward compatibility.
2233          Has effect only with make distro-pack-install]),
2236 AC_ARG_WITH(os-version,
2237     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2238         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2241 AC_ARG_WITH(mingw-cross-compiler,
2242     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2243         [Specify the MinGW cross-compiler to use.
2244          When building on the ODK on Unix and building unowinreg.dll,
2245          specify the MinGW C++ cross-compiler.]),
2248 AC_ARG_WITH(idlc-cpp,
2249     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2250         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2253 AC_ARG_WITH(build-version,
2254     AS_HELP_STRING([--with-build-version="Built by Jim"],
2255         [Allows the builder to add a custom version tag that will appear in the
2256          Help/About box for QA purposes.]),
2257 with_build_version=$withval,
2260 AC_ARG_WITH(parallelism,
2261     AS_HELP_STRING([--with-parallelism],
2262         [Number of jobs to run simultaneously during build. Parallel builds can
2263         save a lot of time on multi-cpu machines. Defaults to the number of
2264         CPUs on the machine, unless you configure --enable-icecream - then to
2265         40.]),
2268 AC_ARG_WITH(all-tarballs,
2269     AS_HELP_STRING([--with-all-tarballs],
2270         [Download all external tarballs unconditionally]))
2272 AC_ARG_WITH(gdrive-client-id,
2273     AS_HELP_STRING([--with-gdrive-client-id],
2274         [Provides the client id of the application for OAuth2 authentication
2275         on Google Drive. If either this or --with-gdrive-client-secret is
2276         empty, the feature will be disabled]),
2279 AC_ARG_WITH(gdrive-client-secret,
2280     AS_HELP_STRING([--with-gdrive-client-secret],
2281         [Provides the client secret of the application for OAuth2
2282         authentication on Google Drive. If either this or
2283         --with-gdrive-client-id is empty, the feature will be disabled]),
2286 AC_ARG_WITH(alfresco-cloud-client-id,
2287     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2288         [Provides the client id of the application for OAuth2 authentication
2289         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2290         empty, the feature will be disabled]),
2293 AC_ARG_WITH(alfresco-cloud-client-secret,
2294     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2295         [Provides the client secret of the application for OAuth2
2296         authentication on Alfresco Cloud. If either this or
2297         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2300 AC_ARG_WITH(onedrive-client-id,
2301     AS_HELP_STRING([--with-onedrive-client-id],
2302         [Provides the client id of the application for OAuth2 authentication
2303         on OneDrive. If either this or --with-onedrive-client-secret is
2304         empty, the feature will be disabled]),
2307 AC_ARG_WITH(onedrive-client-secret,
2308     AS_HELP_STRING([--with-onedrive-client-secret],
2309         [Provides the client secret of the application for OAuth2
2310         authentication on OneDrive. If either this or
2311         --with-onedrive-client-id is empty, the feature will be disabled]),
2313 dnl ===================================================================
2314 dnl Do we want to use pre-build binary tarball for recompile
2315 dnl ===================================================================
2317 if test "$enable_library_bin_tar" = "yes" ; then
2318     USE_LIBRARY_BIN_TAR=TRUE
2319 else
2320     USE_LIBRARY_BIN_TAR=
2322 AC_SUBST(USE_LIBRARY_BIN_TAR)
2324 dnl ===================================================================
2325 dnl Test whether build target is Release Build
2326 dnl ===================================================================
2327 AC_MSG_CHECKING([whether build target is Release Build])
2328 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2329     AC_MSG_RESULT([no])
2330     ENABLE_RELEASE_BUILD=
2331 else
2332     AC_MSG_RESULT([yes])
2333     ENABLE_RELEASE_BUILD=TRUE
2335 AC_SUBST(ENABLE_RELEASE_BUILD)
2337 dnl ===================================================================
2338 dnl Test whether to sign Windows Build
2339 dnl ===================================================================
2340 AC_MSG_CHECKING([whether to sign windows build])
2341 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2342     AC_MSG_RESULT([yes])
2343     WINDOWS_BUILD_SIGNING="TRUE"
2344 else
2345     AC_MSG_RESULT([no])
2346     WINDOWS_BUILD_SIGNING="FALSE"
2348 AC_SUBST(WINDOWS_BUILD_SIGNING)
2350 dnl ===================================================================
2351 dnl MacOSX build and runtime environment options
2352 dnl ===================================================================
2354 AC_ARG_WITH(macosx-sdk,
2355     AS_HELP_STRING([--with-macosx-sdk=<version>],
2356         [Prefer a specific SDK for building.])
2357     [
2358                           If the requested SDK is not available, a search for the oldest one will be done.
2359                           With current Xcode versions, only the latest SDK is included, so this option is
2360                           not terribly useful. It works fine to build with a new SDK and run the result
2361                           on an older OS.
2363                           e. g.: --with-macosx-sdk=10.10
2365                           there are 3 options to control the MacOSX build:
2366                           --with-macosx-sdk (referred as 'sdk' below)
2367                           --with-macosx-version-min-required (referred as 'min' below)
2368                           --with-macosx-version-max-allowed (referred as 'max' below)
2370                           the connection between these value and the default they take is as follow:
2371                           ( ? means not specified on the command line, s means the SDK version found,
2372                           constraint: 8 <= x <= y <= z)
2374                           ==========================================
2375                            command line      || config result
2376                           ==========================================
2377                           min  | max  | sdk  || min   | max  | sdk  |
2378                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2379                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2380                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2381                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2382                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2383                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2384                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2385                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2388                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2389                           for a detailed technical explanation of these variables
2391                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2392     ],
2395 AC_ARG_WITH(macosx-version-min-required,
2396     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2397         [set the minimum OS version needed to run the built LibreOffice])
2398     [
2399                           e. g.: --with-macos-version-min-required=10.10
2400                           see --with-macosx-sdk for more info
2401     ],
2404 AC_ARG_WITH(macosx-version-max-allowed,
2405     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2406         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2407     [
2408                           e. g.: --with-macos-version-max-allowed=10.10
2409                           see --with-macosx-sdk for more info
2410     ],
2414 dnl ===================================================================
2415 dnl options for stuff used during cross-compilation build
2416 dnl Not quite superseded by --with-build-platform-configure-options.
2417 dnl TODO: check, if the "force" option is still needed anywhere.
2418 dnl ===================================================================
2420 AC_ARG_WITH(system-icu-for-build,
2421     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2422         [Use icu already on system for build tools (cross-compilation only).]))
2425 dnl ===================================================================
2426 dnl Check for incompatible options set by fuzzing, and reset those
2427 dnl automatically to working combinations
2428 dnl ===================================================================
2430 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2431         "$enable_dbus" != "$enable_avahi"; then
2432     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2433     enable_avahi=$enable_dbus
2436 add_lopath_after ()
2438     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2439         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2440     fi
2443 add_lopath_before ()
2445     local IFS=${P_SEP}
2446     local path_cleanup
2447     local dir
2448     for dir in $LO_PATH ; do
2449         if test "$dir" != "$1" ; then
2450             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2451         fi
2452     done
2453     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2456 dnl ===================================================================
2457 dnl check for required programs (grep, awk, sed, bash)
2458 dnl ===================================================================
2460 pathmunge ()
2462     if test -n "$1"; then
2463         if test "$build_os" = "cygwin"; then
2464             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2465                 PathFormat "$1"
2466                 new_path=`cygpath -sm "$formatted_path"`
2467             else
2468                 PathFormat "$1"
2469                 new_path=`cygpath -u "$formatted_path"`
2470             fi
2471         else
2472             new_path="$1"
2473         fi
2474         if test "$2" = "after"; then
2475             add_lopath_after "$new_path"
2476         else
2477             add_lopath_before "$new_path"
2478         fi
2479         unset new_path
2480     fi
2483 AC_PROG_AWK
2484 AC_PATH_PROG( AWK, $AWK)
2485 if test -z "$AWK"; then
2486     AC_MSG_ERROR([install awk to run this script])
2489 AC_PATH_PROG(BASH, bash)
2490 if test -z "$BASH"; then
2491     AC_MSG_ERROR([bash not found in \$PATH])
2493 AC_SUBST(BASH)
2495 AC_MSG_CHECKING([for GNU or BSD tar])
2496 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2497     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2498     if test $? -eq 0;  then
2499         GNUTAR=$a
2500         break
2501     fi
2502 done
2503 AC_MSG_RESULT($GNUTAR)
2504 if test -z "$GNUTAR"; then
2505     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2507 AC_SUBST(GNUTAR)
2509 AC_MSG_CHECKING([for tar's option to strip components])
2510 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2511 if test $? -eq 0; then
2512     STRIP_COMPONENTS="--strip-components"
2513 else
2514     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2515     if test $? -eq 0; then
2516         STRIP_COMPONENTS="--strip-path"
2517     else
2518         STRIP_COMPONENTS="unsupported"
2519     fi
2521 AC_MSG_RESULT($STRIP_COMPONENTS)
2522 if test x$STRIP_COMPONENTS = xunsupported; then
2523     AC_MSG_ERROR([you need a tar that is able to strip components.])
2525 AC_SUBST(STRIP_COMPONENTS)
2527 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2528 dnl desktop OSes from "mobile" ones.
2530 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2531 dnl In other words, that when building for an OS that is not a
2532 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2534 dnl Note the direction of the implication; there is no assumption that
2535 dnl cross-compiling would imply a non-desktop OS.
2537 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2538     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2539     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2540     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2543 # Whether to build "avmedia" functionality or not.
2545 if test -z "$enable_avmedia"; then
2546     enable_avmedia=yes
2549 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2550 if test "$enable_avmedia" = yes; then
2551     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2552 else
2553     USE_AVMEDIA_DUMMY='TRUE'
2555 AC_SUBST(USE_AVMEDIA_DUMMY)
2557 # Decide whether to build database connectivity stuff (including
2558 # Base) or not. We probably don't want to on non-desktop OSes.
2559 if test -z "$enable_database_connectivity"; then
2560     # --disable-database-connectivity is unfinished work in progress
2561     # and the iOS test app doesn't link if we actually try to use it.
2562     # if test $_os != iOS -a $_os != Android; then
2563     if test $_os != iOS; then
2564         enable_database_connectivity=yes
2565     fi
2568 if test "$enable_database_connectivity" = yes; then
2569     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2570     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2573 if test -z "$enable_extensions"; then
2574     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2575     if test $_os != iOS; then
2576         enable_extensions=yes
2577     fi
2580 if test "$enable_extensions" = yes; then
2581     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2582     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2585 if test -z "$enable_scripting"; then
2586     # Disable scripting for iOS unless specifically overridden
2587     # with --enable-scripting.
2588     if test $_os != iOS; then
2589         enable_scripting=yes
2590     fi
2593 DISABLE_SCRIPTING=''
2594 if test "$enable_scripting" = yes; then
2595     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2596     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2597 else
2598     DISABLE_SCRIPTING='TRUE'
2599     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2602 if test $_os = iOS -o $_os = Android; then
2603     # Disable dynamic_loading always for iOS and Android
2604     enable_dynamic_loading=no
2605 elif test -z "$enable_dynamic_loading"; then
2606     # Otherwise enable it unless specifically disabled
2607     enable_dynamic_loading=yes
2610 DISABLE_DYNLOADING=''
2611 if test "$enable_dynamic_loading" = yes; then
2612     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2613 else
2614     DISABLE_DYNLOADING='TRUE'
2616 AC_SUBST(DISABLE_DYNLOADING)
2618 # remember SYSBASE value
2619 AC_SUBST(SYSBASE)
2621 dnl ===================================================================
2622 dnl  Sort out various gallery compilation options
2623 dnl ===================================================================
2624 AC_MSG_CHECKING([how to build and package galleries])
2625 if test -n "${with_galleries}"; then
2626     if test "$with_galleries" = "build"; then
2627         WITH_GALLERY_BUILD=TRUE
2628         AC_MSG_RESULT([build from source images internally])
2629     elif test "$with_galleries" = "no"; then
2630         WITH_GALLERY_BUILD=
2631         AC_MSG_RESULT([disable non-internal gallery build])
2632     else
2633         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2634     fi
2635 else
2636     if test $_os != iOS -a $_os != Android; then
2637         WITH_GALLERY_BUILD=TRUE
2638         AC_MSG_RESULT([internal src images for desktop])
2639     else
2640         WITH_GALLERY_BUILD=
2641         AC_MSG_RESULT([disable src image build])
2642     fi
2644 AC_SUBST(WITH_GALLERY_BUILD)
2646 dnl ===================================================================
2647 dnl  Checks if ccache is available
2648 dnl ===================================================================
2649 CCACHE_DEPEND_MODE=
2650 if test "$_os" = "WINNT"; then
2651     # on windows/VC build do not use ccache
2652     CCACHE=""
2653 elif test "$enable_ccache" = "no"; then
2654     CCACHE=""
2655 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2656     case "%$CC%$CXX%" in
2657     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2658     # assume that's good then
2659     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2660         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2661         CCACHE_DEPEND_MODE=1
2662         ;;
2663     *)
2664         AC_PATH_PROG([CCACHE],[ccache],[not found])
2665         if test "$CCACHE" = "not found"; then
2666             CCACHE=""
2667         else
2668             CCACHE_DEPEND_MODE=1
2669             # Need to check for ccache version: otherwise prevents
2670             # caching of the results (like "-x objective-c++" for Mac)
2671             if test $_os = Darwin -o $_os = iOS; then
2672                 # Check ccache version
2673                 AC_MSG_CHECKING([whether version of ccache is suitable])
2674                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2675                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2676                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2677                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2678                 else
2679                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2680                     CCACHE=""
2681                     CCACHE_DEPEND_MODE=
2682                 fi
2683             fi
2684         fi
2685         ;;
2686     esac
2687 else
2688     CCACHE=""
2690 if test "$enable_ccache" = "nodepend"; then
2691     CCACHE_DEPEND_MODE=""
2693 AC_SUBST(CCACHE_DEPEND_MODE)
2695 if test "$CCACHE" != ""; then
2696     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2697     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2698     if test "$ccache_size" = ""; then
2699         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2700         if test "$ccache_size" = ""; then
2701             ccache_size=0
2702         fi
2703         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2704         if test $ccache_size -lt 1024; then
2705             CCACHE=""
2706             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2707             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2708         else
2709             # warn that ccache may be too small for debug build
2710             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2711             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2712         fi
2713     else
2714         if test $ccache_size -lt 5; then
2715             #warn that ccache may be too small for debug build
2716             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2717             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2718         fi
2719     fi
2722 dnl ===================================================================
2723 dnl  Checks for C compiler,
2724 dnl  The check for the C++ compiler is later on.
2725 dnl ===================================================================
2726 if test "$_os" != "WINNT"; then
2727     GCC_HOME_SET="true"
2728     AC_MSG_CHECKING([gcc home])
2729     if test -z "$with_gcc_home"; then
2730         if test "$enable_icecream" = "yes"; then
2731             if test -d "/usr/lib/icecc/bin"; then
2732                 GCC_HOME="/usr/lib/icecc/"
2733             elif test -d "/usr/libexec/icecc/bin"; then
2734                 GCC_HOME="/usr/libexec/icecc/"
2735             elif test -d "/opt/icecream/bin"; then
2736                 GCC_HOME="/opt/icecream/"
2737             else
2738                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2740             fi
2741         else
2742             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2743             GCC_HOME_SET="false"
2744         fi
2745     else
2746         GCC_HOME="$with_gcc_home"
2747     fi
2748     AC_MSG_RESULT($GCC_HOME)
2749     AC_SUBST(GCC_HOME)
2751     if test "$GCC_HOME_SET" = "true"; then
2752         if test -z "$CC"; then
2753             CC="$GCC_HOME/bin/gcc"
2754             CC_BASE="gcc"
2755         fi
2756         if test -z "$CXX"; then
2757             CXX="$GCC_HOME/bin/g++"
2758             CXX_BASE="g++"
2759         fi
2760     fi
2763 COMPATH=`dirname "$CC"`
2764 if test "$COMPATH" = "."; then
2765     AC_PATH_PROGS(COMPATH, $CC)
2766     dnl double square bracket to get single because of M4 quote...
2767     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2769 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2771 dnl ===================================================================
2772 dnl Java support
2773 dnl ===================================================================
2774 AC_MSG_CHECKING([whether to build with Java support])
2775 if test "$with_java" != "no"; then
2776     if test "$DISABLE_SCRIPTING" = TRUE; then
2777         AC_MSG_RESULT([no, overridden by --disable-scripting])
2778         ENABLE_JAVA=""
2779         with_java=no
2780     else
2781         AC_MSG_RESULT([yes])
2782         ENABLE_JAVA="TRUE"
2783         AC_DEFINE(HAVE_FEATURE_JAVA)
2784     fi
2785 else
2786     AC_MSG_RESULT([no])
2787     ENABLE_JAVA=""
2790 AC_SUBST(ENABLE_JAVA)
2792 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2794 dnl ENABLE_JAVA="" indicate no Java support at all
2796 dnl ===================================================================
2797 dnl Check macOS SDK and compiler
2798 dnl ===================================================================
2800 HAVE_MACOS_LD_PLATFORMVERSION=
2801 if test $_os = Darwin; then
2803     # If no --with-macosx-sdk option is given, look for one
2805     # The intent is that for "most" Mac-based developers, a suitable
2806     # SDK will be found automatically without any configure options.
2808     # For developers with a current Xcode, the lowest-numbered SDK
2809     # higher than or equal to the minimum required should be found.
2811     AC_MSG_CHECKING([what macOS SDK to use])
2812     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2813         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2814         if test -d "$MACOSX_SDK_PATH"; then
2815             with_macosx_sdk="${_macosx_sdk}"
2816             break
2817         else
2818             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2819             if test -d "$MACOSX_SDK_PATH"; then
2820                 with_macosx_sdk="${_macosx_sdk}"
2821                 break
2822             fi
2823         fi
2824     done
2825     if test ! -d "$MACOSX_SDK_PATH"; then
2826         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2827     fi
2829     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2831     case $with_macosx_sdk in
2832     10.12)
2833         MACOSX_SDK_VERSION=101200
2834         ;;
2835     10.13)
2836         MACOSX_SDK_VERSION=101300
2837         ;;
2838     10.14)
2839         MACOSX_SDK_VERSION=101400
2840         ;;
2841     10.15)
2842         MACOSX_SDK_VERSION=101500
2843         ;;
2844     *)
2845         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2846         ;;
2847     esac
2849     if test "$with_macosx_version_min_required" = "" ; then
2850         with_macosx_version_min_required="10.10";
2851     fi
2853     if test "$with_macosx_version_max_allowed" = "" ; then
2854         with_macosx_version_max_allowed="$with_macosx_sdk"
2855     fi
2857     # export this so that "xcrun" invocations later return matching values
2858     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2859     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2860     export DEVELOPER_DIR
2861     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2862     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2864     AC_MSG_CHECKING([whether Xcode is new enough])
2865     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2866     my_xcode_ver2=${my_xcode_ver1#Xcode }
2867     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2868     if test "$my_xcode_ver3" -ge 903; then
2869         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2870     else
2871         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2872     fi
2874     case "$with_macosx_version_min_required" in
2875     10.10)
2876         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2877         ;;
2878     10.11)
2879         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2880         ;;
2881     10.12)
2882         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2883         ;;
2884     10.13)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2886         ;;
2887     10.14)
2888         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2889         ;;
2890     10.15)
2891         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2892         ;;
2893     *)
2894         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2895         ;;
2896     esac
2897     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2899     LIBTOOL=/usr/bin/libtool
2900     INSTALL_NAME_TOOL=install_name_tool
2901     if test -z "$save_CC"; then
2902         stdlib=-stdlib=libc++
2903         if test "$ENABLE_LTO" = TRUE; then
2904             lto=-flto
2905         fi
2907         AC_MSG_CHECKING([what C compiler to use])
2908         CC="`xcrun -find clang`"
2909         CC_BASE=`first_arg_basename "$CC"`
2910         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2911         AC_MSG_RESULT([$CC])
2913         AC_MSG_CHECKING([what C++ compiler to use])
2914         CXX="`xcrun -find clang++`"
2915         CXX_BASE=`first_arg_basename "$CXX"`
2916         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2917         AC_MSG_RESULT([$CXX])
2919         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2920         AR=`xcrun -find ar`
2921         NM=`xcrun -find nm`
2922         STRIP=`xcrun -find strip`
2923         LIBTOOL=`xcrun -find libtool`
2924         RANLIB=`xcrun -find ranlib`
2925     fi
2927     case "$with_macosx_version_max_allowed" in
2928     10.10)
2929         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2930         ;;
2931     10.11)
2932         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2933         ;;
2934     10.12)
2935         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2936         ;;
2937     10.13)
2938         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2939         ;;
2940     10.14)
2941         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2942         ;;
2943     10.15)
2944         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2945         ;;
2946     *)
2947         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2948         ;;
2949     esac
2951     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2952     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2953         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])
2954     else
2955         AC_MSG_RESULT([ok])
2956     fi
2958     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2959     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2960         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2961     else
2962         AC_MSG_RESULT([ok])
2963     fi
2964     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2965     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2967     AC_MSG_CHECKING([whether to do code signing])
2969     if test "$enable_macosx_code_signing" = yes; then
2970         # By default use the first suitable certificate (?).
2972         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2973         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2974         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2975         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2976         # "Developer ID Application" one.
2978         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2979         if test -n "$identity"; then
2980             MACOSX_CODESIGNING_IDENTITY=$identity
2981             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2982             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2983         else
2984             AC_MSG_ERROR([cannot determine identity to use])
2985         fi
2986     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2987         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2988         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2989         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2990     else
2991         AC_MSG_RESULT([no])
2992     fi
2994     AC_MSG_CHECKING([whether to create a Mac App Store package])
2996     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2997         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2998     elif test "$enable_macosx_package_signing" = yes; then
2999         # By default use the first suitable certificate.
3000         # It should be a "3rd Party Mac Developer Installer" one
3002         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3003         if test -n "$identity"; then
3004             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3005             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3006             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3007         else
3008             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3009         fi
3010     elif test -n "$enable_macosx_package_signing"; then
3011         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3012         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3013         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3014     else
3015         AC_MSG_RESULT([no])
3016     fi
3018     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3019         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3020     fi
3022     AC_MSG_CHECKING([whether to sandbox the application])
3024     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3025         AC_MSG_ERROR([macOS sandboxing requires code signing])
3026     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3027         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3028     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3029         ENABLE_MACOSX_SANDBOX=TRUE
3030         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3031         AC_MSG_RESULT([yes])
3032     else
3033         AC_MSG_RESULT([no])
3034     fi
3036     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3037     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3038     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3040     AC_MSG_CHECKING([whether the linker supports -platform_version])
3041     save_LDFLAGS=$LDFLAGS
3042     LDFLAGS="$LDFLAGS -Xlinker -platform_version -Xlinker macos \
3043         -Xlinker $MAC_OS_X_VERSION_MIN_REQUIRED_DOTS -Xlinker 0.0.0"
3044     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
3045         [AC_MSG_RESULT([yes])
3046          HAVE_MACOS_LD_PLATFORMVERSION=TRUE],
3047         [AC_MSG_RESULT([no])])
3048     LDFLAGS=$save_LDFLAGS
3050 AC_SUBST(MACOSX_SDK_PATH)
3051 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3052 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3053 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
3054 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3055 AC_SUBST(INSTALL_NAME_TOOL)
3056 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3057 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3058 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3059 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3060 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3061 AC_SUBST(HAVE_MACOS_LD_PLATFORMVERSION)
3063 dnl ===================================================================
3064 dnl Check iOS SDK and compiler
3065 dnl ===================================================================
3067 if test $_os = iOS; then
3068     AC_MSG_CHECKING([what iOS SDK to use])
3069     current_sdk_ver=14.1
3070     older_sdk_vers="14.0 13.7 13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3071     if test "$enable_ios_simulator" = "yes"; then
3072         platform=iPhoneSimulator
3073         versionmin=-mios-simulator-version-min=12.2
3074     else
3075         platform=iPhoneOS
3076         versionmin=-miphoneos-version-min=12.2
3077     fi
3078     xcode_developer=`xcode-select -print-path`
3080     for sdkver in $current_sdk_ver $older_sdk_vers; do
3081         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3082         if test -d $t; then
3083             sysroot=$t
3084             break
3085         fi
3086     done
3088     if test -z "$sysroot"; then
3089         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3090     fi
3092     AC_MSG_RESULT($sysroot)
3094     # LTO is not really recommended for iOS builds,
3095     # the link time will be astronomical
3096     if test "$ENABLE_LTO" = TRUE; then
3097         lto=-flto
3098     fi
3100     stdlib="-stdlib=libc++"
3102     AC_MSG_CHECKING([what C compiler to use])
3103     CC="`xcrun -find clang`"
3104     CC_BASE=`first_arg_basename "$CC"`
3105     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3106     AC_MSG_RESULT([$CC])
3108     AC_MSG_CHECKING([what C++ compiler to use])
3109     CXX="`xcrun -find clang++`"
3110     CXX_BASE=`first_arg_basename "$CXX"`
3111     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3112     AC_MSG_RESULT([$CXX])
3114     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3115     AR=`xcrun -find ar`
3116     NM=`xcrun -find nm`
3117     STRIP=`xcrun -find strip`
3118     LIBTOOL=`xcrun -find libtool`
3119     RANLIB=`xcrun -find ranlib`
3122 AC_MSG_CHECKING([whether to treat the installation as read-only])
3124 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3125         "$enable_extensions" != yes; then
3126     enable_readonly_installset=yes
3128 if test "$enable_readonly_installset" = yes; then
3129     AC_MSG_RESULT([yes])
3130     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3131 else
3132     AC_MSG_RESULT([no])
3135 dnl ===================================================================
3136 dnl Structure of install set
3137 dnl ===================================================================
3139 if test $_os = Darwin; then
3140     LIBO_BIN_FOLDER=MacOS
3141     LIBO_ETC_FOLDER=Resources
3142     LIBO_LIBEXEC_FOLDER=MacOS
3143     LIBO_LIB_FOLDER=Frameworks
3144     LIBO_LIB_PYUNO_FOLDER=Resources
3145     LIBO_SHARE_FOLDER=Resources
3146     LIBO_SHARE_HELP_FOLDER=Resources/help
3147     LIBO_SHARE_JAVA_FOLDER=Resources/java
3148     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3149     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3150     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3151     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3152     LIBO_URE_BIN_FOLDER=MacOS
3153     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3154     LIBO_URE_LIB_FOLDER=Frameworks
3155     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3156     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3157 elif test $_os = WINNT; then
3158     LIBO_BIN_FOLDER=program
3159     LIBO_ETC_FOLDER=program
3160     LIBO_LIBEXEC_FOLDER=program
3161     LIBO_LIB_FOLDER=program
3162     LIBO_LIB_PYUNO_FOLDER=program
3163     LIBO_SHARE_FOLDER=share
3164     LIBO_SHARE_HELP_FOLDER=help
3165     LIBO_SHARE_JAVA_FOLDER=program/classes
3166     LIBO_SHARE_PRESETS_FOLDER=presets
3167     LIBO_SHARE_READMES_FOLDER=readmes
3168     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3169     LIBO_SHARE_SHELL_FOLDER=program/shell
3170     LIBO_URE_BIN_FOLDER=program
3171     LIBO_URE_ETC_FOLDER=program
3172     LIBO_URE_LIB_FOLDER=program
3173     LIBO_URE_MISC_FOLDER=program
3174     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3175 else
3176     LIBO_BIN_FOLDER=program
3177     LIBO_ETC_FOLDER=program
3178     LIBO_LIBEXEC_FOLDER=program
3179     LIBO_LIB_FOLDER=program
3180     LIBO_LIB_PYUNO_FOLDER=program
3181     LIBO_SHARE_FOLDER=share
3182     LIBO_SHARE_HELP_FOLDER=help
3183     LIBO_SHARE_JAVA_FOLDER=program/classes
3184     LIBO_SHARE_PRESETS_FOLDER=presets
3185     LIBO_SHARE_READMES_FOLDER=readmes
3186     if test "$enable_fuzzers" != yes; then
3187         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3188     else
3189         LIBO_SHARE_RESOURCE_FOLDER=resource
3190     fi
3191     LIBO_SHARE_SHELL_FOLDER=program/shell
3192     LIBO_URE_BIN_FOLDER=program
3193     LIBO_URE_ETC_FOLDER=program
3194     LIBO_URE_LIB_FOLDER=program
3195     LIBO_URE_MISC_FOLDER=program
3196     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3198 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3199 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3200 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3201 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3207 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3208 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3209 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3210 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3211 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3212 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3213 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3215 # Not all of them needed in config_host.mk, add more if need arises
3216 AC_SUBST(LIBO_BIN_FOLDER)
3217 AC_SUBST(LIBO_ETC_FOLDER)
3218 AC_SUBST(LIBO_LIB_FOLDER)
3219 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3220 AC_SUBST(LIBO_SHARE_FOLDER)
3221 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3222 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3223 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3224 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3225 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3226 AC_SUBST(LIBO_URE_BIN_FOLDER)
3227 AC_SUBST(LIBO_URE_ETC_FOLDER)
3228 AC_SUBST(LIBO_URE_LIB_FOLDER)
3229 AC_SUBST(LIBO_URE_MISC_FOLDER)
3230 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3232 dnl ===================================================================
3233 dnl Windows specific tests and stuff
3234 dnl ===================================================================
3236 reg_get_value()
3238     # Return value: $regvalue
3239     unset regvalue
3241     local _regentry="/proc/registry${1}/${2}"
3242     if test -f "$_regentry"; then
3243         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3244         # Registry keys read via /proc/registry* are always \0 terminated!
3245         local _regvalue=$(tr -d '\0' < "$_regentry")
3246         if test $? -eq 0; then
3247             regvalue=$_regvalue
3248         fi
3249     fi
3252 # Get a value from the 32-bit side of the Registry
3253 reg_get_value_32()
3255     reg_get_value "32" "$1"
3258 # Get a value from the 64-bit side of the Registry
3259 reg_get_value_64()
3261     reg_get_value "64" "$1"
3264 if test "$_os" = "WINNT"; then
3265     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3266     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3267         AC_MSG_RESULT([no])
3268         WINDOWS_SDK_ARCH="x86"
3269     else
3270         AC_MSG_RESULT([yes])
3271         WINDOWS_SDK_ARCH="x64"
3272         BITNESS_OVERRIDE=64
3273     fi
3275 AC_SUBST(WINDOWS_SDK_ARCH)
3276 if test "$_os" = "iOS"; then
3277     cross_compiling="yes"
3280 if test "$cross_compiling" = "yes"; then
3281     export CROSS_COMPILING=TRUE
3282 else
3283     CROSS_COMPILING=
3284     BUILD_TYPE="$BUILD_TYPE NATIVE"
3286 AC_SUBST(CROSS_COMPILING)
3288 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3289 # NOTE: must _not_ be used for bundled external libraries!
3290 ISYSTEM=
3291 if test "$GCC" = "yes"; then
3292     AC_MSG_CHECKING( for -isystem )
3293     save_CFLAGS=$CFLAGS
3294     CFLAGS="$CFLAGS -Werror"
3295     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3296     CFLAGS=$save_CFLAGS
3297     if test -n "$ISYSTEM"; then
3298         AC_MSG_RESULT(yes)
3299     else
3300         AC_MSG_RESULT(no)
3301     fi
3303 if test -z "$ISYSTEM"; then
3304     # fall back to using -I
3305     ISYSTEM=-I
3307 AC_SUBST(ISYSTEM)
3309 dnl ===================================================================
3310 dnl  Check which Visual Studio compiler is used
3311 dnl ===================================================================
3313 map_vs_year_to_version()
3315     # Return value: $vsversion
3317     unset vsversion
3319     case $1 in
3320     2017)
3321         vsversion=15;;
3322     2019)
3323         vsversion=16;;
3324     *)
3325         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3326     esac
3329 vs_versions_to_check()
3331     # Args: $1 (optional) : versions to check, in the order of preference
3332     # Return value: $vsversions
3334     unset vsversions
3336     if test -n "$1"; then
3337         map_vs_year_to_version "$1"
3338         vsversions=$vsversion
3339     else
3340         # We accept only 2017
3341         vsversions="15"
3342     fi
3345 win_get_env_from_vsvars32bat()
3347     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3348     # Also seems to be located in another directory under the same name: vsvars32.bat
3349     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3350     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3351     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3352     chmod +x $WRAPPERBATCHFILEPATH
3353     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3354     rm -f $WRAPPERBATCHFILEPATH
3355     printf '%s' "$_win_get_env_from_vsvars32bat"
3358 find_ucrt()
3360     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3361     if test -n "$regvalue"; then
3362         PathFormat "$regvalue"
3363         UCRTSDKDIR=$formatted_path
3364         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3365         UCRTVERSION=$regvalue
3366         # Rest if not exist
3367         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3368           UCRTSDKDIR=
3369         fi
3370     fi
3371     if test -z "$UCRTSDKDIR"; then
3372         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3373         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3374         if test -f "$ide_env_file"; then
3375             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3376             UCRTSDKDIR=$formatted_path
3377             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3378             dnl Hack needed at least by tml:
3379             if test "$UCRTVERSION" = 10.0.15063.0 \
3380                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3381                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3382             then
3383                 UCRTVERSION=10.0.14393.0
3384             fi
3385         else
3386           AC_MSG_ERROR([No UCRT found])
3387         fi
3388     fi
3391 find_msvc()
3393     # Find Visual C++ 2017/2019
3394     # Args: $1 (optional) : The VS version year
3395     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3397     unset vctest vcnum vcnumwithdot vcbuildnumber
3399     vs_versions_to_check "$1"
3400     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3401     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3402     PathFormat "$vswhere"
3403     vswhere=$formatted_path
3404     for ver in $vsversions; do
3405         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3406         if test -n "$vswhereoutput"; then
3407             PathFormat "$vswhereoutput"
3408             vctest=$formatted_path
3409             break
3410         fi
3411     done
3413     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3414     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3415     # should be removed when upgrading baseline.
3416     if ! test -n "$vctest"; then
3417         for ver in $vsversions; do
3418             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3419             if test -n "$regvalue"; then
3420                 vctest=$regvalue
3421                 break
3422             fi
3423             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3424             if test -n "$regvalue"; then
3425                 AC_MSG_RESULT([found: $regvalue])
3426                 PathFormat "$regvalue"
3427                 vctest=$formatted_path
3428                 break
3429             fi
3430         done
3431     fi
3433     if test -n "$vctest"; then
3434         vcnumwithdot="$ver.0"
3435         case "$vcnumwithdot" in
3436         15.0)
3437             vcyear=2017
3438             vcnum=150
3439             ;;
3440         16.0)
3441             vcyear=2019
3442             vcnum=160
3443             ;;
3444         esac
3445         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3447     fi
3450 SOLARINC=
3451 MSBUILD_PATH=
3452 DEVENV=
3453 if test "$_os" = "WINNT"; then
3454     AC_MSG_CHECKING([Visual C++])
3455     find_msvc "$with_visual_studio"
3456     if test -z "$vctest"; then
3457         if test -n "$with_visual_studio"; then
3458             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3459         else
3460             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3461         fi
3462     fi
3464     if test "$BITNESS_OVERRIDE" = ""; then
3465         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3466             VC_PRODUCT_DIR=$vctest/VC
3467         else
3468             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3469         fi
3470     else
3471         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3472             VC_PRODUCT_DIR=$vctest/VC
3473         else
3474             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3475         fi
3476     fi
3477     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3479     AC_MSG_CHECKING([for short pathname of VC product directory])
3480     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3481     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3483     UCRTSDKDIR=
3484     UCRTVERSION=
3486     AC_MSG_CHECKING([for UCRT location])
3487     find_ucrt
3488     # find_ucrt errors out if it doesn't find it
3489     AC_MSG_RESULT([found])
3490     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3491     ucrtincpath_formatted=$formatted_path
3492     # SOLARINC is used for external modules and must be set too.
3493     # And no, it's not sufficient to set SOLARINC only, as configure
3494     # itself doesn't honour it.
3495     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3496     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3497     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3498     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3500     AC_SUBST(UCRTSDKDIR)
3501     AC_SUBST(UCRTVERSION)
3503     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3504     # Find the proper version of MSBuild.exe to use based on the VS version
3505     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3506     if test -n "$regvalue" ; then
3507         AC_MSG_RESULT([found: $regvalue])
3508         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3509     else
3510         if test "$vcnumwithdot" = "16.0"; then
3511             if test "$BITNESS_OVERRIDE" = ""; then
3512                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3513             else
3514                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3515             fi
3516         else
3517             if test "$BITNESS_OVERRIDE" = ""; then
3518                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3519             else
3520                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3521             fi
3522         fi
3523         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3524         AC_MSG_RESULT([$regvalue])
3525     fi
3527     # Find the version of devenv.exe
3528     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3529     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3530     if test ! -e "$DEVENV"; then
3531         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3532     fi
3534     dnl ===========================================================
3535     dnl  Check for the corresponding mspdb*.dll
3536     dnl ===========================================================
3538     VC_HOST_DIR=
3539     MSPDB_PATH=
3540     CL_PATH=
3542     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3543         VC_HOST_DIR="HostX64"
3544         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3545     else
3546         VC_HOST_DIR="HostX86"
3547         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3548     fi
3550     if test "$BITNESS_OVERRIDE" = ""; then
3551         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3552     else
3553         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3554     fi
3556     # MSVC 15.0 has libraries from 14.0?
3557     mspdbnum="140"
3559     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3560         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3561     fi
3563     dnl The path needs to be added before cl is called
3564     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3565     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3567     AC_MSG_CHECKING([cl.exe])
3569     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3570     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3571     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3572     # is not enough?
3574     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3575     dnl needed when building CLR code:
3576     if test -z "$MSVC_CXX"; then
3577         if test -f "$CL_PATH/cl.exe"; then
3578             MSVC_CXX="$CL_PATH/cl.exe"
3579         fi
3581         # This gives us a posix path with 8.3 filename restrictions
3582         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3583     fi
3585     if test -z "$CC"; then
3586         CC=$MSVC_CXX
3587         CC_BASE=`first_arg_basename "$CC"`
3588     fi
3589     if test "$BITNESS_OVERRIDE" = ""; then
3590         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3591         MSVC_CXX="$MSVC_CXX -arch:SSE"
3592     fi
3593     if test -z "$CXX"; then
3594         CXX=$MSVC_CXX
3595         CXX_BASE=`first_arg_basename "$CXX"`
3596     fi
3598     if test -n "$CC"; then
3599         # Remove /cl.exe from CC case insensitive
3600         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3601         if test "$BITNESS_OVERRIDE" = ""; then
3602            COMPATH="$VC_PRODUCT_DIR"
3603         else
3604             if test -n "$VC_PRODUCT_DIR"; then
3605                 COMPATH=$VC_PRODUCT_DIR
3606             fi
3607         fi
3608         if test "$BITNESS_OVERRIDE" = ""; then
3609             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3610             CC="$CC -arch:SSE"
3611         fi
3613         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3615         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3617         PathFormat "$COMPATH"
3618         COMPATH=`win_short_path_for_make "$formatted_path"`
3620         VCVER=$vcnum
3621         MSVSVER=$vcyear
3623         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3624         # are always "better", we list them in reverse chronological order.
3626         case "$vcnum" in
3627         150|160)
3628             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3629             ;;
3630         esac
3632         # The expectation is that --with-windows-sdk should not need to be used
3633         if test -n "$with_windows_sdk"; then
3634             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3635             *" "$with_windows_sdk" "*)
3636                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3637                 ;;
3638             *)
3639                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3640                 ;;
3641             esac
3642         fi
3644         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3645         ac_objext=obj
3646         ac_exeext=exe
3648     else
3649         AC_MSG_ERROR([Visual C++ not found after all, huh])
3650     fi
3652     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3653     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3654         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3655         // between Visual Studio versions and _MSC_VER:
3656         #if _MSC_VER < 1914
3657         #error
3658         #endif
3659     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3661     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3662     # version of the Explorer extension (and maybe other small
3663     # bits, too) needed when installing a 32-bit LibreOffice on a
3664     # 64-bit OS. The 64-bit Explorer extension is a feature that
3665     # has been present since long in OOo. Don't confuse it with
3666     # building LibreOffice itself as 64-bit code.
3668     BUILD_X64=
3669     CXX_X64_BINARY=
3671     if test "$BITNESS_OVERRIDE" = ""; then
3672         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3673         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3674              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3675             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3676                 BUILD_X64=TRUE
3677                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3678             fi
3679         fi
3680         if test "$BUILD_X64" = TRUE; then
3681             AC_MSG_RESULT([found])
3682         else
3683             AC_MSG_RESULT([not found])
3684             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3685         fi
3686     else
3687         CXX_X64_BINARY=$CXX
3688     fi
3689     AC_SUBST(BUILD_X64)
3691     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3692     AC_SUBST(CXX_X64_BINARY)
3694     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3695     # needed to support TWAIN scan on both 32- and 64-bit systems
3697     BUILD_X86=
3699     if test "$BITNESS_OVERRIDE" = "64"; then
3700         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3701         if test -n "$CXX_X86_BINARY"; then
3702             BUILD_X86=TRUE
3703             AC_MSG_RESULT([preset])
3704         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3705             BUILD_X86=TRUE
3706             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3707             CXX_X86_BINARY+=" /arch:SSE"
3708             AC_MSG_RESULT([found])
3709         else
3710             CXX_X86_BINARY=
3711             AC_MSG_RESULT([not found])
3712             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3713         fi
3714     else
3715         BUILD_X86=TRUE
3716         CXX_X86_BINARY=$MSVC_CXX
3717     fi
3718     AC_SUBST(BUILD_X86)
3719     AC_SUBST(CXX_X86_BINARY)
3721 AC_SUBST(VCVER)
3722 AC_SUBST(DEVENV)
3723 AC_SUBST(MSVC_CXX)
3726 # unowinreg.dll
3728 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3729 AC_SUBST(UNOWINREG_DLL)
3731 COM_IS_CLANG=
3732 AC_MSG_CHECKING([whether the compiler is actually Clang])
3733 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3734     #ifndef __clang__
3735     you lose
3736     #endif
3737     int foo=42;
3738     ]])],
3739     [AC_MSG_RESULT([yes])
3740      COM_IS_CLANG=TRUE],
3741     [AC_MSG_RESULT([no])])
3742 AC_SUBST(COM_IS_CLANG)
3744 CC_PLAIN=$CC
3745 CLANGVER=
3746 if test "$COM_IS_CLANG" = TRUE; then
3747     AC_MSG_CHECKING([whether Clang is new enough])
3748     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3749         #if !defined __apple_build_version__
3750         #error
3751         #endif
3752         ]])],
3753         [my_apple_clang=yes],[my_apple_clang=])
3754     if test "$my_apple_clang" = yes; then
3755         AC_MSG_RESULT([assumed yes (Apple Clang)])
3756     else
3757         if test "$_os" = WINNT; then
3758             dnl In which case, assume clang-cl:
3759             my_args="/EP /TC"
3760             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3761             dnl clang-cl:
3762             CC_PLAIN=
3763             for i in $CC; do
3764                 case $i in
3765                 -FIIntrin.h)
3766                     ;;
3767                 *)
3768                     CC_PLAIN="$CC_PLAIN $i"
3769                     ;;
3770                 esac
3771             done
3772         else
3773             my_args="-E -P"
3774         fi
3775         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3776         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3777         CLANGVER=`echo $clang_version \
3778             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3779         if test "$CLANGVER" -ge 50002; then
3780             AC_MSG_RESULT([yes ($clang_version)])
3781         else
3782             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3783         fi
3784         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3785         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3786     fi
3789 SHOWINCLUDES_PREFIX=
3790 if test "$_os" = WINNT; then
3791     dnl We need to guess the prefix of the -showIncludes output, it can be
3792     dnl localized
3793     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3794     echo "#include <stdlib.h>" > conftest.c
3795     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3796         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3797     rm -f conftest.c conftest.obj
3798     if test -z "$SHOWINCLUDES_PREFIX"; then
3799         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3800     else
3801         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3802     fi
3804 AC_SUBST(SHOWINCLUDES_PREFIX)
3807 # prefix C with ccache if needed
3809 if test "$CCACHE" != ""; then
3810     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3812     AC_LANG_PUSH([C])
3813     save_CFLAGS=$CFLAGS
3814     CFLAGS="$CFLAGS --ccache-skip -O2"
3815     dnl an empty program will do, we're checking the compiler flags
3816     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3817                       [use_ccache=yes], [use_ccache=no])
3818     if test $use_ccache = yes; then
3819         AC_MSG_RESULT([yes])
3820     else
3821         CC="$CCACHE $CC"
3822         CC_BASE="ccache $CC_BASE"
3823         AC_MSG_RESULT([no])
3824     fi
3825     CFLAGS=$save_CFLAGS
3826     AC_LANG_POP([C])
3829 # ===================================================================
3830 # check various GCC options that Clang does not support now but maybe
3831 # will somewhen in the future, check them even for GCC, so that the
3832 # flags are set
3833 # ===================================================================
3835 HAVE_GCC_GGDB2=
3836 if test "$GCC" = "yes"; then
3837     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3838     save_CFLAGS=$CFLAGS
3839     CFLAGS="$CFLAGS -Werror -ggdb2"
3840     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3841     CFLAGS=$save_CFLAGS
3842     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3843         AC_MSG_RESULT([yes])
3844     else
3845         AC_MSG_RESULT([no])
3846     fi
3848     if test "$host_cpu" = "m68k"; then
3849         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3850         save_CFLAGS=$CFLAGS
3851         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3852         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3853         CFLAGS=$save_CFLAGS
3854         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3855             AC_MSG_RESULT([yes])
3856         else
3857             AC_MSG_ERROR([no])
3858         fi
3859     fi
3861 AC_SUBST(HAVE_GCC_GGDB2)
3863 dnl ===================================================================
3864 dnl  Test the gcc version
3865 dnl ===================================================================
3866 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3867     AC_MSG_CHECKING([the GCC version])
3868     _gcc_version=`$CC -dumpversion`
3869     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3870         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3871     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3873     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3875     if test "$gcc_full_version" -lt 70000; then
3876         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3877     fi
3878 else
3879     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3880     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3881     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3882     # (which reports itself as GCC 4.2.1).
3883     GCC_VERSION=
3885 AC_SUBST(GCC_VERSION)
3887 dnl Set the ENABLE_DBGUTIL variable
3888 dnl ===================================================================
3889 AC_MSG_CHECKING([whether to build with additional debug utilities])
3890 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3891     ENABLE_DBGUTIL="TRUE"
3892     # this is an extra var so it can have different default on different MSVC
3893     # versions (in case there are version specific problems with it)
3894     MSVC_USE_DEBUG_RUNTIME="TRUE"
3896     AC_MSG_RESULT([yes])
3897     # cppunit and graphite expose STL in public headers
3898     if test "$with_system_cppunit" = "yes"; then
3899         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3900     else
3901         with_system_cppunit=no
3902     fi
3903     if test "$with_system_graphite" = "yes"; then
3904         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3905     else
3906         with_system_graphite=no
3907     fi
3908     if test "$with_system_orcus" = "yes"; then
3909         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3910     else
3911         with_system_orcus=no
3912     fi
3913     if test "$with_system_libcmis" = "yes"; then
3914         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3915     else
3916         with_system_libcmis=no
3917     fi
3918     if test "$with_system_hunspell" = "yes"; then
3919         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3920     else
3921         with_system_hunspell=no
3922     fi
3923     if test "$with_system_gpgmepp" = "yes"; then
3924         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3925     else
3926         with_system_gpgmepp=no
3927     fi
3928     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3929     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3930     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3931     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3932     # of those two is using the system variant:
3933     if test "$with_system_libnumbertext" = "yes"; then
3934         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3935     else
3936         with_system_libnumbertext=no
3937     fi
3938     if test "$with_system_libwps" = "yes"; then
3939         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3940     else
3941         with_system_libwps=no
3942     fi
3943 else
3944     ENABLE_DBGUTIL=""
3945     MSVC_USE_DEBUG_RUNTIME=""
3946     AC_MSG_RESULT([no])
3948 AC_SUBST(ENABLE_DBGUTIL)
3949 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3951 dnl Set the ENABLE_DEBUG variable.
3952 dnl ===================================================================
3953 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3954     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3956 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3957     if test -z "$libo_fuzzed_enable_debug"; then
3958         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3959     else
3960         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3961         enable_debug=yes
3962     fi
3965 AC_MSG_CHECKING([whether to do a debug build])
3966 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3967     ENABLE_DEBUG="TRUE"
3968     if test -n "$ENABLE_DBGUTIL" ; then
3969         AC_MSG_RESULT([yes (dbgutil)])
3970     else
3971         AC_MSG_RESULT([yes])
3972     fi
3973 else
3974     ENABLE_DEBUG=""
3975     AC_MSG_RESULT([no])
3977 AC_SUBST(ENABLE_DEBUG)
3979 dnl ===================================================================
3980 dnl Select the linker to use (gold/lld/ld.bfd).
3981 dnl This is done only after compiler checks (need to know if Clang is
3982 dnl used, for different defaults) and after checking if a debug build
3983 dnl is wanted (non-debug builds get the default linker if not explicitly
3984 dnl specified otherwise).
3985 dnl All checks for linker features/options should come after this.
3986 dnl ===================================================================
3987 check_use_ld()
3989     use_ld=$1
3990     use_ld_fail_if_error=$2
3991     use_ld_ok=
3992     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3993     use_ld_ldflags_save="$LDFLAGS"
3994     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3995     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3996 #include <stdio.h>
3997         ],[
3998 printf ("hello world\n");
3999         ])], USE_LD=$use_ld, [])
4000     if test -n "$USE_LD"; then
4001         AC_MSG_RESULT( yes )
4002         use_ld_ok=yes
4003     else
4004         if test -n "$use_ld_fail_if_error"; then
4005             AC_MSG_ERROR( no )
4006         else
4007             AC_MSG_RESULT( no )
4008         fi
4009     fi
4010     if test -n "$use_ld_ok"; then
4011         dnl keep the value of LDFLAGS
4012         return 0
4013     fi
4014     LDFLAGS="$use_ld_ldflags_save"
4015     return 1
4017 USE_LD=
4018 if test "$enable_ld" != "no"; then
4019     if test "$GCC" = "yes"; then
4020         if test -n "$enable_ld"; then
4021             check_use_ld "$enable_ld" fail_if_error
4022         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4023             dnl non-debug builds default to the default linker
4024             true
4025         elif test -n "$COM_IS_CLANG"; then
4026             check_use_ld lld
4027             if test $? -ne 0; then
4028                 check_use_ld gold
4029             fi
4030         else
4031             # For gcc first try gold, new versions also support lld.
4032             check_use_ld gold
4033             if test $? -ne 0; then
4034                 check_use_ld lld
4035             fi
4036         fi
4037         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4038         rm conftest.out
4039         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4040         if test -z "$ld_used"; then
4041             ld_used="unknown"
4042         fi
4043         AC_MSG_CHECKING([for linker that is used])
4044         AC_MSG_RESULT([$ld_used])
4045         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4046             if echo "$ld_used" | grep -q "^GNU ld"; then
4047                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4048                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4049             fi
4050         fi
4051     else
4052         if test "$enable_ld" = "yes"; then
4053             AC_MSG_ERROR([--enable-ld not supported])
4054         fi
4055     fi
4057 AC_SUBST(USE_LD)
4059 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4060 if test "$GCC" = "yes"; then
4061     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4062     bsymbolic_functions_ldflags_save=$LDFLAGS
4063     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4064     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4065 #include <stdio.h>
4066         ],[
4067 printf ("hello world\n");
4068         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4069     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4070         AC_MSG_RESULT( found )
4071     else
4072         AC_MSG_RESULT( not found )
4073     fi
4074     LDFLAGS=$bsymbolic_functions_ldflags_save
4076 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4079 HAVE_GSPLIT_DWARF=
4080 if test "$enable_split_debug" != no; then
4081     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4082     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4083         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4084         save_CFLAGS=$CFLAGS
4085         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4086         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4087         CFLAGS=$save_CFLAGS
4088         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4089             AC_MSG_RESULT([yes])
4090         else
4091             if test "$enable_split_debug" = yes; then
4092                 AC_MSG_ERROR([no])
4093             else
4094                 AC_MSG_RESULT([no])
4095             fi
4096         fi
4097     fi
4098     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4099         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4100         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4101     fi
4103 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4105 ENABLE_GDB_INDEX=
4106 if test "$enable_gdb_index" != "no"; then
4107     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4108     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4109         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4110         save_CFLAGS=$CFLAGS
4111         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4112         have_ggnu_pubnames=
4113         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4114         if test "$have_ggnu_pubnames" != "TRUE"; then
4115             if test "$enable_gdb_index" = "yes"; then
4116                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4117             else
4118                 AC_MSG_RESULT( no )
4119             fi
4120         else
4121             AC_MSG_RESULT( yes )
4122             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4123             ldflags_save=$LDFLAGS
4124             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4125             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4126 #include <stdio.h>
4127                 ],[
4128 printf ("hello world\n");
4129                 ])], ENABLE_GDB_INDEX=TRUE, [])
4130             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4131                 AC_MSG_RESULT( yes )
4132             else
4133                 if test "$enable_gdb_index" = "yes"; then
4134                     AC_MSG_ERROR( no )
4135                 else
4136                     AC_MSG_RESULT( no )
4137                 fi
4138             fi
4139             LDFLAGS=$ldflags_save
4140         fi
4141         CFLAGS=$save_CFLAGS
4142         fi
4143     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4144         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4145         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4146     fi
4148 AC_SUBST(ENABLE_GDB_INDEX)
4150 if test "$enable_sal_log" = yes; then
4151     ENABLE_SAL_LOG=TRUE
4153 AC_SUBST(ENABLE_SAL_LOG)
4155 dnl Check for enable symbols option
4156 dnl ===================================================================
4157 AC_MSG_CHECKING([whether to generate debug information])
4158 if test -z "$enable_symbols"; then
4159     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4160         enable_symbols=yes
4161     else
4162         enable_symbols=no
4163     fi
4165 if test "$enable_symbols" = yes; then
4166     ENABLE_SYMBOLS_FOR=all
4167     AC_MSG_RESULT([yes])
4168 elif test "$enable_symbols" = no; then
4169     ENABLE_SYMBOLS_FOR=
4170     AC_MSG_RESULT([no])
4171 else
4172     # Selective debuginfo.
4173     ENABLE_SYMBOLS_FOR="$enable_symbols"
4174     AC_MSG_RESULT([for "$enable_symbols"])
4176 AC_SUBST(ENABLE_SYMBOLS_FOR)
4178 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4179     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4180     AC_MSG_CHECKING([whether enough memory is available for linking])
4181     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4182     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4183     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4184         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4185     else
4186         AC_MSG_RESULT([yes])
4187     fi
4190 AC_MSG_CHECKING([whether to compile with optimization flags])
4191 if test -z "$enable_optimized"; then
4192     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4193         enable_optimized=no
4194     else
4195         enable_optimized=yes
4196     fi
4198 if test "$enable_optimized" != no; then
4199     ENABLE_OPTIMIZED=TRUE
4200     AC_MSG_RESULT([yes])
4201 else
4202     ENABLE_OPTIMIZED=
4203     AC_MSG_RESULT([no])
4205 AC_SUBST(ENABLE_OPTIMIZED)
4208 # determine CPUNAME, OS, ...
4209 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4211 case "$host_os" in
4213 aix*)
4214     COM=GCC
4215     CPUNAME=POWERPC
4216     USING_X11=TRUE
4217     OS=AIX
4218     RTL_OS=AIX
4219     RTL_ARCH=PowerPC
4220     PLATFORMID=aix_powerpc
4221     P_SEP=:
4222     ;;
4224 cygwin*)
4225     COM=MSC
4226     USING_X11=
4227     OS=WNT
4228     RTL_OS=Windows
4229     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4230         P_SEP=";"
4231     else
4232         P_SEP=:
4233     fi
4234     case "$host_cpu" in
4235     i*86|x86_64)
4236         if test "$BITNESS_OVERRIDE" = 64; then
4237             CPUNAME=X86_64
4238             RTL_ARCH=X86_64
4239             PLATFORMID=windows_x86_64
4240             WINDOWS_X64=1
4241             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4242         else
4243             CPUNAME=INTEL
4244             RTL_ARCH=x86
4245             PLATFORMID=windows_x86
4246         fi
4247         ;;
4248     *)
4249         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4250         ;;
4251     esac
4252     SCPDEFS="$SCPDEFS -D_MSC_VER"
4253     ;;
4255 darwin*)
4256     COM=GCC
4257     USING_X11=
4258     OS=MACOSX
4259     RTL_OS=MacOSX
4260     P_SEP=:
4262     case "$host_cpu" in
4263     arm)
4264         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4265         ;;
4266     arm64)
4267         OS=iOS
4268         RTL_OS=iOS
4269         if test "$enable_ios_simulator" = "yes"; then
4270             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4271         else
4272             CPUNAME=ARM64
4273             RTL_ARCH=ARM_EABI
4274             PLATFORMID=ios_arm64
4275         fi
4276         ;;
4277     i*86)
4278         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4279         ;;
4280     x86_64)
4281         if test "$enable_ios_simulator" = "yes"; then
4282             OS=iOS
4283         fi
4284         CPUNAME=X86_64
4285         RTL_ARCH=X86_64
4286         PLATFORMID=macosx_x86_64
4287         ;;
4288     *)
4289         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4290         ;;
4291     esac
4292     ;;
4294 dragonfly*)
4295     COM=GCC
4296     USING_X11=TRUE
4297     OS=DRAGONFLY
4298     RTL_OS=DragonFly
4299     P_SEP=:
4301     case "$host_cpu" in
4302     i*86)
4303         CPUNAME=INTEL
4304         RTL_ARCH=x86
4305         PLATFORMID=dragonfly_x86
4306         ;;
4307     x86_64)
4308         CPUNAME=X86_64
4309         RTL_ARCH=X86_64
4310         PLATFORMID=dragonfly_x86_64
4311         ;;
4312     *)
4313         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4314         ;;
4315     esac
4316     ;;
4318 freebsd*)
4319     COM=GCC
4320     USING_X11=TRUE
4321     RTL_OS=FreeBSD
4322     OS=FREEBSD
4323     P_SEP=:
4325     case "$host_cpu" in
4326     i*86)
4327         CPUNAME=INTEL
4328         RTL_ARCH=x86
4329         PLATFORMID=freebsd_x86
4330         ;;
4331     x86_64|amd64)
4332         CPUNAME=X86_64
4333         RTL_ARCH=X86_64
4334         PLATFORMID=freebsd_x86_64
4335         ;;
4336     *)
4337         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4338         ;;
4339     esac
4340     ;;
4342 haiku*)
4343     COM=GCC
4344     USING_X11=
4345     GUIBASE=haiku
4346     RTL_OS=Haiku
4347     OS=HAIKU
4348     P_SEP=:
4350     case "$host_cpu" in
4351     i*86)
4352         CPUNAME=INTEL
4353         RTL_ARCH=x86
4354         PLATFORMID=haiku_x86
4355         ;;
4356     x86_64|amd64)
4357         CPUNAME=X86_64
4358         RTL_ARCH=X86_64
4359         PLATFORMID=haiku_x86_64
4360         ;;
4361     *)
4362         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4363         ;;
4364     esac
4365     ;;
4367 kfreebsd*)
4368     COM=GCC
4369     USING_X11=TRUE
4370     OS=LINUX
4371     RTL_OS=kFreeBSD
4372     P_SEP=:
4374     case "$host_cpu" in
4376     i*86)
4377         CPUNAME=INTEL
4378         RTL_ARCH=x86
4379         PLATFORMID=kfreebsd_x86
4380         ;;
4381     x86_64)
4382         CPUNAME=X86_64
4383         RTL_ARCH=X86_64
4384         PLATFORMID=kfreebsd_x86_64
4385         ;;
4386     *)
4387         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4388         ;;
4389     esac
4390     ;;
4392 linux-gnu*)
4393     COM=GCC
4394     USING_X11=TRUE
4395     OS=LINUX
4396     RTL_OS=Linux
4397     P_SEP=:
4399     case "$host_cpu" in
4401     aarch64)
4402         CPUNAME=AARCH64
4403         PLATFORMID=linux_aarch64
4404         RTL_ARCH=AARCH64
4405         ;;
4406     alpha)
4407         CPUNAME=AXP
4408         RTL_ARCH=ALPHA
4409         PLATFORMID=linux_alpha
4410         ;;
4411     arm*)
4412         CPUNAME=ARM
4413         EPM_FLAGS="-a arm"
4414         RTL_ARCH=ARM_EABI
4415         PLATFORMID=linux_arm_eabi
4416         case "$host_cpu" in
4417         arm*-linux)
4418             RTL_ARCH=ARM_OABI
4419             PLATFORMID=linux_arm_oabi
4420             ;;
4421         esac
4422         ;;
4423     hppa)
4424         CPUNAME=HPPA
4425         RTL_ARCH=HPPA
4426         EPM_FLAGS="-a hppa"
4427         PLATFORMID=linux_hppa
4428         ;;
4429     i*86)
4430         CPUNAME=INTEL
4431         RTL_ARCH=x86
4432         PLATFORMID=linux_x86
4433         ;;
4434     ia64)
4435         CPUNAME=IA64
4436         RTL_ARCH=IA64
4437         PLATFORMID=linux_ia64
4438         ;;
4439     mips)
4440         CPUNAME=GODSON
4441         RTL_ARCH=MIPS_EB
4442         EPM_FLAGS="-a mips"
4443         PLATFORMID=linux_mips_eb
4444         ;;
4445     mips64)
4446         CPUNAME=GODSON64
4447         RTL_ARCH=MIPS64_EB
4448         EPM_FLAGS="-a mips64"
4449         PLATFORMID=linux_mips64_eb
4450         ;;
4451     mips64el)
4452         CPUNAME=GODSON64
4453         RTL_ARCH=MIPS64_EL
4454         EPM_FLAGS="-a mips64el"
4455         PLATFORMID=linux_mips64_el
4456         ;;
4457     mipsel)
4458         CPUNAME=GODSON
4459         RTL_ARCH=MIPS_EL
4460         EPM_FLAGS="-a mipsel"
4461         PLATFORMID=linux_mips_el
4462         ;;
4463     m68k)
4464         CPUNAME=M68K
4465         RTL_ARCH=M68K
4466         PLATFORMID=linux_m68k
4467         ;;
4468     powerpc)
4469         CPUNAME=POWERPC
4470         RTL_ARCH=PowerPC
4471         PLATFORMID=linux_powerpc
4472         ;;
4473     powerpc64)
4474         CPUNAME=POWERPC64
4475         RTL_ARCH=PowerPC_64
4476         PLATFORMID=linux_powerpc64
4477         ;;
4478     powerpc64le)
4479         CPUNAME=POWERPC64
4480         RTL_ARCH=PowerPC_64_LE
4481         PLATFORMID=linux_powerpc64_le
4482         ;;
4483     sparc)
4484         CPUNAME=SPARC
4485         RTL_ARCH=SPARC
4486         PLATFORMID=linux_sparc
4487         ;;
4488     sparc64)
4489         CPUNAME=SPARC64
4490         RTL_ARCH=SPARC64
4491         PLATFORMID=linux_sparc64
4492         ;;
4493     s390)
4494         CPUNAME=S390
4495         RTL_ARCH=S390
4496         PLATFORMID=linux_s390
4497         ;;
4498     s390x)
4499         CPUNAME=S390X
4500         RTL_ARCH=S390x
4501         PLATFORMID=linux_s390x
4502         ;;
4503     x86_64)
4504         CPUNAME=X86_64
4505         RTL_ARCH=X86_64
4506         PLATFORMID=linux_x86_64
4507         ;;
4508     *)
4509         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4510         ;;
4511     esac
4512     ;;
4514 linux-android*)
4515     COM=GCC
4516     USING_X11=
4517     OS=ANDROID
4518     RTL_OS=Android
4519     P_SEP=:
4521     case "$host_cpu" in
4523     arm|armel)
4524         CPUNAME=ARM
4525         RTL_ARCH=ARM_EABI
4526         PLATFORMID=android_arm_eabi
4527         ;;
4528     aarch64)
4529         CPUNAME=AARCH64
4530         RTL_ARCH=AARCH64
4531         PLATFORMID=android_aarch64
4532         ;;
4533     i*86)
4534         CPUNAME=INTEL
4535         RTL_ARCH=x86
4536         PLATFORMID=android_x86
4537         ;;
4538     x86_64)
4539         CPUNAME=X86_64
4540         RTL_ARCH=X86_64
4541         PLATFORMID=android_x86_64
4542         ;;
4543     *)
4544         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4545         ;;
4546     esac
4547     ;;
4549 *netbsd*)
4550     COM=GCC
4551     USING_X11=TRUE
4552     OS=NETBSD
4553     RTL_OS=NetBSD
4554     P_SEP=:
4556     case "$host_cpu" in
4557     i*86)
4558         CPUNAME=INTEL
4559         RTL_ARCH=x86
4560         PLATFORMID=netbsd_x86
4561         ;;
4562     powerpc)
4563         CPUNAME=POWERPC
4564         RTL_ARCH=PowerPC
4565         PLATFORMID=netbsd_powerpc
4566         ;;
4567     sparc)
4568         CPUNAME=SPARC
4569         RTL_ARCH=SPARC
4570         PLATFORMID=netbsd_sparc
4571         ;;
4572     x86_64)
4573         CPUNAME=X86_64
4574         RTL_ARCH=X86_64
4575         PLATFORMID=netbsd_x86_64
4576         ;;
4577     *)
4578         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4579         ;;
4580     esac
4581     ;;
4583 openbsd*)
4584     COM=GCC
4585     USING_X11=TRUE
4586     OS=OPENBSD
4587     RTL_OS=OpenBSD
4588     P_SEP=:
4590     case "$host_cpu" in
4591     i*86)
4592         CPUNAME=INTEL
4593         RTL_ARCH=x86
4594         PLATFORMID=openbsd_x86
4595         ;;
4596     x86_64)
4597         CPUNAME=X86_64
4598         RTL_ARCH=X86_64
4599         PLATFORMID=openbsd_x86_64
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     ;;
4608 solaris*)
4609     COM=GCC
4610     USING_X11=TRUE
4611     OS=SOLARIS
4612     RTL_OS=Solaris
4613     P_SEP=:
4615     case "$host_cpu" in
4616     i*86)
4617         CPUNAME=INTEL
4618         RTL_ARCH=x86
4619         PLATFORMID=solaris_x86
4620         ;;
4621     sparc)
4622         CPUNAME=SPARC
4623         RTL_ARCH=SPARC
4624         PLATFORMID=solaris_sparc
4625         ;;
4626     sparc64)
4627         CPUNAME=SPARC64
4628         RTL_ARCH=SPARC64
4629         PLATFORMID=solaris_sparc64
4630         ;;
4631     *)
4632         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4633         ;;
4634     esac
4635     SOLARINC="$SOLARINC -I/usr/local/include"
4636     ;;
4639     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4640     ;;
4641 esac
4643 if test "$with_x" = "no"; then
4644     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4647 DISABLE_GUI=""
4648 if test "$enable_gui" = "no"; then
4649     if test "$USING_X11" != TRUE; then
4650         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4651     fi
4652     USING_X11=
4653     DISABLE_GUI=TRUE
4654     AC_DEFINE(HAVE_FEATURE_UI,0)
4655     test_cairo=yes
4657 AC_SUBST(DISABLE_GUI)
4659 WORKDIR="${BUILDDIR}/workdir"
4660 INSTDIR="${BUILDDIR}/instdir"
4661 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4662 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4663 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4664 AC_SUBST(COM)
4665 AC_SUBST(CPUNAME)
4666 AC_SUBST(RTL_OS)
4667 AC_SUBST(RTL_ARCH)
4668 AC_SUBST(EPM_FLAGS)
4669 AC_SUBST(USING_X11)
4670 AC_SUBST([INSTDIR])
4671 AC_SUBST([INSTROOT])
4672 AC_SUBST([INSTROOTBASE])
4673 AC_SUBST(OS)
4674 AC_SUBST(P_SEP)
4675 AC_SUBST(WORKDIR)
4676 AC_SUBST(PLATFORMID)
4677 AC_SUBST(WINDOWS_X64)
4678 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4680 dnl ===================================================================
4681 dnl Test which package format to use
4682 dnl ===================================================================
4683 AC_MSG_CHECKING([which package format to use])
4684 if test -n "$with_package_format" -a "$with_package_format" != no; then
4685     for i in $with_package_format; do
4686         case "$i" in
4687         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4688             ;;
4689         *)
4690             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4691 aix - AIX software distribution
4692 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4693 deb - Debian software distribution
4694 pkg - Solaris software distribution
4695 rpm - RedHat software distribution
4697 LibreOffice additionally supports:
4698 archive - .tar.gz or .zip
4699 dmg - macOS .dmg
4700 installed - installation tree
4701 msi - Windows .msi
4702         ])
4703             ;;
4704         esac
4705     done
4706     # fakeroot is needed to ensure correct file ownerships/permissions
4707     # inside deb packages and tar archives created on Linux and Solaris.
4708     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4709         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4710         if test "$FAKEROOT" = "no"; then
4711             AC_MSG_ERROR(
4712                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4713         fi
4714     fi
4715     PKGFORMAT="$with_package_format"
4716     AC_MSG_RESULT([$PKGFORMAT])
4717 else
4718     PKGFORMAT=
4719     AC_MSG_RESULT([none])
4721 AC_SUBST(PKGFORMAT)
4723 dnl ===================================================================
4724 dnl Set up a different compiler to produce tools to run on the build
4725 dnl machine when doing cross-compilation
4726 dnl ===================================================================
4728 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4729 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4730 if test "$cross_compiling" = "yes"; then
4731     AC_MSG_CHECKING([for BUILD platform configuration])
4732     echo
4733     rm -rf CONF-FOR-BUILD config_build.mk
4734     mkdir CONF-FOR-BUILD
4735     # Here must be listed all files needed when running the configure script. In particular, also
4736     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4737     # keep them in the same order as there.
4738     (cd $SRC_ROOT && tar cf - \
4739         config.guess \
4740         bin/get_config_variables \
4741         solenv/bin/getcompver.awk \
4742         solenv/inc/langlist.mk \
4743         download.lst \
4744         config_host.mk.in \
4745         config_host_lang.mk.in \
4746         Makefile.in \
4747         bin/bffvalidator.sh.in \
4748         bin/odfvalidator.sh.in \
4749         bin/officeotron.sh.in \
4750         instsetoo_native/util/openoffice.lst.in \
4751         setup_native/source/packinfo/finals_instsetoo.txt.in \
4752         config_host/*.in \
4753         sysui/desktop/macosx/Info.plist.in) \
4754     | (cd CONF-FOR-BUILD && tar xf -)
4755     cp configure CONF-FOR-BUILD
4756     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4757     (
4758     unset COM USING_X11 OS CPUNAME
4759     unset CC CXX SYSBASE CFLAGS
4760     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4761     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4762     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4763     if test -n "$CC_FOR_BUILD"; then
4764         export CC="$CC_FOR_BUILD"
4765         CC_BASE=`first_arg_basename "$CC"`
4766     fi
4767     if test -n "$CXX_FOR_BUILD"; then
4768         export CXX="$CXX_FOR_BUILD"
4769         CXX_BASE=`first_arg_basename "$CXX"`
4770     fi
4771     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4772     cd CONF-FOR-BUILD
4773     sub_conf_opts=""
4774     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4775     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4776     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4777     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4778     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4779     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4780     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4781     # Don't bother having configure look for stuff not needed for the build platform anyway
4782     ./configure \
4783         --disable-cups \
4784         --disable-gstreamer-1-0 \
4785         --disable-gtk3 \
4786         --disable-pdfimport \
4787         --disable-postgresql-sdbc \
4788         --enable-icecream="$enable_icecream" \
4789         --with-parallelism="$with_parallelism" \
4790         --without-doxygen \
4791         --without-java \
4792         $sub_conf_opts \
4793         --srcdir=$srcdir \
4794         2>&1 | sed -e 's/^/    /'
4795     test -f ./config_host.mk 2>/dev/null || exit
4796     cp config_host.mk ../config_build.mk
4797     cp config_host_lang.mk ../config_build_lang.mk
4798     mv config.log ../config.Build.log
4799     mkdir -p ../config_build
4800     mv config_host/*.h ../config_build
4801     . ./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
4803     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
4804         VV='$'$V
4805         VV=`eval "echo $VV"`
4806         if test -n "$VV"; then
4807             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4808             echo "$line" >>build-config
4809         fi
4810     done
4812     for V in INSTDIR INSTROOT WORKDIR; do
4813         VV='$'$V
4814         VV=`eval "echo $VV"`
4815         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4816         if test -n "$VV"; then
4817             line="${V}_FOR_BUILD='$VV'"
4818             echo "$line" >>build-config
4819         fi
4820     done
4822     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4823     echo "$line" >>build-config
4825     )
4826     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4827     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])
4828     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4829              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4831     eval `cat CONF-FOR-BUILD/build-config`
4833     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4835     rm -rf CONF-FOR-BUILD
4836 else
4837     OS_FOR_BUILD="$OS"
4838     CC_FOR_BUILD="$CC"
4839     CXX_FOR_BUILD="$CXX"
4840     INSTDIR_FOR_BUILD="$INSTDIR"
4841     INSTROOT_FOR_BUILD="$INSTROOT"
4842     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4843     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4844     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4845     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4846     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4847     WORKDIR_FOR_BUILD="$WORKDIR"
4849 AC_SUBST(OS_FOR_BUILD)
4850 AC_SUBST(INSTDIR_FOR_BUILD)
4851 AC_SUBST(INSTROOT_FOR_BUILD)
4852 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4853 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4854 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4855 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4856 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4857 AC_SUBST(WORKDIR_FOR_BUILD)
4859 dnl ===================================================================
4860 dnl Check for syslog header
4861 dnl ===================================================================
4862 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4864 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4865 dnl ===================================================================
4866 AC_MSG_CHECKING([whether to turn warnings to errors])
4867 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4868     ENABLE_WERROR="TRUE"
4869     AC_MSG_RESULT([yes])
4870 else
4871     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4872         ENABLE_WERROR="TRUE"
4873         AC_MSG_RESULT([yes])
4874     else
4875         AC_MSG_RESULT([no])
4876     fi
4878 AC_SUBST(ENABLE_WERROR)
4880 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4881 dnl ===================================================================
4882 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4883 if test -z "$enable_assert_always_abort"; then
4884    if test "$ENABLE_DEBUG" = TRUE; then
4885        enable_assert_always_abort=yes
4886    else
4887        enable_assert_always_abort=no
4888    fi
4890 if test "$enable_assert_always_abort" = "yes"; then
4891     ASSERT_ALWAYS_ABORT="TRUE"
4892     AC_MSG_RESULT([yes])
4893 else
4894     ASSERT_ALWAYS_ABORT="FALSE"
4895     AC_MSG_RESULT([no])
4897 AC_SUBST(ASSERT_ALWAYS_ABORT)
4899 # Determine whether to use ooenv for the instdir installation
4900 # ===================================================================
4901 if test $_os != "WINNT" -a $_os != "Darwin"; then
4902     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4903     if test "$enable_ooenv" = "no"; then
4904         AC_MSG_RESULT([no])
4905     else
4906         ENABLE_OOENV="TRUE"
4907         AC_MSG_RESULT([yes])
4908     fi
4910 AC_SUBST(ENABLE_OOENV)
4912 if test "$USING_X11" != TRUE; then
4913     # be sure to do not mess with unneeded stuff
4914     test_randr=no
4915     test_xrender=no
4916     test_cups=no
4917     test_dbus=no
4918     build_gstreamer_1_0=no
4919     test_kf5=no
4920     test_qt5=no
4921     test_gtk3_kde5=no
4922     enable_cairo_canvas=no
4925 if test "$OS" = "HAIKU"; then
4926     enable_cairo_canvas=yes
4927     test_kf5=yes
4930 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4931     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!])
4932     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!"
4933     enable_kf5=yes
4936 if test "$test_kf5" = "yes"; then
4937     test_qt5=yes
4940 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4941     if test "$enable_qt5" = "no"; then
4942         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4943     else
4944         enable_qt5=yes
4945     fi
4948 dnl ===================================================================
4949 dnl check for cups support
4950 dnl ===================================================================
4951 ENABLE_CUPS=""
4953 if test "$enable_cups" = "no"; then
4954     test_cups=no
4957 AC_MSG_CHECKING([whether to enable CUPS support])
4958 if test "$test_cups" = "yes"; then
4959     ENABLE_CUPS="TRUE"
4960     AC_MSG_RESULT([yes])
4962     AC_MSG_CHECKING([whether cups support is present])
4963     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4964     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4965     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4966         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4967     fi
4969 else
4970     AC_MSG_RESULT([no])
4973 AC_SUBST(ENABLE_CUPS)
4975 # fontconfig checks
4976 if test "$test_fontconfig" = "yes"; then
4977     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4978     SYSTEM_FONTCONFIG=TRUE
4979     FilterLibs "${FONTCONFIG_LIBS}"
4980     FONTCONFIG_LIBS="${filteredlibs}"
4982 AC_SUBST(FONTCONFIG_CFLAGS)
4983 AC_SUBST(FONTCONFIG_LIBS)
4984 AC_SUBST([SYSTEM_FONTCONFIG])
4986 dnl whether to find & fetch external tarballs?
4987 dnl ===================================================================
4988 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4989    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4990        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4991    else
4992        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4993    fi
4995 if test -z "$TARFILE_LOCATION"; then
4996     if test -d "$SRC_ROOT/src" ; then
4997         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4998         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4999     fi
5000     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5001 else
5002     AbsolutePath "$TARFILE_LOCATION"
5003     PathFormat "${absolute_path}"
5004     TARFILE_LOCATION="${formatted_path}"
5006 AC_SUBST(TARFILE_LOCATION)
5008 AC_MSG_CHECKING([whether we want to fetch tarballs])
5009 if test "$enable_fetch_external" != "no"; then
5010     if test "$with_all_tarballs" = "yes"; then
5011         AC_MSG_RESULT([yes, all of them])
5012         DO_FETCH_TARBALLS="ALL"
5013     else
5014         AC_MSG_RESULT([yes, if we use them])
5015         DO_FETCH_TARBALLS="TRUE"
5016     fi
5017 else
5018     AC_MSG_RESULT([no])
5019     DO_FETCH_TARBALLS=
5021 AC_SUBST(DO_FETCH_TARBALLS)
5023 AC_MSG_CHECKING([whether to build help])
5024 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5025     BUILD_TYPE="$BUILD_TYPE HELP"
5026     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5027     case "$with_help" in
5028     "html")
5029         ENABLE_HTMLHELP=TRUE
5030         SCPDEFS="$SCPDEFS -DWITH_HELP"
5031         AC_MSG_RESULT([HTML])
5032         ;;
5033     "online")
5034         ENABLE_HTMLHELP=TRUE
5035         HELP_ONLINE=TRUE
5036         AC_MSG_RESULT([HTML])
5037         ;;
5038     yes)
5039         SCPDEFS="$SCPDEFS -DWITH_HELP"
5040         AC_MSG_RESULT([yes])
5041         ;;
5042     *)
5043         AC_MSG_ERROR([Unknown --with-help=$with_help])
5044         ;;
5045     esac
5046 else
5047     AC_MSG_RESULT([no])
5049 AC_SUBST([ENABLE_HTMLHELP])
5050 AC_SUBST([HELP_ONLINE])
5052 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5053 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5054     BUILD_TYPE="$BUILD_TYPE HELP"
5055     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5056     case "$with_omindex" in
5057     "server")
5058         ENABLE_HTMLHELP=TRUE
5059         HELP_ONLINE=TRUE
5060         HELP_OMINDEX_PAGE=TRUE
5061         AC_MSG_RESULT([SERVER])
5062         ;;
5063     "noxap")
5064         ENABLE_HTMLHELP=TRUE
5065         HELP_ONLINE=TRUE
5066         HELP_OMINDEX_PAGE=FALSE
5067         AC_MSG_RESULT([NOXAP])
5068         ;;
5069     *)
5070         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5071         ;;
5072     esac
5073 else
5074     HELP_OMINDEX_PAGE=FALSE
5075     AC_MSG_RESULT([no])
5077 AC_SUBST([ENABLE_HTMLHELP])
5078 AC_SUBST([HELP_OMINDEX_PAGE])
5079 AC_SUBST([HELP_ONLINE])
5082 dnl Test whether to include MySpell dictionaries
5083 dnl ===================================================================
5084 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5085 if test "$with_myspell_dicts" = "yes"; then
5086     AC_MSG_RESULT([yes])
5087     WITH_MYSPELL_DICTS=TRUE
5088     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5089     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5090 else
5091     AC_MSG_RESULT([no])
5092     WITH_MYSPELL_DICTS=
5094 AC_SUBST(WITH_MYSPELL_DICTS)
5096 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5097 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5098     if test "$with_system_dicts" = yes; then
5099         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5100     fi
5101     with_system_dicts=no
5104 AC_MSG_CHECKING([whether to use dicts from external paths])
5105 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5106     AC_MSG_RESULT([yes])
5107     SYSTEM_DICTS=TRUE
5108     AC_MSG_CHECKING([for spelling dictionary directory])
5109     if test -n "$with_external_dict_dir"; then
5110         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5111     else
5112         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5113         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5114             DICT_SYSTEM_DIR=file:///usr/share/myspell
5115         fi
5116     fi
5117     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5118     AC_MSG_CHECKING([for hyphenation patterns directory])
5119     if test -n "$with_external_hyph_dir"; then
5120         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5121     else
5122         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5123     fi
5124     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5125     AC_MSG_CHECKING([for thesaurus directory])
5126     if test -n "$with_external_thes_dir"; then
5127         THES_SYSTEM_DIR=file://$with_external_thes_dir
5128     else
5129         THES_SYSTEM_DIR=file:///usr/share/mythes
5130     fi
5131     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5132 else
5133     AC_MSG_RESULT([no])
5134     SYSTEM_DICTS=
5136 AC_SUBST(SYSTEM_DICTS)
5137 AC_SUBST(DICT_SYSTEM_DIR)
5138 AC_SUBST(HYPH_SYSTEM_DIR)
5139 AC_SUBST(THES_SYSTEM_DIR)
5141 dnl ===================================================================
5142 dnl Precompiled headers.
5143 ENABLE_PCH=""
5144 AC_MSG_CHECKING([whether to enable pch feature])
5145 if test -z "$enable_pch"; then
5146     if test "$_os" = "WINNT"; then
5147         # Enabled by default on Windows.
5148         enable_pch=yes
5149     else
5150         enable_pch=no
5151     fi
5153 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5154     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5156 if test "$enable_pch" = "system"; then
5157     ENABLE_PCH="1"
5158     AC_MSG_RESULT([yes (system headers)])
5159 elif test "$enable_pch" = "base"; then
5160     ENABLE_PCH="2"
5161     AC_MSG_RESULT([yes (system and base headers)])
5162 elif test "$enable_pch" = "normal"; then
5163     ENABLE_PCH="3"
5164     AC_MSG_RESULT([yes (normal)])
5165 elif test "$enable_pch" = "full"; then
5166     ENABLE_PCH="4"
5167     AC_MSG_RESULT([yes (full)])
5168 elif test "$enable_pch" = "yes"; then
5169     # Pick a suitable default.
5170     if test "$GCC" = "yes"; then
5171         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5172         # while making the PCHs larger and rebuilds more likely.
5173         ENABLE_PCH="2"
5174         AC_MSG_RESULT([yes (system and base headers)])
5175     else
5176         # With MSVC the highest level makes a significant difference,
5177         # and it was the default when there used to be no PCH levels.
5178         ENABLE_PCH="4"
5179         AC_MSG_RESULT([yes (full)])
5180     fi
5181 elif test "$enable_pch" = "no"; then
5182     AC_MSG_RESULT([no])
5183 else
5184     AC_MSG_ERROR([Unknown value for --enable-pch])
5186 AC_SUBST(ENABLE_PCH)
5187 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5188 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5189     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5190     if test "$CCACHE_BIN" != "not found"; then
5191         AC_MSG_CHECKING([ccache version])
5192         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5193         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5194         AC_MSG_RESULT([$CCACHE_VERSION])
5195         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5196         if test "$CCACHE_NUMVER" -gt "030701"; then
5197             AC_MSG_RESULT([yes])
5198         else
5199             AC_MSG_RESULT([no (not newer than 3.7.1)])
5200             CCACHE_DEPEND_MODE=
5201         fi
5202     fi
5205 TAB=`printf '\t'`
5207 AC_MSG_CHECKING([the GNU Make version])
5208 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5209 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5210 if test "$_make_longver" -ge "038200"; then
5211     AC_MSG_RESULT([$GNUMAKE $_make_version])
5213 elif test "$_make_longver" -ge "038100"; then
5214     if test "$build_os" = "cygwin"; then
5215         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5216     fi
5217     AC_MSG_RESULT([$GNUMAKE $_make_version])
5219     dnl ===================================================================
5220     dnl Search all the common names for sha1sum
5221     dnl ===================================================================
5222     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5223     if test -z "$SHA1SUM"; then
5224         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5225     elif test "$SHA1SUM" = "openssl"; then
5226         SHA1SUM="openssl sha1"
5227     fi
5228     AC_MSG_CHECKING([for GNU Make bug 20033])
5229     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5230     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5231 A := \$(wildcard *.a)
5233 .PHONY: all
5234 all: \$(A:.a=.b)
5235 <TAB>@echo survived bug20033.
5237 .PHONY: setup
5238 setup:
5239 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5241 define d1
5242 @echo lala \$(1)
5243 @sleep 1
5244 endef
5246 define d2
5247 @echo tyty \$(1)
5248 @sleep 1
5249 endef
5251 %.b : %.a
5252 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5253 <TAB>\$(call d1,\$(CHECKSUM)),\
5254 <TAB>\$(call d2,\$(CHECKSUM)))
5256     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5257         no_parallelism_make="YES"
5258         AC_MSG_RESULT([yes, disable parallelism])
5259     else
5260         AC_MSG_RESULT([no, keep parallelism enabled])
5261     fi
5262     rm -rf $TESTGMAKEBUG20033
5263 else
5264     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5267 # find if gnumake support file function
5268 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5269 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5270 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5271     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5273 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5274 \$(file >test.txt,Success )
5276 .PHONY: all
5277 all:
5278 <TAB>@cat test.txt
5281 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5282 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5283     HAVE_GNUMAKE_FILE_FUNC=TRUE
5284     AC_MSG_RESULT([yes])
5285 else
5286     AC_MSG_RESULT([no])
5288 rm -rf $TESTGMAKEFILEFUNC
5289 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5290 AC_SUBST(GNUMAKE_WIN_NATIVE)
5292 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5293 STALE_MAKE=
5294 if test "$_make_ver_check" = ""; then
5295    STALE_MAKE=TRUE
5298 HAVE_LD_HASH_STYLE=FALSE
5299 WITH_LINKER_HASH_STYLE=
5300 AC_MSG_CHECKING([for --hash-style gcc linker support])
5301 if test "$GCC" = "yes"; then
5302     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5303         hash_styles="gnu sysv"
5304     elif test "$with_linker_hash_style" = "no"; then
5305         hash_styles=
5306     else
5307         hash_styles="$with_linker_hash_style"
5308     fi
5310     for hash_style in $hash_styles; do
5311         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5312         hash_style_ldflags_save=$LDFLAGS
5313         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5315         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5316             [
5317 #include <stdio.h>
5318             ],[
5319 printf ("");
5320             ])],
5321             [
5322                   HAVE_LD_HASH_STYLE=TRUE
5323                   WITH_LINKER_HASH_STYLE=$hash_style
5324             ],
5325             [HAVE_LD_HASH_STYLE=FALSE],
5326             [HAVE_LD_HASH_STYLE=FALSE])
5327         LDFLAGS=$hash_style_ldflags_save
5328     done
5330     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5331         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5332     else
5333         AC_MSG_RESULT( no )
5334     fi
5335     LDFLAGS=$hash_style_ldflags_save
5336 else
5337     AC_MSG_RESULT( no )
5339 AC_SUBST(HAVE_LD_HASH_STYLE)
5340 AC_SUBST(WITH_LINKER_HASH_STYLE)
5342 dnl ===================================================================
5343 dnl Check whether there's a Perl version available.
5344 dnl ===================================================================
5345 if test -z "$with_perl_home"; then
5346     AC_PATH_PROG(PERL, perl)
5347 else
5348     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5349     _perl_path="$with_perl_home/bin/perl"
5350     if test -x "$_perl_path"; then
5351         PERL=$_perl_path
5352     else
5353         AC_MSG_ERROR([$_perl_path not found])
5354     fi
5357 dnl ===================================================================
5358 dnl Testing for Perl version 5 or greater.
5359 dnl $] is the Perl version variable, it is returned as an integer
5360 dnl ===================================================================
5361 if test "$PERL"; then
5362     AC_MSG_CHECKING([the Perl version])
5363     ${PERL} -e "exit($]);"
5364     _perl_version=$?
5365     if test "$_perl_version" -lt 5; then
5366         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5367     fi
5368     AC_MSG_RESULT([Perl $_perl_version])
5369 else
5370     AC_MSG_ERROR([Perl not found, install Perl 5])
5373 dnl ===================================================================
5374 dnl Testing for required Perl modules
5375 dnl ===================================================================
5377 AC_MSG_CHECKING([for required Perl modules])
5378 perl_use_string="use Cwd ; use Digest::MD5"
5379 if test "$_os" = "WINNT"; then
5380     if test -n "$PKGFORMAT"; then
5381         for i in $PKGFORMAT; do
5382             case "$i" in
5383             msi)
5384                 # for getting fonts versions to use in MSI
5385                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5386                 ;;
5387             esac
5388         done
5389     fi
5391 if test "$with_system_hsqldb" = "yes"; then
5392     perl_use_string="$perl_use_string ; use Archive::Zip"
5394 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5395     AC_MSG_RESULT([all modules found])
5396 else
5397     AC_MSG_RESULT([failed to find some modules])
5398     # Find out which modules are missing.
5399     for i in $perl_use_string; do
5400         if test "$i" != "use" -a "$i" != ";"; then
5401             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5402                 missing_perl_modules="$missing_perl_modules $i"
5403             fi
5404         fi
5405     done
5406     AC_MSG_ERROR([
5407     The missing Perl modules are: $missing_perl_modules
5408     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5411 dnl ===================================================================
5412 dnl Check for pkg-config
5413 dnl ===================================================================
5414 if test "$_os" != "WINNT"; then
5415     PKG_PROG_PKG_CONFIG
5418 if test "$_os" != "WINNT"; then
5420     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5421     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5422     # explicitly. Or put /path/to/compiler in PATH yourself.
5424     # Use wrappers for LTO
5425     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5426         AC_CHECK_TOOL(AR,gcc-ar)
5427         AC_CHECK_TOOL(NM,gcc-nm)
5428         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5429     else
5430         AC_CHECK_TOOL(AR,ar)
5431         AC_CHECK_TOOL(NM,nm)
5432         AC_CHECK_TOOL(RANLIB,ranlib)
5433     fi
5434     AC_CHECK_TOOL(OBJDUMP,objdump)
5435     AC_CHECK_TOOL(READELF,readelf)
5436     AC_CHECK_TOOL(STRIP,strip)
5437     if test "$_os" = "WINNT"; then
5438         AC_CHECK_TOOL(DLLTOOL,dlltool)
5439         AC_CHECK_TOOL(WINDRES,windres)
5440     fi
5442 AC_SUBST(AR)
5443 AC_SUBST(DLLTOOL)
5444 AC_SUBST(NM)
5445 AC_SUBST(OBJDUMP)
5446 AC_SUBST(PKG_CONFIG)
5447 AC_SUBST(RANLIB)
5448 AC_SUBST(READELF)
5449 AC_SUBST(STRIP)
5450 AC_SUBST(WINDRES)
5452 dnl ===================================================================
5453 dnl pkg-config checks on macOS
5454 dnl ===================================================================
5456 if test $_os = Darwin; then
5457     AC_MSG_CHECKING([for bogus pkg-config])
5458     if test -n "$PKG_CONFIG"; then
5459         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5460             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5461         else
5462             if test "$enable_bogus_pkg_config" = "yes"; then
5463                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5464             else
5465                 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.])
5466             fi
5467         fi
5468     else
5469         AC_MSG_RESULT([no, good])
5470     fi
5473 find_csc()
5475     # Return value: $csctest
5477     unset csctest
5479     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5480     if test -n "$regvalue"; then
5481         csctest=$regvalue
5482         return
5483     fi
5486 find_al()
5488     # Return value: $altest
5490     unset altest
5492     # We need this check to detect 4.6.1 or above.
5493     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5494         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5495         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5496             altest=$regvalue
5497             return
5498         fi
5499     done
5501     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5502         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5503         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5504             altest=$regvalue
5505             return
5506         fi
5507     done
5512 find_dotnetsdk46()
5514     unset frametest
5516     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5517         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5518         if test -n "$regvalue"; then
5519             frametest=$regvalue
5520             return
5521         fi
5522     done
5525 find_winsdk_version()
5527     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5528     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5530     unset winsdktest winsdkbinsubdir winsdklibsubdir
5532     case "$1" in
5533     8.0|8.0A)
5534         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5535         if test -n "$regvalue"; then
5536             winsdktest=$regvalue
5537             winsdklibsubdir=win8
5538             return
5539         fi
5540         ;;
5541     8.1|8.1A)
5542         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5543         if test -n "$regvalue"; then
5544             winsdktest=$regvalue
5545             winsdklibsubdir=winv6.3
5546             return
5547         fi
5548         ;;
5549     10.0)
5550         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5551         if test -n "$regvalue"; then
5552             winsdktest=$regvalue
5553             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5554             if test -n "$regvalue"; then
5555                 winsdkbinsubdir="$regvalue".0
5556                 winsdklibsubdir=$winsdkbinsubdir
5557                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5558                 # test exist the SDK path
5559                 if test -d "$tmppath"; then
5560                    # when path is convertible to a short path then path is okay
5561                    cygpath -d "$tmppath" >/dev/null 2>&1
5562                    if test $? -ne 0; then
5563                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5564                    fi
5565                 else
5566                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5567                 fi
5568             fi
5569             return
5570         fi
5571         ;;
5572     esac
5575 find_winsdk()
5577     # Return value: From find_winsdk_version
5579     unset winsdktest
5581     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5582         find_winsdk_version $ver
5583         if test -n "$winsdktest"; then
5584             return
5585         fi
5586     done
5589 find_msms()
5591     AC_MSG_CHECKING([for MSVC merge modules directory])
5592     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5593     case "$VCVER" in
5594         150|160)
5595         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5596         ;;
5597     esac
5598     for f in $my_msm_files; do
5599         echo "$as_me:$LINENO: searching for $f" >&5
5600     done
5602     msmdir=
5603     for ver in 14.0 15.0; do
5604         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5605         if test -n "$regvalue"; then
5606             for f in ${my_msm_files}; do
5607                 if test -e "$regvalue/${f}"; then
5608                     msmdir=$regvalue
5609                     break
5610                 fi
5611             done
5612         fi
5613     done
5614     dnl Is the following fallback really necessary, or was it added in response
5615     dnl to never having started Visual Studio on a given machine, so the
5616     dnl registry keys checked above had presumably not yet been created?
5617     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5618     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5619     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5620     dnl expanding to "C:\Program Files\Common Files"), which would need
5621     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5622     dnl obtain its value from cygwin:
5623     if test -z "$msmdir"; then
5624         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5625         for f in ${my_msm_files}; do
5626             if test -e "$my_msm_dir/${f}"; then
5627                 msmdir=$my_msm_dir
5628             fi
5629         done
5630     fi
5632     dnl Starting from MSVC 15.0, merge modules are located in different directory
5633     case "$VCVER" in
5634     150|160)
5635         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5636             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5637             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5638             for f in ${my_msm_files}; do
5639                 if test -e "$my_msm_dir/${f}"; then
5640                     msmdir=$my_msm_dir
5641                     break
5642                 fi
5643             done
5644         done
5645         ;;
5646     esac
5648     if test -n "$msmdir"; then
5649         msmdir=`cygpath -m "$msmdir"`
5650         AC_MSG_RESULT([$msmdir])
5651     else
5652         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5653             AC_MSG_FAILURE([not found])
5654         else
5655             AC_MSG_WARN([not found (check config.log)])
5656             add_warning "MSM none of ${my_msm_files} found"
5657         fi
5658     fi
5661 find_msvc_x64_dlls()
5663     AC_MSG_CHECKING([for MSVC x64 DLL path])
5664     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5665     case "$VCVER" in
5666     150|160)
5667         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5668             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5669             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5670                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5671                 break
5672             fi
5673             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5674             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5675                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5676                 break
5677             fi
5678             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5679             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5680                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5681                 break
5682             fi
5683         done
5684         ;;
5685     esac
5686     AC_MSG_RESULT([$msvcdllpath])
5687     AC_MSG_CHECKING([for MSVC x64 DLLs])
5688     msvcdlls="msvcp140.dll vcruntime140.dll"
5689     for dll in $msvcdlls; do
5690         if ! test -f "$msvcdllpath/$dll"; then
5691             AC_MSG_FAILURE([missing $dll])
5692         fi
5693     done
5694     AC_MSG_RESULT([found all ($msvcdlls)])
5697 dnl =========================================
5698 dnl Check for the Windows  SDK.
5699 dnl =========================================
5700 if test "$_os" = "WINNT"; then
5701     AC_MSG_CHECKING([for Windows SDK])
5702     if test "$build_os" = "cygwin"; then
5703         find_winsdk
5704         WINDOWS_SDK_HOME=$winsdktest
5706         # normalize if found
5707         if test -n "$WINDOWS_SDK_HOME"; then
5708             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5709             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5710         fi
5712         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5713     fi
5715     if test -n "$WINDOWS_SDK_HOME"; then
5716         # Remove a possible trailing backslash
5717         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5719         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5720              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5721              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5722             have_windows_sdk_headers=yes
5723         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5724              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5725              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5726             have_windows_sdk_headers=yes
5727         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5728              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5729              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5730             have_windows_sdk_headers=yes
5731         else
5732             have_windows_sdk_headers=no
5733         fi
5735         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5736             have_windows_sdk_libs=yes
5737         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5738             have_windows_sdk_libs=yes
5739         else
5740             have_windows_sdk_libs=no
5741         fi
5743         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5744             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5745 the  Windows SDK are installed.])
5746         fi
5747     fi
5749     if test -z "$WINDOWS_SDK_HOME"; then
5750         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5751     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5752         WINDOWS_SDK_VERSION=80
5753         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5754     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5755         WINDOWS_SDK_VERSION=81
5756         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5757     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5758         WINDOWS_SDK_VERSION=10
5759         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5760     else
5761         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5762     fi
5763     PathFormat "$WINDOWS_SDK_HOME"
5764     WINDOWS_SDK_HOME="$formatted_path"
5765     if test "$build_os" = "cygwin"; then
5766         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5767         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5768             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5769         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5770             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5771         fi
5772     fi
5774     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5775     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5776     dnl but not in v8.0), so allow this to be overridden with a
5777     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5778     dnl and configuration error if no WiLangId.vbs is found would arguably be
5779     dnl better, but I do not know under which conditions exactly it is needed by
5780     dnl msiglobal.pm:
5781     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5782         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5783         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5784             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5785         fi
5786         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5787             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5788         fi
5789         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5790             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5791         fi
5792     fi
5793     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5794         if test -n "$with_package_format" -a "$with_package_format" != no; then
5795             for i in "$with_package_format"; do
5796                 if test "$i" = "msi"; then
5797                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5798                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5799                     fi
5800                 fi
5801             done
5802         fi
5803     fi
5805 AC_SUBST(WINDOWS_SDK_HOME)
5806 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5807 AC_SUBST(WINDOWS_SDK_VERSION)
5808 AC_SUBST(WINDOWS_SDK_WILANGID)
5810 if test "$build_os" = "cygwin"; then
5811     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5812     dnl dir, it also determines that dir's path w/o an arch segment if any,
5813     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5814     AC_MSG_CHECKING([for midl.exe])
5816     find_winsdk
5817     if test -n "$winsdkbinsubdir" \
5818         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5819     then
5820         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5821         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5822     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5823         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5824         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5825     elif test -f "$winsdktest/Bin/midl.exe"; then
5826         MIDL_PATH=$winsdktest/Bin
5827         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5828     fi
5829     if test ! -f "$MIDL_PATH/midl.exe"; then
5830         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5831     else
5832         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5833     fi
5835     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5836     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5838     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5839          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5840          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5841          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5842     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5843          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5844          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5845          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5846     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5847          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5848          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5849          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5850     else
5851         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5852     fi
5854     dnl Check csc.exe
5855     AC_MSG_CHECKING([for csc.exe])
5856     find_csc
5857     if test -f "$csctest/csc.exe"; then
5858         CSC_PATH="$csctest"
5859     fi
5860     if test ! -f "$CSC_PATH/csc.exe"; then
5861         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5862     else
5863         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5864     fi
5866     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5868     dnl Check al.exe
5869     AC_MSG_CHECKING([for al.exe])
5870     find_winsdk
5871     if test -n "$winsdkbinsubdir" \
5872         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5873     then
5874         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5875     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5876         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5877     elif test -f "$winsdktest/Bin/al.exe"; then
5878         AL_PATH="$winsdktest/Bin"
5879     fi
5881     if test -z "$AL_PATH"; then
5882         find_al
5883         if test -f "$altest/bin/al.exe"; then
5884             AL_PATH="$altest/bin"
5885         elif test -f "$altest/al.exe"; then
5886             AL_PATH="$altest"
5887         fi
5888     fi
5889     if test ! -f "$AL_PATH/al.exe"; then
5890         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5891     else
5892         AC_MSG_RESULT([$AL_PATH/al.exe])
5893     fi
5895     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5897     dnl Check mscoree.lib / .NET Framework dir
5898     AC_MSG_CHECKING(.NET Framework)
5899     find_dotnetsdk46
5900     PathFormat "$frametest"
5901     frametest="$formatted_path"
5902     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5903         DOTNET_FRAMEWORK_HOME="$frametest"
5904     else
5905         find_winsdk
5906         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5907             DOTNET_FRAMEWORK_HOME="$winsdktest"
5908         fi
5909     fi
5910     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
5911         AC_MSG_ERROR([mscoree.lib not found])
5912     fi
5913     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5915     PathFormat "$MIDL_PATH"
5916     MIDL_PATH="$formatted_path"
5918     PathFormat "$AL_PATH"
5919     AL_PATH="$formatted_path"
5921     PathFormat "$DOTNET_FRAMEWORK_HOME"
5922     DOTNET_FRAMEWORK_HOME="$formatted_path"
5924     PathFormat "$CSC_PATH"
5925     CSC_PATH="$formatted_path"
5928 dnl ===================================================================
5929 dnl Check if stdc headers are available excluding MSVC.
5930 dnl ===================================================================
5931 if test "$_os" != "WINNT"; then
5932     AC_HEADER_STDC
5935 dnl ===================================================================
5936 dnl Testing for C++ compiler and version...
5937 dnl ===================================================================
5939 if test "$_os" != "WINNT"; then
5940     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5941     save_CXXFLAGS=$CXXFLAGS
5942     AC_PROG_CXX
5943     CXXFLAGS=$save_CXXFLAGS
5944     if test -z "$CXX_BASE"; then
5945         CXX_BASE=`first_arg_basename "$CXX"`
5946     fi
5949 dnl check for GNU C++ compiler version
5950 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5951     AC_MSG_CHECKING([the GNU C++ compiler version])
5953     _gpp_version=`$CXX -dumpversion`
5954     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5956     if test "$_gpp_majmin" -lt "700"; then
5957         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5958     else
5959         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5960     fi
5962     dnl see https://code.google.com/p/android/issues/detail?id=41770
5963         glibcxx_threads=no
5964         AC_LANG_PUSH([C++])
5965         AC_REQUIRE_CPP
5966         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5967         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5968             #include <bits/c++config.h>]],[[
5969             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5970             && !defined(_GLIBCXX__PTHREADS) \
5971             && !defined(_GLIBCXX_HAS_GTHREADS)
5972             choke me
5973             #endif
5974         ]])],[AC_MSG_RESULT([yes])
5975         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5976         AC_LANG_POP([C++])
5977         if test $glibcxx_threads = yes; then
5978             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5979         fi
5981 AC_SUBST(BOOST_CXXFLAGS)
5984 # prefx CXX with ccache if needed
5986 if test "$CCACHE" != ""; then
5987     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5988     AC_LANG_PUSH([C++])
5989     save_CXXFLAGS=$CXXFLAGS
5990     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5991     dnl an empty program will do, we're checking the compiler flags
5992     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5993                       [use_ccache=yes], [use_ccache=no])
5994     if test $use_ccache = yes; then
5995         AC_MSG_RESULT([yes])
5996     else
5997         CXX="$CCACHE $CXX"
5998         CXX_BASE="ccache $CXX_BASE"
5999         AC_MSG_RESULT([no])
6000     fi
6001     CXXFLAGS=$save_CXXFLAGS
6002     AC_LANG_POP([C++])
6005 dnl ===================================================================
6006 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6007 dnl ===================================================================
6009 if test "$_os" != "WINNT"; then
6010     AC_PROG_CXXCPP
6012     dnl Check whether there's a C pre-processor.
6013     AC_PROG_CPP
6017 dnl ===================================================================
6018 dnl Find integral type sizes and alignments
6019 dnl ===================================================================
6021 if test "$_os" != "WINNT"; then
6023 if test "$_os" = "iOS"; then
6024     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
6025     ac_cv_sizeof_long=8
6026     ac_cv_sizeof_short=2
6027     ac_cv_sizeof_int=4
6028     ac_cv_sizeof_long_long=8
6029     ac_cv_sizeof_double=8
6030     ac_cv_sizeof_voidp=8
6031 else
6032     AC_CHECK_SIZEOF(long)
6033     AC_CHECK_SIZEOF(short)
6034     AC_CHECK_SIZEOF(int)
6035     AC_CHECK_SIZEOF(long long)
6036     AC_CHECK_SIZEOF(double)
6037     AC_CHECK_SIZEOF(void*)
6040     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6041     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6042     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6043     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6044     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6046     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6047     m4_pattern_allow([AC_CHECK_ALIGNOF])
6048     m4_ifdef([AC_CHECK_ALIGNOF],
6049         [
6050             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6051             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6052             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6053             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6054         ],
6055         [
6056             case "$_os-$host_cpu" in
6057             Linux-i686)
6058                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6059                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6060                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6061                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6062                 ;;
6063             Linux-x86_64)
6064                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6065                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6066                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6067                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6068                 ;;
6069             *)
6070                 if test -z "$ac_cv_alignof_short" -o \
6071                         -z "$ac_cv_alignof_int" -o \
6072                         -z "$ac_cv_alignof_long" -o \
6073                         -z "$ac_cv_alignof_double"; then
6074                    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.])
6075                 fi
6076                 ;;
6077             esac
6078         ])
6080     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6081     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6082     if test $ac_cv_sizeof_long -eq 8; then
6083         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6084     elif test $ac_cv_sizeof_double -eq 8; then
6085         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6086     else
6087         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6088     fi
6090     dnl Check for large file support
6091     AC_SYS_LARGEFILE
6092     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6093         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6094     fi
6095     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6096         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6097     fi
6098 else
6099     # Hardcode for MSVC
6100     SAL_TYPES_SIZEOFSHORT=2
6101     SAL_TYPES_SIZEOFINT=4
6102     SAL_TYPES_SIZEOFLONG=4
6103     SAL_TYPES_SIZEOFLONGLONG=8
6104     if test "$BITNESS_OVERRIDE" = ""; then
6105         SAL_TYPES_SIZEOFPOINTER=4
6106     else
6107         SAL_TYPES_SIZEOFPOINTER=8
6108     fi
6109     SAL_TYPES_ALIGNMENT2=2
6110     SAL_TYPES_ALIGNMENT4=4
6111     SAL_TYPES_ALIGNMENT8=8
6112     LFS_CFLAGS=''
6114 AC_SUBST(LFS_CFLAGS)
6116 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6117 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6118 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6119 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6120 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6121 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6122 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6123 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6125 dnl ===================================================================
6126 dnl Check whether to enable runtime optimizations
6127 dnl ===================================================================
6128 ENABLE_RUNTIME_OPTIMIZATIONS=
6129 AC_MSG_CHECKING([whether to enable runtime optimizations])
6130 if test -z "$enable_runtime_optimizations"; then
6131     for i in $CC; do
6132         case $i in
6133         -fsanitize=*)
6134             enable_runtime_optimizations=no
6135             break
6136             ;;
6137         esac
6138     done
6140 if test "$enable_runtime_optimizations" != no; then
6141     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6142     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6143     AC_MSG_RESULT([yes])
6144 else
6145     AC_MSG_RESULT([no])
6147 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6149 dnl ===================================================================
6150 dnl Check if valgrind headers are available
6151 dnl ===================================================================
6152 ENABLE_VALGRIND=
6153 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6154     prev_cppflags=$CPPFLAGS
6155     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6156     # or where does it come from?
6157     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6158     AC_CHECK_HEADER([valgrind/valgrind.h],
6159         [ENABLE_VALGRIND=TRUE])
6160     CPPFLAGS=$prev_cppflags
6162 AC_SUBST([ENABLE_VALGRIND])
6163 if test -z "$ENABLE_VALGRIND"; then
6164     if test "$with_valgrind" = yes; then
6165         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6166     fi
6167     VALGRIND_CFLAGS=
6169 AC_SUBST([VALGRIND_CFLAGS])
6172 dnl ===================================================================
6173 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6174 dnl ===================================================================
6176 # We need at least the sys/sdt.h include header.
6177 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6178 if test "$SDT_H_FOUND" = "TRUE"; then
6179     # Found sys/sdt.h header, now make sure the c++ compiler works.
6180     # Old g++ versions had problems with probes in constructors/destructors.
6181     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6182     AC_LANG_PUSH([C++])
6183     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6184     #include <sys/sdt.h>
6185     class ProbeClass
6186     {
6187     private:
6188       int& ref;
6189       const char *name;
6191     public:
6192       ProbeClass(int& v, const char *n) : ref(v), name(n)
6193       {
6194         DTRACE_PROBE2(_test_, cons, name, ref);
6195       }
6197       void method(int min)
6198       {
6199         DTRACE_PROBE3(_test_, meth, name, ref, min);
6200         ref -= min;
6201       }
6203       ~ProbeClass()
6204       {
6205         DTRACE_PROBE2(_test_, dest, name, ref);
6206       }
6207     };
6208     ]],[[
6209     int i = 64;
6210     DTRACE_PROBE1(_test_, call, i);
6211     ProbeClass inst = ProbeClass(i, "call");
6212     inst.method(24);
6213     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6214           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6215     AC_LANG_POP([C++])
6217 AC_CONFIG_HEADERS([config_host/config_probes.h])
6219 dnl ===================================================================
6220 dnl GCC features
6221 dnl ===================================================================
6222 HAVE_GCC_STACK_CLASH_PROTECTION=
6223 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6224     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6225     save_CFLAGS=$CFLAGS
6226     CFLAGS="$CFLAGS -fstack-clash-protection"
6227     AC_LINK_IFELSE(
6228         [AC_LANG_PROGRAM(, [[return 0;]])],
6229         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6230         [AC_MSG_RESULT([no])])
6231     CFLAGS=$save_CFLAGS
6233     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6234     save_CFLAGS=$CFLAGS
6235     CFLAGS="$CFLAGS -Werror -mno-avx"
6236     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6237     CFLAGS=$save_CFLAGS
6238     if test "$HAVE_GCC_AVX" = "TRUE"; then
6239         AC_MSG_RESULT([yes])
6240     else
6241         AC_MSG_RESULT([no])
6242     fi
6244     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6245     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6246     int v = 0;
6247     if (__sync_add_and_fetch(&v, 1) != 1 ||
6248         __sync_sub_and_fetch(&v, 1) != 0)
6249         return 1;
6250     __sync_synchronize();
6251     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6252         v != 1)
6253         return 1;
6254     return 0;
6255 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6256     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6257         AC_MSG_RESULT([yes])
6258         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6259     else
6260         AC_MSG_RESULT([no])
6261     fi
6263     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6264     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6265     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6266         AC_MSG_RESULT([yes])
6267         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6268     else
6269         AC_MSG_RESULT([no])
6270     fi
6272     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6273     save_CFLAGS=$CFLAGS
6274     CFLAGS="$CFLAGS -Werror"
6275     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6276             __attribute__((deprecated("test"))) void f();
6277         ])], [
6278             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6279             AC_MSG_RESULT([yes])
6280         ], [AC_MSG_RESULT([no])])
6281     CFLAGS=$save_CFLAGS
6283     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6284     AC_LANG_PUSH([C++])
6285     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6286             #include <cstddef>
6287             #include <cxxabi.h>
6288             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6289         ])], [
6290             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6291             AC_MSG_RESULT([yes])
6292         ], [AC_MSG_RESULT([no])])
6293     AC_LANG_POP([C++])
6295     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6296     AC_LANG_PUSH([C++])
6297     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6298             #include <cstddef>
6299             #include <cxxabi.h>
6300             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6301         ])], [
6302             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6303             AC_MSG_RESULT([yes])
6304         ], [AC_MSG_RESULT([no])])
6305     AC_LANG_POP([C++])
6307     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6308     AC_LANG_PUSH([C++])
6309     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6310             #include <cxxabi.h>
6311             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6312         ])], [
6313             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6314             AC_MSG_RESULT([yes])
6315         ], [AC_MSG_RESULT([no])])
6316     AC_LANG_POP([C++])
6318     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6319     AC_LANG_PUSH([C++])
6320     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6321             #include <cstddef>
6322             #include <cxxabi.h>
6323             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6324         ])], [
6325             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6326             AC_MSG_RESULT([yes])
6327         ], [AC_MSG_RESULT([no])])
6328     AC_LANG_POP([C++])
6330     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6331     AC_LANG_PUSH([C++])
6332     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6333             #include <cstddef>
6334             #include <cxxabi.h>
6335             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6336         ])], [
6337             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6338             AC_MSG_RESULT([yes])
6339         ], [AC_MSG_RESULT([no])])
6340     AC_LANG_POP([C++])
6342     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6343     AC_LANG_PUSH([C++])
6344     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6345             #include <cxxabi.h>
6346             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6347         ])], [
6348             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6349             AC_MSG_RESULT([yes])
6350         ], [AC_MSG_RESULT([no])])
6351     AC_LANG_POP([C++])
6353     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6354     AC_LANG_PUSH([C++])
6355     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6356             #include <cxxabi.h>
6357             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6358         ])], [
6359             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6360             AC_MSG_RESULT([yes])
6361         ], [AC_MSG_RESULT([no])])
6362     AC_LANG_POP([C++])
6364     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6365     AC_LANG_PUSH([C++])
6366     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6367             #include <cxxabi.h>
6368             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6369         ])], [
6370             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6371             AC_MSG_RESULT([yes])
6372         ], [AC_MSG_RESULT([no])])
6373     AC_LANG_POP([C++])
6375     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6376     AC_LANG_PUSH([C++])
6377     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6378             #include <cstddef>
6379             #include <cxxabi.h>
6380             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6381         ])], [
6382             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6383             AC_MSG_RESULT([yes])
6384         ], [AC_MSG_RESULT([no])])
6385     AC_LANG_POP([C++])
6387     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6388     AC_LANG_PUSH([C++])
6389     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6390             #include <cstddef>
6391             #include <cxxabi.h>
6392             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6393         ])], [
6394             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6395             AC_MSG_RESULT([yes])
6396         ], [AC_MSG_RESULT([no])])
6397     AC_LANG_POP([C++])
6399     dnl Available in GCC 4.9 and at least since Clang 3.4:
6400     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6401     AC_LANG_PUSH([C++])
6402     save_CXXFLAGS=$CXXFLAGS
6403     CXXFLAGS="$CXXFLAGS -Werror"
6404     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6405             struct __attribute__((warn_unused)) dummy {};
6406         ])], [
6407             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6408             AC_MSG_RESULT([yes])
6409         ], [AC_MSG_RESULT([no])])
6410     CXXFLAGS=$save_CXXFLAGS
6411 AC_LANG_POP([C++])
6414 AC_SUBST(HAVE_GCC_AVX)
6415 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6416 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6417 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6419 dnl ===================================================================
6420 dnl Identify the C++ library
6421 dnl ===================================================================
6423 AC_MSG_CHECKING([what the C++ library is])
6424 AC_LANG_PUSH([C++])
6425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6426 #include <utility>
6427 #ifndef __GLIBCXX__
6428 foo bar
6429 #endif
6430 ]])],
6431     [CPP_LIBRARY=GLIBCXX
6432      cpp_library_name="GNU libstdc++"
6433     ],
6434     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6435 #include <utility>
6436 #ifndef _LIBCPP_VERSION
6437 foo bar
6438 #endif
6439 ]])],
6440     [CPP_LIBRARY=LIBCPP
6441      cpp_library_name="LLVM libc++"
6442      AC_DEFINE([HAVE_LIBCXX])
6443     ],
6444     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6445 #include <utility>
6446 #ifndef _MSC_VER
6447 foo bar
6448 #endif
6449 ]])],
6450     [CPP_LIBRARY=MSVCRT
6451      cpp_library_name="Microsoft"
6452     ],
6453     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6454 AC_MSG_RESULT([$cpp_library_name])
6455 AC_LANG_POP([C++])
6457 dnl ===================================================================
6458 dnl Check for gperf
6459 dnl ===================================================================
6460 AC_PATH_PROG(GPERF, gperf)
6461 if test -z "$GPERF"; then
6462     AC_MSG_ERROR([gperf not found but needed. Install it.])
6464 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6465     GPERF=`cygpath -m $GPERF`
6467 AC_MSG_CHECKING([whether gperf is new enough])
6468 my_gperf_ver1=$($GPERF --version | head -n 1)
6469 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6470 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6471 if test "$my_gperf_ver3" -ge 301; then
6472     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6473 else
6474     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6476 AC_SUBST(GPERF)
6478 dnl ===================================================================
6479 dnl Check for system libcmis
6480 dnl ===================================================================
6481 # libcmis requires curl and we can't build curl for iOS
6482 if test $_os != iOS; then
6483     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6484     ENABLE_LIBCMIS=TRUE
6485 else
6486     ENABLE_LIBCMIS=
6488 AC_SUBST(ENABLE_LIBCMIS)
6490 dnl ===================================================================
6491 dnl C++11
6492 dnl ===================================================================
6494 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6495 CXXFLAGS_CXX11=
6496 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6497     if test "$with_latest_c__" = yes; then
6498         CXXFLAGS_CXX11=-std:c++latest
6499     else
6500         CXXFLAGS_CXX11=-std:c++17
6501     fi
6502     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
6503 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6504     my_flags='-std=c++17 -std=c++1z'
6505     if test "$with_latest_c__" = yes; then
6506         my_flags="-std=gnu++2a -std=c++2a $my_flags"
6507     fi
6508     for flag in $my_flags; do
6509         if test "$COM" = MSC; then
6510             flag="-Xclang $flag"
6511         fi
6512         save_CXXFLAGS=$CXXFLAGS
6513         CXXFLAGS="$CXXFLAGS $flag -Werror"
6514         if test "$SYSTEM_LIBCMIS" = TRUE; then
6515             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6516         fi
6517         AC_LANG_PUSH([C++])
6518         dnl Clang 3.9 supports __float128 since
6519         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6520         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6521         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6522         dnl $flag is supported below, so check this first):
6523         my_float128hack=
6524         my_float128hack_impl=-D__float128=void
6525         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6526             #include <vector>
6527             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6528             // (__float128)
6529             ]])
6530         ],,[
6531             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6532             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6533             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6534             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6535             dnl place where __float128 is used is in a template specialization, -D__float128=void
6536             dnl will avoid the problem there while still causing a problem if somebody actually uses
6537             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6538             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6539             dnl "fixed" with this hack):
6540             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6541             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6542                 #include <vector>
6543                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6544                 // (__float128)
6545                 ]])
6546             ],[my_float128hack=$my_float128hack_impl])
6547         ])
6548         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6549             #include <algorithm>
6550             #include <functional>
6551             #include <vector>
6553             #if defined SYSTEM_LIBCMIS
6554             // See ucb/source/ucp/cmis/auth_provider.hxx:
6555             #if !defined __clang__
6556             #pragma GCC diagnostic push
6557             #pragma GCC diagnostic ignored "-Wdeprecated"
6558             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6559             #endif
6560             #include <libcmis/libcmis.hxx>
6561             #if !defined __clang__
6562             #pragma GCC diagnostic pop
6563             #endif
6564             #endif
6566             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6567                 std::sort(v.begin(), v.end(), fn);
6568             }
6569             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6570         AC_LANG_POP([C++])
6571         CXXFLAGS=$save_CXXFLAGS
6572         if test -n "$CXXFLAGS_CXX11"; then
6573             break
6574         fi
6575     done
6577 if test -n "$CXXFLAGS_CXX11"; then
6578     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6579 else
6580     AC_MSG_ERROR(no)
6582 AC_SUBST(CXXFLAGS_CXX11)
6584 if test "$GCC" = "yes"; then
6585     save_CXXFLAGS=$CXXFLAGS
6586     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6587     CHECK_L_ATOMIC
6588     CXXFLAGS=$save_CXXFLAGS
6589     AC_SUBST(ATOMIC_LIB)
6592 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6593 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6594 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6595 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6596 dnl again towards 4.7.2:
6597 if test $CPP_LIBRARY = GLIBCXX; then
6598     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6599     AC_LANG_PUSH([C++])
6600     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6601 #include <list>
6602 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6603     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6604     //   GCC 4.7.0: 20120322
6605     //   GCC 4.7.1: 20120614
6606     // and using a range check is not possible as the mapping between
6607     // __GLIBCXX__ values and GCC versions is not monotonic
6608 /* ok */
6609 #else
6610 abi broken
6611 #endif
6612         ]])], [AC_MSG_RESULT(no, ok)],
6613         [AC_MSG_ERROR(yes)])
6614     AC_LANG_POP([C++])
6617 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6618 save_CXXFLAGS=$CXXFLAGS
6619 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6620 AC_LANG_PUSH([C++])
6622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6623 #include <stddef.h>
6625 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6627 namespace
6629         struct b
6630         {
6631                 int i;
6632                 int j;
6633         };
6635 ]], [[
6636 struct a
6638         int i;
6639         int j;
6641 a thinga[]={{0,0}, {1,1}};
6642 b thingb[]={{0,0}, {1,1}};
6643 size_t i = sizeof(sal_n_array_size(thinga));
6644 size_t j = sizeof(sal_n_array_size(thingb));
6645 return !(i != 0 && j != 0);
6647     ], [ AC_MSG_RESULT(yes) ],
6648     [ AC_MSG_ERROR(no)])
6649 AC_LANG_POP([C++])
6650 CXXFLAGS=$save_CXXFLAGS
6652 dnl _Pragma support (may require C++11)
6653 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6654     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6655     AC_LANG_PUSH([C++])
6656     save_CXXFLAGS=$CXXFLAGS
6657     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6658     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6659             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6660         ])], [
6661             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6662             AC_MSG_RESULT([yes])
6663         ], [AC_MSG_RESULT([no])])
6664     AC_LANG_POP([C++])
6665     CXXFLAGS=$save_CXXFLAGS
6668 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6669 if test "$GCC" = yes; then
6670     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6671     AC_LANG_PUSH([C++])
6672     save_CXXFLAGS=$CXXFLAGS
6673     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6674     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6675     CXXFLAGS=$save_CXXFLAGS
6676     AC_LANG_POP([C++])
6677     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6678         AC_MSG_RESULT([yes])
6679     else
6680         AC_MSG_RESULT([no])
6681     fi
6683 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6685 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6686 AC_LANG_PUSH([C++])
6687 save_CXXFLAGS=$CXXFLAGS
6688 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6689 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6690         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6691         // supporting it:
6692         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6693         struct S {
6694         private:
6695             S(S const &);
6696         public:
6697             S();
6698             ~S();
6699         };
6700         S copy();
6701         void f() { S c(copy()); }
6702         #endif
6703     ])], [
6704         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6705         AC_MSG_RESULT([yes])
6706     ], [AC_MSG_RESULT([no])])
6707 CXXFLAGS=$save_CXXFLAGS
6708 AC_LANG_POP([C++])
6710 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
6711 AC_LANG_PUSH([C++])
6712 save_CXXFLAGS=$CXXFLAGS
6713 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6714 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6715         #include <algorithm>
6716         #include <initializer_list>
6717         #include <vector>
6718         template<typename T> class S {
6719         private:
6720             std::vector<T> v_;
6721         public:
6722             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
6723         };
6724         constinit S<int> s{3, 2, 1};
6725     ])], [
6726         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
6727         AC_MSG_RESULT([yes])
6728     ], [AC_MSG_RESULT([no])])
6729 CXXFLAGS=$save_CXXFLAGS
6730 AC_LANG_POP([C++])
6732 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
6733 AC_LANG_PUSH([C++])
6734 save_CXXFLAGS=$CXXFLAGS
6735 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6736 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6737         #include <span>
6738         #include <type_traits>
6739         // Don't check size_type directly, as it was called index_type before P1872R0:
6740         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
6741     ])], [
6742         AC_DEFINE([HAVE_CPP_SPAN],[1])
6743         AC_MSG_RESULT([yes])
6744     ], [AC_MSG_RESULT([no])])
6745 CXXFLAGS=$save_CXXFLAGS
6746 AC_LANG_POP([C++])
6748 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6749 AC_LANG_PUSH([C++])
6750 save_CXXFLAGS=$CXXFLAGS
6751 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6752 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6753         struct S1 { S1(S1 &&); };
6754         struct S2: S1 {};
6755         S1 f(S2 s) { return s; }
6756     ])], [
6757         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6758         AC_MSG_RESULT([yes])
6759     ], [AC_MSG_RESULT([no])])
6760 CXXFLAGS=$save_CXXFLAGS
6761 AC_LANG_POP([C++])
6763 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6764 dnl uninitialized warning for code like
6766 dnl   OString f();
6767 dnl   boost::optional<OString> * g(bool b) {
6768 dnl       boost::optional<OString> o;
6769 dnl       if (b) o = f();
6770 dnl       return new boost::optional<OString>(o);
6771 dnl   }
6773 dnl (as is e.g. present, in a slightly more elaborate form, in
6774 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6775 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6776 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6777 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6778     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6779     AC_LANG_PUSH([C++])
6780     save_CXXFLAGS=$CXXFLAGS
6781     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6782     if test "$ENABLE_OPTIMIZED" = TRUE; then
6783         CXXFLAGS="$CXXFLAGS -O2"
6784     else
6785         CXXFLAGS="$CXXFLAGS -O0"
6786     fi
6787     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6788             #include <new>
6789             void f1(int);
6790             struct S1 {
6791                 ~S1() { f1(n); }
6792                 int n = 0;
6793             };
6794             struct S2 {
6795                 S2() {}
6796                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6797                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6798                 void set(S1 s) {
6799                     new (stg) S1(s);
6800                     init = true;
6801                 }
6802                 bool init = false;
6803                 char stg[sizeof (S1)];
6804             } ;
6805             S1 f2();
6806             S2 * f3(bool b) {
6807                 S2 o;
6808                 if (b) o.set(f2());
6809                 return new S2(o);
6810             }
6811         ]])], [AC_MSG_RESULT([no])], [
6812             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6813             AC_MSG_RESULT([yes])
6814         ])
6815     CXXFLAGS=$save_CXXFLAGS
6816     AC_LANG_POP([C++])
6818 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6820 dnl ===================================================================
6821 dnl CPU Intrinsics support - SSE, AVX
6822 dnl ===================================================================
6824 INTRINSICS_CXXFLAGS=""
6826 if test "$GCC" = "yes"; then
6827     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6828     AC_LANG_PUSH([C++])
6829     save_CXXFLAGS=$CXXFLAGS
6830     CXXFLAGS="$CXXFLAGS -msse2"
6831     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6832         #include <emmintrin.h>
6833         int main () {
6834             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6835             c = _mm_xor_si128 (a, b);
6836             return 0;
6837         }
6838         ])],
6839         [can_compile_sse2=yes],
6840         [can_compile_sse2=no])
6841     AC_LANG_POP([C++])
6842     CXXFLAGS=$save_CXXFLAGS
6843     AC_MSG_RESULT([${can_compile_sse2}])
6844     if test "${can_compile_sse2}" = "yes" ; then
6845         INTRINSICS_CXXFLAGS="-msse2"
6846     else
6847         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6848     fi
6850     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6851     AC_LANG_PUSH([C++])
6852     save_CXXFLAGS=$CXXFLAGS
6853     CXXFLAGS="$CXXFLAGS -mssse3"
6854     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6855         #include <tmmintrin.h>
6856         int main () {
6857             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6858             c = _mm_maddubs_epi16 (a, b);
6859             return 0;
6860         }
6861         ])],
6862         [can_compile_ssse3=yes],
6863         [can_compile_ssse3=no])
6864     AC_LANG_POP([C++])
6865     CXXFLAGS=$save_CXXFLAGS
6866     AC_MSG_RESULT([${can_compile_ssse3}])
6867     if test "${can_compile_ssse3}" = "yes" ; then
6868         INTRINSICS_CXXFLAGS="-mssse3"
6869     else
6870         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6871     fi
6873     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6874     AC_LANG_PUSH([C++])
6875     save_CXXFLAGS=$CXXFLAGS
6876     CXXFLAGS="$CXXFLAGS -mavx"
6877     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6878         #include <immintrin.h>
6879         int main () {
6880             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6881             c = _mm256_xor_ps(a, b);
6882             return 0;
6883         }
6884         ])],
6885         [can_compile_avx=yes],
6886         [can_compile_avx=no])
6887     AC_LANG_POP([C++])
6888     CXXFLAGS=$save_CXXFLAGS
6889     AC_MSG_RESULT([${can_compile_avx}])
6890     if test "${can_compile_avx}" = "yes" ; then
6891         INTRINSICS_CXXFLAGS="-mavx"
6892     else
6893         AC_MSG_WARN([cannot compile AVX intrinsics])
6894     fi
6896     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6897     AC_LANG_PUSH([C++])
6898     save_CXXFLAGS=$CXXFLAGS
6899     CXXFLAGS="$CXXFLAGS -mavx2"
6900     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6901         #include <immintrin.h>
6902         int main () {
6903             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6904             c = _mm256_maddubs_epi16(a, b);
6905             return 0;
6906         }
6907         ])],
6908         [can_compile_avx2=yes],
6909         [can_compile_avx2=no])
6910     AC_LANG_POP([C++])
6911     CXXFLAGS=$save_CXXFLAGS
6912     AC_MSG_RESULT([${can_compile_avx2}])
6913     if test "${can_compile_avx2}" = "yes" ; then
6914         INTRINSICS_CXXFLAGS="-mavx2"
6915     else
6916         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6917     fi
6920 AC_SUBST([INTRINSICS_CXXFLAGS])
6922 dnl ===================================================================
6923 dnl system stl sanity tests
6924 dnl ===================================================================
6925 if test "$_os" != "WINNT"; then
6927     AC_LANG_PUSH([C++])
6929     save_CPPFLAGS="$CPPFLAGS"
6930     if test -n "$MACOSX_SDK_PATH"; then
6931         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6932     fi
6934     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6935     # only.
6936     if test "$CPP_LIBRARY" = GLIBCXX; then
6937         dnl gcc#19664, gcc#22482, rhbz#162935
6938         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6939         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6940         AC_MSG_RESULT([$stlvisok])
6941         if test "$stlvisok" = "no"; then
6942             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6943         fi
6944     fi
6946     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6947     # when we don't make any dynamic libraries?
6948     if test "$DISABLE_DYNLOADING" = ""; then
6949         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6950         cat > conftestlib1.cc <<_ACEOF
6951 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6952 struct S2: S1<int> { virtual ~S2(); };
6953 S2::~S2() {}
6954 _ACEOF
6955         cat > conftestlib2.cc <<_ACEOF
6956 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6957 struct S2: S1<int> { virtual ~S2(); };
6958 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6959 _ACEOF
6960         gccvisinlineshiddenok=yes
6961         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6962             gccvisinlineshiddenok=no
6963         else
6964             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6965             dnl known to not work with -z defs (unsetting which makes the test
6966             dnl moot, though):
6967             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6968             if test "$COM_IS_CLANG" = TRUE; then
6969                 for i in $CXX $CXXFLAGS; do
6970                     case $i in
6971                     -fsanitize=*)
6972                         my_linkflagsnoundefs=
6973                         break
6974                         ;;
6975                     esac
6976                 done
6977             fi
6978             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6979                 gccvisinlineshiddenok=no
6980             fi
6981         fi
6983         rm -fr libconftest*
6984         AC_MSG_RESULT([$gccvisinlineshiddenok])
6985         if test "$gccvisinlineshiddenok" = "no"; then
6986             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6987         fi
6988     fi
6990    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6991     cat >visibility.cxx <<_ACEOF
6992 #pragma GCC visibility push(hidden)
6993 struct __attribute__ ((visibility ("default"))) TestStruct {
6994   static void Init();
6996 __attribute__ ((visibility ("default"))) void TestFunc() {
6997   TestStruct::Init();
6999 _ACEOF
7000     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7001         gccvisbroken=yes
7002     else
7003         case "$host_cpu" in
7004         i?86|x86_64)
7005             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7006                 gccvisbroken=no
7007             else
7008                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7009                     gccvisbroken=no
7010                 else
7011                     gccvisbroken=yes
7012                 fi
7013             fi
7014             ;;
7015         *)
7016             gccvisbroken=no
7017             ;;
7018         esac
7019     fi
7020     rm -f visibility.s visibility.cxx
7022     AC_MSG_RESULT([$gccvisbroken])
7023     if test "$gccvisbroken" = "yes"; then
7024         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7025     fi
7027     CPPFLAGS="$save_CPPFLAGS"
7029     AC_LANG_POP([C++])
7032 dnl ===================================================================
7033 dnl  Clang++ tests
7034 dnl ===================================================================
7036 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7037 if test "$GCC" = "yes"; then
7038     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7039     AC_LANG_PUSH([C++])
7040     save_CXXFLAGS=$CXXFLAGS
7041     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7042     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7043     CXXFLAGS=$save_CXXFLAGS
7044     AC_LANG_POP([C++])
7045     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7046         AC_MSG_RESULT([yes])
7047     else
7048         AC_MSG_RESULT([no])
7049     fi
7051 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7053 dnl ===================================================================
7054 dnl Compiler plugins
7055 dnl ===================================================================
7057 COMPILER_PLUGINS=
7058 # currently only Clang
7060 if test "$COM_IS_CLANG" != "TRUE"; then
7061     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7062         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7063         enable_compiler_plugins=no
7064     fi
7067 if test "$COM_IS_CLANG" = "TRUE"; then
7068     if test -n "$enable_compiler_plugins"; then
7069         compiler_plugins="$enable_compiler_plugins"
7070     elif test -n "$ENABLE_DBGUTIL"; then
7071         compiler_plugins=test
7072     else
7073         compiler_plugins=no
7074     fi
7075     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7076         if test "$CLANGVER" -lt 50002; then
7077             if test "$compiler_plugins" = yes; then
7078                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7079             else
7080                 compiler_plugins=no
7081             fi
7082         fi
7083     fi
7084     if test "$compiler_plugins" != "no"; then
7085         dnl The prefix where Clang resides, override to where Clang resides if
7086         dnl using a source build:
7087         if test -z "$CLANGDIR"; then
7088             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7089         fi
7090         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7091         if test -z "$COMPILER_PLUGINS_CXX"; then
7092             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7093         fi
7094         clangbindir=$CLANGDIR/bin
7095         if test "$build_os" = "cygwin"; then
7096             clangbindir=$(cygpath -u "$clangbindir")
7097         fi
7098         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7099         if test -n "$LLVM_CONFIG"; then
7100             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7101             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7102             if test -z "$CLANGLIBDIR"; then
7103                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7104             fi
7105             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7106             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7107             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7108             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7109                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7110             fi
7111             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7112             clangobjdir=$($LLVM_CONFIG --obj-root)
7113             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7114                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7115             fi
7116         fi
7117         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7118         AC_LANG_PUSH([C++])
7119         save_CXX=$CXX
7120         save_CXXCPP=$CXXCPP
7121         save_CPPFLAGS=$CPPFLAGS
7122         save_CXXFLAGS=$CXXFLAGS
7123         save_LDFLAGS=$LDFLAGS
7124         save_LIBS=$LIBS
7125         CXX=$COMPILER_PLUGINS_CXX
7126         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7127         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7128         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7129         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7130             [COMPILER_PLUGINS=TRUE],
7131             [
7132             if test "$compiler_plugins" = "yes"; then
7133                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7134             else
7135                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7136                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7137             fi
7138             ])
7139         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7140         dnl comment in compilerplugins/Makefile-clang.mk:
7141         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7142             LDFLAGS=""
7143             AC_MSG_CHECKING([for clang libraries to use])
7144             if test -z "$CLANGTOOLLIBS"; then
7145                 LIBS="-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSema -lclangEdit \
7146  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7147                 AC_LINK_IFELSE([
7148                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7149                         [[ clang::FullSourceLoc().dump(); ]])
7150                 ],[CLANGTOOLLIBS="$LIBS"],[])
7151             fi
7152             if test -z "$CLANGTOOLLIBS"; then
7153                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7154                 AC_LINK_IFELSE([
7155                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7156                         [[ clang::FullSourceLoc().dump(); ]])
7157                 ],[CLANGTOOLLIBS="$LIBS"],[])
7158             fi
7159             AC_MSG_RESULT([$CLANGTOOLLIBS])
7160             if test -z "$CLANGTOOLLIBS"; then
7161                 if test "$compiler_plugins" = "yes"; then
7162                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7163                 else
7164                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7165                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7166                 fi
7167                 COMPILER_PLUGINS=
7168             fi
7169             if test -n "$COMPILER_PLUGINS"; then
7170                 if test -z "$CLANGSYSINCLUDE"; then
7171                     if test -n "$LLVM_CONFIG"; then
7172                         # Path to the clang system headers (no idea if there's a better way to get it).
7173                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/svn//')/include
7174                     fi
7175                 fi
7176             fi
7177         fi
7178         CXX=$save_CXX
7179         CXXCPP=$save_CXXCPP
7180         CPPFLAGS=$save_CPPFLAGS
7181         CXXFLAGS=$save_CXXFLAGS
7182         LDFLAGS=$save_LDFLAGS
7183         LIBS="$save_LIBS"
7184         AC_LANG_POP([C++])
7185     fi
7186 else
7187     if test "$enable_compiler_plugins" = "yes"; then
7188         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7189     fi
7191 AC_SUBST(COMPILER_PLUGINS)
7192 AC_SUBST(COMPILER_PLUGINS_CXX)
7193 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7194 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7195 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7196 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7197 AC_SUBST(CLANGDIR)
7198 AC_SUBST(CLANGLIBDIR)
7199 AC_SUBST(CLANGTOOLLIBS)
7200 AC_SUBST(CLANGSYSINCLUDE)
7202 # Plugin to help linker.
7203 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7204 # This makes --enable-lto build with clang work.
7205 AC_SUBST(LD_PLUGIN)
7207 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7208 AC_SUBST(HAVE_POSIX_FALLOCATE)
7210 dnl ===================================================================
7211 dnl Custom build version
7212 dnl ===================================================================
7214 AC_MSG_CHECKING([whether to add custom build version])
7215 if test "$with_build_version" != ""; then
7216     BUILD_VER_STRING=$with_build_version
7217     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7218 else
7219     BUILD_VER_STRING=
7220     AC_MSG_RESULT([no])
7222 AC_SUBST(BUILD_VER_STRING)
7224 JITC_PROCESSOR_TYPE=""
7225 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7226     # IBMs JDK needs this...
7227     JITC_PROCESSOR_TYPE=6
7228     export JITC_PROCESSOR_TYPE
7230 AC_SUBST([JITC_PROCESSOR_TYPE])
7232 # Misc Windows Stuff
7233 AC_ARG_WITH(ucrt-dir,
7234     AS_HELP_STRING([--with-ucrt-dir],
7235         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7236         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7237         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7238             Windows6.1-KB2999226-x64.msu
7239             Windows6.1-KB2999226-x86.msu
7240             Windows8.1-KB2999226-x64.msu
7241             Windows8.1-KB2999226-x86.msu
7242             Windows8-RT-KB2999226-x64.msu
7243             Windows8-RT-KB2999226-x86.msu
7244         A zip archive including those files is available from Microsoft site:
7245         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7247 UCRT_REDISTDIR="$with_ucrt_dir"
7248 if test $_os = "WINNT"; then
7249     find_msvc_x64_dlls
7250     find_msms
7251     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7252     MSVC_DLLS="$msvcdlls"
7253     MSM_PATH=`win_short_path_for_make "$msmdir"`
7254     # MSVC 15.3 changed it to VC141
7255     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7256         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7257     else
7258         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7259     fi
7261     if test "$UCRT_REDISTDIR" = "no"; then
7262         dnl explicitly disabled
7263         UCRT_REDISTDIR=""
7264     else
7265         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7266                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7267                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7268                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7269                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7270                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7271             UCRT_REDISTDIR=""
7272             if test -n "$PKGFORMAT"; then
7273                for i in $PKGFORMAT; do
7274                    case "$i" in
7275                    msi)
7276                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7277                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7278                        ;;
7279                    esac
7280                done
7281             fi
7282         fi
7283     fi
7286 AC_SUBST(UCRT_REDISTDIR)
7287 AC_SUBST(MSVC_DLL_PATH)
7288 AC_SUBST(MSVC_DLLS)
7289 AC_SUBST(MSM_PATH)
7291 dnl ===================================================================
7292 dnl Checks for Java
7293 dnl ===================================================================
7294 if test "$ENABLE_JAVA" != ""; then
7296     # Windows-specific tests
7297     if test "$build_os" = "cygwin"; then
7298         if test "$BITNESS_OVERRIDE" = 64; then
7299             bitness=64
7300         else
7301             bitness=32
7302         fi
7304         if test -z "$with_jdk_home"; then
7305             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7306             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7307             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7308             if test -n "$regvalue"; then
7309                 ver=$regvalue
7310                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7311                 _jdk_home=$regvalue
7312             fi
7313             if test -z "$with_jdk_home"; then
7314                 for ver in 1.8; do
7315                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7316                     if test -n "$regvalue"; then
7317                         _jdk_home=$regvalue
7318                         break
7319                     fi
7320                 done
7321             fi
7322             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7323                 with_jdk_home="$_jdk_home"
7324                 howfound="found automatically"
7325             else
7326                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7327             fi
7328         else
7329             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7330             howfound="you passed"
7331         fi
7332     fi
7334     # 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.
7335     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7336     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7337         with_jdk_home=`/usr/libexec/java_home`
7338     fi
7340     JAVA_HOME=; export JAVA_HOME
7341     if test -z "$with_jdk_home"; then
7342         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7343     else
7344         _java_path="$with_jdk_home/bin/$with_java"
7345         dnl Check if there is a Java interpreter at all.
7346         if test -x "$_java_path"; then
7347             JAVAINTERPRETER=$_java_path
7348         else
7349             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7350         fi
7351     fi
7353     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7354     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7355     dnl loaded by java to run JunitTests:
7356     if test "$build_os" = "cygwin"; then
7357         shortjdkhome=`cygpath -d "$with_jdk_home"`
7358         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
7359             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7360             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7361         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
7362             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7363             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7364         fi
7366         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7367             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7368         fi
7369         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7370     elif test "$cross_compiling" != "yes"; then
7371         case $CPUNAME in
7372             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7373                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7374                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7375                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7376                 fi
7377                 ;;
7378             *) # assumption: everything else 32-bit
7379                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7380                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7381                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7382                 fi
7383                 ;;
7384         esac
7385     fi
7388 dnl ===================================================================
7389 dnl Checks for JDK.
7390 dnl ===================================================================
7392 # Note that JAVA_HOME as for now always means the *build* platform's
7393 # JAVA_HOME. Whether all the complexity here actually is needed any
7394 # more or not, no idea.
7396 if test "$ENABLE_JAVA" != ""; then
7397     _gij_longver=0
7398     AC_MSG_CHECKING([the installed JDK])
7399     if test -n "$JAVAINTERPRETER"; then
7400         dnl java -version sends output to stderr!
7401         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7402             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7403         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7404             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7405         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7406             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7407         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7408             JDK=ibm
7410             dnl IBM JDK specific tests
7411             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7412             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7414             if test "$_jdk_ver" -lt 10800; then
7415                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7416             fi
7418             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7420             if test "$with_jdk_home" = ""; then
7421                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7422 you must use the "--with-jdk-home" configure option explicitly])
7423             fi
7425             JAVA_HOME=$with_jdk_home
7426         else
7427             JDK=sun
7429             dnl Sun JDK specific tests
7430             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7431             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7433             if test "$_jdk_ver" -lt 10800; then
7434                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7435             fi
7436             if test "$_jdk_ver" -gt 10800; then
7437                 JAVA_CLASSPATH_NOT_SET=TRUE
7438             fi
7440             AC_MSG_RESULT([found (JDK $_jdk)])
7441             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7442             if test "$_os" = "WINNT"; then
7443                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7444             fi
7446             # set to limit VM usage for JunitTests
7447             JAVAIFLAGS=-Xmx64M
7448             # set to limit VM usage for javac
7449             JAVAFLAGS=-J-Xmx128M
7450         fi
7451     else
7452         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7453     fi
7454 else
7455     dnl Java disabled
7456     JAVA_HOME=
7457     export JAVA_HOME
7460 dnl ===================================================================
7461 dnl Checks for javac
7462 dnl ===================================================================
7463 if test "$ENABLE_JAVA" != ""; then
7464     javacompiler="javac"
7465     : ${JAVA_SOURCE_VER=8}
7466     : ${JAVA_TARGET_VER=8}
7467     if test -z "$with_jdk_home"; then
7468         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7469     else
7470         _javac_path="$with_jdk_home/bin/$javacompiler"
7471         dnl Check if there is a Java compiler at all.
7472         if test -x "$_javac_path"; then
7473             JAVACOMPILER=$_javac_path
7474         fi
7475     fi
7476     if test -z "$JAVACOMPILER"; then
7477         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7478     fi
7479     if test "$build_os" = "cygwin"; then
7480         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7481             JAVACOMPILER="${JAVACOMPILER}.exe"
7482         fi
7483         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7484     fi
7487 dnl ===================================================================
7488 dnl Checks for javadoc
7489 dnl ===================================================================
7490 if test "$ENABLE_JAVA" != ""; then
7491     if test -z "$with_jdk_home"; then
7492         AC_PATH_PROG(JAVADOC, javadoc)
7493     else
7494         _javadoc_path="$with_jdk_home/bin/javadoc"
7495         dnl Check if there is a javadoc at all.
7496         if test -x "$_javadoc_path"; then
7497             JAVADOC=$_javadoc_path
7498         else
7499             AC_PATH_PROG(JAVADOC, javadoc)
7500         fi
7501     fi
7502     if test -z "$JAVADOC"; then
7503         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7504     fi
7505     if test "$build_os" = "cygwin"; then
7506         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7507             JAVADOC="${JAVADOC}.exe"
7508         fi
7509         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7510     fi
7512     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7513     JAVADOCISGJDOC="yes"
7514     fi
7516 AC_SUBST(JAVADOCISGJDOC)
7518 if test "$ENABLE_JAVA" != ""; then
7519     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7520     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7521         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7522            # try to recover first by looking whether we have an alternative
7523            # system as in Debian or newer SuSEs where following /usr/bin/javac
7524            # over /etc/alternatives/javac leads to the right bindir where we
7525            # just need to strip a bit away to get a valid JAVA_HOME
7526            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7527         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7528             # maybe only one level of symlink (e.g. on Mac)
7529             JAVA_HOME=$(readlink $JAVACOMPILER)
7530             if test "$(dirname $JAVA_HOME)" = "."; then
7531                 # we've got no path to trim back
7532                 JAVA_HOME=""
7533             fi
7534         else
7535             # else warn
7536             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7537             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7538             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7539             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7540         fi
7541         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7542         if test "$JAVA_HOME" != "/usr"; then
7543             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7544                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7545                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7546                 dnl Tiger already returns a JDK path...
7547                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7548             else
7549                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7550                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7551                 dnl that checks which version to run
7552                 if test -f "$JAVA_HOME"; then
7553                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7554                 fi
7555             fi
7556         fi
7557     fi
7558     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7560     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7561     if test -z "$JAVA_HOME"; then
7562         if test "x$with_jdk_home" = "x"; then
7563             cat > findhome.java <<_ACEOF
7564 [import java.io.File;
7566 class findhome
7568     public static void main(String args[])
7569     {
7570         String jrelocation = System.getProperty("java.home");
7571         File jre = new File(jrelocation);
7572         System.out.println(jre.getParent());
7573     }
7575 _ACEOF
7576             AC_MSG_CHECKING([if javac works])
7577             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7578             AC_TRY_EVAL(javac_cmd)
7579             if test $? = 0 -a -f ./findhome.class; then
7580                 AC_MSG_RESULT([javac works])
7581             else
7582                 echo "configure: javac test failed" >&5
7583                 cat findhome.java >&5
7584                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7585             fi
7586             AC_MSG_CHECKING([if gij knows its java.home])
7587             JAVA_HOME=`$JAVAINTERPRETER findhome`
7588             if test $? = 0 -a "$JAVA_HOME" != ""; then
7589                 AC_MSG_RESULT([$JAVA_HOME])
7590             else
7591                 echo "configure: java test failed" >&5
7592                 cat findhome.java >&5
7593                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7594             fi
7595             # clean-up after ourselves
7596             rm -f ./findhome.java ./findhome.class
7597         else
7598             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7599         fi
7600     fi
7602     # now check if $JAVA_HOME is really valid
7603     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7604         case "${JAVA_HOME}" in
7605             /Library/Java/JavaVirtualMachines/*)
7606                 ;;
7607             *)
7608                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7609                 ;;
7610         esac
7611         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7612             JAVA_HOME_OK="NO"
7613         fi
7614     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7615         JAVA_HOME_OK="NO"
7616     fi
7617     if test "$JAVA_HOME_OK" = "NO"; then
7618         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7619         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7620         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7621         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7622         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7623         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7624     fi
7625     PathFormat "$JAVA_HOME"
7626     JAVA_HOME="$formatted_path"
7629 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7630     "$_os" != Darwin
7631 then
7632     AC_MSG_CHECKING([for JAWT lib])
7633     if test "$_os" = WINNT; then
7634         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7635         JAWTLIB=jawt.lib
7636     else
7637         case "$host_cpu" in
7638         arm*)
7639             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7640             JAVA_ARCH=$my_java_arch
7641             ;;
7642         i*86)
7643             my_java_arch=i386
7644             ;;
7645         m68k)
7646             my_java_arch=m68k
7647             ;;
7648         powerpc)
7649             my_java_arch=ppc
7650             ;;
7651         powerpc64)
7652             my_java_arch=ppc64
7653             ;;
7654         powerpc64le)
7655             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7656             JAVA_ARCH=$my_java_arch
7657             ;;
7658         sparc64)
7659             my_java_arch=sparcv9
7660             ;;
7661         x86_64)
7662             my_java_arch=amd64
7663             ;;
7664         *)
7665             my_java_arch=$host_cpu
7666             ;;
7667         esac
7668         # This is where JDK9 puts the library
7669         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7670             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7671         else
7672             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7673         fi
7674         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7675     fi
7676     AC_MSG_RESULT([$JAWTLIB])
7678 AC_SUBST(JAWTLIB)
7680 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7681     case "$host_os" in
7683     aix*)
7684         JAVAINC="-I$JAVA_HOME/include"
7685         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7686         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7687         ;;
7689     cygwin*)
7690         JAVAINC="-I$JAVA_HOME/include/win32"
7691         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7692         ;;
7694     darwin*)
7695         if test -d "$JAVA_HOME/include/darwin"; then
7696             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7697         else
7698             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7699         fi
7700         ;;
7702     dragonfly*)
7703         JAVAINC="-I$JAVA_HOME/include"
7704         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7705         ;;
7707     freebsd*)
7708         JAVAINC="-I$JAVA_HOME/include"
7709         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7710         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7711         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7712         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7713         ;;
7715     k*bsd*-gnu*)
7716         JAVAINC="-I$JAVA_HOME/include"
7717         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7718         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7719         ;;
7721     linux-gnu*)
7722         JAVAINC="-I$JAVA_HOME/include"
7723         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7724         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7725         ;;
7727     *netbsd*)
7728         JAVAINC="-I$JAVA_HOME/include"
7729         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7730         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7731        ;;
7733     openbsd*)
7734         JAVAINC="-I$JAVA_HOME/include"
7735         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7736         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7737         ;;
7739     solaris*)
7740         JAVAINC="-I$JAVA_HOME/include"
7741         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7742         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7743         ;;
7744     esac
7746 SOLARINC="$SOLARINC $JAVAINC"
7748 AC_SUBST(JAVACOMPILER)
7749 AC_SUBST(JAVADOC)
7750 AC_SUBST(JAVAINTERPRETER)
7751 AC_SUBST(JAVAIFLAGS)
7752 AC_SUBST(JAVAFLAGS)
7753 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7754 AC_SUBST(JAVA_HOME)
7755 AC_SUBST(JAVA_SOURCE_VER)
7756 AC_SUBST(JAVA_TARGET_VER)
7757 AC_SUBST(JDK)
7760 dnl ===================================================================
7761 dnl Export file validation
7762 dnl ===================================================================
7763 AC_MSG_CHECKING([whether to enable export file validation])
7764 if test "$with_export_validation" != "no"; then
7765     if test -z "$ENABLE_JAVA"; then
7766         if test "$with_export_validation" = "yes"; then
7767             AC_MSG_ERROR([requested, but Java is disabled])
7768         else
7769             AC_MSG_RESULT([no, as Java is disabled])
7770         fi
7771     elif ! test -d "${SRC_ROOT}/schema"; then
7772         if test "$with_export_validation" = "yes"; then
7773             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7774         else
7775             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7776         fi
7777     else
7778         AC_MSG_RESULT([yes])
7779         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7781         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7782         if test -z "$ODFVALIDATOR"; then
7783             # remember to download the ODF toolkit with validator later
7784             AC_MSG_NOTICE([no odfvalidator found, will download it])
7785             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7786             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7788             # and fetch name of odfvalidator jar name from download.lst
7789             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7790             AC_SUBST(ODFVALIDATOR_JAR)
7792             if test -z "$ODFVALIDATOR_JAR"; then
7793                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7794             fi
7795         fi
7796         if test "$build_os" = "cygwin"; then
7797             # In case of Cygwin it will be executed from Windows,
7798             # so we need to run bash and absolute path to validator
7799             # so instead of "odfvalidator" it will be
7800             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7801             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7802         else
7803             ODFVALIDATOR="sh $ODFVALIDATOR"
7804         fi
7805         AC_SUBST(ODFVALIDATOR)
7808         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7809         if test -z "$OFFICEOTRON"; then
7810             # remember to download the officeotron with validator later
7811             AC_MSG_NOTICE([no officeotron found, will download it])
7812             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7813             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7815             # and fetch name of officeotron jar name from download.lst
7816             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7817             AC_SUBST(OFFICEOTRON_JAR)
7819             if test -z "$OFFICEOTRON_JAR"; then
7820                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7821             fi
7822         else
7823             # check version of existing officeotron
7824             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7825             if test 0"$OFFICEOTRON_VER" -lt 704; then
7826                 AC_MSG_ERROR([officeotron too old])
7827             fi
7828         fi
7829         if test "$build_os" = "cygwin"; then
7830             # In case of Cygwin it will be executed from Windows,
7831             # so we need to run bash and absolute path to validator
7832             # so instead of "odfvalidator" it will be
7833             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7834             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7835         else
7836             OFFICEOTRON="sh $OFFICEOTRON"
7837         fi
7838     fi
7839     AC_SUBST(OFFICEOTRON)
7840 else
7841     AC_MSG_RESULT([no])
7844 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7845 if test "$with_bffvalidator" != "no"; then
7846     AC_DEFINE(HAVE_BFFVALIDATOR)
7848     if test "$with_export_validation" = "no"; then
7849         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7850     fi
7852     if test "$with_bffvalidator" = "yes"; then
7853         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7854     else
7855         BFFVALIDATOR="$with_bffvalidator"
7856     fi
7858     if test "$build_os" = "cygwin"; then
7859         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7860             AC_MSG_RESULT($BFFVALIDATOR)
7861         else
7862             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7863         fi
7864     elif test -n "$BFFVALIDATOR"; then
7865         # We are not in Cygwin but need to run Windows binary with wine
7866         AC_PATH_PROGS(WINE, wine)
7868         # so swap in a shell wrapper that converts paths transparently
7869         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7870         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7871         AC_SUBST(BFFVALIDATOR_EXE)
7872         AC_MSG_RESULT($BFFVALIDATOR)
7873     else
7874         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7875     fi
7876     AC_SUBST(BFFVALIDATOR)
7877 else
7878     AC_MSG_RESULT([no])
7881 dnl ===================================================================
7882 dnl Check for C preprocessor to use
7883 dnl ===================================================================
7884 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7885 if test -n "$with_idlc_cpp"; then
7886     AC_MSG_RESULT([$with_idlc_cpp])
7887     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7888 else
7889     AC_MSG_RESULT([ucpp])
7890     AC_MSG_CHECKING([which ucpp tp use])
7891     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7892         AC_MSG_RESULT([external])
7893         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7894     else
7895         AC_MSG_RESULT([internal])
7896         BUILD_TYPE="$BUILD_TYPE UCPP"
7897     fi
7899 AC_SUBST(SYSTEM_UCPP)
7901 dnl ===================================================================
7902 dnl Check for epm (not needed for Windows)
7903 dnl ===================================================================
7904 AC_MSG_CHECKING([whether to enable EPM for packing])
7905 if test "$enable_epm" = "yes"; then
7906     AC_MSG_RESULT([yes])
7907     if test "$_os" != "WINNT"; then
7908         if test $_os = Darwin; then
7909             EPM=internal
7910         elif test -n "$with_epm"; then
7911             EPM=$with_epm
7912         else
7913             AC_PATH_PROG(EPM, epm, no)
7914         fi
7915         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7916             AC_MSG_NOTICE([EPM will be built.])
7917             BUILD_TYPE="$BUILD_TYPE EPM"
7918             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7919         else
7920             # Gentoo has some epm which is something different...
7921             AC_MSG_CHECKING([whether the found epm is the right epm])
7922             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7923                 AC_MSG_RESULT([yes])
7924             else
7925                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7926             fi
7927             AC_MSG_CHECKING([epm version])
7928             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7929             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7930                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7931                 AC_MSG_RESULT([OK, >= 3.7])
7932             else
7933                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7934                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7935             fi
7936         fi
7937     fi
7939     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7940         AC_MSG_CHECKING([for rpm])
7941         for a in "$RPM" rpmbuild rpm; do
7942             $a --usage >/dev/null 2> /dev/null
7943             if test $? -eq 0; then
7944                 RPM=$a
7945                 break
7946             else
7947                 $a --version >/dev/null 2> /dev/null
7948                 if test $? -eq 0; then
7949                     RPM=$a
7950                     break
7951                 fi
7952             fi
7953         done
7954         if test -z "$RPM"; then
7955             AC_MSG_ERROR([not found])
7956         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7957             RPM_PATH=`which $RPM`
7958             AC_MSG_RESULT([$RPM_PATH])
7959             SCPDEFS="$SCPDEFS -DWITH_RPM"
7960         else
7961             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7962         fi
7963     fi
7964     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7965         AC_PATH_PROG(DPKG, dpkg, no)
7966         if test "$DPKG" = "no"; then
7967             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7968         fi
7969     fi
7970     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7971        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7972         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7973             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7974                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7975                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7976                     AC_MSG_RESULT([yes])
7977                 else
7978                     AC_MSG_RESULT([no])
7979                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7980                         _pt="rpm"
7981                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7982                         add_warning "the rpms will need to be installed with --nodeps"
7983                     else
7984                         _pt="pkg"
7985                     fi
7986                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7987                     add_warning "the ${_pt}s will not be relocatable"
7988                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7989                                  relocation will work, you need to patch your epm with the
7990                                  patch in epm/epm-3.7.patch or build with
7991                                  --with-epm=internal which will build a suitable epm])
7992                 fi
7993             fi
7994         fi
7995     fi
7996     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7997         AC_PATH_PROG(PKGMK, pkgmk, no)
7998         if test "$PKGMK" = "no"; then
7999             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8000         fi
8001     fi
8002     AC_SUBST(RPM)
8003     AC_SUBST(DPKG)
8004     AC_SUBST(PKGMK)
8005 else
8006     for i in $PKGFORMAT; do
8007         case "$i" in
8008         aix | bsd | deb | pkg | rpm | native | portable)
8009             AC_MSG_ERROR(
8010                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8011             ;;
8012         esac
8013     done
8014     AC_MSG_RESULT([no])
8015     EPM=NO
8017 AC_SUBST(EPM)
8019 ENABLE_LWP=
8020 if test "$enable_lotuswordpro" = "yes"; then
8021     ENABLE_LWP="TRUE"
8023 AC_SUBST(ENABLE_LWP)
8025 dnl ===================================================================
8026 dnl Check for building ODK
8027 dnl ===================================================================
8028 if test "$enable_odk" = no; then
8029     unset DOXYGEN
8030 else
8031     if test "$with_doxygen" = no; then
8032         AC_MSG_CHECKING([for doxygen])
8033         unset DOXYGEN
8034         AC_MSG_RESULT([no])
8035     else
8036         if test "$with_doxygen" = yes; then
8037             AC_PATH_PROG([DOXYGEN], [doxygen])
8038             if test -z "$DOXYGEN"; then
8039                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8040             fi
8041             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8042                 if ! dot -V 2>/dev/null; then
8043                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8044                 fi
8045             fi
8046         else
8047             AC_MSG_CHECKING([for doxygen])
8048             DOXYGEN=$with_doxygen
8049             AC_MSG_RESULT([$DOXYGEN])
8050         fi
8051         if test -n "$DOXYGEN"; then
8052             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8053             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8054             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8055                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8056             fi
8057         fi
8058     fi
8060 AC_SUBST([DOXYGEN])
8062 AC_MSG_CHECKING([whether to build the ODK])
8063 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8064     AC_MSG_RESULT([yes])
8066     if test "$with_java" != "no"; then
8067         AC_MSG_CHECKING([whether to build unowinreg.dll])
8068         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8069             # build on Win by default
8070             enable_build_unowinreg=yes
8071         fi
8072         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8073             AC_MSG_RESULT([no])
8074             BUILD_UNOWINREG=
8075         else
8076             AC_MSG_RESULT([yes])
8077             BUILD_UNOWINREG=TRUE
8078         fi
8079         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8080             if test -z "$with_mingw_cross_compiler"; then
8081                 dnl Guess...
8082                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8083             elif test -x "$with_mingw_cross_compiler"; then
8084                  MINGWCXX="$with_mingw_cross_compiler"
8085             else
8086                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8087             fi
8089             if test "$MINGWCXX" = "false"; then
8090                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8091             fi
8093             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8094             if test -x "$mingwstrip_test"; then
8095                 MINGWSTRIP="$mingwstrip_test"
8096             else
8097                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8098             fi
8100             if test "$MINGWSTRIP" = "false"; then
8101                 AC_MSG_ERROR(MinGW32 binutils not found.)
8102             fi
8103         fi
8104     fi
8105     BUILD_TYPE="$BUILD_TYPE ODK"
8106 else
8107     AC_MSG_RESULT([no])
8108     BUILD_UNOWINREG=
8110 AC_SUBST(BUILD_UNOWINREG)
8111 AC_SUBST(MINGWCXX)
8112 AC_SUBST(MINGWSTRIP)
8114 dnl ===================================================================
8115 dnl Check for system zlib
8116 dnl ===================================================================
8117 if test "$with_system_zlib" = "auto"; then
8118     case "$_os" in
8119     WINNT)
8120         with_system_zlib="$with_system_libs"
8121         ;;
8122     *)
8123         if test "$enable_fuzzers" != "yes"; then
8124             with_system_zlib=yes
8125         else
8126             with_system_zlib=no
8127         fi
8128         ;;
8129     esac
8132 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8133 dnl and has no pkg-config for it at least on some tinderboxes,
8134 dnl so leaving that out for now
8135 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8136 AC_MSG_CHECKING([which zlib to use])
8137 if test "$with_system_zlib" = "yes"; then
8138     AC_MSG_RESULT([external])
8139     SYSTEM_ZLIB=TRUE
8140     AC_CHECK_HEADER(zlib.h, [],
8141         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8142     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8143         [AC_MSG_ERROR(zlib not found or functional)], [])
8144 else
8145     AC_MSG_RESULT([internal])
8146     SYSTEM_ZLIB=
8147     BUILD_TYPE="$BUILD_TYPE ZLIB"
8148     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8149     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8151 AC_SUBST(ZLIB_CFLAGS)
8152 AC_SUBST(ZLIB_LIBS)
8153 AC_SUBST(SYSTEM_ZLIB)
8155 dnl ===================================================================
8156 dnl Check for system jpeg
8157 dnl ===================================================================
8158 AC_MSG_CHECKING([which libjpeg to use])
8159 if test "$with_system_jpeg" = "yes"; then
8160     AC_MSG_RESULT([external])
8161     SYSTEM_LIBJPEG=TRUE
8162     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8163         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8164     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8165         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8166 else
8167     SYSTEM_LIBJPEG=
8168     AC_MSG_RESULT([internal, libjpeg-turbo])
8169     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8170     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8171     if test "$COM" = "MSC"; then
8172         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8173     else
8174         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8175     fi
8177     case "$host_cpu" in
8178     x86_64 | amd64 | i*86 | x86 | ia32)
8179         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8180         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8181             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8182                 NASM="$LODE_HOME/opt/bin/nasm"
8183             elif test -x "/opt/lo/bin/nasm"; then
8184                 NASM="/opt/lo/bin/nasm"
8185             fi
8186         fi
8188         if test -n "$NASM"; then
8189             AC_MSG_CHECKING([for object file format of host system])
8190             case "$host_os" in
8191               cygwin* | mingw* | pw32* | interix*)
8192                 case "$host_cpu" in
8193                   x86_64)
8194                     objfmt='Win64-COFF'
8195                     ;;
8196                   *)
8197                     objfmt='Win32-COFF'
8198                     ;;
8199                 esac
8200               ;;
8201               msdosdjgpp* | go32*)
8202                 objfmt='COFF'
8203               ;;
8204               os2-emx*) # not tested
8205                 objfmt='MSOMF' # obj
8206               ;;
8207               linux*coff* | linux*oldld*)
8208                 objfmt='COFF' # ???
8209               ;;
8210               linux*aout*)
8211                 objfmt='a.out'
8212               ;;
8213               linux*)
8214                 case "$host_cpu" in
8215                   x86_64)
8216                     objfmt='ELF64'
8217                     ;;
8218                   *)
8219                     objfmt='ELF'
8220                     ;;
8221                 esac
8222               ;;
8223               kfreebsd* | freebsd* | netbsd* | openbsd*)
8224                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8225                   objfmt='BSD-a.out'
8226                 else
8227                   case "$host_cpu" in
8228                     x86_64 | amd64)
8229                       objfmt='ELF64'
8230                       ;;
8231                     *)
8232                       objfmt='ELF'
8233                       ;;
8234                   esac
8235                 fi
8236               ;;
8237               solaris* | sunos* | sysv* | sco*)
8238                 case "$host_cpu" in
8239                   x86_64)
8240                     objfmt='ELF64'
8241                     ;;
8242                   *)
8243                     objfmt='ELF'
8244                     ;;
8245                 esac
8246               ;;
8247               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8248                 case "$host_cpu" in
8249                   x86_64)
8250                     objfmt='Mach-O64'
8251                     ;;
8252                   *)
8253                     objfmt='Mach-O'
8254                     ;;
8255                 esac
8256               ;;
8257               *)
8258                 objfmt='ELF ?'
8259               ;;
8260             esac
8262             AC_MSG_RESULT([$objfmt])
8263             if test "$objfmt" = 'ELF ?'; then
8264               objfmt='ELF'
8265               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8266             fi
8268             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8269             case "$objfmt" in
8270               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8271               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8272               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8273               COFF)       NAFLAGS='-fcoff -DCOFF';;
8274               a.out)      NAFLAGS='-faout -DAOUT';;
8275               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8276               ELF)        NAFLAGS='-felf -DELF';;
8277               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8278               RDF)        NAFLAGS='-frdf -DRDF';;
8279               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8280               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8281             esac
8282             AC_MSG_RESULT([$NAFLAGS])
8284             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8285             cat > conftest.asm << EOF
8286             [%line __oline__ "configure"
8287                     section .text
8288                     global  _main,main
8289             _main:
8290             main:   xor     eax,eax
8291                     ret
8292             ]
8294             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8295             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8296               AC_MSG_RESULT(yes)
8297             else
8298               echo "configure: failed program was:" >&AC_FD_CC
8299               cat conftest.asm >&AC_FD_CC
8300               rm -rf conftest*
8301               AC_MSG_RESULT(no)
8302               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8303               NASM=""
8304             fi
8306         fi
8308         if test -z "$NASM"; then
8309 cat << _EOS
8310 ****************************************************************************
8311 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8312 To get one please:
8314 _EOS
8315             if test "$build_os" = "cygwin"; then
8316 cat << _EOS
8317 install a pre-compiled binary for Win32
8319 mkdir -p /opt/lo/bin
8320 cd /opt/lo/bin
8321 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8322 chmod +x nasm
8324 or get and install one from http://www.nasm.us/
8326 Then re-run autogen.sh
8328 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8329 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8331 _EOS
8332             else
8333 cat << _EOS
8334 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8336 _EOS
8337             fi
8338             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8339             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8340         fi
8341       ;;
8342     esac
8345 AC_SUBST(NASM)
8346 AC_SUBST(LIBJPEG_CFLAGS)
8347 AC_SUBST(LIBJPEG_LIBS)
8348 AC_SUBST(SYSTEM_LIBJPEG)
8350 dnl ===================================================================
8351 dnl Check for system clucene
8352 dnl ===================================================================
8353 dnl we should rather be using
8354 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8355 dnl but the contribs-lib check seems tricky
8356 AC_MSG_CHECKING([which clucene to use])
8357 if test "$with_system_clucene" = "yes"; then
8358     AC_MSG_RESULT([external])
8359     SYSTEM_CLUCENE=TRUE
8360     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8361     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8362     FilterLibs "${CLUCENE_LIBS}"
8363     CLUCENE_LIBS="${filteredlibs}"
8364     AC_LANG_PUSH([C++])
8365     save_CXXFLAGS=$CXXFLAGS
8366     save_CPPFLAGS=$CPPFLAGS
8367     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8368     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8369     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8370     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8371     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8372                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8373     CXXFLAGS=$save_CXXFLAGS
8374     CPPFLAGS=$save_CPPFLAGS
8375     AC_LANG_POP([C++])
8377     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8378 else
8379     AC_MSG_RESULT([internal])
8380     SYSTEM_CLUCENE=
8381     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8383 AC_SUBST(SYSTEM_CLUCENE)
8384 AC_SUBST(CLUCENE_CFLAGS)
8385 AC_SUBST(CLUCENE_LIBS)
8387 dnl ===================================================================
8388 dnl Check for system expat
8389 dnl ===================================================================
8390 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8392 dnl ===================================================================
8393 dnl Check for system xmlsec
8394 dnl ===================================================================
8395 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8397 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8398 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8399     ENABLE_EOT="TRUE"
8400     AC_DEFINE([ENABLE_EOT])
8401     AC_MSG_RESULT([yes])
8403     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8404 else
8405     ENABLE_EOT=
8406     AC_MSG_RESULT([no])
8408 AC_SUBST([ENABLE_EOT])
8410 dnl ===================================================================
8411 dnl Check for DLP libs
8412 dnl ===================================================================
8413 AS_IF([test "$COM" = "MSC"],
8414       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8415       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8417 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8419 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8421 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8423 AS_IF([test "$COM" = "MSC"],
8424       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8425       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8427 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8429 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8431 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8432 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8434 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8436 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8438 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8440 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8441 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8443 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8444 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8446 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8448 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8449 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8451 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8453 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8455 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8457 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8459 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8460 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8462 dnl ===================================================================
8463 dnl Check for system lcms2
8464 dnl ===================================================================
8465 if test "$with_system_lcms2" != "yes"; then
8466     SYSTEM_LCMS2=
8468 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8469 if test "$GCC" = "yes"; then
8470     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8472 if test "$COM" = "MSC"; then # override the above
8473     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8476 dnl ===================================================================
8477 dnl Check for system cppunit
8478 dnl ===================================================================
8479 if test "$_os" != "Android" ; then
8480     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8483 dnl ===================================================================
8484 dnl Check whether freetype is available
8485 dnl ===================================================================
8486 if test  "$test_freetype" = "yes"; then
8487     AC_MSG_CHECKING([whether freetype is available])
8488     # FreeType has 3 different kinds of versions
8489     # * release, like 2.4.10
8490     # * libtool, like 13.0.7 (this what pkg-config returns)
8491     # * soname
8492     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8493     #
8494     # 9.9.3 is 2.2.0
8495     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8496     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8497     FilterLibs "${FREETYPE_LIBS}"
8498     FREETYPE_LIBS="${filteredlibs}"
8499     SYSTEM_FREETYPE=TRUE
8500 else
8501     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8502     if test "x$ac_config_site_64bit_host" = xYES; then
8503         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
8504     else
8505         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8506     fi
8508 AC_SUBST(FREETYPE_CFLAGS)
8509 AC_SUBST(FREETYPE_LIBS)
8510 AC_SUBST([SYSTEM_FREETYPE])
8512 # ===================================================================
8513 # Check for system libxslt
8514 # to prevent incompatibilities between internal libxml2 and external libxslt,
8515 # or vice versa, use with_system_libxml here
8516 # ===================================================================
8517 if test "$with_system_libxml" = "auto"; then
8518     case "$_os" in
8519     WINNT|iOS|Android)
8520         with_system_libxml="$with_system_libs"
8521         ;;
8522     *)
8523         if test "$enable_fuzzers" != "yes"; then
8524             with_system_libxml=yes
8525         else
8526             with_system_libxml=no
8527         fi
8528         ;;
8529     esac
8532 AC_MSG_CHECKING([which libxslt to use])
8533 if test "$with_system_libxml" = "yes"; then
8534     AC_MSG_RESULT([external])
8535     SYSTEM_LIBXSLT=TRUE
8536     if test "$_os" = "Darwin"; then
8537         dnl make sure to use SDK path
8538         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8539         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8540         dnl omit -L/usr/lib
8541         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8542         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8543     else
8544         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8545         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8546         FilterLibs "${LIBXSLT_LIBS}"
8547         LIBXSLT_LIBS="${filteredlibs}"
8548         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8549         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8550         FilterLibs "${LIBEXSLT_LIBS}"
8551         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8552     fi
8554     dnl Check for xsltproc
8555     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8556     if test "$XSLTPROC" = "no"; then
8557         AC_MSG_ERROR([xsltproc is required])
8558     fi
8559 else
8560     AC_MSG_RESULT([internal])
8561     SYSTEM_LIBXSLT=
8562     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8564     if test "$cross_compiling" = "yes"; then
8565         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8566         if test "$XSLTPROC" = "no"; then
8567             AC_MSG_ERROR([xsltproc is required])
8568         fi
8569     fi
8571 AC_SUBST(SYSTEM_LIBXSLT)
8572 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8573     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8575 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8577 AC_SUBST(LIBEXSLT_CFLAGS)
8578 AC_SUBST(LIBEXSLT_LIBS)
8579 AC_SUBST(LIBXSLT_CFLAGS)
8580 AC_SUBST(LIBXSLT_LIBS)
8581 AC_SUBST(XSLTPROC)
8583 # ===================================================================
8584 # Check for system libxml
8585 # ===================================================================
8586 AC_MSG_CHECKING([which libxml to use])
8587 if test "$with_system_libxml" = "yes"; then
8588     AC_MSG_RESULT([external])
8589     SYSTEM_LIBXML=TRUE
8590     if test "$_os" = "Darwin"; then
8591         dnl make sure to use SDK path
8592         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8593         dnl omit -L/usr/lib
8594         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8595     elif test $_os = iOS; then
8596         dnl make sure to use SDK path
8597         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8598         LIBXML_CFLAGS="-I$usr/include/libxml2"
8599         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8600     else
8601         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8602         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8603         FilterLibs "${LIBXML_LIBS}"
8604         LIBXML_LIBS="${filteredlibs}"
8605     fi
8607     dnl Check for xmllint
8608     AC_PATH_PROG(XMLLINT, xmllint, no)
8609     if test "$XMLLINT" = "no"; then
8610         AC_MSG_ERROR([xmllint is required])
8611     fi
8612 else
8613     AC_MSG_RESULT([internal])
8614     SYSTEM_LIBXML=
8615     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8616     if test "$COM" = "MSC"; then
8617         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8618     fi
8619     if test "$COM" = "MSC"; then
8620         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8621     else
8622         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8623     fi
8624     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8626 AC_SUBST(SYSTEM_LIBXML)
8627 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8628     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8630 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8631 AC_SUBST(LIBXML_CFLAGS)
8632 AC_SUBST(LIBXML_LIBS)
8633 AC_SUBST(XMLLINT)
8635 # =====================================================================
8636 # Checking for a Python interpreter with version >= 2.7.
8637 # Build and runtime requires Python 3 compatible version (>= 2.7).
8638 # Optionally user can pass an option to configure, i. e.
8639 # ./configure PYTHON=/usr/bin/python
8640 # =====================================================================
8641 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8642     if test -n "$PYTHON"; then
8643         PYTHON_FOR_BUILD=$PYTHON
8644     else
8645         # This allows a lack of system python with no error, we use internal one in that case.
8646         AM_PATH_PYTHON([2.7],, [:])
8647         # Clean PYTHON_VERSION checked below if cross-compiling
8648         PYTHON_VERSION=""
8649         if test "$PYTHON" != ":"; then
8650             PYTHON_FOR_BUILD=$PYTHON
8651         fi
8652     fi
8654 AC_SUBST(PYTHON_FOR_BUILD)
8656 # Checks for Python to use for Pyuno
8657 AC_MSG_CHECKING([which Python to use for Pyuno])
8658 case "$enable_python" in
8659 no|disable)
8660     if test -z $PYTHON_FOR_BUILD; then
8661         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8662         # requirement from the choice whether to include Python stuff in the installer, but why
8663         # bother?
8664         AC_MSG_ERROR([Python is required at build time.])
8665     fi
8666     enable_python=no
8667     AC_MSG_RESULT([none])
8668     ;;
8669 ""|yes|auto)
8670     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8671         AC_MSG_RESULT([no, overridden by --disable-scripting])
8672         enable_python=no
8673     elif test $build_os = cygwin; then
8674         dnl When building on Windows we don't attempt to use any installed
8675         dnl "system"  Python.
8676         AC_MSG_RESULT([fully internal])
8677         enable_python=internal
8678     elif test "$cross_compiling" = yes; then
8679         AC_MSG_RESULT([system])
8680         enable_python=system
8681     else
8682         # Unset variables set by the above AM_PATH_PYTHON so that
8683         # we actually do check anew.
8684         AC_MSG_RESULT([])
8685         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
8686         AM_PATH_PYTHON([3.3],, [:])
8687         AC_MSG_CHECKING([which Python to use for Pyuno])
8688         if test "$PYTHON" = ":"; then
8689             if test -z "$PYTHON_FOR_BUILD"; then
8690                 AC_MSG_RESULT([fully internal])
8691             else
8692                 AC_MSG_RESULT([internal])
8693             fi
8694             enable_python=internal
8695         else
8696             AC_MSG_RESULT([system])
8697             enable_python=system
8698         fi
8699     fi
8700     ;;
8701 internal)
8702     AC_MSG_RESULT([internal])
8703     ;;
8704 fully-internal)
8705     AC_MSG_RESULT([fully internal])
8706     enable_python=internal
8707     ;;
8708 system)
8709     AC_MSG_RESULT([system])
8710     if test "$_os" = Darwin; then
8711         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])
8712     fi
8713     ;;
8715     AC_MSG_ERROR([Incorrect --enable-python option])
8716     ;;
8717 esac
8719 if test $enable_python != no; then
8720     BUILD_TYPE="$BUILD_TYPE PYUNO"
8723 if test $enable_python = system; then
8724     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8725         # Fallback: Accept these in the environment, or as set above
8726         # for MacOSX.
8727         :
8728     elif test "$cross_compiling" != yes; then
8729         # Unset variables set by the above AM_PATH_PYTHON so that
8730         # we actually do check anew.
8731         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
8732         # This causes an error if no python command is found
8733         AM_PATH_PYTHON([3.3])
8734         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8735         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8736         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8737         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8738         if test -z "$PKG_CONFIG"; then
8739             PYTHON_CFLAGS="-I$python_include"
8740             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8741         elif $PKG_CONFIG --exists python-$python_version-embed; then
8742             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8743             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8744         elif $PKG_CONFIG --exists python-$python_version; then
8745             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8746             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8747         else
8748             PYTHON_CFLAGS="-I$python_include"
8749             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8750         fi
8751         FilterLibs "${PYTHON_LIBS}"
8752         PYTHON_LIBS="${filteredlibs}"
8753     else
8754         dnl How to find out the cross-compilation Python installation path?
8755         AC_MSG_CHECKING([for python version])
8756         AS_IF([test -n "$PYTHON_VERSION"],
8757               [AC_MSG_RESULT([$PYTHON_VERSION])],
8758               [AC_MSG_RESULT([not found])
8759                AC_MSG_ERROR([no usable python found])])
8760         test -n "$PYTHON_CFLAGS" && break
8761     fi
8763     dnl Check if the headers really work
8764     save_CPPFLAGS="$CPPFLAGS"
8765     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8766     AC_CHECK_HEADER(Python.h)
8767     CPPFLAGS="$save_CPPFLAGS"
8769     # let the PYTHON_FOR_BUILD match the same python installation that
8770     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8771     # better for PythonTests.
8772     PYTHON_FOR_BUILD=$PYTHON
8775 if test "$with_lxml" != no; then
8776     if test -z "$PYTHON_FOR_BUILD"; then
8777         case $build_os in
8778             cygwin)
8779                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8780                 ;;
8781             *)
8782                 if test "$cross_compiling" != yes ; then
8783                     BUILD_TYPE="$BUILD_TYPE LXML"
8784                 fi
8785                 ;;
8786         esac
8787     else
8788         AC_MSG_CHECKING([for python lxml])
8789         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8790             AC_MSG_RESULT([yes])
8791         else
8792             case $build_os in
8793                 cygwin)
8794                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8795                     ;;
8796                 *)
8797                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8798                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
8799                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
8800                         else
8801                             BUILD_TYPE="$BUILD_TYPE LXML"
8802                             AC_MSG_RESULT([no, using internal lxml])
8803                         fi
8804                     else
8805                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8806                     fi
8807                     ;;
8808             esac
8809         fi
8810     fi
8813 dnl By now enable_python should be "system", "internal" or "no"
8814 case $enable_python in
8815 system)
8816     SYSTEM_PYTHON=TRUE
8818     if test "x$ac_cv_header_Python_h" != "xyes"; then
8819        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8820     fi
8822     AC_LANG_PUSH(C)
8823     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8824     AC_MSG_CHECKING([for correct python library version])
8825        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8826 #include <Python.h>
8828 int main(int argc, char **argv) {
8829    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8830        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8831    else return 1;
8833        ]])],[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])])
8834     CFLAGS=$save_CFLAGS
8835     AC_LANG_POP(C)
8837     dnl FIXME Check if the Python library can be linked with, too?
8838     ;;
8840 internal)
8841     SYSTEM_PYTHON=
8842     PYTHON_VERSION_MAJOR=3
8843     PYTHON_VERSION_MINOR=7
8844     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8845     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8846         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8847     fi
8848     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8849     BUILD_TYPE="$BUILD_TYPE PYTHON"
8850     if test "$OS" = LINUX; then
8851         BUILD_TYPE="$BUILD_TYPE LIBFFI"
8852     fi
8853     # Embedded Python dies without Home set
8854     if test "$HOME" = ""; then
8855         export HOME=""
8856     fi
8857     ;;
8859     DISABLE_PYTHON=TRUE
8860     SYSTEM_PYTHON=
8861     ;;
8863     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8864     ;;
8865 esac
8867 AC_SUBST(DISABLE_PYTHON)
8868 AC_SUBST(SYSTEM_PYTHON)
8869 AC_SUBST(PYTHON_CFLAGS)
8870 AC_SUBST(PYTHON_LIBS)
8871 AC_SUBST(PYTHON_VERSION)
8872 AC_SUBST(PYTHON_VERSION_MAJOR)
8873 AC_SUBST(PYTHON_VERSION_MINOR)
8875 ENABLE_MARIADBC=TRUE
8876 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8877     ENABLE_MARIADBC=
8879 MARIADBC_MAJOR=1
8880 MARIADBC_MINOR=0
8881 MARIADBC_MICRO=2
8882 if test "$ENABLE_MARIADBC" = "TRUE"; then
8883     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8886 AC_SUBST(ENABLE_MARIADBC)
8887 AC_SUBST(MARIADBC_MAJOR)
8888 AC_SUBST(MARIADBC_MINOR)
8889 AC_SUBST(MARIADBC_MICRO)
8891 if test "$ENABLE_MARIADBC" = "TRUE"; then
8892     dnl ===================================================================
8893     dnl Check for system MariaDB
8894     dnl ===================================================================
8895     AC_MSG_CHECKING([which MariaDB to use])
8896     if test "$with_system_mariadb" = "yes"; then
8897         AC_MSG_RESULT([external])
8898         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8899         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8900         if test -z "$MARIADBCONFIG"; then
8901             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8902             if test -z "$MARIADBCONFIG"; then
8903                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8904                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8905             fi
8906         fi
8907         AC_MSG_CHECKING([MariaDB version])
8908         MARIADB_VERSION=`$MARIADBCONFIG --version`
8909         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8910         if test "$MARIADB_MAJOR" -ge "5"; then
8911             AC_MSG_RESULT([OK])
8912         else
8913             AC_MSG_ERROR([too old, use 5.0.x or later])
8914         fi
8915         AC_MSG_CHECKING([for MariaDB Client library])
8916         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8917         if test "$COM_IS_CLANG" = TRUE; then
8918             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8919         fi
8920         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8921         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8922         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8923         dnl linux32:
8924         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8925             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8926             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8927                 | sed -e 's|/lib64/|/lib/|')
8928         fi
8929         FilterLibs "${MARIADB_LIBS}"
8930         MARIADB_LIBS="${filteredlibs}"
8931         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8932         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8933         if test "$enable_bundle_mariadb" = "yes"; then
8934             AC_MSG_RESULT([yes])
8935             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8936             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8938 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8940 /g' | grep -E '(mysqlclient|mariadb)')
8941             if test "$_os" = "Darwin"; then
8942                 LIBMARIADB=${LIBMARIADB}.dylib
8943             elif test "$_os" = "WINNT"; then
8944                 LIBMARIADB=${LIBMARIADB}.dll
8945             else
8946                 LIBMARIADB=${LIBMARIADB}.so
8947             fi
8948             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8949             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8950             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8951                 AC_MSG_RESULT([found.])
8952                 PathFormat "$LIBMARIADB_PATH"
8953                 LIBMARIADB_PATH="$formatted_path"
8954             else
8955                 AC_MSG_ERROR([not found.])
8956             fi
8957         else
8958             AC_MSG_RESULT([no])
8959             BUNDLE_MARIADB_CONNECTOR_C=
8960         fi
8961     else
8962         AC_MSG_RESULT([internal])
8963         SYSTEM_MARIADB_CONNECTOR_C=
8964         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8965         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8966         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8967     fi
8969     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8970     AC_SUBST(MARIADB_CFLAGS)
8971     AC_SUBST(MARIADB_LIBS)
8972     AC_SUBST(LIBMARIADB)
8973     AC_SUBST(LIBMARIADB_PATH)
8974     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8977 dnl ===================================================================
8978 dnl Check for system hsqldb
8979 dnl ===================================================================
8980 if test "$with_java" != "no"; then
8981     HSQLDB_USE_JDBC_4_1=
8982     AC_MSG_CHECKING([which hsqldb to use])
8983     if test "$with_system_hsqldb" = "yes"; then
8984         AC_MSG_RESULT([external])
8985         SYSTEM_HSQLDB=TRUE
8986         if test -z $HSQLDB_JAR; then
8987             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8988         fi
8989         if ! test -f $HSQLDB_JAR; then
8990                AC_MSG_ERROR(hsqldb.jar not found.)
8991         fi
8992         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8993         export HSQLDB_JAR
8994         if $PERL -e \
8995            'use Archive::Zip;
8996             my $file = "$ENV{'HSQLDB_JAR'}";
8997             my $zip = Archive::Zip->new( $file );
8998             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8999             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9000             {
9001                 push @l, split(/\n/, $mf);
9002                 foreach my $line (@l)
9003                 {
9004                     if ($line =~ m/Specification-Version:/)
9005                     {
9006                         ($t, $version) = split (/:/,$line);
9007                         $version =~ s/^\s//;
9008                         ($a, $b, $c, $d) = split (/\./,$version);
9009                         if ($c == "0" && $d > "8")
9010                         {
9011                             exit 0;
9012                         }
9013                         else
9014                         {
9015                             exit 1;
9016                         }
9017                     }
9018                 }
9019             }
9020             else
9021             {
9022                 exit 1;
9023             }'; then
9024             AC_MSG_RESULT([yes])
9025         else
9026             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9027         fi
9028     else
9029         AC_MSG_RESULT([internal])
9030         SYSTEM_HSQLDB=
9031         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9032         NEED_ANT=TRUE
9033         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9034         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9035         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9036             AC_MSG_RESULT([yes])
9037             HSQLDB_USE_JDBC_4_1=TRUE
9038         else
9039             AC_MSG_RESULT([no])
9040         fi
9041     fi
9042     AC_SUBST(SYSTEM_HSQLDB)
9043     AC_SUBST(HSQLDB_JAR)
9044     AC_SUBST([HSQLDB_USE_JDBC_4_1])
9047 dnl ===================================================================
9048 dnl Check for PostgreSQL stuff
9049 dnl ===================================================================
9050 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9051 if test "x$enable_postgresql_sdbc" != "xno"; then
9052     AC_MSG_RESULT([yes])
9053     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9055     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9056         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9057     fi
9058     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9059         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9060     fi
9062     postgres_interface=""
9063     if test "$with_system_postgresql" = "yes"; then
9064         postgres_interface="external PostgreSQL"
9065         SYSTEM_POSTGRESQL=TRUE
9066         if test "$_os" = Darwin; then
9067             supp_path=''
9068             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9069                 pg_supp_path="$P_SEP$d$pg_supp_path"
9070             done
9071         fi
9072         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9073         if test -n "$PGCONFIG"; then
9074             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9075             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9076         else
9077             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9078               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9079               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9080             ],[
9081               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9082             ])
9083         fi
9084         FilterLibs "${POSTGRESQL_LIB}"
9085         POSTGRESQL_LIB="${filteredlibs}"
9086     else
9087         # if/when anything else than PostgreSQL uses Kerberos,
9088         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9089         WITH_KRB5=
9090         WITH_GSSAPI=
9091         case "$_os" in
9092         Darwin)
9093             # macOS has system MIT Kerberos 5 since 10.4
9094             if test "$with_krb5" != "no"; then
9095                 WITH_KRB5=TRUE
9096                 save_LIBS=$LIBS
9097                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9098                 # that the libraries where these functions are located on macOS will change, is it?
9099                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9100                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9101                 KRB5_LIBS=$LIBS
9102                 LIBS=$save_LIBS
9103                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9104                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9105                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9106                 LIBS=$save_LIBS
9107             fi
9108             if test "$with_gssapi" != "no"; then
9109                 WITH_GSSAPI=TRUE
9110                 save_LIBS=$LIBS
9111                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9112                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9113                 GSSAPI_LIBS=$LIBS
9114                 LIBS=$save_LIBS
9115             fi
9116             ;;
9117         WINNT)
9118             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9119                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9120             fi
9121             ;;
9122         Linux|GNU|*BSD|DragonFly)
9123             if test "$with_krb5" != "no"; then
9124                 WITH_KRB5=TRUE
9125                 save_LIBS=$LIBS
9126                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9127                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9128                 KRB5_LIBS=$LIBS
9129                 LIBS=$save_LIBS
9130                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9131                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9132                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9133                 LIBS=$save_LIBS
9134             fi
9135             if test "$with_gssapi" != "no"; then
9136                 WITH_GSSAPI=TRUE
9137                 save_LIBS=$LIBS
9138                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9139                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9140                 GSSAPI_LIBS=$LIBS
9141                 LIBS=$save_LIBS
9142             fi
9143             ;;
9144         *)
9145             if test "$with_krb5" = "yes"; then
9146                 WITH_KRB5=TRUE
9147                 save_LIBS=$LIBS
9148                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9149                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9150                 KRB5_LIBS=$LIBS
9151                 LIBS=$save_LIBS
9152                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9153                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9154                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9155                 LIBS=$save_LIBS
9156             fi
9157             if test "$with_gssapi" = "yes"; then
9158                 WITH_GSSAPI=TRUE
9159                 save_LIBS=$LIBS
9160                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9161                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9162                 LIBS=$save_LIBS
9163                 GSSAPI_LIBS=$LIBS
9164             fi
9165         esac
9167         if test -n "$with_libpq_path"; then
9168             SYSTEM_POSTGRESQL=TRUE
9169             postgres_interface="external libpq"
9170             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9171             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9172         else
9173             SYSTEM_POSTGRESQL=
9174             postgres_interface="internal"
9175             POSTGRESQL_LIB=""
9176             POSTGRESQL_INC="%OVERRIDE_ME%"
9177             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9178         fi
9179     fi
9181     AC_MSG_CHECKING([PostgreSQL C interface])
9182     AC_MSG_RESULT([$postgres_interface])
9184     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9185         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9186         save_CFLAGS=$CFLAGS
9187         save_CPPFLAGS=$CPPFLAGS
9188         save_LIBS=$LIBS
9189         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9190         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9191         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9192         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9193             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9194         CFLAGS=$save_CFLAGS
9195         CPPFLAGS=$save_CPPFLAGS
9196         LIBS=$save_LIBS
9197     fi
9198     BUILD_POSTGRESQL_SDBC=TRUE
9199 else
9200     AC_MSG_RESULT([no])
9202 AC_SUBST(WITH_KRB5)
9203 AC_SUBST(WITH_GSSAPI)
9204 AC_SUBST(GSSAPI_LIBS)
9205 AC_SUBST(KRB5_LIBS)
9206 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9207 AC_SUBST(SYSTEM_POSTGRESQL)
9208 AC_SUBST(POSTGRESQL_INC)
9209 AC_SUBST(POSTGRESQL_LIB)
9211 dnl ===================================================================
9212 dnl Check for Firebird stuff
9213 dnl ===================================================================
9214 ENABLE_FIREBIRD_SDBC=
9215 if test "$enable_firebird_sdbc" = "yes" ; then
9216     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9218     dnl ===================================================================
9219     dnl Check for system Firebird
9220     dnl ===================================================================
9221     AC_MSG_CHECKING([which Firebird to use])
9222     if test "$with_system_firebird" = "yes"; then
9223         AC_MSG_RESULT([external])
9224         SYSTEM_FIREBIRD=TRUE
9225         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9226         if test -z "$FIREBIRDCONFIG"; then
9227             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9228             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9229                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9230             ])
9231             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9232         else
9233             AC_MSG_NOTICE([fb_config found])
9234             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9235             AC_MSG_CHECKING([for Firebird Client library])
9236             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9237             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9238             FilterLibs "${FIREBIRD_LIBS}"
9239             FIREBIRD_LIBS="${filteredlibs}"
9240         fi
9241         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9242         AC_MSG_CHECKING([Firebird version])
9243         if test -n "${FIREBIRD_VERSION}"; then
9244             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9245             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9246             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9247                 AC_MSG_RESULT([OK])
9248             else
9249                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9250             fi
9251         else
9252             __save_CFLAGS="${CFLAGS}"
9253             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9254             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9255 #if defined(FB_API_VER) && FB_API_VER == 30
9256 int fb_api_is_30(void) { return 0; }
9257 #else
9258 #error "Wrong Firebird API version"
9259 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9260             CFLAGS="${__save_CFLAGS}"
9261         fi
9262         ENABLE_FIREBIRD_SDBC=TRUE
9263         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9264     elif test "$enable_database_connectivity" != yes; then
9265         AC_MSG_RESULT([none])
9266     elif test "$cross_compiling" = "yes"; then
9267         AC_MSG_RESULT([none])
9268     else
9269         dnl Embedded Firebird has version 3.0
9270         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9271         dnl We need libatomic_ops for any non X86/X64 system
9272         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9273             dnl ===================================================================
9274             dnl Check for system libatomic_ops
9275             dnl ===================================================================
9276             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9277             if test "$with_system_libatomic_ops" = "yes"; then
9278                 SYSTEM_LIBATOMIC_OPS=TRUE
9279                 AC_CHECK_HEADERS(atomic_ops.h, [],
9280                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9281             else
9282                 SYSTEM_LIBATOMIC_OPS=
9283                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9284                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9285                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9286             fi
9287         fi
9289         AC_MSG_RESULT([internal])
9290         SYSTEM_FIREBIRD=
9291         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9292         FIREBIRD_LIBS="-lfbclient"
9294         if test "$with_system_libtommath" = "yes"; then
9295             SYSTEM_LIBTOMMATH=TRUE
9296             dnl check for tommath presence
9297             save_LIBS=$LIBS
9298             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9299             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9300             LIBS=$save_LIBS
9301         else
9302             SYSTEM_LIBTOMMATH=
9303             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9304             LIBTOMMATH_LIBS="-ltommath"
9305             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9306         fi
9308         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9309         ENABLE_FIREBIRD_SDBC=TRUE
9310         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9311     fi
9313 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9314 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9315 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9316 AC_SUBST(LIBATOMIC_OPS_LIBS)
9317 AC_SUBST(SYSTEM_FIREBIRD)
9318 AC_SUBST(FIREBIRD_CFLAGS)
9319 AC_SUBST(FIREBIRD_LIBS)
9320 AC_SUBST([TOMMATH_CFLAGS])
9321 AC_SUBST([TOMMATH_LIBS])
9323 dnl ===================================================================
9324 dnl Check for system curl
9325 dnl ===================================================================
9326 AC_MSG_CHECKING([which libcurl to use])
9327 if test "$with_system_curl" = "auto"; then
9328     with_system_curl="$with_system_libs"
9331 if test "$with_system_curl" = "yes"; then
9332     AC_MSG_RESULT([external])
9333     SYSTEM_CURL=TRUE
9335     # First try PKGCONFIG and then fall back
9336     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9338     if test -n "$CURL_PKG_ERRORS"; then
9339         AC_PATH_PROG(CURLCONFIG, curl-config)
9340         if test -z "$CURLCONFIG"; then
9341             AC_MSG_ERROR([curl development files not found])
9342         fi
9343         CURL_LIBS=`$CURLCONFIG --libs`
9344         FilterLibs "${CURL_LIBS}"
9345         CURL_LIBS="${filteredlibs}"
9346         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9347         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9349         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9350         case $curl_version in
9351         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9352         dnl so they need to be doubled to end up in the configure script
9353         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9354             AC_MSG_RESULT([yes])
9355             ;;
9356         *)
9357             AC_MSG_ERROR([no, you have $curl_version])
9358             ;;
9359         esac
9360     fi
9362     ENABLE_CURL=TRUE
9363 else
9364     AC_MSG_RESULT([internal])
9365     SYSTEM_CURL=
9366     BUILD_TYPE="$BUILD_TYPE CURL"
9367     ENABLE_CURL=TRUE
9369 AC_SUBST(SYSTEM_CURL)
9370 AC_SUBST(CURL_CFLAGS)
9371 AC_SUBST(CURL_LIBS)
9372 AC_SUBST(ENABLE_CURL)
9374 dnl ===================================================================
9375 dnl Check for system boost
9376 dnl ===================================================================
9377 AC_MSG_CHECKING([which boost to use])
9378 if test "$with_system_boost" = "yes"; then
9379     AC_MSG_RESULT([external])
9380     SYSTEM_BOOST=TRUE
9381     AX_BOOST_BASE(1.47)
9382     AX_BOOST_DATE_TIME
9383     AX_BOOST_FILESYSTEM
9384     AX_BOOST_IOSTREAMS
9385     AX_BOOST_LOCALE
9386     AC_LANG_PUSH([C++])
9387     save_CXXFLAGS=$CXXFLAGS
9388     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9389     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9390        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9391     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9392        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9393     CXXFLAGS=$save_CXXFLAGS
9394     AC_LANG_POP([C++])
9395     # this is in m4/ax_boost_base.m4
9396     FilterLibs "${BOOST_LDFLAGS}"
9397     BOOST_LDFLAGS="${filteredlibs}"
9398 else
9399     AC_MSG_RESULT([internal])
9400     BUILD_TYPE="$BUILD_TYPE BOOST"
9401     SYSTEM_BOOST=
9402     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9403         # use warning-suppressing wrapper headers
9404         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9405     else
9406         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9407     fi
9409 AC_SUBST(SYSTEM_BOOST)
9411 dnl ===================================================================
9412 dnl Check for system mdds
9413 dnl ===================================================================
9414 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9416 dnl ===================================================================
9417 dnl Check for system glm
9418 dnl ===================================================================
9419 AC_MSG_CHECKING([which glm to use])
9420 if test "$with_system_glm" = "yes"; then
9421     AC_MSG_RESULT([external])
9422     SYSTEM_GLM=TRUE
9423     AC_LANG_PUSH([C++])
9424     AC_CHECK_HEADER([glm/glm.hpp], [],
9425        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9426     AC_LANG_POP([C++])
9427 else
9428     AC_MSG_RESULT([internal])
9429     BUILD_TYPE="$BUILD_TYPE GLM"
9430     SYSTEM_GLM=
9431     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9433 AC_SUBST([GLM_CFLAGS])
9434 AC_SUBST([SYSTEM_GLM])
9436 dnl ===================================================================
9437 dnl Check for system odbc
9438 dnl ===================================================================
9439 AC_MSG_CHECKING([which odbc headers to use])
9440 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
9441     AC_MSG_RESULT([external])
9442     SYSTEM_ODBC_HEADERS=TRUE
9444     if test "$build_os" = "cygwin"; then
9445         save_CPPFLAGS=$CPPFLAGS
9446         find_winsdk
9447         PathFormat "$winsdktest"
9448         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"
9449         AC_CHECK_HEADER(sqlext.h, [],
9450             [AC_MSG_ERROR(odbc not found. install odbc)],
9451             [#include <windows.h>])
9452         CPPFLAGS=$save_CPPFLAGS
9453     else
9454         AC_CHECK_HEADER(sqlext.h, [],
9455             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9456     fi
9457 elif test "$enable_database_connectivity" != yes; then
9458     AC_MSG_RESULT([none])
9459 else
9460     AC_MSG_RESULT([internal])
9461     SYSTEM_ODBC_HEADERS=
9463 AC_SUBST(SYSTEM_ODBC_HEADERS)
9465 dnl ===================================================================
9466 dnl Enable LDAP support
9467 dnl ===================================================================
9469 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9470 AC_MSG_CHECKING([whether to enable LDAP support])
9471     if test "$enable_ldap" != "yes"; then
9472         AC_MSG_RESULT([no])
9473         ENABLE_LDAP=""
9474         enable_ldap=no
9475     else
9476         AC_MSG_RESULT([yes])
9477         ENABLE_LDAP="TRUE"
9478         AC_DEFINE(HAVE_FEATURE_LDAP)
9479     fi
9481 AC_SUBST(ENABLE_LDAP)
9483 dnl ===================================================================
9484 dnl Check for system openldap
9485 dnl ===================================================================
9487 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9488 AC_MSG_CHECKING([which openldap library to use])
9489 if test "$with_system_openldap" = "yes"; then
9490     AC_MSG_RESULT([external])
9491     SYSTEM_OPENLDAP=TRUE
9492     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9493     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9494     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9495 else
9496     AC_MSG_RESULT([internal])
9497     SYSTEM_OPENLDAP=
9498     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9501 AC_SUBST(SYSTEM_OPENLDAP)
9503 dnl ===================================================================
9504 dnl Check for system NSS
9505 dnl ===================================================================
9506 if test "$enable_fuzzers" != "yes"; then
9507     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9508     AC_DEFINE(HAVE_FEATURE_NSS)
9509     ENABLE_NSS="TRUE"
9510     AC_DEFINE(ENABLE_NSS)
9511 elif test $_os != iOS ; then
9512     with_tls=openssl
9514 AC_SUBST(ENABLE_NSS)
9516 dnl ===================================================================
9517 dnl Check for TLS/SSL and cryptographic implementation to use
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9520 if test -n "$with_tls"; then
9521     case $with_tls in
9522     openssl)
9523         AC_DEFINE(USE_TLS_OPENSSL)
9524         TLS=OPENSSL
9526         if test "$enable_openssl" != "yes"; then
9527             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9528         fi
9530         # warn that OpenSSL has been selected but not all TLS code has this option
9531         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9532         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9533         ;;
9534     nss)
9535         AC_DEFINE(USE_TLS_NSS)
9536         TLS=NSS
9537         ;;
9538     no)
9539         AC_MSG_WARN([Skipping TLS/SSL])
9540         ;;
9541     *)
9542         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9543 openssl - OpenSSL
9544 nss - Mozilla's Network Security Services (NSS)
9545     ])
9546         ;;
9547     esac
9548 else
9549     # default to using NSS, it results in smaller oox lib
9550     AC_DEFINE(USE_TLS_NSS)
9551     TLS=NSS
9553 AC_MSG_RESULT([$TLS])
9554 AC_SUBST(TLS)
9556 dnl ===================================================================
9557 dnl Check for system sane
9558 dnl ===================================================================
9559 AC_MSG_CHECKING([which sane header to use])
9560 if test "$with_system_sane" = "yes"; then
9561     AC_MSG_RESULT([external])
9562     AC_CHECK_HEADER(sane/sane.h, [],
9563       [AC_MSG_ERROR(sane not found. install sane)], [])
9564 else
9565     AC_MSG_RESULT([internal])
9566     BUILD_TYPE="$BUILD_TYPE SANE"
9569 dnl ===================================================================
9570 dnl Check for system icu
9571 dnl ===================================================================
9572 SYSTEM_GENBRK=
9573 SYSTEM_GENCCODE=
9574 SYSTEM_GENCMN=
9576 ICU_MAJOR=65
9577 ICU_MINOR=1
9578 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9579 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9580 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9581 AC_MSG_CHECKING([which icu to use])
9582 if test "$with_system_icu" = "yes"; then
9583     AC_MSG_RESULT([external])
9584     SYSTEM_ICU=TRUE
9585     AC_LANG_PUSH([C++])
9586     AC_MSG_CHECKING([for unicode/rbbi.h])
9587     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9588     AC_LANG_POP([C++])
9590     if test "$cross_compiling" != "yes"; then
9591         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9592         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9593         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9594         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9595     fi
9597     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9598         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9599         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9600         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9601         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9602         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9603             AC_MSG_RESULT([yes])
9604         else
9605             AC_MSG_RESULT([no])
9606             if test "$with_system_icu_for_build" != "force"; then
9607                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9608 You can use --with-system-icu-for-build=force to use it anyway.])
9609             fi
9610         fi
9611     fi
9613     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9614         # using the system icu tools can lead to version confusion, use the
9615         # ones from the build environment when cross-compiling
9616         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9617         if test -z "$SYSTEM_GENBRK"; then
9618             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9619         fi
9620         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9621         if test -z "$SYSTEM_GENCCODE"; then
9622             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9623         fi
9624         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9625         if test -z "$SYSTEM_GENCMN"; then
9626             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9627         fi
9628         if test "$ICU_MAJOR" -ge "49"; then
9629             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9630             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9631             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9632         else
9633             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9634             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9635             ICU_RECLASSIFIED_HEBREW_LETTER=
9636         fi
9637     fi
9639     if test "$cross_compiling" = "yes"; then
9640         if test "$ICU_MAJOR" -ge "50"; then
9641             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9642             ICU_MINOR=""
9643         fi
9644     fi
9645 else
9646     AC_MSG_RESULT([internal])
9647     SYSTEM_ICU=
9648     BUILD_TYPE="$BUILD_TYPE ICU"
9649     # surprisingly set these only for "internal" (to be used by various other
9650     # external libs): the system icu-config is quite unhelpful and spits out
9651     # dozens of weird flags and also default path -I/usr/include
9652     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9653     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9655 if test "$ICU_MAJOR" -ge "59"; then
9656     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9657     # with -std=c++11 but not all external libraries can be built with that,
9658     # for those use a bit-compatible typedef uint16_t UChar; see
9659     # icu/source/common/unicode/umachine.h
9660     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9661 else
9662     ICU_UCHAR_TYPE=""
9664 AC_SUBST(SYSTEM_ICU)
9665 AC_SUBST(SYSTEM_GENBRK)
9666 AC_SUBST(SYSTEM_GENCCODE)
9667 AC_SUBST(SYSTEM_GENCMN)
9668 AC_SUBST(ICU_MAJOR)
9669 AC_SUBST(ICU_MINOR)
9670 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9671 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9672 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9673 AC_SUBST(ICU_CFLAGS)
9674 AC_SUBST(ICU_LIBS)
9675 AC_SUBST(ICU_UCHAR_TYPE)
9677 dnl ==================================================================
9678 dnl Breakpad
9679 dnl ==================================================================
9680 DEFAULT_CRASHDUMP_VALUE="true"
9681 AC_MSG_CHECKING([whether to enable breakpad])
9682 if test "$enable_breakpad" != yes; then
9683     AC_MSG_RESULT([no])
9684 else
9685     AC_MSG_RESULT([yes])
9686     ENABLE_BREAKPAD="TRUE"
9687     AC_DEFINE(ENABLE_BREAKPAD)
9688     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9689     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9691     AC_MSG_CHECKING([for disable crash dump])
9692     if test "$enable_crashdump" = no; then
9693         DEFAULT_CRASHDUMP_VALUE="false"
9694         AC_MSG_RESULT([yes])
9695     else
9696        AC_MSG_RESULT([no])
9697     fi
9699     AC_MSG_CHECKING([for crashreport config])
9700     if test "$with_symbol_config" = "no"; then
9701         BREAKPAD_SYMBOL_CONFIG="invalid"
9702         AC_MSG_RESULT([no])
9703     else
9704         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9705         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9706         AC_MSG_RESULT([yes])
9707     fi
9708     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9710 AC_SUBST(ENABLE_BREAKPAD)
9711 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
9713 dnl ==================================================================
9714 dnl libfuzzer
9715 dnl ==================================================================
9716 AC_MSG_CHECKING([whether to enable fuzzers])
9717 if test "$enable_fuzzers" != yes; then
9718     AC_MSG_RESULT([no])
9719 else
9720     AC_MSG_RESULT([yes])
9721     ENABLE_FUZZERS="TRUE"
9722     AC_DEFINE([ENABLE_FUZZERS],1)
9723     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9725 AC_SUBST(ENABLE_FUZZERS)
9727 dnl ===================================================================
9728 dnl Orcus
9729 dnl ===================================================================
9730 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9731 if test "$with_system_orcus" != "yes"; then
9732     if test "$SYSTEM_BOOST" = "TRUE"; then
9733         # ===========================================================
9734         # Determine if we are going to need to link with Boost.System
9735         # ===========================================================
9736         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9737         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9738         dnl in documentation has no effect.
9739         AC_MSG_CHECKING([if we need to link with Boost.System])
9740         AC_LANG_PUSH([C++])
9741         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9742                 @%:@include <boost/version.hpp>
9743             ]],[[
9744                 #if BOOST_VERSION >= 105000
9745                 #   error yes, we need to link with Boost.System
9746                 #endif
9747             ]])],[
9748                 AC_MSG_RESULT([no])
9749             ],[
9750                 AC_MSG_RESULT([yes])
9751                 AX_BOOST_SYSTEM
9752         ])
9753         AC_LANG_POP([C++])
9754     fi
9756 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9757 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9758 AC_SUBST([BOOST_SYSTEM_LIB])
9759 AC_SUBST(SYSTEM_LIBORCUS)
9761 dnl ===================================================================
9762 dnl HarfBuzz
9763 dnl ===================================================================
9764 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9765                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9766                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9768 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9769                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9770                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9772 if test "$COM" = "MSC"; then # override the above
9773     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9774     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9777 if test "$with_system_harfbuzz" = "yes"; then
9778     if test "$with_system_graphite" = "no"; then
9779         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9780     fi
9781     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9782     _save_libs="$LIBS"
9783     _save_cflags="$CFLAGS"
9784     LIBS="$LIBS $HARFBUZZ_LIBS"
9785     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9786     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9787     LIBS="$_save_libs"
9788     CFLAGS="$_save_cflags"
9789 else
9790     if test "$with_system_graphite" = "yes"; then
9791         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9792     fi
9795 AC_MSG_CHECKING([whether to use X11])
9796 dnl ***************************************
9797 dnl testing for X libraries and includes...
9798 dnl ***************************************
9799 if test "$USING_X11" = TRUE; then
9800     AC_DEFINE(HAVE_FEATURE_X11)
9802 AC_MSG_RESULT([$USING_X11])
9804 if test "$USING_X11" = TRUE; then
9805     AC_PATH_X
9806     AC_PATH_XTRA
9807     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9809     if test -z "$x_includes"; then
9810         x_includes="default_x_includes"
9811     fi
9812     if test -z "$x_libraries"; then
9813         x_libraries="default_x_libraries"
9814     fi
9815     CFLAGS="$CFLAGS $X_CFLAGS"
9816     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9817     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9818 else
9819     x_includes="no_x_includes"
9820     x_libraries="no_x_libraries"
9823 if test "$USING_X11" = TRUE; then
9824     dnl ===================================================================
9825     dnl Check for extension headers
9826     dnl ===================================================================
9827     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9828      [#include <X11/extensions/shape.h>])
9830     # vcl needs ICE and SM
9831     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9832     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9833         [AC_MSG_ERROR(ICE library not found)])
9834     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9835     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9836         [AC_MSG_ERROR(SM library not found)])
9839 dnl ===================================================================
9840 dnl Check for system Xrender
9841 dnl ===================================================================
9842 AC_MSG_CHECKING([whether to use Xrender])
9843 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9844     AC_MSG_RESULT([yes])
9845     PKG_CHECK_MODULES(XRENDER, xrender)
9846     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9847     FilterLibs "${XRENDER_LIBS}"
9848     XRENDER_LIBS="${filteredlibs}"
9849     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9850       [AC_MSG_ERROR(libXrender not found or functional)], [])
9851     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9852       [AC_MSG_ERROR(Xrender not found. install X)], [])
9853 else
9854     AC_MSG_RESULT([no])
9856 AC_SUBST(XRENDER_CFLAGS)
9857 AC_SUBST(XRENDER_LIBS)
9859 dnl ===================================================================
9860 dnl Check for XRandr
9861 dnl ===================================================================
9862 AC_MSG_CHECKING([whether to enable RandR support])
9863 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9864     AC_MSG_RESULT([yes])
9865     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9866     if test "$ENABLE_RANDR" != "TRUE"; then
9867         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9868                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9869         XRANDR_CFLAGS=" "
9870         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9871           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9872         XRANDR_LIBS="-lXrandr "
9873         ENABLE_RANDR="TRUE"
9874     fi
9875     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9876     FilterLibs "${XRANDR_LIBS}"
9877     XRANDR_LIBS="${filteredlibs}"
9878 else
9879     ENABLE_RANDR=""
9880     AC_MSG_RESULT([no])
9882 AC_SUBST(XRANDR_CFLAGS)
9883 AC_SUBST(XRANDR_LIBS)
9884 AC_SUBST(ENABLE_RANDR)
9886 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9887     WITH_WEBDAV="serf"
9889 if test $_os = iOS -o $_os = Android; then
9890     WITH_WEBDAV="no"
9892 AC_MSG_CHECKING([for webdav library])
9893 case "$WITH_WEBDAV" in
9894 serf)
9895     AC_MSG_RESULT([serf])
9896     # Check for system apr-util
9897     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9898                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9899                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9900     if test "$COM" = "MSC"; then
9901         APR_LIB_DIR="LibR"
9902         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9903         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9904     fi
9906     # Check for system serf
9907     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9908                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9909     if test "$COM" = "MSC"; then
9910         SERF_LIB_DIR="Release"
9911         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9912         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9913     fi
9914     ;;
9915 neon)
9916     AC_MSG_RESULT([neon])
9917     # Check for system neon
9918     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9919     if test "$with_system_neon" = "yes"; then
9920         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9921     else
9922         NEON_VERSION=0295
9923     fi
9924     AC_SUBST(NEON_VERSION)
9925     ;;
9927     AC_MSG_RESULT([none, disabled])
9928     WITH_WEBDAV=""
9929     ;;
9930 esac
9931 AC_SUBST(WITH_WEBDAV)
9933 dnl ===================================================================
9934 dnl Check for disabling cve_tests
9935 dnl ===================================================================
9936 AC_MSG_CHECKING([whether to execute CVE tests])
9937 # If not explicitly enabled or disabled, default
9938 if test -z "$enable_cve_tests"; then
9939     case "$OS" in
9940     WNT)
9941         # Default cves off for Windows with its wild and wonderful
9942         # variety of AV software kicking in and panicking
9943         enable_cve_tests=no
9944         ;;
9945     *)
9946         # otherwise yes
9947         enable_cve_tests=yes
9948         ;;
9949     esac
9951 if test "$enable_cve_tests" = "no"; then
9952     AC_MSG_RESULT([no])
9953     DISABLE_CVE_TESTS=TRUE
9954     AC_SUBST(DISABLE_CVE_TESTS)
9955 else
9956     AC_MSG_RESULT([yes])
9959 dnl ===================================================================
9960 dnl Check for enabling chart XShape tests
9961 dnl ===================================================================
9962 AC_MSG_CHECKING([whether to execute chart XShape tests])
9963 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9964     AC_MSG_RESULT([yes])
9965     ENABLE_CHART_TESTS=TRUE
9966     AC_SUBST(ENABLE_CHART_TESTS)
9967 else
9968     AC_MSG_RESULT([no])
9971 dnl ===================================================================
9972 dnl Check for system openssl
9973 dnl ===================================================================
9974 DISABLE_OPENSSL=
9975 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9976 if test "$enable_openssl" = "yes"; then
9977     AC_MSG_RESULT([no])
9978     if test "$_os" = Darwin ; then
9979         # OpenSSL is deprecated when building for 10.7 or later.
9980         #
9981         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9982         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9984         with_system_openssl=no
9985         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9986     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9987             && test "$with_system_openssl" != "no"; then
9988         with_system_openssl=yes
9989         SYSTEM_OPENSSL=TRUE
9990         OPENSSL_CFLAGS=
9991         OPENSSL_LIBS="-lssl -lcrypto"
9992     else
9993         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9994     fi
9995     if test "$with_system_openssl" = "yes"; then
9996         AC_MSG_CHECKING([whether openssl supports SHA512])
9997         AC_LANG_PUSH([C])
9998         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9999             SHA512_CTX context;
10000 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10001         AC_LANG_POP(C)
10002     fi
10003 else
10004     AC_MSG_RESULT([yes])
10005     DISABLE_OPENSSL=TRUE
10007     # warn that although OpenSSL is disabled, system libraries may depend on it
10008     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10009     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10012 AC_SUBST([DISABLE_OPENSSL])
10014 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10015     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10016         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10017         enable_cipher_openssl_backend=no
10018     else
10019         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10020     fi
10022 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10023 ENABLE_CIPHER_OPENSSL_BACKEND=
10024 if test "$enable_cipher_openssl_backend" = yes; then
10025     AC_MSG_RESULT([yes])
10026     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10027 else
10028     AC_MSG_RESULT([no])
10030 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10032 dnl ===================================================================
10033 dnl Check for building gnutls
10034 dnl ===================================================================
10035 AC_MSG_CHECKING([whether to use gnutls])
10036 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10037     AC_MSG_RESULT([yes])
10038     AM_PATH_LIBGCRYPT()
10039     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10040         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10041                       available in the system to use as replacement.]]))
10042     FilterLibs "${LIBGCRYPT_LIBS}"
10043     LIBGCRYPT_LIBS="${filteredlibs}"
10044 else
10045     AC_MSG_RESULT([no])
10048 AC_SUBST([LIBGCRYPT_CFLAGS])
10049 AC_SUBST([LIBGCRYPT_LIBS])
10051 dnl ===================================================================
10052 dnl Check for system redland
10053 dnl ===================================================================
10054 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10055 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10056 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10057 if test "$with_system_redland" = "yes"; then
10058     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10059             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10060 else
10061     RAPTOR_MAJOR="0"
10062     RASQAL_MAJOR="3"
10063     REDLAND_MAJOR="0"
10065 AC_SUBST(RAPTOR_MAJOR)
10066 AC_SUBST(RASQAL_MAJOR)
10067 AC_SUBST(REDLAND_MAJOR)
10069 dnl ===================================================================
10070 dnl Check for system hunspell
10071 dnl ===================================================================
10072 AC_MSG_CHECKING([which libhunspell to use])
10073 if test "$_os" = iOS; then
10074    AC_MSG_RESULT([none])
10075 elif test "$with_system_hunspell" = "yes"; then
10076     AC_MSG_RESULT([external])
10077     SYSTEM_HUNSPELL=TRUE
10078     AC_LANG_PUSH([C++])
10079     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10080     if test "$HUNSPELL_PC" != "TRUE"; then
10081         AC_CHECK_HEADER(hunspell.hxx, [],
10082             [
10083             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10084             [AC_MSG_ERROR(hunspell headers not found.)], [])
10085             ], [])
10086         AC_CHECK_LIB([hunspell], [main], [:],
10087            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10088         HUNSPELL_LIBS=-lhunspell
10089     fi
10090     AC_LANG_POP([C++])
10091     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10092     FilterLibs "${HUNSPELL_LIBS}"
10093     HUNSPELL_LIBS="${filteredlibs}"
10094 else
10095     AC_MSG_RESULT([internal])
10096     SYSTEM_HUNSPELL=
10097     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10098     if test "$COM" = "MSC"; then
10099         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10100     else
10101         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10102     fi
10103     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10105 AC_SUBST(SYSTEM_HUNSPELL)
10106 AC_SUBST(HUNSPELL_CFLAGS)
10107 AC_SUBST(HUNSPELL_LIBS)
10109 dnl ===================================================================
10110 dnl Check for system qrcodegen
10111 dnl ===================================================================
10112 AC_MSG_CHECKING([whether to use libqrcodegen])
10113 if test "$enable_qrcodegen" = "no"; then
10114     AC_MSG_RESULT([no])
10115     ENABLE_QRCODEGEN=
10116     SYSTEM_QRCODEGEN=
10117 else
10118     AC_MSG_RESULT([yes])
10119     ENABLE_QRCODEGEN=TRUE
10120     AC_MSG_CHECKING([which libqrcodegen to use])
10121     if test "$with_system_qrcodegen" = "yes"; then
10122         AC_MSG_RESULT([external])
10123         SYSTEM_QRCODEGEN=TRUE
10124         AC_LANG_PUSH([C++])
10125         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10126             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10127         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10128             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10129         QRCODEGEN_LIBS=-lqrcodegencpp
10130         AC_LANG_POP([C++])
10131         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10132         FilterLibs "${QRCODEGEN_LIBS}"
10133         QRCODEGEN_LIBS="${filteredlibs}"
10134     else
10135         AC_MSG_RESULT([internal])
10136         SYSTEM_QRCODEGEN=
10137         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10138     fi
10139     if test "$ENABLE_QRCODEGEN" = TRUE; then
10140         AC_DEFINE(ENABLE_QRCODEGEN)
10141     fi
10143 AC_SUBST(SYSTEM_QRCODEGEN)
10144 AC_SUBST(ENABLE_QRCODEGEN)
10145 AC_SUBST(QRCODEGEN_CFLAGS)
10146 AC_SUBST(QRCODEGEN_LIBS)
10148 dnl ===================================================================
10149 dnl Checking for altlinuxhyph
10150 dnl ===================================================================
10151 AC_MSG_CHECKING([which altlinuxhyph to use])
10152 if test "$with_system_altlinuxhyph" = "yes"; then
10153     AC_MSG_RESULT([external])
10154     SYSTEM_HYPH=TRUE
10155     AC_CHECK_HEADER(hyphen.h, [],
10156        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10157     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10158        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10159        [#include <hyphen.h>])
10160     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10161         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10162     if test -z "$HYPHEN_LIB"; then
10163         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10164            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10165     fi
10166     if test -z "$HYPHEN_LIB"; then
10167         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10168            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10169     fi
10170 else
10171     AC_MSG_RESULT([internal])
10172     SYSTEM_HYPH=
10173     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10174     if test "$COM" = "MSC"; then
10175         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10176     else
10177         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10178     fi
10180 AC_SUBST(SYSTEM_HYPH)
10181 AC_SUBST(HYPHEN_LIB)
10183 dnl ===================================================================
10184 dnl Checking for mythes
10185 dnl ===================================================================
10186 AC_MSG_CHECKING([which mythes to use])
10187 if test "$_os" = iOS; then
10188    AC_MSG_RESULT([none])
10189 elif test "$with_system_mythes" = "yes"; then
10190     AC_MSG_RESULT([external])
10191     SYSTEM_MYTHES=TRUE
10192     AC_LANG_PUSH([C++])
10193     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10194     if test "$MYTHES_PKGCONFIG" = "no"; then
10195         AC_CHECK_HEADER(mythes.hxx, [],
10196             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10197         AC_CHECK_LIB([mythes-1.2], [main], [:],
10198             [ MYTHES_FOUND=no], [])
10199     if test "$MYTHES_FOUND" = "no"; then
10200         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10201                 [ MYTHES_FOUND=no], [])
10202     fi
10203     if test "$MYTHES_FOUND" = "no"; then
10204         AC_MSG_ERROR([mythes library not found!.])
10205     fi
10206     fi
10207     AC_LANG_POP([C++])
10208     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10209     FilterLibs "${MYTHES_LIBS}"
10210     MYTHES_LIBS="${filteredlibs}"
10211 else
10212     AC_MSG_RESULT([internal])
10213     SYSTEM_MYTHES=
10214     BUILD_TYPE="$BUILD_TYPE MYTHES"
10215     if test "$COM" = "MSC"; then
10216         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10217     else
10218         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10219     fi
10221 AC_SUBST(SYSTEM_MYTHES)
10222 AC_SUBST(MYTHES_CFLAGS)
10223 AC_SUBST(MYTHES_LIBS)
10225 dnl ===================================================================
10226 dnl How should we build the linear programming solver ?
10227 dnl ===================================================================
10229 ENABLE_COINMP=
10230 AC_MSG_CHECKING([whether to build with CoinMP])
10231 if test "$enable_coinmp" != "no"; then
10232     ENABLE_COINMP=TRUE
10233     AC_MSG_RESULT([yes])
10234     if test "$with_system_coinmp" = "yes"; then
10235         SYSTEM_COINMP=TRUE
10236         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10237         FilterLibs "${COINMP_LIBS}"
10238         COINMP_LIBS="${filteredlibs}"
10239     else
10240         BUILD_TYPE="$BUILD_TYPE COINMP"
10241     fi
10242 else
10243     AC_MSG_RESULT([no])
10245 AC_SUBST(ENABLE_COINMP)
10246 AC_SUBST(SYSTEM_COINMP)
10247 AC_SUBST(COINMP_CFLAGS)
10248 AC_SUBST(COINMP_LIBS)
10250 ENABLE_LPSOLVE=
10251 AC_MSG_CHECKING([whether to build with lpsolve])
10252 if test "$enable_lpsolve" != "no"; then
10253     ENABLE_LPSOLVE=TRUE
10254     AC_MSG_RESULT([yes])
10255 else
10256     AC_MSG_RESULT([no])
10258 AC_SUBST(ENABLE_LPSOLVE)
10260 if test "$ENABLE_LPSOLVE" = TRUE; then
10261     AC_MSG_CHECKING([which lpsolve to use])
10262     if test "$with_system_lpsolve" = "yes"; then
10263         AC_MSG_RESULT([external])
10264         SYSTEM_LPSOLVE=TRUE
10265         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10266            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10267         save_LIBS=$LIBS
10268         # some systems need this. Like Ubuntu...
10269         AC_CHECK_LIB(m, floor)
10270         AC_CHECK_LIB(dl, dlopen)
10271         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10272             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10273         LIBS=$save_LIBS
10274     else
10275         AC_MSG_RESULT([internal])
10276         SYSTEM_LPSOLVE=
10277         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10278     fi
10280 AC_SUBST(SYSTEM_LPSOLVE)
10282 dnl ===================================================================
10283 dnl Checking for libexttextcat
10284 dnl ===================================================================
10285 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10286 if test "$with_system_libexttextcat" = "yes"; then
10287     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10289 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10291 dnl ===================================================================
10292 dnl Checking for libnumbertext
10293 dnl ===================================================================
10294 AC_MSG_CHECKING([whether to use libnumbertext])
10295 if test "$enable_libnumbertext" = "no"; then
10296     AC_MSG_RESULT([no])
10297     ENABLE_LIBNUMBERTEXT=
10298     SYSTEM_LIBNUMBERTEXT=
10299 else
10300     AC_MSG_RESULT([yes])
10301     ENABLE_LIBNUMBERTEXT=TRUE
10302     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10303     if test "$with_system_libnumbertext" = "yes"; then
10304         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10305         SYSTEM_LIBNUMBERTEXT=YES
10306     else
10307         SYSTEM_LIBNUMBERTEXT=
10308         AC_LANG_PUSH([C++])
10309         save_CPPFLAGS=$CPPFLAGS
10310         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10311         AC_CHECK_HEADERS([codecvt regex])
10312         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10313                 [ ENABLE_LIBNUMBERTEXT=''
10314                   LIBNUMBERTEXT_CFLAGS=''
10315                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10316                                Enable libnumbertext fallback (missing number to number name conversion).])
10317                 ])
10318         CPPFLAGS=$save_CPPFLAGS
10319         AC_LANG_POP([C++])
10320     fi
10321     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10322         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10323     fi
10325 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10326 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10327 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10328 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10330 dnl ***************************************
10331 dnl testing libc version for Linux...
10332 dnl ***************************************
10333 if test "$_os" = "Linux"; then
10334     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10335     exec 6>/dev/null # no output
10336     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10337     exec 6>&1 # output on again
10338     if test "$HAVE_LIBC"; then
10339         AC_MSG_RESULT([yes])
10340     else
10341         AC_MSG_ERROR([no, upgrade libc])
10342     fi
10345 dnl =========================================
10346 dnl Check for uuidgen
10347 dnl =========================================
10348 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10349     # presence is already tested above in the WINDOWS_SDK_HOME check
10350     UUIDGEN=uuidgen.exe
10351     AC_SUBST(UUIDGEN)
10352 else
10353     AC_PATH_PROG([UUIDGEN], [uuidgen])
10354     if test -z "$UUIDGEN"; then
10355         AC_MSG_WARN([uuid is needed for building installation sets])
10356     fi
10359 dnl ***************************************
10360 dnl Checking for bison and flex
10361 dnl ***************************************
10362 AC_PATH_PROG(BISON, bison)
10363 if test -z "$BISON"; then
10364     AC_MSG_ERROR([no bison found in \$PATH, install it])
10365 else
10366     AC_MSG_CHECKING([the bison version])
10367     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10368     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10369     # Accept newer than 2.0
10370     if test "$_bison_longver" -lt 2000; then
10371         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10372     fi
10375 AC_PATH_PROG(FLEX, flex)
10376 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10377     FLEX=`cygpath -m $FLEX`
10379 if test -z "$FLEX"; then
10380     AC_MSG_ERROR([no flex found in \$PATH, install it])
10381 else
10382     AC_MSG_CHECKING([the flex version])
10383     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10384     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10385         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10386     fi
10388 AC_SUBST([FLEX])
10389 dnl ***************************************
10390 dnl Checking for patch
10391 dnl ***************************************
10392 AC_PATH_PROG(PATCH, patch)
10393 if test -z "$PATCH"; then
10394     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10397 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10398 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10399     if test -z "$with_gnu_patch"; then
10400         GNUPATCH=$PATCH
10401     else
10402         if test -x "$with_gnu_patch"; then
10403             GNUPATCH=$with_gnu_patch
10404         else
10405             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10406         fi
10407     fi
10409     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10410     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10411         AC_MSG_RESULT([yes])
10412     else
10413         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10414     fi
10415 else
10416     GNUPATCH=$PATCH
10419 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10420     GNUPATCH=`cygpath -m $GNUPATCH`
10423 dnl We also need to check for --with-gnu-cp
10425 if test -z "$with_gnu_cp"; then
10426     # check the place where the good stuff is hidden on Solaris...
10427     if test -x /usr/gnu/bin/cp; then
10428         GNUCP=/usr/gnu/bin/cp
10429     else
10430         AC_PATH_PROGS(GNUCP, gnucp cp)
10431     fi
10432     if test -z $GNUCP; then
10433         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10434     fi
10435 else
10436     if test -x "$with_gnu_cp"; then
10437         GNUCP=$with_gnu_cp
10438     else
10439         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10440     fi
10443 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10444     GNUCP=`cygpath -m $GNUCP`
10447 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10448 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10449     AC_MSG_RESULT([yes])
10450 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10451     AC_MSG_RESULT([yes])
10452 else
10453     case "$build_os" in
10454     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10455         x_GNUCP=[\#]
10456         GNUCP=''
10457         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10458         ;;
10459     *)
10460         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10461         ;;
10462     esac
10465 AC_SUBST(GNUPATCH)
10466 AC_SUBST(GNUCP)
10467 AC_SUBST(x_GNUCP)
10469 dnl ***************************************
10470 dnl testing assembler path
10471 dnl ***************************************
10472 ML_EXE=""
10473 if test "$_os" = "WINNT"; then
10474     if test "$BITNESS_OVERRIDE" = ""; then
10475         assembler=ml.exe
10476     else
10477         assembler=ml64.exe
10478     fi
10480     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10481     if test -f "$CL_PATH/$assembler"; then
10482         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10483         AC_MSG_RESULT([$ML_EXE])
10484     else
10485         AC_MSG_ERROR([not found])
10486     fi
10489 AC_SUBST(ML_EXE)
10491 dnl ===================================================================
10492 dnl We need zip and unzip
10493 dnl ===================================================================
10494 AC_PATH_PROG(ZIP, zip)
10495 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10496 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10497     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],,)
10500 AC_PATH_PROG(UNZIP, unzip)
10501 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10503 dnl ===================================================================
10504 dnl Zip must be a specific type for different build types.
10505 dnl ===================================================================
10506 if test $build_os = cygwin; then
10507     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10508         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10509     fi
10512 dnl ===================================================================
10513 dnl We need touch with -h option support.
10514 dnl ===================================================================
10515 AC_PATH_PROG(TOUCH, touch)
10516 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10517 touch warn
10518 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10519     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],,)
10522 dnl ===================================================================
10523 dnl Check for system epoxy
10524 dnl ===================================================================
10525 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10527 dnl ===================================================================
10528 dnl Set vcl option: coordinate device in double or sal_Int32
10529 dnl ===================================================================
10531 dnl disabled for now, we don't want subtle differences between OSs
10532 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10533 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10534 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10535 dnl     AC_MSG_RESULT([double])
10536 dnl else
10537 dnl     AC_MSG_RESULT([sal_Int32])
10538 dnl fi
10540 dnl ===================================================================
10541 dnl Test which vclplugs have to be built.
10542 dnl ===================================================================
10543 R=""
10544 if test "$USING_X11" != TRUE; then
10545     enable_gtk3=no
10547 GTK3_CFLAGS=""
10548 GTK3_LIBS=""
10549 ENABLE_GTK3=""
10550 if test "x$enable_gtk3" = "xyes"; then
10551     if test "$with_system_cairo" = no; then
10552         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10553     fi
10554     : ${with_system_cairo:=yes}
10555     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="")
10556     if test "x$ENABLE_GTK3" = "xTRUE"; then
10557         AC_DEFINE(ENABLE_GTK3)
10558         R="gtk3"
10559     else
10560         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10561     fi
10562     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10563     FilterLibs "${GTK3_LIBS}"
10564     GTK3_LIBS="${filteredlibs}"
10566     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10567     if test "$with_system_epoxy" != "yes"; then
10568         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10569         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10570                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10571     fi
10573 AC_SUBST(GTK3_LIBS)
10574 AC_SUBST(GTK3_CFLAGS)
10575 AC_SUBST(ENABLE_GTK3)
10577 if test "$enable_introspection" = yes; then
10578     if test "$ENABLE_GTK3" = TRUE; then
10579         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10580     else
10581         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10582     fi
10585 ENABLE_QT5=""
10586 if test "x$enable_qt5" = "xyes"; then
10587     ENABLE_QT5="TRUE"
10588     AC_DEFINE(ENABLE_QT5)
10589     R="$R qt5"
10591 AC_SUBST(ENABLE_QT5)
10593 ENABLE_KF5=""
10594 if test "x$enable_kf5" = "xyes"; then
10595     ENABLE_KF5="TRUE"
10596     AC_DEFINE(ENABLE_KF5)
10597     R="$R kf5"
10599 AC_SUBST(ENABLE_KF5)
10601 ENABLE_GTK3_KDE5=""
10602 if test "x$enable_gtk3_kde5" = "xyes"; then
10603     ENABLE_GTK3_KDE5="TRUE"
10604     AC_DEFINE(ENABLE_GTK3_KDE5)
10605     R="$R gtk3_kde5"
10607 AC_SUBST(ENABLE_GTK3_KDE5)
10609 if test "$_os" = "WINNT"; then
10610     R="$R win"
10611 elif test "$_os" = "Darwin"; then
10612     R="$R osx"
10613 elif test "$_os" = "iOS"; then
10614     R="ios (builtin)"
10617 build_vcl_plugins="$R"
10618 if test -z "$build_vcl_plugins"; then
10619     build_vcl_plugins="none"
10621 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10623 dnl ===================================================================
10624 dnl check for dbus support
10625 dnl ===================================================================
10626 ENABLE_DBUS=""
10627 DBUS_CFLAGS=""
10628 DBUS_LIBS=""
10629 DBUS_GLIB_CFLAGS=""
10630 DBUS_GLIB_LIBS=""
10631 DBUS_HAVE_GLIB=""
10633 if test "$enable_dbus" = "no"; then
10634     test_dbus=no
10637 AC_MSG_CHECKING([whether to enable DBUS support])
10638 if test "$test_dbus" = "yes"; then
10639     ENABLE_DBUS="TRUE"
10640     AC_MSG_RESULT([yes])
10641     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10642     AC_DEFINE(ENABLE_DBUS)
10643     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10644     FilterLibs "${DBUS_LIBS}"
10645     DBUS_LIBS="${filteredlibs}"
10647     # Glib is needed for BluetoothServer
10648     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10649     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10650         [
10651             DBUS_HAVE_GLIB="TRUE"
10652             AC_DEFINE(DBUS_HAVE_GLIB,1)
10653         ],
10654         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10655     )
10656 else
10657     AC_MSG_RESULT([no])
10660 AC_SUBST(ENABLE_DBUS)
10661 AC_SUBST(DBUS_CFLAGS)
10662 AC_SUBST(DBUS_LIBS)
10663 AC_SUBST(DBUS_GLIB_CFLAGS)
10664 AC_SUBST(DBUS_GLIB_LIBS)
10665 AC_SUBST(DBUS_HAVE_GLIB)
10667 AC_MSG_CHECKING([whether to enable Impress remote control])
10668 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10669     AC_MSG_RESULT([yes])
10670     ENABLE_SDREMOTE=TRUE
10671     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10673     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10674         # The Bluetooth code doesn't compile with macOS SDK 10.15
10675         enable_sdremote_bluetooth=no
10676     fi
10677     # If not explicitly enabled or disabled, default
10678     if test -z "$enable_sdremote_bluetooth"; then
10679         case "$OS" in
10680         LINUX|MACOSX|WNT)
10681             # Default to yes for these
10682             enable_sdremote_bluetooth=yes
10683             ;;
10684         *)
10685             # otherwise no
10686             enable_sdremote_bluetooth=no
10687             ;;
10688         esac
10689     fi
10690     # $enable_sdremote_bluetooth is guaranteed non-empty now
10692     if test "$enable_sdremote_bluetooth" != "no"; then
10693         if test "$OS" = "LINUX"; then
10694             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10695                 AC_MSG_RESULT([yes])
10696                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10697                 dnl ===================================================================
10698                 dnl Check for system bluez
10699                 dnl ===================================================================
10700                 AC_MSG_CHECKING([which Bluetooth header to use])
10701                 if test "$with_system_bluez" = "yes"; then
10702                     AC_MSG_RESULT([external])
10703                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10704                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10705                     SYSTEM_BLUEZ=TRUE
10706                 else
10707                     AC_MSG_RESULT([internal])
10708                     SYSTEM_BLUEZ=
10709                 fi
10710             else
10711                 AC_MSG_RESULT([no, dbus disabled])
10712                 ENABLE_SDREMOTE_BLUETOOTH=
10713                 SYSTEM_BLUEZ=
10714             fi
10715         else
10716             AC_MSG_RESULT([yes])
10717             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10718             SYSTEM_BLUEZ=
10719         fi
10720     else
10721         AC_MSG_RESULT([no])
10722         ENABLE_SDREMOTE_BLUETOOTH=
10723         SYSTEM_BLUEZ=
10724     fi
10725 else
10726     ENABLE_SDREMOTE=
10727     SYSTEM_BLUEZ=
10728     AC_MSG_RESULT([no])
10730 AC_SUBST(ENABLE_SDREMOTE)
10731 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10732 AC_SUBST(SYSTEM_BLUEZ)
10734 dnl ===================================================================
10735 dnl Check whether to enable GIO support
10736 dnl ===================================================================
10737 if test "$ENABLE_GTK3" = "TRUE"; then
10738     AC_MSG_CHECKING([whether to enable GIO support])
10739     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10740         dnl Need at least 2.26 for the dbus support.
10741         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10742                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10743         if test "$ENABLE_GIO" = "TRUE"; then
10744             AC_DEFINE(ENABLE_GIO)
10745             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10746             FilterLibs "${GIO_LIBS}"
10747             GIO_LIBS="${filteredlibs}"
10748         fi
10749     else
10750         AC_MSG_RESULT([no])
10751     fi
10753 AC_SUBST(ENABLE_GIO)
10754 AC_SUBST(GIO_CFLAGS)
10755 AC_SUBST(GIO_LIBS)
10758 dnl ===================================================================
10760 SPLIT_APP_MODULES=""
10761 if test "$enable_split_app_modules" = "yes"; then
10762     SPLIT_APP_MODULES="TRUE"
10764 AC_SUBST(SPLIT_APP_MODULES)
10766 SPLIT_OPT_FEATURES=""
10767 if test "$enable_split_opt_features" = "yes"; then
10768     SPLIT_OPT_FEATURES="TRUE"
10770 AC_SUBST(SPLIT_OPT_FEATURES)
10772 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10773     if test "$enable_cairo_canvas" = yes; then
10774         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10775     fi
10776     enable_cairo_canvas=no
10777 elif test -z "$enable_cairo_canvas"; then
10778     enable_cairo_canvas=yes
10781 ENABLE_CAIRO_CANVAS=""
10782 if test "$enable_cairo_canvas" = "yes"; then
10783     test_cairo=yes
10784     ENABLE_CAIRO_CANVAS="TRUE"
10785     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10787 AC_SUBST(ENABLE_CAIRO_CANVAS)
10789 dnl ===================================================================
10790 dnl Check whether the GStreamer libraries are available.
10791 dnl ===================================================================
10793 ENABLE_GSTREAMER_1_0=""
10795 if test "$build_gstreamer_1_0" = "yes"; then
10797     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10798     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10799         ENABLE_GSTREAMER_1_0="TRUE"
10800         AC_MSG_RESULT([yes])
10801         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10802         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10803         FilterLibs "${GSTREAMER_1_0_LIBS}"
10804         GSTREAMER_1_0_LIBS="${filteredlibs}"
10805         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10806     else
10807         AC_MSG_RESULT([no])
10808     fi
10810 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10811 AC_SUBST(GSTREAMER_1_0_LIBS)
10812 AC_SUBST(ENABLE_GSTREAMER_1_0)
10814 dnl ===================================================================
10815 dnl Check whether to build the VLC avmedia backend
10816 dnl ===================================================================
10818 ENABLE_VLC=""
10820 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10821 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10822     ENABLE_VLC="TRUE"
10823     AC_MSG_RESULT([yes])
10824 else
10825     AC_MSG_RESULT([no])
10827 AC_SUBST(ENABLE_VLC)
10829 ENABLE_OPENGL_TRANSITIONS=
10830 ENABLE_OPENGL_CANVAS=
10831 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10832    : # disable
10833 elif test "$_os" = "Darwin"; then
10834     # We use frameworks on macOS, no need for detail checks
10835     ENABLE_OPENGL_TRANSITIONS=TRUE
10836     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10837     ENABLE_OPENGL_CANVAS=TRUE
10838 elif test $_os = WINNT; then
10839     ENABLE_OPENGL_TRANSITIONS=TRUE
10840     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10841     ENABLE_OPENGL_CANVAS=TRUE
10842 else
10843     if test "$USING_X11" = TRUE; then
10844         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10845         ENABLE_OPENGL_TRANSITIONS=TRUE
10846         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10847         ENABLE_OPENGL_CANVAS=TRUE
10848     fi
10851 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10852 AC_SUBST(ENABLE_OPENGL_CANVAS)
10854 dnl =================================================
10855 dnl Check whether to build with OpenCL support.
10856 dnl =================================================
10858 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10859     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10860     # platform (optional at run-time, used through clew).
10861     BUILD_TYPE="$BUILD_TYPE OPENCL"
10862     AC_DEFINE(HAVE_FEATURE_OPENCL)
10865 dnl =================================================
10866 dnl Check whether to build with dconf support.
10867 dnl =================================================
10869 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10870     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10871         if test "$enable_dconf" = yes; then
10872             AC_MSG_ERROR([dconf not found])
10873         else
10874             enable_dconf=no
10875         fi])
10877 AC_MSG_CHECKING([whether to enable dconf])
10878 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10879     DCONF_CFLAGS=
10880     DCONF_LIBS=
10881     ENABLE_DCONF=
10882     AC_MSG_RESULT([no])
10883 else
10884     ENABLE_DCONF=TRUE
10885     AC_DEFINE(ENABLE_DCONF)
10886     AC_MSG_RESULT([yes])
10888 AC_SUBST([DCONF_CFLAGS])
10889 AC_SUBST([DCONF_LIBS])
10890 AC_SUBST([ENABLE_DCONF])
10892 # pdf import?
10893 AC_MSG_CHECKING([whether to build the PDF import feature])
10894 ENABLE_PDFIMPORT=
10895 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10896     AC_MSG_RESULT([yes])
10897     ENABLE_PDFIMPORT=TRUE
10898     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10899 else
10900     AC_MSG_RESULT([no])
10903 # Pdfium?
10904 AC_MSG_CHECKING([whether to build PDFium])
10905 ENABLE_PDFIUM=
10906 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
10907     AC_MSG_RESULT([yes])
10908     ENABLE_PDFIUM=TRUE
10909     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10910     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10911 else
10912     AC_MSG_RESULT([no])
10914 AC_SUBST(ENABLE_PDFIUM)
10916 dnl ===================================================================
10917 dnl Check for poppler
10918 dnl ===================================================================
10919 ENABLE_POPPLER=
10920 AC_MSG_CHECKING([whether to build Poppler])
10921 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_poppler" = yes; then
10922     AC_MSG_RESULT([yes])
10923     ENABLE_POPPLER=TRUE
10924     AC_DEFINE(HAVE_FEATURE_POPPLER)
10925 else
10926     AC_MSG_RESULT([no])
10928 AC_SUBST(ENABLE_POPPLER)
10930 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10931     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10934 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
10935     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10938 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
10939     dnl ===================================================================
10940     dnl Check for system poppler
10941     dnl ===================================================================
10942     AC_MSG_CHECKING([which PDF import poppler to use])
10943     if test "$with_system_poppler" = "yes"; then
10944         AC_MSG_RESULT([external])
10945         SYSTEM_POPPLER=TRUE
10946         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10947         AC_LANG_PUSH([C++])
10948         save_CXXFLAGS=$CXXFLAGS
10949         save_CPPFLAGS=$CPPFLAGS
10950         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10951         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10952         AC_CHECK_HEADER([cpp/poppler-version.h],
10953             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10954             [])
10955         CXXFLAGS=$save_CXXFLAGS
10956         CPPFLAGS=$save_CPPFLAGS
10957         AC_LANG_POP([C++])
10958         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10960         FilterLibs "${POPPLER_LIBS}"
10961         POPPLER_LIBS="${filteredlibs}"
10962     else
10963         AC_MSG_RESULT([internal])
10964         SYSTEM_POPPLER=
10965         BUILD_TYPE="$BUILD_TYPE POPPLER"
10966         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10967     fi
10968     AC_DEFINE([ENABLE_PDFIMPORT],1)
10970 AC_SUBST(ENABLE_PDFIMPORT)
10971 AC_SUBST(SYSTEM_POPPLER)
10972 AC_SUBST(POPPLER_CFLAGS)
10973 AC_SUBST(POPPLER_LIBS)
10975 SYSTEM_GPGMEPP=
10977 if test "$build_for_ios" = "YES"; then
10978     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10979     AC_MSG_RESULT([yes])
10980 elif test "$enable_mpl_subset" = "yes"; then
10981     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10982     AC_MSG_RESULT([yes])
10983 elif test "$enable_fuzzers" = "yes"; then
10984     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10985     AC_MSG_RESULT([yes])
10986 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10987     dnl ===================================================================
10988     dnl Check for system gpgme
10989     dnl ===================================================================
10990     AC_MSG_CHECKING([which gpgmepp to use])
10991     if test "$with_system_gpgmepp" = "yes"; then
10992         AC_MSG_RESULT([external])
10993         SYSTEM_GPGMEPP=TRUE
10995         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10996         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10997             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10998         # progress_callback is the only func with plain C linkage
10999         # checking for it also filters out older, KDE-dependent libgpgmepp versions
11000         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
11001             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
11002         AC_CHECK_HEADER(gpgme.h, [],
11003             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
11004     else
11005         AC_MSG_RESULT([internal])
11006         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
11007         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
11009         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
11010         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
11011         if test "$_os" != "WINNT"; then
11012             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
11013             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
11014         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
11015             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
11016         fi
11017     fi
11018     ENABLE_GPGMEPP=TRUE
11019     AC_DEFINE([HAVE_FEATURE_GPGME])
11020     AC_PATH_PROG(GPG, gpg)
11021     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
11022     # so let's exclude that manually for the moment
11023     if test -n "$GPG" -a "$_os" != "WINNT"; then
11024         # make sure we not only have a working gpgme, but a full working
11025         # gpg installation to run OpenPGP signature verification
11026         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
11027     fi
11028     if test "$_os" = "Linux"; then
11029       uid=`id -u`
11030       AC_MSG_CHECKING([for /run/user/$uid])
11031       if test -d /run/user/$uid; then
11032         AC_MSG_RESULT([yes])
11033         AC_PATH_PROG(GPGCONF, gpgconf)
11035         # Older versions of gpgconf are not working as expected, since
11036         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
11037         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
11038         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
11039         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
11040         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
11041         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
11042         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
11043           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
11044           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
11045           if $GPGCONF --dump-options > /dev/null ; then
11046             if $GPGCONF --dump-options | grep -q create-socketdir ; then
11047               AC_MSG_RESULT([yes])
11048               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
11049               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
11050             else
11051               AC_MSG_RESULT([no])
11052             fi
11053           else
11054             AC_MSG_RESULT([no. missing or broken gpgconf?])
11055           fi
11056         else
11057           AC_MSG_RESULT([no, $GPGCONF_VERSION])
11058         fi
11059       else
11060         AC_MSG_RESULT([no])
11061      fi
11062    fi
11064 AC_SUBST(ENABLE_GPGMEPP)
11065 AC_SUBST(SYSTEM_GPGMEPP)
11066 AC_SUBST(GPG_ERROR_CFLAGS)
11067 AC_SUBST(GPG_ERROR_LIBS)
11068 AC_SUBST(LIBASSUAN_CFLAGS)
11069 AC_SUBST(LIBASSUAN_LIBS)
11070 AC_SUBST(GPGMEPP_CFLAGS)
11071 AC_SUBST(GPGMEPP_LIBS)
11073 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
11074 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
11075     AC_MSG_RESULT([yes])
11076     ENABLE_MEDIAWIKI=TRUE
11077     BUILD_TYPE="$BUILD_TYPE XSLTML"
11078     if test  "x$with_java" = "xno"; then
11079         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
11080     fi
11081 else
11082     AC_MSG_RESULT([no])
11083     ENABLE_MEDIAWIKI=
11084     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
11086 AC_SUBST(ENABLE_MEDIAWIKI)
11088 AC_MSG_CHECKING([whether to build the Report Builder])
11089 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
11090     AC_MSG_RESULT([yes])
11091     ENABLE_REPORTBUILDER=TRUE
11092     AC_MSG_CHECKING([which jfreereport libs to use])
11093     if test "$with_system_jfreereport" = "yes"; then
11094         SYSTEM_JFREEREPORT=TRUE
11095         AC_MSG_RESULT([external])
11096         if test -z $SAC_JAR; then
11097             SAC_JAR=/usr/share/java/sac.jar
11098         fi
11099         if ! test -f $SAC_JAR; then
11100              AC_MSG_ERROR(sac.jar not found.)
11101         fi
11103         if test -z $LIBXML_JAR; then
11104             if test -f /usr/share/java/libxml-1.0.0.jar; then
11105                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11106             elif test -f /usr/share/java/libxml.jar; then
11107                 LIBXML_JAR=/usr/share/java/libxml.jar
11108             else
11109                 AC_MSG_ERROR(libxml.jar replacement not found.)
11110             fi
11111         elif ! test -f $LIBXML_JAR; then
11112             AC_MSG_ERROR(libxml.jar not found.)
11113         fi
11115         if test -z $FLUTE_JAR; then
11116             if test -f/usr/share/java/flute-1.3.0.jar; then
11117                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11118             elif test -f /usr/share/java/flute.jar; then
11119                 FLUTE_JAR=/usr/share/java/flute.jar
11120             else
11121                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11122             fi
11123         elif ! test -f $FLUTE_JAR; then
11124             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11125         fi
11127         if test -z $JFREEREPORT_JAR; then
11128             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11129                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11130             elif test -f /usr/share/java/flow-engine.jar; then
11131                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11132             else
11133                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11134             fi
11135         elif ! test -f  $JFREEREPORT_JAR; then
11136                 AC_MSG_ERROR(jfreereport.jar not found.)
11137         fi
11139         if test -z $LIBLAYOUT_JAR; then
11140             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11141                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11142             elif test -f /usr/share/java/liblayout.jar; then
11143                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11144             else
11145                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11146             fi
11147         elif ! test -f $LIBLAYOUT_JAR; then
11148                 AC_MSG_ERROR(liblayout.jar not found.)
11149         fi
11151         if test -z $LIBLOADER_JAR; then
11152             if test -f /usr/share/java/libloader-1.0.0.jar; then
11153                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11154             elif test -f /usr/share/java/libloader.jar; then
11155                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11156             else
11157                 AC_MSG_ERROR(libloader.jar replacement not found.)
11158             fi
11159         elif ! test -f  $LIBLOADER_JAR; then
11160             AC_MSG_ERROR(libloader.jar not found.)
11161         fi
11163         if test -z $LIBFORMULA_JAR; then
11164             if test -f /usr/share/java/libformula-0.2.0.jar; then
11165                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11166             elif test -f /usr/share/java/libformula.jar; then
11167                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11168             else
11169                 AC_MSG_ERROR(libformula.jar replacement not found.)
11170             fi
11171         elif ! test -f $LIBFORMULA_JAR; then
11172                 AC_MSG_ERROR(libformula.jar not found.)
11173         fi
11175         if test -z $LIBREPOSITORY_JAR; then
11176             if test -f /usr/share/java/librepository-1.0.0.jar; then
11177                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11178             elif test -f /usr/share/java/librepository.jar; then
11179                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11180             else
11181                 AC_MSG_ERROR(librepository.jar replacement not found.)
11182             fi
11183         elif ! test -f $LIBREPOSITORY_JAR; then
11184             AC_MSG_ERROR(librepository.jar not found.)
11185         fi
11187         if test -z $LIBFONTS_JAR; then
11188             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11189                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11190             elif test -f /usr/share/java/libfonts.jar; then
11191                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11192             else
11193                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11194             fi
11195         elif ! test -f $LIBFONTS_JAR; then
11196                 AC_MSG_ERROR(libfonts.jar not found.)
11197         fi
11199         if test -z $LIBSERIALIZER_JAR; then
11200             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11201                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11202             elif test -f /usr/share/java/libserializer.jar; then
11203                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11204             else
11205                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11206             fi
11207         elif ! test -f $LIBSERIALIZER_JAR; then
11208                 AC_MSG_ERROR(libserializer.jar not found.)
11209         fi
11211         if test -z $LIBBASE_JAR; then
11212             if test -f /usr/share/java/libbase-1.0.0.jar; then
11213                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11214             elif test -f /usr/share/java/libbase.jar; then
11215                 LIBBASE_JAR=/usr/share/java/libbase.jar
11216             else
11217                 AC_MSG_ERROR(libbase.jar replacement not found.)
11218             fi
11219         elif ! test -f $LIBBASE_JAR; then
11220             AC_MSG_ERROR(libbase.jar not found.)
11221         fi
11223     else
11224         AC_MSG_RESULT([internal])
11225         SYSTEM_JFREEREPORT=
11226         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11227         NEED_ANT=TRUE
11228     fi
11229 else
11230     AC_MSG_RESULT([no])
11231     ENABLE_REPORTBUILDER=
11232     SYSTEM_JFREEREPORT=
11234 AC_SUBST(ENABLE_REPORTBUILDER)
11235 AC_SUBST(SYSTEM_JFREEREPORT)
11236 AC_SUBST(SAC_JAR)
11237 AC_SUBST(LIBXML_JAR)
11238 AC_SUBST(FLUTE_JAR)
11239 AC_SUBST(JFREEREPORT_JAR)
11240 AC_SUBST(LIBBASE_JAR)
11241 AC_SUBST(LIBLAYOUT_JAR)
11242 AC_SUBST(LIBLOADER_JAR)
11243 AC_SUBST(LIBFORMULA_JAR)
11244 AC_SUBST(LIBREPOSITORY_JAR)
11245 AC_SUBST(LIBFONTS_JAR)
11246 AC_SUBST(LIBSERIALIZER_JAR)
11248 # this has to be here because both the Wiki Publisher and the SRB use
11249 # commons-logging
11250 COMMONS_LOGGING_VERSION=1.2
11251 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11252     AC_MSG_CHECKING([which Apache commons-* libs to use])
11253     if test "$with_system_apache_commons" = "yes"; then
11254         SYSTEM_APACHE_COMMONS=TRUE
11255         AC_MSG_RESULT([external])
11256         if test -z $COMMONS_LOGGING_JAR; then
11257             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11258                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11259            elif test -f /usr/share/java/commons-logging.jar; then
11260                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11261             else
11262                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11263             fi
11264         elif ! test -f $COMMONS_LOGGING_JAR; then
11265             AC_MSG_ERROR(commons-logging.jar not found.)
11266         fi
11267     else
11268         AC_MSG_RESULT([internal])
11269         SYSTEM_APACHE_COMMONS=
11270         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11271         NEED_ANT=TRUE
11272     fi
11274 AC_SUBST(SYSTEM_APACHE_COMMONS)
11275 AC_SUBST(COMMONS_LOGGING_JAR)
11276 AC_SUBST(COMMONS_LOGGING_VERSION)
11278 # scripting provider for BeanShell?
11279 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11280 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11281     AC_MSG_RESULT([yes])
11282     ENABLE_SCRIPTING_BEANSHELL=TRUE
11284     dnl ===================================================================
11285     dnl Check for system beanshell
11286     dnl ===================================================================
11287     AC_MSG_CHECKING([which beanshell to use])
11288     if test "$with_system_beanshell" = "yes"; then
11289         AC_MSG_RESULT([external])
11290         SYSTEM_BSH=TRUE
11291         if test -z $BSH_JAR; then
11292             BSH_JAR=/usr/share/java/bsh.jar
11293         fi
11294         if ! test -f $BSH_JAR; then
11295             AC_MSG_ERROR(bsh.jar not found.)
11296         fi
11297     else
11298         AC_MSG_RESULT([internal])
11299         SYSTEM_BSH=
11300         BUILD_TYPE="$BUILD_TYPE BSH"
11301     fi
11302 else
11303     AC_MSG_RESULT([no])
11304     ENABLE_SCRIPTING_BEANSHELL=
11305     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11307 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11308 AC_SUBST(SYSTEM_BSH)
11309 AC_SUBST(BSH_JAR)
11311 # scripting provider for JavaScript?
11312 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11313 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11314     AC_MSG_RESULT([yes])
11315     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11317     dnl ===================================================================
11318     dnl Check for system rhino
11319     dnl ===================================================================
11320     AC_MSG_CHECKING([which rhino to use])
11321     if test "$with_system_rhino" = "yes"; then
11322         AC_MSG_RESULT([external])
11323         SYSTEM_RHINO=TRUE
11324         if test -z $RHINO_JAR; then
11325             RHINO_JAR=/usr/share/java/js.jar
11326         fi
11327         if ! test -f $RHINO_JAR; then
11328             AC_MSG_ERROR(js.jar not found.)
11329         fi
11330     else
11331         AC_MSG_RESULT([internal])
11332         SYSTEM_RHINO=
11333         BUILD_TYPE="$BUILD_TYPE RHINO"
11334         NEED_ANT=TRUE
11335     fi
11336 else
11337     AC_MSG_RESULT([no])
11338     ENABLE_SCRIPTING_JAVASCRIPT=
11339     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11341 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11342 AC_SUBST(SYSTEM_RHINO)
11343 AC_SUBST(RHINO_JAR)
11345 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11346 # paths should be added to library search path. So lets put all 64-bit
11347 # platforms there.
11348 supports_multilib=
11349 case "$host_cpu" in
11350 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11351     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11352         supports_multilib="yes"
11353     fi
11354     ;;
11356     ;;
11357 esac
11359 dnl ===================================================================
11360 dnl QT5 Integration
11361 dnl ===================================================================
11363 QT5_CFLAGS=""
11364 QT5_LIBS=""
11365 QMAKE5="qmake"
11366 MOC5="moc"
11367 QT5_GOBJECT_CFLAGS=""
11368 QT5_GOBJECT_LIBS=""
11369 QT5_HAVE_GOBJECT=""
11370 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11371         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11372         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11373 then
11374     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11375     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11377     if test -n "$supports_multilib"; then
11378         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11379     fi
11381     qt5_test_include="QtWidgets/qapplication.h"
11382     qt5_test_library="libQt5Widgets.so"
11384     dnl Check for qmake5
11385     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
11386     if test "$QMAKE5" = "no"; then
11387         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11388     else
11389         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11390         if test -z "$qmake5_test_ver"; then
11391             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11392         fi
11393         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11394         qt5_minimal_minor="6"
11395         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11396             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11397         else
11398             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11399         fi
11400     fi
11402     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11403     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11405     AC_MSG_CHECKING([for Qt5 headers])
11406     qt5_incdir="no"
11407     for inc_dir in $qt5_incdirs; do
11408         if test -r "$inc_dir/$qt5_test_include"; then
11409             qt5_incdir="$inc_dir"
11410             break
11411         fi
11412     done
11413     AC_MSG_RESULT([$qt5_incdir])
11414     if test "x$qt5_incdir" = "xno"; then
11415         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11416     fi
11418     AC_MSG_CHECKING([for Qt5 libraries])
11419     qt5_libdir="no"
11420     for lib_dir in $qt5_libdirs; do
11421         if test -r "$lib_dir/$qt5_test_library"; then
11422             qt5_libdir="$lib_dir"
11423             break
11424         fi
11425     done
11426     AC_MSG_RESULT([$qt5_libdir])
11427     if test "x$qt5_libdir" = "xno"; then
11428         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11429     fi
11431     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11432     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11433     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11435     if test "$USING_X11" = TRUE; then
11436         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11437         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
11438             QT5_HAVE_XCB_ICCCM=1
11439             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
11440         ],[
11441             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)])
11442             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
11443         ])
11444         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
11445         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
11446         QT5_USING_X11=1
11447         AC_DEFINE(QT5_USING_X11)
11448     fi
11450     dnl Check for Meta Object Compiler
11452     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
11453     if test "$MOC5" = "no"; then
11454         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11455 the root of your Qt installation by exporting QT5DIR before running "configure".])
11456     fi
11458     if test "$build_gstreamer_1_0" = "yes"; then
11459         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11460                 QT5_HAVE_GOBJECT=1
11461                 AC_DEFINE(QT5_HAVE_GOBJECT)
11462             ],
11463             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11464         )
11465     fi
11467 AC_SUBST(QT5_CFLAGS)
11468 AC_SUBST(QT5_LIBS)
11469 AC_SUBST(MOC5)
11470 AC_SUBST(QT5_GOBJECT_CFLAGS)
11471 AC_SUBST(QT5_GOBJECT_LIBS)
11472 AC_SUBST(QT5_HAVE_GOBJECT)
11474 dnl ===================================================================
11475 dnl KF5 Integration
11476 dnl ===================================================================
11478 KF5_CFLAGS=""
11479 KF5_LIBS=""
11480 KF5_CONFIG="kf5-config"
11481 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11482         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11483 then
11484     if test "$OS" = "HAIKU"; then
11485         haiku_arch="`echo $RTL_ARCH | tr X x`"
11486         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11487         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11488     fi
11490     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11491     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11492     if test -n "$supports_multilib"; then
11493         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11494     fi
11496     kf5_test_include="KF5/kcoreaddons_version.h"
11497     kf5_test_library="libKF5CoreAddons.so"
11498     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11500     dnl kf5 KDE4 support compatibility installed
11501     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11502     if test "$KF5_CONFIG" != "no"; then
11503         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11504         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11505     fi
11507     dnl Check for KF5 headers
11508     AC_MSG_CHECKING([for KF5 headers])
11509     kf5_incdir="no"
11510     for kf5_check in $kf5_incdirs; do
11511         if test -r "$kf5_check/$kf5_test_include"; then
11512             kf5_incdir="$kf5_check/KF5"
11513             break
11514         fi
11515     done
11516     AC_MSG_RESULT([$kf5_incdir])
11517     if test "x$kf5_incdir" = "xno"; then
11518         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11519     fi
11521     dnl Check for KF5 libraries
11522     AC_MSG_CHECKING([for KF5 libraries])
11523     kf5_libdir="no"
11524     for kf5_check in $kf5_libdirs; do
11525         if test -r "$kf5_check/$kf5_test_library"; then
11526             kf5_libdir="$kf5_check"
11527             break
11528         fi
11529     done
11531     AC_MSG_RESULT([$kf5_libdir])
11532     if test "x$kf5_libdir" = "xno"; then
11533         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11534     fi
11536     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"
11537     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11538     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11540     if test "$USING_X11" = TRUE; then
11541         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11542     fi
11544     AC_LANG_PUSH([C++])
11545     save_CXXFLAGS=$CXXFLAGS
11546     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11547     AC_MSG_CHECKING([whether KDE is >= 5.0])
11548        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11549 #include <kcoreaddons_version.h>
11551 int main(int argc, char **argv) {
11552        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11553        else return 1;
11555        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11556     CXXFLAGS=$save_CXXFLAGS
11557     AC_LANG_POP([C++])
11559 AC_SUBST(KF5_CFLAGS)
11560 AC_SUBST(KF5_LIBS)
11562 dnl ===================================================================
11563 dnl Test whether to include Evolution 2 support
11564 dnl ===================================================================
11565 AC_MSG_CHECKING([whether to enable evolution 2 support])
11566 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11567     AC_MSG_RESULT([yes])
11568     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11569     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11570     FilterLibs "${GOBJECT_LIBS}"
11571     GOBJECT_LIBS="${filteredlibs}"
11572     ENABLE_EVOAB2="TRUE"
11573 else
11574     ENABLE_EVOAB2=""
11575     AC_MSG_RESULT([no])
11577 AC_SUBST(ENABLE_EVOAB2)
11578 AC_SUBST(GOBJECT_CFLAGS)
11579 AC_SUBST(GOBJECT_LIBS)
11581 dnl ===================================================================
11582 dnl Test which themes to include
11583 dnl ===================================================================
11584 AC_MSG_CHECKING([which themes to include])
11585 # if none given use default subset of available themes
11586 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11587     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"
11590 WITH_THEMES=""
11591 if test "x$with_theme" != "xno"; then
11592     for theme in $with_theme; do
11593         case $theme in
11594         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" ;;
11595         default) real_theme=colibre ;;
11596         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11597         esac
11598         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11599     done
11601 AC_MSG_RESULT([$WITH_THEMES])
11602 AC_SUBST([WITH_THEMES])
11603 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11604 for theme in $with_theme; do
11605     case $theme in
11606     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11607     *) ;;
11608     esac
11609 done
11611 dnl ===================================================================
11612 dnl Test whether to integrate helppacks into the product's installer
11613 dnl ===================================================================
11614 AC_MSG_CHECKING([for helppack integration])
11615 if test "$with_helppack_integration" = "no"; then
11616     AC_MSG_RESULT([no integration])
11617 else
11618     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11619     AC_MSG_RESULT([integration])
11622 ###############################################################################
11623 # Extensions checking
11624 ###############################################################################
11625 AC_MSG_CHECKING([for extensions integration])
11626 if test "x$enable_extension_integration" != "xno"; then
11627     WITH_EXTENSION_INTEGRATION=TRUE
11628     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11629     AC_MSG_RESULT([yes, use integration])
11630 else
11631     WITH_EXTENSION_INTEGRATION=
11632     AC_MSG_RESULT([no, do not integrate])
11634 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11636 dnl Should any extra extensions be included?
11637 dnl There are standalone tests for each of these below.
11638 WITH_EXTRA_EXTENSIONS=
11639 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11641 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11642 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11643 if test "x$with_java" != "xno"; then
11644     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11645     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11648 AC_MSG_CHECKING([whether to build opens___.ttf])
11649 if test "$enable_build_opensymbol" = "yes"; then
11650     AC_MSG_RESULT([yes])
11651     AC_PATH_PROG(FONTFORGE, fontforge)
11652     if test -z "$FONTFORGE"; then
11653         AC_MSG_ERROR([fontforge not installed])
11654     fi
11655 else
11656     AC_MSG_RESULT([no])
11657     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11658     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11660 AC_SUBST(OPENSYMBOL_TTF)
11661 AC_SUBST(FONTFORGE)
11663 dnl ===================================================================
11664 dnl Test whether to include fonts
11665 dnl ===================================================================
11666 AC_MSG_CHECKING([whether to include third-party fonts])
11667 if test "$with_fonts" != "no"; then
11668     AC_MSG_RESULT([yes])
11669     WITH_FONTS=TRUE
11670     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11671     AC_DEFINE(HAVE_MORE_FONTS)
11672 else
11673     AC_MSG_RESULT([no])
11674     WITH_FONTS=
11675     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11677 AC_SUBST(WITH_FONTS)
11679 dnl Test whether to include more Google Noto fonts
11680 dnl ===================================================================
11681 AC_MSG_CHECKING([whether to include more Google Noto fonts])
11682 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11683     AC_MSG_RESULT([no])
11684     WITH_NOTO_FONT=
11685 else
11686     AC_MSG_RESULT([yes])
11687     WITH_NOTO_FONT=TRUE
11688     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11689     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11691 AC_SUBST(WITH_NOTO_FONT)
11693 dnl ===================================================================
11694 dnl Test whether to enable online update service
11695 dnl ===================================================================
11696 AC_MSG_CHECKING([whether to enable online update])
11697 ENABLE_ONLINE_UPDATE=
11698 ENABLE_ONLINE_UPDATE_MAR=
11699 UPDATE_CONFIG=
11700 if test "$enable_online_update" = ""; then
11701     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11702         AC_MSG_RESULT([yes])
11703         ENABLE_ONLINE_UPDATE="TRUE"
11704     else
11705         AC_MSG_RESULT([no])
11706     fi
11707 else
11708     if test "$enable_online_update" = "mar"; then
11709         AC_MSG_RESULT([yes - MAR-based online update])
11710         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11711         if test "$with_update_config" = ""; then
11712             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11713         fi
11714         UPDATE_CONFIG="$with_update_config"
11715         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11716     elif test "$enable_online_update" = "yes"; then
11717         AC_MSG_RESULT([yes])
11718         ENABLE_ONLINE_UPDATE="TRUE"
11719     else
11720         AC_MSG_RESULT([no])
11721     fi
11723 AC_SUBST(ENABLE_ONLINE_UPDATE)
11724 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11725 AC_SUBST(UPDATE_CONFIG)
11727 dnl ===================================================================
11728 dnl Test whether we need bzip2
11729 dnl ===================================================================
11730 SYSTEM_BZIP2=
11731 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11732     AC_MSG_CHECKING([whether to use system bzip2])
11733     if test "$with_system_bzip2" = yes; then
11734         SYSTEM_BZIP2=TRUE
11735         AC_MSG_RESULT([yes])
11736         PKG_CHECK_MODULES(BZIP2, bzip2)
11737         FilterLibs "${BZIP2_LIBS}"
11738         BZIP2_LIBS="${filteredlibs}"
11739     else
11740         AC_MSG_RESULT([no])
11741         BUILD_TYPE="$BUILD_TYPE BZIP2"
11742     fi
11744 AC_SUBST(SYSTEM_BZIP2)
11745 AC_SUBST(BZIP2_CFLAGS)
11746 AC_SUBST(BZIP2_LIBS)
11748 dnl ===================================================================
11749 dnl Test whether to enable extension update
11750 dnl ===================================================================
11751 AC_MSG_CHECKING([whether to enable extension update])
11752 ENABLE_EXTENSION_UPDATE=
11753 if test "x$enable_extension_update" = "xno"; then
11754     AC_MSG_RESULT([no])
11755 else
11756     AC_MSG_RESULT([yes])
11757     ENABLE_EXTENSION_UPDATE="TRUE"
11758     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11759     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11761 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11764 dnl ===================================================================
11765 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11766 dnl ===================================================================
11767 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11768 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11769     AC_MSG_RESULT([no])
11770     ENABLE_SILENT_MSI=
11771 else
11772     AC_MSG_RESULT([yes])
11773     ENABLE_SILENT_MSI=TRUE
11774     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11776 AC_SUBST(ENABLE_SILENT_MSI)
11778 AC_MSG_CHECKING([whether and how to use Xinerama])
11779 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11780     if test "$x_libraries" = "default_x_libraries"; then
11781         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11782         if test "x$XINERAMALIB" = x; then
11783            XINERAMALIB="/usr/lib"
11784         fi
11785     else
11786         XINERAMALIB="$x_libraries"
11787     fi
11788     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11789         # we have both versions, let the user decide but use the dynamic one
11790         # per default
11791         USE_XINERAMA=TRUE
11792         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11793             XINERAMA_LINK=dynamic
11794         else
11795             XINERAMA_LINK=static
11796         fi
11797     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11798         # we have only the dynamic version
11799         USE_XINERAMA=TRUE
11800         XINERAMA_LINK=dynamic
11801     elif test -e "$XINERAMALIB/libXinerama.a"; then
11802         # static version
11803         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11804             USE_XINERAMA=TRUE
11805             XINERAMA_LINK=static
11806         else
11807             USE_XINERAMA=
11808             XINERAMA_LINK=none
11809         fi
11810     else
11811         # no Xinerama
11812         USE_XINERAMA=
11813         XINERAMA_LINK=none
11814     fi
11815     if test "$USE_XINERAMA" = "TRUE"; then
11816         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11817         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11818             [AC_MSG_ERROR(Xinerama header not found.)], [])
11819         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11820         if test "x$XEXTLIB" = x; then
11821            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11822         fi
11823         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11824         if test "$_os" = "FreeBSD"; then
11825             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11826         fi
11827         if test "$_os" = "Linux"; then
11828             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11829         fi
11830         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11831             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11832     else
11833         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11834     fi
11835 else
11836     USE_XINERAMA=
11837     XINERAMA_LINK=none
11838     AC_MSG_RESULT([no])
11840 AC_SUBST(USE_XINERAMA)
11841 AC_SUBST(XINERAMA_LINK)
11843 dnl ===================================================================
11844 dnl Test whether to build cairo or rely on the system version
11845 dnl ===================================================================
11847 if test "$USING_X11" = TRUE; then
11848     # Used in vcl/Library_vclplug_gen.mk
11849     test_cairo=yes
11852 if test "$test_cairo" = "yes"; then
11853     AC_MSG_CHECKING([whether to use the system cairo])
11855     : ${with_system_cairo:=$with_system_libs}
11856     if test "$with_system_cairo" = "yes"; then
11857         SYSTEM_CAIRO=TRUE
11858         AC_MSG_RESULT([yes])
11860         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11861         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11862         FilterLibs "${CAIRO_LIBS}"
11863         CAIRO_LIBS="${filteredlibs}"
11865         if test "$test_xrender" = "yes"; then
11866             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11867             AC_LANG_PUSH([C])
11868             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11869 #ifdef PictStandardA8
11870 #else
11871       return fail;
11872 #endif
11873 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11875             AC_LANG_POP([C])
11876         fi
11877     else
11878         SYSTEM_CAIRO=
11879         AC_MSG_RESULT([no])
11881         BUILD_TYPE="$BUILD_TYPE CAIRO"
11882     fi
11885 AC_SUBST(SYSTEM_CAIRO)
11886 AC_SUBST(CAIRO_CFLAGS)
11887 AC_SUBST(CAIRO_LIBS)
11889 dnl ===================================================================
11890 dnl Test whether to use avahi
11891 dnl ===================================================================
11892 if test "$_os" = "WINNT"; then
11893     # Windows uses bundled mDNSResponder
11894     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11895 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11896     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11897                       [ENABLE_AVAHI="TRUE"])
11898     AC_DEFINE(HAVE_FEATURE_AVAHI)
11899     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11900     FilterLibs "${AVAHI_LIBS}"
11901     AVAHI_LIBS="${filteredlibs}"
11904 AC_SUBST(ENABLE_AVAHI)
11905 AC_SUBST(AVAHI_CFLAGS)
11906 AC_SUBST(AVAHI_LIBS)
11908 dnl ===================================================================
11909 dnl Test whether to use liblangtag
11910 dnl ===================================================================
11911 SYSTEM_LIBLANGTAG=
11912 AC_MSG_CHECKING([whether to use system liblangtag])
11913 if test "$with_system_liblangtag" = yes; then
11914     SYSTEM_LIBLANGTAG=TRUE
11915     AC_MSG_RESULT([yes])
11916     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11917     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11918     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11919     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11920     FilterLibs "${LIBLANGTAG_LIBS}"
11921     LIBLANGTAG_LIBS="${filteredlibs}"
11922 else
11923     SYSTEM_LIBLANGTAG=
11924     AC_MSG_RESULT([no])
11925     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11926     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11927     if test "$COM" = "MSC"; then
11928         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11929     else
11930         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11931     fi
11933 AC_SUBST(SYSTEM_LIBLANGTAG)
11934 AC_SUBST(LIBLANGTAG_CFLAGS)
11935 AC_SUBST(LIBLANGTAG_LIBS)
11937 dnl ===================================================================
11938 dnl Test whether to build libpng or rely on the system version
11939 dnl ===================================================================
11941 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11943 dnl ===================================================================
11944 dnl Check for runtime JVM search path
11945 dnl ===================================================================
11946 if test "$ENABLE_JAVA" != ""; then
11947     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11948     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11949         AC_MSG_RESULT([yes])
11950         if ! test -d "$with_jvm_path"; then
11951             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11952         fi
11953         if ! test -d "$with_jvm_path"jvm; then
11954             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11955         fi
11956         JVM_ONE_PATH_CHECK="$with_jvm_path"
11957         AC_SUBST(JVM_ONE_PATH_CHECK)
11958     else
11959         AC_MSG_RESULT([no])
11960     fi
11963 dnl ===================================================================
11964 dnl Test for the presence of Ant and that it works
11965 dnl ===================================================================
11967 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11968     ANT_HOME=; export ANT_HOME
11969     WITH_ANT_HOME=; export WITH_ANT_HOME
11970     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11971         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11972             if test "$_os" = "WINNT"; then
11973                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11974             else
11975                 with_ant_home="$LODE_HOME/opt/ant"
11976             fi
11977         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11978             with_ant_home="$LODE_HOME/opt/ant"
11979         fi
11980     fi
11981     if test -z "$with_ant_home"; then
11982         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11983     else
11984         if test "$_os" = "WINNT"; then
11985             # AC_PATH_PROGS needs unix path
11986             with_ant_home=`cygpath -u "$with_ant_home"`
11987         fi
11988         AbsolutePath "$with_ant_home"
11989         with_ant_home=$absolute_path
11990         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11991         WITH_ANT_HOME=$with_ant_home
11992         ANT_HOME=$with_ant_home
11993     fi
11995     if test -z "$ANT"; then
11996         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11997     else
11998         # resolve relative or absolute symlink
11999         while test -h "$ANT"; do
12000             a_cwd=`pwd`
12001             a_basename=`basename "$ANT"`
12002             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12003             cd "`dirname "$ANT"`"
12004             cd "`dirname "$a_script"`"
12005             ANT="`pwd`"/"`basename "$a_script"`"
12006             cd "$a_cwd"
12007         done
12009         AC_MSG_CHECKING([if $ANT works])
12010         mkdir -p conftest.dir
12011         a_cwd=$(pwd)
12012         cd conftest.dir
12013         cat > conftest.java << EOF
12014         public class conftest {
12015             int testmethod(int a, int b) {
12016                     return a + b;
12017             }
12018         }
12021         cat > conftest.xml << EOF
12022         <project name="conftest" default="conftest">
12023         <target name="conftest">
12024             <javac srcdir="." includes="conftest.java">
12025             </javac>
12026         </target>
12027         </project>
12030         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
12031         if test $? = 0 -a -f ./conftest.class; then
12032             AC_MSG_RESULT([Ant works])
12033             if test -z "$WITH_ANT_HOME"; then
12034                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12035                 if test -z "$ANT_HOME"; then
12036                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12037                 fi
12038             else
12039                 ANT_HOME="$WITH_ANT_HOME"
12040             fi
12041         else
12042             echo "configure: Ant test failed" >&5
12043             cat conftest.java >&5
12044             cat conftest.xml >&5
12045             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
12046         fi
12047         cd "$a_cwd"
12048         rm -fr conftest.dir
12049     fi
12050     if test -z "$ANT_HOME"; then
12051         ANT_HOME="NO_ANT_HOME"
12052     else
12053         PathFormat "$ANT_HOME"
12054         ANT_HOME="$formatted_path"
12055         PathFormat "$ANT"
12056         ANT="$formatted_path"
12057     fi
12058     AC_SUBST(ANT_HOME)
12059     AC_SUBST(ANT)
12061     dnl Checking for ant.jar
12062     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12063         AC_MSG_CHECKING([Ant lib directory])
12064         if test -f $ANT_HOME/lib/ant.jar; then
12065             ANT_LIB="$ANT_HOME/lib"
12066         else
12067             if test -f $ANT_HOME/ant.jar; then
12068                 ANT_LIB="$ANT_HOME"
12069             else
12070                 if test -f /usr/share/java/ant.jar; then
12071                     ANT_LIB=/usr/share/java
12072                 else
12073                     if test -f /usr/share/ant-core/lib/ant.jar; then
12074                         ANT_LIB=/usr/share/ant-core/lib
12075                     else
12076                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12077                             ANT_LIB="$ANT_HOME/lib/ant"
12078                         else
12079                             if test -f /usr/share/lib/ant/ant.jar; then
12080                                 ANT_LIB=/usr/share/lib/ant
12081                             else
12082                                 AC_MSG_ERROR([Ant libraries not found!])
12083                             fi
12084                         fi
12085                     fi
12086                 fi
12087             fi
12088         fi
12089         PathFormat "$ANT_LIB"
12090         ANT_LIB="$formatted_path"
12091         AC_MSG_RESULT([Ant lib directory found.])
12092     fi
12093     AC_SUBST(ANT_LIB)
12095     ant_minver=1.6.0
12096     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12098     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12099     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
12100     ant_version_major=`echo $ant_version | cut -d. -f1`
12101     ant_version_minor=`echo $ant_version | cut -d. -f2`
12102     echo "configure: ant_version $ant_version " >&5
12103     echo "configure: ant_version_major $ant_version_major " >&5
12104     echo "configure: ant_version_minor $ant_version_minor " >&5
12105     if test "$ant_version_major" -ge "2"; then
12106         AC_MSG_RESULT([yes, $ant_version])
12107     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12108         AC_MSG_RESULT([yes, $ant_version])
12109     else
12110         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12111     fi
12113     rm -f conftest* core core.* *.core
12116 OOO_JUNIT_JAR=
12117 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12118     AC_MSG_CHECKING([for JUnit 4])
12119     if test "$with_junit" = "yes"; then
12120         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12121             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12122         elif test -e /usr/share/java/junit4.jar; then
12123             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12124         else
12125            if test -e /usr/share/lib/java/junit.jar; then
12126               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12127            else
12128               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12129            fi
12130         fi
12131     else
12132         OOO_JUNIT_JAR=$with_junit
12133     fi
12134     if test "$_os" = "WINNT"; then
12135         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12136     fi
12137     printf 'import org.junit.Before;' > conftest.java
12138     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12139         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12140     else
12141         AC_MSG_ERROR(
12142 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12143  specify its pathname via --with-junit=..., or disable it via --without-junit])
12144     fi
12145     rm -f conftest.class conftest.java
12146     if test $OOO_JUNIT_JAR != ""; then
12147     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12148     fi
12150 AC_SUBST(OOO_JUNIT_JAR)
12152 HAMCREST_JAR=
12153 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12154     AC_MSG_CHECKING([for included Hamcrest])
12155     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12156     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12157         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12158     else
12159         AC_MSG_RESULT([Not included])
12160         AC_MSG_CHECKING([for standalone hamcrest jar.])
12161         if test "$with_hamcrest" = "yes"; then
12162             if test -e /usr/share/lib/java/hamcrest.jar; then
12163                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12164             elif test -e /usr/share/java/hamcrest/core.jar; then
12165                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12166             else
12167                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12168             fi
12169         else
12170             HAMCREST_JAR=$with_hamcrest
12171         fi
12172         if test "$_os" = "WINNT"; then
12173             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12174         fi
12175         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12176             AC_MSG_RESULT([$HAMCREST_JAR])
12177         else
12178             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),
12179                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12180         fi
12181     fi
12182     rm -f conftest.class conftest.java
12184 AC_SUBST(HAMCREST_JAR)
12187 AC_SUBST(SCPDEFS)
12190 # check for wget and curl
12192 WGET=
12193 CURL=
12195 if test "$enable_fetch_external" != "no"; then
12197 CURL=`which curl 2>/dev/null`
12199 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12200     # wget new enough?
12201     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12202     if test $? -eq 0; then
12203         WGET=$i
12204         break
12205     fi
12206 done
12208 if test -z "$WGET" -a -z "$CURL"; then
12209     AC_MSG_ERROR([neither wget nor curl found!])
12214 AC_SUBST(WGET)
12215 AC_SUBST(CURL)
12218 # check for sha256sum
12220 SHA256SUM=
12222 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12223     eval "$i -a 256 --version" > /dev/null 2>&1
12224     ret=$?
12225     if test $ret -eq 0; then
12226         SHA256SUM="$i -a 256"
12227         break
12228     fi
12229 done
12231 if test -z "$SHA256SUM"; then
12232     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12233         eval "$i --version" > /dev/null 2>&1
12234         ret=$?
12235         if test $ret -eq 0; then
12236             SHA256SUM=$i
12237             break
12238         fi
12239     done
12242 if test -z "$SHA256SUM"; then
12243     AC_MSG_ERROR([no sha256sum found!])
12246 AC_SUBST(SHA256SUM)
12248 dnl ===================================================================
12249 dnl Dealing with l10n options
12250 dnl ===================================================================
12251 AC_MSG_CHECKING([which languages to be built])
12252 # get list of all languages
12253 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12254 # the sed command does the following:
12255 #   + if a line ends with a backslash, append the next line to it
12256 #   + adds " on the beginning of the value (after =)
12257 #   + adds " at the end of the value
12258 #   + removes en-US; we want to put it on the beginning
12259 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12260 [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)]
12261 ALL_LANGS="en-US $completelangiso"
12262 # check the configured localizations
12263 WITH_LANG="$with_lang"
12265 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12266 # (Norwegian is "nb" and "nn".)
12267 if test "$WITH_LANG" = "no"; then
12268     WITH_LANG=
12271 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12272     AC_MSG_RESULT([en-US])
12273 else
12274     AC_MSG_RESULT([$WITH_LANG])
12275     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12276     if test -z "$MSGFMT"; then
12277         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12278             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12279         elif test -x "/opt/lo/bin/msgfmt"; then
12280             MSGFMT="/opt/lo/bin/msgfmt"
12281         else
12282             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12283             if test -z "$MSGFMT"; then
12284                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12285             fi
12286         fi
12287     fi
12288     if test -z "$MSGUNIQ"; then
12289         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12290             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12291         elif test -x "/opt/lo/bin/msguniq"; then
12292             MSGUNIQ="/opt/lo/bin/msguniq"
12293         else
12294             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12295             if test -z "$MSGUNIQ"; then
12296                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12297             fi
12298         fi
12299     fi
12301 AC_SUBST(MSGFMT)
12302 AC_SUBST(MSGUNIQ)
12303 # check that the list is valid
12304 for lang in $WITH_LANG; do
12305     test "$lang" = "ALL" && continue
12306     # need to check for the exact string, so add space before and after the list of all languages
12307     for vl in $ALL_LANGS; do
12308         if test "$vl" = "$lang"; then
12309            break
12310         fi
12311     done
12312     if test "$vl" != "$lang"; then
12313         # if you're reading this - you prolly quoted your languages remove the quotes ...
12314         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12315     fi
12316 done
12317 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12318     echo $WITH_LANG | grep -q en-US
12319     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12321 # list with substituted ALL
12322 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12323 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12324 test "$WITH_LANG" = "en-US" && WITH_LANG=
12325 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12326     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12327     ALL_LANGS=`echo $ALL_LANGS qtz`
12329 AC_SUBST(ALL_LANGS)
12330 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12331 AC_SUBST(WITH_LANG)
12332 AC_SUBST(WITH_LANG_LIST)
12333 AC_SUBST(GIT_NEEDED_SUBMODULES)
12335 WITH_POOR_HELP_LOCALIZATIONS=
12336 if test -d "$SRC_ROOT/translations/source"; then
12337     for l in `ls -1 $SRC_ROOT/translations/source`; do
12338         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12339             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12340         fi
12341     done
12343 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12345 if test -n "$with_locales"; then
12346     WITH_LOCALES="$with_locales"
12348     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12349     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12350     # config_host/config_locales.h.in
12351     for locale in $WITH_LOCALES; do
12352         lang=${locale%_*}
12354         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12356         case $lang in
12357         hi|mr*ne)
12358             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12359             ;;
12360         bg|ru)
12361             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12362             ;;
12363         esac
12364     done
12365 else
12366     AC_DEFINE(WITH_LOCALE_ALL)
12368 AC_SUBST(WITH_LOCALES)
12370 dnl git submodule update --reference
12371 dnl ===================================================================
12372 if test -n "${GIT_REFERENCE_SRC}"; then
12373     for repo in ${GIT_NEEDED_SUBMODULES}; do
12374         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12375             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12376         fi
12377     done
12379 AC_SUBST(GIT_REFERENCE_SRC)
12381 dnl git submodules linked dirs
12382 dnl ===================================================================
12383 if test -n "${GIT_LINK_SRC}"; then
12384     for repo in ${GIT_NEEDED_SUBMODULES}; do
12385         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12386             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12387         fi
12388     done
12390 AC_SUBST(GIT_LINK_SRC)
12392 dnl branding
12393 dnl ===================================================================
12394 AC_MSG_CHECKING([for alternative branding images directory])
12395 # initialize mapped arrays
12396 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12397 brand_files="$BRAND_INTRO_IMAGES about.svg"
12399 if test -z "$with_branding" -o "$with_branding" = "no"; then
12400     AC_MSG_RESULT([none])
12401     DEFAULT_BRAND_IMAGES="$brand_files"
12402 else
12403     if ! test -d $with_branding ; then
12404         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12405     else
12406         AC_MSG_RESULT([$with_branding])
12407         CUSTOM_BRAND_DIR="$with_branding"
12408         for lfile in $brand_files
12409         do
12410             if ! test -f $with_branding/$lfile ; then
12411                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12412                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12413             else
12414                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12415             fi
12416         done
12417         check_for_progress="yes"
12418     fi
12420 AC_SUBST([BRAND_INTRO_IMAGES])
12421 AC_SUBST([CUSTOM_BRAND_DIR])
12422 AC_SUBST([CUSTOM_BRAND_IMAGES])
12423 AC_SUBST([DEFAULT_BRAND_IMAGES])
12426 AC_MSG_CHECKING([for 'intro' progress settings])
12427 PROGRESSBARCOLOR=
12428 PROGRESSSIZE=
12429 PROGRESSPOSITION=
12430 PROGRESSFRAMECOLOR=
12431 PROGRESSTEXTCOLOR=
12432 PROGRESSTEXTBASELINE=
12434 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12435     source "$with_branding/progress.conf"
12436     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12437 else
12438     AC_MSG_RESULT([none])
12441 AC_SUBST(PROGRESSBARCOLOR)
12442 AC_SUBST(PROGRESSSIZE)
12443 AC_SUBST(PROGRESSPOSITION)
12444 AC_SUBST(PROGRESSFRAMECOLOR)
12445 AC_SUBST(PROGRESSTEXTCOLOR)
12446 AC_SUBST(PROGRESSTEXTBASELINE)
12449 AC_MSG_CHECKING([for extra build ID])
12450 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12451     EXTRA_BUILDID="$with_extra_buildid"
12453 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12454 if test -n "$EXTRA_BUILDID" ; then
12455     AC_MSG_RESULT([$EXTRA_BUILDID])
12456 else
12457     AC_MSG_RESULT([not set])
12459 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12461 OOO_VENDOR=
12462 AC_MSG_CHECKING([for vendor])
12463 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12464     OOO_VENDOR="$USERNAME"
12466     if test -z "$OOO_VENDOR"; then
12467         OOO_VENDOR="$USER"
12468     fi
12470     if test -z "$OOO_VENDOR"; then
12471         OOO_VENDOR="`id -u -n`"
12472     fi
12474     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12475 else
12476     OOO_VENDOR="$with_vendor"
12477     AC_MSG_RESULT([$OOO_VENDOR])
12479 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12480 AC_SUBST(OOO_VENDOR)
12482 if test "$_os" = "Android" ; then
12483     ANDROID_PACKAGE_NAME=
12484     AC_MSG_CHECKING([for Android package name])
12485     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12486         if test -n "$ENABLE_DEBUG"; then
12487             # Default to the package name that makes ndk-gdb happy.
12488             ANDROID_PACKAGE_NAME="org.libreoffice"
12489         else
12490             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12491         fi
12493         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12494     else
12495         ANDROID_PACKAGE_NAME="$with_android_package_name"
12496         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12497     fi
12498     AC_SUBST(ANDROID_PACKAGE_NAME)
12501 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12502 if test "$with_compat_oowrappers" = "yes"; then
12503     WITH_COMPAT_OOWRAPPERS=TRUE
12504     AC_MSG_RESULT(yes)
12505 else
12506     WITH_COMPAT_OOWRAPPERS=
12507     AC_MSG_RESULT(no)
12509 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12511 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12512 AC_MSG_CHECKING([for install dirname])
12513 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12514     INSTALLDIRNAME="$with_install_dirname"
12516 AC_MSG_RESULT([$INSTALLDIRNAME])
12517 AC_SUBST(INSTALLDIRNAME)
12519 AC_MSG_CHECKING([for prefix])
12520 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12521 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12522 PREFIXDIR="$prefix"
12523 AC_MSG_RESULT([$PREFIXDIR])
12524 AC_SUBST(PREFIXDIR)
12526 LIBDIR=[$(eval echo $(eval echo $libdir))]
12527 AC_SUBST(LIBDIR)
12529 DATADIR=[$(eval echo $(eval echo $datadir))]
12530 AC_SUBST(DATADIR)
12532 MANDIR=[$(eval echo $(eval echo $mandir))]
12533 AC_SUBST(MANDIR)
12535 DOCDIR=[$(eval echo $(eval echo $docdir))]
12536 AC_SUBST(DOCDIR)
12538 BINDIR=[$(eval echo $(eval echo $bindir))]
12539 AC_SUBST(BINDIR)
12541 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12542 AC_SUBST(INSTALLDIR)
12544 TESTINSTALLDIR="${BUILDDIR}/test-install"
12545 AC_SUBST(TESTINSTALLDIR)
12548 # ===================================================================
12549 # OAuth2 id and secrets
12550 # ===================================================================
12552 AC_MSG_CHECKING([for Google Drive client id and secret])
12553 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12554     AC_MSG_RESULT([not set])
12555     GDRIVE_CLIENT_ID="\"\""
12556     GDRIVE_CLIENT_SECRET="\"\""
12557 else
12558     AC_MSG_RESULT([set])
12559     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12560     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12562 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12563 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12565 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12566 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12567     AC_MSG_RESULT([not set])
12568     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12569     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12570 else
12571     AC_MSG_RESULT([set])
12572     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12573     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12575 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12576 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12578 AC_MSG_CHECKING([for OneDrive client id and secret])
12579 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12580     AC_MSG_RESULT([not set])
12581     ONEDRIVE_CLIENT_ID="\"\""
12582     ONEDRIVE_CLIENT_SECRET="\"\""
12583 else
12584     AC_MSG_RESULT([set])
12585     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12586     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12588 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12589 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12592 dnl ===================================================================
12593 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12594 dnl --enable-dependency-tracking configure option
12595 dnl ===================================================================
12596 AC_MSG_CHECKING([whether to enable dependency tracking])
12597 if test "$enable_dependency_tracking" = "no"; then
12598     nodep=TRUE
12599     AC_MSG_RESULT([no])
12600 else
12601     AC_MSG_RESULT([yes])
12603 AC_SUBST(nodep)
12605 dnl ===================================================================
12606 dnl Number of CPUs to use during the build
12607 dnl ===================================================================
12608 AC_MSG_CHECKING([for number of processors to use])
12609 # plain --with-parallelism is just the default
12610 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12611     if test "$with_parallelism" = "no"; then
12612         PARALLELISM=0
12613     else
12614         PARALLELISM=$with_parallelism
12615     fi
12616 else
12617     if test "$enable_icecream" = "yes"; then
12618         PARALLELISM="40"
12619     else
12620         case `uname -s` in
12622         Darwin|FreeBSD|NetBSD|OpenBSD)
12623             PARALLELISM=`sysctl -n hw.ncpu`
12624             ;;
12626         Linux)
12627             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12628         ;;
12629         # what else than above does profit here *and* has /proc?
12630         *)
12631             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12632             ;;
12633         esac
12635         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12636         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12637     fi
12640 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12641     if test -z "$with_parallelism"; then
12642             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12643             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12644             PARALLELISM="1"
12645     else
12646         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."
12647     fi
12650 if test $PARALLELISM -eq 0; then
12651     AC_MSG_RESULT([explicit make -j option needed])
12652 else
12653     AC_MSG_RESULT([$PARALLELISM])
12655 AC_SUBST(PARALLELISM)
12657 IWYU_PATH="$with_iwyu"
12658 AC_SUBST(IWYU_PATH)
12659 if test ! -z "$IWYU_PATH"; then
12660     if test ! -f "$IWYU_PATH"; then
12661         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12662     fi
12666 # Set up ILIB for MSVC build
12668 ILIB1=
12669 if test "$build_os" = "cygwin"; then
12670     ILIB="."
12671     if test -n "$JAVA_HOME"; then
12672         ILIB="$ILIB;$JAVA_HOME/lib"
12673     fi
12674     ILIB1=-link
12675     if test "$BITNESS_OVERRIDE" = 64; then
12676         ILIB="$ILIB;$COMPATH/lib/x64"
12677         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12678         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12679         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12680         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12681             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12682             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12683         fi
12684         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12685         ucrtlibpath_formatted=$formatted_path
12686         ILIB="$ILIB;$ucrtlibpath_formatted"
12687         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12688     else
12689         ILIB="$ILIB;$COMPATH/lib/x86"
12690         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12691         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12692         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12693         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12694             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12695             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12696         fi
12697         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12698         ucrtlibpath_formatted=$formatted_path
12699         ILIB="$ILIB;$ucrtlibpath_formatted"
12700         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12701     fi
12702     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12703         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12704     else
12705         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12706     fi
12708     AC_SUBST(ILIB)
12711 # ===================================================================
12712 # Creating bigger shared library to link against
12713 # ===================================================================
12714 AC_MSG_CHECKING([whether to create huge library])
12715 MERGELIBS=
12717 if test $_os = iOS -o $_os = Android; then
12718     # Never any point in mergelibs for these as we build just static
12719     # libraries anyway...
12720     enable_mergelibs=no
12723 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12724     if test $_os != Linux -a $_os != WINNT; then
12725         add_warning "--enable-mergelibs is not tested for this platform"
12726     fi
12727     MERGELIBS="TRUE"
12728     AC_MSG_RESULT([yes])
12729 else
12730     AC_MSG_RESULT([no])
12732 AC_SUBST([MERGELIBS])
12734 dnl ===================================================================
12735 dnl icerun is a wrapper that stops us spawning tens of processes
12736 dnl locally - for tools that can't be executed on the compile cluster
12737 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12738 dnl ===================================================================
12739 AC_MSG_CHECKING([whether to use icerun wrapper])
12740 ICECREAM_RUN=
12741 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12742     ICECREAM_RUN=icerun
12743     AC_MSG_RESULT([yes])
12744 else
12745     AC_MSG_RESULT([no])
12747 AC_SUBST(ICECREAM_RUN)
12749 dnl ===================================================================
12750 dnl Setup the ICECC_VERSION for the build the same way it was set for
12751 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12752 dnl ===================================================================
12753 x_ICECC_VERSION=[\#]
12754 if test -n "$ICECC_VERSION" ; then
12755     x_ICECC_VERSION=
12757 AC_SUBST(x_ICECC_VERSION)
12758 AC_SUBST(ICECC_VERSION)
12760 dnl ===================================================================
12762 AC_MSG_CHECKING([MPL subset])
12763 MPL_SUBSET=
12765 if test "$enable_mpl_subset" = "yes"; then
12766     warn_report=false
12767     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12768         warn_report=true
12769     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12770         warn_report=true
12771     fi
12772     if test "$warn_report" = "true"; then
12773         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12774     fi
12775     if test "x$enable_postgresql_sdbc" != "xno"; then
12776         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12777     fi
12778     if test "$enable_lotuswordpro" = "yes"; then
12779         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12780     fi
12781     if test "$WITH_WEBDAV" = "neon"; then
12782         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12783     fi
12784     if test -n "$ENABLE_POPPLER"; then
12785         if test "x$SYSTEM_POPPLER" = "x"; then
12786             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12787         fi
12788     fi
12789     # cf. m4/libo_check_extension.m4
12790     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12791         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12792     fi
12793     for theme in $WITH_THEMES; do
12794         case $theme in
12795         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12796             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12797         *) : ;;
12798         esac
12799     done
12801     ENABLE_OPENGL_TRANSITIONS=
12803     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12804         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12805     fi
12807     MPL_SUBSET="TRUE"
12808     AC_DEFINE(MPL_HAVE_SUBSET)
12809     AC_MSG_RESULT([only])
12810 else
12811     AC_MSG_RESULT([no restrictions])
12813 AC_SUBST(MPL_SUBSET)
12815 dnl ===================================================================
12817 AC_MSG_CHECKING([formula logger])
12818 ENABLE_FORMULA_LOGGER=
12820 if test "x$enable_formula_logger" = "xyes"; then
12821     AC_MSG_RESULT([yes])
12822     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12823     ENABLE_FORMULA_LOGGER=TRUE
12824 elif test -n "$ENABLE_DBGUTIL" ; then
12825     AC_MSG_RESULT([yes])
12826     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12827     ENABLE_FORMULA_LOGGER=TRUE
12828 else
12829     AC_MSG_RESULT([no])
12832 AC_SUBST(ENABLE_FORMULA_LOGGER)
12834 dnl ===================================================================
12835 dnl Setting up the environment.
12836 dnl ===================================================================
12837 AC_MSG_NOTICE([setting up the build environment variables...])
12839 AC_SUBST(COMPATH)
12841 if test "$build_os" = "cygwin"; then
12842     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12843         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12844         ATL_INCLUDE="$COMPATH/atlmfc/include"
12845     elif test -d "$COMPATH/atlmfc/lib"; then
12846         ATL_LIB="$COMPATH/atlmfc/lib"
12847         ATL_INCLUDE="$COMPATH/atlmfc/include"
12848     else
12849         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12850         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12851     fi
12852     if test "$BITNESS_OVERRIDE" = 64; then
12853         ATL_LIB="$ATL_LIB/x64"
12854     else
12855         ATL_LIB="$ATL_LIB/x86"
12856     fi
12857     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12858     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12860     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12861     PathFormat "/usr/bin/find.exe"
12862     FIND="$formatted_path"
12863     PathFormat "/usr/bin/sort.exe"
12864     SORT="$formatted_path"
12865     PathFormat "/usr/bin/grep.exe"
12866     WIN_GREP="$formatted_path"
12867     PathFormat "/usr/bin/ls.exe"
12868     WIN_LS="$formatted_path"
12869     PathFormat "/usr/bin/touch.exe"
12870     WIN_TOUCH="$formatted_path"
12871 else
12872     FIND=find
12873     SORT=sort
12876 AC_SUBST(ATL_INCLUDE)
12877 AC_SUBST(ATL_LIB)
12878 AC_SUBST(FIND)
12879 AC_SUBST(SORT)
12880 AC_SUBST(WIN_GREP)
12881 AC_SUBST(WIN_LS)
12882 AC_SUBST(WIN_TOUCH)
12884 AC_SUBST(BUILD_TYPE)
12886 AC_SUBST(SOLARINC)
12888 PathFormat "$PERL"
12889 PERL="$formatted_path"
12890 AC_SUBST(PERL)
12892 if test -n "$TMPDIR"; then
12893     TEMP_DIRECTORY="$TMPDIR"
12894 else
12895     TEMP_DIRECTORY="/tmp"
12897 if test "$build_os" = "cygwin"; then
12898     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12900 AC_SUBST(TEMP_DIRECTORY)
12902 # setup the PATH for the environment
12903 if test -n "$LO_PATH_FOR_BUILD"; then
12904     LO_PATH="$LO_PATH_FOR_BUILD"
12905 else
12906     LO_PATH="$PATH"
12908     case "$host_os" in
12910     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12911         if test "$ENABLE_JAVA" != ""; then
12912             pathmunge "$JAVA_HOME/bin" "after"
12913         fi
12914         ;;
12916     cygwin*)
12917         # Win32 make needs native paths
12918         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12919             LO_PATH=`cygpath -p -m "$PATH"`
12920         fi
12921         if test "$BITNESS_OVERRIDE" = 64; then
12922             # needed for msi packaging
12923             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12924         fi
12925         # .NET 4.6 and higher don't have bin directory
12926         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12927             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12928         fi
12929         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12930         pathmunge "$CSC_PATH" "before"
12931         pathmunge "$MIDL_PATH" "before"
12932         pathmunge "$AL_PATH" "before"
12933         pathmunge "$MSPDB_PATH" "before"
12934         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12935             pathmunge "$CL_PATH" "before"
12936         fi
12937         if test -n "$MSBUILD_PATH" ; then
12938             pathmunge "$MSBUILD_PATH" "before"
12939         fi
12940         if test "$BITNESS_OVERRIDE" = 64; then
12941             pathmunge "$COMPATH/bin/amd64" "before"
12942             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12943         else
12944             pathmunge "$COMPATH/bin" "before"
12945             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12946         fi
12947         if test "$ENABLE_JAVA" != ""; then
12948             if test -d "$JAVA_HOME/jre/bin/client"; then
12949                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12950             fi
12951             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12952                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12953             fi
12954             pathmunge "$JAVA_HOME/bin" "before"
12955         fi
12956         ;;
12958     solaris*)
12959         pathmunge "/usr/css/bin" "before"
12960         if test "$ENABLE_JAVA" != ""; then
12961             pathmunge "$JAVA_HOME/bin" "after"
12962         fi
12963         ;;
12964     esac
12967 AC_SUBST(LO_PATH)
12969 libo_FUZZ_SUMMARY
12971 # Generate a configuration sha256 we can use for deps
12972 if test -f config_host.mk; then
12973     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12975 if test -f config_host_lang.mk; then
12976     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12979 CFLAGS=$my_original_CFLAGS
12980 CXXFLAGS=$my_original_CXXFLAGS
12981 CPPFLAGS=$my_original_CPPFLAGS
12983 AC_LINK_FILES([include], [include])
12984 AC_CONFIG_FILES([config_host.mk
12985                  config_host_lang.mk
12986                  Makefile
12987                  bin/bffvalidator.sh
12988                  bin/odfvalidator.sh
12989                  bin/officeotron.sh
12990                  instsetoo_native/util/openoffice.lst
12991                  setup_native/source/packinfo/finals_instsetoo.txt
12992                  sysui/desktop/macosx/Info.plist])
12993 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12994 AC_CONFIG_HEADERS([config_host/config_clang.h])
12995 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12996 AC_CONFIG_HEADERS([config_host/config_eot.h])
12997 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12998 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12999 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
13000 AC_CONFIG_HEADERS([config_host/config_dbus.h])
13001 AC_CONFIG_HEADERS([config_host/config_features.h])
13002 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
13003 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
13004 AC_CONFIG_HEADERS([config_host/config_firebird.h])
13005 AC_CONFIG_HEADERS([config_host/config_folders.h])
13006 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
13007 AC_CONFIG_HEADERS([config_host/config_gio.h])
13008 AC_CONFIG_HEADERS([config_host/config_global.h])
13009 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
13010 AC_CONFIG_HEADERS([config_host/config_java.h])
13011 AC_CONFIG_HEADERS([config_host/config_langs.h])
13012 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13013 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
13014 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13015 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
13016 AC_CONFIG_HEADERS([config_host/config_locales.h])
13017 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13018 AC_CONFIG_HEADERS([config_host/config_oox.h])
13019 AC_CONFIG_HEADERS([config_host/config_options.h])
13020 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
13021 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
13022 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13023 AC_CONFIG_HEADERS([config_host/config_vendor.h])
13024 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13025 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13026 AC_CONFIG_HEADERS([config_host/config_version.h])
13027 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13028 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13029 AC_CONFIG_HEADERS([config_host/config_python.h])
13030 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
13031 AC_OUTPUT
13033 if test "$CROSS_COMPILING" = TRUE; then
13034     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13037 # touch the config timestamp file
13038 if test ! -f config_host.mk.stamp; then
13039     echo > config_host.mk.stamp
13040 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
13041     echo "Host Configuration unchanged - avoiding scp2 stamp update"
13042 else
13043     echo > config_host.mk.stamp
13046 # touch the config lang timestamp file
13047 if test ! -f config_host_lang.mk.stamp; then
13048     echo > config_host_lang.mk.stamp
13049 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
13050     echo "Language Configuration unchanged - avoiding scp2 stamp update"
13051 else
13052     echo > config_host_lang.mk.stamp
13056 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
13057         -a "$build_os" = "cygwin"; then
13059 cat << _EOS
13060 ****************************************************************************
13061 WARNING:
13062 Your make version is known to be horribly slow, and hard to debug
13063 problems with. To get a reasonably functional make please do:
13065 to install a pre-compiled binary make for Win32
13067  mkdir -p /opt/lo/bin
13068  cd /opt/lo/bin
13069  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
13070  cp make-4.2.1-msvc.exe make
13071  chmod +x make
13073 to install from source:
13074 place yourself in a working directory of you choice.
13076  git clone git://git.savannah.gnu.org/make.git
13078  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
13079  set PATH=%PATH%;C:\Cygwin\bin
13080  [or Cygwin64, if that is what you have]
13081  cd path-to-make-repo-you-cloned-above
13082  build_w32.bat --without-guile
13084 should result in a WinRel/gnumake.exe.
13085 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13087 Then re-run autogen.sh
13089 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13090 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13092 _EOS
13093 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
13094     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
13099 cat << _EOF
13100 ****************************************************************************
13102 To build, run:
13103 $GNUMAKE
13105 To view some help, run:
13106 $GNUMAKE help
13108 _EOF
13110 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13111     cat << _EOF
13112 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
13113 _EOF
13115     if test $_os = Darwin; then
13116         echo open instdir/$PRODUCTNAME.app
13117     else
13118         echo instdir/program/soffice
13119     fi
13120     cat << _EOF
13122 If you want to run the smoketest, run:
13123 $GNUMAKE check
13125 _EOF
13128 if test -f warn; then
13129     cat warn
13130     rm warn
13133 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: